Azure / Azure/static-web-apps

Ignoring values passed in `env` in Azure DevOps pipeline. It sends all values defined in `Variables`

Open
#756 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

As said in the documentation, in order to pass environment variables to ASWA through Azure DevOps pipeline, they should be declared in `env` field (https://docs.microsoft.com/en-us/azure/static-web-apps/build-configuration?tabs=github-actions#environment-variables)

However, `env` field is currently being ignored, and the pipeline passes all the variables declared in `Variables`

**To Reproduce**

```
- task: AzureStaticWebApp@0
displayName: Release to ASWA
inputs:
app_location: 'build' # App source code path relative to cwd
api_location: 'api' # Api source code path relative to cwd
skip_app_build: true
azure_static_web_apps_api_token:
env:
MY_ENV_VAR: 1234
```
In `Variables` create other env variable
![image](https://user-images.githubusercontent.com/6615888/157736230-818cadf3-59d2-4e36-a41f-e9819f360574.png)
![image](https://user-images.githubusercontent.com/6615888/157736296-b4dc1cf2-bc1a-4a7f-80e2-6cb38c86d0ed.png)

If you try to load both `MY_ENV_VAR` and `OTHER_ENV_VAR` from your static web app, you will notice that only OTHER_WEB_APP has been properly set

**Expected behavior**
The yml task should consider only environment variables defined in `env` field, regardless of variables created in `Variables`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.