-
Notifications
You must be signed in to change notification settings - Fork 4
185 lines (153 loc) · 8.12 KB
/
updates.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
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
name: updates
on:
schedule:
- cron: '42 0 * * *' # every day at 00:42
jobs:
kube-state-metrics:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Install extra tooling
run: |
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0
- name: Check for image updates
run: |
export PATH=$PATH:$(go env GOPATH)/bin
image_ref=$(yq '.image.repository' charts/kube-state-metrics/values.yaml)
latest_version=$(skopeo list-tags docker://$image_ref | jq -r '.Tags | map(. | select(. | test("^v?[0-9]+\\.[0-9]+\\.[0-9]+$"))) | sort | last'); export latest_version
next_chart_version=$(yq '.version' charts/kube-state-metrics/Chart.yaml | awk -F. -v OFS=. '{$NF += 1 ; print}'); export next_chart_version
branch=feature/upgrade-kube-state-metrics-$latest_version
if git ls-remote | grep "$branch"; then
echo Checkout existing branch $branch
git checkout $branch
else
echo Create new branch $branch
git checkout -b $branch
fi
current_version=$(yq '.appVersion' charts/kube-state-metrics/Chart.yaml)
echo "Comparing $current_version == $latest_version"
if [ "$current_version" == "$latest_version" ]; then
echo "New image version $latest_version already present on branch"
exit 0
fi
yq '.appVersion=strenv(latest_version)' -i charts/kube-state-metrics/Chart.yaml
echo Creating PR - if necressary
git update-index -q --really-refresh
if [ -n "$(git diff-index --name-only HEAD --)" ]; then
yq '.version=strenv(next_chart_version)' -i charts/kube-state-metrics/Chart.yaml
helm-docs
git config user.email "support@netic.dk"
git config user.name "Upgrade Automation"
git add charts/kube-state-metrics
git commit -m "feat(kube-state-metrics): Upgrade kube-state-metrics image to $latest_version"
git push --set-upstream origin $branch
gh pr create --base main --title "feat(kube-state-metrics): Upgrade kube-state-metrics image to $latest_version" --body "Upgrade kube-state-metrics image version to $latest_version"
fi
env:
GH_TOKEN: ${{ github.token }}
prometheus-node-exporter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Install extra tooling
run: |
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0
- name: Add dependency chart repos
run: ./.github/scripts/helm-repos.sh
shell: bash
- name: Check for image updates
run: |
export PATH=$PATH:$(go env GOPATH)/bin
image_ref=$(yq '.image.repository' charts/prometheus-node-exporter/values.yaml)
latest_version=$(skopeo list-tags docker://$image_ref | jq -r '.Tags | map(. | select(. | test("^v?[0-9]+\\.[0-9]+\\.[0-9]+$"))) | sort | last'); export latest_version
next_chart_version=$(yq '.version' charts/prometheus-node-exporter/Chart.yaml | awk -F. -v OFS=. '{$NF += 1 ; print}'); export next_chart_version
next_oaas_version=$(yq '.version' charts/oaas-observability/Chart.yaml | awk -F. -v OFS=. '{$NF += 1 ; print}'); export next_oaas_version
branch=feature/upgrade-prometheus-node-exporter-$latest_version
if git ls-remote | grep "$branch"; then
echo Checkout existing branch $branch
git checkout $branch
else
echo Create new branch $branch
git checkout -b $branch
fi
current_version=$(yq '.appVersion' charts/prometheus-node-exporter/Chart.yaml)
echo "Comparing $current_version == $latest_version"
if [ "$current_version" == "$latest_version" ]; then
echo "New image version $latest_version already present on branch"
exit 0
fi
yq '.appVersion=strenv(latest_version)' -i charts/prometheus-node-exporter/Chart.yaml
echo Creating PR - if necressary
git update-index -q --really-refresh
if [ -n "$(git diff-index --name-only HEAD --)" ]; then
yq '.version=strenv(next_chart_version)' -i charts/prometheus-node-exporter/Chart.yaml
yq '.version=strenv(next_oaas_version)' -i charts/oaas-observability/Chart.yaml
helm dependency update charts/oaas-observability
helm-docs
git config user.email "support@netic.dk"
git config user.name "Upgrade Automation"
git add charts/prometheus-node-exporter
git add charts/oaas-observability
git commit -m "feat(prometheus-node-exporter): Upgrade prometheus-node-exporter image to $latest_version"
git push --set-upstream origin $branch
gh pr create --base main --title "feat(prometheus-node-exporter): Upgrade prometheus-node-exporter image to $latest_version" --body "Upgrade prometheus-node-exporter image version to $latest_version"
fi
env:
GH_TOKEN: ${{ github.token }}
oaas-observability:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Install extra tooling
run: |
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0
- name: Add dependency chart repos
run: ./.github/scripts/helm-repos.sh
shell: bash
- name: Check for chart updates
run: |
export PATH=$PATH:$(go env GOPATH)/bin
next_oaas_version=$(yq '.version' charts/oaas-observability/Chart.yaml | awk -F. -v OFS=. '{$NF += 1 ; print}'); export next_oaas_version
branch=feature/upgrade-oaas-observability-$next_oaas_version
if git ls-remote | grep "$branch"; then
echo Checkout existing branch $branch
git checkout $branch
else
echo Create new branch $branch
git checkout -b $branch
fi
grafana_version=$(helm search repo grafana -ojson | jq -r '.[0].version'); export grafana_version
yq '.dependencies.[] |= (select(.name=="grafana") | .version = strenv(grafana_version))' -i charts/oaas-observability/Chart.yaml
promtail_version=$(helm search repo promtail -ojson | jq -r '.[0].version'); export promtail_version
yq '.dependencies.[] |= (select(.name=="promtail") | .version = strenv(promtail_version))' -i charts/oaas-observability/Chart.yaml
kube_state_metrics_version=$(helm search repo kube-state-metrics -ojson | jq -r '.[0].version'); export kube_state_metrics_version
yq '.dependencies.[] |= (select(.name=="kube-state-metrics") | .version = strenv(kube_state_metrics_version))' -i charts/oaas-observability/Chart.yaml
opentelemetry_version=$(helm search repo opentelemetry-operator -ojson | jq -r '.[0].version'); export opentelemetry_version
yq '.dependencies.[] |= (select(.name=="opentelemetry-operator") | .version = strenv(opentelemetry_version))' -i charts/oaas-observability/Chart.yaml
echo Creating PR - if necressary
git update-index -q --really-refresh
if [ -n "$(git diff-index --name-only HEAD --)" ]; then
yq '.version=strenv(next_oaas_version)' -i charts/oaas-observability/Chart.yaml
helm dependency update charts/oaas-observability
helm-docs
git config user.email "support@netic.dk"
git config user.name "Upgrade Automation"
git add charts/oaas-observability
git commit -m "feat(oaas-observability): Upgrade oaas-observability dependencies"
git push --set-upstream origin $branch
gh pr create --base main --title "feat(oaas-observability): Upgrade oaas-observability dependencies" --body "Upgrade oaas-observability dependencies"
fi
env:
GH_TOKEN: ${{ github.token }}