Chris Cavell
Chris Cavell

Reputation: 189

Error with GitHub Action Deploy to Azure Web App

Just converted to new GitHub App Services Action Build And Deployment Pipeline and getting the following error:

Run azure/webapps-deploy@v2
  with:
    app-name: ***
    slot-name: ***
    publish-profile: ***
    package: .
Package deployment using ZIP Deploy initiated.
Fetching changes.
Cleaning up temp folders from previous zip deployments and extracting pushed zip file D:\local\Temp\zipdeploy\gtfnmdqs.zip (19.64 MB) to D:\local\Temp\zipdeploy\extracted
Error: Failed to deploy web package to App Service.
Error: Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
App Service Application URL: https://***.azurewebsites.net

Nothing in log indicating an error other than failed to deploy. No changes where made to repository (other than new yaml) and not sure if error is because no code changes detected. If so why throw an error vs. a warning?

yml is standard generated by Azure:

on:
  workflow_dispatch:
    branches: [main]

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2

    - name: Set up .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '6.0.x'
        include-prerelease: true

    - name: Build with dotnet
      run: dotnet build --configuration Release

    - name: dotnet publish
      run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

    - name: Upload artifact for deployment job
      uses: actions/upload-artifact@v2
      with:
        name: .net-app
        path: ${{env.DOTNET_ROOT}}/myapp

  deploy:
    runs-on: windows-latest
    needs: build
    environment:
      name: '***'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

    steps:
    - name: Download artifact from build job
      uses: actions/download-artifact@v2
      with:
        name: .net-app

    - name: Deploy to Azure Web App
      id: deploy-to-webapp
      uses: azure/webapps-deploy@v2
      with:
        app-name: '***'
        slot-name: '***'
        publish-profile: ${{ secrets.AzureAppService_PublishProfile_*** }}
        package: .

Side Note: I have a new App Service that works fine, this is an existing App Service initially using former CI/DI. Disconnected and generated new connection for CI/DI. Not sure if that matters.

Azure Log Details:

enter image description here

Deployment seems to be pegging out CPU of service plan which explains why everyone is having increase tier in order to resolve:

enter image description here

enter image description here

Tried shutting down all App Services and deploy with nothing else running but had no effect.

Also tried importing publish profile into Visual Studio but that fails as well ...

enter image description here

Even tried deleting exiting App Service and create new App Service but still cannot deploy.

Package deployment using ZIP Deploy initiated.
Updating submodules.
Preparing deployment for commit id '10c1139fcb'.
Generating deployment script.
Using cached version of deployment script (command: 'azure -y --no-dot-deployment -r "D:\local\Temp\zipdeploy\extracted" -o "D:\home\site\deployments\tools" --basic --sitePath "D:\local\Temp\zipdeploy\extracted\Source\Web\cdcavell\cdcavell.csproj"').
Running deployment command...
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling Basic Web Site deployment.
Creating app_offline.htm
Error: Could not find a part of the path 'D:\local\Temp\zipdeploy\extracted\Source\Web\cdcavell\cdcavell.csproj'.
KuduSync.NET from: 'D:\local\Temp\zipdeploy\extracted\Source\Web\cdcavell\cdcavell.csproj' to: 'D:\home\site\wwwroot'
Failed exitCode=1, command="kudusync" -v 50  -f "D:\local\Temp\zipdeploy\extracted\Source\Web\cdcavell\cdcavell.csproj" -t "D:\home\site\wwwroot" -n "D:\home\site\deployments\10c1139fcb004b0fbd7eb608cceb0855\manifest" -p "D:\Program Files (x86)\SiteExtensions\Kudu\94.30524.5227\bin\Scripts\firstDeploymentManifest" -i ".git;.hg;.deployment;deploy.cmd"
An error has occurred during web site deployment.
Error: Could not find a part of the path 'D:\local\Temp\zipdeploy\extracted\Source\Web\cdcavell\cdcavell.csproj'.\r\nD:\Program Files (x86)\SiteExtensions\Kudu\94.30524.5227\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
Error: Failed to deploy web package to App Service.
Error: Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
App Service Application URL: https://cdcavell.azurewebsites.net

Upvotes: 2

Views: 11890

Answers (4)

Gidi9
Gidi9

Reputation: 222

Setting this variable to 0 in the Settings-> Configuration blade of the Function App, did it for me. ENABLE_ORYX_BUILD=0

Some answers here might help if this doesn't do it for you.

Upvotes: -1

Abu Sufian
Abu Sufian

Reputation: 151

TL:DR; For me, I had to add appropriate "AzureWebJobsStorage" configuration value.

I used another user account to create a python function. That account had Global Administrator Role in Active Directory and is a co-administrator to the account's default subscription.

I created a python function. But the "AzureWebJobsStorage" was not there. In the GitHub Actions log, there was a warning saying, this variable is missing.

I would suggest to through the logs if this option doesn't solve your problem. I mean if anyone still faces this problem.

Upvotes: 2

wmmhihaa
wmmhihaa

Reputation: 953

If anyone is still getting this error, here is the solution and a desctiption of what likely caused the problem.

Before GitHub actions were a thing, we used Kudo directly from the Deployment Center of the App Service. However, becase our solution had multiple projects, we had to set a PROJECT configuration variable so Kudo would understand which project to deploy.

Since then, we have copied our app service configuration every time we set up a new site, including the PROJECT configuration variable. This variable is not required when using GitHub Actions, but is still used in Kudo, which is still the underlying framework for deploying your app when using azure/webapps-deploy@v2.

With the PROJECT configuration variable set, Kudo will add it as a parameter as visible in the log:

Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "C:\local\Temp\zipdeploy\extracted" -o "C:\home\site\deployments\tools" --basic --sitePath "C:\local\Temp\zipdeploy\extracted\YOUR-PROJECT-VARIABLE"'.

In conclusion, just remove the PROJECT configuration variable from your App Service Configuration.

Upvotes: 2

Nagireddy
Nagireddy

Reputation: 1

when I added these 2 configs under app settings my issue was resolved WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE

Run Azure Function Action Using RBAC for authentication, GitHub Action will perform resource validation. Successfully acquired site configs from function app! Detected function app sku: Dedicated Successfully acquired app settings from function app (RBAC)! Detected function app language: Java Will archive ./lastfunczip/target/azure-functions/cig-loy-tx-rcvr into /home/runner/work/_temp/temp_web_package_5223027369321132.zip as function app content Will use https:///api/zipdeploy to deploy since RBAC Azure credential is detected. Package deployment using ZIP Deploy initiated. Error: Failed to deploy web package to App Service. Error: Execution Exception (state: PublishContent) (step: Invocation) Error: When request Azure resource at PublishContent, zipDeploy : Failed to use /home/runner/work/_temp/temp_web_package_5223027369321132.zip as ZipDeploy content Error: Failed to deploy web package to App Service. Internal Server Error (CODE: 500) Error: Error: Failed to deploy web package to App Service. Internal Server Error (CODE: 500) at Kudu. (/home/runner/work/_actions/Azure/functions-action/v1/node_modules/azure-actions-appservice-rest/Kudu/azure-app-kudu-service.js:175:23) at Generator.next () at fulfilled (/home/runner/work/_actions/Azure/functions-action/v1/node_modules/azure-actions-appservice-rest/Kudu/azure-app-kudu-service.js:5:58) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5) Error: Deployment Failed!

Upvotes: -3

Related Questions