【发布时间】:2020-11-03 02:12:34
【问题描述】:
我有一个 .gitlab-ci.yml 文件,该文件以前在 Gitlab runner 12.9.0 上运行时没有出现问题。
运行器已更新到 13.1.1,现在它不再签出到我的分支 20-branchname,而是提交。 (可能是最近的一个)这意味着运行器无法将分支与主分支合并以执行一致性检查,因为它会导致fatal: refusing to merge unrelated histories。我正在使用 GitLab 13.2.0-pre
当我让跑步者执行 git status 时,它会打印出 HEAD 已分离。
我在使用不同版本的运行器的两个管道的原始日志中发现了这种差异:
12.9.0:
[32;1mChecking out 16b0a39c as 20-branchname...[0;m
From {repository url}
* [new ref] refs/pipelines/127602838 -> refs/pipelines/127602838
* [new branch] 20-branchname -> origin/20-branchname
git-lfs/2.8.0 (GitHub; windows amd64; go 1.12.2; git 30af66bb)
13.1.1:
[32;1mChecking out 7410f5aa as 20-branchname...[0;m
git-lfs/2.8.0 (GitHub; windows amd64; go 1.12.2; git 30af66bb)
这就是我的.gitlab-ci.yml 的样子:
.shared_windows_runners:
tags:
- shared-windows
- windows
- windows-1809
stages:
- test
# A few templates that help determine when to run a program
.template_manual_trigger_on_wip_merge_request:
rules: &manual_trigger_on_wip_merge_request
- if: '$CI_MERGE_REQUEST_TITLE =~ /WIP/'
when: manual
allow_failure: false
- when: always
allow_failure: false
.template_run_always:
rules: &run_always
- when: always
allow_failure: false
# Check that the checked in target matches what is being generated.
Coherence Check:
extends:
- .shared_windows_runners
stage: test
rules: *manual_trigger_on_wip_merge_request
before_script:
# Git setup
- git config --global user.email "runner@mail.com"
- git config --global user.name "Runner name"
- git config --global core.safecrlf false
- git submodule sync
- git submodule update --init
- git status
# Results in detached HEAD
script:
- git fetch origin
- git merge origin/master -X ours -m "coherence check merge"
# It fails here with "fatal: refusing to merge unrelated histories"
我还尝试在.gitlab-ci.yml 中添加git checkout 20-branchname,虽然它确实导致git status 显示我的分支已被签出而不是提交,但它仍然会导致不相关的历史错误尝试与 master 合并。
有人知道 Gitlab runner 12.9.0 和 13.1.1 之间的差异可能是什么原因吗?任何帮助表示赞赏!
【问题讨论】:
标签: git gitlab branch gitlab-ci gitlab-ci-runner