Hello there!
After about 10 hours I am quite desperate lol…
Does anyone have a simple example of CI / CD with Python, AWS Lambda, Serverless and either Github Actions or Bitbucket pipelines…
I want to simply check into git and have serverless deploy to lambda… I havent found a single example that works…
When serverless runs using either CI/CD option both Implementations return
Error: ENOENT: no such file or directory, open ‘/opt/atlassian/pipelines/agent/build/venv/.Python’
Error: ENOENT: no such file or directory, open ‘/github/workspace/venv/.Python’
Here is my Github workflow YML
on:
push:
branches:
- release
name: Deploy to AWS Prod
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: npm install
uses: actions/npm@master
with:
args: install
- name: serverless deploy
uses: mirrorhanyu/serverless-github-action-python@master
with:
args: deploy
env:
AWS_ACCESS_KEY_ID: ‘ID’
AWS_SECRET_ACCESS_KEY: ‘SECRET’
Here is my Bitbucket Pipelines
image: nikolaik/python-nodejs:python3.7-nodejs12
pipelines:
branches:
release:
- step:
script:
- pip install --upgrade setuptools
- pip3 install virtualenv
- source venv/bin/activate
- pip install -r requirements.txt
- npm install -g serverless
- python3 --version
- serverless config credentials --stage prod --provider aws --key {AWS_DEV_LAMBDA_KEY} --secret {AWS_DEV_LAMBDA_SECRET}
- ls -la
- pwd
- serverless deploy --stage prod
With the Pipelines example I can verify with ls -la, PWD and cd venv that the file .Python does indeed exist… It seems serverless cannot see it…
Anyways any help would be appreciated, many brain cells, hours and checkins have been burned.
https://dev.to/ayushsharma/automating-serverless-framework-deployments-using-bitbucket-pipelines-mfa
That example followed verbatim also fails with the same error.
Lastly this is my Serverless file
service: automata
provider:
name: aws
runtime: python3.7
timeout: 30
functions:
processor:
handler: handler.hello
events:
- schedule: rate(5 minutes)
package:
exclude:
- .gitignore
- .vscode
- bitbucket-pipelines.yml
- README.md
- serverless.yml