-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: add jenkinsfile to build images (#2187)
* docker: add jenkinsfile to build images * Update Jenkinsfile * Update Jenkinsfile * Update Jenkinsfile
- Loading branch information
Showing
2 changed files
with
71 additions
and
36 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
pipeline { | ||
agent none | ||
stages { | ||
stage('Docker Build') { | ||
parallel { | ||
stage('Linux x64') { | ||
agent { | ||
label "dockerBuild&&linux&&x64" | ||
} | ||
steps { | ||
dockerBuild('amd64') | ||
} | ||
} | ||
stage('Linux aarch64') { | ||
agent { | ||
label "dockerBuild&&linux&&aarch64" | ||
} | ||
steps { | ||
dockerBuild('arm64') | ||
} | ||
} | ||
stage('Linux ppc64le') { | ||
agent { | ||
label "dockerBuild&&linux&&ppc64le" | ||
} | ||
steps { | ||
dockerBuild('ppc64le') | ||
} | ||
} | ||
} | ||
} | ||
stage('Docker Manifest') { | ||
agent { | ||
label "dockerBuild&&linux&&x64" | ||
} | ||
environment { | ||
DOCKER_CLI_EXPERIMENTAL = "enabled" | ||
} | ||
steps { | ||
dockerManifest() | ||
} | ||
} | ||
} | ||
} | ||
|
||
def dockerBuild(architecture) { | ||
git poll: false, url: 'https://github.com/adoptium/infrastructure.git' | ||
sh label: '', script: "docker build -t adoptopenjdk/centos7_build_image:linux-$architecture -f ansible/Dockerfile.CentOS7 ." | ||
// dockerhub is the ID of the credentials stored in Jenkins | ||
docker.withRegistry('https://index.docker.io/v1/', 'dockerhub') { | ||
sh label: '', script: "docker push adoptopenjdk/centos7_build_image:linux-$architecture" | ||
} | ||
} | ||
|
||
def dockerManifest() { | ||
// dockerhub is the ID of the credentials stored in Jenkins | ||
docker.withRegistry('https://index.docker.io/v1/', 'dockerhub') { | ||
git poll: false, url: 'https://github.com/adoptium/infrastructure.git' | ||
sh ''' | ||
export TARGET="adoptopenjdk/centos7_build_image" | ||
AMD64=$TARGET:linux-amd64 | ||
ARM64=$TARGET:linux-arm64 | ||
PPC64LE=$TARGET:linux-ppc64le | ||
docker manifest create $TARGET $AMD64 $ARM64 $PPC64LE | ||
docker manifest annotate $TARGET $AMD64 --arch amd64 --os linux | ||
docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux | ||
docker manifest annotate $TARGET $PPC64LE --arch ppc64le --os linux | ||
docker manifest push $TARGET | ||
''' | ||
} | ||
} |