Skip to content

Commit

Permalink
Merge pull request #8 from rackspace-infrastructure-automation/jp/tag…
Browse files Browse the repository at this point in the history
…-more

tags major.minor and major versions
  • Loading branch information
jpbochi authored Oct 5, 2018
2 parents 2c7f575 + 8e4049a commit 22d4ecd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
13 changes: 3 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions scripts/tag_release
Original file line number Diff line number Diff line change
@@ -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]*$//')"

0 comments on commit 22d4ecd

Please sign in to comment.