diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c99438b..d94d647b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,6 +41,7 @@ jobs: run: | make WORKFLOW_ID=${{ inputs.workflow_id }} \ APPLICATION_ID=${{ inputs.application_id }} \ + IMAGE_TAG=${{ github.sha }} \ GIT_TOKEN=${{ env.GH_TOKEN }} \ REGISTRY_REPO=${{ env.REGISTRY_REPO }} \ REGISTRY_USERNAME=${{ secrets.NEW_QUAY_USERNAME }} \ @@ -81,6 +82,7 @@ jobs: run: | make WORKFLOW_ID=${{ inputs.workflow_id }} \ APPLICATION_ID=${{ inputs.application_id }} \ + IMAGE_TAG=${{ github.sha }} \ GIT_TOKEN=${{ env.GH_TOKEN }} \ REGISTRY_REPO=${{ env.REGISTRY_REPO }} \ REGISTRY_USERNAME=${{ secrets.NEW_QUAY_USERNAME }} \ @@ -98,6 +100,7 @@ jobs: WORKDIR=${{ runner.temp }}/serverless-workflows make WORKFLOW_ID=${{ inputs.workflow_id }} \ WORKDIR=${WORKDIR} \ + IMAGE_TAG=${{ github.sha }} \ APPLICATION_ID=${{ inputs.application_id }} \ PR_OR_COMMIT_URL=${PR_OR_COMMIT_URL} \ gen-manifests diff --git a/Makefile b/Makefile index d1fd25d7..1634f219 100644 --- a/Makefile +++ b/Makefile @@ -175,7 +175,7 @@ save-oci: build-image gen-manifests: prepare-workdir cd $(WORKDIR) @$(CONTAINER_ENGINE) run --rm -v $(WORKDIR):/workdir:Z -w /workdir \ - $(LINUX_IMAGE) /bin/bash -c "ENABLE_PERSISTENCE=$(ENABLE_PERSISTENCE) ${SCRIPTS_DIR}/gen_manifests.sh $(WORKFLOW_ID)" + $(LINUX_IMAGE) /bin/bash -c "ENABLE_PERSISTENCE=$(ENABLE_PERSISTENCE) WORKFLOW_IMAGE_TAG=$(IMAGE_TAG) ${SCRIPTS_DIR}/gen_manifests.sh $(WORKFLOW_ID)" @echo "Manifests are available in workdir $(WORKDIR)/$(WORKFLOW_ID)/manifests" # Target: push-manifests diff --git a/scripts/gen_manifests.sh b/scripts/gen_manifests.sh index 4b30bcc3..0a8375fd 100755 --- a/scripts/gen_manifests.sh +++ b/scripts/gen_manifests.sh @@ -1,6 +1,10 @@ #!/bin/bash WORKFLOW_FOLDER=$1 +WORKFLOW_IMAGE_REGISTRY="${WORKFLOW_IMAGE_REGISTRY:-quay.io}" +WORKFLOW_IMAGE_NAMESPACE="${WORKFLOW_IMAGE_NAMESPACE:-orchestrator}" +WORKFLOW_IMAGE_REPO="${WORKFLOW_IMAGE_REPO:-serverless-workflow-${WORKFLOW_FOLDER}}" +WORKFLOW_IMAGE_TAG="${WORKFLOW_IMAGE_TAG:-latest}" if [ ! -f kn ]; then echo "Installing kn-workflow CLI" @@ -43,7 +47,7 @@ fi SONATAFLOW_CR=manifests/01-sonataflow_${workflow_id}.yaml yq --inplace eval '.metadata.annotations["sonataflow.org/profile"] = "prod"' "${SONATAFLOW_CR}" -yq --inplace ".spec.podTemplate.container.image=\"quay.io/orchestrator/serverless-workflow-${WORKFLOW_FOLDER}:latest\"" "${SONATAFLOW_CR}" +yq --inplace ".spec.podTemplate.container.image=\"${WORKFLOW_IMAGE_REGISTRY}/${WORKFLOW_IMAGE_NAMESPACE}/${WORKFLOW_IMAGE_REPO}:${WORKFLOW_IMAGE_TAG}\"" "${SONATAFLOW_CR}" if [ "${ENABLE_PERSISTENCE}" = true ]; then yq --inplace ".spec |= (