I'm trying to deploy an AWS CloudFormation template, located in my repo, from Pipelines. I came across this Docker image at bitbucketpipelines/aws-cloudformation-deploy.
When deploying the following template:
image: bitbucketpipelines/aws-cloudformation-deploy:latest
pipelines:
default:
- step:
name: Deploy with CF
services:
- docker
script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
- export AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
- export STACK_NAME=$STACK_NAME
- export TEMPLATE=$TEMPLATE
- docker run -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION -e STACK_NAME=$STACK_NAME -e TEMPLATE=$TEMPLATE bitbucketpipelines/aws-cloudformation-deploy
where $TEMPLATE is the location in the repo (testdir/test.template.json), I get the following error:
INFO: Using stack template from testdir/test.template.json for deploy.
x Not able to find the file testdir/test.template.json in your repository
This doesn't make sense, since it's saying it can't find the file but yet links directly to it when I click the link found in the above error.
I've tried every variation of the path to this file to no avail. Thoughts?
Hey @justin.weeks ,
Thanks for your reaching out! We haven't released the aws-cloudformation-deploy pipe officially yet, so I wouldn't recommend using it for a critical service deployment yet.
However, your script is not working because you are not mounting the build directory into the docker containers and not setting the working directory to the proper one. This is how you can do it.
pipelines:
default:
- step:
services:
- docker
script:
- docker run
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
-e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
-e STACK_NAME=$STACK_NAME
-e TEMPLATE=$TEMPLATE
-w $(pwd)
-v $(pwd):$(pwd)
bitbucketpipelines/aws-cloudformation-deploy
The aws-cloudformation-deploy pipe will be released in the next few days, so I would recommend using the proper syntax once it is released. For more information you can check our public docs: https://confluence.atlassian.com/bitbucket/pipes-958765631.html
Regards,
Raul
Thanks @Raul Gomis !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.