2022-04-15 14:09:57 -04:00
include :
- remote : 'https://gitlab.com/gitlab-org/modelops/applied-ml/review-recommender/ci-templates/-/raw/v0.2.1/recommender/Reviewers.gitlab-ci.yml'
2020-04-21 14:09:31 -04:00
review-cleanup :
2019-09-18 14:06:14 -04:00
extends :
- .default-retry
2020-02-12 10:09:37 -05:00
- .review:rules:review-cleanup
2022-07-21 11:09:12 -04:00
image : ${REVIEW_APPS_IMAGE}
2022-07-21 17:10:17 -04:00
resource_group : review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
2019-09-18 14:06:14 -04:00
stage : prepare
environment :
2022-07-04 11:10:24 -04:00
name : review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it
2019-09-18 14:06:14 -04:00
action : stop
before_script :
- source scripts/utils.sh
2021-12-15 10:15:54 -05:00
- source scripts/review_apps/review-apps.sh
2020-04-21 14:09:31 -04:00
- source scripts/review_apps/gcp_cleanup.sh
2019-09-18 14:06:14 -04:00
- install_gitlab_gem
2020-04-21 14:09:31 -04:00
- setup_gcp_dependencies
2019-09-18 14:06:14 -04:00
script :
2021-12-13 16:14:32 -05:00
- delete_release
2021-12-15 10:15:54 -05:00
- delete_namespace
2019-09-18 14:06:14 -04:00
- ruby -rrubygems scripts/review_apps/automated_cleanup.rb
2020-03-30 23:07:51 -04:00
- gcp_cleanup
2022-08-24 23:10:55 -04:00
.review-app-pipeline-generate :
2022-08-02 11:09:10 -04:00
image : ${GITLAB_DEPENDENCY_PROXY}ruby:${RUBY_VERSION}
stage : prepare
extends :
- .review:rules:start-review-app-pipeline
artifacts :
expire_in : 7d
paths :
- ${CHANGES_DIFFS_DIR}/*
- review-app-pipeline.yml
variables :
CHANGES_DIFFS_DIR : tmp/diffs
before_script :
- source scripts/utils.sh
- install_gitlab_gem
- tooling/bin/find_change_diffs ${CHANGES_DIFFS_DIR}
script :
- exit_code=0 && tooling/bin/qa/run_qa_check ${CHANGES_DIFFS_DIR} || exit_code=$?
- |
if [ $exit_code -eq 0 ]; then
echo "Review App will use the full pipeline"
cp .gitlab/ci/review-apps/main.gitlab-ci.yml review-app-pipeline.yml
elif [ $exit_code -eq 2 ]; then
echo "Skip Review App because the MR includes only quarantine changes"
cp .gitlab/ci/review-apps/skip-qa.gitlab-ci.yml review-app-pipeline.yml
else
exit $exit_code
fi
2022-08-24 23:10:55 -04:00
# Temporarily disable review-apps due to https://gitlab.com/gitlab-org/gitlab/-/issues/371809
.start-review-app-pipeline :
2020-06-30 11:08:48 -04:00
extends :
2021-11-17 22:14:17 -05:00
- .review:rules:start-review-app-pipeline
2022-07-21 17:10:17 -04:00
resource_group : review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # CI_ENVIRONMENT_SLUG is not available here and we want this to be the same as the environment
2021-10-14 11:14:02 -04:00
stage : review
2020-06-30 11:08:48 -04:00
needs :
2022-08-02 11:09:10 -04:00
- review-app-pipeline-generate
2021-10-14 11:14:02 -04:00
- job : build-assets-image
2020-06-30 11:08:48 -04:00
artifacts : false
2021-10-18 05:12:29 -04:00
# These variables are set in the pipeline schedules.
# They need to be explicitly passed on to the child pipeline.
# https://docs.gitlab.com/ee/ci/pipelines/multi_project_pipelines.html#pass-cicd-variables-to-a-downstream-pipeline-by-using-the-variables-keyword
variables :
2022-07-04 11:10:24 -04:00
SCHEDULE_TYPE : $SCHEDULE_TYPE
2021-10-18 05:12:29 -04:00
DAST_RUN : $DAST_RUN
2021-10-14 11:14:02 -04:00
trigger :
include :
2022-08-02 11:09:10 -04:00
- artifact : review-app-pipeline.yml
job : review-app-pipeline-generate
2021-10-14 11:14:02 -04:00
strategy : depend
2021-05-26 17:10:49 -04:00
2019-04-12 04:56:38 -04:00
danger-review :
2019-08-26 16:41:55 -04:00
extends :
- .default-retry
2021-03-12 07:09:33 -05:00
- .danger-review-cache
2020-02-12 10:09:37 -05:00
- .review:rules:danger
2019-04-12 04:56:38 -04:00
stage : test
2020-02-20 13:08:51 -05:00
needs : [ ]
2021-03-12 07:09:33 -05:00
before_script :
2021-05-14 14:10:34 -04:00
- source scripts/utils.sh
- bundle_install_script "--with danger"
2020-10-08 14:08:32 -04:00
- run_timed_command "retry yarn install --frozen-lockfile"
2021-03-12 07:09:33 -05:00
script :
2022-08-11 17:09:14 -04:00
# ${DANGER_DANGERFILE} is used by Jihulab for customizing danger support: https://jihulab.com/gitlab-cn/gitlab/-/blob/main-jh/jh/.gitlab-ci.yml
2021-03-31 14:09:19 -04:00
- >
if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then
2021-07-15 08:09:01 -04:00
run_timed_command danger_as_local
2021-03-31 14:09:19 -04:00
else
2022-03-21 08:08:01 -04:00
danger_id=$(echo -n ${DANGER_GITLAB_API_TOKEN} | md5sum | awk '{print $1}' | cut -c5-10)
2022-08-11 17:09:14 -04:00
run_timed_command "bundle exec danger --fail-on-errors=true --verbose --danger_id=\"${danger_id}\" --dangerfile=\"${DANGER_DANGERFILE:-Dangerfile}\""
2021-03-31 14:09:19 -04:00
fi
2021-07-15 08:09:01 -04:00
danger-review-local :
extends :
- danger-review
- .review:rules:danger-local
script :
- run_timed_command danger_as_local
2022-04-15 14:09:57 -04:00
reviewers-recommender :
extends :
- .default-retry
2022-08-01 08:12:10 -04:00
# extends generated values cannot overwrite values from included files
# Use !reference as a workaround here
rules : !reference [".review:rules:reviewers-recommender", rules]
2022-04-15 14:09:57 -04:00
stage : test
needs : [ ]