Add a way to force mark a release CI job as successful

Signed-off-by: Balasankar 'Balu' C <balasankar@gitlab.com>
This commit is contained in:
Balasankar 'Balu' C 2024-04-18 22:46:17 +05:30
parent 6df77b3a42
commit af0bc018f5
No known key found for this signature in database
GPG Key ID: B77D2E2E23735427
3 changed files with 41 additions and 1 deletions

View File

@ -108,6 +108,13 @@ variables:
paths:
- gems
.skip_script_execution:
- if [[ -n "${SKIP_SCRIPT_JOB_REGEX}" ]] && [[ "${CI_JOB_NAME}" =~ ${SKIP_SCRIPT_JOB_REGEX} ]]; then
echo "SKIP_SCRIPT_JOB_REGEX variable matches current job's name.";
echo "Skipping execution and mimicking a successful build.";
exit 0;
fi
.build-package: &build-package
- bundle exec rake cache:populate
- bundle exec rake cache:restore
@ -118,6 +125,7 @@ variables:
before_script:
- echo "PIPELINE_TYPE detected as ${PIPELINE_TYPE}"
- !reference [.skip_script_execution]
# Exit early if building on an OS for which we don't provide the specified
# package edition (CE/EE). For child pipelines from
# TRIGGERED_(CE|EE)_PIPELINE, we don't want exit early, but try to build
@ -163,6 +171,7 @@ fetch-assets:
timeout: 1 hour
before_script: []
script:
- !reference [.skip_script_execution]
- export VERSION=${GITLAB_ASSETS_TAG-${GITLAB_REF_SLUG-$(ruby -I. -e 'require "lib/gitlab/version"; puts Gitlab::Version.new("gitlab-rails").print')}}
- support/fetch_assets "${VERSION}"
artifacts:
@ -188,6 +197,7 @@ generate-facts:
stage: prepare
image: "${BUILDER_IMAGE_REGISTRY}/distribution_ci_tools:${BUILDER_IMAGE_REVISION}"
script:
- !reference [.skip_script_execution]
- mkdir -p build_facts
- bundle exec omnibus manifest gitlab -l nothing > build_facts/version-manifest.json
- bundle exec rake build:generate_facts

View File

@ -45,6 +45,7 @@
.branch_template: &branch_build
stage: package
script:
- !reference [.skip_script_execution]
- support/import_gpg_secrets.sh
- !reference [.build-package]
# Run package size checks on nightlies. The job will create alerts, so we
@ -96,6 +97,7 @@
.tag_template: &tag_build
stage: package
script:
- !reference [.skip_script_execution]
# Always compile assets for auto-deploy builds,
# this is done for auto-deploy builds
# so that we do not have to wait for the compile assets job
@ -158,6 +160,7 @@
variables:
INCLUDE_PACKAGECLOUD: "true"
script:
- !reference [.skip_script_execution]
- if [[ "${USE_SYSTEM_SSL}" == "true" ]]; then export STAGING_REPO=${FIPS_STAGING_REPO}; fi
- bundle exec rake repository:upload:staging[$STAGING_REPO]
cache: !reference [.tag-cache]
@ -182,6 +185,7 @@
.staging_upload_with_deployment_template: &staging_upload_with_deployment
extends: .staging_upload_template
script:
- !reference [.skip_script_execution]
- bundle exec rake repository:upload:staging[$STAGING_REPO]
- if [ -n "$DEPLOYER_TRIGGER_TOKEN" ]; then bundle exec rake gitlab_com:deployer; fi
@ -195,6 +199,7 @@
variables:
INCLUDE_PACKAGECLOUD: "true"
script:
- !reference [.skip_script_execution]
- bundle exec rake repository:upload:production
retry: 2
cache: !reference [.tag-cache]
@ -233,6 +238,7 @@
stage: package-and-image-release
image: "${BUILDER_IMAGE_REGISTRY}/debian_packer:${BUILDER_IMAGE_REVISION}"
script:
- !reference [.skip_script_execution]
# aws-sdk gem gives priority to environment variables over config file. So, using correct values for those variables.
- export AWS_ACCESS_KEY_ID=$AWS_AMI_ACCESS_KEY_ID
- export AWS_SECRET_ACCESS_KEY=$AWS_AMI_SECRET_ACCESS_KEY
@ -255,6 +261,7 @@
image: "${BUILDER_IMAGE_REGISTRY}/distribution_ci_tools:${BUILDER_IMAGE_REVISION}"
stage: aws-marketplace-release
script:
- !reference [.skip_script_execution]
- export AWS_ACCESS_KEY_ID=$AWS_AMI_ACCESS_KEY_ID
- export AWS_SECRET_ACCESS_KEY=$AWS_AMI_SECRET_ACCESS_KEY
- bundle exec rake aws:marketplace:release
@ -394,6 +401,7 @@ Docker-branch:
extends: .docker_job
stage: image
script:
- !reference [.skip_script_execution]
- bundle exec rake docker:build:image
- bundle exec rake docker:push:staging
- bundle exec rake docker:push:nightly
@ -418,6 +426,7 @@ QA-branch:
variables:
QA_SCREENSHOTS_DIR: $CI_PROJECT_DIR/screenshots
script:
- !reference [.skip_script_execution]
# For downstream users like JiHu to retain original behavior
- if [ "$BUILD_GITLAB_QA_IMAGE" == "true" ]; then
bundle exec rake qa:build;
@ -497,6 +506,7 @@ Docker-QA:
extends: .docker_job
stage: image
script:
- !reference [.skip_script_execution]
- bundle exec rake qa:build
- bundle exec rake qa:push:staging
cache: !reference [.tag-cache]
@ -656,6 +666,7 @@ Docker:
extends: .docker_job
stage: image
script:
- !reference [.skip_script_execution]
- bundle exec rake docker:build:image
- bundle exec rake docker:push:staging
tags: !reference [.distribution-amd64-tags]
@ -975,6 +986,7 @@ Docker-Release:
extends: .docker_job
stage: package-and-image-release
script:
- !reference [.skip_script_execution]
- bundle exec rake release:docker
cache: !reference [.tag-cache]
needs:
@ -1023,6 +1035,7 @@ QA-Tag:
variables:
QA_SCREENSHOTS_DIR: $CI_PROJECT_DIR/screenshots
script:
- !reference [.skip_script_execution]
- bundle exec rake release:qa
artifacts:
when: on_failure
@ -1050,6 +1063,7 @@ license-upload:
stage: metrics
image: "${BUILDER_IMAGE_REGISTRY}/ubuntu_18.04:${BUILDER_IMAGE_REVISION}"
script:
- !reference [.skip_script_execution]
- bundle exec rake license:upload
tags: !reference [.distribution-amd64-tags]
cache: !reference [.tag-cache]
@ -1065,6 +1079,7 @@ manifest-upload:
stage: metrics
image: "${BUILDER_IMAGE_REGISTRY}/ubuntu_18.04:${BUILDER_IMAGE_REVISION}"
script:
- !reference [.skip_script_execution]
- bundle exec rake manifest:upload
tags: !reference [.distribution-amd64-tags]
cache: !reference [.tag-cache]
@ -1081,6 +1096,7 @@ RAT-Tag:
stage: qa
image: "dev.gitlab.org:5005/cookbooks/gitlab-omnibus-builder/ubuntu_22.04:${BUILDER_IMAGE_REVISION}"
script:
- !reference [.skip_script_execution]
- bundle exec rake qa:rat:tag
cache: !reference [.tag-cache]
needs:
@ -1156,6 +1172,7 @@ create-gitlab-release:
artifacts: true
optional: true
script:
- !reference [.skip_script_execution]
- bundle exec rake release:print_details | tee release_info.txt
release:
name: "GitLab ${GITLAB_EDITION} ${CI_COMMIT_TAG}"

