diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2023-01-26 21:23:25 +0300 |
---|---|---|
committer | Vladimir Shushlin <vshushlin@gitlab.com> | 2023-01-26 21:23:25 +0300 |
commit | f1ed7aae830b2abb2db6079bdf95ca57b7812b56 (patch) | |
tree | ceeca93b63353e1f80054175cea1b780e5520df6 | |
parent | 7aea631ecdf2ff9a9bd6df6c9da449b5ad4ac2a8 (diff) | |
parent | be330016961020beb571dca08a918833c2ae4000 (diff) |
Merge branch 'verify-security-merge-base' into 'master'
Identify undeployed commits and rollbacks in security merge requests
See merge request https://gitlab.com/gitlab-org/gitlab-pages/-/merge_requests/847
Merged-by: Vladimir Shushlin <vshushlin@gitlab.com>
Approved-by: Vladimir Shushlin <vshushlin@gitlab.com>
Co-authored-by: Alessio Caiazza <acaiazza@gitlab.com>
-rw-r--r-- | Dangerfile | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -5,3 +5,19 @@ Gitlab::Dangerfiles.for_project(self) do |dangerfiles| # TODO: find a way to re-enalbe changelog https://gitlab.com/gitlab-org/gitlab-pages/-/issues/736 dangerfiles.import_dangerfiles(except: %w[changelog]) end + +# Identify undeployed commits only on the security mirror +SECURITY_MIRROR_PROJECT_ID = 15_685_887 +if gitlab.mr_json['target_project_id'] == SECURITY_MIRROR_PROJECT_ID && gitlab.mr_json['target_branch'] == ENV['CI_DEFAULT_BRANCH'] + auto_deploy_sha = gitlab.api.file_contents('gitlab-org/gitlab', 'GITLAB_PAGES_VERSION')&.rstrip + + message("Current auto_deploy candidate version: #{auto_deploy_sha}") + + if gitlab.base_commit != auto_deploy_sha + fail <<~MSG + Security merge requests for `#{gitlab.mr_json['target_branch']}` must have `gitlab-org/gitlab` `GITLAB_PAGES_VERSION` content as the merge request base commit. + Please rebase onto #{auto_deploy_sha} with `git rebase -i --onto #{auto_deploy_sha} #{gitlab.base_commit}` + See [our documentation](https://gitlab.com/gitlab-org/release/docs/-/tree/master/components/managed-versioning/security_release.md) for details. + MSG + end +end |