I'm new to Bitbucket pipelines and maybe I don't understand the concept very well yet. My use case is the following:
We have a testing environment, let's call it UAT. I want all branches that aren't master to be deployed to this Lambda testing environment OPTIONALLY (hence the manual trigger).
For our production environment, I want master to be verified and then deployed to Lambda production.
I also want ALL branches, including master, to be verified before proceeding to the next step.
I made use of some deployment variables because configurations obviously change between test and production.
My bitbucket-pipelines.yml looks like this:
image: maven:3.6.1
definitions:
caches:
mvnrepo-build: /root/.m2/repository
steps:
- step: &mvn-verify
name: Maven verify
caches:
- maven
script:
- echo $FLYWAY_CONFIG > src/main/resources/flyway.conf
- tr ' ' '\n' < src/main/resources/flyway.conf > src/main/resources/temp.txt && mv src/main/resources/temp.txt src/main/resources/flyway.conf
- mvn -B verify
- step: &lambda-deploy
caches:
- mvnrepo-build
script:
- echo $CONFIG_FILE > src/main/resources/config.xml
- echo $FLYWAY_CONFIG > src/main/resources/flyway.conf
- tr ' ' '\n' < src/main/resources/flyway.conf > src/main/resources/temp.txt && mv temp.txt src/main/resources/flyway.conf
- mvn -B clean install
- pipe: atlassian/aws-lambda-deploy:0.4.2
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: $FUNCTION_NAME
COMMAND: 'update'
ZIP_FILE: 'target/vtex.jar'
pipelines:
default:
- step:
<<: *mvn-verify
deployment: test
- step:
<<: *lambda-deploy
name: Deploy to UAT
deployment: test
trigger: manual
branches:
master:
- step:
<<: *mvn-verify
deployment: production
- step:
<<: *lambda-deploy
name: Deploy to Prod
deployment: production
In each of the deployment environments, mvn-verify needs values according to its environment, that's why I added deployment: {{environment}} to each step.
However, even though the yml file itself is valid, Bitbucket won't even start to run the pipeline and output the error in the title.