Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 81c343ddb6 | |||
| 091a9a9695 | |||
| ab0bcc25f3 | |||
| b899233138 | |||
| 7ffe1f0b34 | |||
| 75c2f21bae | |||
| 8174773cfb | |||
| 898660fd30 | |||
| b76eba3c4f | |||
| 67e9e17eab | |||
| 543be42786 | |||
| 05ef5690b1 | |||
| 1b0d53291f | |||
| f95aa89208 | |||
| c61c4d9d86 | |||
| bd6dc0a865 | |||
| a7b93e380a | |||
| ebd8b2e424 | |||
| 5e0b7e595d |
@@ -25,6 +25,30 @@ jobs:
|
||||
- name: Check out the triggering commit
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Generate build metadata
|
||||
working-directory: manual
|
||||
env:
|
||||
GIT_COMMIT: ${{ github.sha }}
|
||||
BUILD_NUMBER: ${{ github.run_number }}
|
||||
run: |
|
||||
MANUAL_VERSION="v1.4"
|
||||
SHORT_SHA="${GIT_COMMIT:0:7}"
|
||||
BUILD_ID="${MANUAL_VERSION}+build.${BUILD_NUMBER}.${SHORT_SHA}"
|
||||
|
||||
cat > build-metadata.tex <<EOF
|
||||
\newcommand{\ManualVersion}{${MANUAL_VERSION}}
|
||||
\newcommand{\BuildIdentifier}{${BUILD_ID}}
|
||||
\newcommand{\BuildCommit}{${GIT_COMMIT}}
|
||||
\newcommand{\BuildRunNumber}{${BUILD_NUMBER}}
|
||||
EOF
|
||||
|
||||
cat >> build-metadata.tex <<'EOF'
|
||||
\noindent\textbf{Manual version:} \ManualVersion\\
|
||||
\textbf{Build identifier:} \BuildIdentifier\\
|
||||
\textbf{Commit hash:} \BuildCommit\\
|
||||
\textbf{Gitea Actions run:} \BuildRunNumber
|
||||
EOF
|
||||
|
||||
- name: Record build identity and toolchain
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA::7}"
|
||||
@@ -51,7 +75,7 @@ jobs:
|
||||
ls -l devopsAssignment.pdf
|
||||
|
||||
- name: Upload the PDF as an artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: it-manual-build-${{ github.run_number }}-${{ env.SHORT_SHA }}
|
||||
path: manual/devopsAssignment.pdf
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
__pycache__/
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// CI pipeline for Scrap-Web (SSW 590, Continuous Integration with Jenkins).
|
||||
// Runs for every pull request through the Multibranch Pipeline job and reports
|
||||
// its result to Gitea as a commit status. Uses only the Python 3 standard
|
||||
// library, so no packages are downloaded during the build.
|
||||
pipeline {
|
||||
// Builds run on the Jenkins controller executor (see the IT manual for the
|
||||
// documented risk). python3 must be installed in the Jenkins container.
|
||||
agent any
|
||||
|
||||
options {
|
||||
skipDefaultCheckout()
|
||||
timeout(time: 10, unit: 'MINUTES')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
// Record exactly which commit is being tested, for traceability.
|
||||
sh 'git rev-parse HEAD'
|
||||
sh 'python3 --version'
|
||||
}
|
||||
}
|
||||
stage('Syntax check') {
|
||||
steps {
|
||||
sh 'python3 -m py_compile pricing.py tests/test_pricing.py'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh 'python3 -m unittest discover -s tests -v'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success { echo 'All checks passed.' }
|
||||
failure { echo 'A stage failed: see the stage view for which one.' }
|
||||
}
|
||||
}
|
||||
@@ -3,3 +3,5 @@
|
||||
This Repo is here to act as Group 8's repo for the SSW590 course
|
||||
|
||||
In the 10/2 assignment, we added a domain, reverse proxy, https, and created our repo in Gitea
|
||||
|
||||
In the 10/10 assignment, we added an automation workflow for compiling a LaTeX artifact upon git pushes
|
||||
+20
-2
@@ -8,6 +8,24 @@ FROM texlive/texlive:TL2025-historic
|
||||
# The workflow's actions (checkout, upload-artifact) are JavaScript actions and
|
||||
# need Node.js inside the job container; git lets checkout do a real clone.
|
||||
# Packages come from the image's own Debian repositories -- no downloaded scripts.
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends nodejs git ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
nodejs git ca-certificates python3 python3-pip python3-venv curl \
|
||||
&& python3 -m venv /opt/latex-venv \
|
||||
&& /opt/latex-venv/bin/pip install --upgrade pip \
|
||||
&& /opt/latex-venv/bin/pip install --upgrade latexminted==0.7.1 Pygments \
|
||||
&& mkdir -p /tmp/minted-src /usr/local/share/texmf/tex/latex/minted \
|
||||
&& curl -fsSL https://mirrors.ctan.org/macros/latex/contrib/minted/minted.dtx \
|
||||
-o /tmp/minted-src/minted.dtx \
|
||||
&& curl -fsSL https://mirrors.ctan.org/macros/latex/contrib/minted/minted.ins \
|
||||
-o /tmp/minted-src/minted.ins \
|
||||
&& cd /tmp/minted-src \
|
||||
&& latex minted.ins \
|
||||
&& cp minted.sty /usr/local/texlive/2025/texmf-dist/tex/latex/minted/minted.sty \
|
||||
&& mktexlsr \
|
||||
&& rm -rf /tmp/minted-src \
|
||||
&& mktexlsr \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV PATH="/opt/latex-venv/bin:/usr/local/bin:${PATH}"
|
||||
@@ -1,3 +1,4 @@
|
||||
% This file acts as the entry point for AI
|
||||
\chapter{AI Agent Usage Guide}
|
||||
\ChapterLabel{AIAgentGuide}
|
||||
\index{AI agent}
|
||||
|
||||
@@ -40,10 +40,10 @@
|
||||
\newcommand{\CourseName}{DevOps}
|
||||
\newcommand{\Instructor}{Samah Keshiro and Kayla Holmes}
|
||||
\newcommand{\Organization}{Stevens Institute of Technology}
|
||||
\newcommand{\DocumentDate}{10/02/26}
|
||||
\newcommand{\DocumentDate}{10/10/26}
|
||||
\newcommand{\DueDate}{[Due Date and Time]}
|
||||
\newcommand{\VERSION}{Version 1.3}
|
||||
\newcommand{\AssignmentNumber}{2}
|
||||
\newcommand{\VERSION}{Version 1.4}
|
||||
\newcommand{\AssignmentNumber}{5}
|
||||
|
||||
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
|
||||
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
|
||||
@@ -104,6 +104,14 @@
|
||||
\singlespacing
|
||||
\include{prologue}
|
||||
|
||||
% Display build metadata generated by Gitea Actions.
|
||||
\IfFileExists{build-metadata.tex}{
|
||||
\input{build-metadata.tex}
|
||||
}{
|
||||
\textit{Build metadata is available in automated builds.}
|
||||
}
|
||||
|
||||
% Adds in variables for title page
|
||||
\setcounter{page}{1}
|
||||
\pagenumbering{arabic}
|
||||
\pagestyle{fancy}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
\chapter{Automated Manual Build}
|
||||
\ChapterLabel{AutomatedManualBuild}
|
||||
\index{Gitea Actions}
|
||||
\index{automated manual build}
|
||||
|
||||
% ---------------------------------------------------------------------------
|
||||
% Bracketed italic text marks evidence that is added once the runner is online
|
||||
% and a real workflow run exists. Replace each placeholder with the actual
|
||||
% value or screenshot; do not fill them in before the run has happened.
|
||||
% ---------------------------------------------------------------------------
|
||||
|
||||
\section{Source and Trigger}
|
||||
|
||||
\textbf{Repository and files:}
|
||||
\begin{description}
|
||||
\item[Repository:] \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web}
|
||||
\item[Manual source folder:]
|
||||
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/manual}
|
||||
\item[Main file:]
|
||||
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/manual/devopsAssignment.tex}
|
||||
\item[Workflow:]
|
||||
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/.gitea/workflows/manual.yml}
|
||||
\item[Tracking issue:]
|
||||
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/issues/8}
|
||||
\item[Pull request:] \textit{[link to the merged pull request from
|
||||
\texttt{issue-8} into \texttt{main}]}
|
||||
\end{description}
|
||||
|
||||
The manual is stored in the \texttt{manual/} folder of the team's existing
|
||||
product repository, Scrap-Web, rather than in a separate repository. The
|
||||
complete buildable project is version-controlled there: every chapter file,
|
||||
the \texttt{cornell.cls} document class, the \texttt{IEEEtran.bst}
|
||||
bibliography style, \texttt{devopsReferences.bib}, the glossary, and all
|
||||
figures under \texttt{HW2 images/} and \texttt{HW4 images/}. Generated files
|
||||
(PDF, \texttt{.aux}, \texttt{.log}, minted cache, and so on) are excluded by
|
||||
\texttt{manual/.gitignore}, so the repository holds source only. The
|
||||
repository is the source of truth; the PDF is never edited directly.
|
||||
|
||||
\textbf{How the source was added:} the manual was committed on the branch
|
||||
\texttt{issue-8} (tracked by issue \#8), pushed to Gitea, and merged into
|
||||
\texttt{main} through a pull request. Work on the website itself happens on
|
||||
other branches and is unaffected.
|
||||
|
||||
\textbf{Selected branch and event:} the workflow runs on a \texttt{push} to
|
||||
\texttt{main}. A path filter limits it to pushes that change
|
||||
\texttt{manual/**} or the workflow file itself, so website-only commits do
|
||||
not rebuild the manual. Merging a pull request into \texttt{main} counts as
|
||||
such a push. The workflow can also be started by hand from the Actions tab
|
||||
(\texttt{workflow\_dispatch}).
|
||||
|
||||
\textit{[Figure: Actions tab showing a run triggered by the merge commit into
|
||||
\texttt{main}, dated.]}
|
||||
|
||||
\textbf{Git remote and network path:} team members push over HTTPS. The
|
||||
remote is configured as:
|
||||
\begin{verbatim}
|
||||
$ git remote -v
|
||||
origin https://git.ssw590-08.me/SSW-590-08/Scrap-Web.git (fetch)
|
||||
origin https://git.ssw590-08.me/SSW-590-08/Scrap-Web.git (push)
|
||||
\end{verbatim}
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{lll}
|
||||
\toprule
|
||||
Hop & Port & Exposure \\
|
||||
\midrule
|
||||
Laptop $\rightarrow$ Caddy (TLS proxy) & 443/TCP (HTTPS) & Public \\
|
||||
Caddy $\rightarrow$ Gitea web service & 3000/TCP (HTTP) & Private Docker network only \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
A \texttt{git push} connects to \texttt{git.ssw590-08.me} on port 443,
|
||||
exactly as a browser does. Caddy terminates TLS and forwards the request over
|
||||
the internal Docker network to Gitea on port 3000, which is not published to
|
||||
the internet. Gitea's public root URL is set to
|
||||
\url{https://git.ssw590-08.me/}, so clone URLs and links point at the HTTPS
|
||||
hostname. SSH pushes are not needed for this assignment.
|
||||
|
||||
\textbf{Why the runner needs no public port:} the runner never receives
|
||||
connections. It contacts Gitea outbound over HTTPS to register and to poll
|
||||
for jobs; the job then checks out the source and uploads the PDF over the
|
||||
same HTTPS URL. Because all traffic is initiated by the runner, no submission
|
||||
or management port has to be opened for it.
|
||||
|
||||
\section{Runner Setup}
|
||||
\textit{[To be completed with the runner registration (Part 2): version,
|
||||
location, scope, label \texttt{latex}, execution mode, capacity, network path,
|
||||
and a screenshot of the runner online with a job assigned.]}
|
||||
|
||||
\section{Reproducible Compilation}
|
||||
|
||||
\begin{description}
|
||||
\item[Main file:] \texttt{manual/devopsAssignment.tex}
|
||||
\item[Build command:] \texttt{latexmk devopsAssignment.tex}, run in the
|
||||
\texttt{manual/} folder
|
||||
\item[Build configuration:] \texttt{manual/.latexmkrc}
|
||||
\item[Expected PDF path:] \texttt{manual/devopsAssignment.pdf}
|
||||
\item[Job image definition:] \texttt{manual/ci/Dockerfile}
|
||||
\item[Base image:] \texttt{texlive/texlive:TL2025-historic}
|
||||
\item[Resolved image ID/digest:] \textit{[from the runner host]}
|
||||
\end{description}
|
||||
|
||||
\textbf{Where TeX runs:} the compiler is not installed in the Gitea
|
||||
container. The workflow targets the runner label \texttt{latex}
|
||||
(\texttt{runs-on: latex}), which maps to a job image built from
|
||||
\texttt{manual/ci/Dockerfile}. That image is the official TeX Live image,
|
||||
which already contains \texttt{pdflatex}, \texttt{latexmk}, \texttt{bibtex},
|
||||
\texttt{makeindex}, \texttt{makeglossaries}, and Python with Pygments (needed
|
||||
by the \texttt{minted} package). The Dockerfile adds only Node.js and Git from
|
||||
the image's own Debian package repositories, which the checkout and upload
|
||||
actions require; no external script is downloaded and executed. The base
|
||||
image uses a fixed TeX Live release tag rather than \texttt{latest}, so every
|
||||
build uses the same toolchain.
|
||||
|
||||
\textbf{Build command and dependencies:} all compiler options are stored in
|
||||
\texttt{manual/.latexmkrc}, so the same command works on a laptop and in the
|
||||
workflow:
|
||||
\begin{minted}[breaklines]{perl}
|
||||
$pdf_mode = 1;
|
||||
$pdflatex = 'pdflatex -shell-escape -interaction=nonstopmode -halt-on-error -file-line-error %O %S';
|
||||
add_cus_dep('glo', 'gls', 0, 'run_makeglossaries');
|
||||
add_cus_dep('acn', 'acr', 0, 'run_makeglossaries');
|
||||
sub run_makeglossaries { return system("makeglossaries \"$_[0]\""); }
|
||||
\end{minted}
|
||||
\texttt{latexmk} runs \texttt{pdflatex} as many times as needed and calls
|
||||
\texttt{bibtex}, \texttt{makeindex}, and \texttt{makeglossaries} when their
|
||||
inputs change. \texttt{-shell-escape} is required by \texttt{minted}.
|
||||
|
||||
\textbf{Workflow:} the complete workflow file is shown below.
|
||||
\begin{minted}[breaklines]{yaml}
|
||||
name: Build IT manual
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'manual/**'
|
||||
- '.gitea/workflows/manual.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-manual:
|
||||
runs-on: latex
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Check out the triggering commit
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Record build identity and toolchain
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA::7}"
|
||||
echo "SHORT_SHA=${SHORT_SHA}" >> "$GITHUB_ENV"
|
||||
echo "Commit: ${GITHUB_SHA} (${SHORT_SHA})"
|
||||
echo "Run number: ${GITHUB_RUN_NUMBER}"
|
||||
pdflatex --version | head -n 1
|
||||
latexmk -v | head -n 2 | tail -n 1
|
||||
python3 -c "import pygments; print('Pygments', pygments.__version__)"
|
||||
|
||||
- name: Compile the manual
|
||||
working-directory: manual
|
||||
run: latexmk devopsAssignment.tex
|
||||
|
||||
- name: Verify the PDF exists
|
||||
working-directory: manual
|
||||
run: |
|
||||
if [ ! -s devopsAssignment.pdf ]; then
|
||||
echo "ERROR: manual/devopsAssignment.pdf is missing or empty"
|
||||
exit 1
|
||||
fi
|
||||
ls -l devopsAssignment.pdf
|
||||
|
||||
- name: Upload the PDF as an artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: it-manual-build-${{ github.run_number }}-${{ env.SHORT_SHA }}
|
||||
path: manual/devopsAssignment.pdf
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
\end{minted}
|
||||
|
||||
\textbf{Failure detection:} the build fails in three independent ways.
|
||||
\begin{enumerate}
|
||||
\item A LaTeX error stops \texttt{pdflatex} immediately
|
||||
(\texttt{-halt-on-error}); \texttt{latexmk} then exits with a non-zero
|
||||
code, which fails the \emph{Compile the manual} step. The log shows the
|
||||
failing file and line (\texttt{-file-line-error}).
|
||||
\item If compilation reports success but the PDF is missing or empty, the
|
||||
\emph{Verify the PDF exists} step exits with code 1 and prints an error.
|
||||
\item The upload step uses \texttt{if-no-files-found: error}, so it cannot
|
||||
silently upload nothing.
|
||||
\end{enumerate}
|
||||
A failed step stops the job, so no artifact is produced from a broken build.
|
||||
|
||||
\textbf{Checkout and upload without a shared filesystem:} the job container
|
||||
shares no files with Gitea. The \texttt{actions/checkout} step clones the
|
||||
exact triggering commit from Gitea over HTTPS, the compile happens inside the
|
||||
temporary job container, and \texttt{actions/upload-artifact} sends the PDF
|
||||
back to Gitea over HTTPS, where it is attached to the matching run. The
|
||||
container is discarded when the job ends.
|
||||
|
||||
\textit{[Link to a successful run log, and a dated screenshot of the
|
||||
compile and verify steps passing.]}
|
||||
|
||||
\section{PDF Version Traceability}
|
||||
\textit{[To be completed (Part 4): human-maintained version, generated build
|
||||
identifier such as \texttt{v1.4+build.N.abcdef0}, visible commit hash and run
|
||||
number in the PDF, matching Gitea run, and how the metadata is injected
|
||||
without committing back to the branch.]}
|
||||
|
||||
\section{Downloadable Artifact}
|
||||
|
||||
\begin{description}
|
||||
\item[Artifact name:] \texttt{it-manual-build-\textit{N}-\textit{H}},
|
||||
where \textit{N} is the workflow run number and \textit{H} is the short
|
||||
commit hash; for example, \texttt{it-manual-build-12-a1b2c3d}
|
||||
\item[Contents:] \texttt{devopsAssignment.pdf}
|
||||
\item[Retention:] 30 days, set in the workflow
|
||||
(\texttt{retention-days: 30}). \textit{[Confirm the server's maximum
|
||||
artifact retention; Gitea applies the lower of the two.]}
|
||||
\item[Example artifact link:] \textit{[link to the artifact on a successful
|
||||
run]}
|
||||
\end{description}
|
||||
|
||||
Because the run number and commit hash are part of the artifact name, each
|
||||
downloaded file can be matched to the run and commit that produced it.
|
||||
|
||||
\textbf{How a team member downloads the PDF:}
|
||||
\begin{enumerate}
|
||||
\item Open \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/actions}.
|
||||
\item Select the \emph{Build IT manual} workflow and open the run for the
|
||||
commit of interest (the run lists its commit hash and branch).
|
||||
\item Confirm the run finished successfully.
|
||||
\item In the run's \emph{Artifacts} section, click
|
||||
\texttt{it-manual-build-\ldots} to download it, then extract and open
|
||||
\texttt{devopsAssignment.pdf}.
|
||||
\end{enumerate}
|
||||
|
||||
Artifacts expire after the retention period and are not a backup. The
|
||||
permanent record is the LaTeX source in Git, from which any version of the
|
||||
manual can be rebuilt.
|
||||
|
||||
\textit{[Figure: run page with the artifact listed, and the downloaded PDF
|
||||
open, dated.]}
|
||||
|
||||
\section{Change, Failure, and Repair Evidence}
|
||||
\textit{[To be completed together (Part 6): two successive commits with
|
||||
their runs and PDF identifiers, one deliberate LaTeX error with its failed
|
||||
run, and the repaired passing run.]}
|
||||
|
||||
\section{Runner and Secret Boundary}
|
||||
\textit{[To be completed (Part 7): workflow edit rights, where the runner
|
||||
registration token is stored (without its value), runner isolation, and
|
||||
Docker socket risk.]}
|
||||
|
||||
\section{Manual Quality and Controls}
|
||||
\textit{[To be completed (Part 8): version and history update, whether the
|
||||
Hosts and Passwords tables changed, and a short failed-build troubleshooting
|
||||
procedure.]}
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Pricing helper for the Scrap-Web CI pipeline (SSW 590, Jenkins assignment)."""
|
||||
|
||||
|
||||
def total_price(unit_price, quantity):
|
||||
"""Return the total price for `quantity` items at `unit_price` each."""
|
||||
if quantity < 1:
|
||||
raise ValueError("Quantity must be positive")
|
||||
return unit_price * quantity
|
||||
@@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
|
||||
from pricing import total_price
|
||||
|
||||
|
||||
class PricingTests(unittest.TestCase):
|
||||
def test_total(self):
|
||||
self.assertEqual(total_price(10, 3), 30)
|
||||
|
||||
def test_invalid_quantity(self):
|
||||
with self.assertRaises(ValueError):
|
||||
total_price(10, 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user