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

Environment variables unavailable in inlineScript #7

Closed
oliwheeler opened this issue Nov 14, 2019 · 4 comments
Closed

Environment variables unavailable in inlineScript #7

oliwheeler opened this issue Nov 14, 2019 · 4 comments

Comments

@oliwheeler
Copy link
Contributor

oliwheeler commented Nov 14, 2019

Currently, only the GITHUB_WORKSPACE environment variable is set.
The other default environment variables are not available.

Environment variables set by the user in the workflow YAML are also not available.

The documentation regarding create a Docker container action shows that the environment variables are passed to the container here

Expected behaviour:

  • All default environment variables are available in inlineScript
  • All user set environment variables are available in inlineScript
jalajmsft pushed a commit that referenced this issue Nov 21, 2019
* Add GITHUB_SHA environment variable

This PR makes the GITHUB_SHA default environment variable available to use in inlineScript.
This change does not address the issue #7 since it does not pass down all the environment variables (default ones and ones set by the user). This is stopgap solution that should be superseded by a more scalable solution that addresses issue #7 completely.

* separate environment variables parameters
jalajmsft pushed a commit that referenced this issue Nov 21, 2019
* Add GITHUB_SHA environment variable

This PR makes the GITHUB_SHA default environment variable available to use in inlineScript.
This change does not address the issue #7 since it does not pass down all the environment variables (default ones and ones set by the user). This is stopgap solution that should be superseded by a more scalable solution that addresses issue #7 completely.

* separate environment variables parameters
jalajmsft added a commit that referenced this issue Nov 22, 2019
* Add GITHUB_SHA environment variable (#8)

* Add GITHUB_SHA environment variable

This PR makes the GITHUB_SHA default environment variable available to use in inlineScript.
This change does not address the issue #7 since it does not pass down all the environment variables (default ones and ones set by the user). This is stopgap solution that should be superseded by a more scalable solution that addresses issue #7 completely.

* separate environment variables parameters

* Adding output files
@jalajmsft jalajmsft self-assigned this Dec 30, 2019
@julie-ng
Copy link

@jalajmsft - why is this closed? Expected behavior as posted by original user is still NOT resolved:

All user set environment variables are available in inlineScript

Yep, I need this behavior too because I want to reuse the commands and pass variables depending on environment (dev vs production). This is what I am using and it does not work.

    - name: "Azure CLI: upload assets to blob storage"
      uses: azure/CLI@v1
      env:
        STORAGE_ACCOUNT: "mystorageaccount"
        STORAGE_CONTAINER: "assets"
      with:
        inlineScript: |
          echo "doesn't work $STORAGE_ACCOUNT"
          echo "doesn't work either ${{ env.STORAGE_ACCOUNT }}"
          echo "so of course below fails"
          az storage blob upload-batch \
            --account-name ${{ env.STORAGE_ACCOUNT }} \
            --source ./public/assets \
            --destination ${{ env.STORAGE_CONTAINER }}

@julie-ng
Copy link

Um, no idea why @ing @jalajmsft unassigned them from issue… sorry 🤷‍♀️

@julie-ng
Copy link

julie-ng commented Sep 3, 2020

Nevermind, this was fixed in v1.0.3 release, but the commits never referenced this issue
https://github.com/Azure/cli/releases/tag/v1.0.3

kanika1894 added a commit that referenced this issue Nov 27, 2020
* add lib and node_modules for release branch (#6)

* Users/jaminda/GitHub sha (#9)

* Add GITHUB_SHA environment variable (#8)

* Add GITHUB_SHA environment variable

This PR makes the GITHUB_SHA default environment variable available to use in inlineScript.
This change does not address the issue #7 since it does not pass down all the environment variables (default ones and ones set by the user). This is stopgap solution that should be superseded by a more scalable solution that addresses issue #7 completely.

* separate environment variables parameters

* Adding output files

* GITHUB_* enironement variables are available during script execution (#10) (#12)

* Allowing white-space characters in environment variables (#14) (#15)

* Allow access to user defined variables [Cherry pick from master and build the code for releases] (#17)

* Allowing user-defined env variable to be accessible (#16)

* Allowing user-defined env variable to be accessible

* Resolving PR comments

* Cherry pick and compile the code

* removing node modules

* removing unnecessary files

* updating version

* update gitignore

Co-authored-by: Bishal Prasad <biprasad@microsoft.com>
Co-authored-by: Jalaj Minda <49639049+jalajmsft@users.noreply.github.com>
Co-authored-by: Kanika Pasrija <kanikapasrija@Kanikas-MacBook-Pro.local>
christophwille added a commit to christophwille/deploy-to-azure-playground that referenced this issue Apr 27, 2021
@branostupak
Copy link

What's the proper way to use ENV variables in inlineScript?

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

No branches or pull requests

4 participants