From 216e0d0c1eb9ec970715018c66fd9245cf6ee60b Mon Sep 17 00:00:00 2001 From: Alan Bridgeman Date: Fri, 19 Dec 2025 12:24:40 -0600 Subject: [PATCH] Attempted to make changes to automation to work properly/better (avoid false-positive of remote chart already existing) --- .forgejo/workflows/deploy.yml | 20 +++++++++++++++----- Chart.yaml | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml index ff931ea..14c85d1 100644 --- a/.forgejo/workflows/deploy.yml +++ b/.forgejo/workflows/deploy.yml @@ -34,13 +34,23 @@ jobs: helm repo add BridgemanAccessible https://helm.bridgemanaccessible.ca # Check if the chart is already in the repository or not - REMOTE_CHART_WORK_OUTPUT=$(helm search repo BridgemanAccessible/$CHART_NAME 2>/dev/null || echo "") - if [ -n "$REMOTE_CHART_WORK_OUTPUT" ]; then + #REMOTE_CHART_WORK_OUTPUT=$(helm search repo BridgemanAccessible/$CHART_NAME 2>/dev/null || echo "") + #if [ -n "$REMOTE_CHART_WORK_OUTPUT" ]; then + + SEARCH_JSON=$(helm search repo BridgemanAccessible/$CHART_NAME --output json) + + # Parse the JSON to see if our specific chart name exists in the results + IS_FOUND=$(echo "$SEARCH_JSON" | jq -r ".[] | select(.name == \"BridgemanAccessible/$CHART_NAME\") | .name" + + if [ -n "$IS_FOUND" ]; then # The chart is already in the repository, so we need to check if the version is the same or not echo "Chart already exists in the repository. Checking version..." - - IFS=' ' read -r -a REMOTE_VERSIONS <<< $(helm search repo BridgemanAccessible/$CHART_NAME --output json | jq '.[].version | @sh') - + + # Parse the versions + #IFS=' ' read -r -a REMOTE_VERSIONS <<< $(helm search repo BridgemanAccessible/$CHART_NAME --output json | jq '.[].version | @sh') + # From the ALREADY fetched JSON + IFS=' ' read -r -a REMOTE_VERSIONS <<< $(echo "$SEARCH_JSON" | jq -r ".[] | select(.name == \"BridgemanAccessible/$CHART_NAME\") | .version") + echo "Remote Chart Versions: ${REMOTE_VERSIONS[@]}" else # The chart is not in the repository, so we'll need to add it diff --git a/Chart.yaml b/Chart.yaml index 3bd9aa0..9567962 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -8,4 +8,4 @@ maintainers: name: ba-custom-hashicorp-vault sources: - https://git.bridgemanaccessible.ca/Bridgeman-Accessible/custom-hashicorp-vault -version: "1.0.1" +version: "1.0.0"