Skip to content

Commit

Permalink
Fix release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Sheehy <ssheehy@firescope.com>
  • Loading branch information
Steven Sheehy committed Jun 18, 2019
1 parent aecf867 commit 3ab5e6a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
38 changes: 18 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,28 @@ workflows:
filters:
branches:
only: master
- publish-helm:
- deploy:
requires:
- test
- test-helm
- build
- lint
- publish
filters:
branches:
only: master
- deploy:
release:
jobs:
- release:
filters:
branches:
ignore: /.*/
tags:
only: /.+/
- publish-helm:
requires:
- publish
- release
filters:
branches:
only: master
ignore: /.*/
tags:
only: /.+/

# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
defaults: &defaults
Expand Down Expand Up @@ -156,7 +163,7 @@ jobs:
key: v1-loki-{{ .Branch }}-{{ .Revision }}
- restore_cache:
key: v1-loki-plugin-{{ .Branch }}-{{ .Revision }}

- run:
name: Load Images
command: |
Expand All @@ -168,7 +175,7 @@ jobs:
command: |
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
make push-latest
- run:
name: Push Docker Plugin
command: |
Expand Down Expand Up @@ -234,18 +241,9 @@ jobs:
steps:
- checkout
- setup_remote_docker
- restore_cache:
key: v1-loki-{{ .Branch }}-{{ .Revision }}
- run:
name: Load Images
command: |
touch loki-build-image/.uptodate &&
make BUILD_IN_CONTAINER=false load-images
- run:
name: "Print Tag"
command: echo ${CIRCLE_TAG}
- run:
name: "Release"
command: |
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" &&
make VERSION=${CIRCLE_TAG} release-perform
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ release-perform:
@set -e; \
for image_name in $(IMAGE_NAMES); do \
if ! echo $$image_name | grep build; then \
docker tag $$image_name:$(IMAGE_TAG) $$image_name:$(VERSION); \
docker pull $$image_name:master; \
docker tag $$image_name:master $$image_name:$(VERSION); \
docker push $$image_name:$(VERSION); \
fi \
done
Expand Down Expand Up @@ -296,19 +297,19 @@ PLUGIN_FOLDER = ./cmd/docker-driver
PLUGIN_TAG ?= $(IMAGE_TAG)

build-plugin: $(PLUGIN_FOLDER)/docker-driver
-docker plugin disable grafana/loki-docker-driver:$(IMAGE_TAG)
-docker plugin rm grafana/loki-docker-driver:$(IMAGE_TAG)
-docker plugin disable ${IMAGE_PREFIX}loki-docker-driver:$(IMAGE_TAG)
-docker plugin rm ${IMAGE_PREFIX}loki-docker-driver:$(IMAGE_TAG)
-rm -rf $(PLUGIN_FOLDER)/rootfs
mkdir $(PLUGIN_FOLDER)/rootfs
docker build -t rootfsimage $(PLUGIN_FOLDER)
ID=$$(docker create rootfsimage true) && \
(docker export $$ID | tar -x -C $(PLUGIN_FOLDER)/rootfs) && \
docker rm -vf $$ID
docker rmi rootfsimage -f
docker plugin create grafana/loki-docker-driver:$(PLUGIN_TAG) $(PLUGIN_FOLDER)
docker plugin create ${IMAGE_PREFIX}loki-docker-driver:$(PLUGIN_TAG) $(PLUGIN_FOLDER)

push-plugin: build-plugin
docker plugin push grafana/loki-docker-driver:$(PLUGIN_TAG)
docker plugin push ${IMAGE_PREFIX}loki-docker-driver:$(PLUGIN_TAG)

enable-plugin:
docker plugin enable grafana/loki-docker-driver:$(PLUGIN_TAG)
docker plugin enable ${IMAGE_PREFIX}loki-docker-driver:$(PLUGIN_TAG)

0 comments on commit 3ab5e6a

Please sign in to comment.