Skip to content

Commit 83766ff

Browse files
committed
Add GitHub action workflow for Helm chart lint and test
Signed-off-by: Yi Chen <[email protected]>
1 parent e92962c commit 83766ff

File tree

1 file changed

+63
-4
lines changed

1 file changed

+63
-4
lines changed

.github/workflows/ci.yml

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,84 @@
1616
# limitations under the License.
1717
################################################################################
1818

19-
2019
# We need to specify repo related information here since Apache INFRA doesn't differentiate
2120
# between several workflows with the same names while preparing a report for GHA usage
2221
# https://infra-reports.apache.org/#ghactions
2322
name: Flink Kubernetes Operator CI
23+
2424
on:
2525
push:
2626
branches:
2727
- main
2828
- release-*
2929
pull_request:
30+
3031
concurrency:
3132
group: ${{ github.workflow }}-${{ github.ref_name }}
3233
cancel-in-progress: true
3334

35+
env:
36+
HELM_CHART_DIR: helm
37+
FLINK_OPERATOR_CHART: flink-kubernetes-operator
38+
3439
jobs:
40+
helm_lint_test:
41+
runs-on: ubuntu-latest
42+
43+
name: Helm Lint Test
44+
45+
steps:
46+
- name: Determine branch name
47+
id: get_branch
48+
run: |
49+
BRANCH=""
50+
if [ "${{ github.event_name }}" == "push" ]; then
51+
BRANCH=${{ github.ref_name }}
52+
elif [ "${{ github.event_name }}" == "pull_request" ]; then
53+
BRANCH=${{ github.base_ref }}
54+
fi
55+
echo "BRANCH=$BRANCH" >> "$GITHUB_OUTPUT"
56+
57+
- name: Checkout source code
58+
uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Set up Helm
63+
uses: azure/[email protected]
64+
with:
65+
version: v3.17.3
66+
67+
- name: Install Helm unittest plugin
68+
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version 0.8.1
69+
70+
- name: Run Helm unittest
71+
run: helm unittest ${{ env.HELM_CHART_DIR }}/${{ env.FLINK_OPERATOR_CHART }} --file "tests/**/*_test.yaml" --strict --debug
72+
73+
- name: Set up chart-testing
74+
uses: helm/[email protected]
75+
76+
- name: Run chart-testing (list-changed)
77+
id: list-changed
78+
env:
79+
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
80+
run: |
81+
changed=$(ct list-changed --target-branch $BRANCH --chart-dirs ${{ env.HELM_CHART_DIR }})
82+
if [[ -n "$changed" ]]; then
83+
echo "changed=true" >> "$GITHUB_OUTPUT"
84+
fi
85+
86+
- name: Run Helm lint
87+
if: steps.list-changed.outputs.changed == 'true'
88+
run: |
89+
helm lint ${{ env.HELM_CHART_DIR }}/${{ env.FLINK_OPERATOR_CHART }} --strict --debug
90+
91+
- name: Run chart-testing (lint)
92+
if: steps.list-changed.outputs.changed == 'true'
93+
env:
94+
BRANCH: ${{ steps.get_branch.outputs.BRANCH }}
95+
run: ct lint --target-branch $BRANCH --chart-dirs ${{ env.HELM_CHART_DIR }} --check-version-increment=false --validate-maintainers=false
96+
3597
test_ci:
3698
runs-on: ubuntu-latest
3799
name: maven build
@@ -53,9 +115,6 @@ jobs:
53115
echo "Please generate the java doc via 'mvn clean install -DskipTests -Pgenerate-docs' again"
54116
exit 1
55117
fi
56-
- name: Validate helm chart linting
57-
run: |
58-
helm lint helm/flink-kubernetes-operator
59118
- name: Tests in flink-kubernetes-operator
60119
run: |
61120
cd flink-kubernetes-operator

0 commit comments

Comments
 (0)