Small update/correction to README + uncommenting chunk of Forgejo Action automation
All checks were successful
Deploy the Helm Chart / build (push) Successful in 9s

This commit is contained in:
Alan Bridgeman 2025-12-18 22:34:47 -06:00
parent f40cbdf6dd
commit 0b611db030
2 changed files with 66 additions and 66 deletions

View file

@ -31,27 +31,27 @@ jobs:
# Note, this depends on the [Harbor Helm Index](https://git.bridgemanaccessible.ca/Bridgeman-Accessible/harbor-helm-index) pretty heavily
# In particular, that tool allows us to treat what is an OCI registry as a Helm repository (which includes using `helm search repo`)
#helm repo add BridgemanAccessible https://helm.bridgemanaccessible.ca
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
# # 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')
#
# echo "Remote Chart Versions: ${REMOTE_VERSIONS[@]}"
#else
# # The chart is not in the repository, so we'll need to add it
# echo "Chart not found in the repository. Adding it..."
#
# # Set a blank value so that it WON'T match the local version
# IFS=' ' read -r -a REMOTE_VERSIONS <<< ""
#fi
REMOTE_CHART_WORK_OUTPUT=$(helm search repo BridgemanAccessible/$CHART_NAME 2>/dev/null || echo "")
if [ -n "$REMOTE_CHART_WORK_OUTPUT" ]; 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')
echo "Remote Chart Versions: ${REMOTE_VERSIONS[@]}"
else
# The chart is not in the repository, so we'll need to add it
echo "Chart not found in the repository. Adding it..."
# Set a blank value so that it WON'T match the local version
IFS=' ' read -r -a REMOTE_VERSIONS <<< ""
fi
# Just to keep things clean/safe/etc... remove the repo
#helm repo remove BridgemanAccessible
helm repo remove BridgemanAccessible
# Get the local version from the Chart.yaml file
LOCAL_VERSION=$(yq '.version' Chart.yaml)
@ -59,54 +59,54 @@ jobs:
LOCAL_VERSION=${LOCAL_VERSION%\"} # Remove trailing quote
echo "Local Chart Version: $LOCAL_VERSION"
#has_match='false'
#if [ ${#REMOTE_VERSIONS[@]} -gt 0 ]; then
# # Loop through the remote tags and check if any of them match the local version
# for REMOTE_VERSION in ${REMOTE_VERSIONS[@]}; do
# REMOTE_VERSION=${REMOTE_VERSION#\'} # Remove leading quote
# REMOTE_VERSION=${REMOTE_VERSION%\'} # Remove trailing quote
#
# # Check if the remote tag is the same as the local tag
# if [ "$REMOTE_VERSION" == "$LOCAL_VERSION" ]; then
# echo "Remote version matches local version!"
# has_match='true'
# break
# fi
# done
#fi
has_match='false'
if [ ${#REMOTE_VERSIONS[@]} -gt 0 ]; then
# Loop through the remote tags and check if any of them match the local version
for REMOTE_VERSION in ${REMOTE_VERSIONS[@]}; do
REMOTE_VERSION=${REMOTE_VERSION#\'} # Remove leading quote
REMOTE_VERSION=${REMOTE_VERSION%\'} # Remove trailing quote
# Check if the remote tag is the same as the local tag
if [ "$REMOTE_VERSION" == "$LOCAL_VERSION" ]; then
echo "Remote version matches local version!"
has_match='true'
break
fi
done
fi
# If the versions match, we want to increment the chart's patch version
#if [ "has_match" ]; then
# echo "Versions match!"
#
# # Increment the patch version of the local version (Ex. 1.0.0 -> 1.0.1)
# IFS='.' read -r major minor patch <<< "$LOCAL_VERSION"
# patch=$((patch + 1))
# NEW_LOCAL_VERSION="$major.$minor.$patch"
#
# echo "New Local Version: $NEW_LOCAL_VERSION"
# echo "Committing new chart version change..."
#
# sed -i "s|version: \"$LOCAL_VERSION\"|version: \"$NEW_LOCAL_VERSION\"|g" Chart.yaml
#
# LOCAL_VERSION=$NEW_LOCAL_VERSION
#
# # Update remote URL to use the GITHUB_TOKEN for authentication
# git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@git.bridgemanaccessible.ca/${{ github.repository }}.git
#
# # Setup git user details for committing the version change and tag
# git config user.name "Forgejo Actions"
# git config user.email "actions@git.bridgemanaccessible.ca"
#
# # Commit the version change to the `package.json` file
# git add Chart.yaml
# git commit -m "[Forgejo Actions] Update Helm chart version to $(yq -r '.version' Chart.yaml)"
#
# # Push the changes to the repository
# git push origin HEAD:main
#else
# echo "Versions do not match!"
#fi
if [ "has_match" ]; then
echo "Versions match!"
# Increment the patch version of the local version (Ex. 1.0.0 -> 1.0.1)
IFS='.' read -r major minor patch <<< "$LOCAL_VERSION"
patch=$((patch + 1))
NEW_LOCAL_VERSION="$major.$minor.$patch"
echo "New Local Version: $NEW_LOCAL_VERSION"
echo "Committing new chart version change..."
sed -i "s|version: \"$LOCAL_VERSION\"|version: \"$NEW_LOCAL_VERSION\"|g" Chart.yaml
LOCAL_VERSION=$NEW_LOCAL_VERSION
# Update remote URL to use the GITHUB_TOKEN for authentication
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@git.bridgemanaccessible.ca/${{ github.repository }}.git
# Setup git user details for committing the version change and tag
git config user.name "Forgejo Actions"
git config user.email "actions@git.bridgemanaccessible.ca"
# Commit the version change to the `package.json` file
git add Chart.yaml
git commit -m "[Forgejo Actions] Update Helm chart version to $(yq -r '.version' Chart.yaml)"
# Push the changes to the repository
git push origin HEAD:main
else
echo "Versions do not match!"
fi
#helm package .
#helm push ./$CHART_NAME-$LOCAL_VERSION.tgz oci://${{ secrets.REPOSITORY_HOSTNAME }}/helm
@ -121,7 +121,7 @@ jobs:
# env:
# NAMESPACE: custom-vault
# RELEASE_NAME: custom-vault
# CHART_NAME: ${{ needs.build.outputs.chart-name }}
# CHART_NAME: ${{ needs.build.outputs.chart-name }}
# steps:
# # Deploy the resources to the cluster
# - name: Deploy Helm Chart

View file

@ -8,6 +8,6 @@ To use this chart as a dependency:
dependencies:
- name: ba-custom-hashicorp-vault
version: 1.0.0
repository: "https://charts.bridgemanaccessible.ca/"
repository: "https://helm.bridgemanaccessible.ca/"
condition: vault.enabled
```