\chapter{Continuous Integration with Jenkins} \ChapterLabel{JenkinsContinuousIntegration} \index{Jenkins}\index{continuous integration}\index{Python}\index{pull request!CI} \begin{devopsNote}[Assignment 6 status: CI workflow verified; remaining operations checks pending] This chapter implements Chapter 4 of \path{dosManual-V1.38.pdf} incrementally. On October 9, 2026, the team deployed Jenkins, configured HTTPS and named accounts, connected Gitea, and verified the first Python pipeline build. The eight sections below follow the instructor's rubric order. Repository webhooks, protected-branch enforcement, the controlled failed-then-repaired pull request, peer review and merge were subsequently verified the same day. The dedicated restart test, team external IPv4 port checks and plugin update/security-notice review were subsequently verified. Remaining access policy and final access verification remain identified explicitly. The team subsequently supplied current Cloud Firewall attachment/rules, IPv4-only evidence, UFW status, completed plugin and pipeline views, and the named-user Matrix authorization configuration. \end{devopsNote} All dates in this chapter refer to October 9, 2026 unless stated otherwise. Jenkins screenshots can display UTC; the team works in America/New\_York. Build 1 began at 18:34 UTC (14:34 EDT). The account passwords and token values were entered by the team privately and are not part of this report. \section{Jenkins Deployment and Persistence} \phantomsection\label{GlossaryRef:jenkinscontroller}\index{Jenkins!controller} \subsection{Deployment choice and reproducible configuration} The team reused \texttt{ssw590-group7-droplet}, the existing one-vCPU, 1 GB RAM, 25 GB disk DigitalOcean host. The initial read-only capacity check showed 312 MiB available memory, no swap, and 17 GB free disk. The team chose to trial Jenkins on that host rather than resize it. No capacity upgrade or swap configuration was performed. Jenkins uses the official image from Docker Hub \cite{JenkinsDockerA6}. The requested tag was \texttt{jenkins/jenkins:lts-jdk21}; the installed application reported version \textbf{2.580.1}. The deployed image is pinned to the following immutable repository digest: \begin{lstlisting} jenkins/jenkins@sha256: a660310e39ade10631f774bacd5219de767dfd08947ea5c32a739b5e5bb382c1 \end{lstlisting} The digest is one uninterrupted image reference in the actual Compose file. The configuration lives at \path{/home/codex/myfileagent-gitea/compose.jenkins.yaml} and is versioned in \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/assignment6/python-ci/ops/jenkins/compose.jenkins.yaml}{the feature branch's Jenkins Compose file}. The non-secret excerpt is: \begin{lstlisting} services: jenkins: container_name: myfileagent-jenkins restart: unless-stopped environment: JAVA_OPTS: "-Xms64m -Xmx256m" mem_limit: 448m ports: - "127.0.0.1:8080:8080" volumes: - jenkins-home:/var/jenkins_home networks: - gitea-private volumes: jenkins-home: \end{lstlisting} The full file includes the pinned image reference. Jenkins shares the existing private bridge with Gitea and Caddy. The volume \texttt{myfileagent-gitea\_jenkins-home} stores configuration, accounts, credentials, plugins and jobs outside the disposable container layer. The JVM heap limit is not the whole process's memory footprint; the Docker limit bounds the container. Neither limit proves that every future workload fits. Jobs should be run one at a time on this small host. \subsection{Verification and recovery} \EvidenceID{A6-DEPLOY-01}: the combined Compose configuration validated before startup. The first start stalled and a fresh SSH connection timed out. The operator stopped only Jenkins and verified Gitea HTTPS remained HTTP 200. A subsequent start completed initialization and returned HTTP 200 from the internal login page. The original attempt also logged an initialization class-loading exception; its underlying cause was not established, so the report does not attribute that exception conclusively to memory. Adding a loopback port mapping recreated the container without deleting its home volume. Later, installing Gitea plugins required a restart. The named administrator account and saved Jenkins URL remained usable afterward. These initial observations established retained setup state. The dedicated job-before/job-after restart test was subsequently performed as follows. Restart persistence is \textbf{not a backup/restore test}; no Jenkins backup test has been performed or is claimed. \subsection{Verified job restart and persistence} \EvidenceID{A6-PERSIST-01}: before restarting Jenkins, the operator recorded 13 saved files: the multibranch/child-job configuration, six historical \texttt{build.xml} records, and build-number state. Each file's path, byte length and SHA-256 digest was saved. The six builds comprised feature-branch build 1, PR 11 builds 1--4, and main build 1. The command was: \begin{lstlisting} cd /home/codex/myfileagent-gitea docker compose -f compose.yaml -f compose.jenkins.yaml restart jenkins \end{lstlisting} No volume was deleted. After readiness returned, all 13 files were present with unchanged hashes and sizes. Jenkins HTTPS login and Gitea both returned HTTP 200. The authenticated browser displayed the saved multibranch pipeline, both branches, the PR and previous build history. Evidence is retained in \path{evidence/assignment6/persistence/before.json}, \path{evidence/assignment6/persistence/after.json} and \path{evidence/assignment6/persistence/result.json}. The operator then manually scheduled \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/main/2/console}{main build 2}. It checked out unchanged merge commit \texttt{131d605}, used the saved \texttt{gitea-jenkins-ci} credential, found Python 3.13.5, passed syntax and both unit tests, and reported SUCCESS to Gitea. The run began at 15:26:49 EDT (19:26:49 UTC) on October 9, 2026 and took 25 seconds. This checks usable pipeline behavior after restart, not merely file presence. It is an ordinary service restart test, not a backup/restore or a new job-bearing container replacement test. \begin{figure}[H] \centering \includegraphics[width=0.60\linewidth]{hw6_images/post-restart-main-build2.png} \caption[Post-restart main build 2 passed]{October 9, 2026: saved main job build 2 succeeds after Jenkins restart on merge commit \texttt{131d605}. The linked console records checkout, Python, both tests and status delivery.} \label{fig:a6-persistence} \end{figure} \subsection{Recorded plugin versions} The operator recorded installed plugin manifests after restart. Key versions are listed below; the complete dependency inventory is retained at \path{documentation/evidence/assignment6/plugin-inventory.txt}. \begin{tabularx}{\linewidth}{L{4.3cm}Y} \toprule \textbf{Plugin ID} & \textbf{Observed version}\\ \midrule \texttt{gitea} & \texttt{283.v14b\_179495971}\\ \texttt{gitea-checks} & \texttt{606.679.vb\_d632867a\_6b\_b\_}\\ \texttt{git} & \texttt{5.10.1}\\ \texttt{workflow-aggregator} & \texttt{608.v67378e9d3db\_1}\\ \texttt{workflow-}\allowbreak\texttt{multibranch} & \texttt{842.v3a\_b\_59b\_57b\_e6e}\\ \texttt{matrix-auth} & \texttt{3.3}\\ \texttt{timestamper} & \texttt{1.30}\\ \bottomrule \end{tabularx} The initial strategy was ``logged-in users can do anything.'' The team subsequently selected Matrix-based security, granted the named administrator Overall/Administer, and retained no permissions for Anonymous or Authenticated Users; the configuration and confirmation are recorded in Section~\ref{sec:a6-auth}. \section{HTTPS, Access, and Firewall} \subsection{Public hostname, login and certificate} The A record \texttt{ci.myfileagent.tech} resolves to \texttt{142.93.193.110}. Caddy terminates TLS and forwards privately to \texttt{jenkins:8080}, following the Jenkins Caddy integration approach \cite{JenkinsCaddyA6}. Jenkins Location is set to \url{https://ci.myfileagent.tech/}. Caddy's standard reverse proxy handles the forwarded host/protocol headers. Its added site block is: \begin{lstlisting} ci.myfileagent.tech { reverse_proxy jenkins:8080 } \end{lstlisting} The file was backed up, validated in the running Caddy container, and reloaded. Caddy uses the existing production Let's Encrypt ACME endpoint and persistent certificate state; automatic HTTPS provides renewal management \cite{CaddyAutomaticHTTPS}. A Jenkins-hostname-specific renewal exercise has not yet been run. \EvidenceID{A6-HTTPS-01}: external Windows HTTPS verification accepted the certificate and returned HTTP 200 from the complete login-page URL: \begin{center} \url{https://ci.myfileagent.tech/login} \end{center} Only the login page is visible to users who are not signed in; protected Jenkins pages and build details require authentication. The public Gitea commit-status page linked in Section~\ref{sec:a6-public-results} lets a grader inspect the recorded successful Jenkins status without a Jenkins login. Jenkins features require authentication: an anonymous request to \path{/api/json} returned HTTP 403. HTTP returned 308 with a redirect to HTTPS. The observed certificate issuer is Let's Encrypt YE1; validity is October 9, 2026 17:05:21 UTC through January 7, 2027 17:05:20 UTC, with \texttt{ci.myfileagent.tech} in the subject alternative name. The dated non-secret verification is retained at \path{documentation/evidence/assignment6/deployment-verification.txt}. \begin{figure}[H] \centering \includegraphics[width=0.88\linewidth]{hw6_images/jenkins-https-login.jpg} \caption{October 9, 2026: the live Jenkins HTTPS sign-in page. It supports web-service availability only; it is not pipeline or merge-gate evidence.} \label{fig:a6-login} \end{figure} \subsection{Access decision and port boundary} The team requested access from all public addresses so the professor and TA could open the service. Login remains required. The team states that public access is permitted; an independently supplied instructor approval record has not been attached. Chapter 4's written baseline additionally requires approved source ranges or a private access path. Accordingly, this manual records public access as a team-selected exception requiring instructor confirmation, rather than claiming compliance with that baseline restriction. \begin{tabularx}{\linewidth}{L{2.4cm}L{3.4cm}Y} \toprule \textbf{Port/path} & \textbf{Configured exposure} & \textbf{Verification boundary}\\ \midrule 443/TCP & Public Caddy HTTPS & External Jenkins login 200; authentication tested separately.\\ 80/TCP & Public Caddy HTTP & External 308 redirect; ACME validation also uses the proxy.\\ 8080/TCP & Host \texttt{127.0.0.1} only & Mapping verified; team Windows TCP check failed as expected.\\ 50000/TCP & No published agent port & No agent published; team Windows TCP check failed as expected.\\ 3000/TCP & Gitea host loopback & Existing Gitea backend mapping retained.\\ SSH & Public TCP 22 & Current Cloud Firewall permits all IPv4 sources; IPv6 disabled on Droplet.\\ \bottomrule \end{tabularx} The earlier firewall evidence in \ChapterRef{GiteaStartupFoundation} is historical. On October 9, 2026, the team retired the earlier Assignment 3 services and supplied the updated Cloud Firewall rules. Inbound rules now allow only TCP 22, 80 and 443 from all IPv4 and IPv6 sources; the earlier 5050 and 8080 allowances are absent, and no 50000 allowance is present. Outbound ICMP and all TCP/UDP are permitted. Outbound allowances do not publish inbound ports. Public SSH is retained; this record does not imply source-restricted browser access. \EvidenceID{A6-FIREWALL-01}: the Cloud Firewall is named \texttt{ssw590-group7-gitea-firewall}. Its attached-Droplet view lists \texttt{ssw590-group7-droplet}, address \texttt{142.93.193.110}, and ``Up to date.'' The paired views below document both rules and attachment. \begin{figure}[H] \centering \includegraphics[width=0.76\linewidth]{hw6_images/cloud-firewall-rules.png} \caption{October 9, 2026, team-provided evidence: current named Cloud Firewall rules permit inbound TCP 22, 80 and 443 only; earlier 5050/8080 allowances have been removed. Broad outbound rules do not permit inbound connections.} \label{fig:a6-firewall-rules} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\linewidth]{hw6_images/cloud-firewall-attached.png} \caption{October 9, 2026: the firewall attachment lists \texttt{ssw590-group7-droplet}, IPv4 \texttt{142.93.193.110}, as Up to date.} \label{fig:a6-firewall-attachment} \end{figure} \EvidenceID{A6-IPV4-ONLY}: the Droplet's Public IPv6 tab offers ``Enable IPv6,'' establishing that IPv6 is disabled. The team queried the Jenkins hostname for an AAAA record; the response contains the zone's SOA authority record and no AAAA address. The current deployment therefore uses IPv4 only; IPv6 exposure tests are not applicable while this remains the configuration. The firewall's ``All IPv6'' source entries alone do not enable IPv6. \begin{figure}[H] \centering \includegraphics[width=0.66\linewidth]{hw6_images/droplet-ipv6-disabled.png} \caption{October 9, 2026: the Droplet Public IPv6 view offers Enable IPv6; no public IPv6 is enabled. No shutdown or IPv6 activation was performed for this check.} \label{fig:a6-ipv6} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\linewidth]{hw6_images/dns-aaaa-result.png} \caption[CI hostname query returned no AAAA address]{October 9, 2026: team Windows query \texttt{Resolve-DnsName ci.myfileagent.tech -Type AAAA -DnsOnly} returned an SOA authority record and no AAAA address for the CI hostname.} \label{fig:a6-aaaa} \end{figure} \EvidenceID{A6-HOST-FIREWALL}: the team ran the following read-only command as root on the named Droplet and supplied its output: \begin{lstlisting} root@ssw590-group7-droplet:~# sudo ufw status verbose Status: inactive \end{lstlisting} UFW does not provide active host filtering. The verified external filtering layer is the attached DigitalOcean Cloud Firewall, supplemented by the Compose loopback binding for Jenkins and the unpublished agent port. This command does not inventory every possible nftables/iptables rule; a complete host ruleset audit is not claimed. No UFW rule was enabled or changed. The earlier external TCP tests below were supplied before the Cloud Firewall cleanup; they are not relabeled as post-change tests. A fresh administrator SSH/HTTPS connectivity check after cleanup has not been supplied. For temporary private setup, the first SSH tunnel incorrectly used the Docker container name as a host-side DNS name and failed. The corrected tunnel is: \begin{lstlisting} ssh -N -o ExitOnForwardFailure=yes \ -L 8080:127.0.0.1:8080 ssw590-codex \end{lstlisting} This reaches the Droplet's loopback mapping; the final browser entry is HTTPS. \subsection{Team-performed external port checks} \EvidenceID{A6-PORT-01}: on October 9, 2026, the team supplied PowerShell results from its Windows Wi-Fi computer. The commands and observed TCP results were: \begin{lstlisting} Test-NetConnection 142.93.193.110 -Port 8080 # TcpTestSucceeded : False Test-NetConnection 142.93.193.110 -Port 50000 # TcpTestSucceeded : False Test-NetConnection ci.myfileagent.tech -Port 443 # RemoteAddress : 142.93.193.110 # TcpTestSucceeded : True \end{lstlisting} The first two TCP attempts failed; their accompanying ICMP ping checks timed out as well. Ping is a separate observation and is not the basis for the TCP conclusion. The successful 443 check establishes reachability from the same client network, while raw Jenkins and agent ports were unreachable there. These are team-performed tests, not independently rerun by Codex; no exact execution time was supplied. The result does not identify which network rule caused the failed connection and does not establish every source network or IPv6 path. Client private-address details are omitted from the retained sanitized evidence \path{evidence/assignment6/external-port-checks.txt}. \section{Gitea Trigger and Traceability} \subsection{Repository integration and actual deployment} The product repository is \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline}{myfileagent/myfileagent-pipeline}. The dedicated non-admin Gitea identity \texttt{jenkins-ci} has Write collaborator access to this repository. The Jenkins Gitea server entry is named ``MyFileAgent Gitea'' and uses \url{https://myfileagent.tech}. Jenkins detected Gitea version 1.27.3. The Multibranch Pipeline is \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/}{myfileagent-python-ci}. It uses credential ID \texttt{gitea-jenkins-ci}, owner \texttt{myfileagent}, and repository \texttt{myfileagent-pipeline}. Branch discovery excludes branches already filed as PRs; origin PR discovery selects the current PR revision. Fork PR discovery was removed to avoid executing untrusted fork contributions. The integration uses supported Gitea plugin capabilities \cite{GiteaPluginA6}. \begin{figure}[H] \centering \resizebox{\linewidth}{!}{% \begin{tikzpicture}[font=\small, >=Latex, component/.style={draw,rounded corners,align=center,minimum width=3cm,minimum height=1.1cm}, data/.style={draw,align=center,fill=devopsLightBlue,minimum width=2.8cm,minimum height=1cm}] \draw[dashed,rounded corners] (0,-5.1) rectangle (15,3.3); \node[anchor=north west] at (0.15,3.15) {\textit{\(\ll\)device\(\gg\) DigitalOcean Droplet}}; \node[component] (firewall) at (1.8,1.6) {Cloud Firewall\\existing web rules}; \node[component] (proxy) at (8,1.6) {\(\ll\)container\(\gg\)\\Caddy TLS proxy}; \node[component] (gitea) at (3.2,-1) {\(\ll\)container\(\gg\)\\Gitea :3000}; \node[component] (jenkins) at (11.8,-1) {\(\ll\)container\(\gg\)\\Jenkins :8080\\checkout + tests here}; \node[data] (gdata) at (3.2,-3.1) {\(\ll\)volume\(\gg\)\\repositories + SQLite}; \node[data] (jdata) at (11.8,-3.1) {\(\ll\)volume\(\gg\)\\jenkins-home}; \node[component] (browser) at (-4.5,1.6) {Team / grader\\browser\\\href{https://ci.myfileagent.tech/login}{CI login: HTTPS}}; \draw[->] (browser) -- node[above]{HTTPS 443} (firewall); \draw[->] (firewall) -- (proxy); \draw[->] (proxy) -- node[left]{\href{http://gitea:3000/}{private HTTP :3000}} (gitea); \draw[->] (proxy) -- node[right]{\href{http://jenkins:8080/}{private HTTP :8080}} (jenkins); \draw[->] (gitea) -- (gdata); \draw[->] (jenkins) -- (jdata); \draw[->] (jenkins.west) -- node[midway,above,align=center,font=\scriptsize,fill=white,inner sep=2pt]{checkout + API status\\\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline.git}{HTTPS via myfileagent.tech}} (gitea.east); \draw[->] (gitea.south east) -- node[midway,below,align=center,font=\scriptsize,fill=white,inner sep=2pt]{\href{http://jenkins:8080/gitea-webhook/post}{private webhook POST}\\verified HTTP 200: Processed} (jenkins.south west); \node[align=center,font=\scriptsize] at (7.5,-4.4) {Shared private Compose bridge; controller executor; no separate agent.\\Diagram shows service roles; the verified Git/API URL routes through Caddy.}; \end{tikzpicture}} \caption{Actual Assignment 6 deployment adapted from instruction Figure 4.2. Solid paths identify configured service relationships, including the verified private webhook. Its public proxy endpoint is blocked with HTTP 403. Public HTTPS browser access is the team's selected access policy. Builds run on the Jenkins controller, with persistent home storage and Gitea SQLite/repository volumes.} \label{fig:a6-deployment} \end{figure} \paragraph{Actual routes (clickable endpoints).} Browser access is \href{https://ci.myfileagent.tech/login}{HTTPS CI login} through the Cloud Firewall and Caddy to \href{http://jenkins:8080/}{Jenkins on the private bridge}. Public repository/status viewing uses \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/commits/branch/main}{Gitea commit history} through Caddy to \href{http://gitea:3000/}{private Gitea port 3000}. Jenkins checks out \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline.git}{the actual HTTPS Git remote} and reports status through \href{https://myfileagent.tech/api/v1/repos/myfileagent/myfileagent-pipeline/statuses/131d605c5edb5b5080e4d54861c3c7bf7c360c9c}{Gitea's commit-status API} using its stored credential. Gitea delivers repository events by POST to \url{http://jenkins:8080/gitea-webhook/post}; that Docker-only hostname is reachable inside the shared bridge, not from a grader's browser. Status publication uses authenticated POST; its API link identifies the route, not a browser action to perform. Only the HTTPS viewing links are grader-facing. \subsection{Observed trigger and scope correction} \EvidenceID{A6-TRIGGER-01}: the operator explicitly requested a multibranch scan. The scan initially found no Jenkinsfile. After adding the feature branch, another scan discovered it and started build 1. This was a \textbf{manual branch-indexing trigger}, not a proven webhook or polling trigger. Repository discovery first returned an empty list with the narrower token. Adding organization Read scope to a replacement token and updating the Jenkins credential made \texttt{myfileagent-pipeline} available. The initial symptom was not accompanied by a captured HTTP error, so no specific 403 diagnosis is claimed. Gitea scopes separate organization API routes \cite{GiteaScopesA6}. The tested branch is \texttt{assignment6/python-ci}; the complete commit is \begin{lstlisting} 041adfcda4d37d7c1da7de1861d98cc98e6e64b2 \end{lstlisting} The corresponding \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/assignment6\%252Fpython-ci/1/console}{Jenkins build 1 console} prints that checkout revision and reports the final result. At this initial stage the webhook had not yet been configured. The following subsection records its subsequent private-network implementation and automatic runs; no public raw 8080 listener was needed. \subsection{Verified private webhook} \EvidenceID{A6-WEBHOOK-01}: repository hook 1 uses POST with \texttt{application/json}, active push and PR events, and branch filter \texttt{*}. Its destination is \url{http://jenkins:8080/gitea-webhook/post} on the shared private Docker bridge. Gitea's destination allowlist was set to \texttt{external,jenkins}; no blanket private-network wildcard was added. The persistent Gitea container was recreated to apply that environment setting; Gitea returned HTTP 200 afterward, and the team signed in again. The installed Jenkins handler does not verify a shared-secret HMAC. The hook secret is therefore empty; this report does not claim signature authentication. Instead Caddy blocks \texttt{/gitea-webhook} and all subpaths on the public CI site with HTTP 403, while the internal destination remains available. Raw 8080 stays loopback-only. Versioned reproduction files are \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/jenkins/compose.webhook.yaml}{the exact-host Compose override} and \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/jenkins/Caddyfile.jenkins}{the Caddy site block}. The repaired-head delivery \texttt{e0de474d-209a-48f1-a50e-67c79bd447d5} returned HTTP 200 with body \texttt{Processed} at 19:05:55 UTC. Jenkins separately recorded the PR event, checkout SHA and test result. PR opening, failure push, repair push, final configuration push and merge all triggered builds without a manual rescan. Status events are not selected, so Jenkins status reporting does not form a webhook feedback loop. The delivery screenshot and sanitized hook configuration are retained in the Assignment 6 evidence folder. A successful delivery alone is not a passing test result. \section{Versioned Pipeline and Tests} \label{sec:a6-public-results} \paragraph{Public Gitea evidence for the grader.} Open \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/commits/branch/main}{the public main-branch commit-status page}. The merge row \texttt{131d605c5e} and repaired commit \texttt{02d31699aa} show successful checks; the controlled defect \texttt{d6477b3df6} shows a failed check. The included Gitea history screenshot preserves these results. \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/11}{Public PR 11} also records the review and merge. These Gitea views are the unauthenticated evidence entry points. Jenkins console links below provide additional detail for signed-in operators; graders do not need a Jenkins account to inspect the public Gitea results. A passing main check is not a substitute for the commit-specific PR merge-gate evidence in Section 11.5. \paragraph{Public workflow job following the merge.} The grader can also open \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/13/jobs/13}{Gitea Actions run 13, job 13} to inspect the workflow associated with the merge of PR 11 into main. This page identifies the \texttt{manual-pdf.yml} manual-build job and provides additional public evidence of the repository's automated workflow. It is a Gitea Actions job, separate from the Jenkins Python checks. The Gitea commit-status view above supplies the Jenkins result; this Actions link complements that evidence rather than replacing the Jenkins test or required-check records. \phantomsection\label{GlossaryRef:jenkinsfile}\index{Jenkinsfile}\index{unit test} \subsection{Application, dependencies and clean run} The team chose the instruction's permitted Python pricing application. \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/assignment6/python-ci/pricing.py}{pricing.py} multiplies price by quantity and raises ValueError for quantities below one. \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/assignment6/python-ci/tests/test_pricing.py}{The test file} asserts that \texttt{total\_price(10, 3)} equals 30 and that zero quantity is rejected. The pipeline is a root-level \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/assignment6/python-ci/Jenkinsfile}{Jenkinsfile}. \begin{lstlisting} stage('Checkout') { steps { checkout scm; sh 'git rev-parse HEAD' } } stage('Syntax check') { steps { sh 'python3 --version' sh 'python3 -m py_compile pricing.py tests/test_pricing.py' } } stage('Test') { steps { sh 'python3 -m unittest discover -s tests -v' } } \end{lstlisting} The full Declarative Pipeline disables default checkout and concurrent builds, adds timestamps, enforces a five-minute timeout and retains ten builds. Python 3.13.5 was installed from the image's Debian repositories; Git 2.47.3 was present. There are no pip dependencies, Docker socket mounts or separate build agents. Checks execute as the Jenkins container user in \path{/var/jenkins_home/workspace/_python-ci_assignment6_python-ci}. The operator used root only for package installation, not pipeline execution. For a clean local check, clone the repository, select the feature branch and run: \begin{lstlisting} python3 -m py_compile pricing.py tests/test_pricing.py python3 -m unittest discover -s tests -v \end{lstlisting} Expected result: syntax exits zero; two tests pass. Invalid syntax or a failed assertion must cause a nonzero exit and fail its Jenkins stage. \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/assignment6/python-ci/ops/jenkins/install-python.sh}{The versioned Python installation helper} must be rerun after Jenkins container replacement. The installed Python packages survive a restart but are not in the pinned base image or persistent home volume. This limitation is explicit rather than treating package installation as a reproducible custom image build. \subsection{First verified run} \EvidenceID{A6-BUILD-01}: local syntax and both tests passed before commit. The first push failed because the shell had no interactive Git credential; the operator reused the existing restricted credential helper without exposing its values. The branch then pushed successfully. Jenkins build 1 checked out \texttt{041adfc}, completed all three stages and finished SUCCESS. The console contains the following sanitized results: \begin{lstlisting} Python 3.13.5 test_invalid_quantity ... ok test_total ... ok Ran 2 tests in 0.004s OK [Gitea] Notifying branch build status: SUCCESS [Gitea] Notified Finished: SUCCESS \end{lstlisting} \subsection{Readable post-restart run evidence} \EvidenceID{A6-BUILD-02}: the team supplied the Pipeline Steps and console views of main build 2 plus its console text. The controller workspace is \path{/var/jenkins_home/workspace/myfileagent-python-ci_main}. Checkout, syntax compilation and both tests completed; Gitea received SUCCESS. The complete tested revision is: \begin{lstlisting} 131d605c5edb5b5080e4d54861c3c7bf7c360c9c \end{lstlisting} The sanitized excerpt pairs the exact checkout with each stage's outcome: \begin{lstlisting}[basicstyle=\ttfamily\footnotesize] [Pipeline] { (Checkout) Checking out Revision 131d605c5edb5b5080e4d54861c3c7bf7c360c9c (main) + git rev-parse HEAD 131d605c5edb5b5080e4d54861c3c7bf7c360c9c [Pipeline] { (Syntax check) + python3 --version Python 3.13.5 + python3 -m py_compile pricing.py tests/test_pricing.py [Pipeline] { (Test) + python3 -m unittest discover -s tests -v test_invalid_quantity ... ok test_total ... ok Ran 2 tests in 0.000s OK [Gitea] Notifying branch build status: SUCCESS [Gitea] Notified Finished: SUCCESS \end{lstlisting} Expected result: successful checkout, syntax exit zero, both tests passing, and a successful reported status. Actual result: all expected results were observed in this run. The permanent link is \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/main/2/console}{main build 2 console}. The screenshot's localhost address is the team's temporary access path, not the grader-facing service URL. This main-branch run supports pipeline and restart verification; the separate PR runs below prove the merge gate. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{hw6_images/main2-pipeline-stages.png} \caption{October 9, 2026: main build 2 Pipeline Steps shows green Checkout and Syntax check stage results on merge commit \texttt{131d605}. The companion console excerpt identifies the full tested revision.} \label{fig:a6-stages} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\linewidth,trim=205 55 337.5 65,clip]{hw6_images/main2-tests-success.png} \caption{October 9, 2026: the same main build 2 shows both unit tests passing, Gitea status notification and Finished: SUCCESS on commit \texttt{131d605}. The private localhost URL is not the submission access URL.} \label{fig:a6-test-results} \end{figure} \section{Required Merge Gate} \phantomsection\label{GlossaryRef:requiredcheck}\index{merge gate}\index{status check} \EvidenceID{A6-GATE-01}: the first branch build used context \texttt{myfileagent-python-ci/pipeline/head}. The first actual PR build revealed a different context, so the rule was corrected to require: \begin{lstlisting} myfileagent-python-ci/pipeline/pr-main \end{lstlisting} This context is emitted by the Gitea integration on the latest PR head; installation of Gitea Checks alone does not prove enforcement \cite{GiteaChecksA6}. The saved rule for \texttt{main} disables direct pushes and force pushes, requires one approval, dismisses stale approvals, blocks rejected reviews and outstanding official review requests, and disables administrator merge override. The versioned rule is \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/ops/jenkins/main-branch-protection.json}{the applied branch-protection record}. A missing/queued check showed ``Some required checks are missing.'' After build 2 failed, Gitea showed ``Some required checks failed'' and prevented an ordinary merge. After repair, the same required check passed, but the missing review still blocked merging. Nick's subsequent approval satisfied the review requirement and enabled the ordinary Create merge commit action. No bypass was used. Figures~\ref{fig:a6-failed-gate} and~\ref{fig:a6-repaired-gate} record the failed and repaired states; the exact context and SHA are also retained in \path{evidence/assignment6/pr11-check-evidence.json}. \begin{figure}[H] \centering \includegraphics[width=0.60\linewidth,trim=0 1330 0 850,clip]{hw6_images/pr-11-failed-gate.png} \caption[Failed PR check blocks merging (October 9, 2026)]{October 9, 2026, 15:04 EDT: PR 11 head \texttt{d6477b3}; required \texttt{myfileagent-python-ci/}\allowbreak\texttt{pipeline/pr-main} failed in Jenkins PR build 2. Gitea states that required checks were unsuccessful and blocks ordinary merge. The crop retains the failed commit and gate; the full original is retained in the Assignment 6 evidence folder.} \label{fig:a6-failed-gate} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.60\linewidth]{hw6_images/pr-11-repaired-gate.png} \caption{October 9, 2026, after the 15:05 EDT repair: PR head \texttt{02d3169}; required context \texttt{myfileagent-python-ci/}\allowbreak\texttt{pipeline/pr-main} passed in Jenkins PR build 3. The pending human review remained an independent merge blocker. This is the repaired green-check state, distinct from the preceding failed red-check screenshot; neither screenshot claims peer approval was already granted.} \label{fig:a6-repaired-gate} \end{figure} \section{Failure, Repair, and Review} \EvidenceID{A6-PR-01}: \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/issues/10}{issue 10} tracks the CI acceptance exercise. \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/11}{PR 11} links it with \texttt{Closes \#10}, targets \texttt{main}, and requests review from \texttt{nkogut}. GDL's account \texttt{glovely} authored the PR; the tracking issue was created while signed in as \texttt{jenkins-ci}. NK's existing README name correction was preserved by fast-forwarding the local checkout before the exercise. \begin{tabularx}{\linewidth}{L{2.5cm}L{2.4cm}Y} \toprule \textbf{Head / run} & \textbf{Result} & \textbf{Observed event and evidence}\\ \midrule \texttt{ad056a3} / PR 1 & SUCCESS & PR-open webhook automatically discovered PR 11; checkout, syntax and both tests passed.\\ \texttt{d6477b3} / PR 2 & FAILURE & Multiplication changed to addition only on the feature branch; normal-total test failed with \texttt{13 != 30}; required check blocked merge.\\ \texttt{02d3169} / PR 3 & SUCCESS & Multiplication restored without weakening either test; push/synchronization automatically rebuilt the repaired head.\\ \texttt{b7ef485} / PR 4 & SUCCESS & Private webhook/proxy/protection configuration and operating notes versioned; final PR head passed both tests before review.\\ \texttt{131d605} / main 1 & SUCCESS & Human merge produced a new main commit; webhook automatically built it and both tests passed.\\ \bottomrule \end{tabularx} Run links: \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/PR-11/2/console}{failed PR build 2}, \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/PR-11/3/console}{repaired PR build 3}, \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/PR-11/4/console}{final PR build 4}, and \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/main/1/console}{post-merge main build 1}. The controlled failed run retained the invalid-quantity test as passing and returned exit code 1 from the normal-total assertion. No production service failure was needed to demonstrate the gate. At 15:13 EDT, \texttt{nkogut} approved the final head with the comment ``Good changes demonstrating Jenkins + Gitea.'' Gitea then explicitly stated that the PR could be merged automatically. GDL used the normal merge action at 15:14:45 EDT (19:14:45 UTC). PR 11 is merged and closed, and issue 10 closed through its linked closing reference. Codex verified the review, merge and post-merge build; it did not submit the human approval or click the merge. The full merge revision is: \begin{lstlisting} 131d605c5edb5b5080e4d54861c3c7bf7c360c9c \end{lstlisting} \begin{figure}[H] \centering \includegraphics[width=0.60\linewidth]{hw6_images/pr-11-approved-merge-eligible.png} \caption{October 9, 2026: Nick's approval and the passing final PR check made the ordinary merge action available. This is the review-satisfied state, not an administrator override.} \label{fig:a6-approved} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.60\linewidth]{hw6_images/pr-11-merged.png} \caption{October 9, 2026: Gitea records GDL's merge into main and states that PR 11 was successfully merged and closed. The separate main build verified the merge commit after this action.} \label{fig:a6-merged} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\linewidth]{hw6_images/gitea-commit-sequence.png} \caption{October 9, 2026: Gitea main history ties failed commit \texttt{d6477b3}, repaired \texttt{02d3169}, final PR head \texttt{b7ef485}, and merge \texttt{131d605} to their recorded statuses. This overview supplements the mandatory PR merge-gate views.} \label{fig:a6-commit-sequence} \end{figure} \section{Credentials and Build Boundary} \subsection{Identity, scope and controller risk} The verified named Jenkins administrator is \texttt{ssw590}, displayed as Gowri Das Lovely. The team created \texttt{jenkins-ci} in Gitea, completed its first-login password change, and approved Write access to the product repository. No Gitea administrator role was granted to that account. Its replacement token is public-only with repository Read/Write, user Read and organization Read scopes. Jenkins stores it as the Global Gitea Personal Access Token credential \texttt{gitea-jenkins-ci}; no value is in code or this manual. Global scope makes it available to applicable jobs, so job creation and pipeline editing must remain restricted to trusted team members. The team identifies the Bitwarden entries as \texttt{jenkins-admin} and \texttt{gitea-jenkins}; these are storage references, not credential values. On October 9, 2026, after the team reported only one token, Codex confirmed the signed-in account was \texttt{jenkins-ci} and its Applications page listed only \texttt{jenkins-ci-status}, added at 14:26 EDT and last used at 15:27 EDT, matching the successful post-restart build. No superseded token was listed; no further deletion was performed. This verifies the current inventory, not the historical revocation time. The token value was not viewed or recorded; the list screenshot is retained as evidence. \begin{figure}[H] \centering \includegraphics[width=0.94\linewidth]{hw6_images/jenkins-ci-repository-write-access.jpg} \caption{October 9, 2026: the dedicated integration identity has Write access to the product repository. The permission supports status reporting and also allows code changes; the account is not a site administrator.} \label{fig:a6-ci-account} \end{figure} Builds run on the \textbf{controller executor}, a permitted but higher-risk assignment choice. Pipeline code can access the controller's workspace and potentially sensitive service state. The current controller has two configured executors; each job disables concurrent builds. The team has not yet reduced the global executor count to one. Only trusted team members should author the Jenkinsfile; the integration account itself has repository Write access. Fork discovery is disabled, and no privileged Docker socket or inbound agent port is provided. Default-branch restrictions are verified in the merge-gate section. Named-user Matrix authorization now restricts Jenkins administration as described below; the general logged-in group has no permissions. \subsection{Named-user authorization} \label{sec:a6-auth}\index{Jenkins!authorization} \EvidenceID{A6-AUTH-01}: the team selected \textbf{Matrix-based security}. The named Jenkins account \texttt{ssw590}, displayed as Gowri Das Lovely, has \textbf{Overall/Administer}. Anonymous and Authenticated Users show \textbf{No permissions granted}. Administrator access therefore belongs to the named account, not every user who can sign in. The Gitea integration account is a repository identity/credential, not an added Jenkins administrator. The team supplied the configuration screenshot, then confirmed that Manage Jenkins remained accessible after saving. The screenshot shows the configured matrix; saved administrative access is team-confirmed rather than independently reread by Codex. No post-save private-window access result or self-registration-setting screenshot has been supplied; these specific checks remain unconfirmed. The earlier anonymous API denial is recorded separately and is not presented as a new post-change test. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{hw6_images/jenkins-matrix-security.png} \caption{October 9, 2026, team configuration evidence: Matrix-based security grants Gowri Das Lovely Overall/Administer; Anonymous and Authenticated Users have no permissions. The team subsequently confirmed retained administrative access after saving.} \label{fig:a6-matrix} \end{figure} \subsection{Operator restart and troubleshooting} For an ordinary restart, use the recorded Compose pair without deleting volumes: \begin{lstlisting} cd /home/codex/myfileagent-gitea docker compose -f compose.yaml -f compose.jenkins.yaml restart jenkins docker compose -f compose.yaml -f compose.jenkins.yaml ps jenkins curl -I https://ci.myfileagent.tech/login \end{lstlisting} Expected result: Jenkins becomes ready and the saved job remains. The completed persistence test above recorded unchanged before/after job state and a passing subsequent build; repeat this verification after future restarts. If startup fails, inspect filtered logs without printing setup secrets; stop only Jenkins if the host loses responsiveness, confirm Gitea, then diagnose before retry. After container replacement, rerun the Python helper before builds. \phantomsection\label{GlossaryRef:webhook}\index{webhook} For a failed webhook, inspect Gitea event selection, delivery response and timestamp; verify the private destination, Docker network, configured webhook route and authentication/signature settings. Match the delivered head commit to a Jenkins run. For a failed build, identify the failed stage, confirm the checkout SHA and tool availability, reproduce the command, repair on the same branch and verify a fresh status. Never use a successful delivery as proof that tests passed. This is an operator procedure; no live failed webhook has been demonstrated yet. \EvidenceID{A6-PLUGIN-01}: on October 9, 2026, the operator opened Manage Jenkins / Plugins / Updates and selected Check now. The freshness indicator changed from 1 hr 53 min old to 4.3 seconds old, and the page still reported ``No updates available.'' The full installed-plugin page displayed no plugin security, deprecated, incompatible or load-failure notices. Manage Jenkins showed the built-in-node warning about controller builds. That warning was retained and the existing trusted-controller boundary remains documented; no agent was added or warning dismissed. Operator action: retain the current plugin versions because Jenkins offered no updates; keep controller builds limited to trusted team code and repeat this check during maintenance. These observations describe Jenkins's refreshed update data and displayed notices, not a guarantee that no vulnerability exists. \begin{figure}[H] \centering \includegraphics[width=\linewidth,trim=0 185 0 0,clip]{hw6_images/plugin-updates-complete.png} \caption[Refreshed Jenkins plugin check]{October 9, 2026: after Check now, the team-provided completed Updates view clearly reports No updates available. It replaces the earlier capture made during refresh. Installed-plugin notices and the controller-build warning were reviewed separately.} \label{fig:a6-plugin-check} \end{figure} Do not run the manual compiler and heavy Jenkins jobs concurrently; cost/cleanup remains on the existing team-owned Droplet, with no new purchased cloud resource. On retirement, revoke the CI token, remove its access and DNS/proxy entry, and preserve any needed Jenkins home data before deleting resources. \section{Manual Quality and Controls} This Assignment 6 work-in-progress edition is version \textbf{1.8.2}, dated October 9, 2026, with history/AI entries attributed to \textbf{GDL, NK, CDX}. The history names Hosts and Passwords changes explicitly. Earlier chapters and the completed Assignment 5 evidence were preserved from the latest repository source. This chapter records decisions, expected/actual results, failed attempts, corrections, links and a deployment diagram. New CI terms are linked in the glossary and indexed; citations identify reused guidance. \begin{tabularx}{\linewidth}{L{5.0cm}Y} \toprule \textbf{Acceptance item} & \textbf{Status at this edition}\\ \midrule Official Jenkins deployment and persistent home & Verified ordinary restart: 13 saved records unchanged; main build 2 passed.\\ HTTPS URL, login and redirect & Verified; team external 8080/50000 failed and 443 passed; current Cloud Firewall attachment/rules and IPv4-only status documented; public-access approval remains unresolved.\\ Repository discovery and traceable run & Verified private webhook, PR events, pushes and post-merge main run.\\ Versioned pipeline and meaningful tests & Initial and repaired/final PR heads passed; main build 2 stage/commit/test evidence added.\\ Protected default branch and required check & Verified exact PR context; failure blocked merge; normal merge after approval.\\ Issue-linked failure, repair, review and merge & Verified issue 10 / PR 11; NK approved, GDL merged.\\ Credentials and build boundary & Matrix administrator permissions and retained access team-confirmed; plugin evidence replaced. Bitwarden references recorded; private-window/self-registration checks unconfirmed.\\ Document controls and final submission & Version/history/registries updated; publication commit/run and artifact are identified on the Build Identity page and in Section 10.5.\\ \bottomrule \end{tabularx}