Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

`serverless deploy` tries to execute `docker run` outside of $BITBUCKET_CLONE_DIR

Edited

I have a serverless python app that uses the plugin "serverless-python-requirements". In my bitbucket-pipelines.yml I have the following,

image: node:15.10.0-alpine

pipelines:
branches:
master:
- step:
name: 'Deployment to Staging'
deployment: staging
script:
- cd ./project_dir
- apk add python3
- npm install -g serverless
- npm install --save serverless-python-requirements
- serverless config credentials --provider aws --key $AWS_DEV_LAMBDA_KEY --secret $AWS_DEV_LAMBDA_SECRET
- serverless deploy --stage dev
services:
- docker

the last step progresses as follows,

+ serverless deploy --stage dev
Serverless: Generated requirements from /opt/atlassian/pipelines/agent/build/project_dir/requirements.txt in /opt/atlassian/pipelines/agent/build/project_dir/.serverless/requirements.txt...
Serverless: Installing requirements from /root/.cache/serverless-python-requirements/679f0c7a123e5d80212530da94d545f92ad890ecf43e8288e2b6bc243b4e138b_slspyc/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Using download cache directory /root/.cache/serverless-python-requirements/downloadCacheslspycServerless: Running docker run --rm -v /root/.cache/serverless-python-requirements/679f0c7a123e5d80212530da94d545f92ad890ecf43e8288e2b6bc243b4e138b_slspyc\:/var/task\:z -v /root/.cache/serverless-python-requirements/downloadCacheslspyc\:/var/useDownloadCache\:z lambci/lambda\:build-python3.6 /bin/sh -c 'chown -R 0\\:0 /var/useDownloadCache && python3.6 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 0\\:0 /var/task && chown -R 0\\:0 /var/useDownloadCache'...

 until I get the following error:

Error --------------------------------------------------
Error: STDOUT:
STDERR: docker: Error response from daemon: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories.

I've tried using the serverless-deploy pipe option too but get the same error. 

- pipe: atlassian/serverless-deploy:0.2.2
variables:
AWS_ACCESS_KEY_ID: $AWS_DEV_LAMBDA_KEY
AWS_SECRET_ACCESS_KEY: $AWS_DEV_LAMBDA_SECRET
EXTRA_ARGS: '--stage dev'

I'm hoping this is an easy fix and I've done something silly!

**UPDATE**

I have it working by using the serverless.yml `non-linux` instead of `true` setting

custom:
pythonRequirements:
dockerizePip: non-linux

 and the bitbucket-pipelines.yml

image: node:15.10.0-alpine

pipelines:
branches:
master:
- step:
name: 'Deployment to Staging'
deployment: staging
script:
- cd ./project_dir
- apk add python3
- npm install
- npm install -g serverless
- serverless plugin install -n serverless-python-requirements
- serverless config credentials --overwrite --provider aws --key $AWS_DEV_LAMBDA_KEY --secret $AWS_DEV_LAMBDA_SECRET
- serverless deploy --stage dev

  however I still don't understand why the deployment using docker didn't work

2 answers

0 votes

Hi @Anthony Tsoi ,

We have added support for Python serverless-python-requirements.
A new version  of the serverless-deploy pipe released.

Also, updated NodeJS to 12 LTS version and the Serverless Framework to 2.* version.

script:
  - pipe: atlassian/serverless-deploy:1.0.0
    variables:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY

Tested it with the next dockerizePip parameters: true, false, non-linux.

 It would be nice if you provide us with your feedback about this update.

 

Cheers,
Oleksandr Kyrdan

0 votes

Hi @Anthony Tsoi ,

Thank you for your question!

We'll investigate this case and notify you.

 

Best regards,
Oleksandr Kyrdan

Thank you - any help would be appreciated!

@Oleksandr Kyrdan any luck with the above?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

107 views 1 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you