运行 来自多项目管道的手动作业
Run a manual job from a multi-project pipeline
我有一个仅包含 手动 作业的管道。是否可以从多项目管道中触发此管道并告诉它 运行 只有一些特定的工作?就像它会模仿手动触发器。
示例:
我的 .gitlab-ci.yml
(在 myProject/Foo 中)文件如下所示:
...
deploy_to_Production:
<<: *job_deploy_definition
stage: deploy
when: manual
variables:
ENV: "Prod"
only:
refs:
- tags
deploy_to_Integration:
<<: *job_deploy_definition
stage: deploy
when: manual
variables:
ENV: "Int"
从我的多项目管道上的 .gitlab-ci.yml
文件,我只想触发一个特定的作业:
...
production_deploy:
stage: deploy
trigger:
project: myProject/Foo:deployToProduction # Is something like this possible ???
#strategy: depend
如果您只想从该管道触发 deploy_to_Production
,您可以稍微拆分作业并使用 rules。
触发器管道:
production_deploy:
stage: deploy
variables:
DEPLOY_TO_PROD: true
trigger:
project: myProject/Foo
#strategy: depend
另一个触发管道:
integration_deploy:
stage: deploy
variables:
DEPLOY_TO_INTEGRATION: true
trigger:
project: myProject/Foo
#strategy: depend
myProject/Foo:
.deploy_to_Production:template:
<<: *job_deploy_definition
stage: deploy
variables:
ENV: "Prod"
deploy_to_Production:manual:
extends: .deploy_to_Production:template
rules:
- if: $CI_COMMIT_TAG
when: manual
deploy_to_Production:triggered:
extends: .deploy_to_Production:template
rules:
- if: '$DEPLOY_TO_PROD == "true" && $CI_JOB_TRIGGERED == "true"'
.deploy_to_Integration:template:
<<: *job_deploy_definition
stage: deploy
variables:
ENV: "Int"
deploy_to_Integration:manual:
extends: .deploy_to_Integration:template
when: manual
deploy_to_Integration:triggered:
extends: .deploy_to_Integration:template
rules:
- if: '$DEPLOY_TO_INTEGRATION == "true" && $CI_JOB_TRIGGERED == "true"'
我有一个仅包含 手动 作业的管道。是否可以从多项目管道中触发此管道并告诉它 运行 只有一些特定的工作?就像它会模仿手动触发器。
示例:
我的 .gitlab-ci.yml
(在 myProject/Foo 中)文件如下所示:
...
deploy_to_Production:
<<: *job_deploy_definition
stage: deploy
when: manual
variables:
ENV: "Prod"
only:
refs:
- tags
deploy_to_Integration:
<<: *job_deploy_definition
stage: deploy
when: manual
variables:
ENV: "Int"
从我的多项目管道上的 .gitlab-ci.yml
文件,我只想触发一个特定的作业:
...
production_deploy:
stage: deploy
trigger:
project: myProject/Foo:deployToProduction # Is something like this possible ???
#strategy: depend
如果您只想从该管道触发 deploy_to_Production
,您可以稍微拆分作业并使用 rules。
触发器管道:
production_deploy:
stage: deploy
variables:
DEPLOY_TO_PROD: true
trigger:
project: myProject/Foo
#strategy: depend
另一个触发管道:
integration_deploy:
stage: deploy
variables:
DEPLOY_TO_INTEGRATION: true
trigger:
project: myProject/Foo
#strategy: depend
myProject/Foo:
.deploy_to_Production:template:
<<: *job_deploy_definition
stage: deploy
variables:
ENV: "Prod"
deploy_to_Production:manual:
extends: .deploy_to_Production:template
rules:
- if: $CI_COMMIT_TAG
when: manual
deploy_to_Production:triggered:
extends: .deploy_to_Production:template
rules:
- if: '$DEPLOY_TO_PROD == "true" && $CI_JOB_TRIGGERED == "true"'
.deploy_to_Integration:template:
<<: *job_deploy_definition
stage: deploy
variables:
ENV: "Int"
deploy_to_Integration:manual:
extends: .deploy_to_Integration:template
when: manual
deploy_to_Integration:triggered:
extends: .deploy_to_Integration:template
rules:
- if: '$DEPLOY_TO_INTEGRATION == "true" && $CI_JOB_TRIGGERED == "true"'