Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Anthony Tsoi March 3, 2021

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
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2021

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

Rahul Bhatu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 2, 2021

Hi @Oleksandr Kyrdan 

I want to try out the serverless-deploy pipe, but is it possible to do that  with $AWS_SESSION_TOKEN ?, I have $AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY and $AWS_SESSION_TOKEN does the serverless pipe accept the $AWS_SESSION_TOKEN as variable.

 

Thanks

Rahul

0 votes
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2021

Hi @Anthony Tsoi ,

Thank you for your question!

We'll investigate this case and notify you.

 

Best regards,
Oleksandr Kyrdan

Anthony Tsoi March 5, 2021

Thank you - any help would be appreciated!

Anthony Tsoi March 16, 2021

@Oleksandr Kyrdan any luck with the above?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events