Azure / container-apps-deploy-pipelines-task

Azure Pipelines Task (Release Candidate) for building and deploying Azure Container Apps
MIT License
6 stars 10 forks source link

imageToBuild seems to be ignored #43

Open GK-winamp opened 5 months ago

GK-winamp commented 5 months ago

Hi all,

In the build phase i keep getting the following message and the default image name is being used:

No imageToBuild argument was provided; setting the image to be built to '***.azurecr.io/ado-task/container-app:43.20240409.12'.
No imageToDeploy argument was provided; setting the image to deploy to '***.azurecr.io/ado-task/container-app:43.20240409.12'.

imageToBuild is being used in the pipeline config, but it doesnt like it's being picked up:

trigger:
- master
pool:
  vmImage: ubuntu-latest
steps:
  - task: AzureContainerAppsRC@1
    displayName: Build and deploy Container App
    inputs:
      connectedServiceNameARM: 'arm-service-connection-dev'
      acrName: 'xxx'
      dockerfilePath: 'xxx.Test.Api/Dockerfile'
      imageToBuild:: 'xxx.azurecr.io/xxx.test.api:234'
      acrUsername: $(ACR_USERNAME_SECRET)
      acrPassword: $(ACR_PASSWORD_SECRET)
      appSourcePath: '$(System.DefaultWorkingDirectory)'
      resourceGroup: 'rg-aca-dev-001'
      containerAppEnvironment: 'xxx'

Tagging @harryli0108

GK-winamp commented 5 months ago

@harryli0108 it doesn't seem to pick those settings up at all:

No imageToBuild argument was provided; setting the image to be built to '***.azurecr.io/ado-task/container-app:65.20240412.16'.
No dockerfilePath argument provided; checking for 'Dockerfile' at the root of app source path '/home/vsts/work/1/s' to build image from.
/usr/bin/bash -c (curl -sSL "[https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz"](https://github.com/buildpacks/pack/releases/download/v0.27.0/pack-v0.27.0-linux.tgz%22) | tar -C /usr/local/bin/ --no-same-owner -xzv pack)
pack
/usr/bin/docker run --rm -v /home/vsts/work/1/s:/app mcr.microsoft.com/oryx/cli:builder-debian-buster-20230208.1 /bin/bash -c oryx dockerfile /app | head -n 1 | sed 's/ARG RUNTIME=//' >> /app/oryx-runtime.txt

Right now I'm just trying to deploy an existing image that's in ARC already, but it keeps building and deploying ..

    - job: 'Deploy'
      displayName: 'Deployment job'
      steps:
        - task: AzureContainerAppsRC@1
          displayName: Deploy Container App
          inputs:
            connectedServiceNameARM: 'arm-service-connection-dev'
            containerAppName: 'xxx'
            acrName: 'xxx'
            imageToDeploy: 'xxx.azurecr.io/xxx.test.api:123'
            acrUsername: $(ACR_USERNAME_SECRET)
            acrPassword: $(ACR_PASSWORD_SECRET)
            appSourcePath: '$(System.DefaultWorkingDirectory)'
            resourceGroup: 'rg-aca-dev-001'
            containerAppEnvironment: 'aca-temp'
harryli0108 commented 5 months ago

@GK-winamp I do apologize for the delayed reply here. I’ll try reproduce this issue from my end. Could you share a bit more pipeline logs if possible?

Meanwhile, if you want to deploy the container app using an existing image, you can remove the appSourcePath. That should be able to skip the building steps.

GK-winamp commented 5 months ago

Removing appSourcePath helped, now it deploys without building. After being stuck for some time, I went with regular docker build job (- task: Docker@2) to build it using correct naming and tagging and push it all to ACR.