1
votes

Using Azure DevOps to build and deploy(release) an container based application. Build and push the image to ACR in the build pipeline, and then a classic Release pipeline to deploy it to Azure App Services.

The build-pipeline pushes the image to ACR with an tag based on $(Build.BuildId).

The Release-pipeline is currently configured to use the :latest version of the image.

I guess it is not good practice to use the :latest tag for production, as you might have multiple builds after your release, making new container images with :latest tag, without necessary wanting to deploy them into production. And as the App Services seems to boot every now and then, and then pull a newer :latest image than the one used when the Release pipeline was executed.

I would like to change this behavior, to rather specify which image the deploy when I create a new release, and that this will be picked up in the App Service task.

How should the Artifact & Stages(task) be configured in order to achieve this?

If I select "Specify at the time of release creation" under the Artifact section, can I refer to this somehow as Tag over in the Deploy to App Service task?

1
Not get your latest information, is Krzysztof Madej's workaround helpful for you? If yes, you can accept the answer which can also benefit for others who has same puzzle with you. Also, feel free to leave comment below if still has any puzzle about it:-)Hugh Lin

1 Answers

1
votes

If you use $(Build.BuildId) to set tag then you can use the same value in release pipeline to specify which version should be deployed as it is available.

If you check Default variables - Primary Artifact you will find this

Build.BuildId   Release.Artifacts.{Primary artifact alias}.BuildId

and thus you can use specific tag for which release was triggered.