diff --git a/manual/.DS_Store b/manual/.DS_Store new file mode 100644 index 0000000..2a818c9 Binary files /dev/null and b/manual/.DS_Store differ diff --git a/manual/HW8 images/del-blocked-run6.png b/manual/HW8 images/del-blocked-run6.png new file mode 100644 index 0000000..6fc59e9 Binary files /dev/null and b/manual/HW8 images/del-blocked-run6.png differ diff --git a/manual/HW8 images/del-commit-diff.png b/manual/HW8 images/del-commit-diff.png new file mode 100644 index 0000000..24c563b Binary files /dev/null and b/manual/HW8 images/del-commit-diff.png differ diff --git a/manual/HW8 images/del-fixture-added.png b/manual/HW8 images/del-fixture-added.png new file mode 100644 index 0000000..638998e Binary files /dev/null and b/manual/HW8 images/del-fixture-added.png differ diff --git a/manual/HW8 images/del-fixture-removed.png b/manual/HW8 images/del-fixture-removed.png new file mode 100644 index 0000000..43edab6 Binary files /dev/null and b/manual/HW8 images/del-fixture-removed.png differ diff --git a/manual/HW8 images/del-image-scan-build4.png b/manual/HW8 images/del-image-scan-build4.png new file mode 100644 index 0000000..690ed73 Binary files /dev/null and b/manual/HW8 images/del-image-scan-build4.png differ diff --git a/manual/HW8 images/del-rerun7.png b/manual/HW8 images/del-rerun7.png new file mode 100644 index 0000000..e1adb2b Binary files /dev/null and b/manual/HW8 images/del-rerun7.png differ diff --git a/manual/HW8 images/del-run7-recap-first.png b/manual/HW8 images/del-run7-recap-first.png new file mode 100644 index 0000000..e196a1a Binary files /dev/null and b/manual/HW8 images/del-run7-recap-first.png differ diff --git a/manual/HW8 images/del-run7-recap-second.png b/manual/HW8 images/del-run7-recap-second.png new file mode 100644 index 0000000..1a55ab9 Binary files /dev/null and b/manual/HW8 images/del-run7-recap-second.png differ diff --git a/manual/HW8 images/del-run7-success.png b/manual/HW8 images/del-run7-success.png new file mode 100644 index 0000000..db09336 Binary files /dev/null and b/manual/HW8 images/del-run7-success.png differ diff --git a/manual/HW8 images/del-source-scan-build4.png b/manual/HW8 images/del-source-scan-build4.png new file mode 100644 index 0000000..3cee73f Binary files /dev/null and b/manual/HW8 images/del-source-scan-build4.png differ diff --git a/manual/HW8 images/del-source-scan-secret.png b/manual/HW8 images/del-source-scan-secret.png new file mode 100644 index 0000000..d5c4603 Binary files /dev/null and b/manual/HW8 images/del-source-scan-secret.png differ diff --git a/manual/HW8 images/del-trivy-fs-build4.png b/manual/HW8 images/del-trivy-fs-build4.png new file mode 100644 index 0000000..f65e647 Binary files /dev/null and b/manual/HW8 images/del-trivy-fs-build4.png differ diff --git a/manual/HW8 images/publish-digest-rebuild.png b/manual/HW8 images/publish-digest-rebuild.png new file mode 100644 index 0000000..9ec65ed Binary files /dev/null and b/manual/HW8 images/publish-digest-rebuild.png differ diff --git a/manual/HW8 images/staging-check-rebuild.png b/manual/HW8 images/staging-check-rebuild.png new file mode 100644 index 0000000..d2b9ea8 Binary files /dev/null and b/manual/HW8 images/staging-check-rebuild.png differ diff --git a/manual/HW8 images/staging-idempotence-rebuild.png b/manual/HW8 images/staging-idempotence-rebuild.png new file mode 100644 index 0000000..50bcd2a Binary files /dev/null and b/manual/HW8 images/staging-idempotence-rebuild.png differ diff --git a/manual/devopsReferences.bib b/manual/devopsReferences.bib index e37e98e..47709ae 100644 --- a/manual/devopsReferences.bib +++ b/manual/devopsReferences.bib @@ -140,3 +140,21 @@ url = {https://www.jenkins.io/doc/book/using/using-agents/}, note = {Accessed: Nov. 13, 2026} } + +@misc{TrivyDocs, + author = {{Aqua Security}}, + title = {{Trivy Documentation}}, + howpublished = {Trivy project documentation}, + year = {2026}, + url = {https://trivy.dev/docs/latest/}, + note = {Accessed: Nov. 13, 2026} +} + +@misc{PipAudit, + author = {{Python Packaging Authority}}, + title = {{pip-audit: Audit Python environments and requirements for known vulnerabilities}}, + howpublished = {Project repository}, + year = {2026}, + url = {https://github.com/pypa/pip-audit}, + note = {Accessed: Nov. 13, 2026} +} diff --git a/manual/devopsSecureDelivery.tex b/manual/devopsSecureDelivery.tex index 431b941..f585016 100644 --- a/manual/devopsSecureDelivery.tex +++ b/manual/devopsSecureDelivery.tex @@ -245,10 +245,14 @@ Compose plugin ($\geq$ 2.18) & v5.5.1 (meets the minimum)\\ \item \textbf{Trust boundary:} every branch and pull request runs only the Chapter~\ref{Chapter:ContinuousIntegration} checks on the controller, with no credentials and no Docker socket. The \emph{Delivery} stages run only for - the trusted branch pattern \texttt{TRUSTED\_BRANCH}. During development it - also allowed \texttt{feature/issue-24-delivery}; for the assessed runs it is - \texttt{main} only, so only reviewed code can build, publish, or deploy. - \FillIn{confirm the change to main only and its commit} No Docker daemon API is published to the Internet. + the trusted branch pattern \texttt{TRUSTED\_BRANCH}. In the repository, the pattern is currently + \texttt{main|feature/issue-24-delivery} (Figure~\ref{fig:del-commit-diff}), + so the delivery runs recorded in this chapter (builds \#4 to \#7) ran from the + feature branch. Until the pattern is changed back to \texttt{main}, code on + that branch can build, publish, and deploy without a merge review. The + Jenkinsfile carries a comment to remove the feature branch from the pattern + before submission. \FillIn{commit that restores \texttt{main} only, once it is + made} No Docker daemon API is published to the Internet. \end{itemize} \section{Connect the Application to the Existing Proxy} @@ -316,27 +320,287 @@ artifacts. The image runs Gunicorn as the non-root user \texttt{10001}, and the Compose template drops all capabilities and makes the root filesystem read-only with a \texttt{tmpfs} for \texttt{/tmp}. -\begin{tabularx}{\linewidth}{L{3.2cm}Y} +{\small +\begin{tabularx}{\linewidth}{L{1.9cm}YYY} \toprule -\textbf{Release} & \textbf{v1}\\ \midrule -Source commit & \texttt{2a35f97071c95b23bccb8c973099f2991c998599}\\ -Jenkins build & \texttt{feature/issue-24-delivery} \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8}\\ -Image digest & \texttt{git.ssw590-08.me/ssw-590-08/\allowbreak pricing@sha256:\allowbreak ce91d0552da2a4580557ec65aedec04b\allowbreak 278fe918df1f02b23c971ca45cc3d97c}\\ -Published & November 12, 2026, 11:51 PM EST\\ +\textbf{Release v1} & \textbf{First build (superseded)} & \textbf{Rebuild (superseded)} & \textbf{Run \#7 (latest)}\\ \midrule +Source commit & \texttt{\seqsplit{2a35f97071c95b23bccb8c973099f2991c998599}} & \texttt{\seqsplit{3fcd04010ad115df943d2d001dbc4a1523c2a6d1}} & \texttt{c46f127e8c}\\ +Jenkins build & \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8} & \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/4/}{\#4} & \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/7/}{\#7}\\ +Image digest & \texttt{\seqsplit{sha256:ce91d0552da2a4580557ec65aedec04b278fe918df1f02b23c971ca45cc3d97c}} & \texttt{\seqsplit{sha256:2688685992aa57bc94aaca36ea3cce22fd2cd9ba162ea2e09437531594e15bb7}} & \texttt{\seqsplit{sha256:5e7c72446cfc592fdbef07f085b8045bc366068a2aac039c027da7777a27ad59}}\\ +Published & November 12, 2026, 11:51 PM EST & November 13, 2026, after the 7:48 PM EST image scan in the same build & November 13, 2026, \FillIn{time from the Publish stage}\\ +Status & Failed the security policy: 7 fixable High findings (Section~\ref{sec:del-security}) & Passed the policy; replaced by run \#7 & Passed the policy (both scans ran before Publish and the run finished successfully); \FillIn{unfixed High count from the run's image-summary file}\\ \bottomrule -\end{tabularx} +\end{tabularx}} + +\medskip +Run \#7 is the first run after the blocked-run test (Section~\ref{sec:del-security}). +Its commit \texttt{c46f127e8c} removes the fixture that commit \texttt{05d3c58c3a} +had added, and each of those two commits changed only that one file, so the +source files are the same as in the rebuild. The digest is different because the +commit is baked into each image at build time, so every commit produces a new +image. A later run, with a new commit, would again produce a new digest. The +release that is promoted to production is therefore the one built by the run that +passes the approval stage, and its digest is the one recorded for v1. + +\medskip +All digests are in the registry repository \texttt{git.ssw590-08.me/ssw-590-08/pricing}. +Earlier builds are kept as a record. They were superseded by new builds, not +edited, so their images remain in the registry and their digests are unchanged. \delfig{publish-digest.png}{1.0}{November 12, 2026, run \#8 --- Jenkins Publish stage: the v1 image is pushed, the local copy deleted and pulled back from the registry, and its registry digest recorded. The registry token is masked and never printed.}{fig:del-publish} +\delfig{publish-digest-rebuild.png}{1.0}{November 13, 2026, build \#4 --- Jenkins +Publish stage for the rebuild: the registry digest +\texttt{sha256:2688685992aa\ldots} is recorded and echoed. The registry token is +masked and never printed.}{fig:del-publish-rebuild} + \section{Apply Proportionate Security Gates} \label{sec:del-security} -\FillIn{kholmes: scan policy, tools and database versions, source and image -scan results, blocked synthetic fixture run, fix and rerun -(\texttt{security/scan.sh})} +\subsection{Policy} +The policy was written before the release was scanned +(\texttt{security/POLICY.md} in the repository). The pipeline fails, and no +image is published or deployed, when any of these is true: +\begin{itemize} + \item a secret is detected; + \item \texttt{pip-audit} reports a known vulnerability in the locked + dependencies; + \item a HIGH or CRITICAL vulnerability that \emph{has a fix available} is found + in the repository or the built image; + \item a scanner errors, a tool is missing, or the vulnerability database + cannot be obtained. A failed scan is not a clean scan. +\end{itemize} +HIGH or CRITICAL vulnerabilities with \emph{no fix yet} (typically operating-system +packages in the base image) do not block the build, but they are never hidden: +each image scan also writes a full report and a count summary, which Jenkins +archives with the build, and the accepted set is recorded below as a time-limited +exception. A fixable finding is handled by updating the lockfile or the pinned +base-image digest, rebuilding, and rescanning; a fixable finding accepted for a +stated reason would be recorded in \texttt{security/.trivyignore} with an +expiry date. No claim is made that any scanned version is free of +vulnerabilities. + +\subsection{Tools and Versions} +The checks are implemented in \texttt{security/scan.sh}, called by the +\emph{Security scan: source} and \emph{Security scan: image} stages. It uses +no \texttt{|| true}, so a failing scanner fails the stage. + +\begin{tabularx}{\linewidth}{L{4.4cm}Y} +\toprule +\textbf{Item} & \textbf{Value}\\ \midrule +Trivy~\cite{TrivyDocs} & 0.76.2\\ +Trivy vulnerability database & version 2; updated 2026-11-13 19:05:12 UTC; + downloaded to the agent 2026-11-13 22:54:18 UTC (the pipeline image scan at + 2026-11-14 00:48:38 UTC used this same cached copy)\\ +pip-audit~\cite{PipAudit} & 2.10.1\\ +Blocking severities & HIGH and CRITICAL\\ +\bottomrule +\end{tabularx} + +\subsection{Source Scans} +The source checks were first run by hand inside the \texttt{jenkins-agent} +container on November 13, 2026, at 5:58--5:59 PM EST, against the agent's +existing \texttt{Scrap-Web\_main} workspace. That workspace was at commit +\texttt{fa52a28a0c8ffbf05b77c54e801b88e592522f6d}, not at the v1 release commit, +so this run shows the method and the state of the repository at that commit and +is not the release gate: +\begin{minted}[breaklines,breakanywhere]{text} +pip-audit -r pricing/requirements.txt --strict --progress-spinner off +trivy fs --scanners vuln,secret --severity HIGH,CRITICAL --exit-code 1 --no-progress --skip-dirs .git,.venv . +\end{minted} + +\begin{tabularx}{\linewidth}{L{4.2cm}L{2.2cm}Y} +\toprule +\textbf{Check} & \textbf{Exit code} & \textbf{Result}\\ \midrule +\texttt{pip-audit} & 0 & ``No known vulnerabilities found''\\ +\texttt{trivy fs} & 0 & \texttt{pricing/requirements.txt}: 0 vulnerabilities; no secrets reported\\ +\bottomrule +\end{tabularx} + +\medskip +For the release itself, the \emph{Security scan: source} stage runs the same +checks on the release commit before the image is built. Stages run in order and +the \emph{Publish} stage follows both scans, so the successful publish of the +image built from commit \texttt{3fcd04010ad1\ldots} (below) means both scan stages +passed for it. Figure~\ref{fig:del-source-scan} shows the start of the source +scan output in the Jenkins console: \texttt{pip-audit} 2.10.1 reported ``No known +vulnerabilities found'' and exited with status 0 at 2026-11-14 00:47:41 UTC +(7:47~PM EST on November 13), after which \texttt{trivy fs} began its secret and +vulnerability scan. + +\delfig{del-source-scan-build4.png}{1.0}{November 13, 2026, build \#4 --- Jenkins +console output of the \emph{Security scan: source} stage: \texttt{pip-audit} exit +status 0 at 00:47:41 UTC (7:47~PM EST) and the start of the \texttt{trivy fs} +scan. Screenshot taken at 8:56~PM EST.}{fig:del-source-scan} + +The same build's \texttt{trivy fs} result is in Figure~\ref{fig:del-trivy-fs}: +\texttt{pricing/requirements.txt} (type \texttt{pip}) has 0 vulnerabilities, and +the stage ends with \texttt{RESULT trivy-fs: exit=0} at 2026-11-14 00:48:00 UTC. + +\delfig{del-trivy-fs-build4.png}{1.0}{November 13, 2026, build \#4 --- Jenkins +console output of the \emph{Security scan: source} stage: \texttt{trivy fs} +report summary (0 vulnerabilities in \texttt{pricing/requirements.txt}) and +\texttt{RESULT trivy-fs: exit=0} at 00:48:00 UTC (7:48~PM EST).}{fig:del-trivy-fs} + +\subsection{Image Scan: First v1 Build and Corrective Rebuild} +\textbf{First build (scanned by hand, before the policy was enforced in the +pipeline).} The image from source commit \texttt{2a35f97} (digest +\texttt{sha256:ce91d055\ldots}) was scanned on November 13, 2026, at 6:18~PM EST +with \texttt{trivy image --severity HIGH,CRITICAL}. Trivy identified Debian 13.7. +It reported \textbf{54 HIGH and no CRITICAL} findings (49 in operating-system +packages, 5 in Python packages): \textbf{7 had a fix available and 47 did +not.} The application's own locked dependencies (Flask, Gunicorn, Werkzeug, +Jinja2, and the others) showed no findings. Under the policy this image fails the +gate because of the 7 fixable findings: + +\begin{tabularx}{\linewidth}{L{2.4cm}L{3.8cm}L{3.2cm}Y} +\toprule +\textbf{Package} & \textbf{Advisory} & \textbf{Installed} & \textbf{Fixed in}\\ \midrule +zlib1g & CVE-2026-76844 & \texttt{\seqsplit{1:1.3.dfsg+really1.3.1-1+b1}} & \texttt{…+deb13u1}\\ +zlib1g & CVE-2026-85091 & same & \texttt{…+deb13u1}\\ +msgpack & CVE-2026-114613 & 1.1.2 & 1.2.3\\ +msgpack & GHSA-6v7p-g79w-8964 & 1.1.2 & 1.2.1\\ +setuptools & CVE-2025-47273 & 70.3.0 & 78.1.1\\ +urllib3 & CVE-2026-97687 & 2.7.0 & 2.8.0\\ +urllib3 & CVE-2026-97689 & 2.7.0 & 2.8.0\\ +\bottomrule +\end{tabularx} + +\medskip +None of these packages is in the project's lockfile, so they come from the base +image's operating system and Python environment, not from the application. + +\textbf{Corrective rebuild.} The image was rebuilt from commit +\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/commit/3fcd04010ad115df943d2d001dbc4a1523c2a6d1}{\texttt{3fcd04010ad115df943d2d001dbc4a1523c2a6d1}} +in Jenkins build +\href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/4/}{\#4}. +The new digest is +\texttt{sha256:2688685992aa57bc94aaca36ea3cce22fd2cd9ba162ea2e09437531594e15bb7}. +The Dockerfile on the delivery branch pins the base image by digest: +\texttt{FROM python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d\allowbreak 45a8d350d98134cf1070bc106ee9ed90}, +the same digest named in Section~\ref{sec:del-baseline}, so the base-image digest did +not change between the two builds. The rebuild commit adds two lines to the Dockerfile +(Figure~\ref{fig:del-commit-diff}): one \texttt{RUN} step that upgrades only the +\texttt{zlib1g} package with \texttt{apt-get install -{}-only-upgrade} and +removes the apt package lists, and a second command that uninstalls \texttt{pip} +and \texttt{setuptools} from the image. The upgrade addresses the two +\texttt{zlib1g} findings, and removing \texttt{setuptools} removes its finding. +The diff does not mention \texttt{msgpack} or \texttt{urllib3}, but the package +list in the rebuilt image's scan (Figure~\ref{fig:del-image-scan}) contains +only the nine application packages and no \texttt{pip}, \texttt{setuptools}, +\texttt{msgpack} or \texttt{urllib3} entry. Two trade-offs follow. The +\texttt{apt-get} step makes the result depend on the package archive at build +time, so the image digest, not the Dockerfile, is the identity of the release. +And the image can no longer install packages at runtime, which suits a service +whose dependencies are fixed at build time. + +\delfig{del-commit-diff.png}{1.0}{November 13, 2026 --- commit diff of the rebuild +(screenshot taken at 9:15~PM EST): \texttt{pricing/Dockerfile} gains the +\texttt{zlib1g} upgrade and the \texttt{pip}/\texttt{setuptools} removal, and the +Jenkinsfile \texttt{TRUSTED\_BRANCH} pattern gains +\texttt{feature/issue-24-delivery}.}{fig:del-commit-diff} The pipeline's image scan ran at +2026-11-14 00:48:38 UTC (7:48~PM EST on November 13) and wrote its summary: + +\begin{minted}[breaklines,breakanywhere]{text} +image findings at HIGH/CRITICAL (all, including unfixed): + HIGH no fix yet 47 + total 47 +\end{minted} + +The 7 fixable findings are gone: no HIGH or CRITICAL finding with a fix remains +and no CRITICAL finding exists, so the gate passes for the rebuilt image. +Figure~\ref{fig:del-image-scan}, taken from the archived \texttt{trivy-image.txt}, +shows the gate scan of the image tagged with commit \texttt{3fcd0401}: Debian 13.7 +with 0 vulnerabilities, and 0 in each of the application's Python packages. + +\delfig{del-image-scan-build4.png}{1.0}{November 13, 2026, build \#4 --- +\texttt{trivy-image.txt} from the \emph{Security scan: image} stage (scan at +00:48:41 UTC, 7:48~PM EST): 0 fixable High/Critical findings in the operating +system and in each Python package. Screenshot taken at 9:21~PM EST.}{fig:del-image-scan} + +\begin{tabularx}{\linewidth}{L{3.0cm}L{2.6cm}L{2.4cm}Y} +\toprule +\textbf{Build} & \textbf{Source commit} & \textbf{Fixable HIGH/CRIT} & \textbf{Unfixed HIGH}\\ \midrule +First v1 (by hand) & \texttt{2a35f97} & 7 & 47\\ +Rebuild (\#4) & \texttt{3fcd0401} & 0 & 47\\ +\bottomrule +\end{tabularx} + +\subsection{Accepted Exception} +The 47 remaining HIGH findings have no fixed package version yet. They are +accepted for this teaching deployment on these grounds: no fix exists to apply, +the pricing service is stateless and processes no customer data, application +port 8000 is not published, and the container runs as a non-root user with all +capabilities dropped and a read-only root filesystem. The exception was accepted on November 13, 2026. It is time-limited and must be +reviewed again by November 20, 2026, or +earlier when a fixed package version is released. The full list is in +\texttt{trivy-image-full.json}, archived with the Jenkins build. + +\subsection{Blocked Pipeline Run} +On November 13, 2026, the gate was tested with a synthetic secret fixture, a file +containing a made-up token (see the fixture check below). In Jenkins run \#6 +(screenshot taken at 9:02~PM EST), the stages after the source scan, +\emph{Build image}, \emph{Security scan: image}, \emph{Publish} and +\emph{Deploy staging}, were each skipped with the message ``skipped due to earlier +failure(s)'' (Figure~\ref{fig:del-blocked-run}), so no image was built or +published for that run. After the fixture was removed, run \#7 (screenshot taken at +9:08~PM EST) passed the scan stages and reached \emph{Publish}, where the log +shows the registry login with the token masked as \texttt{****} +(Figure~\ref{fig:del-rerun}). +The Trivy output for the fixture (Figure~\ref{fig:del-secret-finding}, from +\texttt{trivy-source.txt}, scan time 02:00:42 UTC, which is 9:00~PM EST) reports +one \texttt{CRITICAL} secret of type \texttt{github-pat} in +\texttt{security/fixture-secret.txt}, line 1, with the value masked. A critical +finding makes the source scan exit non-zero under the policy, which is what stops +the later stages. The fixture was added in commit \texttt{05d3c58c3a} (message ``testing build +block'', parent \texttt{3fcd04010a}) and removed in commit \texttt{c46f127e8c} +(message ``removed forced error'', parent \texttt{05d3c58c3a}); the two commit +pages are in Figures~\ref{fig:del-fixture-added} and~\ref{fig:del-fixture-removed}, +with the token value covered. The value is made up, but the commit remains in the +repository history. Run \#7, on the removal commit, finished with +\texttt{Finished: SUCCESS} (Figure~\ref{fig:del-run7-success}). In that run the +\emph{Approve and deploy production} stage was still a placeholder that printed +``Not implemented yet'', so no production step ran. Run \#7 also executed the +Publish and Deploy staging stages for commit \texttt{c46f127e8c}. +\FillIn{image digest published by run \#7, and whether it replaces build \#4 as +the v1 release} + +\delfig{del-fixture-added.png}{1.0}{November 13, 2026 --- Gitea commit page for +\texttt{05d3c58c3a}, ``testing build block'', which adds +\texttt{security/fixture-secret.txt} (token value covered). The commit shows a +failed status. Screenshot taken at 9:27~PM EST.}{fig:del-fixture-added} + +\delfig{del-fixture-removed.png}{1.0}{November 13, 2026 --- Gitea commit page for +\texttt{c46f127e8c}, ``removed forced error'', which deletes the fixture file +(token value covered). The commit shows a passing status. Screenshot taken at +9:27~PM EST.}{fig:del-fixture-removed} + +\delfig{del-run7-success.png}{0.9}{November 13, 2026, run \#7 (screenshot taken at +9:27~PM EST) --- end of the Jenkins console: the production stage still prints +``Not implemented yet'', the pipeline reports ``All stages passed'' and +\texttt{Finished: SUCCESS}.}{fig:del-run7-success} + +\delfig{del-blocked-run6.png}{0.9}{November 13, 2026, run \#6 (screenshot taken at +9:02~PM EST) --- Jenkins console: \emph{Build image}, \emph{Security scan: image}, +\emph{Publish} and \emph{Deploy staging} skipped due to earlier failure(s).}{fig:del-blocked-run} + +\delfig{del-rerun7.png}{0.9}{November 13, 2026, run \#7 (screenshot taken at +9:08~PM EST) --- Jenkins console after the fixture was removed: the pipeline +reaches \emph{Publish}; the registry token is masked as \texttt{****}.}{fig:del-rerun} + +\delfig{del-source-scan-secret.png}{1.0}{November 13, 2026, source scan with the +synthetic fixture (scan time 02:00:42 UTC, 9:00~PM EST): Trivy reports 1 +\texttt{CRITICAL} \texttt{github-pat} secret in \texttt{security/fixture-secret.txt}; +the value is masked. The exit status line is not in this screenshot.}{fig:del-secret-finding} + +\textbf{Fixture check.} Before it was committed, the fixture format was tested +locally in the agent on November 13, 2026, at 6:55~PM EST, in a temporary +directory outside the repository. Trivy reported one finding, \texttt{CRITICAL: +GitHub (github-pat)}, and exited with status 1. The value is made up and is +not a live credential; Trivy masked it in its output. \section{Deploy v1 with Ansible and Prove Idempotence} \label{sec:del-ansible} @@ -351,13 +615,13 @@ template with every placeholder replaced. \gls{releaserecord} from the build it belongs to, so the digest and commit cannot be mistyped. The expected version and total are read from the application source (\texttt{VERSION} and \texttt{3 $\times$ UNIT\_PRICE}), not from configuration. -The record is archived with the build. For v1 it contains: +The record is archived with the build. For the rebuild (build \#4) it contained the following; run \#7 generates the same fields from its own digest and commit: \begin{minted}[breaklines,breakanywhere]{yaml} target_env: staging -release_image: git.ssw590-08.me/ssw-590-08/pricing@sha256:ce91d0552da2a4580557ec65aedec04b278fe918df1f02b23c971ca45cc3d97c +release_image: git.ssw590-08.me/ssw-590-08/pricing@sha256:2688685992aa57bc94aaca36ea3cce22fd2cd9ba162ea2e09437531594e15bb7 expected_version: v1 -expected_commit: 2a35f97071c95b23bccb8c973099f2991c998599 +expected_commit: 3fcd04010ad115df943d2d001dbc4a1523c2a6d1 expected_total: 30 public_url: https://staging.ssw590-08.me proxy_network: gitea-net @@ -381,30 +645,72 @@ fails the run if any check fails; it does not roll back on its own. same command again and fails the build unless the recap shows \texttt{changed=0 unreachable=0 failed=0}: -\begin{tabularx}{\linewidth}{L{2.6cm}Y} +\begin{tabularx}{\linewidth}{L{3.4cm}L{2.2cm}Y} \toprule -\textbf{Run} & \textbf{PLAY RECAP for \texttt{startup}}\\ \midrule -First & \texttt{ok=9 changed=3 unreachable=0 failed=0 skipped=0}\\ -Second & \texttt{ok=9 changed=0 unreachable=0 failed=0 skipped=0}\\ +\textbf{Build} & \textbf{Run} & \textbf{PLAY RECAP for \texttt{startup}}\\ \midrule +First build, \#8 & First & \texttt{ok=9 changed=3 unreachable=0 failed=0 skipped=0}\\ + & Second & \texttt{ok=9 changed=0 unreachable=0 failed=0 skipped=0}\\ \addlinespace +Rebuild, \#4 & First & \texttt{ok=9 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0}\\ + & Second & \texttt{ok=9 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0}\\ \addlinespace +Run \#7 & First & \texttt{ok=9 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0}\\ + & Second & \texttt{ok=9 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0}\\ \bottomrule \end{tabularx} \medskip -Jenkins run \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8} (November 12, 2026, 11:51 PM EST): the first run created the environment and started the -container (\texttt{changed=3}); the identical second run changed nothing, and the -stage's check matched the recap line -\texttt{startup : ok=9 changed=0 unreachable=0 failed=0}. In the second run every -task reported \texttt{ok}, including the public HTTPS health, release-identity, -and price checks (\texttt{"msg": "All assertions passed"}). +\textbf{First build, run \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8}} (November 12, 2026, 11:51 PM EST): the first +run created the environment and started the container (\texttt{changed=3}); the +identical second run changed nothing, and the stage's check matched the recap +line \texttt{startup : ok=9 changed=0 unreachable=0 failed=0}. In the second run +every task reported \texttt{ok}, including the public HTTPS health, +release-identity, and price checks (\texttt{"msg": "All assertions passed"}). + +\textbf{Rebuild, run \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/4/}{\#4}} (November 13, 2026): the rebuilt image was +deployed to the same staging project. The first run applied the new release +(\texttt{changed=2}) and the identical second run changed nothing +(\texttt{changed=0}), so the \emph{Staging idempotence} stage passed. +Figure~\ref{fig:del-idempotence-rebuild} shows the start of that stage's log. The +recap lines above were copied from the build's console output. + +\textbf{Run \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/7/}{\#7}} (November 13, 2026): the image from commit +\texttt{c46f127e8c} was deployed to the same staging project. The first run +applied the new release (\texttt{changed=2}, Figure~\ref{fig:del-recap7-first}). +The identical second run changed nothing (\texttt{changed=0}), and the stage's +\texttt{grep} check for \texttt{changed=0 unreachable=0 failed=0} in +\texttt{rerun.log} matched (Figure~\ref{fig:del-recap7-second}), so the +\emph{Staging idempotence} stage passed. \delfig{staging-idempotence.png}{1.0}{November 12, 2026, run \#8 --- Jenkins Staging idempotence stage: the second, unchanged run passes every check and reports \texttt{changed=0}.}{fig:del-idempotence} +\delfig{staging-idempotence-rebuild.png}{1.0}{November 13, 2026, build \#4 --- +start of the Jenkins \emph{Staging idempotence} stage log for the rebuild: the same +\texttt{ansible-playbook} command and release record +(\texttt{release-v1-staging.yml}) are run again, with the deploy key masked +(\texttt{****}) and output copied to \texttt{rerun.log}. Its \texttt{changed=0} +recap line is quoted in the text.}{fig:del-idempotence-rebuild} + +\delfig{del-run7-recap-first.png}{1.0}{November 13, 2026, run \#7 (screenshot +taken at 9:32~PM EST) --- first \texttt{PLAY RECAP} for \texttt{startup}: +\texttt{ok=9 changed=2 unreachable=0 failed=0}, followed by the start of the +\emph{Staging idempotence} stage, which runs the same command with the deploy key +masked.}{fig:del-recap7-first} + +\delfig{del-run7-recap-second.png}{1.0}{November 13, 2026, run \#7 (screenshot +taken at 9:32~PM EST) --- second \texttt{PLAY RECAP}: \texttt{changed=0}, the +\texttt{grep} check on \texttt{rerun.log} matching it, the production stage still +printing ``Not implemented yet'', and ``All stages passed''.}{fig:del-recap7-second} + \delfig{staging-check.png}{1.0}{November 13, 2026 --- staging, v1: \url{https://staging.ssw590-08.me/} returns version \texttt{v1} and commit \texttt{2a35f97}, and \texttt{/price?quantity=3} returns a total of USD 30.}{fig:del-staging} +\delfig{staging-check-rebuild.png}{0.9}{November 13, 2026, about 8:29--8:30~PM +EST --- staging, rebuilt v1: \url{https://staging.ssw590-08.me/} returns version +\texttt{v1} and commit \texttt{3fcd0401}, and \texttt{/price?quantity=3} returns +a total of USD 30.}{fig:del-staging-rebuild} + \section{Approve and Promote the Same Image} \label{sec:del-promote} @@ -431,12 +737,12 @@ resource use, cleanup plan} \begin{tabularx}{\linewidth}{L{3.4cm}YY} \toprule \textbf{Item} & \textbf{v1} & \textbf{v2}\\ \midrule -Source commit & \texttt{2a35f97} & \FillIn{}\\ -Configuration commit & \FillIn{} & \FillIn{}\\ -Image digest & \texttt{sha256:ce91d055\ldots} & \FillIn{}\\ -Jenkins build & \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8} (staging) & \FillIn{}\\ -Scan result & \FillIn{} & \FillIn{}\\ -Staging result & Passed: health, v1, commit, total 30; rerun \texttt{changed=0} & \FillIn{}\\ +Source commit & \texttt{c46f127e8c} (run \#7; earlier: rebuild \texttt{3fcd0401}, first build \texttt{2a35f97}) & \FillIn{}\\ +Configuration commit & \texttt{c46f127e8c} (same checkout as the source; Ansible files and release record come from the build's own repository checkout) & \FillIn{}\\ +Image digest & \texttt{sha256:5e7c7244\ldots} (rebuild \texttt{sha256:26886859\ldots}; first build \texttt{sha256:ce91d055\ldots}) & \FillIn{}\\ +Jenkins build & \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/7/}{\#7} (staging; earlier \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/4/}{\#4} and \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8}) & \FillIn{}\\ +Scan result & Pass: both scan stages passed before Publish in run \#7 (rebuild \#4: 0 fixable High/Critical, 47 unfixed High accepted; first build failed: 7 fixable) & \FillIn{}\\ +Staging result & Run \#7: rerun \texttt{changed=0}; \FillIn{health, v1, commit and total check for the run \#7 deployment} & \FillIn{}\\ Approver and time & \FillIn{} & \FillIn{}\\ Production result & \FillIn{} & \FillIn{}\\ \bottomrule