microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.19k stars 926 forks source link

Multi-Stage YAML - Deployment variable uses latest value not snapshot during rerun the stage #529

Closed rajurh closed 3 years ago

rajurh commented 3 years ago

In the classic release pipeline when you redeploy the existing release, pipelines will make use of the same variables that were used when the release was initially created. In the multi-stage pipeline, I am seeing the value is picked freshly/newly even when we rerun the existing deployed stage.

It's a breaking change in the behavior between classic release pipeline vs YAML pipeline.

Expected: Use the same variable value which was used in the initial run rather than using the updated value.

Scenario: First time I ran with value “Value1” in the Azure DevOps Variable group and the task printed “Value1” in the pipeline. All good here. Now what I do here is update the value in the Azure DevOps variable group for the variable “Test” to “Value2”. To be more clear it’s updated only in the library variable group.

Now I am not running any new deployment or run the pipeline. I am trying to run the previous deployment using “Rerun stage” as shown in the below screenshot. Effectively Redeploying the previous deployment here.

Now I expected since it’s rerun it should print in the pipeline as “Value1” rather “Value2”. But it’s printing as “Value2” which shouldn’t be.

Because what happens is after a month of deployment “Release1” I might have done a new release to the environment “Release 2” but something went wrong I want to effectively deploy the last successful deployment with the same old variable values not picking the latest.

I already raised in the developer community the below issue and it's reported as a limitation (works as designed)

https://developercommunity2.visualstudio.com/t/multi-stage-deployment-variable-value-overrides-du/1309176?from=email&viewtype=all#T-ND1309772

cforce commented 3 years ago

That is really danger if you can not rely on reproducible results repeating things . Please fix this

rajurh commented 3 years ago

That is really danger if you can not rely on reproducible results repeating things. Please fix this

Hoping the issue gets resolved earliest. With this behavior, we can't use the YAML pipeline in production scenarios.

anatolybolshakov commented 3 years ago

Hi @rajurh this repo is mostly for yaml templates - your question is more related to DevOps Server side, I would suggest to ask any further questions on https://developercommunity2.visualstudio.com/search?from=email&viewtype=all&space=21 to get right eyes on it. Closing this here since it's not related to yaml templates.

jonathh21 commented 4 months ago

I'm here looking for an answer to this question, seeing the same thing.

It got closed down but searches for yaml snapshot variables not working brings one to here.

Any clues