View File

@ -22,6 +22,7 @@
stage: prepare
before_script: []
script:
- !reference [.skip_script_execution]
- JOB_NAME=( $CI_JOB_NAME )
- export DISTRO_NAME=${JOB_NAME[0]}
- export DISTRO_VERSION=${JOB_NAME[1]}
@ -46,12 +47,14 @@
extends: .gems-cache-os-dependent
stage: tests
before_script:
- !reference [.skip_script_execution]
# These jobs will not be run on dev, so we set ALTERNATIVE_SOURCES to true
# so tests run fine on forks
- export ALTERNATIVE_SOURCES="true";
- !reference [.install-gems]
retry: 1
script:
- !reference [.skip_script_execution]
- bundle exec rspec spec/lib
artifacts:
reports: &spec_reports
@ -65,6 +68,7 @@
variables:
KNAPSACK_TEST_FILE_PATTERN: "spec/chef/**{,/*/**}/*_spec.rb"
script:
- !reference [.skip_script_execution]
- JOB_NAME=( $CI_JOB_NAME )
- export DISTRO_NAME=${JOB_NAME[0]}
- export DISTRO_VERSION=${JOB_NAME[1]}
@ -140,6 +144,7 @@
cache: {}
needs: []
before_script:
- !reference [.skip_script_execution]
- gem install gitlab --no-doc
# We need to download the script rather than clone the repo since the
# review-docs-cleanup job will not be able to run when the branch gets
@ -227,8 +232,11 @@ rubocop:
extends: .gems-cache
stage: check
image: "${RUBY_IMAGE}"
before_script: !reference [.install-gems]
before_script:
- !reference [.skip_script_execution]
- !reference [.install-gems]
script:
- !reference [.skip_script_execution]
- bundle exec rubocop --parallel
rules:
- if: '$PIPELINE_TYPE =~ /_TEST_PIPELINE$/'
@ -243,6 +251,7 @@ docs-lint markdown:
needs: []
before_script: []
script:
- !reference [.skip_script_execution]
# Lint prose
- vale --minAlertLevel error doc
# Lint Markdown
@ -260,6 +269,7 @@ docs-lint links:
needs: []
before_script: []
script:
- !reference [.skip_script_execution]
# Put documentation in location expected by nanoc and configured in nanoc.yaml. For more information, see:
# https://gitlab.com/gitlab-org/gitlab-docs/-/blob/eee6c4c03621ff13743828ad74a8f0e8b96dfe7c/nanoc.yaml#L43
- mkdir /tmp/omnibus-gitlab
@ -282,11 +292,13 @@ yard:
stage: check
needs: []
before_script:
- !reference [.skip_script_execution]
# These jobs will not be run on dev, so we set ALTERNATIVE_SOURCES to true
# so tests run fine on forks
- export ALTERNATIVE_SOURCES="true";
- !reference [.install-gems]
script:
- !reference [.skip_script_execution]
- bundle exec yardoc
rules:
- if: '$PIPELINE_TYPE =~ /_TEST_PIPELINE$/'
@ -444,6 +456,7 @@ update-knapsack:
stage: post-test
before_script: []
script:
- !reference [.skip_script_execution]
- support/merge-reports knapsack
- rm -f knapsack/*node*
rules: