Azure / container-apps-deploy-action

GitHub Action for building and deploying Azure Container Apps
MIT License
50 stars 30 forks source link

Deploy action always tries to build docker image despite specify an existing image in registry #109

Open philipbTC opened 3 months ago

philipbTC commented 3 months ago

Hi,

I'm trying to deploy a Spring boot API which is built using google JIB. The JIB plugin is also sucessfully pushing my image to the ACR. However the deploy action seems to be also trying to build its own image. If I have read the documentation correctly this should not be the case given my yml:

name: Trigger auto deployment for availability-service

# When this action will be executed
on:
  # Automatically trigger it when detected changes in repo
  push:
    branches:
      [ main ]
    paths:
      - '**'
      - '.github/workflows/availability-service-AutoDeployTrigger-6a25879c-40df-4a82-adb9-2c29787213d4.yml'

  # Allow manual trigger
  workflow_dispatch:

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    permissions:
      id-token: write #This is required for requesting the OIDC JWT Token
      contents: read #Required when GH token is used to authenticate with private repo

    steps:
      - name: Checkout to the branch
        uses: actions/checkout@v2

      - name: Azure Login
        uses: azure/login@v1
        with:
          client-id: ${{ secrets.AVAILABILITYSERVICE_AZURE_CLIENT_ID }}
          tenant-id: ${{ secrets.AVAILABILITYSERVICE_AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AVAILABILITYSERVICE_AZURE_SUBSCRIPTION_ID }}

      - name: Set up JDK 17
        uses: actions/setup-java@v2
        with:
          java-version: '17'
          distribution: 'adopt'
          cache: 'gradle'

      - name: Grant execute permission for gradlew
        run: chmod +x gradlew

      # Custom build step using Gradle Jib
      - name: Build and push container image to registry
        run: |
          ./gradlew jib \
            -Djib.to.auth.username=${{ secrets.AVAILABILITYSERVICE_REGISTRY_USERNAME }} \
            -Djib.to.auth.password=${{ secrets.AVAILABILITYSERVICE_REGISTRY_PASSWORD }} \
            -Djib.to.image=testtechcontainerregistry.azurecr.io/availability-service:${{ github.sha }}

      - name: Build and push container image to registry
        uses: azure/container-apps-deploy-action@v2
        with:
          registryUrl: testtechcontainerregistry.azurecr.io
          registryUsername: ${{ secrets.AVAILABILITYSERVICE_REGISTRY_USERNAME }}
          registryPassword: ${{ secrets.AVAILABILITYSERVICE_REGISTRY_PASSWORD }}
          containerAppName: availability-service
          resourceGroup: test-tech-us
          imageToDeploy: testtechcontainerregistry.azurecr.io/availability-service:${{ github.sha }}

I would appriciate any assistance with this.