awslabs / amazon-app-runner-deploy

Registers an AWS AppRunner Service and deploys the application using the source code of a given GitHub repository. Supports both source code and Docker image based service
MIT No Attribution
50 stars 32 forks source link

Image is ignored for existing App Runner Service #13

Closed TomaszG closed 1 year ago

TomaszG commented 2 years ago

Repro steps:

  1. Push two different images/tags to the ECR private registry (e.g. main and develop)
  2. Configure App Runner manual to deploy one of those, e.g. main
  3. Configure and run App Runner to deploy/refresh that service but with image set to the second image, e.g. develop
  4. After the job is finished check whether the develop image is deployed

Current result: Service was refreshed but with the first image (main)

Expected result: Image from the image field should be used for the new service instance.

My setup:

  1. demo:main and demo:develop are uploaded to ECR
  2. demo-env App Runner service is configured with main image
  3. I'm triggering the workflow with imageTag set to develop
name: Deploy to demo env

on:
  workflow_dispatch:
    inputs:
      imageTag:
        description: "Image tag to deploy"
        required: true
        default: "develop"

jobs:
  deploy-demo:
    # avoid running the job when build for the branch is running
    concurrency:
      group: refs/heads/${{ github.event.inputs.imageTag }}
      cancel-in-progress: false
    runs-on: ubuntu-latest
    env:
      AWS_REGION: <<redacted>>
    steps:
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ env.AWS_REGION }}

      - name: Deploy to App Runner Image
        id: deploy-apprunner
        uses: awslabs/amazon-app-runner-deploy@main
        with:
          service: demo-env
          image: ${{ secrets.AWS_ECR_REPOSITORY }}/<<redacted>>/demo:${{ github.event.inputs.imageTag }}
          access-role-arn: ${{ secrets.AWS_ECR_ACCESS_ROLE_ARN }}
          region: ${{ env.AWS_REGION }}
          cpu: 1
          memory: 2
          wait-for-service-stability: true

      - name: Demo output
        run: |
          echo "App runner service-id ${{ steps.deploy-apprunner.outputs.service-id }}"
          echo "Visit <<redacted>>"

Job log:

Run awslabs/amazon-app-runner-deploy@main
  with:
    service: demo-env
    image: ***/<<redacted>>/demo:develop
    access-role-arn: ***
    region: <<redacted>>
    cpu: 1
    memory: 2
    wait-for-service-stability: true
  env:
    AWS_REGION: <<redacted>>
    AWS_DEFAULT_REGION: <<redacted>>
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
Updating existing service demo-env
Service update initiated with operation ID - <<redacted>>
Waiting for the service <<redacted>> to reach stable state
Service <<redacted>> has reached the stable state RUNNING
App Runner step - DONE!