Build DevOps IT Manual / Compile LaTeX PDF (push) Failing after 10s
383 lines
9.7 KiB
TeX
383 lines
9.7 KiB
TeX
|
|
\chapter{Automated LaTeX Manual Builds with Gitea Actions}
|
|
\label{ch:actions}
|
|
|
|
\noindent\textbf{Evidence status:}
|
|
The self-hosted Gitea Actions runner has been registered,
|
|
configured, and successfully used to compile and publish
|
|
the LaTeX manual as a downloadable workflow artifact.
|
|
Additional source-change and failure-repair demonstrations
|
|
are still pending.
|
|
|
|
\section{Source and Trigger}
|
|
|
|
The source-of-truth repository for this project is:
|
|
|
|
\begin{center}
|
|
\url{https://git.nageshwaran.dev/SSW590-Startup/startup-product}
|
|
\end{center}
|
|
|
|
The main LaTeX document is located at
|
|
\texttt{manual/main.tex}. Chapter files are maintained
|
|
in the \texttt{manual/chapters/} directory.
|
|
|
|
The automated workflow is defined in:
|
|
|
|
\begin{center}
|
|
\texttt{.gitea/workflows/manual-build.yml}
|
|
\end{center}
|
|
|
|
The workflow is configured to execute when changes are
|
|
pushed to the \texttt{main} branch. It also supports
|
|
manual execution using \texttt{workflow\_dispatch}.
|
|
|
|
This ensures that the documentation can be rebuilt
|
|
automatically from the repository's source files.
|
|
|
|
\section{Runner Setup}
|
|
|
|
A self-hosted Gitea Actions runner was installed and
|
|
registered on a macOS computer rather than on the
|
|
DigitalOcean Droplet.
|
|
|
|
The runner was configured as follows:
|
|
|
|
\begin{itemize}
|
|
\item Runner name: \texttt{macbook-latex-runner}
|
|
\item Runner version: \texttt{v5.0.0}
|
|
\item Runner label: \texttt{latex-build}
|
|
\item Host operating system: macOS on Apple Silicon
|
|
\item Container engine: Docker through Colima
|
|
\item Execution environment: Linux AMD64 Docker container
|
|
\end{itemize}
|
|
|
|
The DigitalOcean Droplet continues to host the Gitea
|
|
server, while the MacBook performs the computationally
|
|
intensive LaTeX compilation.
|
|
|
|
This separation reduces resource usage on the
|
|
memory-constrained Droplet.
|
|
|
|
The runner uses a custom Docker image named:
|
|
|
|
\begin{center}
|
|
\texttt{ssw590-texlive-node:1.0}
|
|
\end{center}
|
|
|
|
This image contains Node.js, npm, TeX Live, and latexmk.
|
|
|
|
The runner configuration includes:
|
|
|
|
\begin{verbatim}
|
|
runner:
|
|
labels:
|
|
- "latex-build:docker://ssw590-texlive-node:1.0"
|
|
|
|
container:
|
|
docker_host: "-"
|
|
options: "--platform linux/amd64"
|
|
\end{verbatim}
|
|
|
|
The Docker host setting prevents the macOS Colima socket
|
|
from being mounted into the job container.
|
|
|
|
The runner successfully connected to Gitea and executed
|
|
the automated manual build.
|
|
|
|
\section{Reproducible Compilation}
|
|
|
|
The automated build uses a custom Docker image derived
|
|
from the following pinned TeX Live image:
|
|
|
|
\begin{verbatim}
|
|
ghcr.io/xu-cheng/texlive-full@
|
|
sha256:c06416ebbc69c8e90e07d1f1a6f7a3f9b334e773daa3543ce879ea533317c3a7
|
|
\end{verbatim}
|
|
|
|
The custom image installs Node.js and npm using Alpine
|
|
Linux's \texttt{apk} package manager.
|
|
|
|
The installed tool versions were verified as:
|
|
|
|
\begin{itemize}
|
|
\item Node.js: \texttt{v24.18.1}
|
|
\item npm: \texttt{11.12.1}
|
|
\item latexmk: \texttt{4.88}
|
|
\end{itemize}
|
|
|
|
The LaTeX document is compiled using:
|
|
|
|
\begin{verbatim}
|
|
latexmk -pdf -interaction=nonstopmode \
|
|
-halt-on-error -file-line-error main.tex
|
|
\end{verbatim}
|
|
|
|
The workflow checks that the generated PDF exists
|
|
and is nonempty before uploading it.
|
|
|
|
The base TeX Live image is pinned by digest. The custom
|
|
image is built locally and identified by its local tag;
|
|
its final image digest has not yet been recorded.
|
|
|
|
\subsection{Automated Build Verification}
|
|
|
|
The self-hosted Gitea Actions runner successfully executed
|
|
the automated LaTeX compilation workflow.
|
|
|
|
The successful workflow completed the following steps:
|
|
|
|
\begin{enumerate}
|
|
\item Started the Docker job container.
|
|
\item Checked out the source repository.
|
|
\item Generated build metadata.
|
|
\item Compiled the LaTeX document.
|
|
\item Uploaded the generated PDF artifact.
|
|
\end{enumerate}
|
|
|
|
The verified successful execution completed in
|
|
approximately 20 seconds and produced one downloadable
|
|
PDF artifact.
|
|
|
|
This successful execution was a rerun of an existing
|
|
workflow, so separate push-triggered demonstrations
|
|
are documented in the following testing section.
|
|
|
|
\section{PDF Version Traceability}
|
|
|
|
The human-maintained document version is
|
|
\texttt{\ManualVersion}.
|
|
|
|
The automated workflow generates a build identifier
|
|
using the workflow run number and the triggering
|
|
Git commit's abbreviated SHA.
|
|
|
|
The identifier follows this format:
|
|
|
|
\begin{verbatim}
|
|
v1.3+build.<run-number>.<short-commit-sha>
|
|
\end{verbatim}
|
|
|
|
The workflow writes this information to a generated
|
|
\texttt{build\_metadata.tex} file before compiling
|
|
the document.
|
|
|
|
The current PDF contains the following metadata:
|
|
|
|
\noindent\textbf{Build identifier:}
|
|
\BuildIdentifier
|
|
|
|
\noindent\textbf{Triggering commit:}
|
|
\BuildCommit
|
|
|
|
\noindent\textbf{Workflow run number:}
|
|
\BuildRun
|
|
|
|
\noindent\textbf{Workflow attempt:}
|
|
\BuildAttempt
|
|
|
|
\medskip
|
|
|
|
This metadata allows a generated PDF to be traced
|
|
back to the corresponding repository commit and
|
|
workflow execution.
|
|
|
|
The generated metadata file is not intended to be
|
|
committed to the source repository.
|
|
|
|
\section{Downloadable Artifact}
|
|
|
|
After successful compilation, the workflow copies
|
|
the generated PDF to the distribution directory.
|
|
|
|
The resulting file is named:
|
|
|
|
\begin{center}
|
|
\texttt{SSW590-DevOps-IT-Manual.pdf}
|
|
\end{center}
|
|
|
|
The workflow uploads this file using
|
|
\texttt{actions/upload-artifact@v4}.
|
|
|
|
The artifact is published under the name:
|
|
|
|
\begin{center}
|
|
\texttt{SSW590-DevOps-IT-Manual}
|
|
\end{center}
|
|
|
|
The workflow specifies an artifact retention period
|
|
of 14 days.
|
|
|
|
The upload action is configured to fail if the
|
|
expected PDF file does not exist.
|
|
|
|
The verified successful workflow published one
|
|
downloadable artifact through the Gitea Actions
|
|
interface.
|
|
|
|
\subsection{Push-Triggered Build Validation}
|
|
|
|
A source-code change was committed and pushed to the
|
|
main branch to verify automatic workflow execution.
|
|
|
|
The first successful push-triggered build used commit
|
|
\texttt{7be302d} and Gitea Actions run number 3.
|
|
|
|
The workflow completed successfully in 21 seconds
|
|
and published one downloadable PDF artifact.
|
|
|
|
This confirms that a repository push automatically
|
|
triggers the LaTeX compilation and artifact upload
|
|
process without requiring manual workflow execution.
|
|
|
|
\section{Change, Failure, and Repair}
|
|
|
|
The automated workflow must be tested using
|
|
source changes and a controlled compilation failure.
|
|
|
|
The following table records the current status
|
|
of these demonstrations.
|
|
|
|
\begin{longtable}{
|
|
p{.19\linewidth}
|
|
p{.24\linewidth}
|
|
p{.24\linewidth}
|
|
p{.23\linewidth}
|
|
}
|
|
\toprule
|
|
Test & Commit & Run / PDF & Result \\
|
|
\midrule
|
|
\endfirsthead
|
|
|
|
\toprule
|
|
Test & Commit & Run / PDF & Result \\
|
|
\midrule
|
|
\endhead
|
|
|
|
Successful push 1
|
|
& PENDING
|
|
& PENDING
|
|
& Not yet tested \\
|
|
|
|
Successful push 2
|
|
& PENDING
|
|
& PENDING
|
|
& Not yet tested \\
|
|
|
|
Controlled TeX failure
|
|
& PENDING
|
|
& PENDING
|
|
& Not yet tested \\
|
|
|
|
Repair push
|
|
& PENDING
|
|
& PENDING
|
|
& Not yet tested \\
|
|
|
|
\bottomrule
|
|
\end{longtable}
|
|
|
|
The first two tests will verify that modifying
|
|
LaTeX source files and pushing commits to
|
|
\texttt{main} automatically triggers successful builds.
|
|
|
|
The failure test will introduce a deliberate
|
|
LaTeX syntax error and verify that the workflow
|
|
reports a compilation failure.
|
|
|
|
The repair test will remove the syntax error
|
|
and confirm that the next workflow execution
|
|
successfully generates a new PDF artifact.
|
|
|
|
Each test must be supported by the corresponding
|
|
commit identifier, workflow run, and screenshot.
|
|
|
|
\section{Runner and Secret Boundary}
|
|
|
|
The Gitea Actions runner executes repository-defined
|
|
workflow commands inside Docker containers.
|
|
|
|
Therefore, workflow modification permissions must
|
|
be restricted to trusted repository maintainers.
|
|
|
|
The runner registration file is stored locally
|
|
and protected using restrictive file permissions.
|
|
|
|
Registration tokens, credentials, and private keys
|
|
must never be committed to the repository or
|
|
included in screenshots.
|
|
|
|
The workflow does not require privileged Docker
|
|
execution or access to the host Docker socket
|
|
from inside the job container.
|
|
|
|
The runner uses the following configuration:
|
|
|
|
\begin{verbatim}
|
|
container:
|
|
docker_host: "-"
|
|
privileged: false
|
|
\end{verbatim}
|
|
|
|
This reduces unnecessary container access to
|
|
the host Docker environment.
|
|
|
|
Because the runner operates on a personal computer,
|
|
untrusted pull requests and workflow changes should
|
|
not be executed without review.
|
|
|
|
\section{Manual Quality and Controls}
|
|
|
|
The automated documentation workflow improves
|
|
repeatability by generating a PDF from version-controlled
|
|
LaTeX source files.
|
|
|
|
The implementation provides:
|
|
|
|
\begin{itemize}
|
|
\item Version-controlled documentation source.
|
|
\item Automated workflow execution.
|
|
\item A self-hosted Gitea Actions runner.
|
|
\item A Docker-based LaTeX build environment.
|
|
\item PDF build metadata and commit traceability.
|
|
\item Downloadable PDF artifacts.
|
|
\item Automated failure reporting.
|
|
\end{itemize}
|
|
|
|
\subsection{Troubleshooting}
|
|
|
|
The following issues were encountered during setup:
|
|
|
|
\begin{enumerate}
|
|
\item The runner initially attempted to mount
|
|
the macOS Colima Docker socket into a Linux
|
|
container. This was addressed using
|
|
\texttt{docker\_host: "-"}.
|
|
|
|
\item The original TeX Live container did not
|
|
contain Node.js, preventing
|
|
\texttt{actions/checkout@v4} from executing.
|
|
|
|
\item A custom Docker image was created with
|
|
Node.js, npm, TeX Live, and latexmk.
|
|
|
|
\item The first Dockerfile used
|
|
\texttt{apt-get}, which was unavailable because
|
|
the TeX Live image uses Alpine Linux.
|
|
|
|
\item The Dockerfile was corrected to use
|
|
\texttt{apk add --no-cache nodejs npm}.
|
|
|
|
\item The runner configuration was updated
|
|
to use the custom Docker image.
|
|
\end{enumerate}
|
|
|
|
Following these corrections, the automated
|
|
workflow completed successfully and produced
|
|
a downloadable PDF artifact.
|
|
|
|
The final submission will incorporate screenshots,
|
|
completed testing results, and updated document
|
|
version history.
|
|
|
|
\IntentionalLatexFailure
|