automatically updated tracetest related charts #174
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Releasing Helm charts. | |
on: | |
push: | |
paths: | |
- 'charts/tracetest**' | |
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 "$GITHUB_ACTOR@users.noreply.github.com" | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.4.0 | |
- name: Run chart-releaser | |
uses: helm/chart-releaser-action@v1.2.1 | |
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: tracetest | |
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 --> Tracetest " | |
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: tracetest | |
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 --> Tracetest" | |
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: tracetest | |
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 --> Tracetest" |