2022-06-05 05:31:53 +01:00
stages :
2022-06-06 05:54:43 +01:00
- dependencies
2022-06-06 08:14:11 +01:00
- build
2022-06-14 04:46:37 +01:00
- test
2022-06-06 08:14:11 +01:00
- publish
2022-06-06 05:46:20 +01:00
2022-08-23 21:23:35 +01:00
default :
retry :
max : 2
when :
- api_failure
- runner_system_failure
- scheduler_failure
- stale_schedule
- stuck_or_timeout_failure
- unknown_failure
2022-06-14 01:11:59 +01:00
variables : &default-variables
2022-06-06 05:46:20 +01:00
TZ : "UTC"
GIT_DEPTH : "1"
2022-12-25 14:19:13 +01:00
.build-resources-xs : &build-resources-xs
KUBERNETES_MEMORY_REQUEST : 512Mi
KUBERNETES_MEMORY_LIMIT : 512Mi
.build-resources-s : &build-resources-s
KUBERNETES_MEMORY_REQUEST : 1Gi
KUBERNETES_MEMORY_LIMIT : 1Gi
.build-resources-m : &build-resources-m
KUBERNETES_MEMORY_REQUEST : 2Gi
KUBERNETES_MEMORY_LIMIT : 2Gi
2022-06-06 05:46:20 +01:00
2022-06-14 01:11:59 +01:00
.haproxy_stable : &haproxy-stable
2022-12-01 19:42:19 +00:00
HAPROXY_GITREPO : "https://git.haproxy.org/?p=haproxy-2.7.git"
2023-02-09 13:09:24 +00:00
HAPROXY_VERSION : 2.7 -stable
2023-03-18 06:41:50 +00:00
# https://git.haproxy.org/?p=haproxy-2.7.git;a=commit;h=8d230219e15295a3c4757f94916aafcf540a7337
HAPROXY_GITREF : "8d230219e15295a3c4757f94916aafcf540a7337"
2023-03-23 09:24:58 +00:00
BUILD_PATCHES_DIR : "patches-stable"
2022-06-14 01:11:59 +01:00
.haproxy_dev : &haproxy-dev
2022-06-22 16:45:46 +02:00
HAPROXY_GITREPO : "https://git.haproxy.org/?p=haproxy.git"
2022-12-01 19:42:19 +00:00
HAPROXY_VERSION : 2.8 -dev
2023-03-23 09:21:02 +00:00
# https://git.haproxy.org/?p=haproxy.git;a=commit;h=1751db140ab609e38af8218efbd23427115a42aa
HAPROXY_GITREF : "1751db140ab609e38af8218efbd23427115a42aa"
2023-03-23 09:24:58 +00:00
BUILD_PATCHES_DIR : "patches-dev"
2022-06-14 01:11:59 +01:00
2022-06-06 05:54:43 +01:00
.build-job : &build-job
2022-06-11 11:34:33 +01:00
image : registry.gitlab.com/mangadex-pub/debuilder/buster:main
2022-06-06 05:46:20 +01:00
needs : [ ]
before_script :
- apt -qq update
2022-06-14 04:46:37 +01:00
- apt install -y --no-install-recommends -qq build-essential ca-certificates cmake curl git libpcre2-dev libreadline-dev libsystemd-dev tar zlib1g-dev
2022-08-03 10:05:20 +01:00
- cc --version
2022-06-14 04:46:37 +01:00
#----------------------
# Common dependencies
#----------------------
2022-06-06 05:54:43 +01:00
lua :
<< : *build-job
stage : dependencies
2022-06-06 06:18:58 +01:00
script : make -C deps/lua
2022-12-25 14:19:13 +01:00
variables :
<< : *default-variables
<< : *build-resources-xs
2022-06-06 05:46:20 +01:00
artifacts :
2022-06-06 08:51:31 +01:00
expire_in : 7 days
paths : [ "deps/lua/lua-dist.tar.gz" ]
2022-06-05 05:31:53 +01:00
2022-06-06 05:54:43 +01:00
pcre2 :
<< : *build-job
stage : dependencies
2022-06-06 06:18:58 +01:00
script : make -C deps/pcre2
2022-12-25 14:19:13 +01:00
variables :
<< : *default-variables
<< : *build-resources-xs
2022-06-06 05:54:43 +01:00
artifacts :
2022-06-06 08:51:31 +01:00
expire_in : 7 days
paths : [ "deps/pcre2/pcre2-dist.tar.gz" ]
2022-06-05 05:31:53 +01:00
2022-06-06 05:54:43 +01:00
quictls :
<< : *build-job
stage : dependencies
2022-06-14 04:46:37 +01:00
script : make -C deps/quictls
2022-12-25 14:19:13 +01:00
variables :
<< : *default-variables
<< : *build-resources-m
2022-06-06 05:54:43 +01:00
artifacts :
2022-06-06 08:51:31 +01:00
expire_in : 7 days
paths : [ "deps/quictls/quictls-dist.tar.gz" ]
2022-06-05 05:31:53 +01:00
2022-06-14 04:46:37 +01:00
vtest :
<< : *build-job
stage : dependencies
script : make -C deps/vtest
2022-12-25 14:19:13 +01:00
variables :
<< : *default-variables
2022-12-25 14:33:46 +01:00
<< : *build-resources-xs
2022-06-14 04:46:37 +01:00
artifacts :
expire_in : 7 days
paths : [ "deps/vtest/dist/vtest" ]
.needs-dependencies : &needs-dependencies
- job : lua
artifacts : true
- job : pcre2
artifacts : true
- job : quictls
artifacts : true
#----------------------
# HAProxy job templates
#----------------------
2022-06-14 01:11:59 +01:00
.haproxy-build : &haproxy-build
2022-06-06 05:54:43 +01:00
<< : *build-job
2022-06-06 08:14:11 +01:00
stage : build
2022-06-06 06:52:47 +01:00
script :
2022-06-06 08:51:31 +01:00
- apt install -y --no-install-recommends -qq bzip2 git
- mkdir deps/lua/dist && tar -C deps/lua/dist -xf deps/lua/lua-dist.tar.gz
- mkdir deps/pcre2/dist && tar -C deps/pcre2/dist -xf deps/pcre2/pcre2-dist.tar.gz
- mkdir deps/quictls/dist && tar -C deps/quictls/dist -xf deps/quictls/quictls-dist.tar.gz
2023-03-23 09:24:58 +00:00
- make -C haproxy HAPROXY_GITREPO="$HAPROXY_GITREPO" HAPROXY_VERSION="$HAPROXY_VERSION" HAPROXY_GITREF="$HAPROXY_GITREF" BUILD_PATCHES_DIR="$BUILD_PATCHES_DIR"
2022-06-14 04:46:37 +01:00
needs : *needs-dependencies
artifacts :
expire_in : 7 days
paths : [ "haproxy/dist" , "haproxy/haproxy-dist.tar.gz" ]
.haproxy-regtests : &haproxy-regtests
<< : *build-job
stage : test
script :
- apt install -y --no-install-recommends -qq bzip2 git
- mkdir deps/lua/dist && tar -C deps/lua/dist -xf deps/lua/lua-dist.tar.gz
- mkdir deps/pcre2/dist && tar -C deps/pcre2/dist -xf deps/pcre2/pcre2-dist.tar.gz
- mkdir deps/quictls/dist && tar -C deps/quictls/dist -xf deps/quictls/quictls-dist.tar.gz
2023-03-23 09:24:58 +00:00
- make -C haproxy HAPROXY_GITREPO="$HAPROXY_GITREPO" HAPROXY_VERSION="$HAPROXY_VERSION" HAPROXY_GITREF="$HAPROXY_GITREF" BUILD_PATCHES_DIR="$BUILD_PATCHES_DIR" build test
2022-06-14 04:46:37 +01:00
needs :
- *needs-dependencies
- job : vtest
artifacts : true
.haproxy-debian : &haproxy-debian
<< : *build-job
stage : publish
script :
- apt install -y --no-install-recommends -qq bzip2 devscripts debhelper pkg-config
- mkdir deps/lua/dist && tar -C deps/lua/dist -xf deps/lua/lua-dist.tar.gz
- mkdir deps/pcre2/dist && tar -C deps/pcre2/dist -xf deps/pcre2/pcre2-dist.tar.gz
- mkdir deps/quictls/dist && tar -C deps/quictls/dist -xf deps/quictls/quictls-dist.tar.gz
- export BUILD_MESSAGE="$CI_COMMIT_MESSAGE"
2023-03-23 09:24:58 +00:00
- make -C haproxy dist-deb HAPROXY_GITREPO="$HAPROXY_GITREPO" HAPROXY_VERSION="$HAPROXY_VERSION" HAPROXY_GITREF="$HAPROXY_GITREF" BUILD_PATCHES_DIR="$BUILD_PATCHES_DIR"
2022-06-14 01:11:59 +01:00
- |
2022-06-14 04:46:37 +01:00
set -euo pipefail
2022-06-14 01:11:59 +01:00
2022-06-14 04:46:37 +01:00
PACKAGE_NAME="haproxy-debian"
DEB_VERSION="$(cat haproxy/*.dsc | grep -E '^Version:' | cut -d' ' -f2-)"
2022-06-14 01:11:59 +01:00
if [ "$CI_COMMIT_REF_NAME" != "$CI_DEFAULT_BRANCH" ]; then
2022-06-14 04:46:37 +01:00
export PACKAGE_NAME="haproxy-debian-branches"
export DEB_VERSION="branch-$CI_COMMIT_REF_SLUG"
echo "Git reference $CI_COMMIT_REF_NAME is not the default branch. Setting coordinates to $PACKAGE_NAME/$DEB_VERSION"
2022-06-14 01:11:59 +01:00
fi
2022-08-18 07:59:29 +01:00
GITLAB_PACKAGE_VERSION=$(echo "${DEB_VERSION}" | tr '~' '-')
echo "Publishing Debian package version ${DEB_VERSION} to haproxy-debian@${GITLAB_PACKAGE_VERSION}"
2022-06-14 04:46:37 +01:00
for artifact in haproxy/haproxy*.deb; do
artifact_filename=$(basename "${artifact}")
gitlab_is_lame_artifact_filename=$(echo "${artifact_filename}" | tr '~' '-' | tr '+' '-')
echo "Uploading to haproxy-debian@${DEB_VERSION}... ${artifact_filename} -> ${gitlab_is_lame_artifact_filename}"
curl -fsSL -H"JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file "${artifact}" \
2022-08-18 07:59:29 +01:00
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${GITLAB_PACKAGE_VERSION}/${gitlab_is_lame_artifact_filename}"
2022-06-14 04:46:37 +01:00
echo "OK"
done
2022-06-06 05:54:43 +01:00
artifacts :
2022-06-06 08:51:31 +01:00
expire_in : 7 days
2022-06-14 04:46:37 +01:00
paths : [ "haproxy/haproxy*" ]
2022-06-06 08:14:11 +01:00
2022-06-14 04:46:37 +01:00
.haproxy-tarball : &haproxy-tarball
image : docker.io/curlimages/curl:latest
stage : publish
script : |
set -eu
2022-06-14 01:11:59 +01:00
2022-06-14 04:46:37 +01:00
PKG_VER=$HAPROXY_VERSION
if [ "$CI_COMMIT_REF_NAME" != "$CI_DEFAULT_BRANCH" ]; then
export PKG_VER="branch-$CI_COMMIT_REF_SLUG-$HAPROXY_VERSION-$HAPROXY_GITREF"
echo "Git reference $CI_COMMIT_REF_NAME is not the default branch. Setting version to $PKG_VER"
fi
curl -fsSL \
-H"JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file "haproxy/haproxy-dist.tar.gz" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/haproxy/$PKG_VER/haproxy-$HAPROXY_VERSION.tar.gz"
2022-06-14 01:11:59 +01:00
2022-06-14 04:46:37 +01:00
.haproxy-docker : &haproxy-docker
2022-06-06 08:14:11 +01:00
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
2022-06-06 08:24:06 +01:00
export DEBIAN_CODENAME="bullseye"
2022-08-18 07:59:29 +01:00
export JOB_TIMESTAMP="$(date -D '%Y-%m-%dT%H:%M:%S' -d "$CI_JOB_STARTED_AT" +'%Y%m%d-%H%M')"
2022-06-06 08:14:11 +01:00
2022-12-01 19:42:19 +00:00
# A.B.C -> A.B, otherwise preserve original (eg 2.x-dev -> 2.x-dev)
2022-06-14 01:11:59 +01:00
if echo "$HAPROXY_VERSION" | grep -E '([0-9]\.){2}[0-9]'; then
export HAPROXY_SHORTVER="$(echo "$HAPROXY_VERSION" | cut -d'.' -f1-2)"
else
export HAPROXY_SHORTVER=$HAPROXY_VERSION
fi
2022-08-18 07:59:29 +01:00
2022-06-06 08:14:11 +01:00
echo "Building image with"
2022-06-09 12:59:28 +01:00
echo " -> haproxy version: $HAPROXY_VERSION ($HAPROXY_SHORTVER)"
2022-06-06 08:14:11 +01:00
echo " -> debian codename: $DEBIAN_CODENAME"
echo " -> git commit hash: $CI_COMMIT_SHORT_SHA"
echo " -> build timestamp: $JOB_TIMESTAMP"
2022-06-14 01:25:29 +01:00
export IMAGE_TAG_UNIQUE="$CI_COMMIT_SHORT_SHA-$JOB_TIMESTAMP-$HAPROXY_SHORTVER-$HAPROXY_GITREF"
export IMAGE_TAG_ROLLING_COMMIT="git-$CI_COMMIT_SHORT_SHA-$HAPROXY_VERSION"
export IMAGE_TAG_ROLLING_GITREF="$CI_COMMIT_REF_SLUG-$HAPROXY_VERSION"
2022-06-06 08:14:11 +01:00
2022-06-14 01:39:10 +01:00
export IMAGE_TAG_VERSIONS="$HAPROXY_VERSION-$DEBIAN_CODENAME"
export IMAGE_TAG_SHORTVER="$HAPROXY_SHORTVER-$DEBIAN_CODENAME"
2022-06-06 08:14:11 +01:00
if [ "$CI_COMMIT_REF_NAME" != "$CI_DEFAULT_BRANCH" ]; then
export IMAGE_TAG_VERSIONS="branch-$CI_COMMIT_REF_SLUG-$IMAGE_TAG_VERSIONS"
2022-06-09 12:59:28 +01:00
export IMAGE_TAG_SHORTVER="branch-$CI_COMMIT_REF_SLUG-$IMAGE_TAG_SHORTVER"
echo "Git reference $CI_COMMIT_REF_NAME is not the default branch. Rewriting git rolling tag as $IMAGE_TAG_VERSIONS / $IMAGE_TAG_SHORTVER"
2022-06-06 08:14:11 +01:00
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"
2022-06-09 12:59:28 +01:00
echo "- $CI_REGISTRY_IMAGE:$IMAGE_TAG_SHORTVER"
2022-06-06 08:14:11 +01:00
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" \
2022-06-09 12:59:28 +01:00
--destination "$CI_REGISTRY_IMAGE:$IMAGE_TAG_SHORTVER" \
2022-06-06 08:14:11 +01:00
--single-snapshot
)
2022-06-14 01:11:59 +01:00
2022-06-14 04:46:37 +01:00
#----------------------
# HAProxy jobs
#----------------------
build:stable :
<< : *haproxy-build
variables :
<< : *default-variables
2022-12-25 14:19:13 +01:00
<< : *build-resources-s
2022-06-14 04:46:37 +01:00
<< : *haproxy-stable
build:dev :
<< : *haproxy-build
variables :
<< : *default-variables
2022-12-25 14:19:13 +01:00
<< : *build-resources-s
2022-06-14 04:46:37 +01:00
<< : *haproxy-dev
regtests:stable :
<< : *haproxy-regtests
variables :
<< : *default-variables
2022-12-25 14:19:13 +01:00
<< : *build-resources-m
2022-06-14 04:46:37 +01:00
<< : *haproxy-stable
regtests:dev :
<< : *haproxy-regtests
variables :
<< : *default-variables
2022-12-25 14:19:13 +01:00
<< : *build-resources-m
2022-06-14 04:46:37 +01:00
<< : *haproxy-dev
haproxy-tarball:stable :
<< : *haproxy-tarball
2022-06-14 01:11:59 +01:00
variables :
<< : *default-variables
2022-12-25 14:19:13 +01:00
<< : *build-resources-xs
2022-06-14 01:11:59 +01:00
<< : *haproxy-stable
2022-06-06 08:14:11 +01:00
needs :
2022-06-14 04:46:37 +01:00
- job : "regtests:stable"
artifacts : false
- job : "build:stable"
2022-06-06 08:14:11 +01:00
artifacts : true
2022-06-06 08:51:31 +01:00
2022-06-14 04:46:37 +01:00
haproxy-tarball:dev :
<< : *haproxy-tarball
2022-06-14 01:11:59 +01:00
variables :
<< : *default-variables
2022-12-25 14:19:13 +01:00
<< : *build-resources-xs
2022-06-14 01:11:59 +01:00
<< : *haproxy-dev
2022-06-06 08:51:31 +01:00
needs :
2022-06-14 04:46:37 +01:00
- job : "regtests:dev"
artifacts : false
- job : "build:dev"
2022-06-06 08:51:31 +01:00
artifacts : true
2022-06-07 04:06:13 +01:00
2022-06-14 04:46:37 +01:00
docker:stable :
<< : *haproxy-docker
variables :
<< : *default-variables
2022-12-25 14:19:13 +01:00
<< : *build-resources-m
2022-06-14 04:46:37 +01:00
<< : *haproxy-stable
2022-06-07 07:14:34 +01:00
needs :
2022-06-14 04:46:37 +01:00
- job : "quictls"
2022-06-07 07:14:34 +01:00
artifacts : true
2022-06-14 04:46:37 +01:00
- job : "regtests:stable"
artifacts : false
- job : "build:stable"
2022-06-07 07:14:34 +01:00
artifacts : true
2022-06-14 04:46:37 +01:00
docker:dev :
<< : *haproxy-docker
variables :
<< : *default-variables
2022-12-25 14:19:13 +01:00
<< : *build-resources-m
2022-06-14 04:46:37 +01:00
<< : *haproxy-dev
needs :
- job : "quictls"
artifacts : true
- job : "regtests:dev"
artifacts : false
- job : "build:dev"
2022-06-07 07:14:34 +01:00
artifacts : true
2022-06-14 01:11:59 +01:00
debian:stable :
2022-06-14 04:46:37 +01:00
<< : *haproxy-debian
2022-06-14 01:11:59 +01:00
variables :
<< : *default-variables
2022-12-25 20:07:22 +01:00
<< : *build-resources-m
2022-06-14 01:11:59 +01:00
<< : *haproxy-stable
2022-06-14 04:46:37 +01:00
needs :
- *needs-dependencies
- job : "regtests:stable"
artifacts : false
2022-06-14 01:11:59 +01:00
debian:dev :
2022-06-14 04:46:37 +01:00
<< : *haproxy-debian
2022-06-14 01:11:59 +01:00
variables :
<< : *default-variables
2022-12-25 20:07:22 +01:00
<< : *build-resources-m
2022-06-14 01:11:59 +01:00
<< : *haproxy-dev
2022-06-14 04:46:37 +01:00
needs :
- *needs-dependencies
- job : "regtests:dev"
artifacts : false
quictls:tarball :
image : docker.io/curlimages/curl:latest
stage : publish
script : |
set -eu
PKG_VER="$(cat deps/quictls/Makefile | head -n1 | cut -d'=' -f2 | tr -d ' ')"
QUICTLS_VER="$PKG_VER"
if [ "$CI_COMMIT_REF_NAME" != "$CI_DEFAULT_BRANCH" ]; then
export PKG_VER="branch-$CI_COMMIT_REF_SLUG"
echo "Git reference $CI_COMMIT_REF_NAME is not the default branch. Setting version to $PKG_VER"
fi
curl -fsSL \
-H"JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file "deps/quictls/quictls-dist.tar.gz" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/quictls/$PKG_VER/quictls-$QUICTLS_VER.tar.gz"
needs :
- job : quictls
artifacts : true
- job : "regtests:dev"
artifacts : false
- job : "regtests:stable"
artifacts : false
2022-12-25 14:19:13 +01:00
variables :
<< : *default-variables
<< : *build-resources-xs