vsts-arm-outputs
vsts-arm-outputs copied to clipboard
Setting variables as output variables
I have a case where I need to get a variable in a separate jobs where I do run the ARM Output task. As I can judge from the following line of code
https://github.com/keesschollaart81/vsts-arm-outputs/blob/912497cd5d3384929ba28175712bb452af84aa0d/arm-outputs/arm-outputsV2/index.ts#L58
the task outputs always all of the variables as no output variables.
I would like to be able to modify this behavior by a flag on a task itself.
If you agree, a quick PR will come in.
Thanks
I made a test to be sure of this.
Case 1 - isOutput is set to true
pool:
vmImage: ubuntu-latest
jobs:
# Set an output variable from a deployment
- deployment: A
environment: staging
strategy:
runOnce:
deploy:
steps:
- bash: echo "##vso[task.setvariable variable=myOutputVar;isOutput=true]this is the deployment variable value"
name: setvarStep
- bash: echo $(setvarStep.myOutputVar)
name: echovar
# Map the variable from the job for the first slice
- deployment: B
dependsOn: A
environment: staging
variables:
myVarFromDeploymentJob: $[ dependencies.A.outputs['A.setvarStep.myOutputVar'] ]
strategy:
runOnce:
deploy:
steps:
- bash: "echo $(myVarFromDeploymentJob)"
name: echovar
And once I run it I do get the following:

Case 2 - isOutput is set to false
pool:
vmImage: ubuntu-latest
jobs:
# Set an output variable from a deployment
- deployment: A
environment: staging
strategy:
runOnce:
deploy:
steps:
- bash: echo "##vso[task.setvariable variable=myOutputVar;isOutput=false]this is the deployment variable value"
name: setvarStep
- bash: echo $(setvarStep.myOutputVar)
name: echovar
# Map the variable from the job for the first slice
- deployment: B
dependsOn: A
environment: staging
variables:
myVarFromDeploymentJob: $[ dependencies.A.outputs['A.setvarStep.myOutputVar'] ]
strategy:
runOnce:
deploy:
steps:
- bash: "echo $(myVarFromDeploymentJob)"
name: echovar
And once I run it I do get the following:

Hey, any progress on that?