Skip to content

[CI][HELM] Use chart-testing to install Helm charts #3412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions .github/workflows/helm-lint.yaml

This file was deleted.

138 changes: 138 additions & 0 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Helm

on:
push:
branches:
- master
- release-*
pull_request:
branches:
- master
- release-*

env:
CHART_DIR: helm-chart

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
cancel-in-progress: true

jobs:
lint-test:
name: Lint and Test

runs-on: ubuntu-24.04

strategy:
matrix:
chart:
- kuberay-operator
- kuberay-apiserver
- ray-cluster

steps:
- name: Determine branch name
id: get_branch
run: |
BRANCH=""
if [ "${{ github.event_name }}" == "push" ]; then
BRANCH=${{ github.ref_name }}
elif [ "${{ github.event_name }}" == "pull_request" ]; then
BRANCH=${{ github.base_ref }}
fi
echo "BRANCH=$BRANCH" >> "$GITHUB_OUTPUT"

- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.17.3

- uses: actions/[email protected]
with:
python-version: 3.13

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
env:
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
run: |
changed=$(ct list-changed --target-branch $BRANCH --chart-dirs ${{ env.CHART_DIR }} | grep ${{ matrix.chart }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Install Helm unittest plugin
if: steps.list-changed.outputs.changed == 'true'
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version 0.8.1

- name: Run Helm unittest
if: steps.list-changed.outputs.changed == 'true'
run: helm unittest ${{ env.CHART_DIR }}/${{ matrix.chart }} --file "tests/**/*_test.yaml" --strict --debug

- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
env:
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
run: |
# Run 'helm lint', version checking, YAML schema validation on 'Chart.yaml',
# YAML linting on 'Chart.yaml' and 'values.yaml', and maintainer.
# [Doc]: https://github.com/helm/chart-testing/blob/main/doc/ct_lint.md
ct lint --charts ${{ env.CHART_DIR }}/${{ matrix.chart }} --validate-maintainers=false

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]
with:
cluster_name: kind

- name: Build Docker image (kuberay-operator)
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-operator'
run: |
cd ray-operator && make docker-image -e IMG=kuberay/operator:local

- name: Build Docker image (kuberay-apiserver)
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-apiserver'
run: |
cd apiserver && make docker-image -e IMG=kuberay/apiserver:local

- name: Build Docker image (security-proxy)
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-apiserver'
run: |
cd experimental && make docker-image -e IMG=kuberay/security-proxy:local

- name: Load image to kind cluster (kuberay-operator)
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-operator'
run: |
kind load docker-image kuberay/operator:local

- name: Load image to kind cluster (kuberay-apiserver)
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-apiserver'
run: |
kind load docker-image kuberay/apiserver:local

- name: Load image to kind cluster (security-proxy)
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'kuberay-apiserver'
run: |
kind load docker-image kuberay/security-proxy:local
Comment on lines +96 to +124
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we want to test local build images or the production image on quay.io. This tool is used to test whether the Helm chart can be installed or not, right? So shouldn't we test the production image repo since most users won't build a KubeRay image themselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this workflow runs on both master and release-* branch, I am afraid that we cannot use the production image for all branches. For example, if there are possible breaking changes on the master branch in the future, it may fail the workflow triggered by release branch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @kevin85421 Do we only want to test production images or local build images? By the way, as far as I know, the CI config for GitHub Actions is branch-specific, meaning each branch relies on the config defined in that branch. So if the config in the master branch is changed, the release branch will not be affected unless we cherry-pick the changes into it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For per-commit CI tests, we should test the local build images. Testing with the production image is a one-off test and doesn't need to run per-commit. We can add a release test to cover it. Does this make sense to you?


- name: Install Custom Resource Definitions to kind cluster
if: steps.list-changed.outputs.changed == 'true' && matrix.chart == 'ray-cluster'
working-directory: helm-chart/kuberay-operator
run: kubectl create -f crds

- name: Run chart-testing
if: steps.list-changed.outputs.changed == 'true'
env:
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
run: |
# Run 'helm install', 'helm test', and optionally 'helm upgrade' on specified charts.
# [Doc]: https://github.com/helm/chart-testing/blob/main/doc/ct_install.md
ct install --charts ${{ env.CHART_DIR}}/${{ matrix.chart }}
20 changes: 18 additions & 2 deletions helm-chart/kuberay-apiserver/.helmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store

ci/
.helmignore

# Common VCS dirs
.git/
.gitignore
Expand All @@ -10,14 +13,27 @@
.hg/
.hgignore
.svn/

# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~

# Various IDEs
*.tmproj
.project
.idea/
*.tmproj
.vscode/

# helm-unittest
tests
.debug
__snapshot__

# helm-docs
README.md.gotmpl

# MacOS
.DS_Store
10 changes: 10 additions & 0 deletions helm-chart/kuberay-apiserver/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
image:
repository: kuberay/apiserver
tag: local
pullPolicy: Never

security:
proxy:
repository: kuberay/security-proxy
tag: local
pullPolicy: Never
21 changes: 19 additions & 2 deletions helm-chart/kuberay-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store

ci/
.helmignore

# Common VCS dirs
.git/
.gitignore
Expand All @@ -10,13 +13,27 @@
.hg/
.hgignore
.svn/

# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~

# Various IDEs
*.tmproj
.project
.idea/
*.tmproj
.vscode/

# helm-unittest
tests
.debug
__snapshot__

# helm-docs
README.md.gotmpl

# MacOS
.DS_Store
4 changes: 4 additions & 0 deletions helm-chart/kuberay-operator/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
image:
repository: kuberay/operator
tag: local
pullPolicy: Never
21 changes: 19 additions & 2 deletions helm-chart/ray-cluster/.helmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store

ci/
.helmignore

# Common VCS dirs
.git/
.gitignore
Expand All @@ -10,13 +13,27 @@
.hg/
.hgignore
.svn/

# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~

# Various IDEs
*.tmproj
.project
.idea/
*.tmproj
.vscode/

# helm-unittest
tests
.debug
__snapshot__

# helm-docs
README.md.gotmpl

# MacOS
.DS_Store
3 changes: 3 additions & 0 deletions helm-chart/ray-cluster/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
image:
repository: rayproject/ray
tag: 2.41.0
Loading