问题
I have multiple artifacts for each branch. Continuous deployment trigger is enabled For Dev: _CI_Dev For QA: _CI_QA For Staging: _CI_RC
I want to setup a common stage (since the tasks are same across environments) which should identify the source branch and use corresponding artifacts.
How to add approval and gates only for QA and staging? How do I identify the source branch which triggered the tasks (for a job)? Should I run a powershell script to setup source branch value in variable to be used in tasks?
回答1:
How to add approval and gates only for QA and staging? How do I identify the source branch which triggered the tasks (for a job)? Should I run a powershell script to setup source branch value in variable to be used in tasks?
I am afraid we could not add approval and gates only for QA
and staging
, if we want enable Continuous deployment trigger
for all artifact sources.
That because approval and gates currently do not have separate filters, they rely on the option Artifact filters
:
However, if we set the Artifact filters
for QA
and staging
, it will filter out builds from Dev: _CI_Dev
. Obviously this is not in line with our expectations.
To resolve this issue, the easiest way is to clone the current stage (Although it can't exactly what you originally expected to use one stage, this is currently the best solution.), it will also clone all tasks in that stage. changing Select trigger
from stage
to release
and set the Artifact filters
for QA
and staging
:
Note: Do not forget to add Artifact filters for Dev: _CI_Dev
to the previous stage.
来源:https://stackoverflow.com/questions/65317365/how-to-setup-generic-stage-pipeline-for-all-environments