Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release workflow #677

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)