Files
vpn-dns-gateway/manual/latex/devopsAutomatedManualBuild.tex
T
vsun1 ed0a862657
vpn-dns-gateway/pipeline/pr-main This commit looks good
Move CI runners to Droplet and enable application HTTPS
2026-11-15 12:49:06 -05:00

394 lines
21 KiB
TeX

\chapter{Automated Manual Build}
\ChapterLabel{AutomatedManualBuild}
\index{Gitea!Actions}
\index{LaTeX!automated compilation}
\index{runner!local Docker runner}
\begingroup
\sloppy
This chapter records Assignment 5, \emph{LaTeX Auto-Compilation with
Gitea -- Group}. Evidence was collected on October 7, 2026. Two successive source pushes produced successful Gitea builds. Run 3 then
failed for the intended LaTeX error. After its removal, run 4 passed and
produced a verified PDF. This version 3.4 source records the complete
success, failure, and repair sequence; final submission artifact review
follows its next successful workflow build.
\section{Source and Trigger}
The existing \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway}{Group 1
Gitea repository} contains the manual under \texttt{manual/latex/}, the
compiler configuration under \texttt{ci/manual/}, and the workflow at
\texttt{.gitea/workflows/manual.yml}. Required figures, the document class,
glossary, bibliography resources, and build helper are included. The existing
application deployment remains under \texttt{deploy/}.
Actions is enabled. A push to \texttt{main} or a branch matching
\texttt{codex/assignment5-*} starts the \texttt{manual} job. Vincent pushed
commit \texttt{828f6c5} on \texttt{codex/assignment5-manual-build}, referencing
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/12}{issue
\#12}. Checkout uses the triggering revision, and the build verifies that the
checked-out SHA equals that revision. Results are available on the
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions}{repository
Actions page}.
The main file is
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/codex/assignment5-manual-build/manual/latex/devopsAssignment.tex}{\texttt{manual/latex/devopsAssignment.tex}};
the \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/codex/assignment5-manual-build/.gitea/workflows/manual.yml}{push workflow}
and \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/codex/assignment5-manual-build/ci/manual/build.sh}{build script}
are versioned alongside it. Vincent commits and pushes from the separate
Gitea checkout in VSCode. Its origin uses HTTPS: the client reaches Caddy on
public TCP port 443; Caddy terminates TLS and forwards the request to Gitea's
private Docker-network port 3000. Git pushes need no public Gitea SSH port.
The runner requests work from the same HTTPS service and has no public
submission listener.
\section{Runner Setup}
This section preserves the October 7 setup. The November migration recorded
at the end of this chapter supersedes its laptop placement and start procedure.
The repository-scoped \gls{build-runner} \texttt{ssw590-vince-local}, version 2.3.0,
runs as Docker container \texttt{ssw590-local-runner} on Vincent's Windows
laptop using Docker Desktop's Linux engine. Its \texttt{latex-local} label
selects the local compiler image \texttt{ssw590-manual-ci:20261007}.
Capacity is one job at a time. The runner uses outbound connections to Gitea
over HTTPS and to GitHub for the pinned Actions; it publishes no ports.
Compilation therefore runs on the laptop while Gitea remains on the droplet.
The runner is separate from the 512\,MiB, 10\,GB droplet to leave its
existing Gitea and Color Buttons services available. Docker execution
creates a temporary job container with TeX installed in its image; the
runner daemon container itself does not compile the document. The compiler
image was built once on this laptop's Docker engine and is reused locally.
Label and capacity settings follow Gitea's runner configuration model.\footnote{\url{https://docs.gitea.com/runner/2/configuration/}}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth,height=0.48\textheight,keepaspectratio]{images/gitea-runnner-vince-running-idle.png}
\caption{October 7, 2026: the registered runner is online and idle, with
repository scope, version 2.3.0, and label \texttt{latex-local}.}
\label{Figure:ManualRunnerOnline}
\end{figure}
The local daemon declared this runner and accepted the repository's task 2
at 23:39:34 UTC (7:39:34 p.m. Eastern), matching the second workflow run.
Message-field excerpts from the actual daemon log are:
\begin{minted}{text}
runner: ssw590-vince-local, with version: v2.3.0, with labels: [latex-local], declare successfully
task 2 repo is ssw590-group1/vpn-dns-gateway https://github.com https://git.yebilly.me/
Running job with maxParallel=1 for 1 matrix combinations
\end{minted}
Registration has already been completed privately. With Docker Desktop
running, these commands from the repository root start, inspect, and stop the
registered runner without registering it again:
\begin{minted}{powershell}
.\gitea\local-runner\runner.ps1 -Action Start
.\gitea\local-runner\runner.ps1 -Action Logs
.\gitea\local-runner\runner.ps1 -Action Stop
\end{minted}
Closing the log terminal does not stop the container. After a laptop or Docker
restart, start Docker Desktop and run \texttt{-Action Start}. Stopping the
runner preserves its registration volume.
\section{Reproducible Compilation}
The versioned Dockerfile supplies TeX Live 2022/Debian, latexmk 4.79,
Pygments, Node.js 22.23.3, and Git 2.39.5. The base image is pinned by digest;
resolved Debian packages are recorded in the diagnostics. A later image
rebuild can resolve newer packages, so the tested local image is retained.
Its image ID is:
\begin{minted}{text}
sha256:5d24657a4578977fc7709165b82fc869f09a654a58ab4a0c8defd9d2cd662d5d
\end{minted}
The workflow invokes the versioned build entry point:
\begin{minted}{sh}
sh ci/manual/build.sh
\end{minted}
The script compiles a disposable source copy under
\texttt{build/manual/intermediate}. It generates build metadata there and
uses latexmk with shell escape for minted, glossary and acronym generation, index
processing, and the required final cross-reference passes. Earlier PDF and
checksum deliverables are removed before compilation. A compiler error or
missing/empty PDF causes failure; the PDF upload also fails if its expected
file is absent. Diagnostics are uploaded even after a compilation failure.
Inside the disposable source directory, the build script runs:
\begin{minted}{sh}
latexmk -r "$repo_root/ci/manual/latexmkrc" -pdf -shell-escape \
-interaction=nonstopmode -halt-on-error -file-line-error \
devopsAssignment.tex
\end{minted}
The expected deliverable is
\texttt{build/manual/2026F-SSW-590-DevOps-Group-1.pdf}. The image contains the
manual's fonts and LaTeX packages plus the bibliography, glossary, acronym,
and index tools. The bibliography resources are retained; bibliography
processing is conditional because the active main file currently disables
its bibliography. The job checks out source from Gitea and uploads artifacts
over HTTPS. It shares no source directory or compiler installation with the
Gitea application container.
\section{PDF Version Traceability}
The human document version is maintained in source. Actions appends the run
number and triggering short commit, producing versions such as
\texttt{3.1+build.1.828f6c5}. Generated metadata is not committed, so it does
not create a push loop.
\begin{tabularx}{\linewidth}{L{3.2cm}Y}
\caption{Verified first successful build, October 7, 2026\label{Table:ManualRunOne}}\\
\toprule \textbf{Record} & \textbf{Observed value}\\ \midrule
Source commit & \texttt{828f6c555b0d3a9bcf611a5097207e3942dfda11}\\
Workflow run & 1, successful\\
Visible PDF version & \texttt{3.1+build.1.828f6c5}\\
PDF artifact & \texttt{manual-pdf-build-1}\\
Diagnostics artifact & \texttt{manual-diagnostics-build-1}\\
Downloaded PDF & \texttt{2026F-SSW-590-DevOps-Group-1.pdf}, 100 pages\\
\bottomrule
\end{tabularx}
The first PDF still displays the Assignment 4 title because that title was in
the triggering source. Figure~\ref{Figure:ManualFirstPDF} preserves that
original result. The second source change corrected the title to Assignment 5
and produced version \texttt{3.2+build.2.0ca3beb}. The repair push produced
\texttt{3.3+build.4.b68425b}. This evidence update uses human version 3.4;
its next workflow injects its own actual run and commit values. Generated
metadata is never copied into the versioned source.
\section{Downloadable Artifact}
Figure~\ref{Figure:ManualWorkflowRunOne} shows successful checkout,
compilation, and both artifact uploads. The workflow requests 14-day \gls{build-artifact}
retention, subject to server policy. Vincent downloaded the PDF and
diagnostics ZIPs and saved them under \texttt{build/evidence/run-1/}.
The extracted PDF matches the PDF inside its artifact ZIP and the SHA-256
recorded in the diagnostics:
\begin{minted}{text}
9468fa2803611a09f8f832a5631489413e9ab29254d0ae77e53d43fecd9463f0
\end{minted}
For a matching download, open Actions, select the successful run, and click
its named PDF artifact. Extract the ZIP and open the PDF. For example,
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/2}{\texttt{manual-pdf-build-2} on run 2}
contains the opened PDF in Figure~\ref{Figure:ManualSecondPDF}. Its
106-page file matches its ZIP contents and the diagnostics checksum:
\begin{minted}{text}
b5db51d3b7a94d47f9cc96876d6c82dea7a65e9862970bf2926c69b0bffca109
\end{minted}
The two successful runs' original PDFs, ZIPs, and diagnostics are retained
under \texttt{build/evidence/run-1/} and \texttt{build/evidence/run-2/}.
Artifacts can expire or be deleted; the 14-day setting is not a permanent
backup. Gitea documents artifact upload and retention separately from Git
source history.\footnote{\url{https://docs.gitea.com/usage/actions/artifacts/}}
These original downloads are retained locally and ignored by Git. A final
submission PDF must be downloaded from a successful workflow after the
remaining assignment work is recorded.
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/gitea-actions-workflow-verification.png}
\caption{October 7, 2026: Gitea run 1 completed successfully and lists the
PDF and diagnostics artifacts. Screenshot supplied by Vincent.}
\label{Figure:ManualWorkflowRunOne}
\end{figure}
\begin{figure}[p]
\centering
\includegraphics[width=0.72\linewidth,height=0.72\textheight,keepaspectratio]{images/gitea-runner-pdf-first-run.png}
\caption{October 7, 2026: opened PDF from the first successful workflow,
showing version \texttt{3.1+build.1.828f6c5}. Its Assignment 4 title is
preserved as historical run-1 evidence. Screenshot supplied by Vincent.}
\label{Figure:ManualFirstPDF}
\end{figure}
\clearpage
\section{Change, Failure, and Repair Evidence}
\begin{tabularx}{\linewidth}{L{1.0cm}L{1.8cm}L{1.8cm}Y}
\caption{Actual source-change, failure, and repair results, October 7, 2026\label{Table:ManualBuildSequence}}\\
\toprule \textbf{Run} & \textbf{Commit} & \textbf{Result} & \textbf{Visible PDF / artifact}\\ \midrule
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/1}{1} &
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/828f6c555b0d3a9bcf611a5097207e3942dfda11}{\texttt{828f6c5}} & Success &
\texttt{3.1+build.1.828f6c5}; \texttt{manual-pdf-build-1}\\
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/2}{2} &
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/0ca3bebe3efbf5a9e433ec30abb22d9a901f66cb}{\texttt{0ca3beb}} & Success &
\texttt{3.2+build.2.0ca3beb}; \texttt{manual-pdf-build-2}\\
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/3}{3} &
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/1d2822f8a32c56e946e51fce532c309dafb05867}{\texttt{1d2822f}} & Intended failure & No PDF artifact; \texttt{manual-diagnostics-build-3} retained\\
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/4}{4} &
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/b68425ba13b93b07888602160c773b19595194b8}{\texttt{b68425b}} & Repaired &
\texttt{3.3+build.4.b68425b}; \texttt{manual-pdf-build-4}\\
\bottomrule
\end{tabularx}
The first push added the automated build. The next source change updated the
assignment title and added first-run evidence. Both expected successful
builds passed, and their commit/run identifiers match the downloaded PDFs.
Figure~\ref{Figure:ManualWorkflowRunTwo} shows the second run and both
artifacts; Figure~\ref{Figure:ManualSecondPDF} shows its updated title and
version.
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/gitea-actions-second-run-success.png}
\caption{October 7, 2026: run 2 passed after the second source change and
uploaded \texttt{manual-pdf-build-2} and its diagnostics.}
\label{Figure:ManualWorkflowRunTwo}
\end{figure}
\begin{figure}[p]
\centering
\includegraphics[width=0.72\linewidth,height=0.72\textheight,keepaspectratio]{images/gitea-runner-pdf-second-run.png}
\caption{October 7, 2026: downloaded run-2 PDF opens with the Assignment 5
title and visible version \texttt{3.2+build.2.0ca3beb}.}
\label{Figure:ManualSecondPDF}
\end{figure}
\clearpage
For the controlled test, Vincent committed and pushed a temporary error on
\texttt{codex/assignment5-manual-build}, immediately before the main
document begins:
\begin{minted}{latex}
\errmessage{Assignment 5 intentional compilation failure test}
\end{minted}
\textbf{Expected:} compilation fails, the job is red, no PDF is uploaded,
and diagnostics remain available. \textbf{Actual:} run 3 did exactly this
(Figure~\ref{Figure:ManualIntentionalFailure}). Its downloaded diagnostics
identify commit \texttt{1d2822f}, run 3, the deliberate error at source
line 117, and a compiler return code of 1. The diagnostic ZIP contains
build information, package versions, and compilation output; it contains no
PDF or PDF checksum. The retained compiler output includes:
\begin{minted}{text}
./devopsAssignment.tex:117: Assignment 5 intentional compilation failure test.
Latexmk: Errors, so I did not complete making targets
pdflatex: Command for 'pdflatex' gave return code 1
\end{minted}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/gitea-actions-intentional-failure.png}
\caption{October 7, 2026: run 3 failed at compilation, skipped PDF upload,
and retained only the diagnostics artifact, as expected.}
\label{Figure:ManualIntentionalFailure}
\end{figure}
\textbf{Repair verified:} Vincent removed the temporary error and pushed
commit \texttt{b68425b}. Run 4 completed checkout, compilation, PDF upload,
and diagnostics upload successfully (Figure~\ref{Figure:ManualRepairWorkflow}).
Vincent downloaded both artifacts into \texttt{build/evidence/run-4/} and
opened the 113-page PDF. Its title displays
\texttt{3.3+build.4.b68425b} (Figure~\ref{Figure:ManualRepairPDF}), matching
the full revision \texttt{b68425ba13b93b07888602160c773b19595194b8} and run 4 in
\texttt{build-info.txt}. The extracted PDF is byte-for-byte equal to the
PDF inside \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/4}{\texttt{manual-pdf-build-4} on run 4};
its SHA-256 matches \texttt{pdf-sha256.txt} in the diagnostics:
\begin{minted}{text}
2f921289d77fd72e9805df3c423a5ddc3ed784e8b71deb174f31bf8f4abf03a4
\end{minted}
The expected outcome after repair was a green job and a newly generated PDF;
run 4 demonstrated both. The failure and repair affected manual sources and
evidence only; the application deployment files were unchanged. HTTPS
checks after run 4 returned HTTP 200 from both
\url{https://git.yebilly.me} (Gitea) and
\url{https://colors.yebilly.me} (Color Buttons App), confirming that both
public sites still responded. These are reachability checks; no load test
or additional application functional test was performed.
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/gitea-actions-repair-success.png}
\caption{October 7, 2026: repaired run 4 passed all steps and uploaded the
PDF and diagnostics artifacts. Screenshot supplied by Vincent.}
\label{Figure:ManualRepairWorkflow}
\end{figure}
\begin{figure}[p]
\centering
\includegraphics[width=0.72\linewidth,height=0.72\textheight,keepaspectratio]{images/gitea-runner-pdf-repair.png}
\caption{October 7, 2026: opened PDF from repair run 4, showing version
\texttt{3.3+build.4.b68425b}. Screenshot supplied by Vincent.}
\label{Figure:ManualRepairPDF}
\end{figure}
\clearpage
For a queued job, check Docker Desktop, the runner's online status, and the
\texttt{latex-local} label. For a failed build, download the diagnostics ZIP
from that run and read \texttt{compile-console.txt}; identify the reported
file and line, correct the source, commit, and push the repair. Check that
the repaired run is green and download its new PDF. Do not reuse a PDF from
an earlier run as evidence that the repair passed.
\section{Runner and Secret Boundary}
\index{runner!secret boundary}
Only trusted group members should edit branches that trigger this runner.
Workflow code and minted shell escape execute code on the build environment.
The runner can control Docker Desktop through its Docker socket, which gives
it substantial authority over the laptop. Job containers are not privileged;
the configuration disables automatic mounting of that socket into jobs.
Registration state stays in the named Docker volume
\texttt{ssw590-local-runner-data}, outside Git. No registration token or runner
identity contents appear in this chapter or its screenshots. The workflow
requests read access to repository contents and needs no cloud account secret.
The repository is public, but access to edit and push workflow-covered code
is restricted to authorized group contributors; public visibility does not
make external workflow changes trusted. Non-secret
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/codex/assignment5-manual-build/gitea/local-runner/config.yaml}{runner configuration}
and its
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/codex/assignment5-manual-build/gitea/local-runner/compose.yaml}{Compose configuration}
are versioned. Runner 2.x does not filter all workflow container options, so
these settings do not make it suitable for untrusted workflows.
The Docker privilege boundary still depends on trusting workflow editors.
Registration token input was private; persistent runner identity remains in
\texttt{/data/.runner} inside the named volume, never in the repository.
\section{Manual Quality and Controls}
This draft records human version 3.4 and dated run-1/run-2, failure, and
successful repair evidence,
and assistance in Document History and \ChapterRef{AIPromptLog}. Earlier
assignment chapters retain their historical results. Both controls in
\ChapterRef{HostsPasswords} are updated: the Hosts section adds the local
runner, and the Passwords table adds a hints-only runner identity record.
No credential values are included. Relevant runner and build-artifact terms
appear in the glossary and index. The success/failure/repair evidence is
complete through run 4. After this evidence update is pushed, the group must
review the resulting successful workflow PDF and retain that final artifact
for submission. Pull-request review/merge and issue \#12 closure are still
pending; no approval or submission is claimed here.
\textbf{Status update, October 22, 2026:} the pending steps above have since
completed.
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/13}{PR~\#13}
was merged and issue \#12 is closed (re-checked in Gitea on October 22), and
the merged-\texttt{main} workflow run~6 passed (verified by Vincent on
October 21). The paragraph above is kept as the version 3.4 record.
\section{November 2026 Runner Migration}
On November 14 Vincent requested moving this runner to the existing 2\,GiB
The-Ocean droplet for the final demonstration. Codex stopped the laptop daemon,
transferred the same compiler image with archive checksum and image-ID checks,
and streamed the existing registration over pinned SSH directly into a protected
Docker volume. No registration value entered the repository or output. The
historical name \texttt{ssw590-vince-local} and label \texttt{latex-local} remain;
the active container is \texttt{ssw590-manual-runner}. Repository scope is unchanged.
The first 96 MiB daemon trial exceeded its memory cap during action setup and
restarted. Its attempt was canceled and retained as failure evidence. With the
daemon raised to 192 MiB RAM / 256 MiB RAM+swap and 0.25 CPU, the
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/12/jobs/14}{run 12 attempt 3 job}
passed checkout, compilation and both uploads in 4m32s (compilation 1m42s).
It rebuilt reviewed main commit \texttt{8beefde}, not Assignment 8's uncommitted
preparation. Diagnostics and the retrieved PDF checksum match; the opened title
shows \texttt{5.1+build.12.8beefde}. This is migration evidence, not an Assignment 8 release.
Compiler jobs have separate 512/768 MiB RAM/RAM+swap, 0.5 CPU and 256 PID
caps. No host port or job Docker socket mount is added. TLS checks remain
enabled. New-job admission pauses below 600 MiB available host RAM or 3 GiB
free disk; it does not reserve resources or coordinate Jenkins. Run manual
builds and delivery releases sequentially. The runner still has administrative
Docker authority over the shared host, so workflow editors remain trusted.
The daemon uses \texttt{unless-stopped}; idle restart/reconnect passed at
04:55:52 UTC on November 15 (the request was November 14 Eastern).
\path{gitea/droplet-runner/README.md} records operations and fallback;
\path{gitea/droplet-runner/EVIDENCE.md} links the dated evidence. The original
laptop identity/image are retained but inactive. Its helper requires
\texttt{-AllowLaptopFallback} after stopping the remote copy. VS maintains the
runner and BY the host; no new cloud instance or resize was made. Hosts and
hints-only Passwords tables reflect current placement.
\endgroup