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

Wrong argument for environment variables when updating #89

Open
ohmios opened this issue Jan 10, 2024 · 8 comments
Open

Wrong argument for environment variables when updating #89

ohmios opened this issue Jan 10, 2024 · 8 comments

Comments

@ohmios
Copy link

ohmios commented Jan 10, 2024

Version 2 of this action passes --env-vars as a parameter to az containerapp update, but according to the documentation the parameter should be --set-env-vars. This causes the following error: unrecognized arguments: --env-vars.

image

The content of my workflow file that caused the error is:

name: Dockerize and deploy SvelteKit project to Azure Container App

on:
  push:
    branches:
      - main
  workflow_dispatch:

permissions:
  id-token: write
  contents: read

jobs:
  build-push-and-deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/[email protected]

      - name: Login to Azure
        uses: Azure/[email protected]
        with:
          client-id: ${{ secrets.AZURE_CLIENT_ID }}
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

      - name: Build and deploy app to Azure Container Apps
        uses: azure/container-apps-deploy-action@v2
        with:
          appSourcePath: ${{ github.workspace }}
          acrName: ${{ secrets.ACR_NAME }}
          containerAppName: ${{ secrets.CA_NAME }}
          resourceGroup: ${{ secrets.CA_RG_NAME }}
          imageToBuild: ${{ secrets.ACR_URL }}/my-app:${{ github.SHA }}.${{ github.RUN_ATTEMPT }}
          targetPort: 3000
          environmentVariables: >
              "AUTHORITY=secretref:authority"
              "TENANT_ID=secretref:tenant-id"
              "CLIENT_ID=secretref:client-id"
              "CLIENT_SECRET=secretref:client-secret"
              "REDIRECT_URI=secretref:redirect-uri"
              "COSMOS_ENDPOINT=secretref:cosmos-endpoint"
              "COSMOS_DATABASE=secretref:cosmos-database" 
              "COSMOS_CONTAINER=secretref:cosmos-container"
          

It works fine as long as the environmentVariables parameter is not set. The only difference between the content of this file and my current file is that I use Azure CLI Action to set the enviroment variables in a previous step, as a workaround.

@daniv-msft
Copy link
Contributor

Thanks @ohmios ! @cormacpayne, could you please confirm the discrepancy on our side?

@cormacpayne
Copy link
Member

@daniv-msft it looks like our intention is to use the --replace-env-vars argument when calling az containerapp update and --env-vars for other commands (such as create and up), but somehow we're getting into a flow where --env-vars is being used with update.

@snehapar9 would you mind taking a quick look since you recently worked on refactoring which command is being called for different flows?

@snehapar9
Copy link
Contributor

Thank you for opening this @ohmios! Do you mind sharing what your workflow file looks like? Would be helpful to determine why we're entering this flow based on the arguments provided to the action.

@ohmios
Copy link
Author

ohmios commented Jan 10, 2024

@snehapar9 I have updated the issue with the content of my workflow file. Let me know if you need more information.

@snehapar9
Copy link
Contributor

Thank you @ohmios! We are working on this. Will let you know if we need more information.

@harryli0108
Copy link
Member

harryli0108 commented Jan 25, 2024

@ohmios The fix for this issue has just been merged. The latest v2 should now include this fix. Please don't hesitate to let us know if there's any further issue!

I'll close this issue in a few days if there's no other problems regarding to the env var command issue.

@moderj
Copy link

moderj commented Feb 13, 2024

Hey I'm noticing an issue regarding the environmentVariables flag

This is the error it throws when running github action
ERROR: unrecognized arguments: --replace-env-vars LOG_LEVEL=info DB_URL=secretref:*** DB_NAME=secretref:***
Error: The process '/usr/bin/az' failed with exit code 2 Error: The process '/usr/bin/az' failed with exit code 2

This is the stage:
Screenshot 2024-02-13 102020

any help with that?

@shawndewet
Copy link

shawndewet commented Nov 27, 2024

Looks like this is still a problem.
I have a workflow that is failing because container app create is being called with --replace-env-vars instead of --env-vars.Image

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

7 participants