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
frommain-jh
via the API, and stores them as job artifacts
- Downloads the
- 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 betweenmain-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.
- If the merge succeeds, the job will add the resulting
- Try to merge the corresponding JH branch onto the
Does it work?
https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab
Without a corresponding branch inJob: https://gitlab.com/gitlab-org/gitlab/-/jobs/4869355128
https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab
With a corresponding branch in- Corresponding JH branch:
386585-have_merged_results_from_main_jh_as_if_jh-jh
- The branch starts on commit https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab/-/commit/493157d55e2dbbd81c134cc8dc9371a298aa2493, an older commit in
main-jh
. The goal is to check whether the newer commits inmain-jh
will be included in the merged results🤞🏼
- The branch starts on commit https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab/-/commit/493157d55e2dbbd81c134cc8dc9371a298aa2493, an older commit in
Without conflicts
Job: https://gitlab.com/gitlab-org/gitlab/-/jobs/4869665197
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
- Job: https://gitlab.com/gitlab-org/gitlab/-/jobs/4873766077#L83
- I added a commit to the corresponding branch to create a conflict with another commit in the JiHu main branch (commit added)
Additionally, the job exits with an exit code of 3, which marks it as allowed to fail
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
- Job: https://gitlab.com/gitlab-org/gitlab/-/jobs/4873819475#L53
- I introduced an error in the
as-if-jh
script (see commit)
We also see that the job is just failing, not allowed to fail
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.