--- kind: pipeline type: docker name: helm-chart-pipeline workspace: path: /drone/src # Only run this pipeline on pushes to the master branch # Skip the pipeline when the commit message contains [CI SKIP] trigger: branch: - main event: - push steps: - name: package-and-index image: alpine/helm:3.12.0 commands: # Verify the chart directory exists - 'test -d ./servflow || (echo "Error: servflow directory not found" && exit 1)' # Update dependencies if they exist - "if [ -f ./servflow/Chart.lock ]; then helm dependency update ./servflow; fi" # Make sure charts directory exists - "mkdir -p ./charts" # Package the Helm chart into the charts directory - 'helm package ./servflow -d ./charts || (echo "Error: failed to package chart" && exit 1)' # Update the Helm repository index - "helm repo index ./charts" # Show what was created for debugging - "ls -la ./charts" - name: commit-and-push image: alpine/git commands: # Configure Git - 'git config --global user.name "Drone CI"' - 'git config --global user.email "drone@example.com"' # Check if there are changes to commit - "git add charts/" - | if git diff --cached --quiet; then echo "No changes to commit" exit 0 fi # Commit and push changes - 'git commit -m "Update Helm chart [CI SKIP]"' - "git push origin main" # Limit concurrent builds to avoid conflicts when updating the repository concurrency: limit: 1