From 0ff845d193bec0d02c36af1556609d6d4a98c63b Mon Sep 17 00:00:00 2001 From: dantevvp Date: Thu, 9 Feb 2023 14:40:12 -0300 Subject: [PATCH 1/3] Push images to Dockerhub instead of GCR --- .circleci/config.yml | 9 +++++++-- Makefile | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c6c64abe..78e902c5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,8 +18,12 @@ jobs: - checkout - setup_remote_docker: docker_layer_caching: true - - run: docker login -u _json_key -p "$GCR_JSON_KEY" us.gcr.io - - run: make release RELEASE_TAG="b$CIRCLE_BUILD_NUM" + - run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - run: + name: Push image to Dockerhub + command: | + make release RELEASE_TAG="b$CIRCLE_BUILD_NUM" + make release RELEASE_TAG="$(echo $CIRCLE_BRANCH | grep -oP 'channel/\K[\w\-]+')" workflows: version: 2 @@ -27,6 +31,7 @@ workflows: jobs: - build_and_test - release_images: + context: Quality requires: - build_and_test filters: diff --git a/Makefile b/Makefile index 81937778..6a923a9a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .PHONY: image test citest release IMAGE_NAME ?= codeclimate/codeclimate-duplication +RELEASE_TAG ?= latest image: docker build --rm -t $(IMAGE_NAME) . @@ -17,7 +18,6 @@ bundle: --volume $(PWD):/usr/src/app \ $(IMAGE_NAME) -c "bundle $(BUNDLE_ARGS)" -release: image - docker tag $(IMAGE_NAME) \ - us.gcr.io/code_climate/codeclimate-duplication:$(RELEASE_TAG) - docker push us.gcr.io/code_climate/codeclimate-duplication:$(RELEASE_TAG) +release: + docker tag $(IMAGE_NAME) $(RELEASE_REGISTRY)/codeclimate-coffeelint:$(RELEASE_TAG) + docker push $(RELEASE_REGISTRY)/codeclimate-coffeelint:$(RELEASE_TAG) From 500f7faa49b2f69fbc6d70992928bf1cc8437e75 Mon Sep 17 00:00:00 2001 From: dantevvp Date: Thu, 9 Feb 2023 14:50:05 -0300 Subject: [PATCH 2/3] change make release image name --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6a923a9a..ad467397 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .PHONY: image test citest release IMAGE_NAME ?= codeclimate/codeclimate-duplication +RELEASE_REGISTRY ?= codeclimate RELEASE_TAG ?= latest image: @@ -19,5 +20,5 @@ bundle: $(IMAGE_NAME) -c "bundle $(BUNDLE_ARGS)" release: - docker tag $(IMAGE_NAME) $(RELEASE_REGISTRY)/codeclimate-coffeelint:$(RELEASE_TAG) - docker push $(RELEASE_REGISTRY)/codeclimate-coffeelint:$(RELEASE_TAG) + docker tag $(IMAGE_NAME) $(RELEASE_REGISTRY)/codeclimate-duplication:$(RELEASE_TAG) + docker push $(RELEASE_REGISTRY)/codeclimate-duplication:$(RELEASE_TAG) From 2203c4ee20a65d70421eda7aa5927270185f8537 Mon Sep 17 00:00:00 2001 From: Dante Ventieri Date: Mon, 13 Feb 2023 12:42:30 -0300 Subject: [PATCH 3/3] override RELEASE_TAG on empty string --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ad467397..a92142b5 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,10 @@ IMAGE_NAME ?= codeclimate/codeclimate-duplication RELEASE_REGISTRY ?= codeclimate -RELEASE_TAG ?= latest + +ifndef RELEASE_TAG +override RELEASE_TAG = latest +endif image: docker build --rm -t $(IMAGE_NAME) .