Is it possible to have a single release pipeline with multiple artifacts that will trigger separate stages conditionally.
Example:
(Build Artifact 1)
Build tags of Web
(Build Artifact 2)
Build tags of Identity
When i setup my release pipeline I create one pipeline and add the
(Build Artifact 1)
-> Web Stage
(Build Artifact 2)
-> Identity Stage
both of those artifacts are set trigger a release automatically and set to After Release
The problem I have is that when I queue the build for (Build Artifact 2)
both stages will deploy. And i only want Identity Stage
to deploy and visa versa.
The reason i want everything in one pipeline is because then all my artifacts is contained in one pipeline, I know i can do this if i create separate pipelines.
A single release pipeline can be linked to multiple artifact sources, of which one is the primary source. In this case, when you create a release, you specify individual versions for each of these sources.
A pipeline is comprised of Stages, Jobs, and Steps. A stage contains multiple jobs and jobs contain multiple steps. The YAML syntax following the outline above would be: stages: - stage: Build.
Conclusion. The Azure DevOps Server provides two different types of pipelines to perform build, deployment, testing and further actions. A Build Pipeline is used to generate Artifacts out of Source Code. A Release Pipeline consumes the Artifacts and conducts follow-up actions within a multi-staging system.
Azure Artifacts enable developers to consume and publish different types of packages to Artifacts feeds and public registries such as NuGet.org and npmjs.com.
Thinking more about your situation, it might be cleaner (read: no failing stages) to have a third artifact producing CI that is triggered on the build completion of the other 2 CI builds. That mediation build would get tagged according to why it was triggered (ie. Web
or Identity
). The artifact of this build would be a re-packaging of the upstream artifact (use the download artifact task), allowing your release pipeline to consume one artifact that might have 2 different tag values. This gives your artifact filters in pre-release conditions more teeth.
Web_CI
\ #Web - - Web Development - - Web Production
- -\ /
> = WebIdSwitch_CI - - <
- -/ \
/ #Id - - Id Development - - Id Production
Id_CI
Original Answer
I could be wrong about this, but I think you're going to need to have the stages run based on the value in RELEASE_TRIGGERINGARTIFACT_ALIAS
.
There might be a couple ways to do this, such as
The variable can be accessed on the pipeline using $(Release.TriggeringArtifact.Alias)
or in powershell with $env:RELEASE_TRIGGERINGARTIFACT_ALIAS
.
I'm not sure if you're using Artifact Filters on your stages already as part of your pre-deployment conditions, but that may be another way that isn't as much of a hack. I'll have to put a test pipeline together and try it out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With