3
votes

In Azure DevOps classic pipelines you can have a build pipeline for creating the artifact and a release pipeline for deploying it. This means that whatever stored prexisting artifact could be deployed simply launching the release pipeline and selecting the artifact´s version (typical usage: rolling back the current deployed artifact to a previous version)

How this can be achieved in Multi-Stage pipeline? Any way of launching only the deployment stage selecting the artifact to be deployed?

Regards

2

2 Answers

1
votes

How this can be achieved in Multi-Stage pipeline? Any way of launching only the deployment stage selecting the artifact to be deployed?

Indeed, this is very convenient to choose prexisting artifact based on actual demands, but what you want does not supported in Multi-Stage pipeline until now.

This request already reported to the MS product team:

Select artifacts in YAML release pipeline

This feature have been added in the last sprint:

Pipeline resource version picker in the create run dialogue

However, as I test, it seems this feature has not been deployed in all regions:

enter image description here

If it not deployed in your region, you could try to use the task Download Pipeline Artifacts task with the runId input:

- task: DownloadPipelineArtifact@2
  inputs:
    source: 'specific'
    artifact: 'drop'
    path: $(Build.SourcesDirectory)/bin
    project: 'AndroidBuild'
    pipeline: 12
    runVersion: 'specific'
    runId: $(buildid)

Then use pass queue variable buildid when we queue the build:

enter image description here

Hope this helps.

0
votes

This can be done by having two pipelines. one pipeline for your build where your pipeline produces an artifact and create another pipeline for your release stages. In the release pipeline, you can set the resources to point to another build or pipeline. where you can consume your previously produced artifact(including older build version) to deployment stages.

See: YAML Resources

Your release YAML pipeline can specify what resources it needs. You can specify an existing build or another pipeline.

resources:
  pipelines:
  - pipeline: SmartHotel-resource # identifier for the resource (used in pipeline resource variables)
    source: SmartHotel-CI # name of the pipeline that produces an artifact

However, Keeping them separate just leads to move overhead and maintenance.