From ec3c5ea089fe93d01b04c60604a6efc4372248fb Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Fri, 22 Oct 2021 13:59:24 -0600 Subject: [PATCH 1/6] * refactor stagin-release stage * add release publishing for various channels * extract skip_if_merge_pipeline condition * document cross-project trigger pipeline * document 'devel' chart operations Changelog: changed --- .gitlab-ci.yml | 58 +++++++++++++++++++++++++++++++++++++++++--------- doc/index.md | 22 +++++++++++++++++++ 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f964e773b6..9eb063bf23 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,6 +51,7 @@ stages: - qa - staging-release - package + - release-package - cleanup - report @@ -63,8 +64,14 @@ before_script: .stable_branch_items: - &stable_branch_ref /^[0-9]+-[0-9]+-stable$/ +.skip_if_merge_pipeline: + rules: + - &skip_if_merge_pipeline + if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + tag_auto_deploy: - stage: package + stage: staging-release rules: - if: $CI_PIPELINE_TRIGGERED && $TRIGGER_JOB == "tag_auto_deploy" && $AUTO_DEPLOY_TAG && $REPOSITORY_PAT script: @@ -759,22 +766,52 @@ wait_for_dev_images: refs: - /.*-stable/@gitlab/charts/gitlab -staging_release: - stage: staging-release +.publish_chart_package: + # publish chart into repo's Packages + stage: package image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base-helm-3" variables: - CHANNEL: "stable" + CHANNEL: "unstable" + VERSION_SUFFIX: "" script: - - if [[ $CI_COMMIT_REF_NAME =~ $AUTO_DEPLOY_TAG_REGEX ]]; then export CHANNEL="autodeploy"; fi - helm dependency update - - helm package . + - EXTRACTED_VERSION=$(awk '/^version/ {print $2}' Chart.yaml) + - VERSION=${VERSION:-${EXTRACTED_VERSION}} + - echo "Packaging ${VERSION}${VERSION_SUFFIX} for ${CHANNEL}" + - helm package --version=${VERSION}${VERSION_SUFFIX} . - chart_file=$(ls -l gitlab*.tgz | head -n 1 | awk '{print $NF}') - curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@${chart_file}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/${CHANNEL}/charts" - only: - - tags@gitlab/charts/gitlab + +publish_tagged_package: + extends: .publish_chart_package + # stage: staging-release + variables: + CHANNEL: "stable" + rules: + - if: '$CI_SERVER_HOST == "dev.gitlab.org" && $CI_PROJECT_PATH == "gitlab/charts/gitlab" && $CI_COMMIT_TAG' + when: always + +publish_audodeploy_package: + extends: .publish_chart_package + # stage: staging-release + variables: + CHANNEL: "autodeploy" + rules: + - if: '$CI_SERVER_HOST == "dev.gitlab.org" && $CI_PROJECT_PATH == "gitlab/charts/gitlab" && $CI_COMMIT_TAG && $COMMIT_REF_NAME =~ /$AUTO_DEPLOY_TAG_REGEX/' + when: always + +publish_devel_package: + extends: .publish_chart_package + variables: + CHANNEL: "devel" + VERSION_SUFFIX: "-${CI_PIPELINE_ID}" + rules: + - *skip_if_merge_pipeline + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + when: always release_package: - stage: package + stage: release-package timeout: 2h image: registry.gitlab.com/gitlab-org/gitlab-omnibus-builder/ruby_docker script: @@ -785,6 +822,7 @@ release_package: UNSTABLE="false" fi - bash scripts/wait_for_images.sh + # trigger pipeline for https://gitlab.com/charts/charts.gitlab.io - curl -fS --request POST --form "token=${COM_CHARTS_TRIGGER_TOKEN}" --form ref=master --form "variables[CHART_NAME]=$CI_PROJECT_NAME" --form "variables[RELEASE_REF]=$CI_COMMIT_REF_NAME" @@ -875,7 +913,7 @@ qa_eks_manual_full_suite: when: manual create_operator_mr: - stage: package + stage: release-package timeout: 2h image: registry.gitlab.com/gitlab-org/gitlab-omnibus-builder/ruby_docker allow_failure: true diff --git a/doc/index.md b/doc/index.md index 2178198a53..87b34a140a 100644 --- a/doc/index.md +++ b/doc/index.md @@ -155,6 +155,28 @@ storage, and thus is an [Advanced Configuration](advanced/index.md). To migrate your existing Omnibus GitLab instance to these charts, follow the [migration documentation](installation/migration/index.md). +### Devel builds + +Development chart versions are being built with every merge to `master`. + +It is possible to track current non-production "development" releases of Helm chart by using `devel` channel: + +```shell +helm repo add gitlab-devel https://gitlab.com/api/v4/projects/3828396/packages/helm/devel +``` + +and using `--devel` option for `helm` pointing to a specific release: + +```shell +helm install --devel --version 1.2.3-4567 gitlab-devel/gitlab +``` + +to list available `devel` versions: + +```shell +helm search repo gitlab-devel --devel +``` + ## Architecture These charts are complex, as they coordinate the deployment of a complete application -- GitLab From 322f1be1879d34e5170168b5f17381155c207a4f Mon Sep 17 00:00:00 2001 From: Mitchell Nielsen Date: Wed, 1 Dec 2021 22:06:18 +0000 Subject: [PATCH 2/6] eliminate extraneous comments. drop "when: always" as potentially harmful --- .gitlab-ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9eb063bf23..e08e7f72d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -784,21 +784,17 @@ wait_for_dev_images: publish_tagged_package: extends: .publish_chart_package - # stage: staging-release variables: CHANNEL: "stable" rules: - if: '$CI_SERVER_HOST == "dev.gitlab.org" && $CI_PROJECT_PATH == "gitlab/charts/gitlab" && $CI_COMMIT_TAG' - when: always publish_audodeploy_package: extends: .publish_chart_package - # stage: staging-release variables: CHANNEL: "autodeploy" rules: - if: '$CI_SERVER_HOST == "dev.gitlab.org" && $CI_PROJECT_PATH == "gitlab/charts/gitlab" && $CI_COMMIT_TAG && $COMMIT_REF_NAME =~ /$AUTO_DEPLOY_TAG_REGEX/' - when: always publish_devel_package: extends: .publish_chart_package @@ -808,7 +804,6 @@ publish_devel_package: rules: - *skip_if_merge_pipeline - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - when: always release_package: stage: release-package -- GitLab From 8efcb3d43abd3ade10a758bc72fdd4c937e30d67 Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Thu, 2 Dec 2021 08:19:46 -0700 Subject: [PATCH 3/6] remove default CHANNEL setting in favour of documenting use of the variable within derivative jobs --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e08e7f72d4..b3de0c8e46 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -771,7 +771,8 @@ wait_for_dev_images: stage: package image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base-helm-3" variables: - CHANNEL: "unstable" + # **Required** variable to set channel to which chart will be published: + # CHANNEL: "unstable" VERSION_SUFFIX: "" script: - helm dependency update -- GitLab From d5ac51da86dd1e140a90d2708572c6a852f31ac8 Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Thu, 2 Dec 2021 09:54:14 -0700 Subject: [PATCH 4/6] test merge pipeline fixes --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3de0c8e46..f32962a10d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -803,7 +803,7 @@ publish_devel_package: CHANNEL: "devel" VERSION_SUFFIX: "-${CI_PIPELINE_ID}" rules: - - *skip_if_merge_pipeline + # - *skip_if_merge_pipeline - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' release_package: -- GitLab From 3e788886dcbaee9697a77a9e13aff90977ddc7f3 Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Thu, 2 Dec 2021 13:28:43 -0700 Subject: [PATCH 5/6] remove unnecessary .skip_if_merge_pipeline --- .gitlab-ci.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f32962a10d..adaec481ea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,12 +64,6 @@ before_script: .stable_branch_items: - &stable_branch_ref /^[0-9]+-[0-9]+-stable$/ -.skip_if_merge_pipeline: - rules: - - &skip_if_merge_pipeline - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: never - tag_auto_deploy: stage: staging-release rules: @@ -803,7 +797,6 @@ publish_devel_package: CHANNEL: "devel" VERSION_SUFFIX: "-${CI_PIPELINE_ID}" rules: - # - *skip_if_merge_pipeline - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' release_package: -- GitLab From bff77827296d3f99982ab1ad295576735511aecc Mon Sep 17 00:00:00 2001 From: Dmitry Makovey Date: Thu, 9 Dec 2021 07:43:11 -0700 Subject: [PATCH 6/6] move documentation regarding Development builds --- doc/development/release.md | 22 ++++++++++++++++++++++ doc/index.md | 22 ---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/development/release.md b/doc/development/release.md index 45b38917cb..0d48f49142 100644 --- a/doc/development/release.md +++ b/doc/development/release.md @@ -106,6 +106,28 @@ By default, this task will be automatically run from CI when a new release image > Currently the `helm-release-tools` branch from the release tools repository is used to release the chart +### Development builds + +Development chart versions are being built with every merge to `master`. + +It is possible to track current non-production "development" releases of Helm chart by using `devel` channel: + +```shell +helm repo add gitlab-devel https://gitlab.com/api/v4/projects/3828396/packages/helm/devel +``` + +and using `--devel` option for `helm` pointing to a specific release: + +```shell +helm install --devel --version 1.2.3-4567 gitlab-devel/gitlab +``` + +to list available `devel` versions: + +```shell +helm search repo gitlab-devel --devel +``` + ### Manually releasing the chart Before manually releasing the chart, ensure all the chart changes you want from `master` have been picked into the diff --git a/doc/index.md b/doc/index.md index 87b34a140a..2178198a53 100644 --- a/doc/index.md +++ b/doc/index.md @@ -155,28 +155,6 @@ storage, and thus is an [Advanced Configuration](advanced/index.md). To migrate your existing Omnibus GitLab instance to these charts, follow the [migration documentation](installation/migration/index.md). -### Devel builds - -Development chart versions are being built with every merge to `master`. - -It is possible to track current non-production "development" releases of Helm chart by using `devel` channel: - -```shell -helm repo add gitlab-devel https://gitlab.com/api/v4/projects/3828396/packages/helm/devel -``` - -and using `--devel` option for `helm` pointing to a specific release: - -```shell -helm install --devel --version 1.2.3-4567 gitlab-devel/gitlab -``` - -to list available `devel` versions: - -```shell -helm search repo gitlab-devel --devel -``` - ## Architecture These charts are complex, as they coordinate the deployment of a complete application -- GitLab