Document Assignment 6 Jenkins CI in the manual (refs #14)
Add the Continuous Integration with Jenkins chapter in the eight rubric sections: deployment and persistence (capacity test, memory-limit fix, restart test), HTTPS/access/firewall with IPv4 and IPv6 exposure checks, webhook traceability with an actual deployment diagram, pipeline stages, the required pr-main merge gate, PR #15's failure/repair/review/merge sequence, credentials and controller build boundary, and controls. Update the Hosts and Passwords tables (1 GiB resize, Jenkins and ci.yebilly.me, jenkins-bot account and token hints), the title page, abstract, Document History, glossary, and AI prompt log (including Vincent's prepared Oct 19-21 record). Note that Assignment 5's PR #13 merged. Also version pipeline-graph-view and its dependencies in the Jenkins plugin lockfile, and add Vincent's source-only ci/jenkins-capacity test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -1,9 +1,10 @@
|
||||
This group document records the SSW 590 coursework and its supporting
|
||||
commands, designs, and evidence. Assignment 5 automates compilation of the
|
||||
LaTeX manual through Gitea Actions, using a repository-scoped Docker runner
|
||||
on Vincent's laptop while Gitea remains on the DigitalOcean droplet. The
|
||||
workflow checks out the triggering revision, compiles with a recorded TeX
|
||||
Live toolchain, adds run and commit identifiers to the PDF version, and
|
||||
uploads the PDF and build diagnostics. Two successful source-change runs,
|
||||
an intentional compiler failure, and a successful repair demonstrate the
|
||||
workflow. Earlier chapters retain the group's prior assignment results.
|
||||
commands, designs, and evidence. Assignment 6 adds continuous integration:
|
||||
a Jenkins LTS controller runs beside Gitea on the DigitalOcean droplet,
|
||||
reachable at \url{https://ci.yebilly.me/login} from approved networks only.
|
||||
A Gitea pull request triggers a private webhook; Jenkins tests the pull
|
||||
request's latest head commit with a versioned \texttt{Jenkinsfile} and
|
||||
reports a named status check that branch protection requires before merge.
|
||||
A deliberate unit-test failure blocked pull request \#15, a repair passed,
|
||||
and the change was reviewed and merged. Earlier chapters retain the group's
|
||||
prior assignment results, including the Gitea Actions manual build.
|
||||
|
||||
@@ -521,3 +521,110 @@ replace review of the final workflow-generated PDF. No commit, push,
|
||||
merge, issue closure, or submission was performed by Codex. Final evidence
|
||||
update push, successful artifact review, group pull-request review/merge,
|
||||
issue \#12 closure, and submission remain human workflow steps.
|
||||
|
||||
\section{Assignment 6 Jenkins Capacity and Test Preparation}
|
||||
Date: October 19--21, 2026; Tool: OpenAI Codex; Human: Vincent Sun.
|
||||
Inputs: instructor manual version 1.38 supplied by Vincent, the authorized
|
||||
DigitalOcean droplet view, repository instructions, Vincent's reported resize
|
||||
constraint and choice to test the existing droplet, terminal screenshots, and
|
||||
downloaded capacity measurements. Codex prepared isolated core-only experiments;
|
||||
Vincent ran them through his authenticated SSH connection. The first timed out.
|
||||
After Vincent authorized stopping the graded Color Buttons app, the second
|
||||
demonstrated core startup and 24 successful sampled Gitea HTTP checks. No kernel
|
||||
out-of-memory event was recorded; final container accounting nevertheless
|
||||
included about 80\,MiB RAM plus 212\,MiB swap. This is not evidence of plugin or
|
||||
build capacity. Human/AI correction: the raw result claimed a 60-second idle
|
||||
window, but recorded successful HTTP samples span only 54 seconds. Codex
|
||||
preserved the evidence and prepared a corrected, unexecuted core script whose
|
||||
timer starts after a successful response.
|
||||
|
||||
Vincent requested a portable human/Claude handoff for Billy Ye. Codex assembled
|
||||
selected non-secret references, original evidence, scripts, structured state,
|
||||
the prior team PDF and integrity hashes. The instructor PDF was missing at its
|
||||
previous location when packaging; that limitation was identified explicitly.
|
||||
On October 21, Vincent reported school-network connection timeouts. Read-only
|
||||
checks confirmed that the attached Cloud Firewall allowed the measured source
|
||||
IPv4, Gitea HTTPS responded, and TCP 22 timed out. The location/cause of filtering
|
||||
was not proven. No firewall change, reboot or package upgrade was made by Codex.
|
||||
|
||||
Vincent asked Codex to prepare and explain the next test. The versioned test
|
||||
sources include a host-side Python controller, disposable container
|
||||
bootstrap, explicit Pipeline/Gitea plugin requests, plugin archive inventory,
|
||||
trusted initialization hook, sample Python pipeline, fault/regression checks
|
||||
and a readable runbook. The prepared test covers constrained installation,
|
||||
plugin activation, a corrected 60-second healthy observation, then serial
|
||||
passing, intentionally failing and repaired calculation tests. It retains
|
||||
resource and Gitea checks, separate RAM/swap accounting, targeted cleanup and
|
||||
a detached deadline. It adds no production credential, public Jenkins endpoint,
|
||||
webhook, merge check, persistent service or paid resource. The controller's
|
||||
single executor is restricted by the experiment's trusted local fixture; it
|
||||
does not establish the final production build boundary.
|
||||
|
||||
Verification used: nine local Python regression/fault checks passed, including
|
||||
the actual sample application's pass/failure/repair sequence; Git Bash accepted
|
||||
the bootstrap syntax. Official plugin documentation supplied version/baseline
|
||||
checks. Docker was initially off; Vincent then enabled it and authorized local
|
||||
verification. The first local attempt exhausted the installer's 128\,MiB Java
|
||||
heap while reading the plugin catalog, before Jenkins started; Docker did not
|
||||
report a kernel OOM kill. Codex separated laptop-only plugin preparation
|
||||
(768\,MiB RAM, 512\,MiB heap) from runtime. The official installer prepared
|
||||
59 versioned and hashed plugin archives, and its temporary container was removed.
|
||||
|
||||
The revised runtime kept the original limits: 256\,MiB RAM, 512\,MiB for RAM
|
||||
plus swap, half a CPU and a 128\,MiB heap. All 59 plugins loaded; healthy HTTP
|
||||
samples spanned 65.39 seconds before the job ran. Three serial Jenkins builds
|
||||
produced success, the intended unit-test failure, and repaired success. Peak
|
||||
simultaneous accounted RAM plus swap was about 389.5\,MiB, with zero recorded
|
||||
container OOM events. Cleanup succeeded and no experiment containers remained.
|
||||
This demonstrates local Jenkins execution, not capacity beside Gitea on the
|
||||
droplet. The laptop Docker VM had substantially more host resources; local mode
|
||||
recorded the unmeasured droplet host/Gitea fields as null. Original failed and
|
||||
successful evidence was retained. The upload package includes the resolved
|
||||
plugin archives so the droplet need not repeat the larger catalog-resolution
|
||||
step. Remaining work includes the guarded droplet run, actual Gitea integration and
|
||||
merge-gate exercise, and the Assignment 6 report chapter. Hosts and Passwords
|
||||
tables remain unchanged because no persistent service or real integration
|
||||
credential was added. Existing deployment files and evidence were preserved;
|
||||
no commit, push, merge or submission was performed by Codex.
|
||||
|
||||
\section{Assignment 6 Jenkins Deployment, Merge Gate, and Chapter}
|
||||
Date: October 21--23, 2026; Tool: Anthropic Claude Code (Claude Opus 5.5);
|
||||
Human: Billy Ye, with Vincent Sun as reviewer.
|
||||
Inputs: instructor manual version 1.38 (Chapter 4), Vincent's two handoff
|
||||
packages (capacity evidence, the prepared \texttt{ci/jenkins-capacity} test
|
||||
and plugin bundle, and the patch for the preceding record), the repository
|
||||
and its AI guidance, Billy's decisions (Jenkins on the existing droplet,
|
||||
Claude runs droplet commands over SSH with Billy approving each step,
|
||||
browser allowlist of Stevens 155.246.0.0/16 plus team addresses, and the
|
||||
instructor's Python pricing example), and Billy's dated screenshots. Billy
|
||||
loaded his SSH key into the Windows agent and typed its passphrase himself;
|
||||
Claude never saw the passphrase, the Jenkins initial password, any account
|
||||
password, or the \texttt{jenkins-bot} token.
|
||||
|
||||
Claude read the droplet state, ran Vincent's guarded test unchanged
|
||||
(first run aborted on upload permissions it introduced; fixed with
|
||||
\texttt{chmod}; second run passed), wrote the Dockerfile, plugin lockfile,
|
||||
Compose, Caddy, and README changes, deployed Jenkins with a backup and
|
||||
monitored rollout, and pushed the feature commits after Billy asked.
|
||||
Billy performed every web-interface step (DNS, Jenkins setup and security,
|
||||
bot account and token, credential, job, webhook, branch protection, PR
|
||||
creation, merge); Vincent reviewed and approved PR~\#15.
|
||||
|
||||
Human/AI corrections: the plugin installer exhausted a 128\,MiB heap, so
|
||||
Claude replaced it with hashed \texttt{curl} downloads; the 128\,MiB runtime
|
||||
heap hung the web interface, so Claude doubled the container limits with a
|
||||
recorded reason; Claude had dropped \texttt{matrix-auth} when adopting
|
||||
Vincent's bundle, which Billy discovered when the option was missing, and
|
||||
it was added; Billy's question about the build-view screenshot showed no
|
||||
stage view was installed, so \texttt{pipeline-graph-view} was added. Claude
|
||||
redacted a Jenkins reporting-endpoint ID and personal browser details from
|
||||
screenshots.
|
||||
|
||||
Outputs used: the deployment files and application/test/\texttt{Jenkinsfile}
|
||||
in PR~\#15; the command log retained under ignored
|
||||
\texttt{build/evidence/}; \ChapterRef{JenkinsCI}; updated Hosts and Passwords
|
||||
tables; glossary terms; title page, abstract, Document History; this record.
|
||||
Unresolved: three theme plugins installed through the web interface are not
|
||||
in the lockfile; the course deadline was reported as Friday but not checked
|
||||
on the course page by Claude; the final PDF needs the Gitea Actions runner
|
||||
on Vincent's laptop. No submission was performed by Claude.
|
||||
|
||||
@@ -34,16 +34,16 @@
|
||||
\definecolor{devopsLightBlue}{RGB}{232,240,247}
|
||||
|
||||
% Replace these values for each assignment.
|
||||
\newcommand{\AssignmentTitle}{LaTeX Auto-Compilation with Gitea -- Group}
|
||||
\newcommand{\AssignmentNumber}{5}
|
||||
\newcommand{\DocumentVersion}{3.4}
|
||||
\newcommand{\AssignmentTitle}{Gitea + Jenkins Autobuild and Testing -- Group}
|
||||
\newcommand{\AssignmentNumber}{6}
|
||||
\newcommand{\DocumentVersion}{4.0}
|
||||
\newcommand{\DocumentStatus}{Draft}
|
||||
\newcommand{\CourseNumber}{SSW 590}
|
||||
\newcommand{\CourseName}{DevOps}
|
||||
\newcommand{\Authors}{Vincent Sun and Billy Ye}
|
||||
\newcommand{\Organization}{Stevens Institute of Technology}
|
||||
\newcommand{\DocumentDate}{10/7/2026}
|
||||
\newcommand{\DueDate}{Wednesday by 11:59pm}
|
||||
\newcommand{\DocumentDate}{10/22/2026}
|
||||
\newcommand{\DueDate}{Friday by 11:59pm}
|
||||
% CI writes this ignored file in its checkout; ordinary local builds stay unchanged.
|
||||
\providecommand{\CIBuildSuffix}{}
|
||||
\InputIfFileExists{ci-build-metadata.tex}{}{}
|
||||
@@ -146,6 +146,7 @@
|
||||
\include{devopsProjectProposal}
|
||||
\include{devopsGitea}
|
||||
\include{devopsAutomatedManualBuild}
|
||||
\include{devopsJenkins}
|
||||
\include{devopsHostsPasswords}
|
||||
|
||||
% Restore when a chapter cites devopsReferences.bib.
|
||||
|
||||
@@ -346,4 +346,11 @@ review the resulting successful workflow PDF and retain that final artifact
|
||||
for submission. Pull-request review/merge and issue \#12 closure are still
|
||||
pending; no approval or submission is claimed here.
|
||||
|
||||
\textbf{Status update, October 22, 2026:} the pending steps above have since
|
||||
completed.
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/13}{PR~\#13}
|
||||
was merged and issue \#12 is closed (re-checked in Gitea on October 22), and
|
||||
the merged-\texttt{main} workflow run~6 passed (verified by Vincent on
|
||||
October 21). The paragraph above is kept as the version 3.4 record.
|
||||
|
||||
\endgroup
|
||||
|
||||
@@ -12,6 +12,8 @@ link each entry to the changed chapter, table, figure, or controlled artifact.
|
||||
\multicolumn{4}{l}{\small\itshape Document Update History (continued)}\\
|
||||
\toprule \textbf{Date / Version} & \textbf{Author Initials} & \textbf{Change} & \textbf{Changed At}\\ \midrule
|
||||
\endhead \bottomrule \endlastfoot
|
||||
October 22--23, 2026 / 4.0 & BY, VS, Claude & Assignment 6: ran the guarded Jenkins capacity test on the resized 1\,GiB droplet; deployed Jenkins 2.580.1 LTS with a hashed plugin lockfile behind Caddy at \texttt{ci.yebilly.me} (Stevens and team allowlist); integrated Gitea via a private webhook and the \texttt{jenkins-bot} identity; required check \texttt{vpn-dns-gateway/pipeline/pr-main} on \texttt{main}; recorded PR~\#15's pass, blocked failure, repair, review, and merge, the restart-persistence and IPv4/IPv6 exposure tests, and the plugin-update check. \textbf{Updated the Hosts table} (resize, Jenkins, \texttt{ci} DNS, Color Buttons retired) and \textbf{the Passwords table} (Jenkins administrators, \texttt{jenkins-bot} account and token, CI allowlist file). Added glossary terms, set the Assignment 6 title page and abstract, and noted the completed Assignment 5 merge. & Title and abstract, \ChapterRef{JenkinsCI}, \ChapterRef{HostsPasswords}, \ChapterRef{AutomatedManualBuild}, \ChapterRef{AIPromptLog}\\
|
||||
October 21, 2026 / preparation & VS, Codex & Recorded core-test timing qualification and the Billy/Claude handoff; prepared the plugin/pipeline test and verified it locally after separating plugin resolution from runtime. The droplet run remains unverified. Hosts and Passwords tables are unchanged because no persistent Jenkins service or real integration credential was added. & \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / 3.4 & VS, Codex & Added the successful run-4 repair screenshots and verified its commit, PDF version, artifact contents, and SHA-256; completed the failure/repair evidence. Replaced the abstract's template instructions with an Assignment 5 summary. Hosts and Passwords tables are unchanged from 3.3; final workflow PDF review and submission remain pending. & Title and abstract, \ChapterRef{AutomatedManualBuild}, \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / 3.3 & VS, Codex & Recorded successful run 2 and intentional failure run 3 with screenshots and downloaded diagnostic verification; removed the test error for a repair push. Updated both the Hosts section and hints-only Passwords table for the local runner; passing repair evidence and final artifact review remain pending. & \ChapterRef{AutomatedManualBuild}, \ChapterRef{HostsPasswords}, \ChapterRef{AIPromptLog}\\
|
||||
October 7, 2026 / 3.2 & VS, Codex & Set the Assignment 5 title, number, and date after successful Gitea run 1; retained its original PDF and evidence. The new title omits the duplicate LMS suffix. Added the draft Automated Manual Build chapter with the workflow and first-PDF screenshots. Hosts and Passwords tables are unchanged; remaining workflow tests and runner records are pending. & Title page, \ChapterRef{AutomatedManualBuild}, \ChapterRef{AIPromptLog}\\
|
||||
|
||||
@@ -23,3 +23,10 @@
|
||||
|
||||
\newglossaryentry{build-runner}{name={build runner},description={A registered worker that receives workflow jobs and executes them in its configured environment}}
|
||||
\newglossaryentry{build-artifact}{name={build artifact},description={A file retained by a workflow run for download, such as a compiled PDF or diagnostic log; retention may be limited}}
|
||||
|
||||
\newglossaryentry{webhook}{name={webhook},description={An HTTP request that one service sends automatically to another when an event occurs, such as Gitea notifying Jenkins of a push or pull-request update}}
|
||||
\newglossaryentry{status-check}{name={status check},description={A named pass/fail result that a CI system attaches to a commit through the Git server's commit-status API; Gitea shows it on pull requests}}
|
||||
\newglossaryentry{branch-protection}{name={branch protection},description={Repository rules on a branch, such as disallowing direct pushes and requiring status checks and approvals before a pull request can merge}}
|
||||
\newglossaryentry{jenkinsfile}{name={Jenkinsfile},description={A version-controlled file at the repository root that defines a Jenkins pipeline's stages and steps}}
|
||||
\newglossaryentry{controller}{name={controller},description={The central Jenkins server that serves the web interface, stores configuration, and schedules builds; it can also run builds on its own executors}}
|
||||
\newglossaryentry{build-agent}{name={build agent},description={A separate machine or container that connects to a Jenkins controller and runs builds, isolating build code from the controller}}
|
||||
|
||||
@@ -10,33 +10,44 @@ password, token, recovery code, or private key. Distinct services use distinct
|
||||
credentials, which are stored outside this manual and outside every
|
||||
repository. Both tables were created on 28 September 2026 for Assignment 4
|
||||
(\ChapterRef{GiteaFoundation}). The local runner host and its identity hint
|
||||
were added on October 7, 2026 for \ChapterRef{AutomatedManualBuild}.
|
||||
were added on October 7, 2026 for \ChapterRef{AutomatedManualBuild}. On
|
||||
October 22--23, 2026 (\ChapterRef{JenkinsCI}) the droplet record was updated
|
||||
for the 1\,GiB resize, the Jenkins service, and \texttt{ci.yebilly.me}; the
|
||||
Color Buttons app was marked retired; and the Passwords table gained the
|
||||
Jenkins administrators, the \texttt{jenkins-bot} Gitea account, and its token.
|
||||
|
||||
\section{Hosts}
|
||||
\small
|
||||
\begin{tabularx}{\linewidth}{@{}L{3.3cm}Y@{}}
|
||||
\caption{Hosts\label{Table:Hosts}}\\
|
||||
\toprule \textbf{Field} & \textbf{Droplet The-Ocean (git.yebilly.me, colors.yebilly.me)}\\ \midrule
|
||||
\toprule \textbf{Field} & \textbf{Droplet The-Ocean (git.yebilly.me, ci.yebilly.me)}\\ \midrule
|
||||
\endfirsthead
|
||||
\toprule \textbf{Field} & \textbf{Droplet The-Ocean (git.yebilly.me, colors.yebilly.me)}\\ \midrule
|
||||
\toprule \textbf{Field} & \textbf{Droplet The-Ocean (git.yebilly.me, ci.yebilly.me)}\\ \midrule
|
||||
\endhead
|
||||
\bottomrule \endlastfoot
|
||||
Role & Gitea work hub (Gitea 1.27.3 behind Caddy 2.11.4 TLS proxy); since
|
||||
29 Sep 2026 also the Assignment 3 Color Buttons site\\
|
||||
22 Oct 2026 also the Jenkins 2.580.1 LTS controller, which runs the CI builds.
|
||||
The Assignment 3 Color Buttons app (29 Sep 2026) is retired: container
|
||||
stopped with restart policy \texttt{no}; its Caddy route remains\\
|
||||
Environment & Course production (team use)\\
|
||||
Provider & DigitalOcean, NYC1; Ubuntu 24.04 LTS; 1 vCPU, 512\,MB RAM, 10\,GB disk\\
|
||||
Provider & DigitalOcean, NYC1; Ubuntu 24.04 LTS; 1 vCPU; resized from
|
||||
512\,MB to the 1\,GiB Basic plan in October 2026 (961\,MiB reported, 25\,GB
|
||||
plan disk, 1\,GiB swap file)\\
|
||||
Public address / DNS & IPv4 \texttt{147.182.178.136}; \texttt{A} records
|
||||
\texttt{git.yebilly.me} and \texttt{colors.yebilly.me}; public IPv6 assigned
|
||||
but not published in DNS\\
|
||||
Private services & Gitea \texttt{:3000} and \texttt{color-buttons-app}
|
||||
\texttt{:3000} (96\,MiB memory cap) on Docker network \texttt{gitea\_web}, no
|
||||
host ports; SQLite file in volume \texttt{gitea\_gitea-data}\\
|
||||
\texttt{git}, \texttt{ci}, and \texttt{colors} \texttt{.yebilly.me}; public
|
||||
IPv6 \texttt{2604:a880:400:d1:0:5:22d:6001} assigned but not published in DNS\\
|
||||
Private services & Gitea \texttt{:3000} and Jenkins \texttt{:8080} (512\,MiB
|
||||
RAM, 0.75 CPU cap; agent port disabled) on Docker network \texttt{gitea\_web},
|
||||
no host ports; SQLite file in volume \texttt{gitea\_gitea-data}; Jenkins state
|
||||
in volume \texttt{gitea\_jenkins-home}\\
|
||||
Exposed ports & 443/TCP and 80/TCP to all; 22/TCP to approved team addresses only
|
||||
(Cloud Firewall \texttt{gitea-fw})\\
|
||||
(Cloud Firewall \texttt{gitea-fw}); \texttt{ci.yebilly.me} answers only
|
||||
Stevens 155.246.0.0/16 and team addresses (Caddy allowlist), 403 otherwise\\
|
||||
Owner & BY (server administration); VS (review)\\
|
||||
HTTPS URLs & \url{https://git.yebilly.me}, \url{https://colors.yebilly.me}\\
|
||||
Backup status & No backup job; container-replacement persistence verified only
|
||||
(\ChapterRef{GiteaFoundation})\\
|
||||
HTTPS URLs & \url{https://git.yebilly.me}, \url{https://ci.yebilly.me/login}\\
|
||||
Backup status & No backup job; container-replacement persistence verified for
|
||||
Gitea (\ChapterRef{GiteaFoundation}) and restart persistence for Jenkins
|
||||
(\ChapterRef{JenkinsCI}) only\\
|
||||
Monitoring status & No alerting configured; checked manually with
|
||||
\texttt{docker compose ps}, \texttt{docker stats}, and logs\\
|
||||
\end{tabularx}
|
||||
@@ -74,6 +85,12 @@ Monitoring / backup & Runner logs and Gitea Actions checked manually; no automat
|
||||
Gitea local runner identity & VS & Docker volume \texttt{ssw590-local-runner-data}, file \texttt{/data/.runner}; generated identity, no values in Git; registration token supplied privately from repository settings & Repository runner; Docker control on VS laptop\\
|
||||
Gitea \texttt{bill} & BY & BY's password manager & Site administrator\\
|
||||
Gitea \texttt{vsun1} & VS & VS's password manager & Repository administrator\\
|
||||
Gitea \texttt{jenkins-bot} (added 22 Oct 2026) & BY & BY's password manager; used only to create its token & Write collaborator on \texttt{vpn-dns-gateway}\\
|
||||
\texttt{jenkins-bot} token \texttt{jenkins-ci} & BY & Jenkins credential ID \texttt{gitea-jenkins-bot} (System, Global), encrypted in volume \texttt{gitea\_jenkins-home}; revoke under the bot's Gitea Applications settings & Repository read/write; organization and user read\\
|
||||
Jenkins \texttt{billy} & BY & BY's password manager & Administer (all)\\
|
||||
Jenkins \texttt{vsun1} & VS & VS's password manager & Administer (all)\\
|
||||
Jenkins initial admin password & --- & One-time setup secret in \texttt{/var/jenkins\_home/secrets/}; read once by BY, superseded by named accounts & Setup only\\
|
||||
CI allowlist \texttt{.env} & BY & \texttt{\textasciitilde/gitea/.env} on the droplet, root-only; holds team IP addresses (personal data, not a secret) & n/a\\
|
||||
DigitalOcean team & BY, VS & Each member's own login, in their password manager & Team member\\
|
||||
Namecheap (\texttt{yebilly.me}) & BY & BY's password manager & Domain owner\\
|
||||
Droplet \texttt{root} SSH & BY & Key-based only; private key \texttt{digiOcean} on BY's laptop; no password login & Root\\
|
||||
|
||||
@@ -0,0 +1,613 @@
|
||||
\chapter{Continuous Integration with Jenkins}
|
||||
\ChapterLabel{JenkinsCI}
|
||||
\index{Jenkins}
|
||||
\index{Jenkins!merge gate}
|
||||
\index{Gitea!required status check}
|
||||
\begingroup
|
||||
\sloppy
|
||||
|
||||
This chapter records Assignment 6, \emph{Gitea + Jenkins Autobuild and
|
||||
Testing -- Group} (instructor manual version 1.38, Chapter 4). Jenkins now runs
|
||||
beside Gitea on the droplet \texttt{The-Ocean}. A pull request (PR) to
|
||||
\texttt{main} in the
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway}{Group 1 Gitea
|
||||
repository} triggers a Jenkins pipeline through a private \gls{webhook}.
|
||||
Jenkins tests the PR's latest head commit and reports a named
|
||||
\gls{status-check} to Gitea; \gls{branch-protection} on \texttt{main} blocks
|
||||
the merge until that check passes and a teammate approves. The work was
|
||||
carried out on October 21--23, 2026 (times below are UTC unless marked
|
||||
Eastern). Sections~\ref{Section:JenkinsDeployment}--\ref{Section:JenkinsQuality}
|
||||
follow the eight rubric rows in order.
|
||||
|
||||
\begin{devopsNote}[Result summary]
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/15}{PR~\#15}
|
||||
(closes
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/14}{issue~\#14})
|
||||
passed on its first commit, was blocked by a deliberate unit-test failure,
|
||||
passed again after the repair, was approved by Vincent, and was merged as
|
||||
\texttt{420ba4c}. Jenkins checked out the exact PR head for every run, and
|
||||
the commit IDs match across Gitea and Jenkins (Table~\ref{Table:JenkinsSequence}).
|
||||
\end{devopsNote}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Jenkins Deployment and Persistence}
|
||||
\label{Section:JenkinsDeployment}
|
||||
\index{Jenkins!deployment}
|
||||
|
||||
\paragraph{Image and plugins.}
|
||||
Jenkins uses the official long-term-support (LTS) image
|
||||
\texttt{jenkins/jenkins:2.580.1-lts-jdk21}, pinned by digest
|
||||
\texttt{sha256:a660310e\ldots82c1}.\footnote{\url{https://www.jenkins.io/doc/book/installing/docker/}}
|
||||
The versioned
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/deploy/jenkins/Dockerfile}{\texttt{deploy/jenkins/Dockerfile}}
|
||||
adds only \texttt{python3} (Python 3.13.5; Git 2.47.3 is already in the
|
||||
image) because builds run on the controller. Plugins come from the lockfile
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/deploy/jenkins/plugins.txt}{\texttt{deploy/jenkins/plugins.txt}},
|
||||
which pins every plugin's version and SHA-256. The image build downloads each
|
||||
archive and verifies its hash. Table~\ref{Table:JenkinsPlugins} lists the
|
||||
plugins the pipeline relies on; the full lockfile holds 63 plugins including
|
||||
dependencies.
|
||||
|
||||
\begin{table}[H]
|
||||
\centering\footnotesize
|
||||
\caption{Principal Jenkins plugins (core 2.580.1)\label{Table:JenkinsPlugins}}
|
||||
\begin{tabular}{@{}L{4.4cm}L{4.4cm}L{6.0cm}@{}}
|
||||
\toprule \textbf{Plugin} & \textbf{Version} & \textbf{Purpose}\\ \midrule
|
||||
\texttt{gitea} & \texttt{286.v0740a\_413c1eb\_} & Gitea SCM source, webhook receiver, commit status\\
|
||||
\texttt{workflow-aggregator} & \texttt{608.v67378e9d3db\_1} & Pipeline suite\\
|
||||
\texttt{pipeline-model-definition} & \texttt{2.2293.v6e7193cec599} & Declarative \texttt{Jenkinsfile} syntax\\
|
||||
\texttt{workflow-multibranch} & \texttt{842.v3a\_b\_59b\_57b\_e6e} & One job per branch / PR\\
|
||||
\texttt{git} & \texttt{5.11.0} & Checkout of the selected revision\\
|
||||
\texttt{matrix-auth} & \texttt{3.3} & Named user permissions\\
|
||||
\texttt{pipeline-graph-view} & \texttt{1053.v9df19e6ceed2} & Stage view of each run\\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
\end{table}
|
||||
|
||||
\paragraph{Capacity preparation.}
|
||||
The droplet originally had 512\,MB RAM. Vincent's October 19 core-only
|
||||
experiments started Jenkins but pushed about 212\,MiB into swap, and their
|
||||
recorded idle window was only 54 seconds of successful samples (see the
|
||||
October 21 record in \ChapterRef{AIPromptLog}). Before this deployment the team
|
||||
resized \texttt{The-Ocean} to the 1\,GiB Basic plan (Linux reports 961\,MiB RAM,
|
||||
24\,GB disk, 1\,GiB swap file). On October 22 Billy ran Vincent's guarded
|
||||
plugin and pipeline test, \texttt{ci/jenkins-capacity/run\_test.py}, unchanged
|
||||
on the droplet:
|
||||
|
||||
\begin{tabularx}{\linewidth}{L{3.6cm}Y}
|
||||
\caption{Guarded capacity test on The-Ocean, October 22, 2026\label{Table:JenkinsCapacity}}\\
|
||||
\toprule \textbf{Record} & \textbf{Observed value}\\ \midrule
|
||||
Run 1 (03:02--03:04) & Aborted: \texttt{java.io.FileNotFoundException}. All 59
|
||||
plugins were active; Gitea returned 200 throughout. Cause: Windows
|
||||
\texttt{scp} uploaded the test folders as root-only, so the container's
|
||||
\texttt{jenkins} user could not read its fixtures. Fixed with
|
||||
\texttt{chmod -R u=rwX,go=rX}; the script was not changed.\\
|
||||
Run 2 (03:05--03:09) & \StatusPass: 59 plugins active, 60.6\,s healthy
|
||||
idle, builds SUCCESS / FAILURE (\texttt{13 != 30}) / SUCCESS\\
|
||||
Peak container memory & 252.8\,MiB RAM, 147.1\,MiB swap (393.9\,MiB together); no OOM events\\
|
||||
Host minimum & 238\,MiB available RAM, 824\,MiB free swap; Gitea 200 on all 30 samples\\
|
||||
CPU & Throttled in 1,689 of 2,212 periods at the 0.5-CPU limit\\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
\paragraph{Compose service.}
|
||||
Jenkins is a third service in the existing
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/deploy/docker-compose.yml}{\texttt{deploy/docker-compose.yml}}
|
||||
(redacted excerpt; no secrets exist in the file):
|
||||
\begin{minted}{yaml}
|
||||
jenkins:
|
||||
build: ./jenkins
|
||||
image: ssw590-jenkins:2.580.1
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- JAVA_OPTS=-Xms64m -Xmx256m -XX:+UseSerialGC -Djava.awt.headless=true
|
||||
volumes:
|
||||
- jenkins-home:/var/jenkins_home
|
||||
networks: [web]
|
||||
mem_limit: 512m
|
||||
memswap_limit: 768m
|
||||
cpus: 0.75
|
||||
pids_limit: 256
|
||||
# no ports: Caddy and the Gitea webhook reach jenkins:8080 privately
|
||||
\end{minted}
|
||||
The first deployment kept the test's limits (256\,MiB RAM, 128\,MiB heap,
|
||||
0.5 CPU). Builds worked, but the setup wizard and plugin pages hung with
|
||||
\texttt{OutOfMemoryError: Java heap space} once Jenkins loaded the
|
||||
update-center catalog. The limits were doubled to those shown above at
|
||||
03:35; Jenkins then answered in 45\,s instead of 184\,s, used about
|
||||
350\,MiB, and left about 180\,MiB of host RAM available with Gitea still
|
||||
returning 200. The service runs one executor so only one build uses memory
|
||||
at a time.
|
||||
|
||||
\paragraph{Persistent state and restart test.}
|
||||
Configuration, users, credentials, jobs, and build history live in the
|
||||
\gls{named-volume} \texttt{gitea\_jenkins-home} mounted at
|
||||
\texttt{/var/jenkins\_home}; the restart policy is \texttt{unless-stopped}.
|
||||
On October 23, after the merge, Billy's session restarted the container and
|
||||
compared state before and after:
|
||||
\begin{minted}{text}
|
||||
== BEFORE 2026-10-23T00:56:21Z started=2026-10-22T03:46:07Z
|
||||
PR-15 builds=3 feature-issue-14 builds=1 main builds=1 users: billy vsun1
|
||||
de35139e5c1d2510 de1a292f55d3050a e0e1e971a6f7e1c4 36bb5fd38ecf7ac6
|
||||
== AFTER 2026-10-23T00:57:07Z (login 200 after ~25s) restart=unless-stopped
|
||||
PR-15 builds=3 feature-issue-14 builds=1 main builds=1 users: billy vsun1
|
||||
de35139e5c1d2510 de1a292f55d3050a e0e1e971a6f7e1c4 36bb5fd38ecf7ac6
|
||||
IDENTICAL: jobs, builds, users, config hashes
|
||||
\end{minted}
|
||||
The four hashes are \texttt{config.xml}, \texttt{credentials.xml}, the Gitea
|
||||
server configuration, and the job configuration. Gitea returned 200
|
||||
throughout. \textbf{Restart persistence is not a backup test}: the volume
|
||||
survives a container restart or replacement, but no copy of it exists
|
||||
elsewhere, so losing the droplet or volume would lose Jenkins' state.
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{HTTPS, Access, and Firewall}
|
||||
\label{Section:JenkinsAccess}
|
||||
\index{Jenkins!HTTPS access}
|
||||
|
||||
\paragraph{Login URL and approved access path.}
|
||||
The Jenkins login page is
|
||||
\textbf{\url{https://ci.yebilly.me/login}}. Caddy serves it only to the Stevens
|
||||
network (155.246.0.0/16, registered to Stevens Institute of Technology in
|
||||
ARIN) and the team's dorm address; every other source receives HTTP 403
|
||||
before reaching Jenkins. \textbf{Instructor access:} open the URL from the
|
||||
Stevens campus network or while connected to the Stevens VPN. No sign-in is
|
||||
needed to see the login page, and no grader account exists. This confirms
|
||||
web-service availability only, not that a pipeline works.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-login-2026-10-21.png}
|
||||
\caption{October 21, 2026, 11:40 p.m.\ Eastern: the Jenkins sign-in page at
|
||||
\texttt{ci.yebilly.me/login} over HTTPS from the team's allowlisted address.
|
||||
Bookmarks and taskbar applications are blurred.}
|
||||
\label{Figure:JenkinsLogin}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{DNS, certificate, and redirect.}
|
||||
Billy added an \texttt{A} record \texttt{ci} $\rightarrow$
|
||||
\texttt{147.182.178.136} at Namecheap (Figure~\ref{Figure:JenkinsDNS}). No
|
||||
\texttt{AAAA} record is published for \texttt{ci}. Caddy obtained the
|
||||
certificate automatically at 03:17:31 on October 22 and renews it without a
|
||||
cron job; its renewal window, reported by the certificate authority, is
|
||||
December 20--22, 2026.\footnote{\url{https://caddyserver.com/docs/automatic-https}}
|
||||
The \texttt{ci.yebilly.me} block in
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/deploy/Caddyfile}{\texttt{deploy/Caddyfile}} is:
|
||||
\begin{minted}{text}
|
||||
ci.yebilly.me {
|
||||
@denied not remote_ip 155.246.0.0/16 {$CI_TEAM_IPS}
|
||||
respond @denied 403
|
||||
reverse_proxy jenkins:8080
|
||||
}
|
||||
\end{minted}
|
||||
\texttt{CI\_TEAM\_IPS} is read from the untracked, root-only
|
||||
\texttt{\textasciitilde/gitea/.env}, so home addresses are not in Git. Caddy's
|
||||
\texttt{reverse\_proxy} forwards the \texttt{X-Forwarded-*} headers, and the
|
||||
Jenkins URL is set to \texttt{https://ci.yebilly.me/}.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-dns-namecheap.png}
|
||||
\caption{October 22, 2026: Namecheap Advanced DNS for \texttt{yebilly.me},
|
||||
including the new \texttt{ci} \texttt{A} record to the droplet.}
|
||||
\label{Figure:JenkinsDNS}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{External checks.}
|
||||
All tests ran from Billy's laptop, outside the droplet
|
||||
(Table~\ref{Table:JenkinsExposure}). The IPv6 tests target the droplet's
|
||||
IPv6 address directly because IPv6 is enabled on the droplet, even though DNS
|
||||
publishes only IPv4. The laptop's IPv6 address is not on the allowlist, so
|
||||
the IPv6 HTTPS test is also the non-approved-source test.
|
||||
|
||||
{\small
|
||||
\begin{tabularx}{\linewidth}{L{4.0cm}L{3.0cm}L{1.6cm}Y}
|
||||
\caption{External exposure tests\label{Table:JenkinsExposure}}\\
|
||||
\toprule \textbf{Test} & \textbf{Source / time} & \textbf{Expected} & \textbf{Actual}\\ \midrule
|
||||
HTTPS \texttt{ci\ldots/login} & IPv4, allowlisted; Oct 22 03:17:56 & 200 & 200, ``Sign in -- Jenkins'' \StatusPass\\
|
||||
HTTP \texttt{ci\ldots/login} & same & redirect & 308 to \texttt{https://\ldots/login} \StatusPass\\
|
||||
Certificate & same & valid & Let's Encrypt \texttt{YE2}, CN \texttt{ci.yebilly.me}, Oct 22, 2026 -- Jan 20, 2027 \StatusPass\\
|
||||
TCP 8080, 50000 & same & closed & closed/filtered \StatusPass\\
|
||||
TCP 3000 (Gitea backend) & IPv4; Oct 23 01:02 & closed & closed/filtered \StatusPass\\
|
||||
HTTPS \texttt{ci} via droplet IPv6 & IPv6, not allowlisted; Oct 23 01:02:42 & 403 & 403 \StatusPass\\
|
||||
HTTP \texttt{ci} via IPv6 & same & redirect & 308 \StatusPass\\
|
||||
TCP 8080, 50000, 3000 via IPv6 & same & closed & closed/filtered \StatusPass\\
|
||||
\bottomrule
|
||||
\end{tabularx}}
|
||||
|
||||
\paragraph{Firewalls and port mappings.}
|
||||
The DigitalOcean \gls{cloud-firewall} \texttt{gitea-fw} is unchanged from
|
||||
Assignment 4 (Figure~\ref{fig:gitea-fw-rules} in \ChapterRef{GiteaFoundation}):
|
||||
TCP 80 and 443 from all IPv4/IPv6, TCP 22 from approved team addresses only.
|
||||
No rule was added for Jenkins, because Jenkins publishes no port. The host
|
||||
firewall (\texttt{ufw}) is inactive; exposure is controlled by the Cloud
|
||||
Firewall and by Compose publishing nothing except Caddy's ports. On the
|
||||
droplet, October 23:
|
||||
\begin{minted}{text}
|
||||
caddy caddy:2.11.4-alpine 0.0.0.0:80->80/tcp, [::]:80->80/tcp, 0.0.0.0:443->443/tcp, [::]:443->443/tcp
|
||||
gitea gitea/gitea:1.27.3 22/tcp, 3000/tcp (not published)
|
||||
jenkins ssw590-jenkins:2.580.1 8080/tcp, 50000/tcp (not published)
|
||||
\end{minted}
|
||||
The inbound agent port is also disabled in Jenkins' security settings
|
||||
(\texttt{slaveAgentPort=-1}).
|
||||
|
||||
\paragraph{Accounts and roles.}
|
||||
Jenkins uses its own user database with sign-up disabled and matrix-based
|
||||
authorization (Figure~\ref{Figure:JenkinsMatrix}). \texttt{billy} (Billy Ye)
|
||||
and \texttt{vsun1} (Vincent Sun) each hold \emph{Overall/Administer};
|
||||
\emph{Anonymous} and \emph{Authenticated Users} hold nothing.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-security-matrix-2026-10-21.png}
|
||||
\caption{October 21, 2026, 11:50 p.m.\ Eastern: Jenkins security with own
|
||||
user database, sign-up disabled, and matrix authorization granting
|
||||
\emph{Administer} only to the two named team accounts.}
|
||||
\label{Figure:JenkinsMatrix}
|
||||
\end{figure}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Gitea Trigger and Traceability}
|
||||
\label{Section:JenkinsTrigger}
|
||||
\index{webhook}
|
||||
|
||||
Figure~\ref{Figure:JenkinsDeployment} adapts the instructor's reference
|
||||
deployment to what was built. The browser path and the webhook path are
|
||||
separate: browsers reach Jenkins only through the firewall and Caddy's
|
||||
allowlist, while the webhook, checkout, and status calls never leave the
|
||||
droplet.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\resizebox{\linewidth}{!}{%
|
||||
\begin{tikzpicture}[
|
||||
box/.style={draw, rounded corners, align=center, font=\small, minimum height=1.0cm},
|
||||
lbl/.style={font=\scriptsize, fill=white, inner sep=1pt},
|
||||
arr/.style={-{Stealth}, thick}]
|
||||
\node[box] (browser) at (0,0) {Team / instructor\\browser};
|
||||
\node[box, fill=devopsLightBlue] (fw) at (4.3,0) {Cloud Firewall\\\texttt{gitea-fw}\\443 / 80};
|
||||
\node[box] (caddy) at (8.6,0) {Caddy TLS proxy\\allowlist for \texttt{ci}\\alias \texttt{git.yebilly.me}};
|
||||
\node[box] (gitea) at (13.2,1.9) {Gitea \texttt{:3000}};
|
||||
\node[box] (jenkins) at (13.2,-1.9) {Jenkins controller \texttt{:8080}\\\textbf{builds run here}\\(1 executor)};
|
||||
\node[box] (gvol) at (17.4,1.9) {\texttt{gitea-data}\\SQLite + repos};
|
||||
\node[box] (jvol) at (17.4,-1.9) {\texttt{jenkins-home}\\jobs, users,\\credentials};
|
||||
\draw[arr] (browser) -- node[lbl, above=2pt]{HTTPS} (fw);
|
||||
\draw[arr] (fw) -- (caddy);
|
||||
\draw[arr] (caddy.north) |- node[lbl, pos=0.75]{HTTP} (gitea.west);
|
||||
\draw[arr] (caddy.south) |- node[lbl, pos=0.75]{HTTP} (jenkins.west);
|
||||
\draw[arr, dashed, devopsGreen] ([xshift=-6mm]gitea.south) -- node[lbl, left=2pt]{1. webhook} ([xshift=-6mm]jenkins.north);
|
||||
\draw[arr, dashed, devopsBlue] ([xshift=6mm]jenkins.north) -- node[lbl, right=2pt, align=left]{2. checkout + status\\via Caddy alias} ([xshift=6mm]gitea.south);
|
||||
\draw[arr] (gitea) -- (gvol);
|
||||
\draw[arr] (jenkins) -- (jvol);
|
||||
\node[draw, dashed, rounded corners, fit=(caddy) (gitea) (jenkins) (gvol) (jvol), inner sep=8pt,
|
||||
label={[font=\scriptsize]above:Droplet \texttt{The-Ocean} (1\,GiB) / Docker network \texttt{gitea\_web}}] {};
|
||||
\end{tikzpicture}}
|
||||
\caption{Actual deployment, October 2026. Only Caddy's 80/443 are public.
|
||||
Gitea sends the webhook to \texttt{http://jenkins:8080} on the private
|
||||
network; Jenkins checks out code and posts statuses to
|
||||
\texttt{https://git.yebilly.me}, which resolves to Caddy inside the Docker
|
||||
network. Builds run on the controller; there is no separate agent.}
|
||||
\label{Figure:JenkinsDeployment}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{Integration identity.}
|
||||
Gitea user \texttt{jenkins-bot} is a \emph{Write} collaborator on
|
||||
\texttt{ssw590-group1/vpn-dns-gateway}, the lowest repository role that can
|
||||
post commit statuses. Its token \texttt{jenkins-ci} has repository
|
||||
read/write and organization/user read scopes only. The token is stored in
|
||||
Jenkins as credential \texttt{gitea-jenkins-bot}; Jenkins' Gitea server entry
|
||||
points to \texttt{https://git.yebilly.me} with hook management disabled.
|
||||
|
||||
\paragraph{Job and events.}
|
||||
The Multibranch Pipeline job \texttt{vpn-dns-gateway} discovers branches that
|
||||
are not also PRs, and PRs from the origin repository using \emph{the current
|
||||
pull request revision}, so Jenkins builds the PR head itself rather than a
|
||||
temporary merge. PRs from forks are not discovered. The repository webhook
|
||||
\texttt{jenkins-ci} posts JSON to
|
||||
\texttt{http://jenkins:8080/gitea-webhook/post} for \emph{Push},
|
||||
\emph{Pull Request}, and \emph{Pull Request Synchronized} events on all
|
||||
branches. Gitea's \texttt{webhook.ALLOWED\_HOST\_LIST} is set to
|
||||
\texttt{jenkins}, so Gitea may call no other private host. The first
|
||||
repository scan (October 22, 22:39:55) authenticated as the bot and reported
|
||||
no \texttt{Jenkinsfile} yet, as expected (Figure~\ref{Figure:JenkinsScan}).
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-first-scan-2026-10-22.png}
|
||||
\caption{October 22, 2026, 22:39 UTC: first scan of the Multibranch job; the
|
||||
bot credential reaches \texttt{ssw590-group1/vpn-dns-gateway}, and the
|
||||
executor count is 1.}
|
||||
\label{Figure:JenkinsScan}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{Delivery evidence.}
|
||||
A test delivery at 22:54:06 on October 22 returned HTTP 200 with body
|
||||
\texttt{Processed} from \texttt{Server: Jetty(12.1.13)}, that is, from Jenkins
|
||||
itself (Figure~\ref{Figure:JenkinsWebhook}). Real deliveries then started every
|
||||
run in Table~\ref{Table:JenkinsSequence}; for example, the push of
|
||||
\texttt{52b297c} produced the event ``Pull request \#15 event at 11:10:32 PM
|
||||
on Oct 22, 2026'' that started \texttt{PR-15} run~2.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/gitea-webhook-delivery-2026-10-22.png}
|
||||
\caption{October 22, 2026, 22:54 UTC: Gitea webhook \texttt{jenkins-ci} with
|
||||
Push, Pull Request, and Pull Request Synchronized events; test delivery
|
||||
answered 200 \texttt{Processed} by Jenkins. A Jenkins reporting-endpoint ID
|
||||
in one header is blurred.}
|
||||
\label{Figure:JenkinsWebhook}
|
||||
\end{figure}
|
||||
|
||||
\paragraph{Diagnosing a failed delivery.}
|
||||
If a push does not start a build: (1) open \emph{Repository Settings
|
||||
$\rightarrow$ Webhooks $\rightarrow$ jenkins-ci $\rightarrow$ Recent
|
||||
Deliveries} and read the response; (2) ``can only call allowed HTTP
|
||||
servers'' means \texttt{ALLOWED\_HOST\_LIST} was lost, so recreate the Gitea
|
||||
container from Compose; (3) a connection error means Jenkins is down, so run
|
||||
\texttt{docker compose ps} and \texttt{docker compose logs --tail 100 jenkins};
|
||||
(4) a 200 response with no build means the branch has no \texttt{Jenkinsfile}
|
||||
or the event type is not selected, so use \emph{Scan Multibranch Pipeline
|
||||
Now} in Jenkins and read its log. \emph{Redeliver} on the delivery replays
|
||||
the event after the fix.
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Versioned Pipeline and Tests}
|
||||
\label{Section:JenkinsPipeline}
|
||||
\index{Jenkinsfile}
|
||||
|
||||
The repository root contains
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/Jenkinsfile}{\texttt{Jenkinsfile}},
|
||||
the instructor's permitted Python example
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/pricing.py}{\texttt{pricing.py}},
|
||||
and its unit tests in
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/420ba4c56b1c3efa50099a85c16c750a9815091a/tests/test_pricing.py}{\texttt{tests/test\_pricing.py}}.
|
||||
The Declarative \gls{jenkinsfile} is:
|
||||
\begin{minted}{groovy}
|
||||
pipeline {
|
||||
agent any
|
||||
options { skipDefaultCheckout() }
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps { checkout scm }
|
||||
}
|
||||
stage('Syntax check') {
|
||||
steps { sh 'python3 -m py_compile pricing.py' }
|
||||
}
|
||||
stage('Test') {
|
||||
steps { sh 'python3 -m unittest discover -s tests -v' }
|
||||
}
|
||||
}
|
||||
}
|
||||
\end{minted}
|
||||
\begin{itemize}[nosep]
|
||||
\item \textbf{Checkout} fetches the revision Jenkins selected; for PR~\#15 it
|
||||
fetched \texttt{refs/pull/15/head} and checked out the PR head.
|
||||
\item \textbf{Syntax check} compiles \texttt{pricing.py}; a syntax error fails here.
|
||||
\item \textbf{Test} runs two unit tests: \texttt{10 * 3 == 30}, and quantity 0
|
||||
raises \texttt{ValueError}. Expected passing output ends in
|
||||
\texttt{Ran 2 tests \ldots OK}; any failing assertion ends in
|
||||
\texttt{FAILED} and a non-zero exit, which fails the stage.
|
||||
\end{itemize}
|
||||
\textbf{Dependencies:} Python 3.13.5 and Git 2.47.3 come from the Debian
|
||||
packages in the Jenkins image; the tests use only the standard library.
|
||||
\textbf{Clean run:} on any machine with Python 3, check out a commit and run
|
||||
\texttt{python3 -m py\_compile pricing.py} then
|
||||
\texttt{python3 -m unittest discover -s tests -v} from the repository root.
|
||||
In Jenkins, \emph{Build Now} on a branch or PR job repeats the run in a fresh
|
||||
checkout of the same commit.
|
||||
|
||||
Figure~\ref{Figure:JenkinsStages} shows the distinct stage results of a run,
|
||||
here the deliberate failure, with the tested commit identified in its log.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{images/jenkins-pr15-build2-failure-2026-10-22.png}
|
||||
\caption{October 22, 2026: \texttt{PR-15} run~2 for commit \texttt{52b297c}
|
||||
(started by the PR event at 23:10:32 UTC). Checkout and Syntax check passed;
|
||||
Test failed with \texttt{AssertionError: 13 != 30} and exit code~1.}
|
||||
\label{Figure:JenkinsStages}
|
||||
\end{figure}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Required Merge Gate}
|
||||
\label{Section:JenkinsGate}
|
||||
\index{branch protection}
|
||||
|
||||
At 23:09:44 on October 22, Billy saved a branch-protection rule for
|
||||
\texttt{main} (Figure~\ref{Figure:JenkinsProtection}). Its stored settings
|
||||
are: direct push disabled; status check required with the exact context
|
||||
\textbf{\texttt{vpn-dns-gateway/pipeline/pr-main}}; one approval required;
|
||||
merge blocked on rejected reviews; stale approvals dismissed when new commits
|
||||
are pushed; administrators may not override; no bypass list.\footnote{\url{https://docs.gitea.com/usage/access-control/protected-branches}}
|
||||
|
||||
\textbf{How the status reaches Gitea:} at the start and end of each run, the
|
||||
Gitea plugin calls Gitea's commit-status API with the bot token for the
|
||||
tested commit, for example ``\texttt{[Gitea] Notifying pull request build
|
||||
status: FAILURE There was a failure building this commit}''. The context
|
||||
name is built from the job and the PR target branch. Gitea compares it with
|
||||
the protected branch's required context on the PR's latest head commit; a
|
||||
webhook delivery or a green Jenkins page alone does not satisfy the
|
||||
gate.\footnote{\url{https://plugins.jenkins.io/gitea/}}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.85\linewidth]{images/gitea-branch-protection-2026-10-22.png}
|
||||
\caption{October 22, 2026: protection rule for \texttt{main}. The required
|
||||
pattern \texttt{vpn-dns-gateway/pipeline/pr-main} is marked
|
||||
\emph{Matched} against checks Gitea has seen; administrators must follow
|
||||
the rule.}
|
||||
\label{Figure:JenkinsProtection}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{images/gitea-pr15-blocked-2026-10-22.png}
|
||||
\caption{\textbf{Merge blocked.} October 22, 2026, about 23:11 UTC: PR~\#15
|
||||
head \texttt{52b297c} fails required check
|
||||
\texttt{vpn-dns-gateway/pipeline/pr-main} (Jenkins
|
||||
\href{https://ci.yebilly.me/job/vpn-dns-gateway/job/PR-15/2/}{PR-15 run~2});
|
||||
Gitea reports that required checks were not successful and no approval is
|
||||
granted.}
|
||||
\label{Figure:JenkinsBlocked}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{images/gitea-pr15-passing-2026-10-22.png}
|
||||
\caption{\textbf{Passing after repair.} October 22, 2026, after 23:15:26 UTC:
|
||||
PR~\#15 head \texttt{9381d2a} passes required check
|
||||
\texttt{vpn-dns-gateway/pipeline/pr-main} (Jenkins
|
||||
\href{https://ci.yebilly.me/job/vpn-dns-gateway/job/PR-15/3/}{PR-15 run~3}).
|
||||
The only remaining condition is the required peer approval.}
|
||||
\label{Figure:JenkinsPassing}
|
||||
\end{figure}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Failure, Repair, and Review}
|
||||
\label{Section:JenkinsReview}
|
||||
|
||||
Billy opened
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/14}{issue~\#14},
|
||||
pushed branch \texttt{feature/issue-14}, and opened
|
||||
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/15}{PR~\#15}
|
||||
with \texttt{Closes \#14} in its description and Vincent as reviewer. The
|
||||
controlled failure changed multiplication to addition in \texttt{pricing.py}
|
||||
on the same branch; the repair restored it.
|
||||
|
||||
\clearpage
|
||||
\begin{tabularx}{\linewidth}{L{2.6cm}L{1.6cm}L{2.0cm}L{1.9cm}Y}
|
||||
\caption{PR~\#15 sequence, October 22--23, 2026 (UTC)\label{Table:JenkinsSequence}}\\
|
||||
\toprule \textbf{Event} & \textbf{Commit} & \textbf{Jenkins run} & \textbf{Check} & \textbf{Detail}\\ \midrule
|
||||
Initial push / PR & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/ad35197ee4905767b0c3d74159a8dfee29d5c37a}{\texttt{ad35197}} & PR-15 \#1 & success 23:02:18 & Jenkins service, app, tests, \texttt{Jenkinsfile}\\
|
||||
Controlled failure & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/52b297c2f33881f7b483808c0040758cee2a1d8f}{\texttt{52b297c}} & PR-15 \#2 & failure 23:10:51 & \texttt{AssertionError: 13 != 30}; merge blocked\\
|
||||
Repair & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/9381d2aa9a11cb7be1b157ea5ecb1318f9a014f0}{\texttt{9381d2a}} & PR-15 \#3 & success 23:15:26 & Multiplication restored; 2 tests OK\\
|
||||
Peer review & \texttt{9381d2a} & --- & --- & \texttt{vsun1} approved at 00:02:40, Oct 23\\
|
||||
Merge & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/420ba4c56b1c3efa50099a85c16c750a9815091a}{\texttt{420ba4c}} & main \#1 & success 00:55:37 & Merged by \texttt{bill} at 00:55:21; issue \#14 closed automatically\\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
Each Jenkins log names the commit it checked out
|
||||
(\texttt{Checking out Revision 52b297c2f338\ldots} for run~2,
|
||||
\texttt{9381d2aa9a11\ldots} for run~3), and each matches the PR head shown
|
||||
in Gitea at that time. The branch job \texttt{feature/issue-14}~\#1 also
|
||||
passed on \texttt{ad35197} before the PR existed; its context
|
||||
\texttt{vpn-dns-gateway/pipeline/head} is not the required one.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.92\linewidth]{images/gitea-pr15-merged-2026-10-22.png}
|
||||
\caption{October 23, 2026, 00:55 UTC: PR~\#15 merged into \texttt{main} as
|
||||
\texttt{420ba4c}. The timeline shows the passing, failing, and repaired
|
||||
commits and \texttt{vsun1}'s approval.}
|
||||
\label{Figure:JenkinsMerged}
|
||||
\end{figure}
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Credentials and Build Boundary}
|
||||
\label{Section:JenkinsBoundary}
|
||||
\index{Jenkins!build boundary}
|
||||
|
||||
\paragraph{Secrets.}
|
||||
The only integration secret is the \texttt{jenkins-bot} token, stored as
|
||||
the Jenkins credential \texttt{gitea-jenkins-bot} (System, Global scope) and
|
||||
encrypted in \texttt{jenkins-home}. It never appears in Git, Compose, the
|
||||
console log (the log prints only the credential's description), or this
|
||||
manual. The initial administrator password was read once by Billy in his own
|
||||
terminal and is no longer used. Hints for all accounts are in
|
||||
Table~\ref{Table:Passwords}.
|
||||
|
||||
\paragraph{Where builds run, and the risk.}
|
||||
Builds run on the Jenkins \gls{controller} executor (one executor); there is
|
||||
no separate \gls{build-agent}, controller executors are not zero, and no agent
|
||||
port is open. Pipeline code runs as the container's \texttt{jenkins} user
|
||||
with read access to \texttt{jenkins-home}, which holds the encrypted
|
||||
credentials and their key, so a malicious \texttt{Jenkinsfile} could steal
|
||||
the bot token.\footnote{\url{https://www.jenkins.io/doc/book/security/controller-isolation/}}
|
||||
Compensating restrictions:
|
||||
\begin{itemize}[nosep]
|
||||
\item Only Billy and Vincent can push to the repository, so only they can
|
||||
change the \texttt{Jenkinsfile}; \texttt{main} accepts changes only through
|
||||
reviewed PRs.
|
||||
\item PRs from forks are not discovered, so untrusted code never runs.
|
||||
\item No Docker socket is mounted and the container is not privileged; its
|
||||
memory, CPU, and process count are capped.
|
||||
\item The token is limited to one repository role (Write) and read-only
|
||||
organization/user scopes, and can be revoked in Gitea without touching
|
||||
Jenkins.
|
||||
\end{itemize}
|
||||
|
||||
\paragraph{Plugin-update check.}
|
||||
On October 23 at 01:03, the 63 locked plugins were compared with the Jenkins
|
||||
update center for core 2.580.1. One newer version exists
|
||||
(\texttt{workflow-api} \texttt{1413.v2ff1a\_5e720fa\_} $\rightarrow$
|
||||
\texttt{1429.v7a\_1b\_efb\_a\_f7c5}); no security warning matches any installed
|
||||
version. The update was deferred: it is not a security fix and would change
|
||||
the tested set. Updates are applied by regenerating the lockfile, rebuilding
|
||||
the image, and recreating the container.
|
||||
|
||||
\paragraph{Troubleshooting a failed build.}
|
||||
Open the run's \emph{Pipeline Overview} to see which stage failed and its
|
||||
log. A red \emph{Test} stage with an assertion is a code failure: fix the
|
||||
code and push to the same PR. A red \emph{Checkout} usually means the token
|
||||
was revoked or Gitea is unreachable: check the credential and
|
||||
\texttt{curl https://git.yebilly.me} from inside the container. A run that
|
||||
never starts: follow the webhook steps in
|
||||
Section~\ref{Section:JenkinsTrigger}. Memory trouble (slow pages,
|
||||
\texttt{OutOfMemoryError} in \texttt{docker compose logs jenkins}): check
|
||||
\texttt{free -m} and \texttt{docker stats} and restart Jenkins with
|
||||
\texttt{docker compose restart jenkins}.
|
||||
|
||||
%---------------------------------------------------------------
|
||||
\section{Manual Quality and Controls}
|
||||
\label{Section:JenkinsQuality}
|
||||
|
||||
\paragraph{Corrective actions.}
|
||||
Four problems were found and fixed during this work, each recorded with its
|
||||
evidence: (1) the official plugin installer ran out of its 128\,MiB heap while
|
||||
reading the update-center catalog, so the Dockerfile downloads the pinned
|
||||
plugins with \texttt{curl} and checks their SHA-256; (2) the first droplet
|
||||
capacity run failed on upload permissions, fixed by \texttt{chmod}; (3) the
|
||||
128\,MiB heap hung the web interface, fixed by the larger limits in
|
||||
Section~\ref{Section:JenkinsDeployment}; (4) matrix authorization was missing
|
||||
because the capacity bundle covered only Pipeline and Gitea, so
|
||||
\texttt{matrix-auth} was added and the image rebuilt. Three theme plugins
|
||||
(\texttt{dark-theme}, \texttt{dracula-theme}, \texttt{theme-manager}) were
|
||||
installed from the web interface during setup and are not in the lockfile;
|
||||
they survive in \texttt{jenkins-home} but would be lost if the volume were
|
||||
recreated.
|
||||
|
||||
\paragraph{Operator restart and recovery note.}
|
||||
Run these on the droplet as \texttt{root}:
|
||||
\begin{minted}{sh}
|
||||
cd ~/gitea
|
||||
docker compose ps # all three services Up
|
||||
docker compose restart jenkins # state stays in the volume
|
||||
docker compose logs --tail 100 jenkins # startup errors, OutOfMemoryError
|
||||
# after changing deploy/jenkins/plugins.txt:
|
||||
docker compose build jenkins && docker compose up -d jenkins
|
||||
\end{minted}
|
||||
After a droplet reboot, Docker starts all three services because of their
|
||||
restart policies; Jenkins needs about one minute before the login page
|
||||
answers. Gitea does not depend on Jenkins, so a Jenkins outage only delays
|
||||
checks (PRs stay blocked until Jenkins reports).
|
||||
|
||||
\paragraph{Cost, ownership, and cleanup.}
|
||||
Jenkins adds no paid resource; it uses the droplet's 1\,GiB Basic plan
|
||||
(listed at \$6/month on DigitalOcean's pricing page on October 21, 2026; the
|
||||
account's billing was not re-checked here) and about 0.9\,GB of disk for its
|
||||
image. Billy administers the droplet and Jenkins; Vincent reviews. To remove
|
||||
Jenkins: delete the \texttt{main} protection's required check, stop and
|
||||
remove the service (\texttt{docker compose rm -sf jenkins}), delete the volume
|
||||
(\texttt{docker volume rm gitea\_jenkins-home}), remove the \texttt{ci} block
|
||||
from the Caddyfile and the \texttt{ci} DNS record, delete the webhook, and
|
||||
delete the \texttt{jenkins-bot} user and token.
|
||||
|
||||
\paragraph{Document controls.}
|
||||
This version is 4.0. Document History records the change and both updated
|
||||
tables in \ChapterRef{HostsPasswords}: the Hosts table adds \texttt{ci.yebilly.me},
|
||||
the Jenkins service, and the 1\,GiB resize; the Passwords table adds the
|
||||
Jenkins administrators, the \texttt{jenkins-bot} account, and its token.
|
||||
New glossary terms are indexed, and AI assistance is recorded in
|
||||
\ChapterRef{AIPromptLog}.
|
||||
|
||||
\endgroup
|
||||
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 156 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 161 KiB |
|
After Width: | Height: | Size: 302 KiB |
|
After Width: | Height: | Size: 163 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 274 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 226 KiB |