Help wit Serverless CI/CD Github Actions or Bitbucket Pipelines

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

Hey @Akiren,

I’ve run into the NOENT issue with NPM and bitbucket pipelines with the simple setup described by the tutorial of Ayush Sharma that you linked to. But it happened only the very first time and after that worked seamlessly.

Wow, and you just redeployed and it worked? I have deployed over 100 times to no avail… you should see my bitbucket logs lol. Thanks for the response

From the error you got:

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’

It seems your python didn’t install in the right directory. Could you use the official example and see what happen. You can always run a shell command in the pipelines and verify your file locations.

Akiren, Did you get anywhere with this for GHA? Curious if you have a working template to share. :bowing_man:

Hi
I am trying to setup a bitbucket pipeline saving AWS credentials as bitbucket variable but it’s not locating it.
Getting this error
4s

+ serverless config credentials --provider aws --key ${AWS_DEV_LAMBDA_KEY} --secret ${AWS_DEV_LAMBDA_SECRET}

(node:87) ExperimentalWarning: The dns.promises API is experimental

(node:87) ExperimentalWarning: The fs.promises API is experimental

Serverless Error ---------------------------------------

AWS provider credentials not found. Learn how to set up AWS provider credentials in our docs here: <http://slss.io/aws-creds-setup>.

Get Support --------------------------------------------

Docs: docs.serverless.com

Bugs: github.com/serverless/serverless/issues

Issues: forum.serverless.com

Your Environment Information ---------------------------

Operating System: linux

Node Version: 11.13.0

Framework Version: 2.11.1

Plugin Version: 4.1.2

SDK Version: 2.3.2

Components Version: 3.3.0