我有一个与我的项目关联的运行器以避免并发构建。 GitLab在开始新管道之前处理完整的管道?
concurrent设置为= 1(跑步者的配置文件)
before_script:
- echo %CI_COMMIT_SHA%
- echo %CI_PROJECT_DIR%
stages:
- createPBLs
- build
- package
create PBLs:
stage: createPBLs
script:
- md "C:\HierBauen\%CI_COMMIT_SHA%\"
- xcopy /y /s "C:/Bauen" "C:/HierBauen/%CI_COMMIT_SHA%"
- xcopy /y /s "%CI_PROJECT_DIR%" "C:\HierBauen\%CI_COMMIT_SHA%"
- cd "C:\HierBauen\%CI_COMMIT_SHA%"
- ./run_orcascript.cmd
only:
- tags
- master
build:
stage: build
script:
- cd "C:\HierBauen\%CI_COMMIT_SHA%"
- ./run_pbc.cmd
only:
- tags
except:
- master
build_master:
stage: build
script:
- cd "C:\HierBauen\%CI_COMMIT_SHA%"
- ./run_pbcm.cmd
only:
- master
package:
stage: package
script:
- cd "C:\HierBauen\%CI_COMMIT_SHA%"
- ./cpfiles.cmd
artifacts:
expire_in: 1 week
paths:
- GitLab-Build
name: "%CI_COMMIT_REF_NAME%"
only:
- tags
- master
不幸的是,早期启动的管道受到新启动管道的干扰。结果,构建在最后有缺陷......
编辑新的配置文件:
before_script:
- echo %CI_BUILD_REF%
- echo %CI_PROJECT_DIR%
- xcopy /y /s "C:/Bauen" "%CI_PROJECT_DIR%"
stages:
- createPBLs
- build
- package
create PBLs:
stage: createPBLs
script:
- ./run_orcascript.cmd
only:
- tags
- master
build:
stage: build
script:
- ./run_pbc.cmd
only:
- tags
except:
- master
build_master:
stage: build
script:
- ./run_pbcm.cmd
only:
- master
package:
stage: package
script:
- ./cpfiles.cmd
artifacts:
expire_in: 1 week
name: "%CI_COMMIT_REF_NAME%"
paths:
- GitLab-Build
only:
- tags
- master
答案 0 :(得分:1)
目前没有办法解决这个问题,目前GitLab上有open issue。
您可以做的是在gitlab-runner limit = 1
文件中添加config.toml
,这会强制gitlab-runner一次只接受一个作业。
我发现您没有在各个阶段之间传递工件,但如果您的build
阶段取决于createPBLs
阶段中的任何内容,则可以使用
artifacts和dependencies的组合,用于在各阶段之间传递数据。
例如:
before_script:
- echo %CI_COMMIT_SHA%
- echo %CI_PROJECT_DIR%
stages:
- createPBLs
- build
- package
create PBLs:
stage: createPBLs
script:
- md "C:\HierBauen\%CI_COMMIT_SHA%\"
- xcopy /y /s "C:/Bauen" "C:/HierBauen/%CI_COMMIT_SHA%"
- xcopy /y /s "%CI_PROJECT_DIR%" "C:\HierBauen\%CI_COMMIT_SHA%"
- cd "C:\HierBauen\%CI_COMMIT_SHA%"
- ./run_orcascript.cmd
artifacts:
name: createPBLS_%CI_COMMIT_SHA%
untracked: true
expire_in: 1 day
only:
- tags
- master
build:
stage: build
script:
- cd "C:\HierBauen\%CI_COMMIT_SHA%"
- ./run_pbc.cmd
dependencies:
- createPBLs
artifacts:
name: build_%CI_COMMIT_SHA%
untracked: true
expire_in: 1 day
only:
- tags
except:
- master
build_master:
stage: build
script:
- cd "C:\HierBauen\%CI_COMMIT_SHA%"
- ./run_pbcm.cmd
dependencies:
- createPBLs
artifacts:
name: build_%CI_COMMIT_SHA%
untracked: true
expire_in: 1 day
only:
- master
package:
stage: package
script:
- cd "C:\HierBauen\%CI_COMMIT_SHA%"
- ./cpfiles.cmd
dependencies:
- build_master
artifacts:
expire_in: 1 week
paths:
- GitLab-Build
name: "%CI_COMMIT_REF_NAME%"
only:
- tags
- master