Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38d2e1e965 | |||
| 1de58d4742 | |||
| 84a44f0477 | |||
| a5180ad781 | |||
| 8ba340e32f | |||
| c5538a84d1 | |||
| 81c343ddb6 | |||
| 091a9a9695 | |||
| ab0bcc25f3 | |||
| fa22a0d512 | |||
| b779817f2c | |||
| b899233138 |
@@ -6,8 +6,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- 'manual/**'
|
- "manual/**"
|
||||||
- '.gitea/workflows/manual.yml'
|
- ".gitea/workflows/manual.yml"
|
||||||
workflow_dispatch: # lets a team member re-run a build by hand from the Actions tab
|
workflow_dispatch: # lets a team member re-run a build by hand from the Actions tab
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
GIT_COMMIT: ${{ github.sha }}
|
GIT_COMMIT: ${{ github.sha }}
|
||||||
BUILD_NUMBER: ${{ github.run_number }}
|
BUILD_NUMBER: ${{ github.run_number }}
|
||||||
run: |
|
run: |
|
||||||
MANUAL_VERSION="v1.4"
|
MANUAL_VERSION="v1.5"
|
||||||
SHORT_SHA="${GIT_COMMIT:0:7}"
|
SHORT_SHA="${GIT_COMMIT:0:7}"
|
||||||
BUILD_ID="${MANUAL_VERSION}+build.${BUILD_NUMBER}.${SHORT_SHA}"
|
BUILD_ID="${MANUAL_VERSION}+build.${BUILD_NUMBER}.${SHORT_SHA}"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
__pycache__/
|
||||||
@@ -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.' }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# Jenkins controller image for the Scrap-Web CI pipeline (SSW 590).
|
|
||||||
# The official Jenkins LTS image does not include Python, which the
|
|
||||||
# Jenkinsfile needs (builds run on the controller executor).
|
|
||||||
#
|
|
||||||
# Replace <LTS-TAG> with the exact tag currently in the Compose file,
|
|
||||||
# e.g. 2.xxx.y-lts-jdk21, so the recorded Jenkins version does not change.
|
|
||||||
FROM jenkins/jenkins:<LTS-TAG>
|
|
||||||
|
|
||||||
USER root
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends python3 \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
USER jenkins
|
|
||||||
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 25 KiB |
@@ -42,7 +42,7 @@
|
|||||||
\newcommand{\Organization}{Stevens Institute of Technology}
|
\newcommand{\Organization}{Stevens Institute of Technology}
|
||||||
\newcommand{\DocumentDate}{10/10/26}
|
\newcommand{\DocumentDate}{10/10/26}
|
||||||
\newcommand{\DueDate}{[Due Date and Time]}
|
\newcommand{\DueDate}{[Due Date and Time]}
|
||||||
\newcommand{\VERSION}{Version 1.4}
|
\newcommand{\VERSION}{Version 1.5}
|
||||||
\newcommand{\AssignmentNumber}{5}
|
\newcommand{\AssignmentNumber}{5}
|
||||||
|
|
||||||
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
|
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
|
||||||
@@ -133,6 +133,9 @@
|
|||||||
\include{devopsProjectProposal}
|
\include{devopsProjectProposal}
|
||||||
\include{devopsJenkinsCI}
|
\include{devopsJenkinsCI}
|
||||||
\include{devopsPasswordsAndHosts}
|
\include{devopsPasswordsAndHosts}
|
||||||
|
\include{devopsAutomatedManualBuild}
|
||||||
|
\include{devopsCI}
|
||||||
|
\include
|
||||||
|
|
||||||
\bibliographystyle{IEEEtran}
|
\bibliographystyle{IEEEtran}
|
||||||
\bibliography{devopsReferences}
|
\bibliography{devopsReferences}
|
||||||
|
|||||||
@@ -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,937 @@
|
|||||||
|
\chapter{Continuous Integration with Jenkins}
|
||||||
|
\ChapterLabel{ContinuousIntegration}
|
||||||
|
\index{Jenkins}
|
||||||
|
\index{continuous integration}
|
||||||
|
|
||||||
|
\section{Jenkins Deployment and Persistence}
|
||||||
|
\label{sec:ci-deploy}
|
||||||
|
Jenkins was deployed on the existing DigitalOcean Droplet used for the Gitea environment. The deployment uses the official Jenkins Docker image, \texttt{jenkins/jenkins}, which specifies the Long-Term Support (LTS) release with Java 21. The running Jenkins instance reported version \texttt{2.580.1} and Java 21.
|
||||||
|
|
||||||
|
Jenkins was deployed as a Docker Compose service rather than installed directly on the host operating system. This approach makes the service configuration reproducible and allows the container to be managed independently of the other services running on the Droplet. The Jenkins container is named \texttt{jenkins}.
|
||||||
|
|
||||||
|
The Docker Compose configuration defines the Jenkins image, container name, restart policy, Java memory settings, persistent storage, and shared Docker network. The configuration file is located at \texttt{/root/jenkins/docker-compose.yml} on the Droplet. The corresponding source-controlled configuration should be linked here for reproducibility.
|
||||||
|
|
||||||
|
The relevant configuration is shown below. It contains no passwords, personal access tokens, or other authentication secrets.
|
||||||
|
|
||||||
|
\begin{minted}[fontsize=\small,breaklines,linenos]{yaml}
|
||||||
|
services:
|
||||||
|
jenkins:
|
||||||
|
image: jenkins/jenkins
|
||||||
|
container_name: jenkins
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
JAVA_OPTS: "-Xms256m -Xmx512m"
|
||||||
|
volumes:
|
||||||
|
- jenkins-home:/var/jenkins_home
|
||||||
|
networks:
|
||||||
|
- gitea-net
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
jenkins-home:
|
||||||
|
name: jenkins_home
|
||||||
|
|
||||||
|
networks:
|
||||||
|
gitea-net:
|
||||||
|
external: true
|
||||||
|
name: gitea-net
|
||||||
|
\end{minted}
|
||||||
|
|
||||||
|
\noindent\textbf{Configuration file:} \texttt{/root/jenkins/docker-compose.yml} on the Droplet. Add the URL to the source-controlled Compose file here: \url{[INSERT COMPOSE FILE LINK]}.
|
||||||
|
|
||||||
|
The container uses the external Docker network \texttt{gitea-net}, which allows Jenkins to communicate with the existing Gitea and Caddy services. Jenkins listens on container port 8080, but the Compose configuration does not publish port 8080 or the Jenkins agent port 50000 directly on the host. Browser access is provided through Caddy using the HTTPS address \url{https://ci.ssw590-08.me/}.
|
||||||
|
|
||||||
|
\subsection{Droplet Capacity and Resource Allocation}
|
||||||
|
|
||||||
|
The DigitalOcean Droplet was upgraded to the plan providing 2 GB of RAM, one virtual CPU, and a 50 GB SSD. The host runs Jenkins alongside Gitea and Caddy, so the available resources are shared among these services.
|
||||||
|
|
||||||
|
The Jenkins container is configured with the following Java heap limits:
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item Initial Java heap size: 256 MB.
|
||||||
|
\item Maximum Java heap size: 512 MB.
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
After the Droplet upgrade, the reported host memory usage was approximately 503 MiB used out of 1.9 GiB, with approximately 931 MiB free and 1.4 GiB available. The reported disk usage was approximately 3.3 GB out of 48 GB, leaving approximately 45 GB available. These values describe the host at the time of measurement and may change as builds execute and logs accumulate.
|
||||||
|
|
||||||
|
Because the Droplet hosts several services on a relatively small resource allocation, memory and disk usage should be monitored during builds. The Java heap limit helps constrain Jenkins' Java memory allocation, but it does not represent a limit on the container's total memory usage.
|
||||||
|
|
||||||
|
\subsection{Persistent Storage and Restart Policy}
|
||||||
|
|
||||||
|
Jenkins stores its configuration, job definitions, plugins, and other Jenkins home data under \texttt{/var/jenkins\_home}. The Compose configuration mounts this directory to the named Docker volume \texttt{jenkins\_home}. This separates Jenkins application data from the container's writable filesystem and allows the data to survive replacement or restart of the container, provided that the named volume is retained.
|
||||||
|
|
||||||
|
The container uses the Docker restart policy \texttt{unless-stopped}. This policy allows Docker to restart Jenkins after an unexpected container exit and when Docker restarts, unless the container has been explicitly stopped.
|
||||||
|
|
||||||
|
The following commands can be used to inspect the running container and verify its storage and restart settings:
|
||||||
|
|
||||||
|
\begin{minted}[fontsize=\small,breaklines]{bash}
|
||||||
|
docker inspect jenkins \
|
||||||
|
--format 'Restart policy: {{.HostConfig.RestartPolicy.Name}}'
|
||||||
|
|
||||||
|
docker inspect jenkins \
|
||||||
|
--format '{{json .Mounts}}'
|
||||||
|
|
||||||
|
docker inspect jenkins \
|
||||||
|
--format '{{json .HostConfig.PortBindings}}'
|
||||||
|
\end{minted}
|
||||||
|
|
||||||
|
The deployment inspection confirmed the \texttt{unless-stopped} restart policy and the \texttt{jenkins\_home} volume mounted at \texttt{/var/jenkins\_home}. It also confirmed that the container has no host port bindings for Jenkins' internal ports.
|
||||||
|
|
||||||
|
\subsection{Container Restart Test}
|
||||||
|
|
||||||
|
A container restart test was performed using the following command:
|
||||||
|
|
||||||
|
\begin{minted}[fontsize=\small,breaklines]{bash}
|
||||||
|
docker restart jenkins
|
||||||
|
\end{minted}
|
||||||
|
|
||||||
|
The command completed successfully. Following the restart, Jenkins was accessible through its HTTPS address, and the existing Jenkins configuration and job remained available. This demonstrated that Jenkins could restart without requiring the service to be reinstalled or configured from scratch.
|
||||||
|
|
||||||
|
The test also supports the use of the named \texttt{jenkins\_home} volume for persistent Jenkins data. A container restart is not, however, a backup or disaster-recovery test. It does not demonstrate that data can be recovered after volume deletion, disk failure, Droplet loss, or corruption. Separate backups of the Jenkins home data and a documented restoration procedure are necessary to establish recoverability.
|
||||||
|
|
||||||
|
\section{HTTPS, Access, and Firewall}
|
||||||
|
\label{sec:ci-https}
|
||||||
|
|
||||||
|
\subsection{Jenkins Login URL and Access Path}
|
||||||
|
|
||||||
|
Jenkins is accessible through the following HTTPS address:
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\url{https://ci.ssw590-08.me/}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
The hostname \texttt{ci.ssw590-08.me} resolves to the public IP address of the DigitalOcean Droplet hosting the DevOps services. Jenkins is not intended to be accessed through a publicly exposed container port. Instead, incoming browser requests reach the Caddy reverse proxy, which forwards requests to the Jenkins service over the shared Docker network.
|
||||||
|
|
||||||
|
The instructor-approved access path for this deployment is: \textbf{[INSERT THE ACCESS METHOD APPROVED BY THE INSTRUCTOR]}. Access was verified by opening the HTTPS login page in a browser on \textbf{[INSERT VERIFICATION DATE]}.
|
||||||
|
|
||||||
|
\subsection{DNS and TLS Certificate}
|
||||||
|
|
||||||
|
The DNS record for \texttt{ci.ssw590-08.me} is configured to point to the public IP address of the DigitalOcean Droplet. The hostname is used to distinguish the Jenkins service from the existing Gitea service, which is available at \url{https://git.ssw590-08.me/}.
|
||||||
|
|
||||||
|
Caddy serves as the HTTPS reverse proxy for Jenkins. Its configuration includes the following site definition:
|
||||||
|
|
||||||
|
\begin{minted}[fontsize=\small,breaklines,linenos]{text}
|
||||||
|
ci.ssw590-08.me {
|
||||||
|
encode gzip
|
||||||
|
reverse_proxy jenkins:8080
|
||||||
|
}
|
||||||
|
\end{minted}
|
||||||
|
|
||||||
|
Caddy terminates the incoming HTTPS connection and forwards the request to the Jenkins container at \texttt{jenkins:8080} on the shared Docker network. The configuration was validated successfully with \texttt{caddy validate} and subsequently reloaded.
|
||||||
|
|
||||||
|
The certificate details should be recorded from the certificate actually presented by the deployed service:
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item \textbf{Hostname:} \texttt{ci.ssw590-08.me}
|
||||||
|
\item \textbf{Certificate issuer:} [INSERT VERIFIED CERTIFICATE ISSUER]
|
||||||
|
\item \textbf{Certificate expiration:} [INSERT VERIFIED EXPIRATION DATE]
|
||||||
|
\item \textbf{Certificate verification date:} [INSERT DATE]
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
Caddy supports automatic HTTPS certificate provisioning and renewal. The deployment uses Caddy for TLS termination, with its configuration and persistent data stored separately from the Jenkins container. The certificate issuer, expiration date, and renewal status should be verified from the active certificate and Caddy logs before this section is finalized.
|
||||||
|
|
||||||
|
\subsection{HTTP-to-HTTPS Redirect and Jenkins Proxy Configuration}
|
||||||
|
|
||||||
|
The public web entry point is Caddy, which handles incoming HTTP and HTTPS traffic. The expected browser-facing behavior is that HTTP requests to the Jenkins hostname redirect to HTTPS. This behavior should be documented using a dated test of the deployed endpoint rather than inferred solely from the configuration.
|
||||||
|
|
||||||
|
The redirect can be checked from an external machine with:
|
||||||
|
|
||||||
|
\begin{minted}[fontsize=\small,breaklines]{bash}
|
||||||
|
curl -sSI http://ci.ssw590-08.me/
|
||||||
|
curl -sSI https://ci.ssw590-08.me/
|
||||||
|
\end{minted}
|
||||||
|
|
||||||
|
The first command should be checked for an HTTP redirect to the HTTPS URL. The second verifies the HTTPS response and helps confirm that the endpoint is reachable with TLS.
|
||||||
|
|
||||||
|
Jenkins is configured to use the externally accessible URL:
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\url{https://ci.ssw590-08.me/}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
This URL should also be configured in Jenkins under \textit{Manage Jenkins} $\rightarrow$ \textit{System} $\rightarrow$ \textit{Jenkins Location}. The configured Jenkins URL must match the public HTTPS address so that generated links and integrations use the correct hostname. Caddy handles the external TLS connection and proxies requests to the Jenkins service internally.
|
||||||
|
|
||||||
|
\subsection{Accounts and Authorization}
|
||||||
|
|
||||||
|
Jenkins requires authentication to access its administrative interface and configure continuous integration jobs. Access to Jenkins administration and configuration should be restricted to authorized project members.
|
||||||
|
|
||||||
|
The Gitea integration uses a dedicated \texttt{jenkins} account and a Gitea Personal Access Token stored in Jenkins credentials. The account has the repository permissions needed for Jenkins to interact with \texttt{SSW-590-08/Scrap-Web}. During integration troubleshooting, repository webhook management initially failed with HTTP 403 responses. The account's repository permissions were subsequently adjusted, and the Jenkins webhook was created successfully in Gitea.
|
||||||
|
|
||||||
|
The following account and role information should be completed based on the actual Jenkins security configuration:
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item \textbf{Jenkins administrators:} [INSERT AUTHORIZED ADMINISTRATOR ACCOUNTS OR ROLES]
|
||||||
|
\item \textbf{Jenkins users:} [INSERT AUTHORIZED USER ACCOUNTS OR ROLES]
|
||||||
|
\item \textbf{Gitea integration identity:} \texttt{jenkins}
|
||||||
|
\item \textbf{Credential storage:} Jenkins Credentials
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
Personal access tokens and passwords are not included in this report. The dedicated integration account should have only the permissions required for repository access, webhook management, and build-status reporting.
|
||||||
|
|
||||||
|
\subsection{DigitalOcean Cloud Firewall}
|
||||||
|
|
||||||
|
The deployment uses the DigitalOcean Cloud Firewall named \texttt{gitea-firewall}. The firewall controls which inbound connections can reach the Droplet. The intended inbound access includes SSH administration and the public web ports required by Caddy.
|
||||||
|
|
||||||
|
The relevant public TCP ports are:
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item \textbf{TCP 22:} SSH administration.
|
||||||
|
\item \textbf{TCP 80:} HTTP access and HTTPS redirection.
|
||||||
|
\item \textbf{TCP 443:} HTTPS access through Caddy.
|
||||||
|
\item \textbf{TCP 222:} Gitea SSH access, where required by the existing deployment.
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
Direct public access to Jenkins on TCP 8080 is not required. The Jenkins container does not publish ports 8080 or 50000 on the Droplet's host network. Likewise, the Gitea web interface is reached through Caddy rather than by exposing its internal TCP port 3000.
|
||||||
|
|
||||||
|
The host's UFW firewall was reported as inactive during deployment verification. Consequently, the DigitalOcean Cloud Firewall and Docker's network and port configuration are important parts of the external access restrictions.
|
||||||
|
|
||||||
|
The actual Cloud Firewall rules should be captured in a dated screenshot and compared with the rules listed above. Unneeded inbound rules, including direct public access to TCP 3000 and TCP 5432, should be removed if they are not required by another service.
|
||||||
|
|
||||||
|
\subsection{Docker Port Mappings}
|
||||||
|
|
||||||
|
The Jenkins Compose service joins the existing \texttt{gitea-net} Docker network. It does not define a \texttt{ports} mapping for Jenkins. Inspection of the running container confirmed that Jenkins' internal TCP ports 8080 and 50000 have no host port bindings.
|
||||||
|
|
||||||
|
The container's port configuration was inspected with:
|
||||||
|
|
||||||
|
\begin{minted}[fontsize=\small,breaklines]{bash}
|
||||||
|
docker inspect jenkins \
|
||||||
|
--format '{{json .HostConfig.PortBindings}}'
|
||||||
|
|
||||||
|
docker inspect jenkins \
|
||||||
|
--format '{{json .NetworkSettings.Ports}}'
|
||||||
|
\end{minted}
|
||||||
|
|
||||||
|
The inspection results showed no published host bindings for the Jenkins web interface or agent port. External browser traffic is instead routed through Caddy, which forwards requests to \texttt{jenkins:8080} over the internal Docker network.
|
||||||
|
|
||||||
|
This arrangement avoids exposing Jenkins' application port directly to the public Internet and provides a single HTTPS entry point for browser access.
|
||||||
|
|
||||||
|
\subsection{External Connectivity Tests}
|
||||||
|
|
||||||
|
External tests were performed from a machine outside the Droplet to verify that selected ports were reachable or blocked from the public network. The test results must be recorded with their execution date and the source machine's network context.
|
||||||
|
|
||||||
|
The following command tests the public IPv4 address for TCP connectivity:
|
||||||
|
|
||||||
|
\begin{minted}[fontsize=\small,breaklines]{bash}
|
||||||
|
nc -vz -w 3 147.182.179.191 443
|
||||||
|
nc -vz -w 3 147.182.179.191 8080
|
||||||
|
\end{minted}
|
||||||
|
|
||||||
|
The expected results are:
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item \textbf{TCP 443:} The connection should succeed because Caddy provides the public HTTPS endpoint.
|
||||||
|
\item \textbf{TCP 8080:} The connection should fail because Jenkins' internal web port is not published on the host and is not intended to be publicly accessible.
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
Previous external tests of TCP ports 3000, 5432, 8080, and 50000 returned connection failures. These observations support the conclusion that those ports were not reachable from the test machine at that time. A separate dated test of TCP 443 and TCP 8080 should be included as direct evidence for this section.
|
||||||
|
|
||||||
|
The test record should include:
|
||||||
|
|
||||||
|
\begin{itemize}
|
||||||
|
\item \textbf{Test date and time:} [INSERT DATE, TIME, AND TIME ZONE]
|
||||||
|
\item \textbf{Test source:} [INSERT EXTERNAL MACHINE OR NETWORK]
|
||||||
|
\item \textbf{Droplet IPv4 address:} \texttt{147.182.179.191}
|
||||||
|
\item \textbf{TCP 443 result:} [INSERT OBSERVED RESULT]
|
||||||
|
\item \textbf{TCP 8080 result:} [INSERT OBSERVED RESULT]
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
A failed connection alone does not establish which control blocked it. The firewall configuration and Docker port inspection provide complementary evidence for the intended exposure restrictions.
|
||||||
|
|
||||||
|
\section{Gitea Trigger and Traceability}
|
||||||
|
\label{sec:ci-trigger}
|
||||||
|
|
||||||
|
\subsection{Deployment and Network Paths}
|
||||||
|
|
||||||
|
Figure~\ref{fig:ci-deployment} adapts the reference deployment to the team's
|
||||||
|
actual setup. Gitea and Jenkins run as containers on the same DigitalOcean
|
||||||
|
Droplet behind the Caddy TLS proxy. Two paths are separate:
|
||||||
|
\begin{itemize}
|
||||||
|
\item \textbf{Browser path:} a team member's browser reaches
|
||||||
|
\url{https://ci.ssw590-08.me} on port 443 through the Cloud Firewall and
|
||||||
|
Caddy, which forwards to Jenkins on the private Docker network. Jenkins'
|
||||||
|
own port 8080 is not published (Section~\ref{sec:ci-https}).
|
||||||
|
\item \textbf{Integration path:} Jenkins initiates every connection to
|
||||||
|
Gitea. It calls the Gitea API at \url{https://git.ssw590-08.me} to
|
||||||
|
discover branches and pull requests, clones the pull request's head
|
||||||
|
commit, and posts the commit status back. Gitea never needs to reach
|
||||||
|
Jenkins for builds to run, because the job polls for changes
|
||||||
|
(Section~\ref{sec:ci-trigger-config}).
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
% Uncomment once the diagram image is uploaded:
|
||||||
|
% \includegraphics[width=\linewidth]{HW6 images/ci-deployment.png}
|
||||||
|
\fbox{\parbox[c][3cm][c]{0.9\linewidth}{\centering\textit{[Diagram to be added]}}}
|
||||||
|
\caption{Adapted UML deployment diagram of the Gitea and Jenkins CI paths}
|
||||||
|
\label{fig:ci-deployment}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\subsection{Repository and Integration Identity}
|
||||||
|
|
||||||
|
\begin{description}
|
||||||
|
\item[Repository:] \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web}
|
||||||
|
\item[Jenkins job:] \url{https://ci.ssw590-08.me/job/Scrap-Web/}, a
|
||||||
|
Multibranch Pipeline
|
||||||
|
\item[Integration account:] \texttt{jenkins-ci}, a dedicated Gitea account
|
||||||
|
used only by Jenkins
|
||||||
|
\item[Jenkins credential:] \texttt{gitea-jenkins-ci} (type: Gitea Personal
|
||||||
|
Access Token, global scope)
|
||||||
|
\end{description}
|
||||||
|
|
||||||
|
Jenkins does not use a team member's personal account. The
|
||||||
|
\texttt{jenkins-ci} account was created by the Gitea site administrator for
|
||||||
|
this integration and limited to what Jenkins needs:
|
||||||
|
\begin{itemize}
|
||||||
|
\item it is a \emph{restricted} account, so it can see only repositories it
|
||||||
|
is explicitly added to, and it is not a site administrator;
|
||||||
|
\item it is a collaborator on Scrap-Web only, with \emph{Write} access
|
||||||
|
(Figure~\ref{fig:ci-collaborators}). Write is the minimum Gitea requires
|
||||||
|
to set commit statuses. It cannot push to \texttt{main}, which is
|
||||||
|
protected (Section~\ref{sec:ci-gate});
|
||||||
|
\item its token, named \texttt{jenkins} and created on October 22, 2026,
|
||||||
|
has only the permissions \texttt{write:repository} and
|
||||||
|
\texttt{read:user} (Figure~\ref{fig:ci-token}). The token value is stored
|
||||||
|
only in the Jenkins credential store (Section~\ref{sec:ci-credentials}).
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.85\linewidth]{HW6 images/collaborators.png}
|
||||||
|
\caption{October 23, 2026 --- Scrap-Web collaborators: the integration
|
||||||
|
account \texttt{jenkins-ci} and team member \texttt{kholmes}, both with
|
||||||
|
Write access.}
|
||||||
|
\label{fig:ci-collaborators}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.7\linewidth]{HW6 images/token-scopes.png}
|
||||||
|
\caption{October 23, 2026 --- The \texttt{jenkins-ci} account's access
|
||||||
|
token \texttt{jenkins} and its permissions. Gitea does not display the
|
||||||
|
token value.}
|
||||||
|
\label{fig:ci-token}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\subsection{Job Configuration and Trigger}
|
||||||
|
\label{sec:ci-trigger-config}
|
||||||
|
|
||||||
|
The Multibranch Pipeline job uses the Jenkins Gitea plugin~\cite{JenkinsGiteaPlugin}
|
||||||
|
as its branch source, pointed at owner \texttt{SSW-590-08} and repository
|
||||||
|
\texttt{Scrap-Web} through the \texttt{Gitea} server entry
|
||||||
|
(\url{https://git.ssw590-08.me}) and the \texttt{gitea-jenkins-ci}
|
||||||
|
credential (Figure~\ref{fig:ci-branch-source}). Its relevant settings are:
|
||||||
|
|
||||||
|
\begin{tabularx}{\linewidth}{L{4.6cm}Y}
|
||||||
|
\toprule
|
||||||
|
\textbf{Setting} & \textbf{Value and reason}\\ \midrule
|
||||||
|
Discover branches & Strategy: \emph{only branches that are not also filed
|
||||||
|
as PRs}. \texttt{main} is built as a branch; a feature branch with an open
|
||||||
|
pull request is built once, as that pull request, not twice.\\
|
||||||
|
Discover pull requests from origin & Strategy: \emph{the current pull
|
||||||
|
request revision}. Jenkins tests the pull request's actual head commit, so
|
||||||
|
the tested commit ID matches the one shown in Gitea.\\
|
||||||
|
Discover pull requests from forks & Strategy: \emph{the current pull
|
||||||
|
request revision}; Trust: \emph{Nobody}. Fork pull requests are built with
|
||||||
|
the trusted \texttt{Jenkinsfile} from \texttt{main}
|
||||||
|
(Section~\ref{sec:ci-credentials}).\\
|
||||||
|
Build configuration & By \texttt{Jenkinsfile}, script path
|
||||||
|
\texttt{Jenkinsfile}.\\
|
||||||
|
Scan repository trigger & Periodically if not otherwise run, every
|
||||||
|
1 minute.\\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabularx}
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=\linewidth]{HW6 images/branch-source.png}
|
||||||
|
\caption{October 23, 2026 --- Branch source settings of the
|
||||||
|
\texttt{Scrap-Web} Multibranch Pipeline job.}
|
||||||
|
\label{fig:ci-branch-source}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\textbf{Trigger: polling fallback.} The job scans Scrap-Web every minute and
|
||||||
|
starts a build for any branch or pull request whose head commit has changed.
|
||||||
|
The assignment permits polling in place of a webhook. It was chosen because a
|
||||||
|
webhook from Gitea to Jenkins on the private container network requires
|
||||||
|
changing Gitea's allowed webhook hosts, and Jenkins' web interface was not
|
||||||
|
opened merely to receive webhooks. The cost is a delay of up to one minute
|
||||||
|
between a push and the start of its build. In practice, each push in
|
||||||
|
Section~\ref{sec:ci-failure} was built within about two minutes.
|
||||||
|
|
||||||
|
Each scan is recorded in the job's \emph{Scan Repository Log}
|
||||||
|
(Figure~\ref{fig:ci-scan-log}). The scan at 04:15 UTC on October 23, 2026
|
||||||
|
(00:15 Eastern) found pull request \#13, confirmed that it contains a
|
||||||
|
\texttt{Jenkinsfile} (``Met criteria''), and recorded its head commit
|
||||||
|
\texttt{b899233}. Branches and pull requests without a \texttt{Jenkinsfile}
|
||||||
|
were checked and skipped.
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=\linewidth]{HW6 images/scan-log.png}
|
||||||
|
\caption{October 23, 2026, 04:15 UTC --- Scan Repository Log: pull
|
||||||
|
request \#13 discovered at commit \texttt{b899233}.}
|
||||||
|
\label{fig:ci-scan-log}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\subsection{Traceability: Commit to Jenkins Run}
|
||||||
|
|
||||||
|
The table below traces one trigger from the commit in Gitea to the Jenkins
|
||||||
|
run that tested it. The commit ID is the same in Gitea's commit list, in the
|
||||||
|
run's Checkout log (\texttt{git rev-parse HEAD}), and on the status Gitea
|
||||||
|
displays for that commit (Figure~\ref{fig:ci-pr-fail-fix}).
|
||||||
|
|
||||||
|
\begin{tabularx}{\linewidth}{L{4.2cm}Y}
|
||||||
|
\toprule
|
||||||
|
\textbf{Item} & \textbf{Value}\\ \midrule
|
||||||
|
Event & Repair commit pushed to branch \texttt{feature/issue-11}, the source
|
||||||
|
of pull request \#13\\
|
||||||
|
Time & October 23, 2026; Jenkins run started at 11:07 PM\\
|
||||||
|
Detected by & Repository scan (polling); build started automatically\\
|
||||||
|
Pull request & \#13,
|
||||||
|
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13}\\
|
||||||
|
Triggering commit & \texttt{84a44f0477}\\
|
||||||
|
Jenkins run & \texttt{Scrap-Web/PR-13} run \#9 (Figure~\ref{fig:ci-runs};
|
||||||
|
the job was later removed by Jenkins, see below)\\
|
||||||
|
Status posted to Gitea & \texttt{Scrap-Web/pipeline/pr-main}: success,
|
||||||
|
visible on the commit in
|
||||||
|
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13/commits}{pull
|
||||||
|
request \#13's commit list}\\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabularx}
|
||||||
|
|
||||||
|
\subsection{Where Checkout and Tests Run}
|
||||||
|
|
||||||
|
Checkout, the syntax check, and the tests all run on the Jenkins
|
||||||
|
controller's built-in node, inside the Jenkins container; the stage view of
|
||||||
|
each run lists the node as \emph{Jenkins} (the built-in node,
|
||||||
|
Figure~\ref{fig:ci-stage-view}). There is no separate build agent and no inbound
|
||||||
|
agent port. Jenkins clones the commit from Gitea over HTTPS into its
|
||||||
|
workspace under \texttt{/var/jenkins\_home/workspace/} and runs the
|
||||||
|
\texttt{Jenkinsfile} stages there (Section~\ref{sec:ci-pipeline}). The risk
|
||||||
|
of building on the controller and the restrictions that limit it are covered
|
||||||
|
in Section~\ref{sec:ci-credentials}.
|
||||||
|
|
||||||
|
\subsection{Failure Diagnoses}
|
||||||
|
|
||||||
|
Four integration problems were diagnosed and corrected.
|
||||||
|
|
||||||
|
\textbf{Repository not visible to Jenkins.} When the job was first
|
||||||
|
configured, the Repository list for owner \texttt{SSW-590-08} was empty,
|
||||||
|
even though the token had repository access. \textit{[Cause and fix.]}
|
||||||
|
After the correction the repository appeared and the first scan discovered
|
||||||
|
pull request \#13 (Figure~\ref{fig:ci-scan-log}).
|
||||||
|
|
||||||
|
\textbf{First build failed: \texttt{python3: not found}.} Run \#1 of
|
||||||
|
\texttt{PR-13} (October 23, 2026, 00:13) checked out the commit
|
||||||
|
successfully, proving the integration worked, but failed in the Checkout
|
||||||
|
stage at \texttt{python3 --version} with exit code 127; the later stages were
|
||||||
|
skipped (Figure~\ref{fig:ci-runs}). The official Jenkins image does not
|
||||||
|
include Python. The fix was a deployment change, not a code change:
|
||||||
|
\texttt{python3} was added to the Jenkins container \textit{[confirm how:
|
||||||
|
e.g.\ by building it from \texttt{jenkins/Dockerfile}]}. Run \#2, started
|
||||||
|
manually on the same commit at 9:39 PM, then passed and reported Python
|
||||||
|
3.13.5 (Figure~\ref{fig:ci-stage-view}).
|
||||||
|
|
||||||
|
\textbf{Required check reported as missing.} After the status-check
|
||||||
|
requirement was added, Gitea showed the Jenkins check as green but still
|
||||||
|
reported ``some required checks are missing'' and blocked the merge.
|
||||||
|
\textit{[Cause and fix.]}
|
||||||
|
|
||||||
|
\textbf{Pull request runs deleted after merge.} Shortly after pull request
|
||||||
|
\#13 was merged, the \texttt{PR-13} job and all of its runs disappeared from
|
||||||
|
Jenkins. The pull request was closed, and the Multibranch job's default
|
||||||
|
orphaned item strategy discards the jobs of closed pull requests. Deleted
|
||||||
|
runs cannot be restored without a backup of \texttt{jenkins\_home}. The
|
||||||
|
evidence survives in Gitea, because the commit statuses Jenkins posted remain
|
||||||
|
attached to each commit of pull request \#13, and in the screenshots captured
|
||||||
|
while the runs existed. To keep future evidence, the job's \emph{Orphaned
|
||||||
|
Item Strategy} was changed to keep old items for 30 days.
|
||||||
|
|
||||||
|
If a trigger fails in future, the operator follows the procedure in
|
||||||
|
Section~\ref{sec:ci-troubleshoot}.
|
||||||
|
|
||||||
|
\section{Versioned Pipeline and Tests}
|
||||||
|
\label{sec:ci-pipeline}
|
||||||
|
|
||||||
|
\begin{description}
|
||||||
|
\item[Repository:] \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web}
|
||||||
|
\item[Jenkinsfile:]
|
||||||
|
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/Jenkinsfile}{\texttt{Jenkinsfile} on \texttt{main}}
|
||||||
|
\item[Application:] \texttt{pricing.py} (repository root)
|
||||||
|
\item[Tests:] \texttt{tests/test\_pricing.py}
|
||||||
|
\end{description}
|
||||||
|
|
||||||
|
The pipeline tests a small pricing module, \texttt{pricing.py}, using the
|
||||||
|
optional Python application provided with the assignment. Its function
|
||||||
|
\texttt{total\_price(unit\_price, quantity)} returns the price of an order and
|
||||||
|
rejects quantities below one. The module, its tests, and the
|
||||||
|
\texttt{Jenkinsfile} are committed together at the root of the Scrap-Web
|
||||||
|
repository, so every \gls{pullrequest} carries the exact code, tests, and pipeline
|
||||||
|
definition that Jenkins runs.
|
||||||
|
|
||||||
|
\subsection{Pipeline Stages}
|
||||||
|
|
||||||
|
The \gls{jenkinsfile} is a Declarative Pipeline~\cite{JenkinsPipeline} with three stages. Each
|
||||||
|
stage fails the run if its command exits with a non-zero code, and later
|
||||||
|
stages do not run after a failure, so the stage view shows exactly where a
|
||||||
|
problem occurred.
|
||||||
|
|
||||||
|
\begin{tabularx}{\linewidth}{L{2.2cm}L{4.6cm}Y}
|
||||||
|
\toprule
|
||||||
|
\textbf{Stage} & \textbf{Command} & \textbf{Purpose and expected result}\\ \midrule
|
||||||
|
Checkout & \texttt{checkout scm}, \texttt{git rev-parse HEAD} &
|
||||||
|
Fetches the pull request's head commit from Gitea into the Jenkins
|
||||||
|
workspace and prints its full commit ID, so the run can be matched to the
|
||||||
|
commit in Gitea.\\
|
||||||
|
Syntax check & \texttt{python3 -m py\_compile pricing.py tests/test\_pricing.py} &
|
||||||
|
Byte-compiles both files. Passes silently; fails on any Python syntax
|
||||||
|
error before tests are attempted.\\
|
||||||
|
Test & \texttt{python3 -m unittest discover -s tests -v} &
|
||||||
|
Runs both unit tests. Expected output ends with \texttt{Ran 2 tests} and
|
||||||
|
\texttt{OK}; any failing assertion makes the stage, and the run, fail.\\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabularx}
|
||||||
|
|
||||||
|
\textbf{What the tests check:} \texttt{test\_total} verifies that ten units
|
||||||
|
at a price of 10 cost 30, which exercises the multiplication.
|
||||||
|
\texttt{test\_invalid\_quantity} verifies that a quantity of zero raises
|
||||||
|
\texttt{ValueError}. Changing the multiplication to an addition, as in the
|
||||||
|
controlled failure in Section~\ref{sec:ci-failure}, makes
|
||||||
|
\texttt{test\_total} fail with \texttt{AssertionError: 13 != 30}; this was
|
||||||
|
confirmed locally before the change was pushed.
|
||||||
|
|
||||||
|
The full \texttt{Jenkinsfile}:
|
||||||
|
\begin{minted}[breaklines]{groovy}
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
options {
|
||||||
|
skipDefaultCheckout()
|
||||||
|
timeout(time: 10, unit: 'MINUTES')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
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.' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\end{minted}
|
||||||
|
\texttt{skipDefaultCheckout()} prevents Jenkins from checking out the code
|
||||||
|
twice, so the single explicit \texttt{checkout scm} step is the only checkout
|
||||||
|
and appears as its own stage. The ten-minute timeout stops a hung build from
|
||||||
|
holding the executor indefinitely.
|
||||||
|
|
||||||
|
\subsection{Dependencies}
|
||||||
|
|
||||||
|
The application and tests use only the Python 3 standard library
|
||||||
|
(\texttt{unittest} and \texttt{py\_compile}), so the pipeline downloads no
|
||||||
|
packages and has no external dependency source to trust or pin. The only
|
||||||
|
requirement is a \texttt{python3} interpreter on the Jenkins executor,
|
||||||
|
installed in the Jenkins container image from \texttt{jenkins/Dockerfile}
|
||||||
|
(Python 3.13.5, as printed by the Checkout stage); it is not installed in the
|
||||||
|
Gitea container.
|
||||||
|
|
||||||
|
\subsection{Reproducing a Clean Run}
|
||||||
|
|
||||||
|
\textbf{Locally:} from the root of a fresh clone of the repository, run the
|
||||||
|
same commands the pipeline runs:
|
||||||
|
\begin{verbatim}
|
||||||
|
python3 -m py_compile pricing.py tests/test_pricing.py
|
||||||
|
python3 -m unittest discover -s tests -v
|
||||||
|
\end{verbatim}
|
||||||
|
(On Windows, use \texttt{python} instead of \texttt{python3}.) A clean result
|
||||||
|
ends with \texttt{Ran 2 tests} and \texttt{OK}.
|
||||||
|
|
||||||
|
\textbf{In Jenkins:} every new commit pushed to a pull request starts a new
|
||||||
|
run in a fresh checkout of that commit. A team member can also rebuild the
|
||||||
|
same commit from the pull request's branch page in the Multibranch job.
|
||||||
|
|
||||||
|
\subsection{Run Evidence}
|
||||||
|
|
||||||
|
Figure~\ref{fig:ci-stage-view} shows a passing run, \texttt{Scrap-Web/PR-13}
|
||||||
|
run \#2 (October 23, 2026, 9:39 PM), on commit \texttt{b899233}, the head of
|
||||||
|
pull request \#13 at that time (Figure~\ref{fig:ci-scan-log}). The stage view
|
||||||
|
reports Checkout, Syntax check, and Test as separate results, each passing,
|
||||||
|
and the run executed on the built-in node (\emph{Jenkins}). The Checkout
|
||||||
|
stage's log contains the tested commit ID (\texttt{git rev-parse HEAD}) and
|
||||||
|
the interpreter version, Python 3.13.5. The run pages of pull request \#13
|
||||||
|
were later removed by Jenkins when the pull request closed
|
||||||
|
(Section~\ref{sec:ci-trigger}); their results remain as commit statuses in
|
||||||
|
Gitea.
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=\linewidth]{HW6 images/9.2.png}
|
||||||
|
\caption{October 23, 2026 --- Jenkins stage view of \texttt{Scrap-Web/PR-13}
|
||||||
|
run \#2 on commit \texttt{b899233}: Checkout, Syntax check, and Test
|
||||||
|
passed, and the Checkout stage reports Python 3.13.5.}
|
||||||
|
\label{fig:ci-stage-view}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\section{Required Merge Gate}
|
||||||
|
\label{sec:ci-gate}
|
||||||
|
|
||||||
|
\subsection{Branch Protection on \texttt{main}}
|
||||||
|
|
||||||
|
The default branch, \texttt{main}, is protected in
|
||||||
|
Gitea~\cite{GiteaProtectedBranches}
|
||||||
|
(\emph{Scrap-Web $\rightarrow$ Settings $\rightarrow$ Branches},
|
||||||
|
Figure~\ref{fig:ci-branch-rule}). The rule was created on October 18, 2026,
|
||||||
|
and the required status check was added on October 23, 2026, once Jenkins
|
||||||
|
had reported its first status.
|
||||||
|
|
||||||
|
\begin{tabularx}{\linewidth}{L{4.6cm}Y}
|
||||||
|
\toprule
|
||||||
|
\textbf{Setting} & \textbf{Value and purpose}\\ \midrule
|
||||||
|
Protected branch & \texttt{main}\\
|
||||||
|
Direct pushes & Disabled. Every change reaches \texttt{main} through a pull
|
||||||
|
request, so it passes the same check and review.\\
|
||||||
|
Required approvals & 1. A teammate other than the author must approve;
|
||||||
|
Gitea does not allow authors to approve their own pull requests.\\
|
||||||
|
Dismiss stale approvals & Enabled. A new commit pushed to the pull request
|
||||||
|
clears earlier approvals, so the final head commit is the one that is
|
||||||
|
reviewed. This was observed during the demonstration: Gitea automatically
|
||||||
|
dismissed an earlier approval when commit \texttt{a5180ad} was pushed
|
||||||
|
(Figure~\ref{fig:ci-pr-fail-fix}).\\
|
||||||
|
Status check & Enabled. Required context:
|
||||||
|
\texttt{Scrap-Web/pipeline/pr-main}\\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabularx}
|
||||||
|
|
||||||
|
The required context was copied from the status Jenkins actually reported on
|
||||||
|
pull request \#13, not typed in advance. Gitea will not save a status-check
|
||||||
|
requirement without a pattern, and a pattern that does not match the
|
||||||
|
reported context exactly leaves the check permanently ``missing'' and blocks
|
||||||
|
every merge (Section~\ref{sec:ci-trigger}).
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.75\linewidth]{HW6 images/branch-rule.png}
|
||||||
|
\caption{October 18, 2026 --- Branch protection rule for \texttt{main} in
|
||||||
|
the Scrap-Web branch settings.}
|
||||||
|
\label{fig:ci-branch-rule}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\subsection{How the Status Reaches Gitea}
|
||||||
|
|
||||||
|
The merge gate depends on a commit status, not on a trigger. A webhook or
|
||||||
|
repository scan only tells Jenkins that something changed; it says nothing
|
||||||
|
about whether the code passes. The sequence is:
|
||||||
|
\begin{enumerate}
|
||||||
|
\item A push to a pull request's branch is detected by the Multibranch job's
|
||||||
|
repository scan (Section~\ref{sec:ci-trigger-config}).
|
||||||
|
\item The job builds the pull request's latest head commit and runs the
|
||||||
|
\texttt{Jenkinsfile} stages.
|
||||||
|
\item When the run starts and again when it finishes, the Jenkins Gitea
|
||||||
|
plugin~\cite{JenkinsGiteaPlugin} calls the Gitea API with the
|
||||||
|
\texttt{jenkins-ci} account's token and sets a commit status on that
|
||||||
|
exact commit: \emph{pending}, then \emph{success} or \emph{failure},
|
||||||
|
under the context \texttt{Scrap-Web/pipeline/pr-main}.
|
||||||
|
\item Gitea's branch protection evaluates the statuses on the pull
|
||||||
|
request's \emph{latest} head commit. The merge is allowed only if that
|
||||||
|
context is \emph{success} there and the required approval has been
|
||||||
|
given. A missing, pending, or failed status blocks the merge.
|
||||||
|
\end{enumerate}
|
||||||
|
Because the status is attached to a commit, every corrective push creates a
|
||||||
|
new head commit that has no status until Jenkins tests it again. An earlier
|
||||||
|
green result cannot be reused for new code.
|
||||||
|
|
||||||
|
\subsection{Failed Check Blocks the Merge}
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.8\linewidth]{HW6 images/pr13-fail-fix.png}
|
||||||
|
\caption{October 23, 2026 --- Pull request \#13 timeline: commit
|
||||||
|
\texttt{a5180ad} with the failed required check
|
||||||
|
\texttt{Scrap-Web/pipeline/pr-main} ($\times$), the earlier approval
|
||||||
|
dismissed automatically, and repair commit \texttt{84a44f0} with the
|
||||||
|
passing check ($\checkmark$).}
|
||||||
|
\label{fig:ci-pr-fail-fix}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\textbf{Links:}
|
||||||
|
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13}{pull request \#13};
|
||||||
|
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13/commits}{its
|
||||||
|
commit list}, where commit \texttt{a5180ad} carries the \emph{failure} status
|
||||||
|
from Jenkins run \#8. The Jenkins run page itself was removed when the pull
|
||||||
|
request closed (Section~\ref{sec:ci-trigger}).
|
||||||
|
|
||||||
|
\textbf{Expected:} the \texttt{Test} stage fails on commit \texttt{a5180ad},
|
||||||
|
Jenkins reports \emph{failure}, and Gitea refuses the merge.
|
||||||
|
\textbf{Actual:} Jenkins run \#8 passed Checkout and Syntax check and
|
||||||
|
failed at Test with \texttt{AssertionError: 13 != 30}
|
||||||
|
(Figure~\ref{fig:ci-runs}); the required check on \texttt{a5180ad} was marked
|
||||||
|
failed (Figure~\ref{fig:ci-pr-fail-fix}), and the pull request could not be
|
||||||
|
merged while that commit was the head.
|
||||||
|
|
||||||
|
\subsection{Passing Check Permits Review and Merge}
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.8\linewidth]{HW6 images/pr13-approved.png}
|
||||||
|
\caption{October 23, 2026 --- Pull request \#13 at repair commit
|
||||||
|
\texttt{84a44f0}: required check \texttt{Scrap-Web/pipeline/pr-main}
|
||||||
|
passed, approved by \texttt{kholmes}, and mergeable.}
|
||||||
|
\label{fig:ci-merge-allowed}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\textbf{Links:}
|
||||||
|
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13}{pull request \#13};
|
||||||
|
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13/commits}{its
|
||||||
|
commit list}, where commit \texttt{84a44f0} carries the \emph{success}
|
||||||
|
status from Jenkins run \#9.
|
||||||
|
|
||||||
|
\textbf{Expected:} all three stages pass on commit \texttt{84a44f0}, the
|
||||||
|
required check turns green, and the merge becomes available once the
|
||||||
|
required approval is given. \textbf{Actual:} as expected. The check passed,
|
||||||
|
\texttt{kholmes} approved the final commit, Gitea reported ``All checks were
|
||||||
|
successful'' and ``This pull request can be merged automatically''
|
||||||
|
(Figure~\ref{fig:ci-merge-allowed}), and the pull request was merged
|
||||||
|
(Section~\ref{sec:ci-failure}).
|
||||||
|
|
||||||
|
\section{Failure, Repair, and Review}
|
||||||
|
\label{sec:ci-failure}
|
||||||
|
|
||||||
|
\begin{description}
|
||||||
|
\item[Issue:] \#11,
|
||||||
|
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/issues/11}
|
||||||
|
\item[Pull request:] \#13, from \texttt{feature/issue-11} into
|
||||||
|
\texttt{main}, with \texttt{Closes \#11} in its description:
|
||||||
|
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13}
|
||||||
|
\item[Required check:] \texttt{Scrap-Web/pipeline/pr-main}
|
||||||
|
\end{description}
|
||||||
|
|
||||||
|
The controlled failure followed the assignment's example: the multiplication
|
||||||
|
in \texttt{total\_price} was replaced with an addition on the pull request's
|
||||||
|
branch, which must make \texttt{test\_total} fail (it expects
|
||||||
|
$10 \times 3 = 30$ but receives $10 + 3 = 13$). The failure was confirmed
|
||||||
|
locally before each push. Only the feature branch was changed; the deployed
|
||||||
|
Gitea and Jenkins services were not touched.
|
||||||
|
|
||||||
|
\subsection{Dated Sequence}
|
||||||
|
|
||||||
|
All times are October 23, 2026, Eastern Time. Each commit ID below matches
|
||||||
|
the commit shown in
|
||||||
|
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13/commits}{pull
|
||||||
|
request \#13's commit list}, where each commit still carries the status its
|
||||||
|
Jenkins run reported. Figure~\ref{fig:ci-runs} shows the complete run
|
||||||
|
history of the \texttt{PR-13} job, captured before Jenkins removed the job
|
||||||
|
when the pull request closed (Section~\ref{sec:ci-trigger}).
|
||||||
|
|
||||||
|
\begin{tabularx}{\linewidth}{L{1.5cm}L{3.3cm}L{1.7cm}L{1.0cm}Y}
|
||||||
|
\toprule
|
||||||
|
\textbf{Time} & \textbf{Step} & \textbf{Commit} & \textbf{Run} &
|
||||||
|
\textbf{Result}\\ \midrule
|
||||||
|
9:39 PM & First run after Python was installed & \texttt{b899233} & \#2 &
|
||||||
|
All stages passed\\
|
||||||
|
11:05 PM & Failing commit pushed (addition) & \texttt{a5180ad} & \#8 &
|
||||||
|
Test stage failed; check \emph{failure}; merge blocked\\
|
||||||
|
11:07 PM & Repair commit pushed (multiplication restored) &
|
||||||
|
\texttt{84a44f0} & \#9 &
|
||||||
|
All stages passed; check \emph{success}\\
|
||||||
|
11:10 PM & Peer review & \texttt{84a44f0} & --- &
|
||||||
|
Approved by \texttt{kholmes}\\
|
||||||
|
11:12 PM & Merge into \texttt{main} & \texttt{1de58d4} (merge) & --- &
|
||||||
|
Merged; issue \#11 closed automatically\\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabularx}
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.75\linewidth]{HW6 images/pr13-runs.png}
|
||||||
|
\caption{October 23, 2026 --- Run history of Jenkins job
|
||||||
|
\texttt{Scrap-Web/PR-13}: run \#1 failed at Checkout (no Python), runs
|
||||||
|
\#3 and \#8 failed at Test (controlled failures), and runs \#2, \#4, \#6,
|
||||||
|
\#7, and \#9 passed.}
|
||||||
|
\label{fig:ci-runs}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\subsection{Expected Versus Actual Results}
|
||||||
|
|
||||||
|
\begin{tabularx}{\linewidth}{L{3.4cm}YY}
|
||||||
|
\toprule
|
||||||
|
\textbf{Step} & \textbf{Expected} & \textbf{Actual}\\ \midrule
|
||||||
|
Failing commit & Syntax check passes; Test fails on
|
||||||
|
\texttt{test\_total}; check reports \emph{failure} &
|
||||||
|
As expected: \texttt{AssertionError: 13 != 30} in run \#8\\
|
||||||
|
Merge attempt & Blocked while the required check fails &
|
||||||
|
Blocked\\
|
||||||
|
Repair commit & All three stages pass; check reports \emph{success} &
|
||||||
|
As expected in run \#9\\
|
||||||
|
Review & The earlier approval is cleared by the new commits; a fresh
|
||||||
|
approval is required on the final commit &
|
||||||
|
Earlier approval dismissed automatically; \texttt{kholmes} approved
|
||||||
|
\texttt{84a44f0} at 11:10 PM\\
|
||||||
|
Merge & Allowed only after the passing check and one approval &
|
||||||
|
Merged at 11:12 PM as \texttt{1de58d4}\\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabularx}
|
||||||
|
|
||||||
|
\subsection{Earlier Attempt and Corrective Action}
|
||||||
|
|
||||||
|
A first failure-and-repair attempt was made earlier the same evening: failing
|
||||||
|
commit \texttt{ab0bcc2} (run \#3, failed at Test) and repair commit
|
||||||
|
\texttt{81c343d} (run \#4, passed). While it was in progress, a separate
|
||||||
|
\texttt{Jenkinsfile} was merged into \texttt{main} through pull request
|
||||||
|
\#15, so pull request \#13 also showed a merge conflict, and a blocked merge
|
||||||
|
could not demonstrate the status check alone. The conflict was resolved by
|
||||||
|
merging \texttt{main} into the branch and keeping the tested
|
||||||
|
\texttt{Jenkinsfile} (commit \texttt{c5538a8}, run \#6), and stray files
|
||||||
|
committed by mistake were removed (run \#7). The cycle was then repeated on a
|
||||||
|
conflict-free branch, producing the sequence above, in which the failed
|
||||||
|
check is the only reason the merge was blocked.
|
||||||
|
|
||||||
|
\section{Credentials and Build Boundary}
|
||||||
|
\label{sec:ci-credentials}
|
||||||
|
|
||||||
|
\subsection{Secret Storage and Scope}
|
||||||
|
|
||||||
|
No token or password appears in the repository, the \texttt{Jenkinsfile},
|
||||||
|
the Compose file, a console log, or this manual. Values are stored only where
|
||||||
|
listed below; this report names them but never reproduces them.
|
||||||
|
|
||||||
|
\begin{tabularx}{\linewidth}{L{3.4cm}L{4.0cm}Y}
|
||||||
|
\toprule
|
||||||
|
\textbf{Secret} & \textbf{Stored in} & \textbf{Scope}\\ \midrule
|
||||||
|
Gitea integration token & Jenkins credential store, global scope, ID
|
||||||
|
\texttt{gitea-jenkins-ci} (Figure~\ref{fig:ci-credential}) & Belongs to
|
||||||
|
the dedicated, restricted account \texttt{jenkins-ci}, which is a Write
|
||||||
|
collaborator on Scrap-Web only. Permissions: \texttt{write:repository} and
|
||||||
|
\texttt{read:user} (Figure~\ref{fig:ci-token}), enough to read the
|
||||||
|
repository and set commit statuses.\\
|
||||||
|
\texttt{jenkins-ci} password & Not stored; used once to create the token &
|
||||||
|
Hint only in the Passwords table.\\
|
||||||
|
Jenkins administrator passwords & Jenkins user database (stored hashed) &
|
||||||
|
One named account per team member; hints only in the Passwords table.\\
|
||||||
|
\bottomrule
|
||||||
|
\end{tabularx}
|
||||||
|
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.7\linewidth]{HW6 images/jenkins-credential.png}
|
||||||
|
\caption{October 23, 2026 --- The \texttt{gitea-jenkins-ci} credential in
|
||||||
|
Jenkins 2.580.1. The token is shown only as ``Concealed''.}
|
||||||
|
\label{fig:ci-credential}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
The pipeline itself uses no secrets: the \texttt{Jenkinsfile} contains no
|
||||||
|
\texttt{withCredentials} block, and \texttt{checkout scm} uses the job's
|
||||||
|
configured repository credential automatically without exposing its value to
|
||||||
|
build steps. A build therefore has nothing secret to print or exfiltrate
|
||||||
|
through its own steps. If the token is ever exposed, it is revoked in Gitea
|
||||||
|
(\texttt{jenkins-ci} $\rightarrow$ Settings $\rightarrow$ Applications), a
|
||||||
|
new one is generated, and the Jenkins credential is updated.
|
||||||
|
|
||||||
|
\subsection{Who Can Change What Jenkins Runs}
|
||||||
|
|
||||||
|
The \texttt{Jenkinsfile} is code that Jenkins executes, so editing it is
|
||||||
|
equivalent to running commands on the build host. Only the two team members
|
||||||
|
can change Scrap-Web: \texttt{samahk13}, the repository owner, and
|
||||||
|
\texttt{kholmes}, a Write collaborator (Figure~\ref{fig:ci-collaborators}).
|
||||||
|
The only other account with Write access is \texttt{jenkins-ci}, which
|
||||||
|
Jenkins uses to read code and post statuses. Because \texttt{main} is
|
||||||
|
protected (Section~\ref{sec:ci-gate}), a change to the \texttt{Jenkinsfile}
|
||||||
|
reaches \texttt{main} only through a pull request that passes the check and
|
||||||
|
is approved by the other team member.
|
||||||
|
|
||||||
|
A Multibranch Pipeline builds a pull request using the \texttt{Jenkinsfile}
|
||||||
|
from that pull request's branch. For pull requests from forks, which could
|
||||||
|
come from someone outside the team, the job's trust setting is
|
||||||
|
\emph{Nobody} (Figure~\ref{fig:ci-branch-source}), so Jenkins builds them
|
||||||
|
with the trusted \texttt{Jenkinsfile} from \texttt{main} rather than the
|
||||||
|
fork's version. An untrusted contributor therefore cannot make Jenkins run a
|
||||||
|
modified pipeline on the build host.
|
||||||
|
|
||||||
|
\subsection{Where Builds Execute and the Risk}
|
||||||
|
|
||||||
|
Builds run on the Jenkins controller's own executor (the built-in node),
|
||||||
|
inside the Jenkins container; there is no separate build agent. This is
|
||||||
|
permitted for this assignment~\cite{JenkinsSecurity}, but it carries a
|
||||||
|
specific risk: build steps run in the same container as Jenkins itself, so a
|
||||||
|
malicious pipeline could read \texttt{/var/jenkins\_home}, including stored
|
||||||
|
credentials and job configuration. The compensating restrictions are:
|
||||||
|
\begin{itemize}
|
||||||
|
\item only the two team members can author pipeline changes, and
|
||||||
|
\texttt{main} requires a passing check and review;
|
||||||
|
\item untrusted fork pull requests cannot replace the \texttt{Jenkinsfile}
|
||||||
|
and receive no credentials;
|
||||||
|
\item the Docker socket is not mounted into the Jenkins container: the
|
||||||
|
Compose file (Section~\ref{sec:ci-deploy}) mounts only the
|
||||||
|
\texttt{jenkins\_home} volume, so a build cannot control other
|
||||||
|
containers or the Droplet;
|
||||||
|
\item the Jenkins web interface is reachable only over HTTPS through Caddy
|
||||||
|
and requires login (Section~\ref{sec:ci-https}).
|
||||||
|
\end{itemize}
|
||||||
|
|
||||||
|
\subsection{Plugin-Update Check}
|
||||||
|
|
||||||
|
On \textit{[date]}, \emph{Manage Jenkins $\rightarrow$ Plugins $\rightarrow$
|
||||||
|
Updates} listed \textit{[n]} available updates \textit{[name any marked as
|
||||||
|
security fixes]}. Action taken: \textit{[updated and restarted Jenkins /
|
||||||
|
deferred until after the assignment, with reason]}. Plugin updates are
|
||||||
|
checked before each assignment, and any plugin with a published security
|
||||||
|
warning is updated first.
|
||||||
|
|
||||||
|
\subsection{Troubleshooting a Failed Trigger or Build}
|
||||||
|
\label{sec:ci-troubleshoot}
|
||||||
|
|
||||||
|
\textbf{The pull request shows no Jenkins status at all:}
|
||||||
|
\begin{enumerate}
|
||||||
|
\item In Jenkins, open the Scrap-Web job's \emph{Scan Repository Log} and
|
||||||
|
check that the pull request was discovered. Run \emph{Scan Repository
|
||||||
|
Now} to discover it immediately instead of waiting for the next
|
||||||
|
one-minute scan.
|
||||||
|
\item If the scan cannot list the repository, check that the
|
||||||
|
\texttt{gitea-jenkins-ci} credential holds a current token and that
|
||||||
|
\texttt{jenkins-ci} is still a Write collaborator
|
||||||
|
(Section~\ref{sec:ci-trigger}).
|
||||||
|
\item If a webhook is used: in Gitea, open \emph{Scrap-Web $\rightarrow$
|
||||||
|
Settings $\rightarrow$ Webhooks}, check \emph{Recent Deliveries} for the
|
||||||
|
response code, and use \emph{Test Delivery} after any fix.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\textbf{A run exists but failed:}
|
||||||
|
\begin{enumerate}
|
||||||
|
\item Open the run's stage view to see which stage failed, then its
|
||||||
|
console output; the first error message is the one to fix.
|
||||||
|
\item Checkout fails: check the integration credential and that Jenkins
|
||||||
|
can reach Gitea. Syntax check or Test fails: reproduce locally with the
|
||||||
|
commands in Section~\ref{sec:ci-pipeline}.
|
||||||
|
\item \texttt{python3: not found}: Python is missing from the Jenkins
|
||||||
|
container. This is a deployment problem, not a code problem.
|
||||||
|
\item The check is green but Gitea reports it as missing: the branch
|
||||||
|
rule's status-check pattern does not exactly match
|
||||||
|
\texttt{Scrap-Web/pipeline/pr-main}; correct the pattern.
|
||||||
|
\item Runs of a closed pull request have disappeared: the Multibranch
|
||||||
|
job removed them as orphaned items. Set \emph{Orphaned Item Strategy}
|
||||||
|
to keep old items (30 days here) and rely on the commit statuses in Gitea
|
||||||
|
for runs that were already removed.
|
||||||
|
\item Fix the cause with a new commit on the same branch. The push starts a
|
||||||
|
new run and a new status on the new head commit. Never weaken the tests
|
||||||
|
or bypass branch protection to make a merge possible.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\section{Manual Quality and Controls}
|
||||||
|
\textit{[Version and history entry, Hosts and Passwords table updates, UML
|
||||||
|
deployment diagram, citations, glossary and index entries, and the operator
|
||||||
|
restart/troubleshooting note.]}
|
||||||
@@ -6,6 +6,11 @@
|
|||||||
\caption{Document Update History\label{Table:DocumentHistory}}
|
\caption{Document Update History\label{Table:DocumentHistory}}
|
||||||
\begin{tabularx}{\linewidth}{L{3.1cm}L{2.2cm}YL{2.0cm}}
|
\begin{tabularx}{\linewidth}{L{3.1cm}L{2.2cm}YL{2.0cm}}
|
||||||
\toprule \textbf{Date / Version} & \textbf{Author Initials} & \textbf{Change} & \textbf{Changed At}\\ \midrule
|
\toprule \textbf{Date / Version} & \textbf{Author Initials} & \textbf{Change} & \textbf{Changed At}\\ \midrule
|
||||||
|
|
||||||
|
October 22, 2026 / 1.5 & SK, KH & Completed the Continuous Integration with Jenkins assignment: deployed a persistent Jenkins LTS container behind HTTPS at \texttt{ci.ssw590-08.me} with firewall-restricted access; integrated Jenkins with the Scrap-Web Gitea repository through a dedicated integration account; added a pricing module, unit tests, and a versioned \texttt{Jenkinsfile}; protected \texttt{main} with a required Jenkins status check and one required approval; and demonstrated a failed, repaired, reviewed, and merged pull request. Updated the Hosts table (Jenkins host and ports) and the Passwords table (Jenkins administrator accounts and the Gitea integration token, hints only). & \ChapterRef{ContinuousIntegration}, \ChapterRef{PWDHST} \\
|
||||||
|
|
||||||
|
October 10, 2026 / 1.4 & SK, KH & Completed the related Gitea automation in LaTeX exercise and documented it in new chapter & \ChapterRef{AutomatedManualBuild} \\
|
||||||
|
|
||||||
October 2, 2026 / 1.3 & SK, KH & Completed the Gitea startup exercise and documented the process. Also, created the hosts and passwords tables to be used throughout the group assignments & \ChapterRef{JenkinsCI}, \ChapterRef{PWDHST} \\
|
October 2, 2026 / 1.3 & SK, KH & Completed the Gitea startup exercise and documented the process. Also, created the hosts and passwords tables to be used throughout the group assignments & \ChapterRef{JenkinsCI}, \ChapterRef{PWDHST} \\
|
||||||
September 24, 2026 / 1.2 & SK, KH& Completed the Digital Ocean Docker Deployment chapter; the class-based JavaScript refactor of the two-button website with its accompanying UML class diagram; the LaTeX Docker chapter ; and the Project Proposal chapter, addressing the two-tool comparison, dashboard, SWOT, and unique-contribution rubric criteria. & \ChapterRef{Digital Ocean}, \ChapterRef{ClassBasedJSRefactor}, \ChapterRef{Latex Docker}, \ChapterRef{ProjectProposal}\\
|
September 24, 2026 / 1.2 & SK, KH& Completed the Digital Ocean Docker Deployment chapter; the class-based JavaScript refactor of the two-button website with its accompanying UML class diagram; the LaTeX Docker chapter ; and the Project Proposal chapter, addressing the two-tool comparison, dashboard, SWOT, and unique-contribution rubric criteria. & \ChapterRef{Digital Ocean}, \ChapterRef{ClassBasedJSRefactor}, \ChapterRef{Latex Docker}, \ChapterRef{ProjectProposal}\\
|
||||||
September 16, 2026 / 1.1 & SK, KH & Completed the Linux Commands assignment: environment setup with terminal printout figure and full solutions to Problem Set sections A--E & \ChapterRef{LinuxCommands} \\
|
September 16, 2026 / 1.1 & SK, KH & Completed the Linux Commands assignment: environment setup with terminal printout figure and full solutions to Problem Set sections A--E & \ChapterRef{LinuxCommands} \\
|
||||||
|
|||||||
@@ -11,3 +11,8 @@
|
|||||||
\newglossaryentry{rollback}{name={rollback},description={A controlled return to a known acceptable version or state after a failed or harmful change}}
|
\newglossaryentry{rollback}{name={rollback},description={A controlled return to a known acceptable version or state after a failed or harmful change}}
|
||||||
\newglossaryentry{runbook}{name={runbook},description={A documented operational procedure for a repeatable task or incident response}}
|
\newglossaryentry{runbook}{name={runbook},description={A documented operational procedure for a repeatable task or incident response}}
|
||||||
\newglossaryentry{synonyms}{name={synonyms},description={Equivalent terms used in this assignment; record preferred terms to avoid ambiguity in instructions and evidence}}
|
\newglossaryentry{synonyms}{name={synonyms},description={Equivalent terms used in this assignment; record preferred terms to avoid ambiguity in instructions and evidence}}
|
||||||
|
\newglossaryentry{pullrequest}{name={pull request},description={A proposed change from one branch into another, reviewed and checked before it is merged}}
|
||||||
|
\newglossaryentry{webhook}{name={webhook},description={An HTTP request that Gitea sends to another service, such as Jenkins, when a repository event occurs}}
|
||||||
|
\newglossaryentry{statuscheck}{name={status check},description={A named pass, fail, or pending result that a CI system attaches to a specific commit}}
|
||||||
|
\newglossaryentry{mergegate}{name={merge gate},description={A branch-protection rule that blocks a merge until required status checks pass and reviews are approved}}
|
||||||
|
\newglossaryentry{jenkinsfile}{name={\texttt{Jenkinsfile}},sort={Jenkinsfile},description={The version-controlled file that defines a Jenkins pipeline's stages and steps}}
|
||||||
|
|||||||
@@ -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()
|
||||||