forked from chgl/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (118 loc) · 4.57 KB
/
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
name: Lint and Test Charts
on:
pull_request:
branches: [master]
permissions: read-all
jobs:
lint:
runs-on: ubuntu-22.04
container: ghcr.io/chgl/kube-powertools:v1.22.21@sha256:3e45248e0a88a26978341c7dc2b495020ad0cd75988ce19591f5d6f6d47685ac
steps:
- name: Add workspace as safe directory
run: |
git config --global --add safe.directory /__w/charts/charts
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- name: Check if documentation is up-to-date
run: |
generate-docs.sh
if git diff --exit-code HEAD; then
echo -e "\033[0;32mDocumentation up to date\033[0m ✔"
else
echo -e "\033[0;31mDocumentation outdated! Please run generate-docs.sh locally and push the changes.\033[0m ❌"
git diff --color
exit 1
fi
- name: Update dependencies
run: find charts/ ! -path charts/ -maxdepth 1 -type d -exec helm dependency update {} \;
- name: Run YAML lint
run: yamllint .
- name: Run chart-testing (lint)
run: ct lint --config .github/ct/ct.yaml
- name: Run ArtifactHub lint
run: ah lint --kind=helm
- name: Cache kubeconform schemas
id: cache-powerlint-kubeconform
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: /tmp
key: ${{ runner.os }}-powerlint-kubeconform
- name: Run Powerlint
env:
KUBERNETES_VERSIONS: "1.24.0 1.25.0 1.26.0"
run: chart-powerlint.sh
# used to test whether the changelog generation process works
- name: Generate changelogs (test)
run: generate-chart-changelog.sh
test:
runs-on: ubuntu-22.04
needs:
- lint
strategy:
matrix:
k8s-version: [1.24.7, 1.25.3, 1.26.0]
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- name: Set up chart-testing
uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Create k8s Kind Cluster
uses: helm/kind-action@d08cf6ff1575077dee99962540d77ce91c62387d # tag=v1.3.0
if: steps.list-changed.outputs.changed == 'true'
with:
version: v0.17.0
cluster_name: kind-cluster-k8s-${{ matrix.k8s-version }}
node_image: kindest/node:v${{ matrix.k8s-version }}
- name: Run chart-testing (install)
run: ct install --config .github/ct/install.yaml
generate-renovate-chart-changelogs:
runs-on: ubuntu-22.04
# run only on PRs created by renovate
# disabled temporarily
if: ${{ false }} # success() && startsWith(github.head_ref, 'renovate/') }}
permissions:
contents: write
needs:
- test
container: ghcr.io/chgl/kube-powertools:v1.22.21@sha256:3e45248e0a88a26978341c7dc2b495020ad0cd75988ce19591f5d6f6d47685ac
steps:
- name: Add workspace as safe directory
run: |
git config --global --add safe.directory /__w/charts/charts
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Generate Chart.yaml changelog for renovate PRs
run: |
HEAD_COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")
CHANGELOG_ENTRY=$(cat << EOF
# When using the list of objects option the valid supported kinds are
# added, changed, deprecated, removed, fixed and security.
- kind: changed
description: "${HEAD_COMMIT_MESSAGE}"
EOF
)
export CHANGELOG_ENTRY
CHANGED_CHARTS=$(ct list-changed)
for CHART in $CHANGED_CHARTS
do
echo "$CHART: updating Chart.yaml with auto-generated changelog annotation"
yq -i '.annotations."artifacthub.io/changes" = strenv(CHANGELOG_ENTRY)' "$CHART/Chart.yaml"
done
- name: Add and commit updated Chart.yaml changelogs
uses: EndBug/add-and-commit@050a66787244b10a4874a2a5f682130263edc192 # tag=v9.0.0
with:
message: "docs: auto-generated Chart.yaml changelog annotations"