From 58c240033ec2fd8ee1d0136718ef58ea318b3637 Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Wed, 4 Mar 2020 12:12:20 +0000 Subject: [PATCH 01/14] feat: docker build and tag from ci - build in docker in ci so we can see failures. - tag and push to dockerhub from ci so we have more control and visibility on the process. Note, docker workflows run on all branches and no tags by default. You need to opt in to having builds trigger when a git tag is pushed. The filter definition to opt in to tags needs to be present on your job and all dependendent jobs, which is dull. See https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag I've recreated the dockerhub autobuild rules we have currently, but it is worthing taking a moment to review them. License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 73 ++++++++++++++++++++++++++++++++++++- bin/push-docker-tags.sh | 80 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100755 bin/push-docker-tags.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 0ceeb85e4b4..af389f8ebc3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,7 @@ default_environment: &default_environment executors: golang: docker: - - image: circleci/golang:1.13 + - image: circleci/golang:1.14 working_directory: ~/ipfs/go-ipfs environment: <<: *default_environment @@ -53,6 +53,12 @@ executors: IPFS_REUSEPORT: false LIBP2P_ALLOW_WEAK_RSA_KEYS: 1 E2E_IPFSD_TYPE: go + dockerizer: + docker: + - image: circleci/golang:1.14 + environment: + IMAGE_NAME: olizilla/test-go-ipfs + WIP_IMAGE_TAG: wip jobs: gobuild: @@ -295,8 +301,47 @@ jobs: key: v1-ipfs-webui-{{ checksum "~/ipfs/go-ipfs/ipfs-webui/package-lock.json" }} paths: - ~/ipfs/go-ipfs/ipfs-webui/node_modules + docker-build: + executor: dockerizer + steps: + - checkout + - setup_remote_docker + - run: + name: Build Docker image + command: | + IPFS_PLUGINS="" + if (branch === feat/stabilize-dht) { + IPFS_PLUGINS="peerlog" + } + docker build -t --build-arg IPFS_PLUGINS=$IPFS_PLUGINS $IMAGE_NAME:$WIP_IMAGE_TAG . + - run: + name: Archive Docker image + command: docker save -o go-ipfs-image.tar $IMAGE_NAME + - persist_to_workspace: + root: . + paths: + - ./go-ipfs-image.tar + docker-push: + executor: dockerizer + steps: + - checkout + - setup_remote_docker + - attach_workspace: + at: /tmp/workspace + - run: + name: Load archived Docker image + command: docker load -i /tmp/workspace/go-ipfs-image.tar + - run: + name: Publish Docker Image to Docker Hub + command: | + echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin + ./bin/push-docker-tags.sh "$CIRCLE_BUILD_NUM" "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" dryrun + workflows: version: 2 + + # Runs for all branches, but not on tags + # see: https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag test: jobs: - gobuild @@ -316,3 +361,29 @@ workflows: - ipfs-webui: requires: - build + - docker-build + - docker-push: + requires: + - docker-build + - golint + - gotest + - sharness + - interop + - go-ipfs-api + - go-ipfs-http-client + - ipfs-webui + + # NOTE: As we need to pass the tag filter to all dependent jobs, this is pulled out into a seperate workflow. + # see: https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag + docker-on-tag: + jobs: + - docker-build: + filters: + tags: + only: /^v[0-9].*|^cluster.+/ + - docker-push: + requires: + - docker-build + filters: + tags: + only: /^v[0-9].*|^cluster.+/ diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh new file mode 100755 index 00000000000..db2a6cc78c9 --- /dev/null +++ b/bin/push-docker-tags.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +# push-docker-tags.sh +# +# Run from ci to tag images based on the current branch or tag name. +# A bit like dockerhub autobuild config, but somewhere we can version control it. +# +# The `docker-build` job in .circleci/config.yml builds the current commit +# in docker and tags it as ipfs/go-ipfs:wip +# +# Then the `docker-publish` job runs this script to decide what tag, if any, +# to publish to dockerhub. +# +# Usage: +# ./push-docker-tags.sh [git tag name] [dry run] +# +# Example: +# # dry run. pass a 5th arg to have it print what it would do rather than do it. +# ./push-docker-tags.sh 1 testingsha mybranch v1.0 dryrun +# +# # push tag for the master branch +# ./push-docker-tags.sh 1 testingsha master +# +# # push tag for a release tag +# ./push-docker-tags.sh 1 testingsha release v0.5.0 +# +# # Surving suggestion in circle ci - https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables +# ./push-docker-tags.sh "$CIRCLE_BUILD_NUM" "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" +# +set -euo pipefail + +if [[ $# -lt 3 ]] ; then + echo 'At least 3 args required. Pass 5 args for a dry run.' + echo 'Usage:' + echo './push-docker-tags.sh [git tag name] [dry run]' + exit 1 +fi + +BUILD_NUM=$1 +GIT_SHA1=$2 +GIT_SHA1_SHORT=$(echo "$GIT_SHA1" | cut -c 1-7) +GIT_BRANCH=$3 +GIT_TAG=${4:-""} +DRY_RUN=${5:-false} + +WIP_IMAGE_TAG=${WIP_IMAGE_TAG:-wip} +IMAGE_NAME=${IMAGE_NAME:-ipfs/go-ipfs} + +pushTag () { + local IMAGE_TAG=$1 + if [ "$DRY_RUN" != false ]; then + echo "DRY RUN! I would have tagged and pushed the following..." + echo docker tag "$IMAGE_NAME:$WIP_IMAGE_TAG" "$IMAGE_NAME:$IMAGE_TAG" + echo docker push "$IMAGE_NAME:$IMAGE_TAG" + else + docker tag "$IMAGE_NAME:$WIP_IMAGE_TAG" "$IMAGE_NAME:$IMAGE_TAG" + docker push "$IMAGE_NAME:$IMAGE_TAG" + fi +} + +if [[ $GIT_TAG =~ ^v[0-9]+ ]]; then + pushTag "$GIT_TAG" + +elif [[ $GIT_TAG =~ ^cluster ]]; then + pushTag "$GIT_TAG" + +elif [ "$GIT_BRANCH" = "feat/stabilize-dht" ]; then + pushTag "bifrost-${BUILD_NUM}-${GIT_SHA1_SHORT}" + +elif [ "$GIT_BRANCH" = "release" ]; then + pushTag "release" + pushTag "latest" + +elif [ "$GIT_BRANCH" = "master" ]; then + pushTag "master" + +else + echo "Nothing to do. No docker tag defined for branch: $GIT_BRANCH, tag: $GIT_TAG" + +fi From 80a7f1f1c1d583c8c14b791869c48019cf53b80f Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Wed, 4 Mar 2020 12:22:47 +0000 Subject: [PATCH 02/14] chore: remove unused code License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index af389f8ebc3..aefcbf11fa5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -309,11 +309,7 @@ jobs: - run: name: Build Docker image command: | - IPFS_PLUGINS="" - if (branch === feat/stabilize-dht) { - IPFS_PLUGINS="peerlog" - } - docker build -t --build-arg IPFS_PLUGINS=$IPFS_PLUGINS $IMAGE_NAME:$WIP_IMAGE_TAG . + docker build -t $IMAGE_NAME:$WIP_IMAGE_TAG . - run: name: Archive Docker image command: docker save -o go-ipfs-image.tar $IMAGE_NAME From 8ff47e550c06e8ae92391363615f61bc32d69faa Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Wed, 4 Mar 2020 12:34:09 +0000 Subject: [PATCH 03/14] chore: fix yaml indenting License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index aefcbf11fa5..2392c27517b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -301,37 +301,37 @@ jobs: key: v1-ipfs-webui-{{ checksum "~/ipfs/go-ipfs/ipfs-webui/package-lock.json" }} paths: - ~/ipfs/go-ipfs/ipfs-webui/node_modules - docker-build: - executor: dockerizer - steps: - - checkout - - setup_remote_docker - - run: - name: Build Docker image - command: | - docker build -t $IMAGE_NAME:$WIP_IMAGE_TAG . - - run: - name: Archive Docker image - command: docker save -o go-ipfs-image.tar $IMAGE_NAME - - persist_to_workspace: - root: . - paths: - - ./go-ipfs-image.tar - docker-push: - executor: dockerizer - steps: - - checkout - - setup_remote_docker - - attach_workspace: - at: /tmp/workspace - - run: - name: Load archived Docker image - command: docker load -i /tmp/workspace/go-ipfs-image.tar - - run: - name: Publish Docker Image to Docker Hub - command: | - echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin - ./bin/push-docker-tags.sh "$CIRCLE_BUILD_NUM" "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" dryrun + docker-build: + executor: dockerizer + steps: + - checkout + - setup_remote_docker + - run: + name: Build Docker image + command: | + docker build -t $IMAGE_NAME:$WIP_IMAGE_TAG . + - run: + name: Archive Docker image + command: docker save -o go-ipfs-image.tar $IMAGE_NAME + - persist_to_workspace: + root: . + paths: + - ./go-ipfs-image.tar + docker-push: + executor: dockerizer + steps: + - checkout + - setup_remote_docker + - attach_workspace: + at: /tmp/workspace + - run: + name: Load archived Docker image + command: docker load -i /tmp/workspace/go-ipfs-image.tar + - run: + name: Publish Docker Image to Docker Hub + command: | + echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin + ./bin/push-docker-tags.sh "$CIRCLE_BUILD_NUM" "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" dryrun workflows: version: 2 From 7c593bd84b56e7d78edeaeb49d0a9f552e20437d Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Wed, 4 Mar 2020 15:23:44 +0000 Subject: [PATCH 04/14] wip: add branch filter License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 6 +++++- bin/push-docker-tags.sh | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2392c27517b..e6cc8d511e2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -369,7 +369,7 @@ workflows: - go-ipfs-http-client - ipfs-webui - # NOTE: As we need to pass the tag filter to all dependent jobs, this is pulled out into a seperate workflow. + # NOTE: You have to opt in to get circleci to trigger builds for a tat. As it is required that you set the tag filter to all dependent jobs, this is pulled out into a seperate workflow. # see: https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag docker-on-tag: jobs: @@ -377,9 +377,13 @@ workflows: filters: tags: only: /^v[0-9].*|^cluster.+/ + branches: + ignore: /.*/ - docker-push: requires: - docker-build filters: tags: only: /^v[0-9].*|^cluster.+/ + branches: + ignore: /.*/ diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh index db2a6cc78c9..189f830b4dd 100755 --- a/bin/push-docker-tags.sh +++ b/bin/push-docker-tags.sh @@ -61,8 +61,8 @@ pushTag () { if [[ $GIT_TAG =~ ^v[0-9]+ ]]; then pushTag "$GIT_TAG" -elif [[ $GIT_TAG =~ ^cluster ]]; then - pushTag "$GIT_TAG" +elif [[ $GIT_BRANCH =~ ^cluster ]]; then + pushTag "$GIT_BRANCH" elif [ "$GIT_BRANCH" = "feat/stabilize-dht" ]; then pushTag "bifrost-${BUILD_NUM}-${GIT_SHA1_SHORT}" From 793f39d7811d6bdbbf31bb0933c4de21cd41e26e Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Wed, 4 Mar 2020 15:26:07 +0000 Subject: [PATCH 05/14] fix: yaml indenting License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e6cc8d511e2..7b41ba2a8f3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -377,7 +377,7 @@ workflows: filters: tags: only: /^v[0-9].*|^cluster.+/ - branches: + branches: ignore: /.*/ - docker-push: requires: @@ -385,5 +385,5 @@ workflows: filters: tags: only: /^v[0-9].*|^cluster.+/ - branches: + branches: ignore: /.*/ From 107bbc680d87d38c6bd2da46600398d4697d6e1a Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Wed, 4 Mar 2020 15:27:17 +0000 Subject: [PATCH 06/14] feat: add bifrost-latest docker tag License: MIT Signed-off-by: Oli Evans --- bin/push-docker-tags.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh index 189f830b4dd..c1a7cfdb172 100755 --- a/bin/push-docker-tags.sh +++ b/bin/push-docker-tags.sh @@ -66,6 +66,7 @@ elif [[ $GIT_BRANCH =~ ^cluster ]]; then elif [ "$GIT_BRANCH" = "feat/stabilize-dht" ]; then pushTag "bifrost-${BUILD_NUM}-${GIT_SHA1_SHORT}" + pushTag "bifrost-latest" elif [ "$GIT_BRANCH" = "release" ]; then pushTag "release" From cba7be08f1058d1523c8497932f9c30150652aa6 Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Wed, 4 Mar 2020 15:36:01 +0000 Subject: [PATCH 07/14] chore: fix typo License: MIT Signed-off-by: Oli Evans --- bin/push-docker-tags.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh index c1a7cfdb172..39bc4cd7b01 100755 --- a/bin/push-docker-tags.sh +++ b/bin/push-docker-tags.sh @@ -24,7 +24,7 @@ # # push tag for a release tag # ./push-docker-tags.sh 1 testingsha release v0.5.0 # -# # Surving suggestion in circle ci - https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables +# # Serving suggestion in circle ci - https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables # ./push-docker-tags.sh "$CIRCLE_BUILD_NUM" "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" # set -euo pipefail From e83862ae7c8bdd42e8182b6042d9b37f62e2bdc9 Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Fri, 6 Mar 2020 09:37:30 +0000 Subject: [PATCH 08/14] docs: better explanation of circleci opt-in to tags madness Thanks to @Mr0grog Co-Authored-By: Rob Brackett --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b41ba2a8f3..c258a56f07b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -369,7 +369,9 @@ workflows: - go-ipfs-http-client - ipfs-webui - # NOTE: You have to opt in to get circleci to trigger builds for a tat. As it is required that you set the tag filter to all dependent jobs, this is pulled out into a seperate workflow. + # NOTE: CircleCI only builds tags if you explicitly filter for them. That + # also means tag-based jobs can only depend on other tag-based jobs, so we + # use a separate workflow because every job needs to be tagged together. # see: https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag docker-on-tag: jobs: From 37dcb2d4e2b5af157dc9c022a85c7ea90d6e7554 Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Fri, 6 Mar 2020 10:01:11 +0000 Subject: [PATCH 09/14] wip: circle context. filter to relevent branches - use a circleci context to provide dockerhub credentials - use a yaml alias to reduce repetition for branch filters (thanks @Mr0grog) - limit docker-push step from test workflow to only run on relevant branches License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 42 +++++++++++++++++++++++------------------ bin/push-docker-tags.sh | 4 +--- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c258a56f07b..f3b6b9b74fb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,6 +16,11 @@ aliases: paths: - ~/go/pkg/mod - ~/.cache/go-build/ + only-version-tags: &only-version-tags + tags: + only: /^v[0-9].*/ + branches: + ignore: /.*/ default_environment: &default_environment SERVICE: circle-ci @@ -359,15 +364,23 @@ workflows: - build - docker-build - docker-push: + # Requires dockerhub credentials, from circleci context. + context: dockerhub requires: - - docker-build - - golint - - gotest - - sharness - - interop - - go-ipfs-api - - go-ipfs-http-client - - ipfs-webui + - docker-build + - golint + - gotest + - sharness + - interop + - go-ipfs-api + - go-ipfs-http-client + - ipfs-webui + filters: + branches: + only: + - master + - release + - feat/stabilize-dht # NOTE: CircleCI only builds tags if you explicitly filter for them. That # also means tag-based jobs can only depend on other tag-based jobs, so we @@ -376,16 +389,9 @@ workflows: docker-on-tag: jobs: - docker-build: - filters: - tags: - only: /^v[0-9].*|^cluster.+/ - branches: - ignore: /.*/ + filters: *only-version-tags - docker-push: + context: dockerhub + filters: *only-version-tags requires: - docker-build - filters: - tags: - only: /^v[0-9].*|^cluster.+/ - branches: - ignore: /.*/ diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh index 39bc4cd7b01..60fd03a0431 100755 --- a/bin/push-docker-tags.sh +++ b/bin/push-docker-tags.sh @@ -61,9 +61,6 @@ pushTag () { if [[ $GIT_TAG =~ ^v[0-9]+ ]]; then pushTag "$GIT_TAG" -elif [[ $GIT_BRANCH =~ ^cluster ]]; then - pushTag "$GIT_BRANCH" - elif [ "$GIT_BRANCH" = "feat/stabilize-dht" ]; then pushTag "bifrost-${BUILD_NUM}-${GIT_SHA1_SHORT}" pushTag "bifrost-latest" @@ -73,6 +70,7 @@ elif [ "$GIT_BRANCH" = "release" ]; then pushTag "latest" elif [ "$GIT_BRANCH" = "master" ]; then + pushTag "master-${BUILD_NUM}-${GIT_SHA1_SHORT}" pushTag "master" else From 2ed366226ea61832475a18a0dcf3e774a6d52bf3 Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Thu, 12 Mar 2020 17:07:09 +0000 Subject: [PATCH 10/14] wip: use date instead of circleci build num License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 2 +- bin/push-docker-tags.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f3b6b9b74fb..038e316e5f1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -336,7 +336,7 @@ jobs: name: Publish Docker Image to Docker Hub command: | echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin - ./bin/push-docker-tags.sh "$CIRCLE_BUILD_NUM" "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" dryrun + ./bin/push-docker-tags.sh (date -u +%F) "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" dryrun workflows: version: 2 diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh index 60fd03a0431..162d879d798 100755 --- a/bin/push-docker-tags.sh +++ b/bin/push-docker-tags.sh @@ -16,16 +16,16 @@ # # Example: # # dry run. pass a 5th arg to have it print what it would do rather than do it. -# ./push-docker-tags.sh 1 testingsha mybranch v1.0 dryrun +# ./push-docker-tags.sh $(date -u +%F) testingsha master "" dryrun # # # push tag for the master branch -# ./push-docker-tags.sh 1 testingsha master +# ./push-docker-tags.sh $(date -u +%F) testingsha master # # # push tag for a release tag -# ./push-docker-tags.sh 1 testingsha release v0.5.0 +# ./push-docker-tags.sh $(date -u +%F) testingsha release v0.5.0 # # # Serving suggestion in circle ci - https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables -# ./push-docker-tags.sh "$CIRCLE_BUILD_NUM" "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" +# ./push-docker-tags.sh $(date -u +%F) "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" # set -euo pipefail From 358b7fe5975e9c36b790963bd0a8cf8ab9a28143 Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Thu, 12 Mar 2020 17:25:18 +0000 Subject: [PATCH 11/14] fix: pass date to push-docker-tags.sh License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 038e316e5f1..7f6561230d5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -336,7 +336,7 @@ jobs: name: Publish Docker Image to Docker Hub command: | echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin - ./bin/push-docker-tags.sh (date -u +%F) "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" dryrun + ./bin/push-docker-tags.sh $(date -u +%F) "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" dryrun workflows: version: 2 From 9f6349b07b9d5ce804308128e42bec6bcb30e821 Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Thu, 12 Mar 2020 19:04:37 +0000 Subject: [PATCH 12/14] wip: remove dry run License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 2 +- bin/push-docker-tags.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7f6561230d5..3fb180bbc77 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -336,7 +336,7 @@ jobs: name: Publish Docker Image to Docker Hub command: | echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin - ./bin/push-docker-tags.sh $(date -u +%F) "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" dryrun + ./bin/push-docker-tags.sh $(date -u +%F) "$CIRCLE_SHA1" "$CIRCLE_BRANCH" "$CIRCLE_TAG" workflows: version: 2 diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh index 162d879d798..973b0fa7dbd 100755 --- a/bin/push-docker-tags.sh +++ b/bin/push-docker-tags.sh @@ -51,8 +51,9 @@ pushTag () { if [ "$DRY_RUN" != false ]; then echo "DRY RUN! I would have tagged and pushed the following..." echo docker tag "$IMAGE_NAME:$WIP_IMAGE_TAG" "$IMAGE_NAME:$IMAGE_TAG" - echo docker push "$IMAGE_NAME:$IMAGE_TAG" - else + echo docker push "$IMAGE_NAME:$IMAGE_TAG" + else + echo "Tagging $IMAGE_NAME:$IMAGE_TAG and pushing to dockerhub" docker tag "$IMAGE_NAME:$WIP_IMAGE_TAG" "$IMAGE_NAME:$IMAGE_TAG" docker push "$IMAGE_NAME:$IMAGE_TAG" fi From 427557e90384581ff34994b200a9b24f50e5c3df Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Fri, 13 Mar 2020 14:31:45 +0000 Subject: [PATCH 13/14] wip: remove release tag. use more recent docker. License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 11 ++++++----- bin/push-docker-tags.sh | 13 +++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3fb180bbc77..6f23d3d7137 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -310,7 +310,8 @@ jobs: executor: dockerizer steps: - checkout - - setup_remote_docker + - setup_remote_docker: + version: "18.09.3" - run: name: Build Docker image command: | @@ -326,7 +327,8 @@ jobs: executor: dockerizer steps: - checkout - - setup_remote_docker + - setup_remote_docker: + version: "18.09.3" - attach_workspace: at: /tmp/workspace - run: @@ -374,12 +376,11 @@ workflows: - interop - go-ipfs-api - go-ipfs-http-client - - ipfs-webui + - ipfs-webui filters: branches: - only: + only: - master - - release - feat/stabilize-dht # NOTE: CircleCI only builds tags if you explicitly filter for them. That diff --git a/bin/push-docker-tags.sh b/bin/push-docker-tags.sh index 973b0fa7dbd..faee3998631 100755 --- a/bin/push-docker-tags.sh +++ b/bin/push-docker-tags.sh @@ -59,20 +59,17 @@ pushTag () { fi } -if [[ $GIT_TAG =~ ^v[0-9]+ ]]; then +if [[ $GIT_TAG =~ ^v[0-9]+ ]]; then pushTag "$GIT_TAG" + pushTag "latest" -elif [ "$GIT_BRANCH" = "feat/stabilize-dht" ]; then +elif [ "$GIT_BRANCH" = "feat/stabilize-dht" ]; then pushTag "bifrost-${BUILD_NUM}-${GIT_SHA1_SHORT}" pushTag "bifrost-latest" -elif [ "$GIT_BRANCH" = "release" ]; then - pushTag "release" - pushTag "latest" - -elif [ "$GIT_BRANCH" = "master" ]; then +elif [ "$GIT_BRANCH" = "master" ]; then pushTag "master-${BUILD_NUM}-${GIT_SHA1_SHORT}" - pushTag "master" + pushTag "master-latest" else echo "Nothing to do. No docker tag defined for branch: $GIT_BRANCH, tag: $GIT_TAG" From ec220ddd852417cda915f1c0f51170d59a41e3db Mon Sep 17 00:00:00 2001 From: Oli Evans Date: Fri, 13 Mar 2020 16:48:15 +0000 Subject: [PATCH 14/14] wip: set IMAGE_NAME: ipfs/go-ipfs License: MIT Signed-off-by: Oli Evans --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6f23d3d7137..bc30f97f8c2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,7 +62,7 @@ executors: docker: - image: circleci/golang:1.14 environment: - IMAGE_NAME: olizilla/test-go-ipfs + IMAGE_NAME: ipfs/go-ipfs WIP_IMAGE_TAG: wip jobs: