Search code examples
amazon-elastic-beanstalkgithub-actions

GitHub Actions workflow has stopped working


We use GitHub Actions to deploy the server app to AWS Beanstalk instance. Everything worked just fine couple of weeks ago but when I returned from my break this week I discovered we can't deploy anymore. The thing is, nobody changed anything so I assume something has changed/was updated either on GH or AWS end but I can't find any related info. Here's the GH workflow log:

Build container for action use: '/home/runner/work/_actions/hmanzur/actions-aws-eb/v1.0.0/Dockerfile'.
  /usr/bin/docker build -t c9a4a5:52e43b697a534189bf3fc89189a65d8a -f "/home/runner/work/_actions/hmanzur/actions-aws-eb/v1.0.0/Dockerfile" "/home/runner/work/_actions/hmanzur/actions-aws-eb/v1.0.0"
  Sending build context to Docker daemon   12.8kB
  
  Step 1/7 : FROM python:3
  3: Pulling from library/python
  d52e4f012db1: Already exists
  7dd206bea61f: Already exists
  2320f9be4a9c: Already exists
  6e5565e0ba8d: Already exists
  d3797e13cc41: Pulling fs layer
  70f90dfe001b: Pulling fs layer
  bd75605de417: Pulling fs layer
  3d0e1a4b14bc: Pulling fs layer
  3d0e1a4b14bc: Waiting
  bd75605de417: Download complete
  d3797e13cc41: Verifying Checksum
  d3797e13cc41: Download complete
  3d0e1a4b14bc: Verifying Checksum
  3d0e1a4b14bc: Download complete
  70f90dfe001b: Verifying Checksum
  70f90dfe001b: Download complete
  d3797e13cc41: Pull complete
  70f90dfe001b: Pull complete
  bd75605de417: Pull complete
  3d0e1a4b14bc: Pull complete
  Digest: sha256:d73088ce13d5a1eec1dd05b47736041ae6921d08d2f240035d99642db98bc8d4
  Status: Downloaded newer image for python:3
   ---> c0e63845ae98
  Step 2/7 : ARG command="--version"
   ---> Running in da15ecbbb38c
  Removing intermediate container da15ecbbb38c
   ---> c5f5eb9914a2
  Step 3/7 : COPY entrypoint.sh /entrypoint.sh
   ---> 47cf7730bc4e
  Step 4/7 : RUN apt-get update -y
   ---> Running in d2e7c8930e5f
  Get:1 http://deb.debian.org/debian bookworm InRelease [147 kB]
  Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
  Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
  Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8904 kB]
  Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [4732 B]
  Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [48.0 kB]
  Fetched 9204 kB in 1s (6272 kB/s)
  Reading package lists...
  Removing intermediate container d2e7c8930e5f
   ---> 20e379c550f9
  Step 5/7 : RUN pip install --upgrade pip awsebcli
   ---> Running in 2767b024d90a
  Requirement already satisfied: pip in /usr/local/lib/python3.11/site-packages (23.1.2)
  Collecting pip
    Downloading pip-23.2-py3-none-any.whl (2.1 MB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 35.0 MB/s eta 0:00:00
  Collecting awsebcli
    Downloading awsebcli-3.20.7.tar.gz (267 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 267.7/267.7 kB 47.2 MB/s eta 0:00:00
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'done'
  Collecting botocore<1.29.159,>1.23.41 (from awsebcli)
    Downloading botocore-1.29.158-py3-none-any.whl (10.9 MB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.9/10.9 MB 81.8 MB/s eta 0:00:00
  Collecting cement==2.8.2 (from awsebcli)
    Downloading cement-2.8.2.tar.gz (165 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 165.8/165.8 kB 33.0 MB/s eta 0:00:00
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'done'
  Collecting colorama<0.4.4,>=0.2.5 (from awsebcli)
    Downloading colorama-0.4.3-py2.py3-none-any.whl (15 kB)
  Collecting pathspec==0.10.1 (from awsebcli)
    Downloading pathspec-0.10.1-py3-none-any.whl (27 kB)
  Collecting python-dateutil<3.0.0,>=2.1 (from awsebcli)
    Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 48.5 MB/s eta 0:00:00
  Collecting requests>=2.31 (from awsebcli)
    Downloading requests-2.31.0-py3-none-any.whl (62 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 14.1 MB/s eta 0:00:00
  Requirement already satisfied: setuptools>=20.0 in /usr/local/lib/python3.11/site-packages (from awsebcli) (65.5.1)
  Collecting semantic_version==2.8.5 (from awsebcli)
    Downloading semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
  Collecting six<1.15.0,>=1.11.0 (from awsebcli)
    Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
  Collecting termcolor==1.1.0 (from awsebcli)
    Downloading termcolor-1.1.0.tar.gz (3.9 kB)
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'done'
  Collecting wcwidth<0.2.0,>=0.1.7 (from awsebcli)
    Downloading wcwidth-0.1.9-py2.py3-none-any.whl (19 kB)
  Collecting PyYAML<5.5,>=5.3.1 (from awsebcli)
    Downloading PyYAML-5.4.1.tar.gz (175 kB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 175.1/175.1 kB 39.6 MB/s eta 0:00:00
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'error'
    error: subprocess-exited-with-error
    
    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [68 lines of output]
        /tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
        !!
        
                ********************************************************************************
                The license_file parameter is deprecated, use license_files instead.
        
                By 2023-Oct-30, you need to update your project and remove deprecated calls
                or your builds will no longer be supported.
        
                See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
                ********************************************************************************
        
        !!
          parsed = self.parsers.get(option_name, lambda x: x)(value)
        running egg_info
        writing lib3/PyYAML.egg-info/PKG-INFO
        writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
        writing top-level names to lib3/PyYAML.egg-info/top_level.txt
        Traceback (most recent call last):
          File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
            main()
          File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
            return hook(config_settings)
                   ^^^^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
            return self._get_build_requires(config_settings, requirements=['wheel'])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
            self.run_setup()
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup
            exec(code, locals())
          File "<string>", line 271, in <module>
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
            return distutils.core.setup(**attrs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
            return run_commands(dist)
                   ^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
            dist.run_commands()
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
            self.run_command(cmd)
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
            super().run_command(command)
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
            cmd_obj.run()
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 314, in run
            self.find_sources()
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 322, in find_sources
            mm.run()
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 551, in run
            self.add_defaults()
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 589, in add_defaults
            sdist.add_defaults(self)
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/command/sdist.py", line 104, in add_defaults
            super().add_defaults()
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
            self._add_defaults_ext()
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
            self.filelist.extend(build_ext.get_source_files())
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "<string>", line 201, in get_source_files
          File "/tmp/pip-build-env-mrm5my2c/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
            raise AttributeError(attr)
        AttributeError: cython_sources
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  
  Notice:  A new release of pip is available: 23.1.2 -> 23.2
  Notice:  To update, run: pip install --upgrade pip
  The command '/bin/sh -c pip install --upgrade pip awsebcli' returned a non-zero code: 1
  

ANd here's one of the workflow YAMLs (the prod one is pretty much the same):

name: Build and deploy Staging

on:
  push:
    branches: [ dev ]
  # pull_request:
  #   branches: [ dev ]

jobs:
  build:

    runs-on: ubuntu-latest
    env:
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      AWS_DEFAULT_REGION: "eu-west-1"

    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '6.0.x'
    - name: Install dependencies
      run: dotnet restore
    - name: Build projects
      run: dotnet build --configuration Release --no-restore
    - name: Run tests
      run: dotnet test --no-restore
    #- name: Precompute refine set and pair scores
    #  run: mkdir -p cache && cd RefinePrecompute && dotnet run --project . -c Release

    - name: Publish assembly
      # Need to do this so '../content' is still the correct path
      run: dotnet publish ./OurApp -c Release -o out/package
    - name: Add other required files
      # run: cp -avr {Procfile,content,cache,.elasticbeanstalk,.ebextensions,.platform} out
      run: cp -avr {Procfile,.elasticbeanstalk,.ebextensions,.platform} out
    - name: Zip everything up
      run: (cd out && zip -r ../out.zip .)

    - name: Deploy to Elastic Beanstalk – dev
      if: github.event_name == 'push' # only for dev branch
      uses: hmanzur/actions-aws-eb@v1.0.0
      with:
        command: deploy --verbose --process --region eu-west-1 -l ${{ github.sha }} --timeout 20 our-app-env -m "${{ github.sha }}"

Could you please help me solving that or point me to the direction of the solution. I'm not sure where to start to be honest.


Solution

  • The issue is related to PyYAML upgrade, refer to this answer for context.

    The error reproduces on external action you use (this one). So, you need to fix that extension so that it works again. Now you have a few options:

    • Report to action maintainer (already done by another member here, though issue description is incorrect - consider posting more context there) and wait for a fix to be released
    • Contribute a PR and wait for it to be merged&released
    • Do it for yourself

    Assuming you need this fixed ASAP, doing for yourself is the fastest option. You need to add --no-build-isolation flag (let's avoid improving the rest of Dockerfile for now, though it looks a bit raw). Then you need to start using your action instead of the original one. You can either create a "full" action (published on marketplace) or just a local one - I'll show the latter way, there are plenty of docs and tutorials regarding publishing github actions.

    So, step-by-step:

    1. Clone https://github.com/hmanzur/actions-aws-eb somewhere
    2. Copy that folder as .github/actions/actions-aws-eb
    3. Update .github/actions/actions-aws-eb/Dockerfile (line 9 should look like RUN pip install --upgrade pip awsebcli --no-build-isolation)
    4. Update README.md in that folder to mention attribution
    5. Update your workflow definition, replacing uses: hmanzur/actions-aws-eb@v1.0.0 with uses: ./.github/actions/actions-aws-eb/
    6. Commit and push

    Follow this issue for common pitfails.

    If you need this action in several repositories, publishing to marketplace might be better suited. Here's the documentation on that: docs. Instead of copying the folder, you'll have to fork original action, change Dockerfile and create a release. Then you'll use your_github_username/actions-aws-eb@your_release_version as uses workflow part.