Mock pre-main-jh as scheduled and maintenance
Related issue: https://jihulab.com/gitlab-cn/gitlab/-/issues/2715
What does this MR do and why?
For scheduled and maintenance pipeline on main-jh, will trigger a lot of cache jobs.
If we want to trigger cache jobs on pre-main-jh
branch, we should mock the variables on pre-main-jh
branch.
For example:
update-static-analysis-cache
is not triggered on pre-main-jh
branch pipelines due to rule of :
if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TYPE == "maintenance"
update-static-analysis-cache:
retry:
max: 2
when:
- api_failure
- data_integrity_failure
- runner_system_failure
- scheduler_failure
- stuck_or_timeout_failure
- unknown_failure
before_script:
- - echo $FOSS_ONLY
- '[ "$FOSS_ONLY" = "1" ] && rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/
qa/qa/ee.rb'
- export GOPATH=$CI_PROJECT_DIR/.go
- mkdir -p $GOPATH
- source scripts/utils.sh
- source scripts/prepare_build.sh
extends:
- ".static-analysis-base"
- ".rubocop-job-cache-push"
- ".shared:rules:update-cache"
stage: prepare
needs: []
variables:
SETUP_DB: 'false'
ENABLE_SPRING: '1'
BROWSERSLIST_IGNORE_OLD_DATA: 'true'
GRAPHQL_SCHEMA_APOLLO_FILE: tmp/tests/graphql/gitlab_schema_apollo.graphql
cache:
- key: ruby-gems-debian-${DEBIAN_VERSION}-ruby-${RUBY_VERSION}
paths:
- vendor/ruby/
policy: pull
- key: rubocop-debian-${DEBIAN_VERSION}-ruby-${RUBY_VERSION}
paths:
- tmp/rubocop_cache/
policy: push
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TYPE == "maintenance"
- if: $CI_PROJECT_NAMESPACE == "gitlab-org/security" && $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PROJECT_PATH == "gitlab-org/gitlab-foss" && $CI_PIPELINE_SOURCE == "schedule"
- if: "$CI_MERGE_REQUEST_LABELS =~ /pipeline:update-cache/"
script:
- run_timed_command "fail_on_warnings bundle exec rake rubocop:check:graceful"
Screenshots or screen recordings
Non-UI
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
由 Baodong 编辑于