Files

265 lines
19 KiB
TeX
Raw Permalink Normal View History

\chapter{Automated Manual Build}
\ChapterLabel{AutomatedManualBuild}
\index{Gitea Actions}\index{LaTeX!automated build}\index{build artifact}
\begin{devopsNote}[Assignment 5 implementation record]
2026-10-07 21:36:36 +00:00
Human version \texttt{1.7.1}; document date October 7, 2026. The team authorized
Chapter 3 implementation on its existing Droplet. Jenkins (instruction Chapter 4)
is outside this activity. Infrastructure checks below are observed results;
the manual build sequence below records the executed results.
\end{devopsNote}
\section{Source and trigger}
The source of truth is the existing
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline}{MyFileAgent repository}.
The entry point is
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/documentation/main.tex}{\path{documentation/main.tex}};
chapter sources, \texttt{cornell.cls}, bibliography, formatting files and all
historical figures are included. The transferred source archive had SHA-256
\path{ad93f9f2e71bc66a2b882b57510cbb7f51827637047073d6a6f78c0170e6205e}.
Its 12 \path{hw4_images} files preserve earlier evidence. Generated PDFs,
metadata, caches and secrets are excluded from source control.
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/.gitea/workflows/manual-pdf.yml}{The manual workflow}
accepts \texttt{push} events on \texttt{main} and
\texttt{manual-build-validation}. It explicitly checks out the triggering SHA
and disables persisted checkout credentials. Pushes use Git over HTTPS to
\texttt{myfileagent.tech:443}. Caddy 2.11.4 terminates TLS and forwards to Gitea
1.27.3 on private container port 3000. The host mapping remains
\texttt{127.0.0.1:3000}. No Gitea SSH port, runner submission listener or
compiler port was published. The runner needs no public submission port because
source pushes terminate at Gitea, while the runner initiates outbound HTTPS
requests to Gitea to poll for and receive jobs.
\begin{figure}[htbp]
\centering
\begin{tikzpicture}[node distance=9mm and 7mm,
every node/.style={draw,rounded corners,align=center,font=\small,text width=3.0cm,minimum height=15mm},>=Stealth]
\node (team) {Team\\HTTPS source push};
\node[right=of team] (gitea) {Caddy 443\\Gitea private 3000};
\node[right=of gitea] (runner) {Runner\\HTTPS work requests};
\node[below=of runner] (docker) {Docker daemon\\internal socket};
\node[left=of docker] (job) {Temporary TeX job\\checkout and compile};
\node[left=of job] (pdf) {Named PDF artifact\\team downloads};
\draw[->] (team)--(gitea);
\draw[->] (gitea)--(runner);
\draw[->] (runner)--(docker);
\draw[->] (docker)--(job);
\draw[->] (job)--(pdf);
\draw[<->,dashed] (gitea)--(job);
\end{tikzpicture}
\caption{Actual single-Droplet manual-build path. Only the runner mounts the
Docker socket. The dashed HTTPS path carries source checkout and artifact upload; Gitea and the compiler do not share a source filesystem.}
\label{Fig:ManualBuildArchitecture}
\end{figure}
\section{Runner setup}
\phantomsection\label{GlossaryRef:actionsrunner}\index{runner!registration}
Runner ID 1, \texttt{assignment5-manual}, is registered only to
\path{myfileagent/myfileagent-pipeline}. The self-managed
\texttt{act\_runner} version is 0.6.1. Its image digest is
\path{sha256:b5c35d6bdbb9bb25e531230bfc7cc663cb751406cbec90a2a891b85fea54de86}.
The live files are under \path{/home/codex/myfileagent-gitea/runner};
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/manual-build}{versioned non-secret configuration}
records the deployment. \textbf{Execution mode: Docker container execution
(\texttt{docker://}).} Each job runs in a temporary TeX container created by
the host Docker daemon, rather than directly in the runner environment.
The workflow's \texttt{runs-on: manual-latex} selects the runner label, which
maps to the exact local compiler image ID recorded below. The runner polls
Gitea over outbound HTTPS, and the job uses HTTPS for checkout and upload.
Capacity is one job. The runner has a 192 MiB hard memory limit and 128 MiB Go
memory target; jobs have a 256 MiB limit, no swap, 0.65 CPU and a 256-process
limit. The initial 96 MiB runner limit caused an out-of-memory restart while
cloning an action in run 1; its temporary container and volumes were removed.
Increasing the bounded limit allowed run 2 to pass without another restart.
\EvidenceID{MAN-RUNNER-01}: October 6, 2026, America/New\_York
(UTC log timestamps may be October 7). Expected: registered online worker,
HTTPS reachability and an assigned job. Actual: the repository runner API
reported ID 1 online; \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/2}{preflight run 2}
was assigned to this worker and succeeded. Its downloaded text artifact
verified HTTPS certificate validation and blocked direct connections from the
job to private backend \texttt{172.20.0.2:3000} and gateway
\texttt{172.20.0.1:3000}. The job had no Docker socket, runner-state mount or
published ports. This is a measured bridge boundary, not a claim that every
outbound destination is blocked. Runner registration and execution follow
Gitea's documented model~\cite{GiteaActRunnerManual}.
\section{Reproducible compilation}
TeX is installed in the temporary job image, not the Gitea application
container. \path{ops/manual-build/Dockerfile} pins Debian by digest and its
packages to the October 1, 2026 Debian snapshot. The built local image is
\path{sha256:579106aaffa81dc2436a72a5dbfc51d3590f1a97646321fd38c694aae6d7cba1}
(1.32 GB); \texttt{force\_pull: false} selects this stored immutable image ID.
A replacement host must rebuild from the recorded definition and update the
recorded image ID after verification. Dependencies include TeX Live 2022,
latexmk 4.79, BibTeX, makeindex/makeglossaries, Latin Modern and recommended
fonts, Pygments 2.14.0 for minted, Node 18.20.4 and pypdf 3.4.1.
The job runs \texttt{python3} \path{documentation/ci/build_manual.py}. The helper copies
sources into a fresh temporary directory and invokes:
\begin{lstlisting}[language=bash]
latexmk -pdf -shell-escape -interaction=nonstopmode \
-halt-on-error -file-line-error main.tex
\end{lstlisting}
latexmk coordinates repeated PDF, bibliography and index passes. This report
uses authored, linked glossary/acronym lists; their label references are
resolved by repeated LaTeX passes rather than a generated glossary printout.
Shell escape is required by minted and is restricted to trusted source in the
job container. The helper verifies that checkout HEAD equals the triggering
SHA, removes prior publish targets, propagates a compiler failure, rejects
missing/empty/unreadable PDFs, verifies visible metadata, and rejects unresolved
references/citations or duplicate labels. Only success copies
\path{documentation/build/main.pdf} and \path{build-manifest.json} for upload.
The original manual was precompiled in a separate temporary container before
relying on Actions. The successful Actions records below are the authoritative
publication evidence. The \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/9}{successful run 9}
provides its compile-step log; the \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/9/jobs/9}{successful job log}
records checkout, latexmk passes, PDF validation and upload. See also the
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/documentation/ci/build_manual.py}{build helper}.
\section{PDF version traceability}
\phantomsection\label{GlossaryRef:buildidentity}\index{build identity}
The Assignment 5 builds below used human version \texttt{1.7.1};
the current manual is version \texttt{1.8.2}. The helper writes an
uncommitted \path{build-metadata.tex} with a suffix
\texttt{+build.RUN.SHORTSHA.attempt.ATTEMPT}, full Git commit, run number and
clickable run URL. The downloaded workflow PDFs visibly contain that run identity. The
current \hyperref[Build:Identity]{Build Identity page} identifies this edition
separately; a local review build is not an Actions publication. Metadata is produced in the temporary workspace;
no workflow step commits or pushes generated version changes. This avoids a
push/build loop. A local compile instead says \texttt{+local.unverified} and
must not be presented as an Actions artifact. The manifest correlates full
commit, run/attempt, PDF checksum and page count. The checkout and artifact
actions are pinned to tested commits, not floating tags~\cite{GiteaActionsComparisonManual}.
\section{Downloadable artifact}
\phantomsection\label{GlossaryRef:buildartifact}\index{artifact!retention}
For the historical Assignment 5 builds, the artifact name is
\texttt{assignment5-1.7.1-run-RUN-FULLSHA}; it contains the PDF and JSON
manifest. Open the matching \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/4}{recorded successful run 4}, select that named
artifact, download its ZIP and extract \texttt{main.pdf}. Retention is
explicitly requested as 14 days, rather than relying on the server default;
expiration enforcement has not yet been observed. Keep the submitted PDF
outside this temporary retention window~\cite{GiteaActionsConfigManual}.
Artifacts are temporary build outputs, not permanent backups.
Checkout v4.2.2 is pinned to
\path{11bd71901bbe5b1630ceea73d27597364c9af683}; upload-artifact v3.2.2 to
\path{c6a366c94c3e0affe28c06c8df20a878f24da3cf}. The latter's legacy artifacts
are available from the run's named download link even though the newer REST
artifact-list endpoint returned no entries in the preflight. The direct
preflight artifact download was verified, including ZIP checksum and contents.
Manual artifact downloads and visible PDF checks are recorded below.
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/4/artifacts/assignment5-1.7.1-run-4-2b8be117c7c9b2a074cc7fbfcf152e34d0e65b2a}{Download the recorded run-4 PDF artifact}.
The current Assignment 6 workflow uses artifact name
\texttt{assignment6-1.8.2-run-RUN-FULLSHA}. For this edition, use
\href{\BuildRunURL}{the matching Actions publication run} and
\href{\BuildRunURL/artifacts/assignment6-\DocumentVersion-run-\BuildRun-\BuildCommit}{its named PDF and manifest artifact}.
The Build Identity page supplies the exact commit and run number injected by
that run. Extract \texttt{main.pdf} from the ZIP and compare its checksum to
\texttt{build-manifest.json}; the artifact has the same 14-day retention.
\section{Change, failure, and repair evidence}
% BEGIN BUILD EVIDENCE
All observations below were made on October 6, 2026 (America/New\_York). Logs use UTC, where these runs are dated October 7. These are actual push-triggered manual builds, separate from infrastructure preflight runs 1--2.
\paragraph{Source change 1.}
\EvidenceID{MAN-BUILD-01}: Imported the full manual and activated its workflow. Expected: a successful full build and downloadable PDF with the triggering revision. Actual: \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/3}{run 3 passed}; full commit \path{c74087a93bf53b44a75a25c3658fc178ff253225}.
Visible version: \path{1.7.1+build.3.c74087a.attempt.1}; 72 pages. The \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/3/artifacts/assignment5-1.7.1-run-3-c74087a93bf53b44a75a25c3658fc178ff253225}{named PDF and manifest artifact} was downloaded, opened with a PDF parser, and its PDF SHA-256 matched the manifest:
\path{ab99995751da7a67684d97e32344cfc8d7f3d0c6c26055bbd0670b3dc030d337}.
\paragraph{Source change 2.}
\EvidenceID{MAN-BUILD-02}: Improved long-identifier wrapping and clarified the introduction. Expected: a successful full build and downloadable PDF with the triggering revision. Actual: \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/4}{run 4 passed}; full commit \path{2b8be117c7c9b2a074cc7fbfcf152e34d0e65b2a}.
Visible version: \path{1.7.1+build.4.2b8be11.attempt.1}; 72 pages. The \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/4/artifacts/assignment5-1.7.1-run-4-2b8be117c7c9b2a074cc7fbfcf152e34d0e65b2a}{named PDF and manifest artifact} was downloaded, opened with a PDF parser, and its PDF SHA-256 matched the manifest:
\path{ba87740958bada14f31d2236638c9b175d8b24797f715252cdb0f0af6668be06}.
\paragraph{Controlled failure.}
\EvidenceID{MAN-FAIL-01}: Expected: an invalid LaTeX command fails compilation and publishes no PDF. Actual: \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/5}{run 5 failed} for commit \path{f0e7b74ee63b40811334ee9cd4aecf035f1b0864}, on \texttt{manual-build-validation}. The deliberate \texttt{\string\AssignmentFiveControlledFailure} command caused ``Undefined control sequence'' at chapter line 4; latexmk returned 12. The workflow skipped PDF upload and the expected named artifact returned HTTP 404. Main and the deployed services remained operational.
\paragraph{Repair.}
\EvidenceID{MAN-REPAIR-01}: Removed the deliberate undefined command on the validation branch. Expected: a successful full build and downloadable PDF with the triggering revision. Actual: \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/6}{run 6 passed}; full commit \path{a4737f1a4eed5e1b786038bb917ca1ab9f1ed856}.
Visible version: \path{1.7.1+build.6.a4737f1.attempt.1}; 72 pages. The \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/6/artifacts/assignment5-1.7.1-run-6-a4737f1a4eed5e1b786038bb917ca1ab9f1ed856}{named PDF and manifest artifact} was downloaded, opened with a PDF parser, and its PDF SHA-256 matched the manifest:
\path{7591b1cd87f319dfc77eaa4ca9fd9727d1e7b97253a05d9a93e8624296bc736e}.
The artifact name for each successful row is \texttt{assignment5-1.7.1-run-} followed by the run number, a hyphen and the full commit above. The run links and artifact links therefore identify the same source revision; version suffixes use its first seven hex digits. Full machine-readable records and downloaded PDF checksums are retained in \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/manual-build/manual-build-evidence.json}{the versioned evidence manifest}. The controlled error was confined to the validation branch and its repair restored the exact source content of the second successful build.
Visual inspection of the downloaded run-4 chapter identified overlapping architecture labels; the final source corrects the diagram. Each Actions publication uses its own visible Build Identity and matching run.
The current review edition must not inherit the identity of an earlier artifact. Download verification of that final artifact is performed after publication, without editing the PDF or creating an automatic source commit loop.
% END BUILD EVIDENCE
\section{Runner and secret boundary}
\index{runner!security}\index{Docker socket}
The repository's Owners team may change workflows. The historical Assignment 5
preflight found no direct collaborators and no branch-protection rules; peer
review was then a team procedure rather than an enforced gate. This is not
the current policy: Assignment 6 subsequently enforced the required Jenkins
status check and peer approval on main, with bypass disabled, as documented
in \ChapterRef{JenkinsContinuousIntegration}. Only trusted team pushes to the
selected branches execute. Untrusted pull-request triggers are not enabled.
The runner controls the host Docker socket and therefore has powerful host
access; containers are not a security boundary against a malicious trusted
workflow author or Docker administrator. Jobs receive no socket or runner-state
mount; \texttt{valid\_volumes: []}, \texttt{docker\_host: '-'}, nonprivileged
execution and the separate bridge reduce accidental exposure. These controls
are recorded in the non-secret
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/manual-build/runner-config.yaml}{runner configuration}
and \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/manual-build/runner-compose.yaml}{runner Compose file};
the \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/.gitea/workflows/manual-pdf.yml}{workflow}
records trusted push triggers and checkout permissions.
Registration state is stored outside Git in a mode-700 directory, with its
\texttt{.runner} file mode 600. Registration tokens were passed without logging
their values. A temporary implementation token has \texttt{write:repository}
scope and resides in restricted storage outside Git; that scope covers the
account's accessible repositories and is not a per-repository credential.
It is not passed to build jobs. Checkout uses the Actions job credential with
read-only workflow permissions and removes persisted Git credentials.
The \hyperref[Table:CredentialRegistry]{Passwords table} contains hints only.
\section{Manual quality and controls}
The \hyperref[Table:HostRegistry]{Hosts table} now identifies the runner,
compiler execution and ports. The \hyperref[Table:CredentialRegistry]{Passwords
table} now identifies protected runner state and the temporary implementation
credential without values. \hyperref[Chapter:DocumentHistory]{Document History} and
\AppendixRef{AIPromptLog} record the work and retain earlier attribution.
Figure~\ref{Fig:ManualBuildArchitecture}, linked glossary/index terms and
citations connect the operational record to its configuration and evidence.
The MyFileAgent team owns this single-Droplet runner. Preflight measured one
CPU, 961 MiB RAM, about 292 MiB available memory, no swap and 18 GiB free disk;
after the compiler image build about 17 GiB remained. No paid resize or new
machine was purchased. Existing cloud/domain charges and transfer allowances
were not re-audited; do not assume perpetual free service. Historical domain,
firewall, backup and instructor-exception evidence remains in
\ChapterRef{GiteaStartupFoundation}.
For a queued job, inspect branch trigger, Actions enablement, runner online
state and label. For a compile failure, read the first LaTeX error in the
matching job log, repair the source and push again. For absent artifacts,
confirm PDF existence, upload success and the legacy run download link before
assuming the REST listing is complete. Check memory/disk before retrying.
Stop only the added runner using its separate Compose project for recovery;
this leaves Gitea and the grading apps running. On retirement, remove runner
ID 1 through repository settings, revoke temporary credentials, and remove
only identified runner/job storage after preserving submission evidence.
Do not prune all Docker storage on this shared host.
\subsection*{Instruction Section 3.5 evidence coverage}
All eight requested evidence areas are retained in Sections 10.1--10.8:
source/trigger links and ports; registered runner and assigned run 2;
toolchain, commands and successful compilation log; generated commit/run
identity; named artifacts and download verification; successive builds 3/4,
failed run 5 and repaired run 6; runner/token boundary; and document controls,
registry hints and troubleshooting. These are dated historical observations.
The Build Identity page distinguishes an Actions publication from a local
review compile. Section 3.5 requires the final submitted PDF to be downloaded
from a successful workflow; use the current run and artifact links in
Section 10.5, rather than assigning an earlier artifact's identity to this
edition. Preserve the downloaded PDF outside the 14-day artifact window.