Files
myfileagent-pipeline/documentation/devopsAutomatedManualBuild.tex
T

197 lines
12 KiB
TeX
Raw 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]
Human version \texttt{1.7.1}; document date October 6, 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 is recorded separately as it completes.
\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 existing grading apps on 5050/8080 and the
instructor-approved key-only SSH exception were preserved.
\begin{figure}[htbp]
\centering
\begin{tikzpicture}[node distance=10mm, every node/.style={draw,rounded corners,align=center,font=\small,text width=3.7cm},>=Stealth]
\node (team) {Team source push\\HTTPS 443};
\node[right=of team] (gitea) {Caddy $\rightarrow$ Gitea\\private backend 3000};
\node[below=of gitea] (runner) {Repository runner\\one job; Docker socket};
\node[left=of runner] (job) {Temporary TeX container\\checkout, compile, upload};
\node[below=of job] (pdf) {Named PDF artifact\\download for submission};
\draw[->] (team)--(gitea);
\draw[<->] (gitea)--node[right,draw=none,text width=1.8cm]{HTTPS work requests}(runner);
\draw[->] (runner)--(job);
\draw[->] (job)--(pdf);
\draw[->,dashed] (job)--node[above,sloped,draw=none,text width=3.2cm]{HTTPS source and artifact}(gitea);
\end{tikzpicture}
\caption{Actual single-Droplet manual-build path. Only the runner mounts the
Docker socket; 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
\texttt{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. The \texttt{manual-latex} label uses
\texttt{docker://} execution with the exact local compiler image ID below.
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 \path{python3 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. See the retained job logs and 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 human-maintained version stays \texttt{1.7.1}. 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 title and \hyperref[Build:Identity]{Build Identity page}
show the values of this PDF. 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}
On success, the artifact name is
\texttt{assignment5-1.7.1-run-RUN-FULLSHA}; it contains the PDF and JSON
manifest. Open the matching \href{\BuildRunURL}{Actions run}, 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}.
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.
\section{Change, failure, and repair evidence}
% BEGIN BUILD EVIDENCE
The two source-change builds and the isolated LaTeX failure/repair sequence
are pending at this first source-import stage. The infrastructure preflight
is not counted as a manual build. No manual result is inferred from it.
% END BUILD EVIDENCE
\section{Runner and secret boundary}
\index{runner!security}\index{Docker socket}
The repository's Owners team may change workflows; preflight found no direct
collaborators and no branch-protection rules. Peer review is a team procedure,
not an enforced gate for this assignment. 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.
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. \ChapterRef{DocumentHistory} 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.