Azure / Azure/azure-cli-extensions
[containerapp] Azure containerapp compose create does not read unset environment variable defaults
- Dominant language
- Python
- Stars
- 454
- Forks
- 1.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 64
Description
Source: https://github.com/Azure/azure-cli/issues/32606 (by @jackroc97)
Affected extension: `containerapp` (`src/containerapp/`)
---
<<>>
# Issue #32606 (by @jackroc97)
## Title
Azure containerapp compose create does not read unset environment variable defaults
## Body
### Describe the bug
## Bug Description
I am building a containerapp using `az containerapp compose create`. My compose file's `environment` section declares several variables that are to be read in from environment variables, many of which have default values. Rather than using the default value for unset environment variables, the command uses the literal string of the variable reference as the value.
## Example
Say this is the compose file:
''' yml
environment:
VAR_A: ${VAR_A}
VAR_B: ${VAR_B:-foo}
VAR_C: ${VAR_C:-bar}
'''
And my locally set environment variables are:
''' bash
VAR_A=hello
VAR_B=world
# VAR_C intentionally left un-set
'''
Azure will read my environment variables as:
''' json
"env": [
{
"name": "VAR_A",
"value": "hello"
},
{
"name": "VAR_B",
"value": "world"
},
{
"name": "VAR_C",
"value": "${VAR_C:-bar}" // BUG: This should be "bar" since VAR_C was not set
},
]
'''
### Related command
`az containerapp compose create`
### Errors
Please see description
### Issue script & Debug output
Please see description.
### Expected behavior
Default values for un-declared env variables referenced in the compose file should be interpreted correctly.
### Environment Summary
azure-cli 2.81.0
containerapp extension 1.3.0b1
### Additional context
_No response_
## Comments
### Comment by @yonzhan
Thank you for opening this issue, we will look into it.
### Comment by @microsoft-github-policy-service[bot]
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @howang-ms, @Greedygre.
<<>>
Contributor guide
Assessment
This issue has not been assessed yet.