-
Notifications
You must be signed in to change notification settings - Fork 36
153 lines (132 loc) · 4.13 KB
/
helm-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Lint/Test Helm charts
on:
pull_request:
branches: [ "main" ]
paths:
- 'charts/**'
jobs:
find_directories:
name: Find changed helm charts
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.find_directories.outputs.build_matrix }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Check out the coredb repo to reuse some actions
uses: actions/checkout@v3
with:
repository: tembo-io/tembo
path: ./.tembo
ref: 84664df742ce9774a3029e08111940f9f1fb345e
- name: Find directories with Chart.yaml that changed
id: find_directories
uses: ./.tembo/.github/actions/find-changed-directories
with:
contains_the_file: Chart.yaml
changed_relative_to_branch: ${{ github.base_ref || 'not-a-branch' }}
ignore_dirs: ".tembo"
# We can check versions using ct, but there is a bug checking 1 chart. So lets
# just do it this way for now.
# https://github.com/helm/chart-testing/pull/594
check_version:
name: Check Helm chart version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: 'code'
- name: Fetch main branch
run: |
cd code
git fetch origin main:main
- name: Check chart version
run: |
cd code
CURR_VERSION=$(cat charts/tembo-operator/Chart.yaml | grep version: | cut -d ' ' -f 2)
MAIN_VERSION=$(git show main:charts/tembo-operator/Chart.yaml | grep version: | cut -d ' ' -f 2)
echo -n "Current version: ${CURR_VERSION}"
echo -n "Previous version: ${MAIN_VERSION}"
if [ "$CURR_VERSION" = "$MAIN_VERSION" ]; then
echo "Helm chart version needs to be bumped!"
exit 1
fi
lint:
name: Lint charts
runs-on: ubuntu-latest
needs:
- find_directories
- check_version
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_directories.outputs.directories) }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Helm lint
run: helm lint ${{ matrix.path }}
lint-ct:
name: Lint using chart-testing
runs-on: ubuntu-latest
needs:
- find_directories
- check_version
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@v4 #
with:
python-version: 3.x
- name: Set up Helm
uses: azure/[email protected]
with:
version: 3.13.2
- name: Set up chart-testing
uses: helm/[email protected]
- name: Install just
uses: extractions/setup-just@v1
- run: just helm-repo
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch main)
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing linter
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --config ct.yaml
test:
name: Test using chart-testing
runs-on: ubuntu-latest
needs: lint-ct
# if: needs.lint-ct.outputs.changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: 3.13.2
- name: Set up chart-testing
uses: helm/[email protected]
- uses: extractions/setup-just@v1
- run: just helm-repo
- name: Install kind cluster
uses: helm/[email protected]
with:
install_only: true
- name: Start kind cluster
run: just start-kind
- name: Run helm chart tests
run: ct install --config ct.yaml