Update manual to v1.6 and merge SRE chapter into one file
Scrap-Web/pipeline/pr-main This commit looks good
Scrap-Web/pipeline/head This commit looks good

This commit is contained in:
2026-11-13 14:09:15 -05:00
parent b4007504b7
commit 5c0ed9fbcd
64 changed files with 2345 additions and 170 deletions
+284 -110
View File
@@ -9,8 +9,7 @@ Jenkins was deployed on the existing DigitalOcean Droplet used for the Gitea env
Jenkins was deployed as a Docker Compose service rather than installed directly on the host operating system. This approach makes the service configuration reproducible and allows the container to be managed independently of the other services running on the Droplet. The Jenkins container is named \texttt{jenkins}.
The Docker Compose configuration defines the Jenkins image, container name, restart policy, Java memory settings, persistent storage, and shared Docker network. The configuration file is located at \texttt{/root/jenkins/docker-compose.yml} on the Droplet. The corresponding source-controlled configuration should be linked here for reproducibility.
The Docker Compose configuration defines the Jenkins image, container name, restart policy, Java memory settings, persistent storage, and shared Docker network. The configuration file is located at \texttt{/root/jenkins/docker-compose.yml} on the Droplet.
The relevant configuration is shown below. It contains no passwords, personal access tokens, or other authentication secrets.
\begin{minted}[fontsize=\small,breaklines,linenos]{yaml}
@@ -36,7 +35,7 @@ networks:
name: gitea-net
\end{minted}
\noindent\textbf{Configuration file:} \texttt{/root/jenkins/docker-compose.yml} on the Droplet. Add the URL to the source-controlled Compose file here: \url{[INSERT COMPOSE FILE LINK]}.
\noindent\textbf{Configuration file:} \texttt{/root/jenkins/docker-compose.yml} on the Droplet. The source-controlled copy is at \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/deployment/docker-compose.yml}.
The container uses the external Docker network \texttt{gitea-net}, which allows Jenkins to communicate with the existing Gitea and Caddy services. Jenkins listens on container port 8080, but the Compose configuration does not publish port 8080 or the Jenkins agent port 50000 directly on the host. Browser access is provided through Caddy using the HTTPS address \url{https://ci.ssw590-08.me/}.
@@ -53,6 +52,13 @@ The Jenkins container is configured with the following Java heap limits:
After the Droplet upgrade, the reported host memory usage was approximately 503 MiB used out of 1.9 GiB, with approximately 931 MiB free and 1.4 GiB available. The reported disk usage was approximately 3.3 GB out of 48 GB, leaving approximately 45 GB available. These values describe the host at the time of measurement and may change as builds execute and logs accumulate.
\begin{figure}[H]
\centering
\includegraphics[width=0.8\linewidth]{HW6 images/droplet-resize.png}
\caption{DigitalOcean resize configuration for the Droplet \texttt{devops-gitea-server}: Basic plan, 1 vCPU, 2 GB RAM, 50 GB disk.}
\label{fig:ci-droplet-resize}
\end{figure}
Because the Droplet hosts several services on a relatively small resource allocation, memory and disk usage should be monitored during builds. The Java heap limit helps constrain Jenkins' Java memory allocation, but it does not represent a limit on the container's total memory usage.
\subsection{Persistent Storage and Restart Policy}
@@ -84,7 +90,14 @@ A container restart test was performed using the following command:
docker restart jenkins
\end{minted}
The command completed successfully. Following the restart, Jenkins was accessible through its HTTPS address, and the existing Jenkins configuration and job remained available. This demonstrated that Jenkins could restart without requiring the service to be reinstalled or configured from scratch.
The command completed successfully. Following the restart, Jenkins was accessible through its HTTPS address, and the existing Jenkins configuration and job remained available. This demonstrated that Jenkins could restart without requiring the service to be reinstalled or configured from scratch. Figure~\ref{fig:ci-restart} shows the running Jenkins, Caddy, and Gitea containers and the Jenkins log after the restart.
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{HW6 images/persisting-jenkins.png}
\caption{Container inspection and \texttt{docker restart jenkins}: the \texttt{unless-stopped} restart policy, the \texttt{jenkins\_home} volume mount, and the Jenkins log after restart (2026-10-22, 02:03 UTC) showing all jobs loaded and Jenkins fully up and running.}
\label{fig:ci-restart}
\end{figure}
The test also supports the use of the named \texttt{jenkins\_home} volume for persistent Jenkins data. A container restart is not, however, a backup or disaster-recovery test. It does not demonstrate that data can be recovered after volume deletion, disk failure, Droplet loss, or corruption. Separate backups of the Jenkins home data and a documented restoration procedure are necessary to establish recoverability.
@@ -101,7 +114,14 @@ Jenkins is accessible through the following HTTPS address:
The hostname \texttt{ci.ssw590-08.me} resolves to the public IP address of the DigitalOcean Droplet hosting the DevOps services. Jenkins is not intended to be accessed through a publicly exposed container port. Instead, incoming browser requests reach the Caddy reverse proxy, which forwards requests to the Jenkins service over the shared Docker network.
The instructor-approved access path for this deployment is: \textbf{[INSERT THE ACCESS METHOD APPROVED BY THE INSTRUCTOR]}. Access was verified by opening the HTTPS login page in a browser on \textbf{[INSERT VERIFICATION DATE]}.
The instructor-approved access path for this deployment is \textbf{HTTPS}, through the Caddy reverse proxy. HTTPS access, including the Caddy-issued certificate, was verified on October 22, 2026 (Figure~\ref{fig:ci-site}).
\begin{figure}[H]
\centering
\includegraphics[width=0.8\linewidth]{HW6 images/jenkins-site.png}
\caption{Jenkins 2.580.1 reached in a browser at \texttt{ci.ssw590-08.me} through Caddy.}
\label{fig:ci-site}
\end{figure}
\subsection{DNS and TLS Certificate}
@@ -122,12 +142,12 @@ The certificate details should be recorded from the certificate actually present
\begin{itemize}
\item \textbf{Hostname:} \texttt{ci.ssw590-08.me}
\item \textbf{Certificate issuer:} [INSERT VERIFIED CERTIFICATE ISSUER]
\item \textbf{Certificate expiration:} [INSERT VERIFIED EXPIRATION DATE]
\item \textbf{Certificate verification date:} [INSERT DATE]
\item \textbf{Certificate issuer:} Caddy (automatic certificate management)
\item \textbf{Certificate expiration:} January 20, 2027
\item \textbf{Certificate verification date:} October 22, 2026
\end{itemize}
Caddy supports automatic HTTPS certificate provisioning and renewal. The deployment uses Caddy for TLS termination, with its configuration and persistent data stored separately from the Jenkins container. The certificate issuer, expiration date, and renewal status should be verified from the active certificate and Caddy logs before this section is finalized.
Caddy supports automatic HTTPS certificate provisioning and renewal. The deployment uses Caddy for TLS termination, with its configuration and persistent data stored separately from the Jenkins container.
\subsection{HTTP-to-HTTPS Redirect and Jenkins Proxy Configuration}
@@ -154,14 +174,14 @@ This URL should also be configured in Jenkins under \textit{Manage Jenkins} $\ri
Jenkins requires authentication to access its administrative interface and configure continuous integration jobs. Access to Jenkins administration and configuration should be restricted to authorized project members.
The Gitea integration uses a dedicated \texttt{jenkins} account and a Gitea Personal Access Token stored in Jenkins credentials. The account has the repository permissions needed for Jenkins to interact with \texttt{SSW-590-08/Scrap-Web}. During integration troubleshooting, repository webhook management initially failed with HTTP 403 responses. The account's repository permissions were subsequently adjusted, and the Jenkins webhook was created successfully in Gitea.
The Gitea integration uses a dedicated \texttt{jenkins-ci} account and a Gitea Personal Access Token stored in Jenkins credentials. The account has the repository permissions needed for Jenkins to interact with \texttt{SSW-590-08/Scrap-Web}. During integration troubleshooting, repository webhook management initially failed with HTTP 403 responses. The account's repository permissions were subsequently adjusted, and the Jenkins webhook was created successfully in Gitea.
The following account and role information should be completed based on the actual Jenkins security configuration:
The Jenkins accounts and roles are:
\begin{itemize}
\item \textbf{Jenkins administrators:} [INSERT AUTHORIZED ADMINISTRATOR ACCOUNTS OR ROLES]
\item \textbf{Jenkins users:} [INSERT AUTHORIZED USER ACCOUNTS OR ROLES]
\item \textbf{Gitea integration identity:} \texttt{jenkins}
\item \textbf{Jenkins administrators:} \texttt{samahk} and \texttt{kaylah7}
\item \textbf{Jenkins users:} \texttt{samahk} and \texttt{kaylah7}
\item \textbf{Gitea integration identity:} \texttt{jenkins-ci}
\item \textbf{Credential storage:} Jenkins Credentials
\end{itemize}
@@ -184,7 +204,7 @@ Direct public access to Jenkins on TCP 8080 is not required. The Jenkins contain
The host's UFW firewall was reported as inactive during deployment verification. Consequently, the DigitalOcean Cloud Firewall and Docker's network and port configuration are important parts of the external access restrictions.
The actual Cloud Firewall rules should be captured in a dated screenshot and compared with the rules listed above. Unneeded inbound rules, including direct public access to TCP 3000 and TCP 5432, should be removed if they are not required by another service.
Any inbound rule that is not required, such as direct public access to TCP 3000 or TCP 5432, should be removed from the Cloud Firewall.
\subsection{Docker Port Mappings}
@@ -206,7 +226,7 @@ This arrangement avoids exposing Jenkins' application port directly to the publi
\subsection{External Connectivity Tests}
External tests were performed from a machine outside the Droplet to verify that selected ports were reachable or blocked from the public network. The test results must be recorded with their execution date and the source machine's network context.
Connectivity tests were run twice: first from a shell on the Droplet, and later from a machine outside it, to check which ports are reachable or blocked from the public network. The date and source of each run are recorded below.
The following command tests the public IPv4 address for TCP connectivity:
@@ -222,49 +242,41 @@ The expected results are:
\item \textbf{TCP 8080:} The connection should fail because Jenkins' internal web port is not published on the host and is not intended to be publicly accessible.
\end{itemize}
Previous external tests of TCP ports 3000, 5432, 8080, and 50000 returned connection failures. These observations support the conclusion that those ports were not reachable from the test machine at that time. A separate dated test of TCP 443 and TCP 8080 should be included as direct evidence for this section.
The test record should include:
Previous external tests of TCP ports 3000, 5432, 8080, and 50000 returned connection failures.
\begin{itemize}
\item \textbf{Test date and time:} [INSERT DATE, TIME, AND TIME ZONE]
\item \textbf{Test source:} [INSERT EXTERNAL MACHINE OR NETWORK]
\item \textbf{Test date and time:} October 24, 2026, 4:25 AM EDT
\item \textbf{Test source:} Shell on the Droplet itself (\texttt{root@devops-gitea-server}), connecting to its own public IPv4 address
\item \textbf{Droplet IPv4 address:} \texttt{147.182.179.191}
\item \textbf{TCP 443 result:} [INSERT OBSERVED RESULT]
\item \textbf{TCP 8080 result:} [INSERT OBSERVED RESULT]
\item \textbf{TCP 443 result:} Succeeded (\texttt{nc} reported the connection to port 443 succeeded)
\item \textbf{TCP 8080 result:} Failed with ``Connection refused,'' so nothing is listening on host port 8080
\end{itemize}
A failed connection alone does not establish which control blocked it. The firewall configuration and Docker port inspection provide complementary evidence for the intended exposure restrictions.
Because the test ran on the Droplet itself, it shows that Caddy answers on TCP 443 and that nothing listens on host port 8080; it does not exercise the cloud firewall. A failed connection alone does not establish which control blocked it. The firewall configuration and Docker port inspection provide complementary evidence for the intended exposure restrictions.
\textbf{Test from outside the Droplet (October 30, 2026).} The same two commands were run from a team member's MacBook on a network outside the Droplet, at 2026-10-31T01:58:14Z (9:58~PM EDT). TCP 443 succeeded. \textbf{TCP 8080 also succeeded}, which differs from the expected result.
The result was investigated rather than accepted. At 2026-10-31T02:14:23Z (10:14~PM EDT) a follow-up from the same machine gave:
\begin{itemize}
\item TCP 8081 and 8888, ports with no service, \textbf{timed out}, so the outside network does not accept every port.
\item \texttt{curl -v http://147.182.179.191:8080} connected, sent \texttt{GET /}, and after 5 seconds closed the connection with \textbf{0 bytes received}. Jenkins would have answered with HTTP headers, so Jenkins did not serve this connection.
\end{itemize}
On the Droplet, \texttt{ss -tlnp} showed no process listening on ports 8080 or 50000, and \texttt{iptables -t nat -S DOCKER} showed no forwarding rule for them. \texttt{docker ps} showed the Jenkins container with the unpublished ports \texttt{8080/tcp, 50000/tcp}; the only host-published ports were Caddy's 80 and 443 and Gitea's SSH on 222.
\textbf{Conclusion.} Jenkins' web port is not published and no Jenkins content was reachable on port 8080. The TCP handshake that succeeded on 8080 alone was not explained: its source was not identified, and the test was not repeated from a second outside network. This report does not claim that port 8080 is closed to the Internet, only that nothing on the Droplet listens on it and no HTTP response was received. A repeat from a second network, and a cloud-firewall rule that admits only the ports in use, would settle it.
\section{Gitea Trigger and Traceability}
\label{sec:ci-trigger}
\subsection{Deployment and Network Paths}
Figure~\ref{fig:ci-deployment} adapts the reference deployment to the team's
actual setup. Gitea and Jenkins run as containers on the same DigitalOcean
Droplet behind the Caddy TLS proxy. Two paths are separate:
\begin{itemize}
\item \textbf{Browser path:} a team member's browser reaches
\url{https://ci.ssw590-08.me} on port 443 through the Cloud Firewall and
Caddy, which forwards to Jenkins on the private Docker network. Jenkins'
own port 8080 is not published (Section~\ref{sec:ci-https}).
\item \textbf{Integration path:} Jenkins initiates every connection to
Gitea. It calls the Gitea API at \url{https://git.ssw590-08.me} to
discover branches and pull requests, clones the pull request's head
commit, and posts the commit status back. Gitea never needs to reach
Jenkins for builds to run, because the job polls for changes
(Section~\ref{sec:ci-trigger-config}).
\end{itemize}
\begin{figure}[H]
\centering
% Uncomment once the diagram image is uploaded:
% \includegraphics[width=\linewidth]{HW6 images/ci-deployment.png}
\fbox{\parbox[c][3cm][c]{0.9\linewidth}{\centering\textit{[Diagram to be added]}}}
\caption{Adapted UML deployment diagram of the Gitea and Jenkins CI paths}
\label{fig:ci-deployment}
\end{figure}
The continuous integration workflow connects the Gitea repository
\texttt{SSW-590-08/Scrap-Web} to Jenkins. The repository is hosted at
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web}, and Jenkins is
accessible through \url{https://ci.ssw590-08.me/}. Jenkins uses the
Gitea integration to discover repository changes and report build
statuses associated with commits and pull requests.
\subsection{Repository and Integration Identity}
@@ -312,6 +324,65 @@ this integration and limited to what Jenkins needs:
\label{fig:ci-token}
\end{figure}
\subsection{Webhook Configuration and Delivery}
The Jenkins Gitea integration is configured to communicate with the
Gitea server at \url{https://git.ssw590-08.me/}. The Gitea webhook
connects repository events to the Jenkins service. Jenkins is
reachable externally through Caddy over HTTPS, while the Jenkins
container itself is attached to the shared Docker network
\texttt{gitea-net}. The Caddy reverse proxy forwards requests for
\url{https://ci.ssw590-08.me/} to the Jenkins service on port 8080
inside the Docker network.
The webhook was created in Gitea (\emph{Scrap-Web $\rightarrow$ Settings
$\rightarrow$ Webhooks}) and points at the endpoint exposed by the Jenkins
Gitea plugin. Its details, as shown in
Figures~\ref{fig:ci-webhook-list} and~\ref{fig:ci-webhook-delivery}, are:
\begin{description}
\item[Name:] \texttt{Jenkins Webhook}
\item[Target URL:] \url{https://ci.ssw590-08.me/gitea-webhook/post}, reached
over HTTPS through Caddy
\item[Status:] Listed with a green (healthy) indicator in the repository's
webhook list
\item[Verification:] A \emph{Test Push Event} was sent from Gitea on
October 23, 2026. \emph{Recent Deliveries} lists delivery
\texttt{6b542d91-02b7-45be-a6c2-ba9989df7f4f} with a green check mark,
meaning Gitea delivered the event to the Jenkins endpoint successfully.
\item[Trigger events and secret:] Push and pull-request events from the
repository. No webhook secret is set; a secret would let Jenkins verify
that a delivery really came from Gitea, and adding one is a recommended
hardening step (Section~\ref{sec:ci-credentials}).
\end{description}
Figure~\ref{fig:ci-job-list} shows the Jenkins job list shortly after the
test delivery: the \texttt{Scrap-Web} Multibranch Pipeline reports a last
success 25 seconds earlier and no failures. The Multibranch Pipeline also
scans the repository every minute as a fallback (Section~\ref{sec:ci-trigger-config}), so a missed webhook delivery
delays a build rather than losing it.
\begin{figure}[H]
\centering
\includegraphics[width=0.9\linewidth]{HW6 images/webhook-list.png}
\caption[10/23/26 --- Gitea webhook \texttt{Jenkins Webhook} for Scrap-Web]{\textit{10/23/26} --- Gitea webhook \texttt{Jenkins Webhook} for Scrap-Web, targeting \url{https://ci.ssw590-08.me/gitea-webhook/post}.}
\label{fig:ci-webhook-list}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.9\linewidth]{HW6 images/webhook-delivery.png}
\caption{\textit{10/23/26} --- Gitea \emph{Recent Deliveries} for the Jenkins webhook, showing a successful \emph{Test Push Event} delivery.}
\label{fig:ci-webhook-delivery}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.9\linewidth]{HW6 images/jenkins-job-list.png}
\caption{\textit{10/23/26} --- Jenkins job list showing the \texttt{Scrap-Web} Multibranch Pipeline, last success 25 seconds earlier, captured shortly after the test delivery.}
\label{fig:ci-job-list}
\end{figure}
\subsection{Job Configuration and Trigger}
\label{sec:ci-trigger-config}
@@ -349,14 +420,14 @@ Scan repository trigger & Periodically if not otherwise run, every
\label{fig:ci-branch-source}
\end{figure}
\textbf{Trigger: polling fallback.} The job scans Scrap-Web every minute and
starts a build for any branch or pull request whose head commit has changed.
The assignment permits polling in place of a webhook. It was chosen because a
webhook from Gitea to Jenkins on the private container network requires
changing Gitea's allowed webhook hosts, and Jenkins' web interface was not
opened merely to receive webhooks. The cost is a delay of up to one minute
between a push and the start of its build. In practice, each push in
Section~\ref{sec:ci-failure} was built within about two minutes.
\textbf{Trigger: webhook with polling fallback.} The Gitea webhook
(Section~\ref{sec:ci-trigger}) notifies Jenkins when a push or pull-request
event occurs, so a build can start without waiting for the next scan. As a
safety net, the job also scans Scrap-Web every minute and starts a build for
any branch or pull request whose head commit has changed. A missed or failed
webhook delivery therefore delays a build by about one minute instead of
losing it. In practice, each push in Section~\ref{sec:ci-failure} was built
within about two minutes.
Each scan is recorded in the job's \emph{Scan Repository Log}
(Figure~\ref{fig:ci-scan-log}). The scan at 04:15 UTC on October 23, 2026
@@ -373,25 +444,81 @@ were checked and skipped.
\label{fig:ci-scan-log}
\end{figure}
\subsection{Build and Commit Traceability}
The Jenkins job is configured as a Multibranch Pipeline using the
Gitea source integration. Jenkins discovers branches and pull
requests from the repository and associates builds with the relevant
revision. This makes it possible to trace a proposed change from its
Gitea pull request to the Jenkins build and its reported status.
During verification, Jenkins logs showed pull-request build activity
for pull request \#13. The logs also showed status notifications for
the following revisions:
\begin{itemize}
\item \texttt{1de58d4742d1ad600dacad50890c845ab963e985}
\item \texttt{84a44f0477dac51b540d038bf3a94b8f49bec275}
\end{itemize}
The Jenkins log included messages indicating that a pending build
was being reported and that the notification completed for each of these
revisions; the same commit IDs appear in Gitea's commit list for pull
request \#13.
The traceability path is therefore:
\begin{enumerate}
\item A developer pushes a commit or creates or updates a pull
request in the Gitea repository.
\item Gitea delivers the webhook event to Jenkins, or the next
one-minute repository scan detects the new commit.
\item The Jenkins Multibranch Pipeline discovers the relevant
branch or pull-request revision and starts the associated
build.
\item Jenkins records the build result and reports the associated
status back to Gitea.
\item A reviewer can inspect the pull request, commit, and Jenkins
result to determine whether the proposed change passed the
configured checks.
\end{enumerate}
\subsection{Deployment Diagram}
Figure~\ref{fig:gitea-jenkins-deployment} illustrates the deployment
and communication paths between the developer, Gitea, the webhook,
Jenkins, and the repository's build process. The HTTPS browser path
is shown separately from the webhook path to distinguish normal user
access from automated event delivery.
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{figures/gitea-jenkins-deployment.png}
\caption{Deployment and communication paths for Gitea and Jenkins
continuous integration.}
\label{fig:gitea-jenkins-deployment}
\end{figure}
\subsection{Traceability: Commit to Jenkins Run}
The table below traces one trigger from the commit in Gitea to the Jenkins
run that tested it. The commit ID is the same in Gitea's commit list, in the
run's Checkout log (\texttt{git rev-parse HEAD}), and on the status Gitea
displays for that commit (Figure~\ref{fig:ci-pr-fail-fix}).
displays for that commit.
\begin{tabularx}{\linewidth}{L{4.2cm}Y}
\toprule
\textbf{Item} & \textbf{Value}\\ \midrule
Event & Repair commit pushed to branch \texttt{feature/issue-11}, the source
of pull request \#13\\
Time & October 23, 2026; Jenkins run started at 11:07 PM\\
Detected by & Repository scan (polling); build started automatically\\
Time pushed & October 23, 2026, 11:07 PM\\
Detected by & Webhook or repository scan; build started automatically\\
Pull request & \#13,
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13}\\
Triggering commit & \texttt{84a44f0477}\\
Jenkins run & \texttt{Scrap-Web/PR-13} run \#9 (Figure~\ref{fig:ci-runs};
the job was later removed by Jenkins, see below)\\
Triggering commit & \texttt{84a44f0}\\
Jenkins run & \texttt{Scrap-Web/PR-13} run \#9 (the job was later
removed by Jenkins; see below)\\
Run history & Figure~\ref{fig:ci-runs}\\
Status posted to Gitea & \texttt{Scrap-Web/pipeline/pr-main}: success,
visible on the commit in
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13/commits}{pull
@@ -403,13 +530,13 @@ Status posted to Gitea & \texttt{Scrap-Web/pipeline/pr-main}: success,
Checkout, the syntax check, and the tests all run on the Jenkins
controller's built-in node, inside the Jenkins container; the stage view of
each run lists the node as \emph{Jenkins} (the built-in node,
Figure~\ref{fig:ci-stage-view}). There is no separate build agent and no inbound
agent port. Jenkins clones the commit from Gitea over HTTPS into its
workspace under \texttt{/var/jenkins\_home/workspace/} and runs the
\texttt{Jenkinsfile} stages there (Section~\ref{sec:ci-pipeline}). The risk
of building on the controller and the restrictions that limit it are covered
in Section~\ref{sec:ci-credentials}.
each run lists the node as \emph{Jenkins (built-in)}. There is no separate
build agent and no inbound agent port. Jenkins clones the commit from Gitea
over HTTPS into its workspace under \texttt{/var/jenkins\_home/workspace/}
and runs the \texttt{Jenkinsfile} stages there
(Section~\ref{sec:ci-pipeline}). The risk of building on the controller and
the restrictions that limit it are covered in
Section~\ref{sec:ci-credentials}.
\subsection{Failure Diagnoses}
@@ -417,35 +544,40 @@ Four integration problems were diagnosed and corrected.
\textbf{Repository not visible to Jenkins.} When the job was first
configured, the Repository list for owner \texttt{SSW-590-08} was empty,
even though the token had repository access. \textit{[Cause and fix.]}
After the correction the repository appeared and the first scan discovered
pull request \#13 (Figure~\ref{fig:ci-scan-log}).
even though the \texttt{jenkins-ci} account was a collaborator on the
repository. The token was regenerated with the scopes \texttt{write:repository}
and \texttt{read:user} (Gitea did not keep any other scope selected), the
Jenkins credential \texttt{gitea-jenkins-ci} was updated, and the old tokens
were deleted. After the correction the repository appeared in the list and
the first scan discovered pull request \#13.
\textbf{First build failed: \texttt{python3: not found}.} Run \#1 of
\texttt{PR-13} (October 23, 2026, 00:13) checked out the commit
successfully, proving the integration worked, but failed in the Checkout
stage at \texttt{python3 --version} with exit code 127; the later stages were
skipped (Figure~\ref{fig:ci-runs}). The official Jenkins image does not
include Python. The fix was a deployment change, not a code change:
\texttt{python3} was added to the Jenkins container \textit{[confirm how:
e.g.\ by building it from \texttt{jenkins/Dockerfile}]}. Run \#2, started
manually on the same commit at 9:39 PM, then passed and reported Python
3.13.5 (Figure~\ref{fig:ci-stage-view}).
\texttt{PR-13} (October 23, 2026) checked out the commit successfully,
proving the integration worked, but failed in the Checkout stage at
\texttt{python3 --version} with exit code 127. The official Jenkins image
does not include Python. The fix was a deployment change, not a code change:
\texttt{python3} was added to the Jenkins container. Jenkins now runs the
custom image \texttt{custom-jenkins:lts-jdk21-python3}, which adds Python to
the Jenkins LTS JDK~21 image (recorded on October 28, 2026), so Python survives
a container rebuild. Run \#2 on the same
pull request then passed, reporting Python 3.13.5.
\textbf{Required check reported as missing.} After the status-check
requirement was added, Gitea showed the Jenkins check as green but still
reported ``some required checks are missing'' and blocked the merge.
\textit{[Cause and fix.]}
The branch rule contained a pattern that did
not exactly match the reported context \texttt{Scrap-Web/pipeline/pr-main}.
It was corrected to that exact name.
\textbf{Pull request runs deleted after merge.} Shortly after pull request
\#13 was merged, the \texttt{PR-13} job and all of its runs disappeared from
Jenkins. The pull request was closed, and the Multibranch job's default
orphaned item strategy discards the jobs of closed pull requests. Deleted
runs cannot be restored without a backup of \texttt{jenkins\_home}. The
evidence survives in Gitea, because the commit statuses Jenkins posted remain
attached to each commit of pull request \#13, and in the screenshots captured
while the runs existed. To keep future evidence, the job's \emph{Orphaned
Item Strategy} was changed to keep old items for 30 days.
Jenkins. The Scan Repository Log showed that the job had been removed as an
orphaned item: the pull request was closed, and the Multibranch job's default
orphaned item strategy discards such jobs immediately. Deleted runs cannot be
restored without a backup of \texttt{jenkins\_home}. The evidence survives in
Gitea, because the commit statuses Jenkins posted remain attached to each
commit of pull request \#13. To keep future evidence, the job's
\emph{Orphaned Item Strategy} was changed to keep old items for 30 days.
If a trigger fails in future, the operator follows the procedure in
Section~\ref{sec:ci-troubleshoot}.
@@ -547,9 +679,9 @@ The application and tests use only the Python 3 standard library
(\texttt{unittest} and \texttt{py\_compile}), so the pipeline downloads no
packages and has no external dependency source to trust or pin. The only
requirement is a \texttt{python3} interpreter on the Jenkins executor,
installed in the Jenkins container image from \texttt{jenkins/Dockerfile}
(Python 3.13.5, as printed by the Checkout stage); it is not installed in the
Gitea container.
provided by the Jenkins container image
\texttt{custom-jenkins:lts-jdk21-python3} (Python 3.13.5, as printed by the
Checkout stage); it is not installed in the Gitea container.
\subsection{Reproducing a Clean Run}
@@ -560,7 +692,14 @@ python3 -m py_compile pricing.py tests/test_pricing.py
python3 -m unittest discover -s tests -v
\end{verbatim}
(On Windows, use \texttt{python} instead of \texttt{python3}.) A clean result
ends with \texttt{Ran 2 tests} and \texttt{OK}.
ends with \texttt{Ran 2 tests} and \texttt{OK} (Figure~\ref{fig:ci-local}).
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{HW6 images/runs.png}
\caption{Local reproduction on Windows: the syntax check and both unit tests pass.}
\label{fig:ci-local}
\end{figure}
\textbf{In Jenkins:} every new commit pushed to a pull request starts a new
run in a fresh checkout of that commit. A team member can also rebuild the
@@ -596,9 +735,9 @@ Gitea.
The default branch, \texttt{main}, is protected in
Gitea~\cite{GiteaProtectedBranches}
(\emph{Scrap-Web $\rightarrow$ Settings $\rightarrow$ Branches},
Figure~\ref{fig:ci-branch-rule}). The rule was created on October 18, 2026,
and the required status check was added on October 23, 2026, once Jenkins
had reported its first status.
Figure~\ref{fig:ci-branch-rule}). The rule was put in place on October 23, 2026, with the required
status check, once Jenkins had reported its first status. Gitea's settings page
does not show the rule's history far enough back to capture a dated screenshot.
\begin{tabularx}{\linewidth}{L{4.6cm}Y}
\toprule
@@ -627,8 +766,8 @@ every merge (Section~\ref{sec:ci-trigger}).
\begin{figure}[H]
\centering
\includegraphics[width=0.75\linewidth]{HW6 images/branch-rule.png}
\caption{October 18, 2026 --- Branch protection rule for \texttt{main} in
the Scrap-Web branch settings.}
\caption{Branch protection rule for \texttt{main} in the Scrap-Web branch
settings.}
\label{fig:ci-branch-rule}
\end{figure}
@@ -638,8 +777,9 @@ The merge gate depends on a commit status, not on a trigger. A webhook or
repository scan only tells Jenkins that something changed; it says nothing
about whether the code passes. The sequence is:
\begin{enumerate}
\item A push to a pull request's branch is detected by the Multibranch job's
repository scan (Section~\ref{sec:ci-trigger-config}).
\item A push to a pull request's branch reaches Jenkins through the Gitea
webhook or the Multibranch job's one-minute repository scan
(Section~\ref{sec:ci-trigger-config}).
\item The job builds the pull request's latest head commit and runs the
\texttt{Jenkinsfile} stages.
\item When the run starts and again when it finishes, the Jenkins Gitea
@@ -882,15 +1022,23 @@ credentials and job configuration. The compensating restrictions are:
\item the Jenkins web interface is reachable only over HTTPS through Caddy
and requires login (Section~\ref{sec:ci-https}).
\end{itemize}
One gap remains: the Gitea webhook has no secret, so Jenkins cannot verify
that a delivery came from Gitea. A forged delivery can only make Jenkins scan
the repository; it cannot change the code that is built. Adding a shared
secret to the webhook and the Jenkins Gitea configuration is the next
hardening step.
\subsection{Plugin-Update Check}
On \textit{[date]}, \emph{Manage Jenkins $\rightarrow$ Plugins $\rightarrow$
Updates} listed \textit{[n]} available updates \textit{[name any marked as
security fixes]}. Action taken: \textit{[updated and restarted Jenkins /
deferred until after the assignment, with reason]}. Plugin updates are
checked before each assignment, and any plugin with a published security
warning is updated first.
On October 24, 2026, \emph{Manage Jenkins $\rightarrow$ Plugins $\rightarrow$
Updates} listed one available update: \emph{Pipeline: API}, installed version
\texttt{1413.v2ff1a\_5e720fa\_}, available version
\texttt{1429.v7a\_1b\_efb\_a\_f7c5} (released two days earlier). It was not
marked as a security fix. Action taken: deferred until after this assignment
was submitted, because updating requires a Jenkins restart and the update
fixes no published security warning. Plugin updates are checked before each
assignment, and any plugin with a published security warning is updated
first.
\subsection{Troubleshooting a Failed Trigger or Build}
\label{sec:ci-troubleshoot}
@@ -905,7 +1053,7 @@ warning is updated first.
\texttt{gitea-jenkins-ci} credential holds a current token and that
\texttt{jenkins-ci} is still a Write collaborator
(Section~\ref{sec:ci-trigger}).
\item If a webhook is used: in Gitea, open \emph{Scrap-Web $\rightarrow$
\item In Gitea, open \emph{Scrap-Web $\rightarrow$
Settings $\rightarrow$ Webhooks}, check \emph{Recent Deliveries} for the
response code, and use \emph{Test Delivery} after any fix.
\end{enumerate}
@@ -932,6 +1080,32 @@ warning is updated first.
\end{enumerate}
\section{Manual Quality and Controls}
\textit{[Version and history entry, Hosts and Passwords table updates, UML
deployment diagram, citations, glossary and index entries, and the operator
restart/troubleshooting note.]}
\label{sec:ci-quality}
\begin{itemize}
\item \textbf{Version and history:} the manual is at Version 1.5, and the
Document History table has a 1.5 entry describing this chapter and the
table updates.
\item \textbf{Hosts and Passwords:} the Hosts table
(Table~\ref{tab:devops-hosts}) now lists the Jenkins hostname
\texttt{ci.ssw590-08.me} and its internal ports 8080 and 50000, which are
not published on the Droplet. The Passwords table
(Table~\ref{tab:devops-passwords}) lists the Jenkins administrator
accounts and the \texttt{jenkins-ci} integration account with hints only;
no password or token value appears anywhere in this manual.
\item \textbf{Deployment diagram:} Figure~\ref{fig:gitea-jenkins-deployment}
shows the Droplet, the three containers, the \texttt{jenkins\_home}
volume, and the browser, webhook, and status paths.
\item \textbf{Citations:} the Jenkins Pipeline, Jenkins Gitea plugin,
Jenkins security, and Gitea protected-branch documentation are cited
where they are used and listed in the Bibliography.
\item \textbf{Glossary and index:} the terms \gls{pullrequest}, \gls{webhook},
\gls{statuscheck}, \gls{mergegate}, and \gls{jenkinsfile} were added to the
Glossary, and the chapter is indexed under Jenkins and continuous
integration.
\item \textbf{Operator notes:} restarting Jenkins is
\texttt{docker restart jenkins} (Section~\ref{sec:ci-deploy}); its data
survives in the \texttt{jenkins\_home} volume, which is not a backup.
Failed triggers and builds are handled with the procedure in
Section~\ref{sec:ci-troubleshoot}.
\end{itemize}