From 5b51b21a11959454dd7c72ddee3ec25db399d0c2 Mon Sep 17 00:00:00 2001 From: Dave Chevell Date: Tue, 10 Oct 2017 13:24:57 +1100 Subject: [PATCH] Enabled piplines support for automated docker releases --- bitbucket-pipelines.yml | 31 +++++++++++++++++++++++++++++++ hooks/post_push | 13 +++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 bitbucket-pipelines.yml create mode 100644 hooks/post_push diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml new file mode 100644 index 0000000..2e5d26d --- /dev/null +++ b/bitbucket-pipelines.yml @@ -0,0 +1,31 @@ +image: dchevell/docker-release-maker:latest +clone: + depth: full + +pipelines: + custom: + create-release-base-6: + - step: + script: + - git fetch --all + - export BASE_BRANCH=base-6 + - export BASE_VERSION=6 + - export DOCKER_REPO=atlassian/confluence-server + - export DOCKERFILE_VERSION_STRING=CONFLUENCE_VERSION + - export GIT_USER=pipelinesagent + - export GIT_EMAIL=pipelines-agent@atlassian.com + - export MAC_PRODUCT_KEY=confluence + - python /usr/src/app/create_release.py + branches: + base-6: + - step: + script: + - git fetch --all + - export BASE_BRANCH=base-6 + - export BASE_VERSION=6 + - export DOCKER_REPO=atlassian/confluence-server + - export DOCKERFILE_VERSION_STRING=CONFLUENCE_VERSION + - export GIT_USER=pipelinesagent + - export GIT_EMAIL=pipelines-agent@atlassian.com + - export MAC_PRODUCT_KEY=confluence + - python /usr/src/app/update_release.py \ No newline at end of file diff --git a/hooks/post_push b/hooks/post_push new file mode 100644 index 0000000..e4643e1 --- /dev/null +++ b/hooks/post_push @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +# Parse image name for repo name +tagStart=$(expr index "$IMAGE_NAME" :) +repoName=${IMAGE_NAME:0:tagStart-1} + +# Tag and push image for each additional tag +for tag in `git tag -l --points-at HEAD`; do + docker tag $IMAGE_NAME ${repoName}:${tag} + docker push ${repoName}:${tag} +done \ No newline at end of file