I am trying to reproduce, step-by-step, the instructions on this video "Cloud Resume Challenge Sprint (Sept, 2022) - Week 4" from youtube, https://youtu.be/wiyI0Ngn31o, on how to setup GitHub Actions with CD/CI pipeline for Backend testing with Python for SAM Deployment in AWS. I am using modified files from the GitHub repo of the YouTube video: https://github.com/CumulusCycles/CloudResumeChallenge/tree/main/Week_4
I have followed the video's instructions, step-by-step; however, when I push my mail.yml file to the GitHub repository, I get the following error message from GitHub Actions:
Run sam build
SAM CLI now collects telemetry to better understand customer needs.
You can OPT OUT and disable telemetry collection by setting the
environment variable SAM_CLI_TELEMETRY=0 in your shell.
Thanks for your help!
Learn More: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-telemetry.html
Building codeuri: /home/runner/work/cloud-resume-challenge/cloud-resume-challenge/serverless-architecture-with-SAM/hello_world runtime: python3.8 metadata: {} architecture: x86_64 functions: MyLambdaFunction
Running PythonPipBuilder:ResolveDependencies
Running PythonPipBuilder:CopySource
Building codeuri: /home/runner/work/cloud-resume-challenge/cloud-resume-challenge/serverless-architecture-with-SAM/hello_world runtime: python3.9 metadata: {} architecture: x86_64 functions: HelloWorldFunction
Build Failed
Error: PythonPipBuilder:Validation - Binary validation failed for python, searched for python in following locations : ['/opt/hostedtoolcache/Python/3.8.15/x64/bin/python', '/opt/hostedtoolcache/Python/3.8.15/x64/python', '/usr/bin/python', '/bin/python', '/opt/hostedtoolcache/Python/3.8.15/x64/bin/python3', '/usr/bin/python3', '/bin/python3'] which did not satisfy constraints for runtime: python3.9. Do you have python for runtime: python3.9 on your PATH?
Error: Process completed with exit code 1.
Here is a copy of my main.yml file:
name: main
on: push
jobs:
test-infra:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Install dependencies
run: |
cd serverless-architecture-with-SAM/tests
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests with pytest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
run: pytest
build-and-deploy-infra:
needs: test-infra
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: 3.8
- uses: aws-actions/setup-sam@v1
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: sam build
working-directory: serverless-architecture-with-SAM
- run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset
working-directory: serverless-architecture-with-SAM
deploy-site:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jakejarvis/s3-sync-action@master
with:
args: --delete
env:
AWS_S3_BUCKET: justinhenson-cloud-resume-website
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: serverless-architecture-with-SAM/resume-site
I tried to add the stanza below before - run: sam build
to my main.yml file, but I still get the same error message.
- uses: actions/setup-python@v3
with:
python-version: 3.8
I sincerely appreciate any help you can offer.
If you notice the error message:
which did not satisfy constraints for runtime: python3.9. Do you have python for runtime: python3.9 on your PATH?
Looks like it expects Python 3.9 in your System path whereas you're running on 3.8 and it could possibly occur due to the mismatch of Python versions.
Could you upgrade it to 3.9 system wide, and try to rerun this.