Created
November 22, 2022 10:46
-
-
Save dobeerman/e1c5df58a417593c27ddd7a5572c480e to your computer and use it in GitHub Desktop.
bitbucket | ECR deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pipelines: | |
| custom: # Pipelines that can only be triggered manually | |
| from-commit: | |
| - step: | |
| #python image with aws-cli installed | |
| image: atlassian/pipelines-awscli | |
| services: | |
| - docker | |
| script: | |
| # aws login | |
| - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email) | |
| # docker | |
| - export BUILD_ID=custom.${BITBUCKET_COMMIT} | |
| - docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID . | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_ID | |
| tags: # add the 'tags' section | |
| release-*: # specify the tag | |
| - step: # define the build pipeline for the tag | |
| #python image with aws-cli installed | |
| image: atlassian/pipelines-awscli | |
| services: | |
| - docker | |
| script: | |
| # aws login | |
| - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email) | |
| # docker | |
| - export BUILD_ID=${BITBUCKET_TAG} | |
| - docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID . | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_ID | |
| hotfix-*: # specify the tag | |
| - step: # define the build pipeline for the tag | |
| #python image with aws-cli installed | |
| image: atlassian/pipelines-awscli | |
| services: | |
| - docker | |
| script: | |
| # aws login | |
| - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email) | |
| # docker | |
| - export BUILD_ID=${BITBUCKET_TAG} | |
| - docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID . | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_ID | |
| feature-*: # specify the tag | |
| - step: # define the build pipeline for the tag | |
| #python image with aws-cli installed | |
| image: atlassian/pipelines-awscli | |
| services: | |
| - docker | |
| script: | |
| # aws login | |
| - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email) | |
| # docker | |
| - export BUILD_ID=${BITBUCKET_TAG} | |
| - docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID . | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_ID | |
| branches: | |
| main: | |
| - step: | |
| #python image with aws-cli installed | |
| image: atlassian/pipelines-awscli | |
| services: | |
| - docker | |
| script: | |
| # aws login | |
| - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email) | |
| # docker | |
| - export BUILD_ID=$BITBUCKET_BRANCH.$BITBUCKET_COMMIT | |
| - export BUILD_LATEST=$BITBUCKET_BRANCH.latest | |
| - docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID . | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_ID | |
| - docker tag ${AWS_REGISTRY_URL}:$BUILD_ID ${AWS_REGISTRY_URL}:$BUILD_LATEST | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_LATEST | |
| stage: | |
| - step: | |
| #python image with aws-cli installed | |
| image: atlassian/pipelines-awscli | |
| services: | |
| - docker | |
| script: | |
| # aws login | |
| - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email) | |
| # docker | |
| - export BUILD_ID=$BITBUCKET_BRANCH.$BITBUCKET_COMMIT | |
| - export BUILD_LATEST=$BITBUCKET_BRANCH.latest | |
| - docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID . | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_ID | |
| - docker tag ${AWS_REGISTRY_URL}:$BUILD_ID ${AWS_REGISTRY_URL}:$BUILD_LATEST | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_LATEST | |
| dev: | |
| - step: | |
| #python image with aws-cli installed | |
| image: atlassian/pipelines-awscli | |
| services: | |
| - docker | |
| script: | |
| # aws login | |
| - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email) | |
| # docker | |
| - export BUILD_ID=$BITBUCKET_BRANCH.$BITBUCKET_COMMIT | |
| - export BUILD_LATEST=$BITBUCKET_BRANCH.latest | |
| - docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID . | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_ID | |
| - docker tag ${AWS_REGISTRY_URL}:$BUILD_ID ${AWS_REGISTRY_URL}:$BUILD_LATEST | |
| - docker push ${AWS_REGISTRY_URL}:$BUILD_LATEST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment