child 管道中未提取工件
Artifacts are not pulled in a child pipeline
这是我的 gitlab ci 配置。在构建阶段,应用程序构建在 dist
文件夹中,该文件夹作为工件存储。
下一个部署阶段是 运行 部署的 child 管道的触发器。
但是 dist
工件没有为 child 管道提取,因此 child 作业失败。
- 如何在 child 工作中获得
dist
工件?
- 即使 child 部署作业失败,parent 管道也显示完全通过。我希望看到,至少有一个 child 失败了。
.gitlab-ci.yml
stages:
- build
- deployment
build:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}
policy: pull
paths:
- node_modules/
artifacts:
when: always
paths:
- deployment.yml
- dist/
script:
- node ./build-app.js # creates dist folder
- node ./generate-pipeline.js # generates deployment.yml
trigger-deploy:
stage: deployment
trigger:
include:
- artifact: deployment.yml
job: build
deployment.yml
stages:
- deploy
app1-deploy:
stage: deploy
script:
- ls dist # fails, as dist folder is not existing
'trigger-deploy' 工作需要 'build' 工作的 dependency,以允许提供工件。
要在子管道失败时让父管道失败,您需要向包含 strategy: depend
添加策略。 see last example
needs:pipeline:job
子管道可以从其父管道中的作业或同一 parent-child 管道层次结构中的另一个子管道下载工件。
这是我的 gitlab ci 配置。在构建阶段,应用程序构建在 dist
文件夹中,该文件夹作为工件存储。
下一个部署阶段是 运行 部署的 child 管道的触发器。
但是 dist
工件没有为 child 管道提取,因此 child 作业失败。
- 如何在 child 工作中获得
dist
工件? - 即使 child 部署作业失败,parent 管道也显示完全通过。我希望看到,至少有一个 child 失败了。
.gitlab-ci.yml
stages:
- build
- deployment
build:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}
policy: pull
paths:
- node_modules/
artifacts:
when: always
paths:
- deployment.yml
- dist/
script:
- node ./build-app.js # creates dist folder
- node ./generate-pipeline.js # generates deployment.yml
trigger-deploy:
stage: deployment
trigger:
include:
- artifact: deployment.yml
job: build
deployment.yml
stages:
- deploy
app1-deploy:
stage: deploy
script:
- ls dist # fails, as dist folder is not existing
'trigger-deploy' 工作需要 'build' 工作的 dependency,以允许提供工件。
要在子管道失败时让父管道失败,您需要向包含 strategy: depend
添加策略。 see last example
needs:pipeline:job
子管道可以从其父管道中的作业或同一 parent-child 管道层次结构中的另一个子管道下载工件。