diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f44acd00c1d957852b0e8c14ecacff0a05114654..8df4a11ed5604f8ecd377d2c5c22f2f2c628fa0c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ stages: include: - local: .gitlab/lint.yaml - - local: .gitlab/pixiecore.yaml + - remote: https://gitlab.com/ethz-hpc/pipelines/-/raw/main/scripts/container/build-push.yaml - template: Security/Secret-Detection.gitlab-ci.yml - template: Security/SAST.gitlab-ci.yml @@ -22,3 +22,21 @@ workflow: # don't run merge request pipelines - if: $CI_PIPELINE_SOURCE == "merge_request_event" when: never + +variables: + CACHE: "yes" + +pixiecore: + variables: + DOCKERFILE: image/Dockerfile + before_script: + - > + BUILD_EXTRA_ARGS="$BUILD_EXTRA_ARGS + --build-arg=REVISION=${TAG:-$CI_COMMIT_SHORT_SHA} + --build-arg=CREATED=$(date '+%Y-%m-%d %H:%M:%S%:z')" + # disable cache for tagged releases, default branch and schedules + - > + [ -z "$CI_COMMIT_TAG" ] && [ "$CI_COMMIT_REF_NAME" != "$CI_DEFAULT_BRANCH" ] \ + && [ "$CI_PIPELINE_SOURCE" != "schedule" ] || CACHE=no + + extends: .kaniko-build diff --git a/.gitlab/pixiecore.yaml b/.gitlab/pixiecore.yaml deleted file mode 100644 index 39f56d76d997f48469735a707d2d83d0244bcfc4..0000000000000000000000000000000000000000 --- a/.gitlab/pixiecore.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -pixiecore: - image: - name: gcr.io/kaniko-project/executor:debug - entrypoint: [""] - stage: build - script: - # add an extra tag - - if [ -n "${TAG}" ]; then EXTRA_ARGS="--destination=${CI_REGISTRY_IMAGE}:${TAG}"; fi - - /kaniko/executor - --context="${CI_PROJECT_DIR}" - --ignore-path=/usr/bin/newuidmap - --ignore-path=/usr/bin/newgidmap - --build-arg=REVISION="${TAG:-$CI_COMMIT_SHORT_SHA}" - --build-arg=CREATED="$(date '+%Y-%m-%d %H:%M:%S%:z')" - --dockerfile="${CI_PROJECT_DIR}/image/Dockerfile" - --destination="${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}" $EXTRA_ARGS - rules: - - if: $CI_COMMIT_TAG - variables: - TAG: $CI_COMMIT_TAG - - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - variables: - TAG: latest - - if: $CI_PIPELINE_SOURCE == "manual" - - if: $CI_PIPELINE_SOURCE == "schedule" - - changes: - paths: - - .gitlab/pixiecore*.yaml - - .gitlab-ci.yml - - image/* - - cmd/* - - go.*