Files
portal/.gitea/workflows/backfill.yml
T
Bendik Aagaard LynghaugandClaude Sonnet 5 3a2a19b79b
Deploy / deploy (push) Successful in 31s
Add manually-triggered backfill workflow, no terminal/sudo needed
Runs backfill_events using secrets.PORTAL_NATS_URL directly from the
CI job's own env (same source deploy.yml's env-write step already
uses) - avoids needing a sudo'd terminal session to read
/etc/app/uhhm-portal.env's secrets off disk just to run a one-time
migration tool. workflow_dispatch only, defaults to dry run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-06 10:09:08 +02:00

45 lines
1.5 KiB
YAML

name: Backfill events (one-time)
# Manual only (workflow_dispatch, no push trigger) - this is a one-time
# migration, not something that should run on every deploy. Runs the
# same backfill_events binary (src/bin/backfill_events.rs) that would
# otherwise need a `sudo`'d terminal session on the host to read
# /etc/app/uhhm-portal.env's secrets - the CI job already has them
# natively via secrets.PORTAL_NATS_URL, same source deploy.yml's
# "Write service env" step uses, so nothing needs reading off disk at
# all. Defaults to a dry run; check "apply" to actually write.
on:
workflow_dispatch:
inputs:
apply:
description: "Actually write (unchecked = dry run, writes nothing)"
type: boolean
default: false
jobs:
backfill:
runs-on: bare
env:
CARGO_HOME: /var/local/cargo
RUSTUP_HOME: /var/local/rustup
PATH: /var/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin
SCCACHE_DIR: /var/local/sccache
SCCACHE_SERVER_PORT: "4228"
CARGO_TARGET_DIR: /var/local/cargo-target
NATS_URL: ${{ secrets.PORTAL_NATS_URL }}
steps:
- uses: actions/checkout@v4
- name: Build backfill_events
run: cargo build --release --features ssr --bin backfill_events
- name: Run backfill
run: |
set -euo pipefail
if [ "${{ inputs.apply }}" = "true" ]; then
"$CARGO_TARGET_DIR/release/backfill_events" --apply
else
"$CARGO_TARGET_DIR/release/backfill_events"
fi