-
Notifications
You must be signed in to change notification settings - Fork 331
110 lines (98 loc) · 3.5 KB
/
run-testing.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
name: "Test charts"
on:
push:
paths-ignore:
- 'packages/**'
- 'index.yaml'
- '**.md'
branches:
- master
pull_request:
paths-ignore:
- 'packages/**'
- 'index.yaml'
- '**.md'
branches:
- master
env:
HELM_VERSION: 3.15.1
jobs:
get-changed-charts:
name: Get changed charts
runs-on: ubuntu-22.04
outputs:
charts: ${{ steps.charts-diff.outputs.charts }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run changed-files with dir_names
id: changed-charts
uses: tj-actions/changed-files@v44
with:
files: |
charts/**
# This steps gets output of changes-charts step and filters out only chart names
# changed-charts output is space-separated list of changed paths
# this bash pipeline extracts unique chart names from the list
- name: Build charts diff
id: charts-diff
run: |
charts=$(echo "${{ steps.changed-charts.outputs.all_modified_files }}" | sed 's/ /\n/g' | grep -v 'common' | awk -F/ '{print $2}' | sort | uniq | jq -ncR '[inputs]')
echo "charts=$charts" >> $GITHUB_OUTPUT
install-chart:
name: Install chart
runs-on: ubuntu-22.04
needs: get-changed-charts
if: ${{ needs.get-changed-charts.outputs.charts != '[""]' }}
strategy:
matrix:
chart: ${{ fromJSON(needs.get-changed-charts.outputs.charts) }}
k8s_version: ["v1.28.9", "v1.29.4", "v1.30.2"]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Kubernetes tools
uses: yokawasa/[email protected]
with:
setup-tools: |
helmv3
kubectl
helm: "${{ env.HELM_VERSION }}"
kubectl: "${{ matrix.k8s_version }}"
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up chart-testing
uses: helm/[email protected]
- name: Create Kind cluster
uses: helm/kind-action@v1
with:
node_image: kindest/node:${{ matrix.k8s_version }}
kubectl_version: ${{ matrix.k8s_version }}
- name: Remove node taints
run: |
kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true
- name: Run chart-testing (install)
env:
LICENSE_KEY: ${{ secrets.ENTERPRISE_COMPONENTS_LICENSE_KEY }}
run: |
kubectl create namespace ${{ matrix.chart }}-testing
kubectl create secret -n=${{ matrix.chart }}-testing generic license --from-literal=key=$LICENSE_KEY
helm dep update charts/${{ matrix.chart }}
# Skip run for k8s stack chart as it fails CRD check
if [ "${{ matrix.chart }}" != "victoria-metrics-k8s-stack" ] && [ "${{ matrix.chart }}" != "victoria-metrics-distributed" ]; then
helm template charts/${{ matrix.chart }} \
--namespace ${{ matrix.chart }}-testing \
--values ./hack/helm/${{ matrix.chart }}/e2e/simple.yaml \
--validate | kubectl apply -f - --dry-run=server
fi
ct install \
--namespace ${{ matrix.chart }}-testing \
--config .github/ci/ct.yaml \
--charts "charts/${{ matrix.chart }}" \
--helm-extra-set-args "--values ./hack/helm/${{ matrix.chart }}/e2e/simple.yaml" --skip-clean-up