Skip to content

Commit 15974a2

Browse files
authored
feat: Add chart (#1)
* feat: Add chart * ci: Bump chart-testing-action version * ci: Satisfy linter * ci: Satisfy linter * ci: Satisfy linter * fix: Fix templates * fix: Fix templates * ci: Modify values * fix: Fix priorityClass * ci: Increase version * ci: Increase versions * feat: Add schedule timezones, documentation * feat: Add schedule timezones, documentation * feat: Add schedule timezones, documentation * ci: Satify ci * ci: Satify ci * feat: Modifications * chore(repo): Sync repository template * chore(repo): Sync repository template * ci(workflows): Use mise instead of asdf * docs: Update README * feat(chart): Add restrictive security context to containers * fix(chart): Pin overprovisioning pause image version * fix(chart): Update pause image version * feat(chart): Add default labeling * feat(keeper): Disable replicas when schedule is enabled * feat(keeper): Use placeholders instead of map * feat(keeper): Use placeholders instead of map * feat(keeper): Add labels * feat(keeper): Use placeholders instead of map * docs(keeper): Update README * feat(keeper): Adjust priorityClass values * feat(keeper): Use official kubectl image * ci: Update mise setup * feat(keeper): Disable priorityclass creation if override provided
1 parent 2d3ddc4 commit 15974a2

42 files changed

Lines changed: 1549 additions & 212 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Cache Warmup
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main # caches from the main branch are shared with all other branches and pull requests
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
# renovate: datasource=github-releases depName=jdx/mise
14+
MISE_VERSION: 2025.10.10
15+
16+
jobs:
17+
pre-commit:
18+
runs-on: ubuntu-24.04
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
22+
with:
23+
persist-credentials: false
24+
25+
- name: Setup Mise
26+
uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
27+
with:
28+
version: ${{ env.MISE_VERSION }}
29+
30+
- name: Cache pre-commit
31+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
32+
with:
33+
path: ~/.cache/pre-commit
34+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}-warmup
35+
restore-keys: ${{ runner.os }}-pre-commit-
36+
37+
- name: Run pre-commit
38+
run: pre-commit install --install-hooks
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for GH API calls quota

.github/workflows/cleanup.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Cleanup
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [closed]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
metadata-collector:
13+
uses: ./.github/workflows/metadata-collector.yaml
14+
15+
packages:
16+
runs-on: ubuntu-24.04
17+
permissions:
18+
contents: read
19+
packages: write
20+
needs: metadata-collector
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
chart: ${{ fromJSON(needs.metadata-collector.outputs.charts) }}
25+
steps:
26+
- name: GitHub Slug Action
27+
uses: rlespinasse/github-slug-action@955b5ba4560860f8a633bd24190941f16016e42c # v5.1.0
28+
29+
- name: Cleanup Helm chart
30+
run: |
31+
gh api \
32+
--method DELETE \
33+
-H "Accept: application/vnd.github+json" \
34+
-H "X-GitHub-Api-Version: 2022-11-28" \
35+
/orgs/${{ github.repository_owner }}/packages/container/${PACKAGE_NAME} || true
36+
env:
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
PACKAGE_NAME: ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}%2F${{ env.GITHUB_EVENT_REF_SLUG_URL || env.GITHUB_HEAD_REF_SLUG_URL }}%2F${{ matrix.chart }}

