Browse Source

Debug push-to-branch step

master
Fábio Kaiser Rauber 5 months ago
parent
commit
d6edd887d5
  1. 10
      .drone.yml

10
.drone.yml

@ -27,8 +27,8 @@ steps:
image: alpine:latest image: alpine:latest
commands: commands:
- apk add --no-cache curl 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:
GITEA_API_KEY: GITEA_API_KEY:
from_secret: gitea_api_key from_secret: gitea_api_key
@ -39,7 +39,7 @@ steps:
- name: update-index - name: update-index
image: alpine/helm:latest image: alpine/helm:latest
commands: commands:
- if [ -n "$(ls charts/dist/*.tgz 2>/dev/null)" ]; then helm repo index charts/dist --url https://git.interlegis.leg.br/seit/rancher-charts/raw/branch/gh-pages/ --merge charts/dist/index.yaml; else echo "No new charts to index"; fi - if [ -n "$(ls charts/dist/*.tgz 2>/dev/null)" ]; then helm repo index charts/dist --url https://git.interlegis.leg.br/SEIT/rancher-charts/raw/branch/gh-pages/ --merge charts/dist/index.yaml; else echo "No new charts to index"; fi
depends_on: depends_on:
- fetch-existing-index - fetch-existing-index
@ -47,6 +47,8 @@ steps:
- name: push-to-branch - name: push-to-branch
image: alpine/git image: alpine/git
commands: commands:
# Debug: Verify API key presence
- test -n "$GITEA_API_KEY" || { echo "GITEA_API_KEY is not set"; exit 1; }
# Check if gh-pages exists remotely, fetch it if it does, otherwise create it # Check if gh-pages exists remotely, fetch it if it does, otherwise create it
- git ls-remote --heads origin gh-pages | grep -q gh-pages && git fetch origin gh-pages && git checkout gh-pages || git checkout -b gh-pages - git ls-remote --heads origin gh-pages | grep -q gh-pages && git fetch origin gh-pages && git checkout gh-pages || git checkout -b gh-pages
# Stage the charts/dist directory (already in the working directory) # Stage the charts/dist directory (already in the working directory)
@ -54,7 +56,7 @@ steps:
# Commit changes # Commit changes
- git commit -m "Update Helm charts from commit ${DRONE_COMMIT}" || echo "No changes to commit" - git commit -m "Update Helm charts from commit ${DRONE_COMMIT}" || echo "No changes to commit"
# Push with API key in URL and check for failure # Push with API key in URL and check for failure
- git push https://${GITEA_API_KEY}@git.interlegis.leg.br/seit/rancher-charts.git HEAD:gh-pages --force || { echo "Git push failed"; exit 1; } - git push https://x:${GITEA_API_KEY}@git.interlegis.leg.br/SEIT/rancher-charts.git HEAD:gh-pages --force || { echo "Git push failed"; exit 1; }
environment: environment:
GITEA_API_KEY: GITEA_API_KEY:
from_secret: gitea_api_key from_secret: gitea_api_key

Loading…
Cancel
Save