Forums

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

sharing build-package between multiple branches

Sri Karan
Contributor
August 19, 2019

Hi team,

I have 3 branches develop release and master and i am creating a build package and artifact deployment.zip during the branch develop is run now i am not able to use the same deployment.zip while merging the pipeline to release and i get an error 

"Error parsing parameter '--zip-file': Unable to load paramfile fileb:///opt/atlassian/pipelines/agent/build/deployment.zip: [Errno 2] No such file or directory: '/opt/atlassian/pipelines/agent/build/deployment.zip'✖ Failed to update Lambda function code."

 

below is my bitbucket-pipeline.yml file


definitions:
caches:
golang: $HOME/.cache/go-build
steps:
- step: &Build-Package
name: Build package
caches:
- golang
script:
- PACKAGE_PATH="${GOPATH}/src/ecal/auth-service"
- mkdir -pv "${PACKAGE_PATH}"
- tar -cO --exclude=bitbucket-pipelines.yml . | tar -xv -C "${PACKAGE_PATH}"
- git clone https://${BB_CI_USER}:${BB_CI_PWD}@bitbucket.org/ecal/bitbucket-pipelines.git
- ./bitbucket-pipelines/build/bitbucket.sh ${PACKAGE_PATH} ${BB_CI_USER} ${BB_CI_PWD} ${BITBUCKET_CLONE_DIR}

artifacts: # defining the artifacts to be passed to each future step.
- deployment.zip
pipelines:
branches:
'develop':
- step: *Build-Package
- step:
name: Deploy to TEST
deployment: test
# test trigger: manual # for PROD deployment
script:
- git clone https://${BB_CI_USER}:${BB_CI_PWD}@bitbucket.org/ecal/bitbucket-pipelines.git
- ./bitbucket-pipelines/semtag.sh getcurrent
- ./bitbucket-pipelines/semtag.sh beta -s auto
- pipe: atlassian/aws-lambda-deploy:0.2.3
variables:
AWS_ACCESS_KEY_ID: $DEV_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $DEV_AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: "us-east-1"
FUNCTION_NAME: "lambda"
COMMAND: "update"
ZIP_FILE: "${BITBUCKET_CLONE_DIR}/deployment.zip"

- step:
name: Merge to release
trigger: manual # for STAGE deployment
script:
- git checkout -b release
- git describe --tags && git merge develop
- git push


'release':
# - step: *Build-Package
- step:
name: Deploy to STAGING
deployment: staging
# trigger: manual # for STAGE deployment
script:
- git clone https://${BB_CI_USER}:${BB_CI_PWD}@bitbucket.org/ecal/bitbucket-pipelines.git
- ./bitbucket-pipelines/semtag.sh getcurrent
- ./bitbucket-pipelines/semtag.sh candidate -s auto
- pipe: atlassian/aws-lambda-deploy:0.2.3
variables:
AWS_ACCESS_KEY_ID: $BB_CI_STAGING_ACCESS_KEY
AWS_SECRET_ACCESS_KEY: $BB_CI_STAGING_SECRET_KEY
AWS_DEFAULT_REGION: "us-east-1"
FUNCTION_NAME: "lambda"
COMMAND: "update"
ZIP_FILE: "${BITBUCKET_CLONE_DIR}/deployment.zip"

 

1 answer

1 vote
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2019

Hi @Sri Karan ,

you can use built in variables that exist for the duration of a pipeline:

  • BITBUCKET_PIPE_STORAGE_DIR  You can use this directory to pass information or artifacts between subsequent runs of your pipe.
  • BITBUCKET_PIPE_SHARED_STORAGE_DIR If you need to get information from another pipe, you can read it from this directory.

More details you can find in Advanced techniques for writing pipes.

Cheers,
Alex

Sri Karan
Contributor
August 28, 2019

Hi @Oleksandr Kyrdan ,

Thanks for the information.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events