Hi ,
I am a newbie to bitbucket pipeline. Trying to configure a pipeline to do the following but getting an error while accessing the zip file in the deployment step saying the file is not found.
- Maven build package (which generates a zip file)
- Deploy the zip file to AWS lambda using the pipe "atlassian/aws-lambda-deploy:0.5.5"
bitbucket-pipelines.yml
image: maven:3.6.1
pipelines:
default:
- step:
name: Build
caches:
- maven
script: # Modify the commands below to build your repository.
- # mvn -B verify # -B batch mode makes Maven less verbose
- mvn -DskipTests -B package
- step:
name: Deploy
script:
- pipe: atlassian/aws-lambda-deploy:0.5.5
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
FUNCTION_NAME: $LAMBDA_FUNCTION_NAME
COMMAND: update
ZIP_FILE: $LAMBDA_ZIP_FILE
Logs:
Maven build log :
INFO] Building zip: /opt/atlassian/pipelines/agent/build/target/csi-stepstone-0.0.1-SNAPSHOT-lambda-package.zip
Deployment step log
Error parsing parameter '--zip-file': Unable to load paramfile fileb://opt/atlassian/pipelines/agent/build/target/csi-stepstone-0.0.1-SNAPSHOT-lambda-package.zip: [Errno 2] No such file or directory: 'opt/atlassian/pipelines/agent/build/target/csi-stepstone-0.0.1-SNAPSHOT-lambda-package.zip'
[31m✖ Failed to update Lambda function code.[0m
Searching for files matching artifact pattern .bitbucket/pipelines/generated/pipeline/pipes/**
Am I missing anything basic here?
This is resolved.
I added the step for artifact in the maven build and use the artifact in the deploy step.
Below is the final script.
image: maven:3.6.1
pipelines:
default:
- step:
name: Build
caches:
- maven
script: # Modify the commands below to build your repository.
- # mvn -B verify # -B batch mode makes Maven less verbose
- mvn -DskipTests -B package
artifacts:
- target/*
- step:
image:
name: atlassian/default-image:2
name: Sonar Scan
caches:
- maven
script:
- mvn -Dmaven.test.failure.ignore=true -B package # -B batch mode makes Maven less verbose
- mvn sonar:sonar -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN -Dsonar.bitbucket.minSeverity=INFO #Sonar Configuration
- step:
name: Deploy
script:
- pipe: atlassian/aws-lambda-deploy:0.5.5
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
FUNCTION_NAME: $LAMBDA_FUNCTION_NAME
COMMAND: update
ZIP_FILE: target/$LAMBDA_ZIP_FILE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.