I am new to VSTS and Azure Kubernetes. I am building a VSTS CD pipeline. I have added a Deploy to Kubernetes task in my pipeline. I am executing the get command and trying to store the output in the output variables (which is available at the bottom of the Deploy to kubernetes task). I have set the variable name.
I am trying to fetch the value of the above output variable. I have used command line task to set a value to the variable as mentioned below
echo '##vso[task.setvariable variable=myStatusVar;isSecret=false;]$(myvar)'
where myvar
is the variable, which is set in the Deploy to kubernetes task as output variable.
After that in another command line task, I am trying to access the myStatusVar
variable value, but when I execute the release pipeline, it shows the message:
myvar command not found
Can anyone let me know, how to use the output variable of the Deploy to kuberentes task of VSTS pipeline?
As stated in the comments your variable is 'exposed' as 'myvar.KubectlOutput'
the way you are able to use it in scripts differs based on type of scripting you are doing:
For more details on this see the documentation on using variables in Azure DevOps: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch