haproxy/.gitlab-ci.yml

118 lines
3.4 KiB
YAML
Raw Normal View History

2022-06-05 10:01:53 +05:30
stages:
- quictls
- haproxy
.default-vars: &default-vars
TZ: "UTC"
GIT_DEPTH: "1"
QUICTLS_VERSION: "3.0.3"
QUICTLS_ARCHIVE: "$CI_PROJECT_DIR/quictls/quictls.tar.gz"
quictls:build:
image: docker.io/library/debian:bullseye
stage: quictls
needs: [ ]
before_script:
- apt -qq update
- apt install -y --no-install-recommends -qq build-essential ca-certificates curl tar
script:
- cd quictls || exit 1
- make clone
- make dist
- make archive
variables:
<<: *default-vars
BUILDDIR: "$CI_PROJECT_DIR/quictls/build"
DESTDIR: "$CI_PROJECT_DIR/quictls/dist"
artifacts:
expire_in: 14 days
paths: [ "$QUICTLS_ARCHIVE" ]
quictls:upload:
image: docker.io/curlimages/curl:latest
stage: quictls
needs:
- job: quictls:build
artifacts: true
script: |
set -eu
curl \
-H"JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file "$QUICTLS_ARCHIVE" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/quictls/$QUICTLS_VERSION/quictls.tar.gz"
variables:
<<: *default-vars
GIT_STRATEGY: none
2022-06-05 10:01:53 +05:30
.docker-build: &docker-build
2022-06-05 10:02:42 +05:30
stage: build
2022-06-05 10:01:53 +05:30
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
needs: [ ]
variables:
GIT_DEPTH: "1"
TZ: "UTC"
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
2022-06-05 10:07:36 +05:30
source "./common.config"
source "./$BUILD_TYPE.config"
2022-06-05 10:01:53 +05:30
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: $HAPROXY_VER"
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
export IMAGE_PATH="$CI_REGISTRY_IMAGE/$BUILD_TYPE"
echo "***"
echo "Will build and push image as:"
echo "- $IMAGE_PATH:$IMAGE_TAG_UNIQUE"
echo "- $IMAGE_PATH:$IMAGE_TAG_ROLLING_COMMIT"
echo "- $IMAGE_PATH:$IMAGE_TAG_ROLLING_GITREF"
echo "- $IMAGE_PATH:$IMAGE_TAG_VERSIONS"
echo "***"
(
set -x;
/kaniko/executor \
--single-snapshot \
--context . \
--dockerfile Dockerfile \
--build-arg "DEBIAN_CODENAME=$DEBIAN_CODENAME" \
--build-arg "QUICTLS_SOURCE=$QUICTLS_SOURCE" \
--build-arg "HAPROXY_SOURCE_REPO=$HAPROXY_SOURCE_REPO" \
--build-arg "HAPROXY_SOURCE_BRANCH=$HAPROXY_SOURCE_BRANCH" \
--destination "$IMAGE_PATH:$IMAGE_TAG_UNIQUE" \
--destination "$IMAGE_PATH:$IMAGE_TAG_ROLLING_COMMIT" \
--destination "$IMAGE_PATH:$IMAGE_TAG_ROLLING_GITREF" \
2022-06-05 10:11:44 +05:30
--destination "$IMAGE_PATH:$IMAGE_TAG_VERSIONS"
2022-06-05 10:01:53 +05:30
)
mainline:
<<: *docker-build
variables:
BUILD_TYPE: mainline
nightly:
<<: *docker-build
variables:
BUILD_TYPE: nightly