fix(ci): use GITOPS_PAT for gitops push, not never-configured SSH secrets
Some checks failed
build-and-release / build (push) Failing after 1m50s

Third bug in the same chain: GITEOPS_REPO/GITEOPS_SSH_KEY were
referenced but never actually configured as repo secrets (only
REGISTRY_*, GITOPS_GITHUB_*, and GITOPS_PAT exist) — the digest
extraction fix got the job to actually reach this step, where it then
failed instantly and silently (a bare `test -n` with no echo). Switch
to an HTTPS clone with GITOPS_PAT, matching nxtgauge-backend-rust's
already-working workflow.
This commit is contained in:
Ashwin Kumar Sivakumar 2026-07-12 18:36:42 +05:30
parent 52e7e86a0e
commit c8af6e4114

View file

@ -98,22 +98,24 @@ jobs:
- name: Update GitOps release
env:
GITEOPS_REPO: ${{ secrets.GITEOPS_REPO }}
GITEOPS_SSH_KEY: ${{ secrets.GITEOPS_SSH_KEY }}
GITOPS_SERVER: ${{ secrets.GITOPS_SERVER || 'ci.nxtgauge.com' }}
GITOPS_OWNER: ${{ secrets.GITOPS_OWNER || 'ashwin' }}
GITOPS_REPO: ${{ secrets.GITOPS_REPO || 'nxtgauge-gitops' }}
GITOPS_BRANCH: ${{ secrets.GITOPS_BRANCH || 'main' }}
# The gitops repo lives on Forgejo (ci.nxtgauge.com), not GitHub -
# GITEOPS_REPO/GITEOPS_SSH_KEY were never actually configured as
# repo secrets (only GITOPS_GITHUB_* and GITOPS_PAT exist, per
# nxtgauge-backend-rust's already-fixed workflow). Use GITOPS_PAT.
GITOPS_PAT: ${{ secrets.GITOPS_PAT }}
SHA: ${{ github.sha }}
run: |
set -euo pipefail
test -n "$GITEOPS_REPO"
test -n "$GITEOPS_SSH_KEY"
test -n "${GITOPS_PAT:-}" || { echo "GITOPS_PAT is empty"; exit 1; }
mkdir -p ~/.ssh
printf '%s\n' "$GITEOPS_SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
for host in github.com ci.nxtgauge.com; do ssh-keyscan -H "$host" >> ~/.ssh/known_hosts 2>/dev/null || true; done
GITEOPS_DIR=$(mktemp -d)
git clone "$GITEOPS_REPO" "$GITEOPS_DIR"
cd "$GITEOPS_DIR"
GITOPS_DIR=$(mktemp -d)
git clone "https://forgejo-actions:${GITOPS_PAT}@${GITOPS_SERVER}/${GITOPS_OWNER}/${GITOPS_REPO}.git" "$GITOPS_DIR"
cd "$GITOPS_DIR"
git checkout "$GITOPS_BRANCH"
image_ref="$(cat /tmp/frontend-solid-image-ref.txt)"
./scripts/set-app-release.sh frontend-solid "$image_ref"
@ -127,4 +129,4 @@ jobs:
git config user.email "forgejo-actions@ci.nxtgauge.com"
git add apps scripts/set-app-release.sh
git commit -m "chore(gitops): deploy frontend-solid@${SHA}"
git push
git push origin "HEAD:${GITOPS_BRANCH}"