Skip to content

Commit 0c9a777

Browse files
committed
Add version and commit labels to release manifests
Update build-installer target to accept VERSION_LABEL and GIT_SHA_LABEL parameters that add app.kubernetes.io/version and app.kubernetes.io/commit labels to all resources. Release workflow now passes version and git SHA to label all released manifests.
1 parent e2e3179 commit 0c9a777

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ jobs:
101101

102102
- name: Generate installation manifest
103103
run: |
104-
make build-installer IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.full }}
104+
GIT_SHA=$(git rev-parse --short HEAD)
105+
make build-installer \
106+
IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.full }} \
107+
VERSION_LABEL=${{ steps.version.outputs.full }} \
108+
GIT_SHA_LABEL=${GIT_SHA}
105109
mv dist/install.yaml func-operator.yaml
106110
107111
- name: Create GitHub Release

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,16 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
209209
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
210210
mkdir -p dist
211211
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
212+
@if [ -n "$(VERSION_LABEL)" ]; then \
213+
cd config/default && $(KUSTOMIZE) edit add label app.kubernetes.io/version:$(VERSION_LABEL) --force; \
214+
fi
215+
@if [ -n "$(GIT_SHA_LABEL)" ]; then \
216+
cd config/default && $(KUSTOMIZE) edit add label app.kubernetes.io/commit:$(GIT_SHA_LABEL) --force; \
217+
fi
212218
$(KUSTOMIZE) build config/default > dist/install.yaml
219+
@if [ -n "$(VERSION_LABEL)" ] || [ -n "$(GIT_SHA_LABEL)" ]; then \
220+
cd config/default && git restore kustomization.yaml; \
221+
fi
213222

214223
##@ Deployment
215224

0 commit comments

Comments
 (0)