From d6edd887d5074ec2d38022937eea74133188eab2 Mon Sep 17 00:00:00 2001 From: Fabio Date: Fri, 4 Apr 2025 10:58:59 -0300 Subject: [PATCH] Debug push-to-branch step --- .drone.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index b2a9d1e..a39bf7d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,8 +27,8 @@ steps: image: alpine:latest commands: - 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')" - - "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" + - "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" environment: GITEA_API_KEY: from_secret: gitea_api_key @@ -39,7 +39,7 @@ steps: - name: update-index image: alpine/helm:latest 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: - fetch-existing-index @@ -47,6 +47,8 @@ steps: - name: push-to-branch image: alpine/git 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 - 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) @@ -54,7 +56,7 @@ steps: # Commit changes - 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 - - 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: GITEA_API_KEY: from_secret: gitea_api_key