From 5daaa407c8270d530d9d7d630b4da945ab8fc6f0 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 16 Nov 2022 09:12:30 -0500 Subject: [PATCH 1/4] Tweak some tag defaults Signed-off-by: Chris Evich --- Containerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Containerfile b/Containerfile index b00638a..978c651 100644 --- a/Containerfile +++ b/Containerfile @@ -107,11 +107,11 @@ ENTRYPOINT ["/usr/local/bin/gitlab-runner-wrapper"] # Gitlab-runner configuration options. Default to unprivileged (nested) # runner. Privileged is required to permit nested container image building. -ARG RUNNER_NAME="pipglr" +ARG RUNNER_NAME="qontainers-pipglr" ARG PRIVILEGED_RUNNER="false" # Tags allow pinning jobs to specific runners, comma-separated list of # tags to add to runner (no spaces!) -ARG RUNNER_TAGS="podman_in_podman" +ARG RUNNER_TAGS="podman-in-podman" # Permit running jobs without any tag at all ARG RUNNER_UNTAGGED="true" ENV REGISTER_NON_INTERACTIVE="true" \ From 64ce093a874e5d89d0e079a092b71a01d250907f Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 16 Nov 2022 09:21:56 -0500 Subject: [PATCH 2/4] Ignore local pre-commit configuration files Signed-off-by: Chris Evich --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fcf7246 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.pre-commit-config.yaml From 341fbb80300d723d3e717c0635c8050624992610 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 16 Nov 2022 09:07:44 -0500 Subject: [PATCH 3/4] Fix kaniko command-line For whatever reason, line-breaks must be used regardless of string-block marker `|` or `>-`. Fix this. Also, support a fork/pull/MR model allowing contributors to run pipelines on their fork w/ push to their registry. In this case, images should be tagged by MR number to be helpful. Signed-off-by: Chris Evich --- .gitlab-ci.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5be0e1b..49e4de6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,13 +15,18 @@ build: BASE_TAG: latest FLAVOR: stable script: - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - IMAGE_TAG="${CI_COMMIT_TAG:+${CI_COMMIT_TAG}}${CI_MERGE_REQUEST_IID:+mr${CI_MERGE_REQUEST_IID}${CI_COMMIT_BRANCH:+${CI_COMMIT_BRANCH/main/latest}}" - - >- - /kaniko/executor - --context $CI_PROJECT_DIR - --dockerfile $CI_PROJECT_DIR/Containerfile - --destination "$CI_REGISTRY_IMAGE:${IAMGE_TAG}" - --build-arg "BASE_TAG=$BASE_TAG" + - 'mkdir -p /kaniko/.docker' + - 'echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json' + - | + 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}"; + fi + echo "Building/Pushing to: ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}"; + - | + /kaniko/executor \ + --context $CI_PROJECT_DIR \ + --dockerfile $CI_PROJECT_DIR/Containerfile \ + --destination "${CI_REGISTRY_IMAGE}:${IMAGE_TAG}" \ + --build-arg "BASE_TAG=$BASE_TAG" \ --build-arg "FLAVOR=$FLAVOR" From 04b61422a94fdea85b4f93834390a5c242ebeda0 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 16 Nov 2022 09:48:10 -0500 Subject: [PATCH 4/4] 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 --- .gitlab-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 49e4de6..4dbeb04 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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}"; - |