.github/workflows/helm-lint-test.yaml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/helm-release.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Metadata collector
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
charts:
7+
description: "List of changed charts within the repository"
8+
value: ${{ jobs.chart-list.outputs.charts }}
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
chart-list:
15+
runs-on: ubuntu-24.04
16+
outputs:
17+
charts: ${{ steps.changed-charts.outputs.all_changed_files || steps.changed-charts-tag.outputs.all_changed_files }}
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 # pragma: allowlist secret
21+
with:
22+
persist-credentials: true # needed for private repositories
23+
24+
- name: Get changed charts without tag
25+
uses: step-security/changed-files@95b56dadb92a30ca9036f16423fd3c088a71ee94 # v46.0.5
26+
id: changed-charts
27+
if: github.ref_type != 'tag'
28+
with:
29+
dir_names: true
30+
dir_names_max_depth: 1
31+
path: charts
32+
matrix: true
33+
34+
- name: Get changed chart using tag
35+
if: github.ref_type == 'tag'
36+
id: changed-charts-tag
37+
run: |
38+
# Extract tag name which triggered this workflow: refs/tags/my-chart-1.2.3 -> my-chart-1.2.3
39+
TAG_REF="${GITHUB_REF#refs/tags/}"
40+
# Extract chart name from tag name by removing the version part: my-chart-1.2.3 -> my-chart
41+
CHART_NAME="${TAG_REF%%-[0-9]*}"
42+
echo "all_changed_files=[\"${CHART_NAME}\"]" >> $GITHUB_OUTPUT
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: Pull Request
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
paths:
9+
- charts/**
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: pull-request-${GITHUB_REF}
16+
cancel-in-progress: false
17+
18+
env:
19+
# renovate: datasource=github-releases depName=jdx/mise
20+
MISE_VERSION: 2025.10.10
21+
# renovate: datasource=github-releases depName=helm/helm
22+
HELM_VERSION: v3.18.6
23+
# renovate: datasource=github-tags depName=python/cpython
24+
PYTHON_VERSION: v3.13.7
25+
# renovate: datasource=github-releases depName=helm/chart-testing-action
26+
CHART_TESTING_VERSION: v3.13.0
27+
# renovate: datasource=github-releases depName=adrienverge/yamllint
28+
CHART_TESTING_YAMLLINT_VERSION: v1.37.1
29+
# renovate: datasource=github-releases depName=23andMe/Yamale
30+
CHART_TESTING_YAMALE_VERSION: 6.0.0
31+
32+
jobs:
33+
metadata-collector:
34+
uses: ./.github/workflows/metadata-collector.yaml
35+
36+
version-check:
37+
uses: ./.github/workflows/version-check.yaml
38+
39+
pre-commit:
40+
runs-on: ubuntu-24.04
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
44+
with:
45+
persist-credentials: false
46+
47+
- name: Setup Mise
48+
uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
49+
with:
50+
version: ${{ env.MISE_VERSION }}
51+
52+
- name: Cache pre-commit
53+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
54+
with:
55+
path: ~/.cache/pre-commit
56+
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
57+
restore-keys: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}-
58+
59+
- name: Run pre-commit
60+
run: pre-commit run --show-diff-on-failure --color=always --all-files
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for GH API calls quota
63+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for zizmor
64+
65+
artifacthub-lint:
66+
runs-on: ubuntu-24.04
67+
container:
68+
image: docker.io/artifacthub/ah:v1.21.0 # referencing version via env variable not supported in GHA
69+
options: --user=root
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
73+
with:
74+
persist-credentials: false
75+
76+
- name: Run Artifact Hub lint
77+
working-directory: ./charts/
78+
run: ah lint
79+
80+
chart-testing:
81+
runs-on: ubuntu-24.04
82+
needs: [pre-commit, artifacthub-lint, metadata-collector, version-check]
83+
strategy:
84+
fail-fast: false
85+
matrix:
86+
chart: ${{ fromJSON(needs.metadata-collector.outputs.charts) }}
87+
steps:
88+
- name: Checkout
89+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
90+
with:
91+
persist-credentials: false
92+
93+
- name: Set up Helm
94+
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
95+
with:
96+
version: ${{ env.HELM_VERSION }}
97+
98+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
99+
with:
100+
python-version: ${{ env.PYTHON_VERSION }}
101+
102+
- name: Set up chart-testing
103+
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0
104+
with:
105+
version: ${{ env.CHART_TESTING_VERSION }}
106+
yamllint_version: ${{ env.CHART_TESTING_YAMLLINT_VERSION }}
107+
yamale_version: ${{ env.CHART_TESTING_YAMALE_VERSION }}
108+
109+
- name: Build Helm dependencies
110+
# Build Helm chart dependencies locally to support both chart-testing lint and install operations.
111+
# This allows using the --skip-helm-dependencies flag with chart-testing commands, eliminating the need for separate repository configurations during testing.
112+
run: scripts/helm-dependency-build.sh $CHART_NAME
113+
env:
114+
CHART_NAME: ${{ matrix.chart }}
115+
116+
- name: Run chart-testing (lint)
117+
# zizmor:ignore-template-injection
118+
run: ct lint --target-branch main --validate-maintainers=false --check-version-increment=false --lint-conf .yamllint.yaml --charts charts/${CHART_NAME}
119+
env:
120+
CHART_NAME: ${{ matrix.chart }}
121+
122+
- name: Determine chart type
123+
id: chart-type
124+
run: echo "type=$(yq -r '.type' charts/${CHART_NAME}/Chart.yaml)" >> $GITHUB_OUTPUT
125+
env:
126+
CHART_NAME: ${{ matrix.chart }}
127+
128+
- name: Create kind cluster
129+
if: ${{ steps.chart-type.outputs.type == 'application' }} # Only run installation tests for application charts, skip library charts
130+
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
131+
132+
# FIXME config: Place custom steps to install CRDs or other dependencies here
133+
134+
- name: Run chart-testing (install)
135+
if: ${{ steps.chart-type.outputs.type == 'application' }} # Only run installation tests for application charts, skip library charts
136+
# zizmor:ignore-template-injection
137+
run: ct install --target-branch main --charts charts/${CHART_NAME}
138+
env:
139+
CHART_NAME: ${{ matrix.chart }}
140+
141+
release:
142+
runs-on: ubuntu-24.04
143+
permissions:
144+
contents: read
145+
packages: write
146+
needs: [chart-testing, metadata-collector, version-check]
147+
strategy:
148+
fail-fast: false
149+
matrix:
150+
chart: ${{ fromJSON(needs.metadata-collector.outputs.charts) }}
151+
steps:
152+
- name: Checkout
153+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
154+
with:
155+
persist-credentials: false
156+
157+
- name: Set up Helm
158+
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
159+
with:
160+
version: ${{ env.HELM_VERSION }}
161+
162+
- name: GitHub Slug Action
163+
uses: rlespinasse/github-slug-action@955b5ba4560860f8a633bd24190941f16016e42c # v5.1.0
164+
165+
- name: Build Helm dependencies
166+
# Build Helm chart dependencies locally to support both chart-testing lint and install operations.
167+
# This allows using the --skip-helm-dependencies flag with chart-testing commands, eliminating the need for separate repository configurations during testing.
168+
run: scripts/helm-dependency-build.sh $CHART_NAME
169+
env:
170+
CHART_NAME: ${{ matrix.chart }}
171+
172+
- name: Publish Helm chart
173+
# FIXME config: Add dependency repositories
174+
run: |
175+
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${GITHUB_ACTOR} --password-stdin
176+
177+
helm package charts/${CHART_NAME}
178+
helm push "$(realpath ${CHART_NAME}-*.tgz)" oci://ghcr.io/${REPOSITORY_NAME}
179+
180+
helm registry logout ghcr.io
181+
env:
182+
REPOSITORY_NAME: ${{ github.repository }}/${{ env.GITHUB_EVENT_REF_SLUG || env.GITHUB_HEAD_REF_SLUG }}
183+
CHART_NAME: ${{ matrix.chart }}

0 commit comments

Comments
 (0)