From 9f4056347d0b88ace995e1dc1435e60b470383bf Mon Sep 17 00:00:00 2001 From: Eloy Coto Date: Mon, 13 Mar 2023 12:54:51 +0100 Subject: [PATCH] CI: Push images on each main push Signed-off-by: Eloy Coto --- .github/workflows/push.yml | 41 +++++++++++++++++++++++ Makefile | 10 +++--- hack/manifests/base/deployment.yaml | 4 +-- hack/manifests/testing/ingress.yaml | 2 +- hack/manifests/testing/kustomization.yaml | 4 +-- 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 000000000..4df49c01f --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,41 @@ +--- +name: Main push +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }} + + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: Maven Build + run: mvn clean package + + + - name: Build cotainer + run: mvn clean package + + - name: "Build container images" + run: | + make build-images GIT_BRANCH=${GITHUB_REF##*/} + make tag-images GIT_BRANCH=${GITHUB_REF##*/} + + + - name: Login to quay + env: + QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} + run: | + echo "$QUAY_TOKEN" | docker login quay.io --username parodos+githubpush --password-stdin + + - name: "Push images" + run: | + make push-images GIT_BRANCH=${GITHUB_REF##*/} diff --git a/Makefile b/Makefile index ce05d9c99..dba7f19d9 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ MAVEN ?= mvn # set quiet mode by default Q=@ -ORG=quay.io/parados/ +ORG=quay.io/parodos/ WORKFLOW_SERVICE_IMAGE=workflow-service NOTIFICATION_SERVICE_IMAGE=notification-service @@ -132,11 +132,11 @@ tag-images: ## Tag docker images with git hash and branch name $(DOCKER) tag docker-compose_notification-service:latest $(ORG)$(NOTIFICATION_SERVICE_IMAGE):$(GIT_BRANCH) push-images: ## Push docker images to quay.io registry - $(DOCKER) push $(ORG)/$(WORKFLOW_SERVICE_IMAGE):$(GIT_HASH) - $(DOCKER) push $(ORG)/$(NOTIFICATION_SERVICE_IMAGE):$(GIT_HASH) + $(DOCKER) push $(ORG)$(WORKFLOW_SERVICE_IMAGE):$(GIT_HASH) + $(DOCKER) push $(ORG)$(NOTIFICATION_SERVICE_IMAGE):$(GIT_HASH) - $(DOCKER) push $(ORG)/$(WORKFLOW_SERVICE_IMAGE):$(GIT_BRANCH) - $(DOCKER) push $(ORG)/$(NOTIFICATION_SERVICE_IMAGE):$(GIT_BRANCH) + $(DOCKER) push $(ORG)$(WORKFLOW_SERVICE_IMAGE):$(GIT_BRANCH) + $(DOCKER) push $(ORG)$(NOTIFICATION_SERVICE_IMAGE):$(GIT_BRANCH) push-images-to-kind: ## Push docker images to kind $(DOCKER) tag docker-compose_workflow-service:latest $(ORG)$(WORKFLOW_SERVICE_IMAGE):test diff --git a/hack/manifests/base/deployment.yaml b/hack/manifests/base/deployment.yaml index 324668213..eebce8bce 100644 --- a/hack/manifests/base/deployment.yaml +++ b/hack/manifests/base/deployment.yaml @@ -13,7 +13,7 @@ spec: spec: containers: - name: notification-service - image: quay.io/parados/notification-service:latest + image: quay.io/parodos/notification-service:latest env: - name: SPRING_PROFILES_ACTIVE value: "local" @@ -33,7 +33,7 @@ spec: spec: containers: - name: workflow-service - image: quay.io/parados/workflow-service:latest + image: quay.io/parodos/workflow-service:latest env: - name: SPRING_PROFILES_ACTIVE value: "dev" diff --git a/hack/manifests/testing/ingress.yaml b/hack/manifests/testing/ingress.yaml index edb38bb72..a252e5be5 100644 --- a/hack/manifests/testing/ingress.yaml +++ b/hack/manifests/testing/ingress.yaml @@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: parados-ingress + name: parodos-ingress spec: rules: - http: diff --git a/hack/manifests/testing/kustomization.yaml b/hack/manifests/testing/kustomization.yaml index 7ebdd5e66..363b65686 100644 --- a/hack/manifests/testing/kustomization.yaml +++ b/hack/manifests/testing/kustomization.yaml @@ -4,10 +4,10 @@ resources: - ingress.yaml - ldap.yaml images: -- name: quay.io/parados/workflow-service:latest +- name: quay.io/parodos/workflow-service:latest newTag: test -- name: quay.io/parados/notification-service:latest +- name: quay.io/parodos/notification-service:latest newTag: test configMapGenerator: