This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ migrate to centralised helm repository
- Loading branch information
1 parent
25f9ade
commit 19c9551
Showing
13 changed files
with
124 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
remote: origin | ||
target-branch: master | ||
debug: true | ||
check-version-increment: true | ||
upgrade: true | ||
validate-chart-schema: true | ||
validate-yaml: true |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Release Charts | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
uses: "traefik/hub-helm-chart/.github/workflows/test.yml@master" | ||
release: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
git config --global --add safe.directory /charts | ||
- name: Get chart verison | ||
id: chart_version | ||
run: | | ||
echo "CHART_VERSION=$(cat hub-agent/Chart.yaml | awk -F"[ ',]+" '/version:/{print $2}')" >> $GITHUB_OUTPUT | ||
- name: Check if tag exists | ||
id: tag_exists | ||
run: | | ||
TAG_EXISTS=true | ||
if ! [ $(git tag -l "${{ steps.chart_version.outputs.CHART_VERSION }}") ]; then | ||
TAG_EXISTS=false | ||
fi | ||
echo TAG_EXISTS=$TAG_EXISTS >> $GITHUB_OUTPUT | ||
- name: Tag release | ||
id: tag_version | ||
uses: mathieudutour/github-tag-action@v6.1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
custom_tag: ${{ steps.chart_version.outputs.CHART_VERSION }} | ||
if: steps.tag_exists.outputs.TAG_EXISTS == 'false' | ||
|
||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
if: steps.tag_exists.outputs.TAG_EXISTS == 'false' | ||
|
||
- name: Publish Helm chart | ||
uses: stefanprodan/helm-gh-pages@master | ||
with: | ||
token: ${{ secrets.CHARTS_TOKEN }} | ||
charts_dir: . | ||
charts_url: https://traefik.github.io/charts | ||
owner: traefik | ||
repository: charts | ||
branch: master | ||
target_dir: hub-agent | ||
index_dir: . | ||
commit_username: traefiker | ||
commit_email: 30906710+traefiker@users.noreply.github.com | ||
if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
name: Test | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
- name: Lint | ||
run: make lint | ||
|
||
- name: Test | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,7 @@ | ||
DIST_DIR ?= $(CURDIR)/dist | ||
CHART_DIR ?= $(CURDIR)/hub-agent | ||
TMPDIR ?= /tmp | ||
HELM_REPO ?= $(CURDIR)/repo | ||
LINT_USE_DOCKER ?= true | ||
LINT_CMD ?= ct lint --config=lint/ct.yaml | ||
PROJECT ?= traefik/hub-helm-chart | ||
VERSION ?= $(shell cat hub-agent/Chart.yaml | grep 'version: ' | awk '{ print $$2 }') | ||
.PHONY: lint test | ||
|
||
################################## Functionnal targets | ||
test: | ||
docker run ${DOCKER_ARGS} --entrypoint /bin/sh --rm -v $(CURDIR):/charts -w /charts quintush/helm-unittest:3.10.0-0.2.9 /charts/hack/test.sh | ||
|
||
all: clean test build | ||
|
||
test: lint unit-test | ||
|
||
# Execute Static Testing | ||
lint: lint-requirements | ||
@echo "== Linting Chart..." | ||
@git remote add hub-agent https://github.com/traefik/hub-helm-chart >/dev/null 2>&1 || true | ||
@git fetch hub-agent master >/dev/null 2>&1 || true | ||
ifeq ($(LINT_USE_DOCKER),true) | ||
@docker run --rm -t -v $(CURDIR):/charts -w /charts quay.io/helmpack/chart-testing:v3.3.1 $(LINT_CMD) | ||
else | ||
cd $(CHART_DIR)/tests && $(LINT_CMD) | ||
endif | ||
@echo "== Linting Finished" | ||
|
||
# Execute Units Tests | ||
unit-test: helm-unittest | ||
@echo "== Unit Testing Chart..." | ||
@helm unittest --helm3 --color --update-snapshot ./hub-agent | ||
@echo "== Unit Tests Finished..." | ||
|
||
build: global-requirements $(DIST_DIR) | ||
@echo "== Building Chart..." | ||
@helm package $(CHART_DIR) --destination=$(DIST_DIR) | ||
@echo "== Building Finished" | ||
|
||
# Prepare the Helm repository with the latest packaged charts | ||
package: global-requirements $(DIST_DIR) $(HELM_REPO) build full-yaml | ||
@echo "== Deploying Chart..." | ||
@rm -rf $(CURDIR)/gh-pages.zip | ||
@curl -sSL -o gh-pages.zip -H "Authorization: Bearer $(GITHUB_TOKEN)" https://api.github.com/repos/$(PROJECT)/zipball/gh-pages | ||
@unzip -oj $(CURDIR)/gh-pages.zip -d $(HELM_REPO)/ | ||
@cp $(DIST_DIR)/*tgz $(HELM_REPO)/ | ||
@cp $(CURDIR)/README.md $(HELM_REPO)/index.md | ||
@cp -r $(DIST_DIR)/yaml $(HELM_REPO)/ | ||
@helm repo index --merge $(HELM_REPO)/index.yaml --url https://helm.traefik.io/hub/ $(HELM_REPO) | ||
@echo "== Deploying Finished" | ||
|
||
# Cleanup leftovers and distribution dir | ||
clean: | ||
@echo "== Cleaning..." | ||
@rm -rf $(DIST_DIR) | ||
@rm -rf $(HELM_REPO) | ||
@echo "== Cleaning Finished" | ||
|
||
# Generate full yaml | ||
full-yaml: | ||
@echo "== Generating full yaml for $(VERSION)" | ||
@helm template hub-agent hub-agent > $(DIST_DIR)/yaml/$(VERSION).yaml | ||
|
||
install: global-requirements $(DIST_DIR) | ||
@helm install hub-agent $(CHART_DIR) | ||
|
||
uninstall: global-requirements $(DIST_DIR) | ||
@helm uninstall hub-agent $(CHART_DIR) | ||
clean | ||
|
||
global-requirements: | ||
@echo "== Checking global requirements..." | ||
ifeq ($(LINT_USE_DOCKER),true) | ||
@command -v docker >/dev/null || ( echo "ERROR: Docker binary not found. Exiting." && exit 1) | ||
@docker info >/dev/null || ( echo "ERROR: command "docker info" is in error. Exiting." && exit 1) | ||
else | ||
@command -v helm >/dev/null || ( echo "ERROR: Helm binary not found. Exiting." && exit 1) | ||
@command -v git >/dev/null || ( echo "ERROR: git binary not found. Exiting." && exit 1) | ||
@echo "== Global requirements are met." | ||
endif | ||
|
||
lint-requirements: global-requirements | ||
@echo "== Checking requirements for linting..." | ||
ifeq ($(LINT_USE_DOCKER),true) | ||
@command -v docker >/dev/null || ( echo "ERROR: Docker binary not found. Exiting." && exit 1) | ||
@docker info >/dev/null || ( echo "ERROR: command "docker info" is in error. Exiting." && exit 1) | ||
else | ||
@command -v ct >/dev/null || ( echo "ERROR: ct binary not found. Exiting." && exit 1) | ||
@command -v yamale >/dev/null || ( echo "ERROR: yamale binary not found. Exiting." && exit 1) | ||
@command -v yamllint >/dev/null || ( echo "ERROR: yamllint binary not found. Exiting." && exit 1) | ||
@command -v kubectl >/dev/null || ( echo "ERROR: kubectl binary not found. Exiting." && exit 1) | ||
endif | ||
@echo "== Requirements for linting are met." | ||
|
||
################################## Technical targets | ||
$(DIST_DIR): | ||
@mkdir -p $(DIST_DIR)/yaml | ||
|
||
$(HELM_REPO): | ||
@mkdir -p $(HELM_REPO) | ||
|
||
helm-unittest: global-requirements | ||
@echo "== Checking that plugin helm-unittest is available..." | ||
@helm plugin list 2>/dev/null | grep unittest >/dev/null || helm plugin install https://github.com/quintush/helm-unittest --version v0.2.7 --debug | ||
@echo "== plugin helm-unittest is ready" | ||
|
||
.PHONY: all global-requirements lint-requirements helm-unittest lint build package clean full-yaml | ||
lint: | ||
docker run ${DOCKER_ARGS} --env GIT_SAFE_DIR="true" --entrypoint /bin/sh --rm -v $(CURDIR):/charts -w /charts quay.io/helmpack/chart-testing:v3.7.1 /charts/hack/lint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
CT_ARGS="" | ||
GIT_SAFE_DIR="false" | ||
|
||
if [ "$GIT_SAFE_DIR" != "true" ]; then | ||
git config --global --add safe.directory /charts | ||
fi | ||
|
||
CT_ARGS="--charts ${PWD}/charts" | ||
|
||
ct lint --config=./.github/chart-testing.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
/usr/bin/helm unittest --helm3 --color ./hub-agent; |
Oops, something went wrong.