|
@ -7,24 +7,26 @@ steps: |
|
|
- name: lint-charts |
|
|
- name: lint-charts |
|
|
image: alpine/helm:latest |
|
|
image: alpine/helm:latest |
|
|
commands: |
|
|
commands: |
|
|
- find charts -maxdepth 1 -type d -not -path charts -exec helm lint {} \; |
|
|
- find charts -maxdepth 2 -type d -regex ".*/v[0-9]+\.[0-9]+\.[0-9]+" -exec helm lint {} \; |
|
|
|
|
|
|
|
|
# Step 2: Package only changed Helm charts |
|
|
# Step 2: Package only changed Helm charts |
|
|
- name: package-changed-charts |
|
|
- name: package-changed-charts |
|
|
image: alpine/helm:latest |
|
|
image: alpine/helm:latest |
|
|
commands: |
|
|
commands: |
|
|
- mkdir -p charts/dist |
|
|
- mkdir -p charts/dist |
|
|
# Detect changed chart directories and package them |
|
|
# Detect changed versioned chart directories (e.g., charts/my-chart/v1.0.0) |
|
|
- CHANGED_CHARTS=$(git diff --name-only $DRONE_PREV_COMMIT $DRONE_COMMIT | grep '^charts/' | sed 's|/[^/]*$||' | sort -u) |
|
|
- CHANGED_CHARTS=$(git diff --name-only $DRONE_PREV_COMMIT $DRONE_COMMIT | grep '^charts/.*v[0-9]\+\.[0-9]\+\.[0-9]\+' | sed 's|/[^/]*$||' | sort -u) |
|
|
- if [ -n "$CHANGED_CHARTS" ]; then echo "$CHANGED_CHARTS" | xargs -I {} helm package {} --destination charts/dist; else echo "No charts changed"; fi |
|
|
- if [ -n "$CHANGED_CHARTS" ]; then echo "$CHANGED_CHARTS" | xargs -I {} helm package {} --destination charts/dist; else echo "No charts changed"; fi |
|
|
|
|
|
- mkdir -p charts/dist |
|
|
depends_on: |
|
|
depends_on: |
|
|
- lint-charts |
|
|
- lint-charts |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Step 3: Fetch the existing index.yaml from Gitea (if it exists) |
|
|
# Step 3: Fetch the existing index.yaml from Gitea (if it exists) |
|
|
- name: fetch-existing-index |
|
|
- name: fetch-existing-index |
|
|
image: curlimages/curl |
|
|
image: alpine:latest |
|
|
commands: |
|
|
commands: |
|
|
- "apk add jq" |
|
|
- apk add --no-cache curl jq |
|
|
- "LATEST_TAG=$(curl -s -H \"Authorization: token $GITEA_API_KEY\" https://git.interlegis.leg.br/api/v1/repos/seit/rancher-charts/releases?limit=1 | jq -r '.[0].tag_name')" |
|
|
- "LATEST_TAG=$(curl -s -H \"Authorization: token $GITEA_API_KEY\" https://git.interlegis.leg.br/api/v1/repos/seit/rancher-charts/releases?limit=1 | jq -r '.[0].tag_name')" |
|
|
- "if [ -n \"$LATEST_TAG\" ]; then curl -L -o charts/dist/index.yaml https://git.interlegis.leg.br/seit/rancher-charts/releases/download/$LATEST_TAG/index.yaml || true; fi" |
|
|
- "if [ -n \"$LATEST_TAG\" ]; then curl -L -o charts/dist/index.yaml https://git.interlegis.leg.br/seit/rancher-charts/releases/download/$LATEST_TAG/index.yaml || true; fi" |
|
|
environment: |
|
|
environment: |
|
|