2019-12-04 14:23:08 +00:00
|
|
|
image: $CI_REGISTRY/$CI_PROJECT_NAMESPACE/hub/auto-deploy-image:latest
|
|
|
|
|
|
|
|
variables:
|
|
|
|
DOCKER_DRIVER: overlay2
|
2019-08-27 15:00:27 +00:00
|
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
2021-09-03 13:52:59 +00:00
|
|
|
TRAEFIK_VERSION: "2.5"
|
2021-02-18 14:31:42 +00:00
|
|
|
PORTAINER_IMAGE: "portainer/portainer-ce"
|
2019-12-04 14:23:08 +00:00
|
|
|
PORTAINER_VERSION: latest
|
2021-02-18 14:31:42 +00:00
|
|
|
PORTAINER_COMMAND_OPTIONS: ""
|
2019-12-04 14:23:08 +00:00
|
|
|
PSU_IMAGE: ${CI_REGISTRY_IMAGE}/builds
|
2020-01-27 14:51:02 +00:00
|
|
|
PSU_TAG: $$CI_COMMIT_SHA
|
|
|
|
PSU_TAG_CORE: core-$$CI_COMMIT_SHA
|
2019-12-04 14:23:08 +00:00
|
|
|
DOCKER_REGISTRY_IMAGE: $DOCKER_REGISTRY/$CI_PROJECT_PATH
|
2021-11-30 16:52:51 +00:00
|
|
|
BUILDX_VERSION: "v0.7.1"
|
|
|
|
DOCKER_MULTI_ARCH: "linux/amd64,linux/arm64"
|
2019-12-04 14:23:08 +00:00
|
|
|
|
|
|
|
stages:
|
2020-01-08 15:09:03 +00:00
|
|
|
- cleanup
|
2019-12-04 14:23:08 +00:00
|
|
|
- build
|
|
|
|
- test
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
.build_template: &build_definition
|
|
|
|
stage: build
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
except:
|
|
|
|
refs:
|
|
|
|
- gitlab-pages
|
|
|
|
variables:
|
|
|
|
- $CI_COMMIT_TAG == "dev"
|
|
|
|
script:
|
2021-11-30 16:52:51 +00:00
|
|
|
- setup_docker_multi_arch
|
2019-12-04 14:23:08 +00:00
|
|
|
- setup_docker
|
|
|
|
- registry_login
|
|
|
|
- cd ${CONTAINER_FOLDER:-.}
|
2020-01-27 14:51:02 +00:00
|
|
|
- |
|
|
|
|
CONTAINER_COMMIT_SHA=$(if [ -n "$CONTAINER_COMMIT_SHA" ]; then
|
|
|
|
eval echo "$CONTAINER_COMMIT_SHA";
|
|
|
|
else
|
|
|
|
echo "$CI_COMMIT_SHA";
|
|
|
|
fi)
|
|
|
|
export CONTAINER_COMMIT_SHA
|
2021-11-30 16:52:51 +00:00
|
|
|
- docker buildx build --compress --push --platform $DOCKER_MULTI_ARCH --pull $(if [[ -n "$DOCKER_CACHE_DISABLED" ]]; then echo "--no-cache "; else echo "--cache-from $CONTAINER_IMAGE:${CONTAINER_VERSION:-latest}"; fi) --file ${DOCKER_FILE:-Dockerfile} --tag $CONTAINER_IMAGE:$CONTAINER_COMMIT_SHA --tag $CONTAINER_IMAGE:${CONTAINER_VERSION:-latest} --build-arg HTTP_PROXY="$HTTP_PROXY" --build-arg http_proxy="$http_proxy" --build-arg HTTPS_PROXY="$HTTPS_PROXY" --build-arg https_proxy="$https_proxy" --build-arg FTP_PROXY="$FTP_PROXY" --build-arg ftp_proxy="$ftp_proxy" --build-arg NO_PROXY="$NO_PROXY" --build-arg no_proxy="$no_proxy" .
|
2019-12-04 14:23:08 +00:00
|
|
|
|
|
|
|
build:main:
|
|
|
|
<<: *build_definition
|
|
|
|
variables:
|
|
|
|
CONTAINER_NAME: $CI_PROJECT_NAME
|
|
|
|
CONTAINER_VERSION: $CI_COMMIT_REF_SLUG-build
|
|
|
|
CONTAINER_IMAGE: ${CI_REGISTRY_IMAGE}/builds
|
|
|
|
|
|
|
|
build:debian:
|
|
|
|
<<: *build_definition
|
|
|
|
variables:
|
|
|
|
CONTAINER_NAME: $CI_PROJECT_NAME
|
|
|
|
CONTAINER_VERSION: $CI_COMMIT_REF_SLUG-build-debian
|
2020-01-27 14:51:02 +00:00
|
|
|
CONTAINER_COMMIT_SHA: debian-$$CI_COMMIT_SHA
|
2019-12-04 14:23:08 +00:00
|
|
|
DOCKER_FILE: Dockerfile.debian
|
|
|
|
CONTAINER_IMAGE: ${CI_REGISTRY_IMAGE}/builds
|
|
|
|
|
|
|
|
build:core:
|
|
|
|
<<: *build_definition
|
|
|
|
variables:
|
|
|
|
CONTAINER_NAME: $CI_PROJECT_NAME
|
|
|
|
CONTAINER_VERSION: $CI_COMMIT_REF_SLUG-build-core
|
2020-01-27 14:51:02 +00:00
|
|
|
CONTAINER_COMMIT_SHA: core-$$CI_COMMIT_SHA
|
2019-12-04 14:23:08 +00:00
|
|
|
DOCKER_FILE: Dockerfile.core
|
|
|
|
CONTAINER_IMAGE: ${CI_REGISTRY_IMAGE}/builds
|
2020-01-27 14:51:02 +00:00
|
|
|
|
2019-12-04 14:23:08 +00:00
|
|
|
build:debian-core:
|
|
|
|
<<: *build_definition
|
|
|
|
variables:
|
|
|
|
CONTAINER_NAME: $CI_PROJECT_NAME
|
|
|
|
CONTAINER_VERSION: $CI_COMMIT_REF_SLUG-build-debian-core
|
2020-01-27 14:51:02 +00:00
|
|
|
CONTAINER_COMMIT_SHA: debian-core-$$CI_COMMIT_SHA
|
2019-12-04 14:23:08 +00:00
|
|
|
DOCKER_FILE: Dockerfile.debian-core
|
|
|
|
CONTAINER_IMAGE: ${CI_REGISTRY_IMAGE}/builds
|
|
|
|
|
|
|
|
.test_template: &test_definition
|
|
|
|
stage: test
|
|
|
|
services:
|
|
|
|
- name: docker:dind
|
|
|
|
alias: cluster
|
|
|
|
except:
|
|
|
|
refs:
|
|
|
|
- gitlab-pages
|
|
|
|
variables:
|
|
|
|
- $TEST_DISABLED
|
|
|
|
- $CI_COMMIT_TAG == "dev"
|
|
|
|
script:
|
|
|
|
- setup_docker
|
|
|
|
- registry_login
|
|
|
|
- bash scripts/test.sh
|
|
|
|
|
2021-09-14 09:10:14 +00:00
|
|
|
test:portainer-1.24.2:
|
2019-12-04 14:23:08 +00:00
|
|
|
<<: *test_definition
|
|
|
|
variables:
|
2021-02-18 14:31:42 +00:00
|
|
|
PORTAINER_IMAGE: "portainer/portainer"
|
2021-09-14 09:10:14 +00:00
|
|
|
PORTAINER_VERSION: 1.24.2
|
2021-02-18 14:31:42 +00:00
|
|
|
PORTAINER_COMMAND_OPTIONS: " --no-analytics"
|
2019-12-04 14:23:08 +00:00
|
|
|
|
2021-11-25 17:16:11 +00:00
|
|
|
test:portainer-2.5.1:
|
2021-09-03 10:27:12 +00:00
|
|
|
<<: *test_definition
|
|
|
|
variables:
|
2021-11-25 17:16:11 +00:00
|
|
|
PORTAINER_VERSION: 2.5.1
|
2021-09-03 10:27:12 +00:00
|
|
|
|
2021-11-25 17:16:11 +00:00
|
|
|
test:portainer-2.6.3:
|
2021-09-03 10:27:12 +00:00
|
|
|
<<: *test_definition
|
|
|
|
variables:
|
2021-11-25 17:16:11 +00:00
|
|
|
PORTAINER_VERSION: 2.6.3
|
2021-09-03 10:27:12 +00:00
|
|
|
|
2019-12-04 14:23:08 +00:00
|
|
|
test:portainer-latest:
|
|
|
|
<<: *test_definition
|
|
|
|
|
|
|
|
test:portainer-latest:debian:
|
|
|
|
<<: *test_definition
|
|
|
|
variables:
|
2020-01-27 14:51:02 +00:00
|
|
|
PSU_TAG: debian-$$CI_COMMIT_SHA
|
|
|
|
PSU_TAG_CORE: debian-core-$$CI_COMMIT_SHA
|
2019-12-04 14:23:08 +00:00
|
|
|
|
|
|
|
release:
|
|
|
|
stage: deploy
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
except:
|
|
|
|
refs:
|
|
|
|
- gitlab-pages
|
|
|
|
variables:
|
|
|
|
- $CI_COMMIT_TAG == "dev"
|
|
|
|
script:
|
2021-11-30 16:52:51 +00:00
|
|
|
- setup_docker_multi_arch
|
2019-12-04 14:23:08 +00:00
|
|
|
- setup_docker
|
|
|
|
- registry_login
|
|
|
|
- external_registry_login
|
|
|
|
# Tagging git repository and Docker images on successful builds and tests
|
|
|
|
# First argument is the variant(s) of the Docker image
|
|
|
|
# e.g. "core"
|
|
|
|
# or for multiple variants: "core debian debian-core"
|
|
|
|
- bash scripts/release.sh "core debian debian-core"
|
|
|
|
|
|
|
|
generate-docs:
|
|
|
|
stage: deploy
|
|
|
|
script:
|
|
|
|
- mkdir -p public/$CI_COMMIT_REF_SLUG
|
|
|
|
- cp -r docs/. public/$CI_COMMIT_REF_SLUG
|
|
|
|
- mkdir public/$CI_COMMIT_REF_SLUG/repo
|
|
|
|
- cp *.md public/$CI_COMMIT_REF_SLUG/repo
|
2019-08-28 09:38:37 +00:00
|
|
|
- cp LICENSE public/$CI_COMMIT_REF_SLUG/repo/LICENSE.md
|
2019-12-04 14:23:08 +00:00
|
|
|
- bash scripts/push-to-gitlab-pages.sh
|
|
|
|
only:
|
|
|
|
variables:
|
|
|
|
- $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^.+-stable$/ && $CI_COMMIT_REF_PROTECTED == "true"
|
|
|
|
except:
|
|
|
|
variables:
|
|
|
|
- $CI_PIPELINE_SOURCE == "schedule"
|
|
|
|
|
|
|
|
pages:
|
|
|
|
stage: deploy
|
|
|
|
before_script:
|
|
|
|
- echo ""
|
|
|
|
script:
|
|
|
|
# Gzip all static files before publishing GitLab Pages
|
|
|
|
# Source: https://www.queryxchange.com/q/5_119670/how-do-you-serve-jekyll-pages-with-gzip-compression-on-gitlab-pages/
|
|
|
|
- find public \( -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.md' \) -print0 | xargs -0 gzip -9 -kv
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
only:
|
|
|
|
- gitlab-pages
|
|
|
|
except:
|
|
|
|
variables:
|
|
|
|
- $CI_PIPELINE_SOURCE == "schedule"
|
|
|
|
|
2020-01-08 15:09:03 +00:00
|
|
|
cleanup_registries:
|
|
|
|
stage: cleanup
|
|
|
|
allow_failure: true
|
|
|
|
script:
|
|
|
|
- cleanup_registries
|
|
|
|
only:
|
2020-01-17 14:35:19 +00:00
|
|
|
refs:
|
|
|
|
- schedules
|
|
|
|
variables:
|
|
|
|
- $CLEANUP_REGISTRIES_ENABLED
|
2020-01-08 15:09:03 +00:00
|
|
|
|
2019-12-04 14:23:08 +00:00
|
|
|
before_script:
|
|
|
|
- set -e
|
|
|
|
- source scripts/helpers.sh
|
|
|
|
# Used for updating the Docker images, but not the psu code
|
|
|
|
# Via Scheduling Pipelines
|
|
|
|
# See: https://gitlab.com/help/user/project/pipelines/schedules
|
|
|
|
- git_reset_from_tag
|
|
|
|
# Used for updating Docker images, on release/stable branches, but not the psu code
|
|
|
|
- git_reset_from_last_stable_tag
|