Skip to content

Commit

Permalink
ci: tweak release ci & env support (#3)
Browse files Browse the repository at this point in the history
* ci: tweak release ci & env support

* ci: install unittest plugin
  • Loading branch information
corite committed Dec 29, 2023
1 parent 21b4ede commit b491742
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 10 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
name: Build & Test Chart
on: [push, workflow_dispatch, pull_request]

on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: azure/setup-helm@v3
- name: install unittest plugin
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git
- uses: helm/kind-action@v1.8.0
- name: template
- name: unit tests
run: |
helm unittest .
- name: template tests
run: |
for file in test-values/*; do
echo "############## template $file ###############"
helm template --debug --validate gts-test . -f $file
echo "#############################################"
done
- name: install
- name: integration tests
run: |
for file in test-values/*; do
echo "############## install $file ################"
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
name: Release Charts
name: Release Chart

on:
push:
branches:
- main
tags:
- "*"

jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: check if on main branch
run: exit ${{ github.ref_name }} == "main"
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,3 @@ ingress:
hosts:
- your-domain.com
```

## TODO

- publish the chart
4 changes: 4 additions & 0 deletions templates/_environments.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ env:
- name: GTS_LETSENCRYPT_EMAIL_ADDRESS
value: {{ .Values.tls.email | quote }}
{{- end }}
{{- range $key, $value := .Values.env }}
- name: {{ $key | quote }}
value: {{ $value | quote }}
{{- end -}}
{{- end -}}
30 changes: 30 additions & 0 deletions tests/test-env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
suite: test correctness of environment
templates:
- templates/deployment.yaml
tests:
- it: default values
release:
name: gts
values:
- test-env.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: FOO
value: "bar"
- contains:
path: spec.template.spec.containers[0].env
content:
name: FOO_QUOT
value: "bar"
- contains:
path: spec.template.spec.containers[0].env
content:
name: FOO_NUM
value: "appserver"
- contains:
path: spec.template.spec.containers[0].env
content:
name: FOO_BOOL
value: "true"
8 changes: 8 additions & 0 deletions tests/values/test-env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
host: chart-example.local


env:
FOO_STR: bar
FOO_QUOT: "bar"
FOO_NUM: 42
FOO_BOOL: true
6 changes: 6 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ tls:
enabled: false
email: ""

# define arbitrary environment variables for the GoToSocial application
# this is especially useful if you want to leverage GoToSocial functionality
# that is not yet supported by "normal" chart values (please open an issue/PR if you'd like "real" support)
env:
# FOO: bar

image:
repository: superseriousbusiness/gotosocial
pullPolicy: IfNotPresent
Expand Down

0 comments on commit b491742

Please sign in to comment.