diff --git a/.circleci/config.yml b/.circleci/config.yml index 2457333..3e8efe3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,16 +24,13 @@ jobs: docker: - image: rackautomation/rackspace-toolbox:$CIRCLE_SHA1 environment: - TF_STATE_BUCKET: test_harness # these don't have any effect since we don't - TF_STATE_REGION: test_harness # have any actual layers defined in the repo + TF_STATE_BUCKET: test_harness + TF_STATE_REGION: test_harness steps: - checkout - run: name: disable automatic resolution of changed layers command: mkdir test/workspace && ls test/layers/ > test/workspace/changed_layers - - run: - name: check old - command: cd test && check_old.sh - run: name: lint tests command: cd test && lint.sh @@ -69,11 +66,7 @@ jobs: name: tag an official release command: | docker login -u $DOCKER_USER -p $DOCKER_PASS - docker pull rackautomation/rackspace-toolbox:$CIRCLE_SHA1 - docker tag rackautomation/rackspace-toolbox:$CIRCLE_SHA1 rackautomation/rackspace-toolbox:$CIRCLE_TAG - docker push rackautomation/rackspace-toolbox:$CIRCLE_TAG - docker tag rackautomation/rackspace-toolbox:$CIRCLE_SHA1 rackautomation/rackspace-toolbox:latest - docker push rackautomation/rackspace-toolbox:latest + ./scripts/tag_release $CIRCLE_SHA1 $CIRCLE_TAG workflows: version: 2 diff --git a/scripts/tag_release b/scripts/tag_release new file mode 100755 index 0000000..8b7d597 --- /dev/null +++ b/scripts/tag_release @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +set -eu + +tag_and_push() { + docker tag "rackautomation/rackspace-toolbox:$GIT_SHA" "rackautomation/rackspace-toolbox:$1" + docker push "rackautomation/rackspace-toolbox:$1" +} + +GIT_SHA="$1" +GIT_TAG="$2" + +docker pull "rackautomation/rackspace-toolbox:$GIT_SHA" +tag_and_push latest + +# major.minor.patch +tag_and_push "$GIT_TAG" +# major.minor +tag_and_push "$(echo "$GIT_TAG" | sed 's/[.][0-9]*$//')" +# major +tag_and_push "$(echo "$GIT_TAG" | sed 's/[.][0-9]*[.][0-9]*$//')"