-
Notifications
You must be signed in to change notification settings - Fork 5
127 lines (119 loc) · 3.81 KB
/
compatibility.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
name: Helm PR Flow
on:
pull_request:
branches:
- main
jobs:
check_helm_versions:
name: Check Helm Versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.10.0
- id: files
uses: jitterbit/get-changed-files@v1
- name: prepate yq
run: |
curl https://github.com/mikefarah/yq/releases/download/`curl --silent "https://api.github.com/repos/mikefarah/yq/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")'`/yq_linux_amd64 -L -o yq
chmod 755 yq
- name: install helm plugins
run: |
helm plugin install https://github.com/sstarcher/helm-release
- name: bumper
run: |
case "${{ github.event.pull_request.title }}" in
fix:*)
RELEASE_TYPE=minor
;;
release:*)
RELEASE_TYPE=major
;;
*)
RELEASE_TYPE=patch
;;
esac
echo Release type is $RELEASE_TYPE
changed=""
reqsubstr="charts/"
for file in ${{ steps.files.outputs.all }}; do
if [ -z "${file##*$reqsubstr*}" ] ;
then
chartName=$(echo $file | awk -F "/" '{print $2}')
if [[ ! $changed =~ $chartName ]];
then
changed="$changed $chartName"
fi
fi
done
echo Changed Charts are: $changed
for chart in $changed; do
if git rev-parse "${chart}-$(yq '.version' charts/${chart}/Chart.yaml)" >/dev/null 2>&1;
then
echo "Release ${chart}-$(yq '.version' charts/${chart}/Chart.yaml) already exists"
echo "changing version on $RELEASE_TYPE"
helm release --bump=${RELEASE_TYPE} --source helm -s charts/${chart}
else
echo "Unique release number for this chart (${chart}), skipping"
fi
done
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
message: 'Commited new chart versions'
update_readme:
runs-on: ubuntu-latest
name: Readme Updater
needs: check_helm_versions
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Run helm-docs
run: |
GOBIN=$PWD GO111MODULE=on go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
./helm-docs --sort-values-order file
rm helm-docs
- name: Commit bump
uses: EndBug/add-and-commit@v7
with:
message: 'Regenerate chart README.md'
helmcheck:
runs-on: ubuntu-latest
name: Perform Helm Compatibility Checks
needs: update_readme
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Download Pluto
uses: FairwindsOps/pluto/github-action@master
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
- name: Add repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Add dependencies
run: |
set -E
for chart in $(ls -b charts/); do
helm dependency update charts/${chart}
done
- name: Check compatibility
run: |
set -E
for chart in $(ls -b charts/); do
helm template charts/${chart} | pluto detect --target-versions k8s=v1.16.0 -
done