Skip to content

Instantly share code, notes, and snippets.

@vahanNasibyan
Created December 21, 2018 08:31
Show Gist options
  • Save vahanNasibyan/bd2244eeb9a36e523d09b70bebec5ada to your computer and use it in GitHub Desktop.
Save vahanNasibyan/bd2244eeb9a36e523d09b70bebec5ada to your computer and use it in GitHub Desktop.
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:
master:
- 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
develop:
- 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