我为单个项目配置了一个 gitlab runner。我看到的问题是运行者不会等到之前的工作完成,而是在与之前的工作相同的目录中进行结帐并踩踏一切。我有一个工作已经在运行,然后另一个开发提交,因此另一个工作开始了。为什么我不能将管道配置为不运行,以免破坏已经运行的工作区?
这是两个作业的日志(唯一的区别是时间戳)
[0K] Running with gitlab-runner 12.6.0 (ac8e767a)
[0K] on gitlab.xxxx.com rz8RmGp4
[0K] section_start:1578357551:prepare_executor
[0K] Using Docker executor with image my-image-build ...
[0K] Using locally found image version due to if-not-present pull policy
[0K] Using docker image sha256:xxxxxxxxxx for my-image-build ...
[0;msection_end:1578357553:prepare_executor
[0Ksection_start:1578357553:prepare_script
[0K] Running on runner-rz8RmGp4-project-23-concurrent-0 via gitlab.xxxx.com...
section_end:1578357554:prepare_script
[0K] section_start:1578357554:get_sources
[0K[32;1mFetching changes with git depth set to 50...[0;m
Initialized empty Git repository in /builds/my-project/.git/
<proceeds to checkout and stomp over the already running runner>
我看到的主要问题是它们都 check out 到导致问题的 Initialized empty Git repository in/builds/my-project/.git/
的同一目录。
最佳答案
您可以使用 resource_group防止作业并行运行。
例如
Job 1:
stage: My Stage
resource_group: stage-wedge
...
Job 2:
stage: My Stage
resource_group: stage-wedge
...
在上面的示例中,作业 2 将在作业 1 完成后运行。
关于Gitlab runner 在完成之前开始另一项工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59620921/