From c8ecb6bf8114a196b2b5c742bb5ae6ae5770a864 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Sivakumar Date: Thu, 11 Jun 2026 17:17:42 +0530 Subject: [PATCH] chore: migrate ci naming to forgejo --- .../scripts/registry_prune.py | 0 {.gitea => .forgejo}/scripts/update-gitops.py | 8 +++++-- {.gitea => .forgejo}/workflows/build.yaml | 13 +++++++----- {.gitea => .forgejo}/workflows/test.yaml | 0 ...{sync-to-gitea.yml => sync-to-forgejo.yml} | 21 ++++++++++--------- TESTING.md | 4 ++-- 6 files changed, 27 insertions(+), 19 deletions(-) rename {.gitea => .forgejo}/scripts/registry_prune.py (100%) rename {.gitea => .forgejo}/scripts/update-gitops.py (93%) rename {.gitea => .forgejo}/workflows/build.yaml (89%) rename {.gitea => .forgejo}/workflows/test.yaml (100%) rename .github/workflows/{sync-to-gitea.yml => sync-to-forgejo.yml} (65%) diff --git a/.gitea/scripts/registry_prune.py b/.forgejo/scripts/registry_prune.py similarity index 100% rename from .gitea/scripts/registry_prune.py rename to .forgejo/scripts/registry_prune.py diff --git a/.gitea/scripts/update-gitops.py b/.forgejo/scripts/update-gitops.py similarity index 93% rename from .gitea/scripts/update-gitops.py rename to .forgejo/scripts/update-gitops.py index 03805a0..317d66e 100644 --- a/.gitea/scripts/update-gitops.py +++ b/.forgejo/scripts/update-gitops.py @@ -11,7 +11,7 @@ Usage: This script: 1. Updates the newTag for the specified service to the SHA 2. Commits and pushes to the gitops repo -3. ArgoCD detects the change and deploys +3. Flux detects the change and deploys """ import argparse @@ -98,10 +98,14 @@ def main(): image_name = f"nxtgauge-{args.service}" # Find the right kustomization file based on service - if "frontend" in args.service or "admin" in args.service: + if "frontend" in args.service: kustomization_path = os.path.join(args.repo, "apps/nxtgauge-frontend-solid/overlays/prod/kustomization.yaml") if not os.path.exists(kustomization_path): kustomization_path = os.path.join(args.repo, "apps/nxtgauge-frontend-solid/base/kustomization.yaml") + elif "admin" in args.service: + kustomization_path = os.path.join(args.repo, "apps/nxtgauge-admin-solid/overlays/prod/kustomization.yaml") + if not os.path.exists(kustomization_path): + kustomization_path = os.path.join(args.repo, "apps/nxtgauge-admin-solid/base/kustomization.yaml") elif "ai-assistant" in args.service: kustomization_path = os.path.join(args.repo, "apps/nxtgauge-ai-assistant/overlays/prod/kustomization.yaml") if not os.path.exists(kustomization_path): diff --git a/.gitea/workflows/build.yaml b/.forgejo/workflows/build.yaml similarity index 89% rename from .gitea/workflows/build.yaml rename to .forgejo/workflows/build.yaml index 4b9478d..9257c3a 100644 --- a/.gitea/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -30,6 +30,7 @@ jobs: run: | set -euo pipefail export DOCKER_HOST=unix:///var/run/docker.sock + SHA="$(git rev-parse HEAD)" test -n "$REGISTRY_HOSTPORT" echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY_HOSTPORT" -u "$REGISTRY_USERNAME" --password-stdin @@ -39,11 +40,12 @@ jobs: run: | set -euo pipefail export DOCKER_HOST=unix:///var/run/docker.sock + SHA="$(git rev-parse HEAD)" build_and_push() { docker buildx build --push \ -f Dockerfile \ - -t "$REGISTRY_HOSTPORT/nxtgauge-frontend-solid:${{ gitea.sha }}" \ + -t "$REGISTRY_HOSTPORT/nxtgauge-frontend-solid:${SHA}" \ -t "$REGISTRY_HOSTPORT/nxtgauge-frontend-solid:high-performance-latest" \ . } @@ -72,7 +74,7 @@ jobs: REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} run: | set -euo pipefail - python3 .gitea/scripts/registry_prune.py \ + python3 .forgejo/scripts/registry_prune.py \ --registry "$REGISTRY_HOST" \ --repo "nxtgauge-frontend-solid" \ --username "$REGISTRY_USERNAME" \ @@ -87,6 +89,7 @@ jobs: GITEOPS_SSH_KEY: ${{ secrets.GITEOPS_SSH_KEY }} run: | set -euo pipefail + SHA="$(git rev-parse HEAD)" if [ -z "$GITEOPS_REPO" ]; then echo "GITEOPS_REPO secret not set, skipping GitOps update" @@ -102,10 +105,10 @@ jobs: chmod 600 ~/.ssh/id_ed25519 ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null - python3 .gitea/scripts/update-gitops.py \ + python3 .forgejo/scripts/update-gitops.py \ --repo "$GITEOPS_DIR" \ --service "frontend-solid" \ - --sha "${{ gitea.sha }}" \ - --message "chore: deploy frontend-solid@${{ gitea.sha }}" + --sha "${SHA}" \ + --message "chore: deploy frontend-solid@${SHA}" rm -rf "$GITEOPS_DIR" diff --git a/.gitea/workflows/test.yaml b/.forgejo/workflows/test.yaml similarity index 100% rename from .gitea/workflows/test.yaml rename to .forgejo/workflows/test.yaml diff --git a/.github/workflows/sync-to-gitea.yml b/.github/workflows/sync-to-forgejo.yml similarity index 65% rename from .github/workflows/sync-to-gitea.yml rename to .github/workflows/sync-to-forgejo.yml index a9b0694..31851e5 100644 --- a/.github/workflows/sync-to-gitea.yml +++ b/.github/workflows/sync-to-forgejo.yml @@ -1,8 +1,9 @@ -name: sync-to-gitea +name: sync-to-forgejo on: push: branches: + - main - high-performance jobs: @@ -16,9 +17,9 @@ jobs: with: fetch-depth: 0 - - name: Sync to Gitea + - name: Sync to Forgejo env: - GITEA_TOKEN: ${{ secrets.GITEA_SECRET }} + FORGEJO_TOKEN: ${{ secrets.FORGEJO_SECRET }} REPO: ${{ github.event.repository.name }} BRANCH: ${{ github.ref_name }} run: | @@ -29,18 +30,18 @@ jobs: USER="Admin" TARGET="https://ci.nxtgauge.com/Admin/${REPO}.git" - AUTH="$(printf '%s' "${USER}:${GITEA_TOKEN}" | base64 -w0)" + AUTH="$(printf '%s' "${USER}:${FORGEJO_TOKEN}" | base64 -w0)" - test -n "${GITEA_TOKEN:-}" || (echo "GITEA_TOKEN empty" && exit 1) - curl -fsS -H "Authorization: token ${GITEA_TOKEN}" https://ci.nxtgauge.com/api/v1/user >/dev/null + test -n "${FORGEJO_TOKEN:-}" || (echo "FORGEJO_TOKEN empty" && exit 1) + curl -fsS -H "Authorization: token ${FORGEJO_TOKEN}" https://ci.nxtgauge.com/api/v1/user >/dev/null curl -fsS -H "Authorization: Basic ${AUTH}" "${TARGET}/info/refs?service=git-receive-pack" >/dev/null git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git config --global http.version HTTP/1.1 git config --global http.postBuffer 524288000 - git remote remove gitea 2>/dev/null || true - git remote add gitea "${TARGET}" + git remote remove forgejo 2>/dev/null || true + git remote add forgejo "${TARGET}" - git -c http.extraheader="Authorization: Basic ${AUTH}" push gitea "HEAD:${BRANCH}" --force - git -c http.extraheader="Authorization: Basic ${AUTH}" push gitea --tags --force + git -c http.extraheader="Authorization: Basic ${AUTH}" push forgejo "HEAD:${BRANCH}" --force + git -c http.extraheader="Authorization: Basic ${AUTH}" push forgejo --tags --force diff --git a/TESTING.md b/TESTING.md index 654f054..bd2e9a6 100644 --- a/TESTING.md +++ b/TESTING.md @@ -102,9 +102,9 @@ Visual tests compare screenshots against baselines in `tests/e2e/visual/`. ## CI / Nightly Runs -GitHub Actions runs tests nightly via `.gitea/workflows/test.yaml`: +GitHub Actions runs tests nightly via `.forgejo/workflows/test.yaml`: - **2:30 AM daily** — all test suites -- **On-demand** — use `workflow_dispatch` trigger in Gitea +- **On-demand** — use `workflow_dispatch` trigger in Forgejo Artifacts are uploaded: - `vitest-coverage/` — coverage reports