Files
devops-it-manual/devopsGiteaActions.tex
reviewer 1df4798a31
manual-pdf / build-manual (push) Successful in 1m17s
Complete Gitea Actions manual build evidence
2026-10-13 15:19:44 -04:00

172 lines
12 KiB
TeX

\chapter{Automated LaTeX Manual Builds with Gitea Actions}
\ChapterLabel{GiteaActions}
\index{Gitea Actions}
\index{LaTeX automation}
\index{build artifact}
\index{runner}
\section{Source and Trigger}
This chapter records the corrected Chapter 3 assignment from the Version 1.18 startup DevOps manual: the team manual must build automatically from source in Gitea Actions \cite{GiteaActionsQuickstart,GiteaActionsArtifacts,GiteaRunnerDocker,GiteaRunnerLabels,LatexmkCtan,TexLiveTug}. The older Chapter 3 manual treated Jenkins as the next assignment; in Version 1.18 Jenkins moved to Chapter 4, while Chapter 3 became the automated LaTeX manual-build assignment. The Jenkins work is preserved in \ChapterRef{Jenkins}; this chapter adds the missing Gitea Actions path.
\begin{devopsNote}[Evidence Summary]
The manual source was mirrored into the Gitea repository \texttt{group10-startup/devops-it-manual}, and Gitea Actions built the PDF with the registered runner \texttt{sergio-windows-latex-runner}. The evidence set includes successful main-branch builds, a controlled failed LaTeX build, and a repaired passing build. The runner uses a Windows host label because the existing \texttt{512 MB} Droplet did not have enough practical disk and memory headroom for a full TeX Live job-container image.
\end{devopsNote}
\begin{longtable}{L{4.1cm}L{9.1cm}}
\caption{Source and Trigger Configuration\label{Table:GiteaActionsSource}}\\
\toprule
\textbf{Item} & \textbf{Configured or Verified Value}\\
\midrule
\endfirsthead
\toprule
\textbf{Item} & \textbf{Configured or Verified Value}\\
\midrule
\endhead
\bottomrule
\endlastfoot
Manual repository source & \url{https://git.sespinal590.dev/group10-startup/devops-it-manual}.\\
Main file & \texttt{devopsAssignment.tex}.\\
Workflow file & \texttt{.gitea/workflows/manual-pdf.yml}.\\
Selected branch and event & Pushes to \texttt{main} and \texttt{chapter3-failure-test}; manual dispatch is also allowed for controlled reruns.\\
Git submission path & HTTPS Git push to \texttt{https://git.sespinal590.dev/group10-startup/devops-it-manual.git}. The browser and Git client reach Caddy on TCP \texttt{443}, and Caddy forwards private traffic to Gitea on container port \texttt{3000}.\\
Runner public exposure & No runner submission port is exposed. The runner requests work from Gitea over HTTPS and does not publish Docker, runner management, or build-agent ports to the internet.\\
\end{longtable}
\section{Runner Setup}
The live runner is a self-managed Gitea Actions runner registered as \texttt{sergio-windows-latex-runner}. The runner advertises the label \texttt{windows-latex-host}. This was selected after testing the Droplet path: a small TeX image was insufficient for the manual build, and the full LaTeX image was not a good fit for the \texttt{512 MB} Gitea Droplet with about \texttt{1.7 GB} free disk at the time of setup.
\begin{longtable}{L{4.1cm}L{9.1cm}}
\caption{Runner Setup Evidence\label{Table:GiteaActionsRunner}}\\
\toprule
\textbf{Item} & \textbf{Status or Value}\\
\midrule
\endfirsthead
\toprule
\textbf{Item} & \textbf{Status or Value}\\
\midrule
\endhead
\bottomrule
\endlastfoot
Runner name & \texttt{sergio-windows-latex-runner}.\\
Runner label & \texttt{windows-latex-host}.\\
Execution mode & Host runner on Sergio's Windows workstation.\\
Toolchain & Local MiKTeX with \texttt{latexmk}, Git, Node.js, and Python/Pygments for \texttt{minted}.\\
Registration scope & Repository runner registered with a Gitea token generated for setup and kept outside the repository.\\
Rejected runner path & Docker execution on the Gitea Droplet was tested and rejected for this assignment because the Droplet was too constrained for a full TeX Live build image.\\
Live registration status & Complete. The runner accepted jobs for runs \texttt{3}, \texttt{4}, \texttt{6}, and \texttt{7}.\\
\end{longtable}
\section{Reproducible Compilation}
The workflow checks out the triggering revision, writes generated build metadata, runs \texttt{latexmk}, and fails if \texttt{devopsAssignment.pdf} is missing or empty. The Windows host runner uses \texttt{cmd} steps so the generated Gitea action scripts are not blocked by local PowerShell execution policy.
\begin{lstlisting}[caption={Manual PDF workflow build command},label={Listing:GiteaActionsBuildCommand}]
latexmk -norc -pdf -shell-escape -interaction=nonstopmode ^
-halt-on-error devopsAssignment.tex
if not exist devopsAssignment.pdf exit /b 1
for %%A in (devopsAssignment.pdf) do if %%~zA EQU 0 exit /b 1
\end{lstlisting}
\begin{longtable}{L{4.1cm}L{9.1cm}}
\caption{Reproducible Compilation Controls\label{Table:GiteaActionsCompilation}}\\
\toprule
\textbf{Control} & \textbf{Implementation}\\
\midrule
\endfirsthead
\toprule
\textbf{Control} & \textbf{Implementation}\\
\midrule
\endhead
\bottomrule
\endlastfoot
Runner selector & \texttt{runs-on: windows-latex-host}.\\
Build command & \texttt{latexmk -norc -pdf -shell-escape -interaction=nonstopmode -halt-on-error devopsAssignment.tex}.\\
Main output & \texttt{devopsAssignment.pdf}.\\
Failure detection & The workflow uses \texttt{-halt-on-error}, then checks that \texttt{devopsAssignment.pdf} exists and has nonzero size.\\
Compiler location & The Windows runner host performs the compile; the Gitea application container only stores source, workflow state, and logs.\\
\end{longtable}
\section{PDF Version Traceability}
The manual includes \texttt{devopsBuildMetadata.tex}. In local builds, that file defines safe fallback values. During Actions builds, the workflow overwrites it with the triggering commit hash, workflow run number, and run attempt. The footer displays the normal human version plus the generated build identifier.
\begin{lstlisting}[caption={Generated metadata written during Actions build},label={Listing:GiteaActionsMetadata}]
\providecommand{\BuildIdentifier}{local-unverified}
\renewcommand{\BuildIdentifier}{+build.<run-number>.<short-sha>}
\renewcommand{\SourceRevision}{<short-sha>}
\renewcommand{\WorkflowRunNumber}{<run-number>}
\renewcommand{\WorkflowRunAttempt}{<run-attempt>}
\end{lstlisting}
The workflow does not commit generated metadata back to the repository. That avoids a push/build loop while still making each downloaded PDF traceable to the commit and run that produced it.
\begin{longtable}{L{2.0cm}L{3.3cm}L{2.5cm}L{4.8cm}}
\caption{Observed Gitea Actions Build Evidence\label{Table:GiteaActionsRuns}}\\
\toprule
\textbf{Run} & \textbf{Branch} & \textbf{Conclusion} & \textbf{Evidence}\\
\midrule
\endfirsthead
\toprule
\textbf{Run} & \textbf{Branch} & \textbf{Conclusion} & \textbf{Evidence}\\
\midrule
\endhead
\bottomrule
\endlastfoot
\texttt{3} & \texttt{main} & Success & Commit \texttt{f15d65c}; PDF built as \texttt{devopsAssignment.pdf} with reported output size \texttt{1575428} bytes and artifact upload completed.\\
\texttt{4} & \texttt{main} & Success & Commit \texttt{ca620f9}; second main-branch source change built successfully.\\
\texttt{6} & \texttt{chapter3-failure-test} & Failure & Commit \texttt{2d879a8}; controlled source-level LaTeX failure confirmed the workflow fails broken manual source.\\
\texttt{7} & \texttt{chapter3-failure-test} & Success & Commit \texttt{6ca37f1}; repair commit removed the deliberate failure and rebuilt successfully.\\
\end{longtable}
\section{Downloadable Artifact}
The workflow uploads the compiled manual as a named artifact from successful runs. The artifact name includes the run number and commit SHA so the downloaded PDF can be matched to the Gitea Actions page.
\begin{longtable}{L{4.1cm}L{9.1cm}}
\caption{PDF Artifact Configuration\label{Table:GiteaActionsArtifact}}\\
\toprule
\textbf{Item} & \textbf{Value}\\
\midrule
\endfirsthead
\toprule
\textbf{Item} & \textbf{Value}\\
\midrule
\endhead
\bottomrule
\endlastfoot
Artifact source path & \texttt{devopsAssignment.pdf}.\\
Artifact naming pattern & \texttt{devops-it-manual-<run-number>-<commit-sha>}.\\
Retention setting & \texttt{14} days in the workflow. This is an artifact retention setting, not a backup policy.\\
Verified upload evidence & Run \texttt{3} uploaded \texttt{devops-it-manual-3-f15d65cc7490253c310a80973d92b20b272598d1}; the log reported a successful upload and finalized compressed artifact of \texttt{1413101} bytes.\\
Download note & The artifact is downloaded from the Gitea Actions run page for the matching successful run. The API artifact-list endpoint did not return a separate list during verification, so the manual records the successful upload log as the primary evidence.\\
\end{longtable}
\section{Change, Failure, and Repair Evidence}
The Chapter 3 workflow now has the required behavior pattern. Main branch runs \texttt{3} and \texttt{4} demonstrate repeatable successful manual builds after source changes. The branch \texttt{chapter3-failure-test} demonstrates failure and repair: run \texttt{6} failed after the source intentionally introduced \texttt{\textbackslash undefinedChapterThreeFailureTestCommand}, and run \texttt{7} passed after the repair commit removed that line. This proves the workflow is not only uploading a PDF when source is valid, but also stopping the pipeline when source is broken.
\section{Runner and Secret Boundary}
Runner registration tokens, Gitea tokens, repository secrets, and SSH keys were kept outside the repository. Workflow edit rights should be limited to trusted team members because workflow code executes commands in the runner environment. The runner does not require any inbound firewall rule. The only temporary inbound change needed during this setup was SSH access for administration of the Droplet; after setup, SSH should be restricted again to the operator's current IP address.
\section{Manual Quality and Controls}
\begin{longtable}{L{4.4cm}L{2.0cm}L{6.8cm}}
\caption{Chapter 3 Rubric Evidence Status\label{Table:GiteaActionsRemainingWork}}\\
\toprule
\textbf{Rubric Criterion} & \textbf{Status} & \textbf{Evidence or Gap}\\
\midrule
\endfirsthead
\toprule
\textbf{Rubric Criterion} & \textbf{Status} & \textbf{Evidence or Gap}\\
\midrule
\endhead
\bottomrule
\endlastfoot
Versioned source and push-triggered workflow & Complete & Manual source is in \texttt{group10-startup/devops-it-manual}; workflow \texttt{manual-pdf.yml} triggers on covered branch pushes.\\
Registered runner and documented execution environment & Complete & Runner \texttt{sergio-windows-latex-runner} with label \texttt{windows-latex-host} completed live Gitea Actions jobs.\\
Reproducible LaTeX compilation and failure detection & Complete & The workflow runs \texttt{latexmk} with \texttt{-halt-on-error} and checks for a nonempty PDF. Run \texttt{6} confirmed failure detection.\\
Visible commit/run version traceability in the PDF & Complete & Actions builds rewrite \texttt{devopsBuildMetadata.tex} with run number, attempt, and commit hash for the PDF footer.\\
Downloadable, verified PDF artifact & Complete with note & Artifact upload completed in the successful run log. The Gitea API artifact listing did not expose a separate artifact list during verification.\\
Two builds plus controlled failure and repair & Complete & Runs \texttt{3} and \texttt{4} passed on \texttt{main}; run \texttt{6} failed intentionally; run \texttt{7} passed after repair.\\
Runner permissions and secret boundary & Complete & Tokens were kept outside source control; no runner management port is exposed publicly.\\
Versioned IT manual, history, tables, and evidence & Complete & Version, history, citations, glossary/index terms, workflow, tables, run evidence, and troubleshooting notes are included.\\
\end{longtable}
\begin{devopsNote}[Troubleshooting Procedure]
If a Gitea Actions build does not start, check that Actions are enabled for the repository, the workflow file is under \texttt{.gitea/workflows/}, the push targets a covered branch, and the runner is online with the label \texttt{windows-latex-host}. If the build starts but fails, inspect the \texttt{latexmk} log, confirm \texttt{devopsBuildMetadata.tex} was generated, and verify that \texttt{devopsAssignment.pdf} exists before artifact upload.
\end{devopsNote}