gitlab ci/cd 中 跨项目使用制品
【摘要】
gitlab ci/cd 中 跨项目使用制品
https://docs.gitlab.com/ee/ci/yaml/#needsproject
build_job:
stage: build
...
gitlab ci/cd 中 跨项目使用制品
https://docs.gitlab.com/ee/ci/yaml/#needsproject
build_job:
stage: build
script:
- ls -lhR
needs:
- project: namespace/group/project-name
job: build-1
ref: main
artifacts: true
build_job:
stage: build
script:
- ls -lhR
needs:
- project: group/same-project-name
job: build-1
ref: other-ref
artifacts: true
build_job:
stage: build
script:
- ls -lhR
needs:
- project: $CI_PROJECT_PATH
job: $DEPENDENCY_JOB_NAME
ref: $ARTIFACTS_DOWNLOAD_REF
artifacts: true
You can’t download artifacts from jobs that run in parallel:.
To download artifacts between parent-child pipelines, use needs:pipeline.
You should not download artifacts from the same ref as a running pipeline. Concurrent pipelines running on the same ref could override the artifacts.
create-artifact:
stage: build
script: echo 'sample artifact' > artifact.txt
artifacts:
paths: [artifact.txt]
child-pipeline:
stage: test
trigger:
include: child.yml
strategy: depend
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
付费版 premium 才能使用
跨项目流水线的制品依赖可以使用 runner挂载本地目录来解决,即在配置runner挂载一个同步读写的本地目录,直通构建的runner docker容器中。然后将容器构建的制品复制到该目录中。
到用时再从该目录去取。 简单适用,非常适合想白嫖的同学,比如看了文章不点赞的同学。
文章来源: fizzz.blog.csdn.net,作者:拿我格子衫来,版权归原作者所有,如需转载,请联系作者。
原文链接:fizzz.blog.csdn.net/article/details/118463861
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)