Update CI
This commit is contained in:
parent
5971388de4
commit
c41d71333b
140
.gitlab-ci.yml
140
.gitlab-ci.yml
@ -1,117 +1,53 @@
|
|||||||
stages:
|
stages:
|
||||||
- quictls
|
- dependencies
|
||||||
- haproxy
|
- haproxy
|
||||||
|
|
||||||
.default-vars: &default-vars
|
variables:
|
||||||
TZ: "UTC"
|
TZ: "UTC"
|
||||||
GIT_DEPTH: "1"
|
GIT_DEPTH: "1"
|
||||||
QUICTLS_VERSION: "3.0.3"
|
|
||||||
QUICTLS_ARCHIVE: "$CI_PROJECT_DIR/quictls/quictls.tar.gz"
|
|
||||||
|
|
||||||
quictls:build:
|
.build-job: &build-job
|
||||||
image: docker.io/library/debian:bullseye
|
image: docker.io/library/debian:bullseye
|
||||||
stage: quictls
|
|
||||||
needs: [ ]
|
needs: [ ]
|
||||||
before_script:
|
before_script:
|
||||||
- apt -qq update
|
- apt -qq update
|
||||||
- apt install -y --no-install-recommends -qq build-essential ca-certificates curl tar
|
- apt install -y --no-install-recommends -qq build-essential ca-certificates curl git tar
|
||||||
script:
|
|
||||||
- cd quictls || exit 1
|
lua:
|
||||||
- make clone
|
<<: *build-job
|
||||||
- make dist
|
stage: dependencies
|
||||||
- make archive
|
script: make -C deps/lua
|
||||||
variables:
|
|
||||||
<<: *default-vars
|
|
||||||
BUILDDIR: "$CI_PROJECT_DIR/quictls/build"
|
|
||||||
DESTDIR: "$CI_PROJECT_DIR/quictls/dist"
|
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 14 days
|
expire_in: 14 days
|
||||||
paths: [ "$QUICTLS_ARCHIVE" ]
|
paths: [ "deps/lua/dist" ]
|
||||||
|
|
||||||
quictls:upload:
|
pcre2:
|
||||||
image: docker.io/curlimages/curl:latest
|
<<: *build-job
|
||||||
stage: quictls
|
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", "quictls-*-dist.tar.gz" ]
|
||||||
|
|
||||||
|
haproxy:
|
||||||
|
<<: *build-job
|
||||||
|
stage: haproxy
|
||||||
|
script: make -C haproxy
|
||||||
needs:
|
needs:
|
||||||
- job: quictls:build
|
- job: lua
|
||||||
artifacts: true
|
artifacts: true
|
||||||
script: |
|
- job: pcre2
|
||||||
set -eu
|
artifacts: true
|
||||||
curl \
|
- job: quictls
|
||||||
-H"JOB-TOKEN: $CI_JOB_TOKEN" \
|
artifacts: true
|
||||||
--upload-file "$QUICTLS_ARCHIVE" \
|
artifacts:
|
||||||
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/quictls/$QUICTLS_VERSION/quictls.tar.gz"
|
expire_in: 14 days
|
||||||
variables:
|
paths: [ "haproxy/dist" ]
|
||||||
<<: *default-vars
|
|
||||||
GIT_STRATEGY: none
|
|
||||||
|
|
||||||
.docker-build: &docker-build
|
|
||||||
stage: build
|
|
||||||
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
|
|
||||||
|
|
||||||
source "./common.config"
|
|
||||||
source "./$BUILD_TYPE.config"
|
|
||||||
|
|
||||||
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" \
|
|
||||||
--destination "$IMAGE_PATH:$IMAGE_TAG_VERSIONS"
|
|
||||||
)
|
|
||||||
|
|
||||||
mainline:
|
|
||||||
<<: *docker-build
|
|
||||||
variables:
|
|
||||||
BUILD_TYPE: mainline
|
|
||||||
|
|
||||||
nightly:
|
|
||||||
<<: *docker-build
|
|
||||||
variables:
|
|
||||||
BUILD_TYPE: nightly
|
|
||||||
|
Loading…
Reference in New Issue
Block a user