我有一个与我的项目关联的运行程序以避免并发构建。 GitLab 在开始新管道之前处理完整的管道?
并发设置为= 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
目前没有办法,有一个办法开放问题 https://gitlab.com/gitlab-org/gitlab/-/issues/16548目前在 GitLab 上。
你可以做的是添加limit = 1
在你的 gitlab-runner 中config.toml
文件,这将强制 gitlab-runner 一次只接受一项作业。
我发现你没有在你的阶段之间传递工件,但是如果你的build
阶段,取决于任何事情createPBLs
阶段,你可以使用
的组合文物 https://docs.gitlab.com/ee/ci/yaml/#artifacts and 依赖关系 https://docs.gitlab.com/ee/ci/yaml/#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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)