debian-mirror-gitlab/.gitlab/ci/review.gitlab-ci.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
3.8 KiB
YAML
Raw Normal View History

2022-06-21 17:19:12 +05:30
include:
- remote: 'https://gitlab.com/gitlab-org/modelops/applied-ml/review-recommender/ci-templates/-/raw/v0.2.1/recommender/Reviewers.gitlab-ci.yml'
2020-05-24 23:13:21 +05:30
review-cleanup:
2019-12-21 20:55:43 +05:30
extends:
- .default-retry
2020-03-13 15:44:24 +05:30
- .review:rules:review-cleanup
2022-08-27 11:52:29 +05:30
image: ${REVIEW_APPS_IMAGE}
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-12-21 20:55:43 +05:30
stage: prepare
environment:
2022-08-13 15:12:31 +05:30
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-12-21 20:55:43 +05:30
action: stop
before_script:
- source scripts/utils.sh
2022-01-26 12:08:38 +05:30
- source scripts/review_apps/review-apps.sh
2020-05-24 23:13:21 +05:30
- source scripts/review_apps/gcp_cleanup.sh
2019-12-21 20:55:43 +05:30
- install_gitlab_gem
2020-05-24 23:13:21 +05:30
- setup_gcp_dependencies
2019-12-21 20:55:43 +05:30
script:
2022-01-26 12:08:38 +05:30
- delete_release
- delete_namespace
2019-12-21 20:55:43 +05:30
- ruby -rrubygems scripts/review_apps/automated_cleanup.rb
2020-04-22 19:07:51 +05:30
- gcp_cleanup
2022-08-27 11:52:29 +05:30
review-app-pipeline-generate:
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
2021-11-18 22:05:49 +05:30
start-review-app-pipeline:
2020-07-28 23:09:34 +05:30
extends:
2022-01-26 12:08:38 +05:30
- .review:rules:start-review-app-pipeline
2022-08-27 11:52:29 +05:30
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-11-18 22:05:49 +05:30
stage: review
2020-07-28 23:09:34 +05:30
needs:
2022-08-27 11:52:29 +05:30
- review-app-pipeline-generate
2021-11-18 22:05:49 +05:30
- job: build-assets-image
2020-07-28 23:09:34 +05:30
artifacts: false
2021-11-18 22:05:49 +05:30
# 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
2021-10-27 15:23:28 +05:30
variables:
2022-08-13 15:12:31 +05:30
SCHEDULE_TYPE: $SCHEDULE_TYPE
2021-11-18 22:05:49 +05:30
DAST_RUN: $DAST_RUN
trigger:
include:
2022-08-27 11:52:29 +05:30
- artifact: review-app-pipeline.yml
job: review-app-pipeline-generate
2021-11-18 22:05:49 +05:30
strategy: depend
2021-09-04 01:27:46 +05:30
2019-07-31 22:56:46 +05:30
danger-review:
2019-12-04 20:38:33 +05:30
extends:
- .default-retry
2021-04-17 20:07:23 +05:30
- .danger-review-cache
2020-03-13 15:44:24 +05:30
- .review:rules:danger
2019-07-31 22:56:46 +05:30
stage: test
2020-04-08 14:13:33 +05:30
needs: []
2021-04-17 20:07:23 +05:30
before_script:
2021-06-08 01:23:25 +05:30
- source scripts/utils.sh
- bundle_install_script "--with danger"
2021-01-03 14:25:43 +05:30
- run_timed_command "retry yarn install --frozen-lockfile"
2021-04-17 20:07:23 +05:30
script:
2022-08-27 11:52:29 +05:30
# ${DANGER_DANGERFILE} is used by Jihulab for customizing danger support: https://jihulab.com/gitlab-cn/gitlab/-/blob/main-jh/jh/.gitlab-ci.yml
2021-04-29 21:17:54 +05:30
- >
if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then
2021-09-30 23:02:18 +05:30
run_timed_command danger_as_local
2021-04-29 21:17:54 +05:30
else
2022-06-21 17:19:12 +05:30
danger_id=$(echo -n ${DANGER_GITLAB_API_TOKEN} | md5sum | awk '{print $1}' | cut -c5-10)
2022-08-27 11:52:29 +05:30
run_timed_command "bundle exec danger --fail-on-errors=true --verbose --danger_id=\"${danger_id}\" --dangerfile=\"${DANGER_DANGERFILE:-Dangerfile}\""
2021-04-29 21:17:54 +05:30
fi
2021-09-30 23:02:18 +05:30
danger-review-local:
extends:
- danger-review
- .review:rules:danger-local
script:
- run_timed_command danger_as_local
2022-06-21 17:19:12 +05:30
reviewers-recommender:
extends:
- .default-retry
2022-08-27 11:52:29 +05:30
# extends generated values cannot overwrite values from included files
# Use !reference as a workaround here
rules: !reference [".review:rules:reviewers-recommender", rules]
2022-06-21 17:19:12 +05:30
stage: test
needs: []