Add automated LaTeX manual build (refs #12)
Automated Manual Build / manual (push) Successful in 1m27s

This commit is contained in:
2026-10-07 18:56:18 -04:00
parent d4d3c02f05
commit 828f6c555b
70 changed files with 7226 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
*.sh text eol=lf
+85
View File
@@ -0,0 +1,85 @@
# Local Gitea runner (Assignment 5 preparation)
Run from the repository root in PowerShell with Docker Desktop's Linux engine running:
```powershell
.\gitea\local-runner\runner.ps1 -Action Check
.\gitea\local-runner\runner.ps1 -Action Register
.\gitea\local-runner\runner.ps1 -Action Start
.\gitea\local-runner\runner.ps1 -Action Logs
```
Register only when instructed: select the token for the existing group repository
at `https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/settings/actions/runners`.
The script prompts with hidden input and passes the token through stdin. Do not
paste it into chat, source, screenshots, command arguments, or transcripts.
Registration is not performed by the Check action. No token is kept in the
running container's environment. Clear the clipboard after pasting your token.
The stdin wrapper removes CR/LF added by PowerShell's native-command pipeline.
Runner 2.3.0 reads `--token-file` verbatim; without this normalization the
extra line ending causes Gitea to reject an otherwise valid registration token.
The wrapper streams the normalized bytes directly to the runner without a
temporary token file or token-bearing process argument.
Runner identity/API credentials persist in the Docker volume
`ssw590-local-runner-data`, at `/data/.runner`. This is secret runtime state;
never print, export into Git, or screenshot its contents. It is not an evidence file.
## Configuration
- Official runner version verified locally: `v2.3.0`, 2026-10-07.
- Runner image pinned to `sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7`.
- Host: student's Windows computer, Docker Desktop Linux engine.
- Name: `ssw590-vince-local`; capacity 1; scope comes from the selected token.
- Label: `latex-local`; Docker execution; no published ports.
- HTTPS certificate verification remains enabled; cache server disabled.
- The runner reaches Docker's internal socket; `container.docker_host: "-"`
prevents automatic mounting of that socket into job containers.
- Workflows still require trust: runner 2.x does not comprehensively filter
workflow container options. Restrict workflow edit rights to trusted teammates.
- Logs rotate at 10 MB per file with 3 files. Workflow step logs belong in Gitea.
- No automatic restart after Docker restarts: start deliberately before builds.
The job label selects the locally built `ssw590-manual-ci:20261007` image,
which includes Git, Node.js, and the complete TeX Live compiler environment.
See `ci/manual/README.md` for the Dockerfile, tested image ID, workflow,
and local checks. Registration and online status were verified after the
student privately registered the runner; a real Actions job remains pending.
## Evidence checkpoints
1. Check: capture the version and non-secret summary.
2. Start: refresh Gitea's runner page and capture its online status/name/label.
3. Later workflow: capture assigned runner, successful compilation, commit/run
version metadata, artifact download, two changes, failure, and repair.
To stop without removing registration:
```powershell
.\gitea\local-runner\runner.ps1 -Action Stop
```
Do not use `docker compose down -v` unless intentionally retiring the runner;
it deletes the registration volume and would require registration again.
Sources:
- https://docs.gitea.com/runner/2/installation/docker/
- https://docs.gitea.com/runner/2/registration/
- https://docs.gitea.com/runner/2/configuration/
AI assistance: OpenAI Codex prepared these files after the student chose a
local runner and requested setup guidance with screenshot reminders. The student
privately supplied registration input. The agent verified online declaration,
prepared the compiler/workflow, and performed token-free local build checks.
Real job execution and the active assignment chapter are still pending.
Correction, 2026-10-07: the student supplied a sanitized screenshot of a
registration rejection after the preflight check. Inspection of the official
v2.3.0 `register.go` identified untrimmed token-file bytes, and the helper was
corrected to remove PowerShell line endings. A fake-token local HTTP test
verifies what the actual runner sends; it does not register a real runner.
Observed result: the original pipeline sent a token with CR/LF and failed
exact-byte comparison; the corrected wrapper passed exact-byte comparison
with no CR/LF. The test endpoint intentionally rejected both requests after
capturing only the fake value. Temporary test containers/networks were removed.
+22
View File
@@ -0,0 +1,22 @@
services:
runner:
image: docker.io/gitea/runner@sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7
container_name: ssw590-local-runner
working_dir: /data
entrypoint: ["gitea-runner"]
command: ["--config", "/config.yaml", "daemon"]
restart: "no"
volumes:
- runner-data:/data
- ./config.yaml:/config.yaml:ro
- ./register-from-stdin.sh:/register-from-stdin.sh:ro
- /var/run/docker.sock:/var/run/docker.sock
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
volumes:
runner-data:
name: ssw590-local-runner-data
+18
View File
@@ -0,0 +1,18 @@
log:
level: info
runner:
file: /data/.runner
capacity: 1
timeout: 30m
shutdown_timeout: 30s
insecure: false
labels:
- "latex-local:docker://ssw590-manual-ci:20261007"
cache:
enabled: false
container:
privileged: false
valid_volumes: []
# Runner uses Docker Desktop; do not mount its socket into job containers.
docker_host: "-"
force_pull: false
@@ -0,0 +1,6 @@
#!/bin/sh
set -eu
# PowerShell's native-command pipeline appends CR/LF. Runner 2.3.0's
# --token-file reads bytes verbatim, so remove line endings before it reads stdin.
# The token is never put into an argument, environment variable, or disk file.
tr -d '\r\n' | gitea-runner "$@"
+82
View File
@@ -0,0 +1,82 @@
[CmdletBinding()]
param(
[ValidateSet('Check', 'Register', 'Start', 'Logs', 'Stop')]
[string]$Action = 'Check'
)
$ErrorActionPreference = 'Stop'
$composeFile = Join-Path $PSScriptRoot 'compose.yaml'
$composeArgs = @('compose', '--project-name', 'ssw590-local-runner', '-f', $composeFile)
$runnerImage = 'docker.io/gitea/runner@sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7'
$instanceUrl = 'https://git.yebilly.me/'
$runnerName = 'ssw590-vince-local'
function Assert-DockerSuccess([string]$Operation) {
if ($LASTEXITCODE -ne 0) { throw "$Operation failed (exit $LASTEXITCODE)." }
}
Get-Command docker -ErrorAction Stop | Out-Null
$engineType = & docker info --format '{{.OSType}}'
Assert-DockerSuccess 'Docker Desktop connection'
if ($engineType -ne 'linux') { throw 'Switch Docker Desktop to Linux containers first.' }
Write-Host "Docker engine: $engineType"
& docker @composeArgs config --quiet
Assert-DockerSuccess 'Compose configuration'
switch ($Action) {
'Check' {
& docker run --rm --entrypoint gitea-runner $runnerImage --version
Assert-DockerSuccess 'Runner version check'
& docker run --rm --entrypoint wget $runnerImage -q -T 20 -O /dev/null $instanceUrl
Assert-DockerSuccess 'HTTPS connection from runner image to Gitea'
Write-Host 'CHECK PASSED: Docker Linux engine, Compose configuration, runner version, and Gitea HTTPS.'
Write-Host "Name: $runnerName | Label: latex-local | Capacity: 1 | Mode: Docker"
Write-Host 'Scope: determined by the repository registration token you select.'
Write-Host 'SCREENSHOT: capture this summary and the version output; no token is involved.'
}
'Register' {
# Do not overwrite an existing runner identity or start a second daemon.
$registrationState = & docker @composeArgs run --rm -T --no-deps --entrypoint sh runner -c 'if test -s /data/.runner; then echo registered; else echo unregistered; fi'
Assert-DockerSuccess 'Runner registration storage check'
if ($registrationState -eq 'registered') { throw 'Already registered. Use -Action Start instead.' }
if ($registrationState -ne 'unregistered') { throw 'Unexpected runner registration status.' }
Write-Host 'Use the token from repository Settings > Actions > Runners.'
Write-Host 'Do not screenshot the token page or run a transcript during registration.'
$secureToken = Read-Host 'Paste registration token (input is hidden)' -AsSecureString
$tokenPointer = [IntPtr]::Zero
try {
$tokenPointer = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureToken)
$tokenText = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($tokenPointer).Trim()
if ([string]::IsNullOrWhiteSpace($tokenText)) { throw 'Token is empty.' }
# stdin avoids saving the value in a file, command argument, or container environment.
$tokenText | & docker @composeArgs run --rm -T --no-deps --entrypoint sh runner /register-from-stdin.sh --config /config.yaml register --no-interactive --instance $instanceUrl --name $runnerName --token-file /dev/stdin
Assert-DockerSuccess 'Runner registration'
}
finally {
$tokenText = $null
if ($tokenPointer -ne [IntPtr]::Zero) {
[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($tokenPointer)
}
if ($null -ne $secureToken) { $secureToken.Dispose() }
}
Write-Host 'Registered. Run this script with -Action Start, then refresh the Gitea Runners page.'
}
'Start' {
$registrationState = & docker @composeArgs run --rm -T --no-deps --entrypoint sh runner -c 'if test -s /data/.runner; then echo registered; else echo unregistered; fi'
Assert-DockerSuccess 'Runner registration storage check'
if ($registrationState -ne 'registered') { throw 'No existing registration. Run -Action Register first.' }
& docker @composeArgs up -d runner
Assert-DockerSuccess 'Runner start'
& docker @composeArgs ps
Assert-DockerSuccess 'Runner status'
Write-Host 'SCREENSHOT: refresh Gitea Settings > Actions > Runners; capture the online runner and latex-local label, with tokens hidden.'
Write-Host 'Use -Action Logs to watch its output in PowerShell.'
}
'Logs' {
Write-Host 'Ctrl+C stops watching logs; it leaves the runner running.'
& docker @composeArgs logs --follow --tail 100 runner
}
'Stop' {
& docker @composeArgs stop runner
Assert-DockerSuccess 'Runner stop'
Write-Host 'Runner stopped; registration volume retained.'
}
}