Gitea workflow: auto-pull server-infra on Act runner after master changes #1

Closed
opened 2026-07-11 08:15:43 -07:00 by westfarn · 0 comments
Owner

Summary

Add a .gitea/workflows/ job in this repo that keeps the Act runner checkout in sync with master. When a commit lands on master (direct push or merged PR), the workflow should git pull the latest into ~/Documents/repos/server-infra on ai-server-4080 (the Gitea Act runner / control node).

Today the runner relies on a manual checkout at that path (see IMPLEMENTATION.md — runner requirements). CI deploy jobs will drift if inventory, playbooks, or scripts change on master but the runner copy is stale.

Motivation

  • deploy-apps.yml and future CI deploy steps read playbooks + inventory from the local checkout.
  • Changes merged to server-infra should be picked up automatically without SSH-ing to ai-server-4080 to pull by hand.
  • Self-sync on merge avoids chicken-and-egg: this workflow lives in the repo it updates.

Proposed workflow

File: .gitea/workflows/sync-checkout.yml (name flexible)

Triggers:

  • push to master
  • pull_request closed + merged into master (optional redundancy; push on merge may suffice)

Runner: self-hosted Act runner on ai-server-4080 (runs-on: self-hosted or org-specific label — match however the runner is registered).

Steps (sketch):

name: Sync runner checkout

on:
  push:
    branches: [master]
  pull_request:
    types: [closed]
    branches: [master]

jobs:
  sync:
    if: github.event_name == 'push' || github.event.pull_request.merged == true
    runs-on: self-hosted
    steps:
      - name: Pull latest server-infra
        run: |
          cd ~/Documents/repos/server-infra
          git fetch origin master
          git checkout master
          git pull --ff-only origin master

Adjust event context keys to Gitea Actions equivalents if they differ from GitHub (github.* vs gitea.*).

Acceptance criteria

  • Workflow file added under .gitea/workflows/
  • Runs on push to master and on merged PRs targeting master
  • Executes only on the ai-server-4080 Act runner (not app hosts)
  • Updates ~/Documents/repos/server-infra to the triggering commit (fast-forward pull)
  • Fails loudly if the working tree is dirty or pull is not fast-forward (no silent overwrite of local changes)
  • Documented briefly in IMPLEMENTATION.md (Gitea Act Runner section or Implementation Order table)

Notes

  • Checkout path must match control-node layout: ~/Documents/repos/server-infra (same as Ansible install / galaxy steps in docs).
  • Runner user needs read access to this repo (deploy key at gitea_key_path on ai-server-4080 may already cover this).
  • This is sync only — not a full deploy. App deploy via deploy-apps.yml remains a separate workflow/ticket (#9 in implementation order).
  • Consider git pull --ff-only to avoid merge commits on the runner.

Related

  • IMPLEMENTATION.md — Gitea Act Runner, Phase 2 CI Deploy
  • Implementation order item 9: stub deploy-apps.yml + app repo workflows
## Summary Add a `.gitea/workflows/` job in this repo that keeps the Act runner checkout in sync with `master`. When a commit lands on `master` (direct push or merged PR), the workflow should `git pull` the latest into `~/Documents/repos/server-infra` on **ai-server-4080** (the Gitea Act runner / control node). Today the runner relies on a manual checkout at that path (see `IMPLEMENTATION.md` — runner requirements). CI deploy jobs will drift if inventory, playbooks, or scripts change on `master` but the runner copy is stale. ## Motivation - `deploy-apps.yml` and future CI deploy steps read playbooks + inventory from the local checkout. - Changes merged to `server-infra` should be picked up automatically without SSH-ing to ai-server-4080 to pull by hand. - Self-sync on merge avoids chicken-and-egg: this workflow lives in the repo it updates. ## Proposed workflow **File:** `.gitea/workflows/sync-checkout.yml` (name flexible) **Triggers:** - `push` to `master` - `pull_request` closed + merged into `master` (optional redundancy; push on merge may suffice) **Runner:** self-hosted Act runner on ai-server-4080 (`runs-on: self-hosted` or org-specific label — match however the runner is registered). **Steps (sketch):** ```yaml name: Sync runner checkout on: push: branches: [master] pull_request: types: [closed] branches: [master] jobs: sync: if: github.event_name == 'push' || github.event.pull_request.merged == true runs-on: self-hosted steps: - name: Pull latest server-infra run: | cd ~/Documents/repos/server-infra git fetch origin master git checkout master git pull --ff-only origin master ``` Adjust event context keys to Gitea Actions equivalents if they differ from GitHub (`github.*` vs `gitea.*`). ## Acceptance criteria - [ ] Workflow file added under `.gitea/workflows/` - [ ] Runs on push to `master` and on merged PRs targeting `master` - [ ] Executes only on the ai-server-4080 Act runner (not app hosts) - [ ] Updates `~/Documents/repos/server-infra` to the triggering commit (fast-forward pull) - [ ] Fails loudly if the working tree is dirty or pull is not fast-forward (no silent overwrite of local changes) - [ ] Documented briefly in `IMPLEMENTATION.md` (Gitea Act Runner section or Implementation Order table) ## Notes - Checkout path must match control-node layout: `~/Documents/repos/server-infra` (same as Ansible install / galaxy steps in docs). - Runner user needs read access to this repo (deploy key at `gitea_key_path` on ai-server-4080 may already cover this). - This is **sync only** — not a full deploy. App deploy via `deploy-apps.yml` remains a separate workflow/ticket (#9 in implementation order). - Consider `git pull --ff-only` to avoid merge commits on the runner. ## Related - `IMPLEMENTATION.md` — Gitea Act Runner, Phase 2 CI Deploy - Implementation order item 9: stub `deploy-apps.yml` + app repo workflows
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/server-infra#1