Skip to content

Commit

Permalink
chore: rename Chart.yaml template to Chart.template.yaml for clarity
Browse files Browse the repository at this point in the history
* chore: rename Chart.yaml template to Chart.template.yaml for clarity
* feat: add make gen target to generate Chart.yaml from Chart.template.yaml
* chore: add Chart.yaml to .gitignore

Signed-off-by: lvlcn-t <[email protected]>
  • Loading branch information
lvlcn-t committed Nov 19, 2024
1 parent f50da2e commit a08c1f0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/end2end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ jobs:
run: echo "value=$(git describe --tags --abbrev=0)-commit-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Install Sparrow
run: |
helm upgrade -i sparrow \
cd chart && make package
version="$(make WITH_V=0 version)"
cd ..
helm upgrade -i sparrow ./chart/sparrow-${version}.tgz \
--atomic \
--timeout 300s \
--set image.tag=${{ steps.version.outputs.value }} \
Expand All @@ -66,8 +69,7 @@ jobs:
--set sparrowConfig.loader.interval=5s \
--set sparrowConfig.loader.file.path=/config/.sparrow.yaml \
--set checksConfig.health.interval=1s \
--set checksConfig.health.timeout=1s \
./chart
--set checksConfig.health.timeout=1s
- name: Check Pods
run: |
Expand Down
1 change: 1 addition & 0 deletions chart/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Chart.yaml
File renamed without changes.
25 changes: 13 additions & 12 deletions chart/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@

WITH_V ?= 0

BASE_VERSION = $(shell (git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | sed 's/^v//')
CHART_VERSION ?= $(shell $(MAKE) -s version)
CHART_APP_VERSION ?= $(shell $(MAKE) -s WITH_V=1 version)

.PHONY: package
package: lint build

.PHONY: gen
gen:
@cp -f Chart.template.yaml Chart.yaml
@sed -i "/^version:.*/c\version: $(BASE_VERSION)" Chart.yaml || echo "version: $(BASE_VERSION)" >> Chart.yaml
@sed -i "/^appVersion:.*/c\appVersion: \"v$(BASE_VERSION)\"" Chart.yaml || echo "appVersion: \"v$(BASE_VERSION)\"" >> Chart.yaml

.PHONY: lint
lint:
lint: gen
@helm lint .

.PHONY: build
build:
build: gen
@helm package . --version $(CHART_VERSION) --app-version $(CHART_APP_VERSION)

.PHONY: docs
docs:
@VERSION=$$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0"); \
VERSION=$${VERSION#v}; \
cp -f Chart.yaml Chart.yaml.bak; \
sed -i "s/^version:.*/version: $${VERSION}/" Chart.yaml; \
sed -i "s/^appVersion:.*/appVersion: \"v$${VERSION}\"/" Chart.yaml; \
echo "Generating docs for version $${VERSION} (appVersion: v$${VERSION})"; \
helm-docs; \
mv -f Chart.yaml.bak Chart.yaml
docs: gen
@echo "Generating docs for version $(BASE_VERSION) (appVersion: v$(BASE_VERSION))"
@helm-docs

.PHONY: version
version:
@TAG=$$(git describe --tags --exact-match 2>/dev/null); \
if [ -n "$$TAG" ]; then \
VERSION="$$TAG"; \
else \
VERSION="$$(git describe --tags --abbrev=0 2>/dev/null)-commit-$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")"; \
VERSION="v$(BASE_VERSION)-commit-$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")"; \
fi; \
if [ "$(WITH_V)" = "1" ]; then \
echo "$$VERSION"; \
Expand Down
2 changes: 1 addition & 1 deletion chart/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# sparrow

![Version: 0.5.0-rc2](https://img.shields.io/badge/Version-0.5.0--rc2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.5.0-rc2](https://img.shields.io/badge/AppVersion-v0.5.0--rc2-informational?style=flat-square)
![Version: 0.5.0-rc3](https://img.shields.io/badge/Version-0.5.0--rc3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.5.0-rc3](https://img.shields.io/badge/AppVersion-v0.5.0--rc3-informational?style=flat-square)

A Helm chart to install Sparrow

Expand Down

0 comments on commit a08c1f0

Please sign in to comment.