Pick up bamboo credentials in shell script:
region='us-east-1'
if [[ -n "${bamboo_custom_aws_accessKeyId:-}" ]]; then
echo "Exporting AWS credentials from bamboo injected credentials"
export AWS_ACCESS_KEY_ID="${bamboo_custom_aws_accessKeyId}"
export AWS_SECRET_ACCESS_KEY="${bamboo_custom_aws_secretAccessKey_password}"
export AWS_SESSION_TOKEN="${bamboo_custom_aws_sessionToken_password}"
export AWS_DEFAULT_REGION=$region
fi
Create -> Create Plan
Create an app password on bitbucket that gives full access
Use this password to add a bitbucket repo (
Click on the plan and hit edit configuration
Go to Stages and hit Create stage
Create new job and name it Deploy.
Click on the Docker tab and choose Docker container and use ${bamboo.cicd_deployment_image} for the image. For Extra arguments for the docker run command use --net=host
Add task AWS Credentials Variables: For connector use [Use connector variable ...] and add ${bamboo.AWSConnectorIDSecret} as the connector variable
Add task Script and link the script from the repo
Go back to plan configuration and add variables. add key: cicd_deployment_image, value: VALUE
These are parameters at the top of the cloud formation
Go to stages and create a new stage called delete. Make this a manual stage and final stage.
Create new job and name it Delete.
Click on the Docker tab and choose Docker container and use ${bamboo.cicd_deployment_image} for the image. For Extra arguments for the docker run command use --net=host
Add task AWS Credentials Variables: For connector use [Use connector variable ...] and add ${bamboo.AWSConnectorIDSecret} as the connector variable
Add task Script and link the script from the repo
You may want to turn off the default Trigger of repo polling (every 180 seconds)