Closed ghost closed 6 years ago
I will check.
Fixed with 0.9
node {
azureCLI commands: [[exportVariablesString: '/ipAddress|PUBLIC_IP', script: 'az network public-ip show --resource-group test -n pip']], principalCredentialId: 'superSecretCredential'
sh "echo ${PUBLIC_IP}"
}
It doesn't work at 0.9, I still have the error, the variable is empty
azureCLI commands: [[exportVariablesString: '/ipAddress|PUBLIC_IP', script: 'az container show --name --resource-group ']], principalCredentialId: 'serviceJenkinsPrincipal' sh "echo ${PUBLIC_IP}"
Transforming to environment variables: /ipAddress|PUBLIC_IP [Pipeline] sh
[Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS
The real reason that the PUBLIC_IP variable is empty is because the JSON path is not valid or is another JSON object.
this example works for me, (pay atention on exportVariablesString = "/ipAddress/ip|PUBLIC_IP'"):
azureCLI commands: [[exportVariablesString: '/ipAddress/ip|PUBLIC_IP', script: 'az container show --name --resource-group ']], principalCredentialId: 'serviceJenkinsPrincipal'
sh "echo ${PUBLIC_IP}"
Hi,
I'm trying to use the exportVariablesString as part of a query to make my pipeline simpler, but I am unable to get the environment variable to work.
Pipeline:
Output:
I would love to get this working to clean up my Jenkinsfile