Skip to content

Commit

Permalink
build(ci): verify labels of Docker image
Browse files Browse the repository at this point in the history
Updates the release process to generate the correct labels for the
Docker image, and verify them, failing the release process (and not
pushing the image) if they are wrong.

Ideally, this would be done before the Maven release to avoid wasting
time if the image would produce the wrong labels. Doing this is quite a
bit of refactoring of the CI pipeline unfortunately, and producing the
wrong labels is most likely an issue with the CI pipeline itself, which
should not happen very often. Errors in the Dockerfile itself would be
checked by the GHA pipeline, which should cover the important cases and
runs on each pull.
  • Loading branch information
npepinpe committed Aug 5, 2022
1 parent ccb8527 commit 062a15f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
12 changes: 12 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 @@ -90,6 +93,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
8 changes: 7 additions & 1 deletion .ci/pipelines/release_zeebe.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ spec:
container('golang') {
sh '.ci/scripts/release/prepare-go.sh'
}
container('docker') {
sh '.ci/scripts/release/prepare-docker.sh'
}
}
}

Expand Down Expand Up @@ -151,8 +154,11 @@ spec:
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: true),
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

0 comments on commit 062a15f

Please sign in to comment.