From f870cf483433452619de216a2d18f074bc68b1f9 Mon Sep 17 00:00:00 2001 From: Dante Ventieri Date: Mon, 13 Feb 2023 11:59:25 -0300 Subject: [PATCH 1/5] Push images to Dockerhub instead of GCR --- .circleci/config.yml | 10 +++++----- Makefile | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3c36f1f..f4965d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,13 +25,12 @@ jobs: steps: - checkout - run: make image - - run: echo "$GCR_JSON_KEY" | docker login -u _json_key --password-stdin us.gcr.io + - run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - run: - name: Push image to GCR + name: Push image to Dockerhub command: | - docker tag $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \ - us.gcr.io/code-climate/codeclimate-phpmd:b$CIRCLE_BUILD_NUM - docker push us.gcr.io/code-climate/codeclimate-phpmd:b$CIRCLE_BUILD_NUM + make release RELEASE_TAG="b$CIRCLE_BUILD_NUM" + make release RELEASE_TAG="$(echo $CIRCLE_BRANCH | grep -oP 'channel/\K[\w\-]+')" workflows: version: 2 @@ -42,6 +41,7 @@ workflows: requires: - build - release_images: + context: Quality requires: - test diff --git a/Makefile b/Makefile index 6573191..b2343a2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ -.PHONY: image composer-update test +.PHONY: image composer-update test release IMAGE_NAME ?= codeclimate/codeclimate-phpmd +RELEASE_REGISTRY ?= codeclimate +RELEASE_TAG ?= latest image: docker build --tag $(IMAGE_NAME) . @@ -26,3 +28,7 @@ test: --volume $(PWD)/tests:/usr/src/app/tests \ $(IMAGE_NAME)-test \ sh -c "vendor/bin/phpunit --bootstrap engine.php ./tests" + +release: + docker tag $(IMAGE_NAME) $(RELEASE_REGISTRY)/codeclimate-phpmd:$(RELEASE_TAG) + docker push $(RELEASE_REGISTRY)/codeclimate-phpmd:$(RELEASE_TAG) From dee62b2adc5eae68989da490f314d143c4ca6003 Mon Sep 17 00:00:00 2001 From: Dante Ventieri Date: Mon, 13 Feb 2023 12:12:54 -0300 Subject: [PATCH 2/5] Change base image to alpine:3.15.0 --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 79ca58c..40bb8a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:edge +FROM alpine:3.15.0 LABEL maintainer="Code Climate " WORKDIR /usr/src/app @@ -37,13 +37,13 @@ RUN composer install --no-dev && \ # Build Content COPY bin/build-content ./bin/build-content -RUN apk add --no-cache ruby ruby-json ruby-bigdecimal ruby-dev build-base libxml2-dev libxslt-dev libffi-dev && \ +RUN apk add --no-cache ruby ruby-json ruby-bigdecimal ruby-dev build-base libxml2-dev libxslt-dev libffi-dev yaml-dev && \ gem install rdoc nokogiri httparty --no-document && \ ./bin/build-content && \ chown -R app:app content && \ gem uninstall --all rdoc httparty nokogiri && \ rm -rf $( gem environment gemdir ) && \ - apk del --purge ruby ruby-json ruby-bigdecimal ruby-dev build-base libxml2-dev libxslt-dev libffi-dev && \ + apk del --purge ruby ruby-json ruby-bigdecimal ruby-dev build-base libxml2-dev libxslt-dev libffi-dev yaml-dev && \ rm -rf /var/cache/* ~/.gem COPY . ./ From d4592b5e9f4f7a9ff66776443acbab1d2d550d8b Mon Sep 17 00:00:00 2001 From: Dante Ventieri Date: Mon, 13 Feb 2023 12:38:30 -0300 Subject: [PATCH 3/5] Fix makefile release step --- .circleci/config.yml | 3 +++ Makefile | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f4965d3..12f6451 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,6 +44,9 @@ workflows: context: Quality requires: - test + filters: + branches: + only: /master|channel\/[\w-]+/ notify: diff --git a/Makefile b/Makefile index b2343a2..5f55ad9 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,11 @@ -.PHONY: image composer-update test release +.PHONY: image composer-update test release tuki IMAGE_NAME ?= codeclimate/codeclimate-phpmd RELEASE_REGISTRY ?= codeclimate -RELEASE_TAG ?= latest + +ifndef RELEASE_TAG +override RELEASE_TAG = latest +endif image: docker build --tag $(IMAGE_NAME) . From e9c80ab3de539bce2c74517f3b345350b4d24c11 Mon Sep 17 00:00:00 2001 From: Dante Ventieri Date: Mon, 13 Feb 2023 12:54:17 -0300 Subject: [PATCH 4/5] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5f55ad9..792fe6b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: image composer-update test release tuki +.PHONY: image composer-update test release IMAGE_NAME ?= codeclimate/codeclimate-phpmd RELEASE_REGISTRY ?= codeclimate From 1741a5b20024c25fc61173918408670e41b94dec Mon Sep 17 00:00:00 2001 From: Dante Ventieri Date: Fri, 10 Mar 2023 15:20:39 -0300 Subject: [PATCH 5/5] Force cc analysis