Skip to content

Commit cbde878

Browse files
authored
[CI][HELM] Use chart-testing to install Helm charts (#3412)
1 parent ed7f3db commit cbde878

File tree

8 files changed

+211
-94
lines changed

8 files changed

+211
-94
lines changed

.github/workflows/helm-lint.yaml

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

.github/workflows/helm.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Helm
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release-*
8+
pull_request:
9+
branches:
10+
- master
11+
- release-*
12+
13+
env:
14+
CHART_DIR: helm-chart
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
lint-test:
22+
name: Lint and Test
23+
24+
runs-on: ubuntu-24.04
25+
26+
strategy:
27+
matrix:
28+
chart:
29+
- kuberay-operator
30+
- kuberay-apiserver
31+
- ray-cluster
32+
33+
steps:
34+
- name: Determine branch name
35+
id: get_branch
36+
run: |
37+
BRANCH=""
38+
if [ "${{ github.event_name }}" == "push" ]; then
39+
BRANCH=${{ github.ref_name }}
40+
elif [ "${{ github.event_name }}" == "pull_request" ]; then
41+
BRANCH=${{ github.base_ref }}
42+
fi
43+
echo "BRANCH=$BRANCH" >> "$GITHUB_OUTPUT"
44+
45+
- name: Checkout Code
46+
uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Set up Helm
51+
uses: azure/[email protected]
52+
with:
53+
version: v3.17.3
54+
55+
- uses: actions/[email protected]
56+
with:
57+
python-version: 3.13
58+
59+
- name: Set up chart-testing
60+
uses: helm/[email protected]
61+
62+
- name: Run chart-testing (list-changed)
63+
id: list-changed
64+
env:
65+
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
66+
run: |
67+
changed=$(ct list-changed --target-branch $BRANCH --chart-dirs ${{ env.CHART_DIR }} | grep ${{ matrix.chart }})
68+
if [[ -n "$changed" ]]; then
69+
echo "changed=true" >> "$GITHUB_OUTPUT"
70+
fi
71+
72+
- name: Install Helm unittest plugin
73+
if: steps.list-changed.outputs.changed == 'true'
74+
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version 0.8.1
75+
76+
- name: Run Helm unittest
77+
if: steps.list-changed.outputs.changed == 'true'
78+
run: helm unittest ${{ env.CHART_DIR }}/${{ matrix.chart }} --file "tests/**/*_test.yaml" --strict --debug
79+
80+
- name: Run chart-testing (lint)
81+
if: steps.list-changed.outputs.changed == 'true'
82+
env:
83+
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
84+
run: |
85+
# Run 'helm lint', version checking, YAML schema validation on 'Chart.yaml',
86+
# YAML linting on 'Chart.yaml' and 'values.yaml', and maintainer.
87+
# [Doc]: https://github.com/helm/chart-testing/blob/main/doc/ct_lint.md
88+
ct lint --charts ${{ env.CHART_DIR }}/${{ matrix.chart }} --validate-maintainers=false
89+
90+
- name: Create kind cluster
91+
if: steps.list-changed.outputs.changed == 'true'
92+
uses: helm/[email protected]
93+
with:
94+
cluster_name: kind
95+
96+
- name: Build Docker image (kuberay-operator)
97+
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-operator'
98+
run: |
99+
cd ray-operator && make docker-image -e IMG=kuberay/operator:local
100+
101+
- name: Build Docker image (kuberay-apiserver)
102+
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-apiserver'
103+
run: |
104+
cd apiserver && make docker-image -e IMG=kuberay/apiserver:local
105+
106+
- name: Build Docker image (security-proxy)
107+
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-apiserver'
108+
run: |
109+
cd experimental && make docker-image -e IMG=kuberay/security-proxy:local
110+
111+
- name: Load image to kind cluster (kuberay-operator)
112+
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-operator'
113+
run: |
114+
kind load docker-image kuberay/operator:local
115+
116+
- name: Load image to kind cluster (kuberay-apiserver)
117+
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-apiserver'
118+
run: |
119+
kind load docker-image kuberay/apiserver:local
120+
121+
- name: Load image to kind cluster (security-proxy)
122+
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-apiserver'
123+
run: |
124+
kind load docker-image kuberay/security-proxy:local
125+
126+
- name: Install Custom Resource Definitions to kind cluster
127+
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'ray-cluster'
128+
working-directory: helm-chart/kuberay-operator
129+
run: kubectl create -f crds
130+
131+
- name: Run chart-testing
132+
if: steps.list-changed.outputs.changed == 'true'
133+
env:
134+
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
135+
run: |
136+
# Run 'helm install', 'helm test', and optionally 'helm upgrade' on specified charts.
137+
# [Doc]: https://github.com/helm/chart-testing/blob/main/doc/ct_install.md
138+
ct install --charts ${{ env.CHART_DIR}}/${{ matrix.chart }}
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Patterns to ignore when building packages.
22
# This supports shell glob matching, relative path matching, and
33
# negation (prefixed with !). Only one pattern per line.
4-
.DS_Store
4+
5+
ci/
6+
.helmignore
7+
58
# Common VCS dirs
69
.git/
710
.gitignore
@@ -10,14 +13,27 @@
1013
.hg/
1114
.hgignore
1215
.svn/
16+
1317
# Common backup files
1418
*.swp
1519
*.bak
1620
*.tmp
1721
*.orig
1822
*~
23+
1924
# Various IDEs
25+
*.tmproj
2026
.project
2127
.idea/
22-
*.tmproj
2328
.vscode/
29+
30+
# helm-unittest
31+
tests
32+
.debug
33+
__snapshot__
34+
35+
# helm-docs
36+
README.md.gotmpl
37+
38+
# MacOS
39+
.DS_Store
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
image:
2+
repository: kuberay/apiserver
3+
tag: local
4+
pullPolicy: Never
5+
6+
security:
7+
proxy:
8+
repository: kuberay/security-proxy
9+
tag: local
10+
pullPolicy: Never
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Patterns to ignore when building packages.
22
# This supports shell glob matching, relative path matching, and
33
# negation (prefixed with !). Only one pattern per line.
4-
.DS_Store
4+
5+
ci/
6+
.helmignore
7+
58
# Common VCS dirs
69
.git/
710
.gitignore
@@ -10,13 +13,27 @@
1013
.hg/
1114
.hgignore
1215
.svn/
16+
1317
# Common backup files
1418
*.swp
1519
*.bak
1620
*.tmp
21+
*.orig
1722
*~
23+
1824
# Various IDEs
25+
*.tmproj
1926
.project
2027
.idea/
21-
*.tmproj
2228
.vscode/
29+
30+
# helm-unittest
31+
tests
32+
.debug
33+
__snapshot__
34+
35+
# helm-docs
36+
README.md.gotmpl
37+
38+
# MacOS
39+
.DS_Store
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
image:
2+
repository: kuberay/operator
3+
tag: local
4+
pullPolicy: Never

helm-chart/ray-cluster/.helmignore

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Patterns to ignore when building packages.
22
# This supports shell glob matching, relative path matching, and
33
# negation (prefixed with !). Only one pattern per line.
4-
.DS_Store
4+
5+
ci/
6+
.helmignore
7+
58
# Common VCS dirs
69
.git/
710
.gitignore
@@ -10,13 +13,27 @@
1013
.hg/
1114
.hgignore
1215
.svn/
16+
1317
# Common backup files
1418
*.swp
1519
*.bak
1620
*.tmp
21+
*.orig
1722
*~
23+
1824
# Various IDEs
25+
*.tmproj
1926
.project
2027
.idea/
21-
*.tmproj
2228
.vscode/
29+
30+
# helm-unittest
31+
tests
32+
.debug
33+
__snapshot__
34+
35+
# helm-docs
36+
README.md.gotmpl
37+
38+
# MacOS
39+
.DS_Store
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
image:
2+
repository: rayproject/ray
3+
tag: 2.41.0

0 commit comments

Comments
 (0)