-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (131 loc) · 4.32 KB
/
chart-ci.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
154
155
156
name: Chart CI
on:
push:
branches:
- "dev"
tags:
- "v*.*.*"
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.14.4
- name: Add Helm repositories
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Setup Helm plugins
run: |
helm plugin install https://github.com/jtyr/kubeconform-helm
- name: Setup Polaris
run: |
mkdir -p .local/bin
curl -s https://api.github.com/repos/FairwindsOps/polaris/releases/latest | \
jq '.assets[] | select(.name=="polaris_linux_amd64.tar.gz")'.browser_download_url | \
xargs curl -s -L | \
tar xvz -C .local/bin polaris
echo "$PWD/.local/bin" >> $GITHUB_PATH
- uses: actions/setup-python@v5
with:
python-version: '3.x'
check-latest: true
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: |
ct lint --target-branch ${{ github.event.repository.default_branch }}
- name: Run chart-testing (kubeconform)
if: steps.list-changed.outputs.changed == 'true'
run: |
helm kubeconform ./charts/redcap --output json --kubernetes-version "1.24.0" --strict --summary
- name: Run chart-testing (polaris)
if: steps.list-changed.outputs.changed == 'true'
run: |
polaris audit \
--only-show-failed-tests \
--set-exit-code-below-score=80 \
--set-exit-code-on-danger=true \
--helm-chart ./charts/redcap \
--helm-values ./charts/redcap/tests/values.yaml \
--format=pretty \
--color=true
- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
generate-doc-schema:
needs: lint-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache chart dir
id: cache-dir
uses: actions/cache@v4
with:
path: charts
key: ${{ github.sha }}-redcap-chart
- name: Helm-docs
uses: losisin/[email protected]
with:
chart-search-root: ./charts/redcap
values-file : ./values.yaml
output-file: ./README.md
template-files: ./README.md.gotpl
sort-values-order: file
- name: Generate values schema json
uses: losisin/[email protected]
with:
input: ./charts/redcap/values.yaml
output: ./charts/redcap/values.schema.json
release:
needs: generate-doc-schema
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache chart dir
id: cache-dir
uses: actions/cache@v4
with:
path: charts
key: ${{ github.sha }}-redcap-chart
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Add Helm repositories
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
skip_existing: true