gitea-runner: stack + playbook for self-hosted Actions
Central runner on ana-docker (gitea is local; existing fleet tooling already SSHes from there). Playbook is parameterized so future site-local runners (nh3-docker, esh-docker-vm) drop in via --var overrides instead of copy-paste. Includes a workflow template for vh/task-board that calls the existing deploy-task-board.yaml playbook — keeps the playbook as the single source of truth for "how task-board is deployed", manual or automated. Labels embed `:docker://node:20-bookworm-slim` schema; without it, act_runner v0.6+ silently falls back to host-mode and runs job steps inside the Alpine runner container (no apt/python/node), breaking any real workflow. node:20-bookworm-slim is small + has git + node so actions/checkout works out of the box.
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
# Gitea Actions workflow for task-board.
|
||||
#
|
||||
# THIS FILE LIVES IN THE TASK-BOARD REPO, NOT HERE.
|
||||
# Copy to vh/task-board:.gitea/workflows/deploy.yaml and commit.
|
||||
#
|
||||
# What it does on every push to main (and on manual workflow_dispatch):
|
||||
# 1. Checks out task-board itself (the triggering repo).
|
||||
# 2. Checks out vh/esh-pfi-infrastructure to pick up the elway
|
||||
# playbook and helper scripts.
|
||||
# 3. Configures SSH so elway can reach ana-docker.
|
||||
# 4. Runs `scripts/elway ana-docker --playbook playbooks/deploy-task-board.yaml`
|
||||
# pinning to the commit SHA that triggered the workflow.
|
||||
#
|
||||
# Required Actions secrets (configure under
|
||||
# https://gitea.phasefinal.com/vh/task-board/settings/actions/secrets,
|
||||
# or org-level for reuse across repos):
|
||||
#
|
||||
# DEPLOY_SSH_KEY Private SSH key whose pubkey is in
|
||||
# ~lkraven/.ssh/authorized_keys on ana-docker.
|
||||
# Used by the runner to invoke the elway playbook.
|
||||
# Generate fresh; don't reuse a personal key.
|
||||
#
|
||||
# MGMT_REPO_TOKEN Gitea PAT (read:repository scope) on
|
||||
# vh/esh-pfi-infrastructure, used to clone the
|
||||
# management repo. Generate at
|
||||
# https://gitea.phasefinal.com/-/user/settings/applications.
|
||||
|
||||
name: Deploy task-board
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
# `pfi-fleet` matches the central runner on ana-docker. Pin to
|
||||
# `ana-docker` instead if you want to refuse running on a future
|
||||
# site-local runner.
|
||||
runs-on: pfi-fleet
|
||||
|
||||
# Debian image picked because the elway playbook uses python3 +
|
||||
# pyyaml (Debian package: python3-yaml). Keeps the install step short.
|
||||
container:
|
||||
image: debian:bookworm-slim
|
||||
|
||||
steps:
|
||||
- name: Install playbook prerequisites
|
||||
run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y --no-install-recommends \
|
||||
python3 python3-yaml openssh-client ca-certificates curl git
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
- name: Checkout task-board (triggering repo)
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout management repo (eshpfi-management)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: vh/esh-pfi-infrastructure
|
||||
token: ${{ secrets.MGMT_REPO_TOKEN }}
|
||||
path: _mgmt
|
||||
|
||||
- name: Configure SSH to ana-docker
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
# The DEPLOY_SSH_KEY secret is the full private key contents,
|
||||
# newline-terminated. ssh refuses keys that aren't 0600.
|
||||
printf '%s\n' "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
|
||||
# ssh_config alias so elway resolves "ana-docker" the same
|
||||
# way it would on a workstation. accept-new is fine for a
|
||||
# fresh job container — host key gets cached for the lifetime
|
||||
# of this job only.
|
||||
cat > ~/.ssh/config <<'EOF'
|
||||
Host ana-docker
|
||||
HostName 10.250.50.70
|
||||
User lkraven
|
||||
IdentityFile ~/.ssh/id_ed25519
|
||||
StrictHostKeyChecking accept-new
|
||||
EOF
|
||||
chmod 600 ~/.ssh/config
|
||||
|
||||
- name: Deploy task-board (elway playbook, pinned to this commit)
|
||||
working-directory: _mgmt
|
||||
run: |
|
||||
scripts/elway ana-docker \
|
||||
--playbook playbooks/deploy-task-board.yaml \
|
||||
--var ref=${{ github.sha }}
|
||||
Reference in New Issue
Block a user