Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AzureCLI does not preserve variable name case #9687

Closed
andreacassioli opened this issue Feb 25, 2019 · 7 comments
Closed

AzureCLI does not preserve variable name case #9687

andreacassioli opened this issue Feb 25, 2019 · 7 comments

Comments

@andreacassioli
Copy link

andreacassioli commented Feb 25, 2019

I am setting up a build pipeline in AzureDevOps. That pipeline has an AzureCLI task that uses a pipeline variable say apiKey. The variable name (the content of the variable is irrelevant here), is in camel style.

When the AzureCLI script runs as bash, it actually uses an upper case version of the variable name, i.e. APIKEY. This breaks some of my commands and scripts, as bash considers variable names to be case sensitive!

@bishal-pdMSFT
Copy link
Contributor

The task sets an environment variable using upper case. i.e. it will set APIKEY as environment variable. But if you use the variable with $(apiKey) notation (and pass it to your script as an argument if needed), it would work fine.
Would you elaborate how you are using the variable in the task?

@andreacassioli
Copy link
Author

Hi, I run Terraform in AzureCLI task, and I use env variables to pass some configuration to Terraform. Terraform attempts to fill unspecified configuration from the environment variables:

https://www.terraform.io/docs/configuration/variables.html#environment-variables

So I have to make sure that the case is correct. I can fix on my side fiddling with my scripts of course.

In general, as I run in bash, it seems quite confusing that the case of the pipeline variable is not preserved. At least there should be a clear warning somewhere.

@bishal-pdMSFT
Copy link
Contributor

@andreacassioli Would it help if you use command line variables to pass arguments to Terraform rather than depend on environment variables implicitly.
https://www.terraform.io/docs/configuration/variables.html#variables-on-the-command-line

@andreacassioli
Copy link
Author

@bishal-pdMSFT of course I could. But I use a Makefile and I do not want to change it every time I add or remove a variable! Moreover, there is a limit on the number of vars you can pass as argument.

Anyway, my point is that a bash user would expect the case of a variable should to be preserved. The current behaviour is misleading. If you can not for whatever reason, please make it clear!

@bishal-pdMSFT
Copy link
Contributor

This behavior is not defined by Azure CLI task. This is how the azure pipelines agent sets the environment variables and executes task.
@chrisrpatterson @bryanmacfarlane would you like to comment on this behavior? - the build/release pipeline variables are set in Upper case environment variables.

@bishal-pdMSFT
Copy link
Contributor

ping @bryanmacfarlane @chrisrpatterson

@bishal-pdMSFT
Copy link
Contributor

@andreacassioli there is already a closed issue in pipelines agent repo which explains the behavior. If you do not agree with the explanation, you can re-open that issue.
I am closing current issue as it is not related to task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants