0

To set the stage, I have two pipelines created in yaml, call them Build-CI and Release-CD. Release-CD has a pipeline resource dependency on Build-CI so when Build-CI completes, Release-CD is triggered.

The problem I am having is specific to build artifacts. In order to make my Release-CD jobs more efficient I am only downloading the build artifact that is necessary to complete the job, rather than having all jobs download all artifacts. I do this using the following syntax

- download: triggeredBy
      artifact: 'drop'
      patterns: '**/ArtifactSubFolder/*'

In this case "triggeredBy" is the name of the pipeline resource.

My understanding is this will download the artifacts from the build that triggered the release. And this works when the build and release occur back-to-back. However, the Release-CD pipeline contains multiple stages (dev, test, stage, prod). And as much is the case, the release will go to "test" and sit there waiting approval for a day or so before being promoted to "stage".

When this delay occurs and we approve the release to the next environment we get errors saying that the build artifacts are not found, and the build id it refers to is not the build id of the triggering build, but rather the build id of a build that occurred between the deploy to "test" and the approval to "stage"

How do I ensure that when approving these release pipelines to subsequent stages that they are indeed downloading artifacts from the original triggering branch?

  • I think you could use [Build.TriggeredBy.DefinitionId](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services) to get the pipeline and that is unique. – Mr Qian Apr 29 '21 at 09:22
  • Thanks for the suggestion, however it does pull from the correct build definition but the wrong build id (i.e. the instance of the build definition that triggered the release). According to this link https://learn.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema#resources-pipelines there does not appear to get the build id from the pipeline resource alia (see Pipeline Resource Variables section) – Brian Mahloch Apr 29 '21 at 13:03

0 Answers0