Be helpful to CI/CD job maintainers
It's often hard to debug/maintain/improve a job when you can't observe any of the (many!) auto-generated CI env. vars. Print them all out on every job. Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
This commit is contained in:
@@ -17,10 +17,14 @@ build:
|
||||
script:
|
||||
- 'mkdir -p /kaniko/.docker'
|
||||
- 'echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json'
|
||||
- |
|
||||
echo "Select CI env. vars.:";
|
||||
printenv | egrep '^CI_' | sort
|
||||
# N/B: There could be more than one merge-request open with this branch's HEAD
|
||||
- |
|
||||
IMAGE_TAG="${CI_COMMIT_TAG:+${CI_COMMIT_TAG}}${CI_COMMIT_BRANCH:+${CI_COMMIT_BRANCH/main/latest}}";
|
||||
if [[ -n "$CI_OPEN_MERGE_REQUESTS" ]]; then
|
||||
IMAGE_TAG="mr${CI_MERGE_REQUEST_ID}";
|
||||
IMAGE_TAG=mr$(echo "${CI_OPEN_MERGE_REQUESTS}" | cut -d, -f -1 | cut -d\! -f 2);
|
||||
fi
|
||||
echo "Building/Pushing to: ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}";
|
||||
- |
|
||||
|
||||
Reference in New Issue
Block a user