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

Add --revision-suffix parameter support (which is a param from az containerapp create and az containerapp update) #49

Open
PedroCosta93 opened this issue Jun 22, 2023 · 5 comments
Assignees

Comments

@PedroCosta93
Copy link

Like the title says, is it possible to add support to the --revision-suffix parameter ?
I am having issues deploying new revisions, I don't get any errors but no revision is created after I update my container app using "azure/container-apps-deploy-action@v1" with a newly built image. The new image has the same name but has code changes. It works when I create a revision through the portal and give it a Suffix.

@PedroCosta93 PedroCosta93 changed the title Add --revision-suffix parameter to az containerapp create and az containerapp update Add --revision-suffix parameter support (which is a param from az containerapp create and az containerapp update) Jun 22, 2023
@cormacpayne
Copy link
Member

@PedroCosta93 Hey Pedro, thanks for filing this issue -- currently, we only support setting the revision suffix via the yamlConfigPath argument that takes in a YAML configuration file. Within this file, you can set the properties.template.revisionSuffix field to change the suffix appended to your revision.

Does this seem like a possible solution for you, or were you looking for an argument that's exposed directly as a part of the GitHub Action?

@PedroCosta93
Copy link
Author

PedroCosta93 commented Jun 23, 2023

Hey, thank you for the fast reply. That can work as a workaround for now but it has the issue that I have to alter the suffix value before deploying (either with a github action or manually in the code) which is not ideal. Although I noticed something, I have an action which deploys 3 container apps and if I use the yamlconfigPath in one of them, the others throw an error if I don't supply the parameter (which is optional). this is the error: ERROR: argument --yaml: expected one argument

@cormacpayne
Copy link
Member

@PedroCosta93 Thanks for the reply -- we've had similar issues raised about modifying the YAML configuration file within the workflow to utilize some values defined there (e.g., the GitHub Action run ID), so this is something we'll need to circle back on to find an easy route for customers to use (which may end up being a separate argument for the action itself).

The error you've replied with is an interesting one -- I'm not sure I've seen that before 🤔 Would you mind sending me your workflow YAML file (with any meaningful or identifying values stripped out), or maybe just the steps in the workflow relevant to this GitHub Action?

@PedroCosta93
Copy link
Author

PedroCosta93 commented Jun 23, 2023

I was able to modify the yaml configuration file using this action: fjogeleit/yaml-update-action@main I do it right after the checkout so when i reach the deploy stage it uses the modified yaml file.
Sure here's a snippet of the job where I use the action:

deploy:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: [Build-Test-Scan]

env:      
  WORKING_DIRECTORY: my/directory      

steps:  
- name: Checkout code
  uses: actions/checkout@v3

- name: Update values.yaml
  uses: fjogeleit/yaml-update-action@main
  with:
      valueFile: '/.github/workflows/container-app-suffixes.yml'
      propertyPath: 'template.revisionSuffix'
      value: ${{ github.run_id }}-${{ github.run_number }}	
      commitChange: false


- name: Log in to Azure
  uses: azure/login@v1
  with:
    creds: 'xxxxxx'        
  
- name: Build and push App1 image
  uses: azure/container-apps-deploy-action@v1
  with:
    appSourcePath: ${{ github.workspace }}/${{ env.WORKING_DIRECTORY }}
    dockerfilePath: APP/Dockerfile
    acrName: ${{ vars.CONTAINER_REGISTRY_NAME }}
    containerAppName: ${{ vars.APP1_CONTAINER_APP_NAME }}
    resourceGroup: ${{ vars.RESOURCE_GROUP_NAME }}
    runtimeStack: 'dotnetcore:7.0'
    imageToBuild: ${{ vars.CONTAINER_REGISTRY_NAME }}.azurecr.io/github-action/app:app        
    environmentVariables: ASPNETCORE_ENVIRONMENT=XXXX
    yamlConfigPath: /.github/workflows/container-app-suffixes.yml

    
- name: Build and push APP2 docker image
  uses: azure/container-apps-deploy-action@v1
  with:
    appSourcePath: ${{ github.workspace }}/${{ env.WORKING_DIRECTORY }}
    dockerfilePath: APP2/Dockerfile
    acrName: ${{ vars.CONTAINER_REGISTRY_NAME }}
    containerAppName: ${{ vars.APP2_CONTAINER_APP_NAME }}
    resourceGroup: ${{ vars.RESOURCE_GROUP_NAME }}
    runtimeStack: 'dotnetcore:7.0'
    imageToBuild: ${{ vars.CONTAINER_REGISTRY_NAME }}.azurecr.io/github-action/app2:app2
    environmentVariables: ASPNETCORE_ENVIRONMENT=XXXX`

As you can see, I only use the yamlConfigPath on APP1 although the error is in APP2: ERROR: argument --yaml: expected one argument

@cormacpayne
Copy link
Member

@PedroCosta93 Huh, that's a very strange error to encounter for APP2, specifically because the Azure CLI commands we execute under-the-hood that use --yaml are solely dependent on the yamlConfigPath argument being provided to the GitHub Action, so I'm really curious why it thinks that argument was provided 🤔

If you are able to, would you mind sharing the logs from the APP2 build step so that I can take a look at the inputs and environment variables defined throughout the step? Feel free to strip out any uniquely identifying information or anything you don't feel comfortable sharing.

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

2 participants