I am using Command line in VSTS in the Release pipeline. Unfortunately not sure how to pass multiple arguments like "username", "password" and "siteurl" to the command line
I am using Command line in VSTS in the Release pipeline. Unfortunately not sure how to pass multiple arguments like "username", "password" and "siteurl" to the command line
If you are using Command Line task, you can use the format $(variablename) to pass argument.
Such as below example:
For passing multiple variables in the Command Line task, the format is still $(variablename).
Such as, the command line script can be:
echo "Please enter your user name: $(username). Please enter to you password: $(password). Please enter the site url: $(siteurl)"
As per the documentation, and using YAML code, this can be achieved by the env argument.
# Command line
# Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
- task: CmdLine@2
inputs:
script: 'echo Example of a command line task'
env:
var1: someValue
var2: $(someVariable)
...
Note that:
Secret variables are not automatically mapped. If you have a secret variable called Foo, you can map it in as shown in the above example
Also, do not forget that you have to declare the variables you are using. For groups of variables, which on Azure DevOps you can declare in the Pipelines Menu, on the Library sub-menu. In the image below, I am declaring a group variable named Tailspin Space Game - Release
I can then reference the group variables in the YAML code as follows:
variables:
- group: 'Timeline CV - Release'