gitlab: attach $CI_PIPELINE_ID to created containers

GitLab schedules use `master` as CI_COMMIT_REF_SLUG which causes
unpredictable behaviour when scheduling multiple releases at the same
time. Recently the 19.07 schedule would use 21.02 images for testing,
which succeeded even though it would fail on actual 19.07 containers.

A simple workaround is to attach the $CI_PIPELINE_ID to the test
containers. This issue won't happen to PRs since the CI_COMMIT_REF_SLUG
would then be set to the PRs branch name.

Signed-off-by: Paul Spooren <mail@aparcar.org>
pull/99/head
Paul Spooren 2022-02-22 17:52:58 +01:00
parent 4afdd248d6
commit f4689b15d7
3 changed files with 10 additions and 10 deletions

View File

@ -7,11 +7,11 @@ build-imagebuilder_x86-64:
TARGET=$(echo "$CI_JOB_NAME" | cut -d _ -f 2-)
VERSION="${VERSION:-snapshot}"
docker tag "$DOCKER_IMAGE:$TARGET-$VERSION" \
"$DOCKER_IMAGE:imagebuilder-$TARGET-$CI_COMMIT_REF_SLUG"
docker push "$DOCKER_IMAGE:imagebuilder-$TARGET-$CI_COMMIT_REF_SLUG"
"$DOCKER_IMAGE:imagebuilder-$TARGET-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
docker push "$DOCKER_IMAGE:imagebuilder-$TARGET-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
test-imagebuilder:
image: "$CI_REGISTRY_IMAGE:imagebuilder-x86-64-$CI_COMMIT_REF_SLUG"
image: "$CI_REGISTRY_IMAGE:imagebuilder-x86-64-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
stage: test
script:
- cd /home/build/openwrt/

View File

@ -11,11 +11,11 @@ build-rootfs_x86-64:
TARGET=$(echo "$CI_JOB_NAME" | cut -d _ -f 2-)
VERSION="${VERSION:-snapshot}"
docker tag "$DOCKER_IMAGE:$TARGET-$VERSION" \
"$DOCKER_IMAGE:rootfs-$TARGET-$CI_COMMIT_REF_SLUG"
docker push "$DOCKER_IMAGE:rootfs-$TARGET-$CI_COMMIT_REF_SLUG"
"$DOCKER_IMAGE:rootfs-$TARGET-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
docker push "$DOCKER_IMAGE:rootfs-$TARGET-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
test-rootfs:
image: "$CI_REGISTRY_IMAGE:rootfs-x86-64-$CI_COMMIT_REF_SLUG"
image: "$CI_REGISTRY_IMAGE:rootfs-x86-64-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
stage: test
except:
variables:

View File

@ -7,8 +7,8 @@
bash docker-sdk.sh
VERSION="${VERSION:-snapshot}"
docker tag "$DOCKER_IMAGE:$TARGETS-$VERSION" \
"$DOCKER_IMAGE:sdk-$TARGETS-$CI_COMMIT_REF_SLUG"
docker push "$DOCKER_IMAGE:sdk-$TARGETS-$CI_COMMIT_REF_SLUG"
"$DOCKER_IMAGE:sdk-$TARGETS-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
docker push "$DOCKER_IMAGE:sdk-$TARGETS-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
build-sdk_x86_64:
variables:
@ -40,12 +40,12 @@ build-sdk_mips_24kc:
test-sdk_x86_64:
extends: .test-sdk
image: "$CI_REGISTRY_IMAGE:sdk-x86-64-$CI_COMMIT_REF_SLUG"
image: "$CI_REGISTRY_IMAGE:sdk-x86-64-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
script:
- ls ./bin/packages/x86_64/base/busybox*
test-sdk_mips_24kc:
extends: .test-sdk
image: "$CI_REGISTRY_IMAGE:sdk-ath79-generic-$CI_COMMIT_REF_SLUG"
image: "$CI_REGISTRY_IMAGE:sdk-ath79-generic-$CI_COMMIT_REF_SLUG-$CI_PIPELINE_ID"
script:
- ls ./bin/packages/mips_24kc/base/busybox*