forked from kubeshop/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (116 loc) · 4.45 KB
/
helm-releaser-kusk-gateway-charts.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
name: Releasing Helm charts.
on:
push:
paths:
- 'charts/kusk-gateway**'
branches:
- main
jobs:
release_charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: charts
env:
CR_TOKEN: "${{ secrets.CI_BOT_TOKEN }}"
CR_SKIP_EXISTING: true
notify_slack_if_helm_chart_release_fails:
runs-on: ubuntu-latest
needs: release_charts
if: always() && (needs.release_charts.result == 'failure')
steps:
- name: Slack Notification if Helm Release action failed
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: kusk
SLACK_COLOR: ${{ needs.release_charts.result }} # or a specific color like 'good' or '#ff00ff'
SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_TITLE: Helm Chart release action failed :boom:!
SLACK_USERNAME: GitHub
SLACK_LINK_NAMES: true
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_FOOTER: "Kubeshop --> Kusk Gateway"
refreshing_gh_pages:
needs: release_charts
runs-on: ubuntu-latest
steps:
- name: Triggering refresh for GH-pages to make just released charts available
run: |
curl -s --fail --request POST \
--url https://api.github.com/repos/kubeshop/helm-charts/pages/builds \
--header "Authorization: Bearer $USER_TOKEN"
env:
# You must create a personal token with repo access as GitHub does
# not yet support server-to-server page builds.
USER_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
checking_that_ghpages_updated:
needs: refreshing_gh_pages
runs-on: ubuntu-latest
steps:
- name: Making sure that they are abvailable now.
run: |
status=""
counter=0
while [[ $status != \"built\" ]]
do
status=$(curl -s \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/kubeshop/helm-charts/pages/builds/latest \
--header "Authorization: Bearer $USER_TOKEN" | jq .status)
echo "Checking latest GH pages build status --> $status"
sleep 5
counter=$(expr $counter + 1)
if [[ $status == \"errored\" ]] || [[ $counter == 120 ]]; then
echo "Something went wrong. Please check GH's pages issues."
exit 1
fi
done
env:
# You must create a personal token with repo access as GitHub does
# not yet support server-to-server page builds.
USER_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
notify_slack_if_release_succeeds:
runs-on: ubuntu-latest
needs: checking_that_ghpages_updated
steps:
- name: Slack Notification if the helm release pipeline succeeded.
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: kusk
SLACK_COLOR: ${{ needs.checking_that_ghpages_updated.result }} # or a specific color like 'good' or '#ff00ff'
SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_TITLE: Helm chart release succeed and GH pages got updated :party_blob:!
SLACK_USERNAME: GitHub
SLACK_LINK_NAMES: true
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_FOOTER: "Kubeshop --> Kusk Gateway"
notify_slack_if_gh_pages_update_failed:
runs-on: ubuntu-latest
needs: checking_that_ghpages_updated
if: always() && (needs.checking_that_ghpages_updated.result == 'failure')
steps:
- name: Slack Notification if the helm release GH Pages failed.
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: kusk
SLACK_COLOR: ${{ needs.checking_that_ghpages_updated.result }} # or a specific color like 'good' or '#ff00ff'
SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_TITLE: Helm chart release failed on GH pages update! :boom:!
SLACK_USERNAME: GitHub
SLACK_LINK_NAMES: true
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_FOOTER: "Kubeshop --> Kusk Gateway"