Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate and verify labels of Docker image during release #10013

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .ci/jobs/docker_zeebe.dsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ pipelineJob('zeebe-docker') {
parameters {
stringParam('BRANCH', 'main', 'Which branch to build and push?')
stringParam('VERSION', '', 'Zeebe version to build the image for')
stringParam('REVISION', '', 'The Git commit used to build the image; can be omitted except for releases')
stringParam('DATE', '', 'The ISO-8601 date when the packaged artifact was built; can be omitted except for releases')
booleanParam('IS_LATEST', false, 'Should the docker image be tagged as camunda/zeebe:latest?')
booleanParam('PUSH', false, 'Should the docker image be pushed to docker hub?')
booleanParam('VERIFY', false', 'Should we verify the Docker image before pushing it?')
}
}
18 changes: 18 additions & 0 deletions .ci/pipelines/docker_zeebe.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ spec:
PUSH = "${params.PUSH}"
IMAGE = "camunda/zeebe"
TAG = docker_tag("${params.VERSION}")
REVISION = "${params.REVISION}"
DATE = "${param.DATE}"
VERIFY = "${param.VERIFY}"
}

stages {
Expand All @@ -79,6 +82,12 @@ spec:
container('maven') {
sh '.ci/scripts/docker/prepare.sh'
}

// extract to a script if we need to do more here; these are necessary for the
// verify script
container('docker') {
sh 'apk add -q bash jq'
}
}
}

Expand All @@ -90,6 +99,15 @@ spec:
}
}

stage('Verify') {
when { environment name: 'VERIFY', value: 'true' }
steps {
container('docker') {
sh "./docker/test/verify.sh '${env.IMAGE}:${env.TAG}'"
}
}
}

stage('Upload') {
when { environment name: 'PUSH', value: 'true' }
steps {
Expand Down
6 changes: 4 additions & 2 deletions .ci/pipelines/release_zeebe.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,15 @@ spec:
}

stage('Docker Image') {
when { expression { return params.PUSH_DOCKER } }
steps {
build job: 'zeebe-docker', parameters: [
string(name: 'BRANCH', value: env.RELEASE_BRANCH),
string(name: 'VERSION', value: params.RELEASE_VERSION),
string(name: 'REVISION', value: env.GIT_COMMIT),
string(name: 'DATE', value: java.time.Instant.now().toString()),
booleanParam(name: 'IS_LATEST', value: params.IS_LATEST),
booleanParam(name: 'PUSH', value: true)
booleanParam(name: 'PUSH', value: params.PUSH_DOCKER),
booleanParam(name: 'VERIFY', value: true)
]
}
}
Expand Down
7 changes: 6 additions & 1 deletion .ci/scripts/docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/sh -eux

echo "Building Zeebe Docker image ${IMAGE}:${TAG}"
docker build --no-cache --build-arg DISTBALL=camunda-zeebe.tar.gz -t ${IMAGE}:${TAG} --target app .
docker build --no-cache \
--build-arg DISTBALL=camunda-zeebe.tar.gz \
--build-arg DATE="${DATE}" \
--build-arg REVISION="${REVISION}" \
--build-arg VERSION="${VERSION}" \
-t "${IMAGE}:${TAG}" --target app .
3 changes: 3 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ pipeline {
DOCKER_BUILDKIT = "1"
IMAGE = "camunda/zeebe"
TAG = 'current-test'
VERSION = readMavenPom(file: 'bom/pom.xml').getVersion()
REVISION = "${env.GIT_COMMIT}"
DATE = java.time.Instant.now().toString()
}

steps {
Expand Down