Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
🐛 Fix subchart of demo chart not having correct version
Browse files Browse the repository at this point in the history
Also increases the Redis PVC size to prevent no space left errors :)
  • Loading branch information
TilBlechschmidt committed Jan 14, 2022
1 parent 5d45128 commit 2df9ee4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: 100M
storage: 500M
---
{{- end }}
apiVersion: v1
Expand Down
25 changes: 25 additions & 0 deletions docs/hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import shutil
import os

def on_pre_build(config):
# Make sure the chart version is set correctly
# This is necessary because the Helm package `--version` flag only changes the
# root chart version but not the subcharts. Thus we need to manually overwrite it!
print("Running pre-build hook!")
update_chart_version()

def on_post_build(*args, **kwargs):
site_dir = kwargs['config']['site_dir']

Expand Down Expand Up @@ -28,3 +35,21 @@ def copy_docker_compose(site_dir):
# Write the file out again
with open(dst_file, 'w') as file:
file.write(filedata)

def update_chart_version():
chart = "distribution/kubernetes/demo/charts/webgrid/Chart.yaml"

# Read in the file
with open(chart, 'r') as file :
filedata = file.read()

# Use the git ref in GitHub Actions
git_ref = os.getenv('GITHUB_REF')
if git_ref is not None and git_ref.startswith('refs/tags/'):
version = git_ref[10:]
filedata = filedata.replace('v0.0.0-tempversion', version)
print("Overwriting Helm subchart version with git tag '" + version + "'")

# Write the file out again
with open(chart, 'w') as file:
file.write(filedata)
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ plugins:
helm_repo_url: https://webgrid.dev/
- mkdocs-simple-hooks:
hooks:
on_pre_build: "docs.hooks:on_pre_build"
on_post_build: "docs.hooks:on_post_build"

extra_javascript:
Expand Down

0 comments on commit 2df9ee4

Please sign in to comment.