You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.3 KiB
61 lines
2.3 KiB
kind: pipeline
|
|
type: kubernetes
|
|
name: update-helm-charts
|
|
|
|
steps:
|
|
# Step 1: Lint all Helm charts
|
|
- name: lint-charts
|
|
image: alpine/helm:latest
|
|
commands:
|
|
- find charts -maxdepth 2 -type d -regex ".*/v[0-9]+\.[0-9]+\.[0-9]+" -exec helm lint {} \;
|
|
|
|
# Step 2: Package only changed Helm charts
|
|
- name: package-all-charts
|
|
image: alpine/helm:latest
|
|
commands:
|
|
- mkdir -p charts/dist
|
|
# Debug: List repository contents
|
|
- echo "Repository root contents:"
|
|
- ls -la .
|
|
- echo "Charts directory contents:"
|
|
- ls -la charts/ || echo "No charts/ directory found"
|
|
# Debug: List contents of charts/clamav/
|
|
- echo "Contents of charts/clamav/:"
|
|
- ls -la charts/clamav/ || echo "No clamav directory found"
|
|
# Debug: Explicitly check for v0.1.0 in clamav
|
|
- echo "Contents of charts/clamav/v0.1.0/:"
|
|
- ls -la charts/clamav/v0.1.0/ || echo "No v0.1.0 directory found in charts/clamav/"
|
|
# Find all versioned chart directories
|
|
- ALL_CHARTS=$$(find charts -maxdepth 2 -type d -regex '.*/v[0-9]+\.[0-9]+\.[0-9]+')
|
|
- "echo \"Detected charts: $ALL_CHARTS\""
|
|
- if [ -n "$ALL_CHARTS" ]; then echo "$ALL_CHARTS" | xargs -I {} helm package {} --destination charts/dist; else echo "No charts found in repository"; exit 1; fi
|
|
# Debug: List packaged files
|
|
- ls -la charts/dist/ || echo "No files in charts/dist/"
|
|
depends_on:
|
|
- lint-charts
|
|
|
|
# Step 3: Push charts to Harbor
|
|
- name: push-to-harbor
|
|
image: alpine/helm:latest
|
|
commands:
|
|
# Fail if credentials are missing
|
|
- "if [ -z \"$HARBOR_USERNAME\" ] || [ -z \"$HARBOR_PASSWORD\" ]; then echo \"Error: HARBOR_USERNAME or HARBOR_PASSWORD not set\"; exit 1; fi"
|
|
# Login to Harbor registry
|
|
- "helm registry login -u \"$HARBOR_USERNAME\" -p \"$HARBOR_PASSWORD\" https://porto.interlegis.leg.br"
|
|
# Push each chart to Harbor (OCI format, Helm 3.8+)
|
|
- for CHART in charts/dist/*.tgz; do helm push "$CHART" oci://porto.interlegis.leg.br/seit; done
|
|
environment:
|
|
HARBOR_USERNAME:
|
|
from_secret: harbor_username
|
|
HARBOR_PASSWORD:
|
|
from_secret: harbor_password
|
|
when:
|
|
condition: ls charts/dist/*.tgz 2>/dev/null # Only run if there are new .tgz files
|
|
depends_on:
|
|
- package-all-charts
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
event:
|
|
- push
|