Skip to content

Commit a9f1c14

Browse files
authored
ci: create helm dedicated workflow (#1169)
create a dedicated github action for helm operation
1 parent 3b26854 commit a9f1c14

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

.github/configs/ct-lint.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
remote: origin
2+
target-branch: main
3+
chart-dirs:
4+
- "deployments/helm"
5+
helm-extra-args: "--timeout 600s"
6+
validate-chart-schema: true
7+
validate-chart-values: true
8+
validate-maintainers: false
9+
check-version-increment: true
10+
validate-yaml: true
11+
exclude-deprecated: true

.github/configs/lintconf.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
rules:
3+
braces:
4+
min-spaces-inside: 0
5+
max-spaces-inside: 0
6+
min-spaces-inside-empty: -1
7+
max-spaces-inside-empty: -1
8+
brackets:
9+
min-spaces-inside: 0
10+
max-spaces-inside: 0
11+
min-spaces-inside-empty: -1
12+
max-spaces-inside-empty: -1
13+
colons:
14+
max-spaces-before: 0
15+
max-spaces-after: 1
16+
commas:
17+
max-spaces-before: 0
18+
min-spaces-after: 1
19+
max-spaces-after: 1
20+
document-end: disable
21+
document-start: disable # No --- to start a file
22+
hyphens:
23+
max-spaces-after: 1
24+
indentation:
25+
spaces: consistent
26+
indent-sequences: whatever # - list indentation will handle both indentation and without
27+
check-multi-line-strings: false
28+
key-duplicates: enable
29+
line-length: disable # Lines can be any length
30+
new-line-at-end-of-file: enable
31+
new-lines:
32+
type: unix
33+
trailing-spaces: enable
34+
truthy:
35+
level: warning

.github/workflows/helm.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: 'helm'
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [opened, synchronize, closed]
8+
paths:
9+
- 'deployments/helm/**'
10+
11+
permissions:
12+
id-token: write
13+
packages: write
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
run:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: "checkout"
24+
uses: actions/checkout@v6
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Set up Helm
29+
uses: azure/setup-helm@v4
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
34+
- name: Set up chart-testing
35+
uses: helm/[email protected]
36+
37+
- name: Run chart-testing
38+
run: |
39+
ct lint --debug --all --config ./.github/configs/ct-lint.yaml \
40+
--lint-conf ./.github/configs/lintconf.yaml \
41+
--target-branch ${{ github.event.pull_request.base.ref }}
42+
43+
- name: Run kubeconform
44+
run: |
45+
helm plugin install https://github.com/melmorabity/helm-kubeconform
46+
helm kubeconform chart --verbose --summary --strict --exit-on-error
47+
48+
- name: release
49+
if: github.event.pull_request.merged == true
50+
env:
51+
REPOSITORY_OWNER: ${{ github.repository_owner }}
52+
run: |
53+
REPO_NAME=$(echo "${GITHUB_REPOSITORY}" | cut -d'/' -f2)
54+
CHART_NAME="$(grep -e "^name:" deployments/helm/gpud/Chart.yaml | awk '{print $2}')"
55+
CHART_VERSION="$(grep -e "^version:" deployments/helm/gpud/Chart.yaml | awk '{print $2}')"
56+
echo '${{ secrets.GITHUB_TOKEN }}' | helm registry login -u '${{ github.actor }}' --password-stdin 'ghcr.io'
57+
helm package deployments/helm/gpud
58+
echo "Pushing helm chart ${CHART_NAME}-${CHART_VERSION}.tgz to oci://ghcr.io/${REPOSITORY_OWNER}"
59+
helm push "${CHART_NAME}-${CHART_VERSION}.tgz" "oci://ghcr.io/chart/${REPOSITORY_OWNER}"

deployments/helm/gpud/Chart.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ description: GPUd Helm chart for Kubernetes
44
type: application
55
version: 0.8.0
66
appVersion: "v0.8.0"
7+
icon: https://assets.nvidiagrid.net/ngc/logos/Infrastructure.png

0 commit comments

Comments
 (0)