Loading .gitlab-ci.yml +8 −9 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ variables: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - << : *change-files script: - BUILD_TAG=${CI_REGISTRY_IMAGE}/${TARGET}/build:${CI_PIPELINE_ID} - BUILD_TAG=${CI_REGISTRY_IMAGE}/${TARGET}:build-${CI_PIPELINE_IID} - buildctl build --frontend=dockerfile.v0 --local context=. Loading @@ -45,7 +45,7 @@ variables: .tag: stage: deploy image: docker:stable image: docker.kodo.org.uk/ci-images/docker-reg:latest rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule" variables: Loading @@ -59,12 +59,11 @@ variables: variables: TAG: unstable script: | BUILD_REPO=${CI_REGISTRY_IMAGE}/${TARGET}/build:${CI_PIPELINE_ID} DEPLOY_REPO=${CI_REGISTRY_IMAGE}/${TARGET} if [ $TAG = latest ]; then VERSION=`eval "docker run --rm ${BUILD_REPO} ${GET_VERSION}"` BUILD_TAG=${CI_REGISTRY_IMAGE}/${TARGET}:build-${CI_PIPELINE_IID} docker-reg $BUILD_TAG retag $TAG if [ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]; then docker-reg $BUILD_TAG retag $VERSION fi . scripts/deploy.sh $TAG ${VERSION-} Build Wordpress: Loading @@ -82,10 +81,10 @@ Tag Wordpress Image: extends: [.tag] variables: TARGET: fastcgi GET_VERSION: wp core version VERSION: $WORDPRESS_VERSION Tag Nginx Image: extends: [.tag] variables: TARGET: nginx GET_VERSION: nginx -V 2>&1 | sed -n '/nginx version:/s/.*nginx\///p' VERSION: $NGINX_VERSION scripts/deploy.shdeleted 100755 → 0 +0 −20 Original line number Diff line number Diff line #!/bin/sh # Copyright 2019-2021 Dominik Sekotill <dom.sekotill@kodo.org.uk> # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. set -eu : ${BUILD_REPO?} : ${DEPLOY_REPO?} set -x docker pull ${BUILD_REPO} for tag in "$@"; do docker tag ${BUILD_REPO} ${DEPLOY_REPO}:${tag} docker push ${DEPLOY_REPO}:${tag} done Loading
.gitlab-ci.yml +8 −9 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ variables: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - << : *change-files script: - BUILD_TAG=${CI_REGISTRY_IMAGE}/${TARGET}/build:${CI_PIPELINE_ID} - BUILD_TAG=${CI_REGISTRY_IMAGE}/${TARGET}:build-${CI_PIPELINE_IID} - buildctl build --frontend=dockerfile.v0 --local context=. Loading @@ -45,7 +45,7 @@ variables: .tag: stage: deploy image: docker:stable image: docker.kodo.org.uk/ci-images/docker-reg:latest rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule" variables: Loading @@ -59,12 +59,11 @@ variables: variables: TAG: unstable script: | BUILD_REPO=${CI_REGISTRY_IMAGE}/${TARGET}/build:${CI_PIPELINE_ID} DEPLOY_REPO=${CI_REGISTRY_IMAGE}/${TARGET} if [ $TAG = latest ]; then VERSION=`eval "docker run --rm ${BUILD_REPO} ${GET_VERSION}"` BUILD_TAG=${CI_REGISTRY_IMAGE}/${TARGET}:build-${CI_PIPELINE_IID} docker-reg $BUILD_TAG retag $TAG if [ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]; then docker-reg $BUILD_TAG retag $VERSION fi . scripts/deploy.sh $TAG ${VERSION-} Build Wordpress: Loading @@ -82,10 +81,10 @@ Tag Wordpress Image: extends: [.tag] variables: TARGET: fastcgi GET_VERSION: wp core version VERSION: $WORDPRESS_VERSION Tag Nginx Image: extends: [.tag] variables: TARGET: nginx GET_VERSION: nginx -V 2>&1 | sed -n '/nginx version:/s/.*nginx\///p' VERSION: $NGINX_VERSION
scripts/deploy.shdeleted 100755 → 0 +0 −20 Original line number Diff line number Diff line #!/bin/sh # Copyright 2019-2021 Dominik Sekotill <dom.sekotill@kodo.org.uk> # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. set -eu : ${BUILD_REPO?} : ${DEPLOY_REPO?} set -x docker pull ${BUILD_REPO} for tag in "$@"; do docker tag ${BUILD_REPO} ${DEPLOY_REPO}:${tag} docker push ${DEPLOY_REPO}:${tag} done