Skip to content

Merge pull request #1616 from FalkorDB/fix-ai-comments #97

Merge pull request #1616 from FalkorDB/fix-ai-comments

Merge pull request #1616 from FalkorDB/fix-ai-comments #97

Workflow file for this run

name: Helm Chart CI/CD
# This workflow requires a GHCR_TOKEN or GITHUB_TOKEN with repo permissions
# to push charts to the FalkorDB/helm-charts repository
# The token needs write access to the helm-charts repository
on:
push:
branches: ["main", "staging"]
tags: ["v*.*.*"]
paths:
- 'helm/**'
- '.github/workflows/helm-chart.yml'
pull_request:
paths:
- 'helm/**'
- '.github/workflows/helm-chart.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with:
version: v3.14.0
- name: Lint Helm chart
run: |
helm lint helm/falkordb-browser
- name: Template Helm chart
run: |
helm template test-release helm/falkordb-browser > /dev/null
echo "✅ Helm chart templates rendered successfully"
- name: Template with various configurations
run: |
echo "Testing with ingress enabled..."
helm template test helm/falkordb-browser --set ingress.enabled=true > /dev/null
echo "Testing with persistence enabled..."
helm template test helm/falkordb-browser --set persistence.enabled=true > /dev/null
echo "Testing with autoscaling enabled..."
helm template test helm/falkordb-browser --set autoscaling.enabled=true > /dev/null
echo "Testing with serviceAccount.create=false..."
helm template test helm/falkordb-browser --set serviceAccount.create=false > /dev/null
echo "✅ All configuration tests passed"
kind-test:
runs-on: ubuntu-latest
needs: lint-test
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with:
version: v3.14.0
- name: Create Kind cluster
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
cluster_name: kind
wait: 120s
- name: Install Helm chart
run: |
helm install test-release helm/falkordb-browser \
--wait \
--timeout 5m \
--set env.nextauthSecret=test-secret-for-ci
- name: Verify deployment
run: |
kubectl get all -l app.kubernetes.io/name=falkordb-browser
kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=falkordb-browser --timeout=300s
- name: Test service
run: |
kubectl get svc test-release-falkordb-browser
echo "✅ Service is running"
- name: Run basic connectivity test
run: |
set -e
echo "Testing service connectivity..."
kubectl run test-pod --image=busybox:1.36 --rm -i --restart=Never --command -- \
sh -c 'wget -O- --timeout=10 http://test-release-falkordb-browser:3000 && echo "✅ Connectivity test passed"'
- name: Cleanup
if: always()
run: |
helm uninstall test-release || true
package-publish:
runs-on: ubuntu-latest
needs: [lint-test, kind-test]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with:
version: v3.14.0
- name: Install yq
run: |
YQ_VERSION="v4.50.1"
YQ_BINARY="yq_linux_amd64"
wget -qO /tmp/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}"
echo "c7a1278e6bbc4924f41b56db838086c39d13ee25dcb22089e7fbf16ac901f0d4 /tmp/yq" | sha256sum -c -
sudo mv /tmp/yq /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq
- name: Set chart version
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags/v ]]; then
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}" # Remove 'v' prefix
echo "CHART_VERSION=$VERSION" >> $GITHUB_ENV
echo "Publishing version: $VERSION"
else
# For main branch, use version from Chart.yaml
VERSION=$(yq '.version' helm/falkordb-browser/Chart.yaml)
echo "CHART_VERSION=$VERSION" >> $GITHUB_ENV
echo "Publishing version from Chart.yaml: $VERSION"
fi
- name: Update chart version if tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
yq -i ".version = \"${{ env.CHART_VERSION }}\"" helm/falkordb-browser/Chart.yaml
yq -i ".appVersion = \"${{ env.CHART_VERSION }}\"" helm/falkordb-browser/Chart.yaml
- name: Package Helm chart
run: |
helm package helm/falkordb-browser --destination .helm-charts
- name: Checkout helm-charts repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: FalkorDB/helm-charts
path: helm-charts-repo
token: ${{ secrets.GHCR_TOKEN || secrets.GITHUB_TOKEN }}
- name: Copy chart to helm-charts repository
run: |
mkdir -p helm-charts-repo/charts
cp .helm-charts/*.tgz helm-charts-repo/charts/
cd helm-charts-repo
# Update index
helm repo index charts --url https://falkordb.github.io/helm-charts
# Commit and push with retry logic
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add charts/
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "feat(helm): update falkordb-browser chart to version ${{ env.CHART_VERSION }}"
# Retry push up to 3 times in case of conflicts
for i in {1..3}; do
if git push; then
echo "✅ Chart successfully pushed to helm-charts repository"
break
else
if [ $i -lt 3 ]; then
echo "Push failed, retrying... (attempt $i/3)"
# Get the default branch name
DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)
if git pull --rebase origin ${DEFAULT_BRANCH}; then
echo "Rebase successful, retrying push..."
sleep 2
else
echo "❌ Failed to rebase - conflicts detected"
git rebase --abort
exit 1
fi
else
echo "❌ Failed to push after 3 attempts"
exit 1
fi
fi
done
fi
- name: Generate installation instructions
run: |
cat << EOF > installation-instructions.txt
# FalkorDB Browser Helm Chart Installation
## Add the Helm repository
helm repo add falkordb https://falkordb.github.io/helm-charts
helm repo update
## Install the chart
helm install falkordb-browser falkordb/falkordb-browser --version ${{ env.CHART_VERSION }}
## Or with custom values
helm install falkordb-browser falkordb/falkordb-browser \\
--version ${{ env.CHART_VERSION }} \\
--set env.nextauthUrl=https://your-domain.com \\
--set env.nextauthSecret=your-secret-here
## Verify installation
kubectl get pods -l app.kubernetes.io/name=falkordb-browser
EOF
cat installation-instructions.txt
- name: Upload package as artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: helm-chart
path: .helm-charts/*.tgz
retention-days: 30