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: default avatarOli Evans <oli@tableflip.io>
parent e83862ae
......@@ -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: /.*/
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment