Skip to content

Commit

Permalink
docker: add jenkinsfile to build images (#2187)
Browse files Browse the repository at this point in the history
* docker: add jenkinsfile to build images

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile
  • Loading branch information
gdams authored May 18, 2021
1 parent 3ae29a7 commit 2dc6274
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 36 deletions.
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

71 changes: 71 additions & 0 deletions Jenkinsfile
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
'''
}
}

0 comments on commit 2dc6274

Please sign in to comment.