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"
|
2020-07-29 15:54:52 +00:00
|
|
|
TRAEFIK_VERSION: "2.2"
|
2019-12-04 14:23:08 +00:00
|
|
|
PORTAINER_VERSION: latest
|
|
|
|
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
|
|
|
|
|
|
|
|
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:
|
|
|
|
- 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
|
2019-12-04 14:23:08 +00:00
|
|
|
- docker pull $CONTAINER_IMAGE:${CONTAINER_VERSION:-latest} || true
|
2020-01-27 14:51:02 +00:00
|
|
|
- docker build --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" .
|
|
|
|
- docker push $CONTAINER_IMAGE:$CONTAINER_COMMIT_SHA
|
2019-12-04 14:23:08 +00:00
|
|
|
- docker push $CONTAINER_IMAGE:${CONTAINER_VERSION:-latest}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-07-08 12:11:26 +00:00
|
|
|
test:portainer-1.22.2:
|
2019-12-04 14:23:08 +00:00
|
|
|
<<: *test_definition
|
|
|
|
variables:
|
2020-07-08 12:11:26 +00:00
|
|
|
PORTAINER_VERSION: 1.22.2
|
2019-12-04 14:23:08 +00:00
|
|
|
|
2020-07-08 12:11:26 +00:00
|
|
|
test:portainer-1.23.2:
|
2019-08-27 14:40:30 +00:00
|
|
|
<<: *test_definition
|
|
|
|
variables:
|
2020-07-08 12:11:26 +00:00
|
|
|
PORTAINER_VERSION: 1.23.2
|
2019-08-27 14:40:30 +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:
|
|
|
|
- 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
|