From 33c73f65b6573d1d629714cb28eb20f3a76795a3 Mon Sep 17 00:00:00 2001 From: Yaron Dayagi Date: Thu, 6 Jul 2023 01:03:07 +0300 Subject: [PATCH] separate workflow-examples from workflow-service build workflow-service image without workflow-examples provide workflow-examples (or user's JAR) via a PVC for integration tests create a PVC in kind and use a pod to mount it and copy the examples JAR to the PVC. FLPATH-510 https://issues.redhat.com/browse/FLPATH-510 Signed-off-by: Yaron Dayagi --- .github/workflows/test.yml | 11 +++++++++++ Makefile | 7 +++++++ docker-compose/docker-compose.yml | 8 +++++++- hack/manifests/testing/kustomization.yaml | 1 + integration-tests/Dockerfile | 5 +++++ workflow-service/Dockerfile | 5 +---- 6 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 integration-tests/Dockerfile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6ba9f4ed..0e8149511 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -108,6 +108,11 @@ jobs: run: | make build-images + - name: Upload image + uses: ishworkh/docker-image-artifact-upload@v1 + with: + image: "docker-compose_examples-service:latest" + - name: Upload image uses: ishworkh/docker-image-artifact-upload@v1 with: @@ -175,6 +180,11 @@ jobs: with: image: "docker-compose_workflow-service:latest" + - name: Download images + uses: ishworkh/docker-image-artifact-download@v1 + with: + image: "docker-compose_examples-service:latest" + - name: Load images inside kind run: | make push-images-to-kind @@ -185,6 +195,7 @@ jobs: kubectl wait --timeout=600s --for=condition=Ready pods --all -n default || { echo "Timeout waiting for Parodos services to be ready"; kubectl get pods --all-namespaces; + kubectl describe pods echo "************ workflow-service logs ***************"; kubectl logs -l app=workflow-service --tail=40; echo "************ notification-service logs ***************"; diff --git a/Makefile b/Makefile index 6f47c7621..d772546ed 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ MAVEN ?= /usr/bin/mvn ORG=quay.io/parodos-dev/ WORKFLOW_SERVICE_IMAGE=workflow-service NOTIFICATION_SERVICE_IMAGE=notification-service +EXAMPLES_SERVICE_IMAGE=examples-service # get version from pom VERSION = $(shell sed -n "s/\(.*\)<\/revision>/\1/p" $(PWD)/pom.xml | sed 's/\ *//g') @@ -145,9 +146,11 @@ tag-images: ## Tag docker images with git hash and branch name $(eval TAG?=$(GIT_HASH)) $(DOCKER) tag docker-compose_workflow-service:latest $(ORG)$(WORKFLOW_SERVICE_IMAGE):$(TAG) $(DOCKER) tag docker-compose_notification-service:latest $(ORG)$(NOTIFICATION_SERVICE_IMAGE):$(TAG) + $(DOCKER) tag docker-compose_examples-service:latest $(ORG)$(EXAMPLES_SERVICE_IMAGE):$(TAG) $(DOCKER) tag docker-compose_workflow-service:latest $(ORG)$(WORKFLOW_SERVICE_IMAGE):$(GIT_BRANCH) $(DOCKER) tag docker-compose_notification-service:latest $(ORG)$(NOTIFICATION_SERVICE_IMAGE):$(GIT_BRANCH) + $(DOCKER) tag docker-compose_examples-service:latest $(ORG)$(EXAMPLES_SERVICE_IMAGE):$(GIT_BRANCH) deploy-local-registry: ifneq ($(shell $(DOCKER) container inspect -f '{{.State.Running}}' registry 2> /dev/null), true) @@ -228,14 +231,18 @@ push-images: ## Push docker images to quay.io registry $(eval TAG?=$(GIT_HASH)) $(DOCKER) push $(ORG)$(WORKFLOW_SERVICE_IMAGE):$(TAG) $(DOCKER) push $(ORG)$(NOTIFICATION_SERVICE_IMAGE):$(TAG) + $(DOCKER) push $(ORG)$(EXAMPLES_SERVICE_IMAGE):$(TAG) $(DOCKER) push $(ORG)$(WORKFLOW_SERVICE_IMAGE):$(GIT_BRANCH) $(DOCKER) push $(ORG)$(NOTIFICATION_SERVICE_IMAGE):$(GIT_BRANCH) + $(DOCKER) push $(ORG)$(EXAMPLES_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 + $(DOCKER) tag docker-compose_examples-service:latest $(ORG)$(EXAMPLES_SERVICE_IMAGE):test $(DOCKER) tag docker-compose_notification-service:latest $(ORG)$(NOTIFICATION_SERVICE_IMAGE):test kind load docker-image $(ORG)$(WORKFLOW_SERVICE_IMAGE):test + kind load docker-image $(ORG)$(EXAMPLES_SERVICE_IMAGE):test kind load docker-image $(ORG)$(NOTIFICATION_SERVICE_IMAGE):test install-nginx: ## Install nginx diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index cefbace1a..f3f773526 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -20,4 +20,10 @@ services: environment: - SPRING_PROFILES_ACTIVE=local depends_on: - - notification-service \ No newline at end of file + - notification-service + + examples-service: + build: + context: ../ + dockerfile: ./integration-tests/Dockerfile + container_name: examples-service diff --git a/hack/manifests/testing/kustomization.yaml b/hack/manifests/testing/kustomization.yaml index 76a8ac97a..0fcf63fbe 100644 --- a/hack/manifests/testing/kustomization.yaml +++ b/hack/manifests/testing/kustomization.yaml @@ -14,6 +14,7 @@ patches: images: - name: quay.io/parodos-dev/workflow-service:main + newName: quay.io/parodos-dev/examples-service newTag: test - name: quay.io/parodos-dev/notification-service:main newTag: test diff --git a/integration-tests/Dockerfile b/integration-tests/Dockerfile new file mode 100644 index 000000000..90528da10 --- /dev/null +++ b/integration-tests/Dockerfile @@ -0,0 +1,5 @@ +FROM docker-compose_workflow-service:latest +WORKDIR /app +COPY workflow-examples/target/*jar-with-dependencies.jar ./workflows.jar +EXPOSE 8080 +ENTRYPOINT java -Dloader.path=workflows.jar -jar workflow-service.jar diff --git a/workflow-service/Dockerfile b/workflow-service/Dockerfile index e3d8093be..76f2448fb 100644 --- a/workflow-service/Dockerfile +++ b/workflow-service/Dockerfile @@ -3,10 +3,7 @@ FROM registry.access.redhat.com/ubi9/openjdk-17-runtime WORKDIR /app COPY workflow-service/target/workflow-service-*.*.*[^a-z].jar ./workflow-service.jar -COPY workflow-examples/target/*jar-with-dependencies.jar ./workflow-examples.jar EXPOSE 8080 -ENV SYS_PROPS="-Dloader.path=workflow-examples.jar" - -ENTRYPOINT java ${SYS_PROPS} -jar workflow-service.jar +ENTRYPOINT java -jar workflow-service.jar