mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-08-28 03:27:08 +00:00
feat: Enhance update-charts workflow with error handling and notifications
This commit is contained in:
@@ -32,6 +32,11 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "updates=false" >> $GITHUB_OUTPUT
|
echo "updates=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
if [ -f errors_summary.txt ]; then
|
||||||
|
echo "errors=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "errors=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Commit and Push Changes
|
- name: Commit and Push Changes
|
||||||
if: steps.git-check.outputs.updates == 'true'
|
if: steps.git-check.outputs.updates == 'true'
|
||||||
@@ -43,7 +48,7 @@ jobs:
|
|||||||
git pull --rebase origin main
|
git pull --rebase origin main
|
||||||
git push
|
git push
|
||||||
|
|
||||||
- name: Send Signal Notification
|
- name: Send Signal Notification (Updates)
|
||||||
if: steps.git-check.outputs.updates == 'true'
|
if: steps.git-check.outputs.updates == 'true'
|
||||||
env:
|
env:
|
||||||
SIGNAL_URL: ${{ secrets.SIGNAL_URL }}
|
SIGNAL_URL: ${{ secrets.SIGNAL_URL }}
|
||||||
@@ -66,3 +71,27 @@ jobs:
|
|||||||
curl -X POST "$SIGNAL_URL" \
|
curl -X POST "$SIGNAL_URL" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$PAYLOAD"
|
-d "$PAYLOAD"
|
||||||
|
|
||||||
|
- name: Send Signal Notification (Errors)
|
||||||
|
if: steps.git-check.outputs.errors == 'true'
|
||||||
|
env:
|
||||||
|
SIGNAL_URL: ${{ secrets.SIGNAL_URL }}
|
||||||
|
SIGNAL_SENDER: ${{ secrets.SIGNAL_SENDER }}
|
||||||
|
SIGNAL_RECIPIENT: ${{ secrets.SIGNAL_RECIPIENT }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$SIGNAL_URL" ] || [ -z "$SIGNAL_SENDER" ] || [ -z "$SIGNAL_RECIPIENT" ]; then
|
||||||
|
echo "Signal secrets not fully configured, skipping notification."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
ERRORS=$(cat errors_summary.txt)
|
||||||
|
MESSAGE=$(printf '⚠️ Helm Charts Version Check Errors\n\n%s' "$ERRORS")
|
||||||
|
|
||||||
|
PAYLOAD=$(jq -n \
|
||||||
|
--arg msg "$MESSAGE" \
|
||||||
|
--arg num "$SIGNAL_SENDER" \
|
||||||
|
--arg rec "$SIGNAL_RECIPIENT" \
|
||||||
|
'{message: $msg, number: $num, recipients: [$rec]}')
|
||||||
|
|
||||||
|
curl -X POST "$SIGNAL_URL" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$PAYLOAD"
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
# scripts/update-charts.sh
|
# scripts/update-charts.sh
|
||||||
# Checks for upstream image updates and bumps Helm chart versions automatically.
|
# Checks for upstream image updates and bumps Helm chart versions automatically.
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Repository Root
|
# Repository Root
|
||||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||||
UPDATES_FOUND=""
|
UPDATES_FOUND=""
|
||||||
|
ERRORS_FOUND=""
|
||||||
|
|
||||||
# Fetch latest version from different sources
|
# Fetch latest version from different sources
|
||||||
fetch_latest() {
|
fetch_latest() {
|
||||||
@@ -21,6 +20,11 @@ fetch_latest() {
|
|||||||
"dockerhub-tags")
|
"dockerhub-tags")
|
||||||
version=$(curl -s "https://registry.hub.docker.com/v2/repositories/$source_data/tags?page_size=100" | jq -r '.results[].name' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -1)
|
version=$(curl -s "https://registry.hub.docker.com/v2/repositories/$source_data/tags?page_size=100" | jq -r '.results[].name' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -1)
|
||||||
;;
|
;;
|
||||||
|
"dockerhub-tags-pattern")
|
||||||
|
local repo="${source_data%%:*}"
|
||||||
|
local pattern="${source_data#*:}"
|
||||||
|
version=$(curl -s "https://registry.hub.docker.com/v2/repositories/$repo/tags?page_size=100" | jq -r '.results[].name' | grep -E "$pattern" | sort -V -r | head -1)
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
@@ -69,11 +73,17 @@ for chart_dir in "$REPO_ROOT"/*/; do
|
|||||||
|
|
||||||
# Fetch and clean latest
|
# Fetch and clean latest
|
||||||
echo " Source image: $source_type"
|
echo " Source image: $source_type"
|
||||||
latest_raw=$(fetch_latest "${source_type%%:*}" "${source_type#*:}")
|
if ! latest_raw=$(fetch_latest "${source_type%%:*}" "${source_type#*:}" 2>&1); then
|
||||||
|
echo " Error: Unsupported source type '${source_type%%:*}'."
|
||||||
|
ERRORS_FOUND="$ERRORS_FOUND\n- **$chart_name**: unsupported source type '${source_type%%:*}'"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
latest_clean=$(apply_pattern "$latest_raw" "$source_pattern")
|
latest_clean=$(apply_pattern "$latest_raw" "$source_pattern")
|
||||||
|
|
||||||
if [ -z "$latest_clean" ]; then
|
if [ -z "$latest_clean" ]; then
|
||||||
echo " Error: Could not fetch latest version."
|
echo " Error: Could not fetch latest version."
|
||||||
|
ERRORS_FOUND="$ERRORS_FOUND\n- **$chart_name**: could not fetch latest version from $source_type"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -100,7 +110,10 @@ done
|
|||||||
# Output summary for GH Actions
|
# Output summary for GH Actions
|
||||||
if [ -n "$UPDATES_FOUND" ]; then
|
if [ -n "$UPDATES_FOUND" ]; then
|
||||||
echo -e "$UPDATES_FOUND" > "$REPO_ROOT/update_summary.txt"
|
echo -e "$UPDATES_FOUND" > "$REPO_ROOT/update_summary.txt"
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$ERRORS_FOUND" ]; then
|
||||||
|
echo -e "$ERRORS_FOUND" > "$REPO_ROOT/errors_summary.txt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@ apiVersion: v2
|
|||||||
name: termix
|
name: termix
|
||||||
description: Termix Helm chart
|
description: Termix Helm chart
|
||||||
type: application
|
type: application
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
appVersion: "1.11.2"
|
appVersion: "2.0.0"
|
||||||
annotations:
|
annotations:
|
||||||
version-source: dockerhub-dev:bugattiguy527/termix:^release-[0-9]+\.[0-9]+\.[0-9]+$
|
version-source: dockerhub-tags-pattern:bugattiguy527/termix:^release-[0-9]+\.[0-9]+\.[0-9]+$
|
||||||
version-pattern: "s|^release-||"
|
version-pattern: "s|^release-||"
|
||||||
|
|||||||
Reference in New Issue
Block a user