Deployment fails when running via CI/CD from github to webapp

Gourab Hazra 5 Reputation points
2023-07-21T16:11:18.25+00:00

I hadn't changed any thing in terms of requirements in my code. I am suddenly getting failed deployment on my azure web app.

Also I included instructions to update pip in the .gihub folder under workflow. It doesn't seem to be following those as well.

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions

name: Build and deploy Python app to Azure Web App - xxxxxxxxxxxxxxxxx

on:
  push:
    branches:
      - master
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true

      - name: Set up Python version
        uses: actions/setup-python@v1
        with:
          python-version: '3.9'

      - name: Create and start virtual environment
        run: |
          python -m venv venv
          source venv/bin/activate
      
      # - name: Install libgl1
      #   run: |
      #     sudo apt-get update
      #     sudo apt-get install -y libgl1-mesa-dev
      #     sudo apt-get install -y libglib2.0-0

      - name: Upgrade pip
        run: python -m pip install --upgrade pip

      - name: Install wheel and setuptools
        run: pip install -U wheel setuptools
      
      - name: Install dependencies
        run: pip install -r requirements.txt
        
      # Optional: Add step to run tests here (PyTest, Django test suites, etc.)
      
      - name: Upload artifact for deployment jobs
        uses: actions/upload-artifact@v2
        with:
          name: python-app
          path: |
            . 
            !venv/

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

    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v2
        with:
          name: python-app
          path: .
          
      - name: 'Deploy to Azure Web App'
        uses: azure/webapps-deploy@v2
        id: deploy-to-webapp
        with:
          app-name: 'xxxxxxxxxxxxxxxxxxxxx'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_9xxxxxxxxxxxxxxxxxxxxxxxxxxx }}


Here are the logs for the error:

Run azure/webapps-deploy@v2
Package deployment using ZIP Deploy initiated.
Updating submodules.
Preparing deployment for commit id '9d0a4acc-7'.
PreDeployment: context.CleanOutputPath False
PreDeployment: context.OutputPath /home/site/wwwroot
Repository path is /tmp/zipdeploy/extracted
Running oryx build...
Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9 -p virtualenv_name=antenv --log-file /tmp/build-debug.log  -i /tmp/8db8a0320db1556 --compress-destination-dir | tee /tmp/oryx-build.log
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20230508.1, Commit: 7fe2bf39b357dd68572b438a85ca50b5ecfb4592, ReleaseTagName: 20230508.1

Build Operation ID: dfad305d9033a9d5
Repository Commit : 9d0a4acc-7296-4b26-8621-f5bf8b93bca2
OS Type           : buster
Image Type        : githubactions

Detecting platforms...
Detected following platforms:
  python: 3.9.15

Using intermediate directory '/tmp/8db8a0320db1556'.

Copying files to the intermediate directory...
Done in 1 sec(s).

Source directory     : /tmp/8db8a0320db1556
Destination directory: /home/site/wwwroot

Python Version: /tmp/oryx/platforms/python/3.9.15/bin/python3.9
Creating directory for command manifest file if it does not exist
Removing existing manifest file
Python Virtual Environment: antenv
Creating virtual environment...
Activating virtual environment...
Running pip install...
[15:57:31+0000] Collecting absl-py==1.4.0
[15:57:31+0000]   Using cached absl_py-1.4.0-py3-none-any.whl (126 kB)
[15:57:31+0000] Collecting addict==2.4.0
[15:57:31+0000]   Using cached addict-2.4.0-py3-none-any.whl (3.8 kB)
[15:57:31+0000] Collecting altair==5.0.1
[15:57:31+0000]   Using cached altair-5.0.1-py3-none-any.whl (471 kB)
[15:57:31+0000] Collecting attrs==23.1.0
[15:57:31+0000]   Using cached attrs-23.1.0-py3-none-any.whl (61 kB)
[15:57:32+0000] Collecting azure-core==1.27.1
[15:57:32+0000]   Using cached azure_core-1.27.1-py3-none-any.whl (174 kB)
[15:57:32+0000] Collecting azure-identity==1.13.0
[15:57:32+0000]   Using cached azure_identity-1.13.0-py3-none-any.whl (151 kB)
[15:57:32+0000] Collecting basicsr==1.4.2
[15:57:32+0000]   Using cached basicsr-1.4.2.tar.gz (172 kB)
[15:57:32+0000]   Preparing metadata (setup.py): started
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      Traceback (most recent call last):
        File "/tmp/8db8a0320db1556/antenv/lib/python3.9/site-packages/setuptools/installer.py", line 75, in fetch_build_egg
          subprocess.check_call(cmd)
        File "/tmp/oryx/platforms/python/3.9.15/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/tmp/8db8a0320db1556/antenv/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp0n7nd77m', '--quiet', 'torch']' died with 
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.