Skip to content

Simulate merged results pipelines for as-if-jh

Context

Closes #386585 (closed)

What does this MR do and why?

New behavior for the add-jh-files:

  • If a corresponding JH branch does not exist:
    • Downloads the JH_FILES_TO_COMMIT from main-jh via the API, and stores them as job artifacts
  • If a corresponding JH branch exists:
    • Try to merge the corresponding JH branch onto the main-jh branch.
      • If the merge succeeds, the job will add the resulting JH_FILES_TO_COMMIT from the merged results between main-jh and the corresponding JH branch as job artifacts
      • If the merge fails, the job will add the JH_FILES_TO_COMMIT from the corresponding JH branch only as job artifacts. The job will also fail, but will be allowed to fail.
      • If the job fails for any other reason, it will fail.

Does it work?

Without a corresponding branch in https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab

Job: https://gitlab.com/gitlab-org/gitlab/-/jobs/4869355128

Screenshot_2023-08-14_at_16.57.11

With a corresponding branch in https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab

Without conflicts

Job: https://gitlab.com/gitlab-org/gitlab/-/jobs/4869665197

Screenshot_2023-08-14_at_17.22.47

Downloading the artifacts for the job, we see that the changes in https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab/-/commit/1bb337a651b78c904faa81f7c91f60d0ae65a56e are included 🎉 :

cd ~/Downloads/
unzip artifacts.zip
cd artifacts/

# We want to see whether the file `jh/doc/api/database_migrations.md` was added (introduced in https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab/-/commit/1bb337a651b78c904faa81f7c91f60d0ae65a56e#ee35beac85c01c6bec614b416aacda45dd717f5e_0_1)

 $ ls -l jh/doc/api/database_migrations.md
-rw-r--r--@ 1 gitlab  staff  1226 Aug 14 17:20 jh/doc/api/database_migrations.md

$ cat jh/doc/api/database_migrations.md
---
stage: Data Stores
group: Database
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---

# 数据库迁移 API **(FREE SELF)**

> 引入于极狐GitLab 16.2。

该 API 用于管理极狐GitLab 开发中的数据库迁移。

所有方法都需要管理员权限。

## 将迁移标记为成功

[...]

With conflicts

Screenshot_2023-08-15_at_09.26.46

Additionally, the job exits with an exit code of 3, which marks it as allowed to fail 🎉

Screenshot_2023-08-15_at_09.27.14

Downloading the artifacts for the job, we see that the changes in https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab/-/commit/1bb337a651b78c904faa81f7c91f60d0ae65a56e are NOT included (which is good!) 🎉 :

cd ~/Downloads/
unzip artifacts.zip

# We want to verify that https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab/-/commit/1bb337a651b78c904faa81f7c91f60d0ae65a56e#ee35beac85c01c6bec614b416aacda45dd717f5e_0_1 is not in the `jh` folder
$ cat jh/doc/api/database_migrations.md
This is just to create merge conflicts!

Success 🎉

With another error

We also see that the job is just failing, not allowed to fail 🎉

Screenshot_2023-08-15_at_09.37.41

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by David Dieulivol

Merge request reports

Loading