Skip to content

Commit

Permalink
Pass the full github sha to the make targets in github actions
Browse files Browse the repository at this point in the history
The Makefile default is to use a short 8 chars of the revision, while
the github action is relying on the full github version using the {{
github.sha }} context variable, which is available every where.
We could potentially change the short sha in the makefile, but it is
convenient for developers, hence will leave this untouched for now.

Signed-off-by: Roy Golan <[email protected]>
  • Loading branch information
rgolangh committed Jul 15, 2024
1 parent 237b306 commit a607d44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} \
Expand Down Expand Up @@ -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 }} \
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion scripts/gen_manifests.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 |= (
Expand Down

0 comments on commit a607d44

Please sign in to comment.