Azure-devops-docs: Missing an example of how to pass variables across stages

Created on 16 Aug 2019  Â·  8Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

You have one for dependent jobs but not for dependent stages


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 devops-cictech devopprod doc-enhancement

Most helpful comment

As far as I can tell, there is no way to natively move variables between stages as they are effectively as separate as classic build and release pipelines. As such the only real option is to treat them like config settings that need to be bundled with an artifact and save them as a json or similar to re-import into later stages as needed (or regenerate if that's easier).

The biggest "hang up" for me personally is that it means it becomes much harder to use the dependsOn parameter to gate later stages based on things like build results (only run deploy stage if build stage results in a change, for example)

All 8 comments

Is this possible today? I attempted converting our current pipeline to the new stage-based one but a variable wasn't passed between stages and nothing works so I had to revert. If so, how do I set it up?

I haven't my workaround is to store it as part of the pipeline artifacts.

Also looking for this, for the moment writing the variable to a file and uploading that as an artifact, which is pretty clunky.

Add me to the list of those looking.

I have a few theories on the "how" but I'd rather avoid potential days of trial and error.

Any update on this?
Using with pipeline artifact isn't convenient when we need to update the variable via bash

My work-around was not that dramatic as I already had a script that creates the value, so I just rerun it later in the new stage(s), but it does not feel elegant to have to do that.

As far as I can tell, there is no way to natively move variables between stages as they are effectively as separate as classic build and release pipelines. As such the only real option is to treat them like config settings that need to be bundled with an artifact and save them as a json or similar to re-import into later stages as needed (or regenerate if that's easier).

The biggest "hang up" for me personally is that it means it becomes much harder to use the dependsOn parameter to gate later stages based on things like build results (only run deploy stage if build stage results in a change, for example)

This is not supported right now. You can make a feature request to the product team at the Azure DevOps Developer Community.

Was this page helpful?
0 / 5 - 0 ratings