-
Notifications
You must be signed in to change notification settings - Fork 528
[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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
- 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
image: | ||
repository: kuberay/operator | ||
tag: local | ||
pullPolicy: Never |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
image: | ||
repository: rayproject/ray | ||
tag: 2.41.0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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
andrelease-*
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.There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?