Repository navigation
240 lines (203 loc) · 10 KB
/
Copy pathchart-test.yaml
File metadata and controls
240 lines (203 loc) · 10 KB
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: Test Charts
# Controls when the workflow will run
on:
workflow_call:
inputs:
base-ref:
type: string
required: false
default: ''
base-sha:
type: string
required: false
default: ''
head-repository:
type: string
required: false
default: ''
head-sha:
type: string
required: false
default: ''
sync:
type: string
required: false
default: ''
concurrency:
group: fork-ci-charts-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/checkout-and-sync
with:
base-ref: ${{ inputs.base-ref }}
base-sha: ${{ inputs.base-sha }}
head-repository: ${{ inputs.head-repository }}
head-sha: ${{ inputs.head-sha }}
sync: ${{ inputs.sync }}
id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/workflows/**
- dev/charts/**
outputs:
source_changes: ${{ steps.filter.outputs.source_changes }}
lint-test:
needs: changes
if: needs.changes.outputs.source_changes == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- uses: ./.github/actions/checkout-and-sync
with:
base-ref: ${{ inputs.base-ref }}
base-sha: ${{ inputs.base-sha }}
head-repository: ${{ inputs.head-repository }}
head-sha: ${{ inputs.head-sha }}
sync: ${{ inputs.sync }}
id: checkout
- name: Set up Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310
- uses: actions/setup-python@v5.3.0
with:
python-version: '3.x'
check-latest: true
- name: Set up Cosign
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
- name: Set up chart-testing
run: |
set -euo pipefail
CT_VERSION=3.14.0
YAMLLINT_VERSION=1.33.0
YAMALE_VERSION=6.0.0
if [[ "$(uname -m)" == "aarch64" ]]; then
arch=arm64
else
arch=amd64
fi
cache_dir="${RUNNER_TOOL_CACHE}/ct/${CT_VERSION}/${arch}"
venv_dir="${cache_dir}/venv"
if [[ ! -d "${cache_dir}" ]]; then
mkdir -p "${cache_dir}"
archive="chart-testing_${CT_VERSION}_linux_${arch}.tar.gz"
release_url="https://github.com/helm/chart-testing/releases/download/v${CT_VERSION}"
curl --retry 5 --retry-delay 1 -sSLo ct.tar.gz "${release_url}/${archive}"
cosign verify-blob --certificate "${release_url}/${archive}.pem" --signature "${release_url}/${archive}.sig" \
--certificate-identity "https://github.com/helm/chart-testing/.github/workflows/release.yaml@refs/heads/main" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" ct.tar.gz
tar -xzf ct.tar.gz -C "${cache_dir}"
rm -f ct.tar.gz
python -m venv "${venv_dir}"
"${venv_dir}/bin/python" -m pip install --upgrade pip
"${venv_dir}/bin/python" -m pip install "yamllint==${YAMLLINT_VERSION}" "yamale==${YAMALE_VERSION}"
fi
echo "${cache_dir}" >> "${GITHUB_PATH}"
echo "CT_CONFIG_DIR=${cache_dir}/etc" >> "${GITHUB_ENV}"
echo "VIRTUAL_ENV=${venv_dir}" >> "${GITHUB_ENV}"
echo "${venv_dir}/bin" >> "${GITHUB_PATH}"
"${cache_dir}/ct" version
- name: List changed
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs=dev/charts --target-branch ${{ steps.checkout.outputs.base-ref }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Lint
if: steps.list-changed.outputs.changed == 'true'
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
ct lint --chart-dirs=dev/charts --chart-yaml-schema=dev/ci/chart_schema.yaml --lint-conf=dev/ci/lintconf.yaml --target-branch ${{ steps.checkout.outputs.base-ref }} --check-version-increment=false
- name: Set up helm-unittest
if: steps.list-changed.outputs.changed == 'true'
run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version v1.1.0 --verify=false
- name: Unit test Gravitino chart
if: steps.list-changed.outputs.changed == 'true'
run: helm unittest --with-subchart=false dev/charts/gravitino
- name: Unit test Gravitino Iceberg REST Server chart
if: steps.list-changed.outputs.changed == 'true'
run: helm unittest --with-subchart=false dev/charts/gravitino-iceberg-rest-server
- name: Unit test Gravitino Lance REST Server chart
if: steps.list-changed.outputs.changed == 'true'
run: helm unittest --with-subchart=false dev/charts/gravitino-lance-rest-server
- name: Set up kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: container-tools/kind-action@v2
with:
version: v0.27.0
cluster_name: helm-test-cluster
registry: true
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Extract Image Tag
id: get-tag
run: |
# Use yq to parse the value. Path typically follows .image.tag structure.
IMAGE_TAG=$(yq '.image.tag' dev/charts/gravitino/values.yaml)
# Remove any potential quotes and save to GitHub Outputs
echo "tag=$(echo $IMAGE_TAG | tr -d '\"')" >> "$GITHUB_ENV"
- name: Build the Docker image to local registry
if: steps.list-changed.outputs.changed == 'true'
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/hostedtoolcache/CodeQL
docker buildx use default
rm -rf ${{ github.workspace }}/README.md
rm -rf ${{ github.workspace }}/etc
rm -rf ${{ github.workspace }}/dev/charts/gravitino/Chart.lock
for t in gravitino:gravitino iceberg-rest-server:gravitino-iceberg-rest lance-rest-server:gravitino-lance-rest; do
(
REPO_NAME=${t#*:}
FOLDER_NAME=${t%:*}
CONTEXT_DIR="${{ github.workspace }}/dev/docker/${FOLDER_NAME}/"
. ${CONTEXT_DIR}/${FOLDER_NAME}-dependency.sh
docker build -t ${KIND_REGISTRY}/${REPO_NAME}:${tag} "${CONTEXT_DIR}"
docker push ${KIND_REGISTRY}/${REPO_NAME}:${tag}
)
done
- name: Set up kubectl
uses: azure/setup-kubectl@829323503d1be3d00ca8346e5391ca0b07a9ab0d
- name: Run chart-testing (install default,gravitino)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --charts dev/charts/gravitino --target-branch ${{ steps.checkout.outputs.base-ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino"
- name: Run chart-testing (install default,gravitino-iceberg-rest-server)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --charts dev/charts/gravitino-iceberg-rest-server --target-branch ${{ steps.checkout.outputs.base-ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino-iceberg-rest"
- name: Run chart-testing (install gravitino with mysql enable,replicas 2)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --charts=dev/charts/gravitino --helm-extra-set-args "--values dev/charts/gravitino/resources/scenarios/ci-values.yaml --set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino" --target-branch ${{ steps.checkout.outputs.base-ref }}
- name: Run chart-testing (install gravitino with postgresql enable)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --charts=dev/charts/gravitino --helm-extra-set-args "--values dev/charts/gravitino/resources/scenarios/pg-values.yaml --set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino" --target-branch ${{ steps.checkout.outputs.base-ref }}
- name: Run chart-testing (install default,gravitino-lance-rest-server)
if: steps.list-changed.outputs.changed == 'true'
run: |
helm install gravitino dev/charts/gravitino -n test --create-namespace --set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino --wait --timeout 5m
kubectl run -n test --rm -i --restart=Never --image=curlimages/curl:latest metalake-setup \
--command -- curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.gravitino.v1+json" \
-d '{"name":"lrs_test","comment":"Quick setup"}' \
http://gravitino.test:8090/api/metalakes
ct install --charts dev/charts/gravitino-lance-rest-server --target-branch ${{ steps.checkout.outputs.base-ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino-lance-rest --set lanceRest.gravitinoUri=http://gravitino.test:8090 --set lanceRest.gravitinoMetalake=lrs_test"