Azure / spring-apps-deploy

GitHub Actions to deploy to Azure Spring Cloud
MIT License
12 stars 9 forks source link

Deployment fails for custom container - no error logged #38

Closed exaucae closed 8 months ago

exaucae commented 10 months ago

I use the action to deploy a custom container from github container registry:

  deploy:
    runs-on: ubuntu-latest
    name: deploy
    steps:
      - name: Login via Azure CLI
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}
      - name: Deploy custom container image
        uses: azure/spring-apps-deploy@v1
        with:
          azure-subscription: ${{ vars.AZURE_SPRING_APPS_SUBSCRIPTION }}
          action: deploy
          service-name: ${{ vars.AZURE_SPRING_APPS_SERVICE_NAME }}
          app-name: ${{ vars.AZURE_SPRING_APPS_APP_NAME }}
          use-staging-deployment: false
          container-registry: ghcr.io
          registry-username: ${{ github.actor }}
          registry-password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          container-image: username/repo:v1

The action runs for 16 minutes before failing without error message:

Warning: Deployment failed. Please check the application logs for more details. Error: Action failed with error:

[debug]Node Action run completed with exit code 1

[debug]Finishing: Deploy custom container image

I was able to trace it back to this function:

https://github.com/Azure/spring-apps-deploy/blob/main/src/DeploymentProvider/DeploymentHelper.ts#L463-L472

    private static async deployWithLog(client: asa.AppPlatformManagementClient, params: ActionParameters, deploymentResource: asa.DeploymentResource) {
        try {
            const response = await client.deployments.beginCreateOrUpdateAndWait(params.resourceGroupName, params.serviceName, params.appName, params.deploymentName, deploymentResource);
            core.debug('deploy response: ' + JSON.stringify(response));
        } catch (e:any) {
            core.warning("Deployment failed. Please check the application logs for more details.");
            await this.printLatestAppInstanceLog(client, params);
            throw e;
        }
    }

Could we add the err to the warning message. When the error is thrown, it doesn't log error.message in main.ts: https://github.com/Azure/spring-apps-deploy/blob/ee95b349bfb9497436d9203b722080459ee35ed6/src/main.ts#L15

Is there any insight I can have as to why azure isn't deploying the container? I was able to pull the image from ghcr using the same username and personal access token it locally

exaucae commented 8 months ago

Saw that #37 fixes this one in v1.6.0