stages: - dependencies - build - publish variables: TZ: "UTC" GIT_DEPTH: "1" .build-job: &build-job image: docker.io/library/debian:bullseye needs: [ ] before_script: - apt -qq update - apt install -y --no-install-recommends -qq build-essential ca-certificates cmake curl libreadline-dev libsystemd-dev tar lua: <<: *build-job stage: dependencies script: make -C deps/lua artifacts: expire_in: 14 days paths: [ "deps/lua/dist" ] pcre2: <<: *build-job stage: dependencies script: make -C deps/pcre2 artifacts: expire_in: 14 days paths: [ "deps/pcre2/dist" ] quictls: <<: *build-job stage: dependencies script: make -C deps/quictls artifacts: expire_in: 14 days paths: [ "deps/quictls/dist", "deps/quictls/quictls-*-dist.tar.gz" ] haproxy: <<: *build-job stage: build script: - apt install -y --no-install-recommends -qq git - make -C haproxy needs: - job: lua artifacts: true - job: pcre2 artifacts: true - job: quictls artifacts: true artifacts: expire_in: 14 days paths: [ "haproxy/dist", "haproxy/haproxy-*-dist.tar.gz" ] docker: stage: publish image: name: gcr.io/kaniko-project/executor:debug entrypoint: [ "" ] before_script: - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"gitlab-ci-token\",\"password\":\"$CI_JOB_TOKEN\"}}}" > /kaniko/.docker/config.json script: | set -eu export HAPROXY_VER="2.6" export JOB_TIMESTAMP="$(date -D '%Y-%m-%dT%H:%M:%S%Z' -d "$CI_JOB_STARTED_AT" +'%Y%m%d-%H%M')" echo "Building image with" echo " -> haproxy version: 2.6" echo " -> debian codename: $DEBIAN_CODENAME" echo " -> git commit hash: $CI_COMMIT_SHORT_SHA" echo " -> build timestamp: $JOB_TIMESTAMP" export IMAGE_TAG_UNIQUE="$HAPROXY_VER-$DEBIAN_CODENAME-$CI_COMMIT_SHORT_SHA-$JOB_TIMESTAMP" export IMAGE_TAG_ROLLING_COMMIT="git-$CI_COMMIT_SHORT_SHA" export IMAGE_TAG_ROLLING_GITREF="$CI_COMMIT_REF_SLUG" export IMAGE_TAG_VERSIONS="$HAPROXY_VER-$DEBIAN_CODENAME" if [ "$CI_COMMIT_REF_NAME" != "$CI_DEFAULT_BRANCH" ]; then export IMAGE_TAG_VERSIONS="branch-$CI_COMMIT_REF_SLUG-$IMAGE_TAG_VERSIONS" echo "Git reference $CI_COMMIT_REF_NAME is not the default branch. Rewriting git rolling tag as $IMAGE_TAG_VERSIONS" fi echo "***" echo "Will build and push image as:" echo "- $CI_REGISTRY_IMAGE:$IMAGE_TAG_UNIQUE" echo "- $CI_REGISTRY_IMAGE:$IMAGE_TAG_ROLLING_COMMIT" echo "- $CI_REGISTRY_IMAGE:$IMAGE_TAG_ROLLING_GITREF" echo "- $CI_REGISTRY_IMAGE:$IMAGE_TAG_VERSIONS" echo "***" ( set -x; /kaniko/executor \ --context . \ --dockerfile Dockerfile \ --build-arg "CANONICAL_VERSION=$IMAGE_TAG_UNIQUE" \ --destination "$CI_REGISTRY_IMAGE:$IMAGE_TAG_UNIQUE" \ --destination "$CI_REGISTRY_IMAGE:$IMAGE_TAG_ROLLING_COMMIT" \ --destination "$CI_REGISTRY_IMAGE:$IMAGE_TAG_ROLLING_GITREF" \ --destination "$CI_REGISTRY_IMAGE:$IMAGE_TAG_VERSIONS" \ --single-snapshot ) needs: - job: quictls artifacts: true - job: haproxy artifacts: true