Skip to content

Commit

Permalink
Add target to build dev images
Browse files Browse the repository at this point in the history
...and disable persistence for dev-build.

Signed-off-by: Moti Asayag <[email protected]>
  • Loading branch information
masayag committed Apr 21, 2024
1 parent 7af9a64 commit 1aa0faa
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
default: false

env:
DOCKERFILE: workflow-builder${{ inputs.it_mode== true && '-dev' || ''}}.Dockerfile
WF_CONFIG_REPO: parodos-dev/serverless-workflows-config

jobs:
Expand All @@ -32,16 +31,33 @@ jobs:
- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
if: ${{ ! inputs.it_mode }}
with:
image: serverless-workflow-${{ inputs.workflow_id }}
tags: latest ${{ github.sha }}
extra-args: --ulimit nofile=4096:4096
containerfiles: |
pipeline/${{ env.DOCKERFILE }}
pipeline/workflow-builder.Dockerfile
build-args: |
WF_RESOURCES=${{ inputs.workflow_id }}/
MAVEN_ARGS_APPEND=-Dkogito.persistence.type=jdbc -Dquarkus.datasource.db-kind=postgresql -Dkogito.persistence.proto.marshaller=false
QUARKUS_EXTENSIONS=org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:9.99.1.redhat-00003,org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:9.99.1.redhat-00003,org.kie.kogito:kogito-addons-persistence-jdbc:9.99.1.redhat-00003,io.quarkus:quarkus-jdbc-postgresql:3.2.9.Final,io.quarkus:quarkus-agroal:3.2.9.Final
- name: Buildah Action for testing
id: build-dev-image
uses: redhat-actions/buildah-build@v2
if: ${{ inputs.it_mode }}
with:
image: serverless-workflow-${{ inputs.workflow_id }}
tags: latest ${{ github.sha }}
extra-args: --ulimit nofile=4096:4096
containerfiles: |
pipeline/workflow-builder-dev.Dockerfile
build-args: |
WF_RESOURCES=${{ inputs.workflow_id }}/
MAVEN_ARGS_APPEND=
QUARKUS_EXTENSIONS=
- name: Buildah push to OCI Arcive
if: ${{ inputs.it_mode }}
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/move2kube-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
run: |
helm repo add janus-idp-workflows https://rgolangh.github.io/janus-idp-workflows-helm/
helm install janus-idp-workflows janus-idp-workflows/janus-idp-workflows \
--set backstage.upstream.backstage.image.tag=1.1 \
-f https://raw.githubusercontent.com/rgolangh/janus-idp-workflows-helm/main/charts/kubernetes/orchestrator/values-k8s.yaml
echo "sleep bit long till the PV for data index and kaniko cache is ready. its a bit slow. TODO fixit"
kubectl get pv
Expand All @@ -107,7 +108,8 @@ jobs:
yq --inplace 'del(.spec.persistence)' manifests/01-sonataflow_m2k.yaml
# The 'for loop' added due to inconsistency of the generated numbers of the configmaps
for file in manifests/*-configmap_m2k-props.yaml; do
sed -i '/quarkus\.flyway\.migrate-at-start=true/d' "$file"
# sed -i '/quarkus\.flyway\.migrate-at-start=true/d' "$file"
sed -i 's/quarkus.flyway.migrate-at-start=true/quarkus.datasource.jdbc.url = ""/' "$file"
done
# deploy the manifests created by the ${{ steps.build-image.outputs.image }}"
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/mta-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
run: |
helm repo add janus-idp-workflows https://rgolangh.github.io/janus-idp-workflows-helm/
helm install janus-idp-workflows janus-idp-workflows/janus-idp-workflows \
--set backstage.upstream.backstage.image.tag=1.1 \
-f https://raw.githubusercontent.com/rgolangh/janus-idp-workflows-helm/main/charts/kubernetes/orchestrator/values-k8s.yaml
echo "sleep bit long till the PV for data index and kaniko cache is ready. its a bit slow. TODO fixit"
Expand Down Expand Up @@ -108,11 +109,28 @@ jobs:
yq --inplace '.spec.podTemplate.container.env |= ( . + [{"name": "QUARKUS_REST_CLIENT_MTA_JSON_URL", "value": "http://tackle-ui.my-konveyor-operator.svc:8080/hub"}, {"name": "BACKSTAGE_NOTIFICATIONS_URL", "value": "http://janus-idp-workflows-backstage.default.svc.cluster.local:7007/api/notifications/"}] )' manifests/01-sonataflow_mtaanalysis.yaml
# Disable persistence for e2e tests
yq --inplace 'del(.spec.persistence)' manifests/01-sonataflow_mtaanalysis.yaml
sed -i '/quarkus\.flyway\.migrate-at-start=true/d' manifests/02-configmap_mtaanalysis-props.yaml
# deploy the manifests created by the ${{ steps.build-image.outputs.image }}"
kubectl apply -f manifests
yq e '.spec.persistence = {}' -i manifests/01-sonataflow_mtaanalysis.yaml
# sed -i '/quarkus\.flyway\.migrate-at-start=true/d' manifests/02-configmap_mtaanalysis-props.yaml
# sed -i '/^data:/a \ \ \ \ quarkus.datasource.jdbc.url = ""' manifests/02-configmap_mtaanalysis-props.yaml
# The purpose of this ugly hack is to prevent the workflow application start with DB enabled.
# While the workflow be responsive for incoming requests, it will also produce warnings since the persistence attributes
# are build-time only in Quarkus 3.2. When we'll switch to Quarkus 3.8 we can easily disable persistence by introducing line:
# quarkus.datasource.jdbc = false
# See https://quarkus.io/guides/datasource#jdbc-and-reactive-datasources-simultaneously and
# https://quarkus.io/guides/datasource#quarkus-agroal_quarkus-datasource-jdbc
sed -i 's/quarkus.flyway.migrate-at-start=true/quarkus.datasource.jdbc.url = ""/' manifests/02-configmap_mtaanalysis-props.yaml
echo "manifests/02-configmap_mtaanalysis-props.yaml"
cat manifests/02-configmap_mtaanalysis-props.yaml
echo "---"
echo "manifests/01-sonataflow_mtaanalysis.yaml"
cat manifests/01-sonataflow_mtaanalysis.yaml
echo "---"
# deploy the manifests created by the ${{ steps.build-image.outputs.image }} image
kubectl apply -f manifests/
sleep 5
kubectl get deployment mtaanalysis -o jsonpath={.spec.template.spec.containers[]}
# give the pod time to start
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ else
DOCKERFILE ?= src/main/docker/Dockerfile.jvm
endif

DEV_DOCKERFILE ?= pipeline/workflow-builder-dev.Dockerfile

ifeq ($(IS_WORKFLOW),true)
IMAGE_NAME = $(REGISTRY)/$(REGISTRY_REPO)/$(IMAGE_PREFIX)-$(WORKFLOW_ID)
else
Expand All @@ -80,6 +82,8 @@ DEPLOYMENT_BRANCH ?= main
# extra extensions needed for persistence at build time.
# The extentions listed below are included in the cache in image quay.io/kiegroup/kogito-swf-builder:9.99.1.CR1 or available from maven central repository
QUARKUS_EXTENSIONS=org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:9.99.1.redhat-00003,org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:9.99.1.redhat-00003,org.kie.kogito:kogito-addons-persistence-jdbc:9.99.1.redhat-00003,io.quarkus:quarkus-jdbc-postgresql:3.2.9.Final,io.quarkus:quarkus-agroal:3.2.9.Final
QUARKUS_DEV_EXTENSIONS=""
#org.kie:kie-addons-quarkus-persistence-jdbc:999-20240317-SNAPSHOT,io.quarkus:quarkus-jdbc-postgresql:3.2.9.Final,io.quarkus:quarkus-agroal:3.2.9.Final

# build time properties required for persistence.
MAVEN_ARGS_APPEND="-Dkogito.persistence.type=jdbc -Dquarkus.datasource.db-kind=postgresql -Dkogito.persistence.proto.marshaller=false"
Expand Down Expand Up @@ -122,6 +126,10 @@ else
--tag ${IMAGE_NAME}:${IMAGE_TAG} --tag ${IMAGE_NAME}:latest .
endif

build-dev-image: QUARKUS_EXTENSIONS=$(QUARKUS_DEV_EXTENSIONS)
build-dev-image: DOCKERFILE=$(DEV_DOCKERFILE)
build-dev-image: build-image

# Target: push-image
# Description: Pushes the workflow containerized image to the configured REGISTRY.
# Usage: make push-image
Expand Down
2 changes: 1 addition & 1 deletion pipeline/workflow-builder-dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM quay.io/kiegroup/kogito-swf-builder-nightly:main-2024-04-08 AS builder

# Temp hack to provide persistence artifacts
ENV MAVEN_REPO_URL=https://maven.repository.redhat.com/earlyaccess/all
# ENV MAVEN_REPO_URL=https://maven.repository.redhat.com/earlyaccess/all

# variables that can be overridden by the builder
# To add a Quarkus extension to your application
Expand Down

0 comments on commit 1aa0faa

Please sign in to comment.