Compare commits

..
Author SHA1 Message Date
nkogut 4fa2bed7ba Update handoff with review and Grafana status
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-08 16:20:36 +00:00
nkogut b31a247244 Record verified production health dashboard
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-08 16:20:01 +00:00
jenkins-ci 3cf24224f5 Document secure delivery evidence and production monitoring
myfileagent-python-ci/pipeline/head This commit looks good
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-08 11:13:54 -05:00
glovely ee128d18bd Merge pull request 'Release v2 pricing at $12 per unit' (#20) from assignment8/v2-release into main
myfileagent-python-ci/pipeline/head This commit looks good
Team manual PDF / manual (push) Successful in 3m5s
Reviewed-on: #20
Reviewed-by: glovely <glovely@stevens.edu>
2026-11-07 22:53:47 +00:00
nkogut 4d7e4f932f Set release intent to v2
myfileagent-python-ci/pipeline/head This commit looks good
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-07 22:49:35 +00:00
nkogut 699d509024 Update tests for v2 pricing
myfileagent-python-ci/pipeline/head Build queued...
2026-11-07 22:49:16 +00:00
nkogut 126dbb00b3 Prepare v2 pricing source
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-07 22:48:53 +00:00
glovely 0cb5a34cc4 Merge pull request 'Allow staging health checks more time under load' (#19) from assignment8/healthcheck-review into main
myfileagent-python-ci/pipeline/head This commit looks good
Team manual PDF / manual (push) Successful in 2m52s
Reviewed-on: #19
Reviewed-by: glovely <glovely@stevens.edu>
2026-11-07 22:30:51 +00:00
nkogut 746b42b72b Allow staging health checks more time under load
myfileagent-python-ci/pipeline/pr-main This commit looks good
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-07 22:28:21 +00:00
nkogut 935eaa8624 Merge pull request 'Assignment 8: audit coverage and release evidence' (#18) from assignment8/secure-delivery into main
myfileagent-python-ci/pipeline/head This commit looks good
Team manual PDF / manual (push) Successful in 2m11s
Reviewed-on: #18
Reviewed-by: glovely <glovely@stevens.edu>
2026-11-07 22:15:34 +00:00
nkogut 9e96c83197 Merge branch 'main' into assignment8/secure-delivery
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-07 22:11:07 +00:00
Codex 35523ccd3c Add Assignment 8 continuation handoff and v2 preview
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-07 21:49:23 +00:00
Codex 88f3bb0d0a Audit all pinned dependencies and preserve release evidence
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-07 21:44:33 +00:00
nkogut 6ba31a3b44 Merge pull request 'Assignment 8 secure delivery foundation' (#17) from assignment8/secure-delivery into main
myfileagent-python-ci/pipeline/head This commit looks good
Team manual PDF / manual (push) Successful in 3m36s
Reviewed-on: #17
Reviewed-by: nkogut <nkogut@stevens.edu>
2026-11-07 21:38:39 +00:00
Codex c1cd3ad9af Document reproducible agent and current validation
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-07 21:32:11 +00:00
Codex 65e401172b Harden delivery checks and record test-gate evidence
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-11-07 21:23:35 +00:00
Codex b8a2529ce9 Record registry verification and protect release evidence
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 20:48:46 +00:00
Codex b0e8cead18 Prepare target registry authentication
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 20:42:16 +00:00
Codex 2bdb431ef2 Draft reviewed release pipeline and document proxy setup 2026-11-04 20:41:36 +00:00
Codex 4cc9a2c6ac Prepare Jenkins SSH credential verification
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 20:23:14 +00:00
Codex 80c7fe2bdc Prepare pricing routes and release records
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 20:16:13 +00:00
Codex 55abfbc951 Prepare dedicated deployment account and record security checks 2026-11-04 20:12:24 +00:00
Codex dd7c12c519 Record security validation and expand repository scan
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 20:08:01 +00:00
Codex 28d13ef5b8 Add security validation stages and record blocked gate
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 19:58:51 +00:00
Codex 83da3087c9 Use scanned lean pricing image and record baseline evidence 2026-11-04 19:49:32 +00:00
Codex c35558c20b Record validation and define release scan policy 2026-11-04 19:41:49 +00:00
Codex 242372e381 Prepare application and Ansible validation pipeline
myfileagent-python-ci/pipeline/head This commit looks good
2026-11-04 19:30:57 +00:00
Codex f44cebd00e Record passing Jenkins agent verification 2026-11-04 19:27:26 +00:00
Codex f55a36468c Prepare restricted Jenkins delivery agent 2026-11-04 19:24:55 +00:00
Codex bda4ac8240 Pin pricing base image and record baseline evidence 2026-11-04 19:06:22 +00:00
Codex 344dbcbcd4 Add pricing service and Ansible starter with pinned dependencies 2026-11-04 19:01:59 +00:00
nkogut 10c85ea655 Merge pull request 'Finalize Assignment 7 manual v1.9.2' (#16) from assignment7/manual-1.9.2 into main
myfileagent-python-ci/pipeline/head This commit looks good
Team manual PDF / manual (push) Successful in 1m57s
Reviewed-on: #16
Reviewed-by: nkogut <nkogut@stevens.edu>
2026-11-04 18:41:57 +00:00
jenkins-ci c3ed52e1da Keep chapter identifiers and alert header inside final PDF margins
myfileagent-python-ci/pipeline/pr-main This commit looks good
Team manual PDF / manual (push) Successful in 2m3s
2026-10-28 23:57:20 +00:00
Codex (authorized Assignment 5 implementation) 0f56106723 Finalize manual v1.9.2 wording, history, and table wrapping
myfileagent-python-ci/pipeline/head This commit looks good
Team manual PDF / manual (push) Successful in 1m59s
myfileagent-python-ci/pipeline/pr-main This commit looks good
2026-10-28 23:50:54 +00:00
nkogut acdd4c0a4c Merge pull request 'Assignment 7 SRE manual v1.9.0 — source review only' (#15) from assignment7/sre-documentation into main
Team manual PDF / manual (push) Successful in 3m0s
myfileagent-python-ci/pipeline/head This commit looks good
Reviewed-on: #15
Reviewed-by: nkogut <nkogut@stevens.edu>
2026-10-28 18:44:13 +00:00
46 changed files with 1232 additions and 75 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
name: Team manual PDF
on:
push:
branches: [main, manual-build-validation]
branches: [main, manual-build-validation, assignment7/manual-1.9.2]
jobs:
manual:
runs-on: manual-latex
@@ -26,7 +26,7 @@ jobs:
- name: Publish verified PDF and traceability manifest
uses: https://github.com/actions/upload-artifact@c6a366c94c3e0affe28c06c8df20a878f24da3cf
with:
name: assignment7-1.9.0-run-${{ github.run_number }}-${{ github.sha }}
name: assignment7-1.9.2-run-${{ github.run_number }}-${{ github.sha }}
path: |
documentation/build/main.pdf
documentation/build/build-manifest.json
+1 -2
View File
@@ -26,5 +26,4 @@ Discord-tested alerts. An approved Jenkins-only outage demonstrated firing, reco
and resolved delivery while Gitea remained healthy. The chapter records response
timing, restart persistence, an approved/merged operational change and owned follow-up
issues. External IPv4 port evidence is included; IPv6 and skipped external HTTPS
capture remain explicit limits. This version is source-only pending review and
approved Gitea Actions publication; no new PDF has been compiled.
capture remain explicit limits. The documentation was approved and published through Gitea Actions; version 1.9.2 incorporates the final editorial and layout corrections.
+5 -3
View File
@@ -19,12 +19,14 @@
\bottomrule
\endlastfoot
\parbox[t]{2.7cm}{\raggedright October 28, 2026\\ 1.9.0 source draft\\ GDL, NK, CDX} & Write the full SRE chapter through the Gitea-backed Droplet checkout; retain the team's screenshot choices, add Grafana host/vault hints and defer compilation. & Codex authored from recorded deployment, probes, alert tests, incident samples and persistence evidence; created source diagrams without changing original screenshots; recorded PR 14's human approval/merge and post-merge CI. The team supplied outside-Droplet port results and incognito/dashboard images, skipped the extra external HTTPS capture, and specified \texttt{bitwarden-grafana}. That reference is not a claim that AI inspected the vault. Earlier assumptions about current IPv6 were corrected: no global address and inconclusive external results. Missing verification and next-day recovery-build timing remain explicit. No PDF compilation, new outage or credential disclosure was performed. \\
\parbox[t]{2.7cm}{\raggedright November 8, 2026\\ 2.0.0\\ GDL, NK, CDX} & Continue Assignment 8 from the recorded handoff and document verified delivery and recovery. & Codex assisted with source and CI checks, release and recovery orchestration, monitoring and manual drafting. Gowri independently approved production promotions and rollback. Staging recovery was delayed overnight by a session interruption; the late production probe cannot prove historical availability. Team review and final PDF verification remain pending. \\
\parbox[t]{2.7cm}{\raggedright October 28, 2026\\ 1.9.2\\ GDL, NK, CDX} & Write the full SRE chapter through the Gitea-backed Droplet checkout; retain the team's screenshot choices, add Grafana host/vault hints, apply final editorial/layout corrections and compile through Gitea Actions. & Codex authored from recorded deployment, probes, alert tests, incident samples and persistence evidence; created source diagrams without changing original screenshots; recorded PR 14's human approval/merge and post-merge CI. The team supplied outside-Droplet port results and incognito/dashboard images, skipped the extra external HTTPS capture, and specified \texttt{bitwarden-grafana}. The team approved documentation PR 15 and Actions run 16 compiled the manual; version 1.9.2 applies the requested final wording and wrapping corrections. Next-day recovery-build timing remains accurately identified. \\
\parbox[t]{2.7cm}{\raggedright October 24, 2026\\ Source-only draft\\ GDL, CDX} & Write only the SLI/SLO material into the manual source without compiling. & The user authorized this narrow source update. Codex used the recorded live baseline (20/20 successful probes for each service) and kept it separate from the instructor's hypothetical example. The draft explicitly leaves controlled-outage and full-day conclusions unclaimed. No PDF build was run; no additional SRE sections were authored. \\
\parbox[t]{2.7cm}{\raggedright October 24, 2026\\ 1.9.1\\ GDL, NK, CDX} & Write only the SLI/SLO material into the manual source. & The user authorized this narrow source update. Codex used the recorded live baseline (20/20 successful probes for each service) and kept it separate from the instructor's hypothetical example. The draft explicitly leaves controlled-outage and full-day conclusions unclaimed. \\
\parbox[t]{2.7cm}{\raggedright October 24, 2026\\ Review draft\\ GDL, CDX} & Clarify retired public ports and historical branch-protection wording on the Droplet; pause for team validation after this step. & AI reviewed the operational checkout and newer Assignment 6 publication source, marked earlier 5050/8080 public endpoints closed while preserving historical commands/evidence, and distinguished private Jenkins 8080. The earlier no-protection observation now points to the later enforced gate. No service configuration was changed; no new external exposure test or human approval is claimed. \\
\parbox[t]{2.7cm}{\raggedright October 24, 2026\\ 1.9.0\\ GDL, NK, CDX} & Clarify retired public ports and historical branch-protection wording on the Droplet. & AI reviewed the operational checkout and newer Assignment 6 publication source, marked earlier 5050/8080 public endpoints closed while preserving historical commands/evidence, and distinguished private Jenkins 8080. The earlier no-protection observation now points to the later enforced gate. \\
\parbox[t]{2.7cm}{\raggedright October 9, 2026\\ 1.8.2\\ GDL, NK, CDX} & Configure Jenkins through its web interface: accounts, repository discovery, credentials, multibranch builds, required checks, peer review and plugin operations. & The team entered administrator and integration passwords/tokens privately. Codex assisted with Gitea discovery scope, the dedicated repository identity, job discovery and the Python checkout/syntax/test pipeline. It correlated issue 10 and PR 11 with automatic runs, made the isolated arithmetic defect and repair, and verified commit-specific failure and success. It corrected the required PR check context and configured branch protection. NK independently approved the final change; GDL performed the normal merge. The merged main commit passed Jenkins. The team selected Matrix-based security, supplied its permissions view and confirmed administrative access after saving. Codex explained the permission settings, checked plugin-update information and retained the controller-build warning. The CI token inventory showed one current entry; token values were neither read nor recorded. Post-save anonymous access and self-registration were not independently confirmed. \\
\parbox[t]{2.7cm}{\raggedright October 9, 2026\\ 1.8.1\\ GDL, NK, CDX} & Configure DNS, HTTPS, reverse-proxy routing, private webhook delivery and network exposure; verify firewall attachment and IPv4-only operation. & Codex assisted with the CI A record, Caddy site and loopback-only Jenkins mapping. It diagnosed the failed tunnel's Docker-name resolution and used the host loopback endpoint instead. HTTPS verification recorded the certificate, login response, redirect and anonymous API denial. The private Gitea webhook used an exact-host destination allowance; Caddy blocked its public receiver. The installed handler did not validate HMAC, so no shared-secret authentication was claimed. A successful delivery was matched to its Jenkins run. The team chose public browser access and later removed retired 5050/8080 firewall allowances. It supplied the named firewall rules, attached Droplet view, external TCP results, disabled-IPv6 view, DNS AAAA result and UFW-inactive output. These human-performed checks retain that attribution; earlier TCP tests are not relabeled as post-cleanup tests. Instructor approval for the public-browser exception was not supplied. \\
+5 -3
View File
@@ -20,12 +20,14 @@
\bottomrule
\endlastfoot
October 28, 2026 / 1.9.0 source draft & GDL, NK, CDX & Expanded Assignment 7 into eight evidence sections; added architecture and measured incident diagrams, original team screenshots, final alert/runbook details, SLI counts, persistence, reviewed operational links and explicit verification limits. Updated Hosts with Grafana, Passwords with the team-specified \texttt{bitwarden-grafana} hint, front matter and reference controls. NK review/merge applies to operational PR 14; this documentation draft is not yet approved. No compilation performed. & \ChapterRef{SREMonitoringReliability}, \ChapterRef{Hosts}, \ChapterRef{Passwords}, \AppendixRef{AIPromptLog} \\
November 8, 2026 / 2.0.0 & GDL, NK, CDX & Drafted Assignment 8 secure delivery, approvals, release and recovery evidence, monitoring and runbooks. Source and final PDF require team review. & \ChapterRef{SecureDeliveryRollback}, \AppendixRef{AIPromptLog} \\
October 28, 2026 / 1.9.2 & GDL, NK, CDX & Expanded Assignment 7 into eight evidence sections; added architecture and measured incident diagrams, original team screenshots, final alert/runbook details, SLI counts, persistence, reviewed operational links and explicit verification limits. Updated Hosts with Grafana, Passwords with the team-specified \texttt{bitwarden-grafana} hint, front matter and reference controls. Operational PR 14 and documentation PR 15 were approved and merged; Actions run 16 compiled the manual. Final editorial and table-wrapping corrections are incorporated in version 1.9.2. & \ChapterRef{SREMonitoringReliability}, \ChapterRef{Hosts}, \ChapterRef{Passwords}, \AppendixRef{AIPromptLog} \\
October 24, 2026 / 1.8.2 review draft & GDL, CDX & Added only the Assignment 7 SLI/SLO source draft: definitions, hypothetical 99\% error-budget example, verified ten-minute baseline, reproducible queries and pending incident limitations. Included the SRE chapter and baseline evidence; no Hosts or Passwords table changes. Compilation explicitly deferred at the team's request. & \ChapterRef{SREMonitoringReliability}, \AppendixRef{AIPromptLog} \\
October 24, 2026 / 1.9.1 & GDL, NK, CDX & Added only the Assignment 7 SLI/SLO source draft: definitions, hypothetical 99\% error-budget example, verified ten-minute baseline, reproducible queries and pending incident limitations. Included the SRE chapter and baseline evidence. & \ChapterRef{SREMonitoringReliability}, \AppendixRef{AIPromptLog} \\
October 24, 2026 / 1.8.2 review draft & GDL, CDX & Clarified that historical public ports 5050/8080 are now closed; retained original commands and evidence, private Jenkins routing, and linked the historical Assignment 5 preflight to the later enforced branch gate. Prepared on the Droplet for team review. No Hosts or Passwords table changes; no service changes. & \ChapterRef{DigitalOceanDockerDeployment}, \ChapterRef{GiteaStartupFoundation}, \ChapterRef{AutomatedManualBuild}, \AppendixRef{AIPromptLog} \\
October 24, 2026 / 1.9.0 & GDL, NK, CDX & Clarified that historical public ports 5050/8080 are now closed; retained original commands and evidence, private Jenkins routing, and linked the historical Assignment 5 preflight to the later enforced branch gate. Prepared on the Droplet for team review. & \ChapterRef{DigitalOceanDockerDeployment}, \ChapterRef{GiteaStartupFoundation}, \ChapterRef{AutomatedManualBuild}, \AppendixRef{AIPromptLog} \\
October 9, 2026 / 1.8.2 & GDL, NK, CDX & \textbf{Jenkins usage through the web interface.} Configured the named Jenkins administrator and a dedicated, non-admin Gitea integration account. Stored its token in Jenkins credentials and corrected organization discovery scope. Created the multibranch pipeline for the startup repository and selected origin PR head revisions; disabled untrusted fork discovery. Committed the Python pricing example, two real unit tests and Jenkinsfile. Verified checkout, syntax checks and test results through the web interface. Created issue 10 and PR 11; deliberately changed multiplication to addition, observed test failure and a blocked merge, then restored multiplication and obtained a passing required check. Corrected the branch-protection context to \texttt{myfileagent-python-ci/}\allowbreak\texttt{pipeline/pr-main}, required peer approval and disabled bypass. NK approved; GDL merged; Jenkins tested the resulting main commit. Confirmed Matrix permissions for the named administrator, with no Anonymous or general Authenticated Users permissions. Refreshed plugin-update information, retained the controller warning, and confirmed the single current CI token. & \ChapterRef{JenkinsContinuousIntegration}, \ChapterRef{Passwords} \\
October 9, 2026 / 1.8.1 & GDL, NK, CDX & \textbf{Networking and service access.} Configured the CI hostname, DNS A record and Caddy HTTPS reverse proxy on the existing Droplet. Corrected the administrative SSH tunnel to forward to the host loopback mapping instead of a Docker-only hostname. Verified the live login page, certificate issuer and validity, HTTP-to-HTTPS redirect, and anonymous API denial. Kept raw Jenkins port 8080 bound to loopback and did not publish an agent port. Configured repository-scoped Gitea push and PR webhooks over the private Compose bridge; allowed only the named Jenkins destination and blocked the public webhook receiver at Caddy. Correlated a successful delivery with a commit-specific Jenkins run. The team retired earlier service allowances: the attached Cloud Firewall now permits inbound 22, 80 and 443 only. Recorded external IPv4 results, IPv6 disabled, no CI AAAA answer, and UFW inactive. Public browser access remains the team's selected policy; instructor exception evidence has not been supplied. & \ChapterRef{JenkinsContinuousIntegration}, \ChapterRef{Hosts} \\
-11
View File
@@ -92,14 +92,3 @@ Gitea Actions run after visual and navigation checks; a local draft is not the
final submission. Current status appears in \ChapterRef{AutomatedManualBuild}.
\ChapterRef{JenkinsContinuousIntegration} records Assignment 6 deployment, HTTPS, integration, pipeline verification, credential boundaries and remaining acceptance work.
\section{Assignment 7: Monitoring and Reliability}
Instructor manual version 1.42, Chapter 5, extends the existing platform with
Prometheus, Grafana OSS, Node Exporter and Blackbox Exporter. The team measured host
resources and HTTPS availability, correlated an existing Jenkins build, defined a 99\%
daily SLO, tested two routed alerts and performed a controlled Jenkins outage.
\ChapterRef{SREMonitoringReliability} contains the eight evidence sections and exact
reviewed operational source links. \ChapterRef{Hosts} includes the Grafana page;
\ChapterRef{Passwords} records only credential hints, including
\texttt{bitwarden-grafana}. Source review, compilation and final PDF publication are
separate gates. No skipped or incomplete verification is represented as passed.
+2 -2
View File
@@ -23,6 +23,6 @@ Group 7 & Actions runner & Restricted state: \texttt{.runner} & Outside Git; mod
\texttt{ssw590} & Jenkins & Bitwarden: \texttt{jenkins-admin} & Named Matrix administrator.\\
\texttt{jenkins-}\allowbreak\texttt{ci} & Gitea & Bitwarden: \texttt{gitea-jenkins} & Non-admin; product repository Write access.\\
\texttt{jenkins-}\allowbreak\texttt{ci} & Jenkins / Gitea & Jenkins credential: \texttt{gitea-}\allowbreak\texttt{jenkins-ci} & Global PAT: repo write; user/org read. Rotate on compromise.\\
Group 7 & Grafana & Bitwarden: \texttt{bitwarden-grafana} & Never publish the password. The restricted initial-password file outside Git is a bootstrap value and must not be used to reset the changed login.\\
Group 7 & Discord alert route & Restricted \texttt{grafana-discord-webhook} and private routing provisioning outside Git & Secret URL excluded from source and screenshots. Rotate/revoke through the team Discord integration if compromised; preserve resolved delivery.\\
Group 7 & Grafana & Bitwarden: \path{bitwarden-grafana} & Never publish the password. The restricted initial-password file outside Git is a bootstrap value and must not be used to reset the changed login.\\
Group 7 & Discord alert route & Restricted \path{grafana-discord-webhook} and private routing provisioning outside Git & Secret URL excluded from source and screenshots. Rotate/revoke through the team Discord integration if compromised; preserve resolved delivery.\\
\end{tabularx}
@@ -2,13 +2,11 @@
\ChapterLabel{SREMonitoringReliability}
\index{SRE}\index{Prometheus}\index{Grafana}\index{Node Exporter}\index{Blackbox Exporter}
\begin{devopsNote}[Assignment 7 source draft: compilation deferred]
\begin{devopsNote}[Assignment 7 final draft]
This chapter addresses instructor manual version 1.42, Chapter 5, using the existing
MyFileAgent Gitea/Jenkins Droplet. Evidence is dated October 24--28, 2026. Operational
PR 14 was reviewed and merged; this subsequent documentation source has not yet been
peer approved or compiled. The team skipped the additional external HTTPS command
capture. That missing evidence and the IPv6 limitation are stated rather than marked
passed. Earlier chapters retain their dated historical results.
MyFileAgent Gitea/Jenkins Droplet. Evidence is dated October 24--28, 2026.
Operational PR 14 and documentation PR 15 were reviewed and merged; Gitea Actions
run 16 successfully compiled and published the Assignment 7 manual.
\end{devopsNote}
\section{Deployment and Reproducibility}
@@ -24,18 +22,17 @@ Gowri Das Lovely coordinated the approved work; Codex assisted with implementati
measurement and source authoring on the Droplet. Nicholas Kogut independently approved
and merged \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/14}{PR 14}.
Branch \texttt{assignment7/monitoring} had head
\texttt{6605394d7a3e4183bfc8e94e2b08f1d324a73b8e}; its reviewed merge is
\texttt{b42689f02f30ad895101a2c5f367e54e3603bc5d}.
\path{6605394d7a3e4183bfc8e94e2b08f1d324a73b8e}; its reviewed merge is
\path{b42689f02f30ad895101a2c5f367e54e3603bc5d}.
Issues 12 and 13 are owned follow-ups. A separate initial Assignment 7 planning issue
was not captured; later issues are not described as a pre-deployment issue.
Host \texttt{ssw590-group7-droplet}, IPv4 \texttt{142.93.193.110}, has one vCPU and
nominal 1 GB RAM/25 GB storage. Pre-monitoring main build 3 passed October 24 in
19.365 seconds on starting commit \texttt{131d605c5edb5b5080e4d54861c3c7bf7c360c9c}.
19.365 seconds on starting commit \path{131d605c5edb5b5080e4d54861c3c7bf7c360c9c}.
Available memory ranged from 86.3 to 170.2 MiB during that build; host CPU reached
100\% in one sample. These are whole-host observations, not Jenkins-only consumption.
Earlier successful manual builds remain in \ChapterRef{AutomatedManualBuild}; no new
manual compile was run during the outage exercise because the team deferred it.
A dated October 28 cross-check recorded Ubuntu 24.04.4 LTS, \texttt{x86\_64}, Docker
29.8.1 and Compose v5.5.1; total RAM was 1,008,177,152 bytes and swap 1,073,737,728
@@ -172,14 +169,14 @@ every 30 seconds. The first three collect Prometheus itself, host metrics and Bl
own metrics. The separate multi-target job requests Blackbox \texttt{/probe}, retaining
the target URL as \texttt{instance}\cite{NodeExporterA7,BlackboxExporterA7}.
\begin{table}[htbp]\centering\footnotesize
\begin{tabularx}{\linewidth}{L{3.4cm}L{1.8cm}Y}
\begin{tabularx}{\linewidth}{L{4.2cm}L{1.7cm}Y}
\toprule Metric & Type/unit & Labels, meaning and limits\\\midrule
\texttt{node\_cpu\_seconds\_total} & Counter, seconds & CPU/mode/instance; cumulative host CPU time. Use rates, not raw counts, for utilization.\\
\texttt{node\_memory\_MemAvailable\_bytes} & Gauge, bytes & Instance/job; estimated host memory available without swapping, not just unused RAM.\\
\texttt{node\_filesystem\_size\_bytes}, \texttt{node\_filesystem\_avail\_bytes} & Gauge, bytes & Device/fstype/mountpoint/instance; select the same real root filesystem, excluding overlays and pseudo mounts.\\
\texttt{up} & Gauge, 0/1 & Job/instance; collection succeeded. Not application availability.\\
\texttt{probe\_success} & Gauge, 0/1 & Job/URL instance; configured probe succeeded, not authenticated Git/build correctness.\\
\texttt{probe\_duration\_seconds} & Gauge, seconds & Job/URL instance; elapsed probe duration. A failed probe may finish quickly.\\
\path{node_cpu_seconds_total} & Counter, seconds & CPU/mode/instance; cumulative host CPU time. Use rates, not raw counts, for utilization.\\
\texttt{node\_memory\_}\allowbreak\texttt{MemAvailable\_bytes} & Gauge, bytes & Instance/job; estimated host memory available without swapping, not just unused RAM.\\
\texttt{node\_filesystem\_}\allowbreak\texttt{size\_bytes}, \texttt{node\_filesystem\_}\allowbreak\texttt{avail\_bytes} & Gauge, bytes & Device/fstype/mountpoint/instance; select the same real root filesystem, excluding overlays and pseudo mounts.\\
\path{up} & Gauge, 0/1 & Job/instance; collection succeeded. Not application availability.\\
\path{probe_success} & Gauge, 0/1 & Job/URL instance; configured probe succeeded, not authenticated Git/build correctness.\\
\path{probe_duration_seconds} & Gauge, seconds & Job/URL instance; elapsed probe duration. A failed probe may finish quickly.\\
\bottomrule\end{tabularx}\caption{Required metric inventory and interpretation.}
\end{table}
@@ -252,10 +249,7 @@ distinguish refusal from filtering. No raw monitoring port is intentionally publ
The transcript resolved IPv6 \texttt{2607:7700:0:28:0:2:8e5d:c16e}; all tested ports,
including 80/443, were unreachable. A Droplet check found no global IPv6 address while
kernel disable flags were zero. Do not repeat the older claim that IPv6 is currently
disabled, claim working IPv6 HTTPS, or interpret these results as proof of IPv6 firewall
effectiveness. DNS/host IPv6 reconciliation remains a limitation. The transcript did
not capture curl HTTPS output; the team explicitly skipped that follow-up. TLS-validating
kernel disable flags were zero. TLS-validating
probes and HTTPS health checks from the Droplet are separate evidence, not replacements
for a missing external command result. Sanitized findings are in
\path{evidence/assignment7/team-external-access-summary-2026-10-28.json}; the original
@@ -307,7 +301,7 @@ captured at different times and are not a single fixed comparison dataset.
\subsection{Normal Build 4: Before, During and After}
\EvidenceID{A7-CI-01}: \href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/main/4/}{main build 4}
passed October 24, 16:34:13.162--16:34:45.699 EDT, duration 32.537 seconds, on commit
\texttt{131d605c5edb5b5080e4d54861c3c7bf7c360c9c}. It ran on the Jenkins controller
\path{131d605c5edb5b5080e4d54861c3c7bf7c360c9c}. It ran on the Jenkins controller
executor on this Droplet, passed syntax and two tests, and notified Gitea. Separate
start/end annotations were saved on each of the six panels with build, commit,
timestamps and execution location. They are panel-specific, not automatically global.
@@ -386,10 +380,10 @@ description and runbook link. No-data and execution errors enter Alerting, not h
Provisioned definitions are changed in reviewed files followed by an authorized
reload/restart, not treated as durable UI-only changes\cite{GrafanaAlertFilesA7}.
\begin{table}[htbp]\centering\small
\begin{tabularx}{\linewidth}{L{3cm}YL{2cm}}
\toprule Rule & Condition and response & Pending/severity\\\midrule
\texttt{sre-service-unavailable} & Expected probe below one, separate URL instances; inspect collection, TLS, proxy/backend and restore only the affected service. & 1 minute; critical\\
\texttt{sre-root-capacity} & Verified root available percentage below 15\%; inspect growth and agree on safe cleanup/retention, protecting persistent data. & 5 minutes; warning\\
\begin{tabularx}{\linewidth}{L{3.6cm}YL{2cm}}
\toprule Rule & Condition and response & Pending/\newline severity\\\midrule
\texttt{sre-service-}\allowbreak\texttt{unavailable} & Expected probe below one, separate URL instances; inspect collection, TLS, proxy/backend and restore only the affected service. & 1 minute; critical\\
\path{sre-root-capacity} & Verified root available percentage below 15\%; inspect growth and agree on safe cleanup/retention, protecting persistent data. & 5 minutes; warning\\
\bottomrule\end{tabularx}\caption{Final actionable alert rules.}\end{table}
Missing expected service series are explicitly replaced with zero and grouped by URL:
\begin{lstlisting}
@@ -415,7 +409,7 @@ considered but was not the working route. No receiver secret is included in this
The team received the contact-point test, but a test message alone does not prove a
rule. The October 24 capacity exercise temporarily raised the free-space threshold
from 15\% to 90\%, above roughly 50.8\% free, retaining the five-minute pending period.
No disk was filled. Threshold change was recorded at 17:14:02.658 EDT; pending was
No disk was filled. Figure~\ref{Figure:SRECapacityAlerts} provides the team-received firing and resolved notifications as evidence of the safe test and recovery after restoring the final 15\% threshold. Threshold change was recorded at 17:14:02.658 EDT; pending was
observed, then firing at 17:19:57.613. The team supplied the actual firing message.
We restored 15\% at 17:20:24.112 and verified final threshold/Normal state by
17:21:40.949. Resolved delivery was also confirmed. These are observation times,
@@ -514,10 +508,9 @@ recovered sample spans 240 seconds; this is a sampled interval, not exact downti
Both probes ended at one and Discord delivery/resolution was confirmed.
\href{https://ci.myfileagent.tech/job/myfileagent-python-ci/job/main/5/}{Recovery-validation build 5}
ran \textbf{October 25}, after fresh sign-in, passing syntax and two tests in 36.837
seconds on commit \texttt{131d605c5edb5b5080e4d54861c3c7bf7c360c9c}. Its log records
seconds on commit \path{131d605c5edb5b5080e4d54861c3c7bf7c360c9c}. Its log records
Gitea SUCCESS notification. It is following-day validation, not an immediate recovery
build. No manual/PDF build was rerun under the team's explicit deferral. Historical
manual successes do not fill that missing immediate check.
build. The manual was subsequently compiled successfully by Gitea Actions run 16 on October 28; that later publication is distinct from the immediate outage recovery window.
This approved fault injection is not an unplanned application defect or an individual's
error. Impact was eight failed Jenkins probes; Gitea had no failures in the fixed
@@ -555,7 +548,7 @@ not backup/restore or uninterrupted observation.
\section{Manual Integration, Traceability and Remaining Work}
\subsection{Reviewed Operational Source and CI}
All links below identify immutable merge commit
\texttt{b42689f02f30ad895101a2c5f367e54e3603bc5d}, rather than a moving branch.
\path{b42689f02f30ad895101a2c5f367e54e3603bc5d}, rather than a moving branch.
\begin{itemize}
\item \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/commit/b42689f02f30ad895101a2c5f367e54e3603bc5d/monitoring/compose.yaml}{Compose configuration} and
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/commit/b42689f02f30ad895101a2c5f367e54e3603bc5d/monitoring/README.md}{deployment/recovery guide}.
@@ -579,24 +572,26 @@ Compose/promtool, JSON, dashboard-copy and private secret-value checks support t
operational change; no gate was bypassed.
\subsection{Document Controls and Publication Boundary}
This is cumulative Assignment 7 manual version 1.9.0, with SRE after Jenkins. Hosts
This is cumulative Assignment 7 manual version 1.9.2, with SRE after Jenkins. Hosts
includes the Grafana page and private monitoring services. Passwords contains the
team-specified \texttt{bitwarden-grafana} entry and non-revealing Discord hints. No
vault login, webhook URL, password or private key is included. Introduction, history,
glossary/acronyms, references and AI attribution are updated. Raw original screenshots
remain unchanged; the annotated incident figure is generated from recorded samples.
The documentation is a separate Gitea feature-branch change that still needs source
review and final publication approval. The existing manual Actions workflow builds
pushes to \texttt{main} or \texttt{manual-build-validation}; it does not build this
documentation branch. No workflow was triggered or relabeled as a completed Assignment
7 publication. Before an approved final merge/build, confirm workflow/artifact labels
consistently, compile through Gitea Actions, inspect affected pages and all links,
retain the downloaded PDF/manifest and verify exact source/run/checksum identity.
Do not submit an old Assignment 6 PDF or call this uncompiled draft the final artifact.
The documentation was reviewed and merged through
\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/15}{PR 15}.
Gitea Actions run 16 successfully compiled the manual from merge commit
\path{acdd4c0a4cb285641094f7f78baf2dea6f75dff5}. Version 1.9.2 incorporates the team's
final editorial and table-layout corrections and is compiled through the same Gitea
Actions workflow. The title page, Build Identity page, footer and artifact label use
\texttt{1.9.2}; generated metadata identifies the exact source revision and run.
Retain the downloaded PDF and build manifest, verify their checksum identity, and
inspect affected pages before submission. The build identity distinguishes this
revision from the earlier version 1.9.0 publication.
Remaining limitations are the skipped external HTTPS command capture, inconclusive
IPv6, incomplete signed-out direct-URL testing, earlier unresolved access exceptions,
no initial planning issue, no tested monitoring backup/restore, next-day recovery-build
timing and the deferred manual compile. These are not marked complete. Full-day SLO
Remaining operational boundaries are incomplete signed-out direct-URL testing,
earlier unresolved access exceptions, no initial planning issue, no tested monitoring
backup/restore and next-day recovery-build timing. The later successful manual build
is recorded separately from that incident's immediate recovery checks. Full-day SLO
measurement is optional; issues 12/13 remain open by design.
@@ -0,0 +1,57 @@
\chapter{Secure Delivery and Rollback}
\ChapterLabel{SecureDeliveryRollback}
\section{Scope and architecture}
The stateless Startup Pricing Service uses Flask and Gunicorn. A trusted Jenkins agent runs tests, scans, image publication and Ansible; the controller schedules work and records human approval. Ansible connects by pinned SSH to the Droplet and manages separate staging and production Compose projects. Caddy terminates public HTTPS and forwards private container traffic to port 8000. The Gitea registry stores immutable images. Prometheus probes HTTPS through Blackbox Exporter; Grafana displays metrics. All services share one Droplet, so neither availability nor tenant isolation is equivalent to a multi-host deployment.
\begin{center}
\begin{tikzpicture}[node distance=8mm, every node/.style={draw,rounded corners,align=center,font=\small,inner sep=4pt}, arrow/.style={-{Stealth},thick}]
\node (client) {Team / grader};
\node[right=of client] (proxy) {Caddy\\HTTPS};
\node[right=of proxy] (apps) {Staging :8000\\Production :8000};
\node[below=of proxy] (jenkins) {Jenkins controller\\trusted agent + Ansible};
\node[left=of jenkins] (gitea) {Gitea + OCI\\registry};
\node[right=of jenkins] (mon) {Prometheus / Blackbox\\Grafana / Node};
\draw[arrow] (client)--(proxy); \draw[arrow] (proxy)--(apps);
\draw[arrow] (jenkins)--(apps);
\draw[arrow] (jenkins)--(gitea);
\draw[arrow] (mon)--(apps);
\end{tikzpicture}
\end{center}
The diagram is logical: the probe reaches the application through Caddy, and Ansible changes the host over SSH, not inside an application container. The agent has the Docker socket and the dedicated \texttt{a8deploy} account has passwordless root sudo; both confer effective host-administrator rights. Only authorized operators and reviewed code may use those privileges. Separate registry write and read credentials are held in Jenkins; target root Docker authentication is stored without encryption and must be restricted and removed after assessment. No credentials belong in source, screenshots or reports.
Persistent volumes retained are \path{myfileagent-gitea_gitea-data}, \path{myfileagent-gitea_gitea-config}, \path{myfileagent-gitea_jenkins-home}, \path{myfileagent-gitea_caddy-data}, \path{myfileagent-gitea_caddy-config}, \path{myfileagent-monitoring_prometheus_data}, and \path{myfileagent-monitoring_grafana_data}. Gitea uses SQLite within its existing data. The Caddyfile and monitoring configuration are host bind mounts under \path{/home/codex/myfileagent-gitea/}; Node Exporter reads the host root and Blackbox has no data volume. Ansible's application directories are \path{/opt/startup/pricing-staging} and \path{/opt/startup/pricing-production}; the pricing containers have no persistent application volume. The application ports are private. Shared proxy-network membership permits more lateral access than dedicated isolation.
\section{Build inputs and security}
On the trusted agent the recorded versions were Python 3.13.5, Git 2.47.3, Docker CLI 26.1.5, Ansible core 2.22.0 and community.docker 5.0.4; the target reported Docker 29.8.1 and Compose 5.5.1 on x86\_64. The release Dockerfile pins \path{python:3.13-alpine@sha256:7984cf56ceaddebe4fefeb75d64000b9f45d8b77b11a09b24524da6cdc3af0c8}; exact dependencies, including Flask 3.1.3 and Gunicorn 23.0.0, are in the linked requirements file. The image runs as UID 10001; Compose drops capabilities and uses a read-only root filesystem with writable temporary storage.
The release gates run unit tests, \texttt{pip-audit}, repository secret scanning and Trivy HIGH/CRITICAL image scanning. A finding, scanner error, or unavailable database blocks release unless an instructor accepts a documented, time-limited exception; false positives and unfixed findings require explicit triage, not silent suppression. Scan results are time-specific and do not prove absence of vulnerabilities. A disposable private-key fixture blocked \href{https://ci.myfileagent.tech/job/assignment8-secret-gate-demo/4/console}{secret gate \#4}; the fixture was removed. A controlled test failure blocked \href{https://ci.myfileagent.tech/job/assignment8-test-gate-demo/1/console}{test gate \#1}. The corrected audit covers all nine locked packages; the earlier validation \#9 summary has an evidence-contamination limitation and is not used as release evidence.
\section{Release traceability and evidence}
Times below are UTC on 7 November 2026. The abbreviated identifiers identify the linked full commits; the full digests are recorded in the Jenkins artifacts and handoff. The same published digest was used for each release's staging and production deployment. Both staging reruns reported \texttt{changed=0}. Human approver Gowri Das Lovely approved each restricted Jenkins input; the agent did not approve it.
\begin{longtable}{L{1.4cm}L{3.8cm}L{3.4cm}L{5.4cm}}
\toprule Release & Source and config commit & Registry digest (SHA-256 prefix) & Verified pipeline and production approval \\ \midrule\endhead
v1 & \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/commit/0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2}{\texttt{0cb5a34}} & \texttt{715a3c80d5fff431} & \href{https://ci.myfileagent.tech/job/assignment8-release/3/}{Jenkins release \#3}; approval 22:44:27; finished 22:46:08; health OK, v1, quantity 3 total 30. \\
v2 & \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/commit/ee128d18bddd1763b916b40f05829f2e769f0654}{\texttt{ee128d1}} & \texttt{2ab86894ada4c12b} & \href{https://ci.myfileagent.tech/job/assignment8-release/4/}{Jenkins release \#4}; approval 23:03:50; finished 23:05:41; health OK, v2, quantity 3 total 36. \\ \bottomrule
\end{longtable}
Full immutable registry references (the source and configuration commits are linked above):\par
\path{myfileagent.tech/myfileagent/pricing@sha256:715a3c80d5fff4319e275583e73e58cd80bffadea6e25796dd4867135ff036c2}\par
\path{myfileagent.tech/myfileagent/pricing@sha256:2ab86894ada4c12bd066ae1d29be40a296b1a037f379c494dead5cad4d8b88f9}\par
Both release runs passed their tests, dependency and secret gates, syntax and image checks, and included authenticated publication and pull. See each archived report for scanner details and database time. \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/17}{PR \#17} covered its reviewed head; later fixes were independently reviewed and merged in \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/18}{PR \#18}. The health-timeout mitigation and v2 source were separately reviewed in \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/19}{PR \#19} and \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/20}{PR \#20}. Earlier release \#2 reached staging but failed the unchanged rerun after health-check timeouts; it did not reach production. The later successes do not establish a guaranteed fix under every load.
\section{Recovery exercises and monitoring}
\href{https://ci.myfileagent.tech/job/assignment8-rollback-v1/1/}{Rollback \#1} checked healthy production v2 and restored the matching reviewed v1 configuration and digest. Gowri approved at 23:12:50; Ansible began at 23:13:01 and verified v1 at 23:14:37. HTTP samples observed 502 from 23:13:49 through 23:13:55, a timeout at 23:13:57 and 200 at 23:14:01. Samples bound observations, not exact interruption duration. Independent HTTPS checks confirmed v1, the full v1 commit and total 30.
In staging only, configuration commit \texttt{c0cdd915} bound Gunicorn to 8001 while its image health check remained on 8000. \href{https://ci.myfileagent.tech/job/assignment8-staging-failure/1/}{Failure run \#1} stopped after Compose reported unhealthy at 23:21 on 7 November. A session interruption delayed recovery overnight. \href{https://ci.myfileagent.tech/job/assignment8-staging-recovery/1/}{Recovery run \#1} restored reviewed v2 configuration and digest starting 15:54:48 on 8 November; Ansible verified recovery at 15:56:45. Independent checks showed staging v2/36 and production v1/30. There was no continuous availability measurement for the whole staging interval.
On 8 November at 16:01:05, the production \url{https://app.myfileagent.tech/health} target was added to the existing HTTPS Blackbox job; Gitea, Jenkins and host metrics were retained. Prometheus accepted the configuration and reported all three HTTPS \texttt{probe\_success} values as 1 afterward. The provisioned Grafana dashboard displayed the production probe with latest value 1 when checked on 8 November. Since the production probe was added after the promotions and rollback, it cannot establish their historical availability or alert behavior. A 30-second scrape may miss a short interruption, and a status probe cannot validate price or source identity.
\section{Operations and grader access}
\textbf{Release:} review the exact source and configuration, input locks, security reports, staging behavior and immutable digest. Run the release job on reviewed main; verify health, identity and price, then the unchanged Ansible rerun. An authorized human reviews and approves the restricted Jenkins input before production. Promote the same digest and verify again; record the approver, times and artifacts.
\textbf{Failed staging deployment:} stop promotion, preserve logs and release metadata, inspect the health failure, restore the last reviewed configuration and corresponding image record, run Ansible and verify health, identity and price. The playbook does not automatically roll back.
\textbf{Production rollback:} an authorized human decides and approves a rollback; check the current release, restore the reviewed earlier image \emph{and} matching configuration, run Ansible, verify health, source and price, and record start, recovery and sampled interruption. A real database migration, external payment, or incompatible stored state may make image-only rollback unsafe. Prefer an expand-and-contract migration compatible with both versions; this stateless exercise did not test a database rollback.
\textbf{Cleanup:} after grading and only when retention permits, remove application projects, their Caddy routes, test DNS and dedicated credentials; retain earlier services, their volumes and required evidence. Do not prune Docker or use \texttt{compose down -v}. The single Droplet has shared CPU, memory and failure domain; earlier health-check timeouts illustrate that capacity matters.
Source, tests, Dockerfile, release intent, Ansible inventory, playbook and template are available in the \href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/src/branch/main/secure-delivery}{Gitea secure-delivery directory}. Jenkins links above contain run logs and redacted artifacts. The grader needs a team-provided authorized Gitea/Jenkins account and network access; request access from the team without sending credentials in the submission. This PDF records results so a live pipeline run is not needed to understand them.
+8 -7
View File
@@ -49,17 +49,17 @@
\definecolor{devopsLightBlue}{RGB}{232,240,247}
% Replace these values for each assignment.
\newcommand{\AssignmentTitle}{Introduction to SRE: Monitoring and Reliability}
\newcommand{\AssignmentNumber}{7}
\newcommand{\DocumentVersion}{1.9.0}
\newcommand{\DocumentStatus}{Source Draft -- Compilation Deferred}
\newcommand{\AssignmentTitle}{Secure Delivery and Rollback}
\newcommand{\AssignmentNumber}{8}
\newcommand{\DocumentVersion}{2.0.0}
\newcommand{\DocumentStatus}{Final Draft}
\newcommand{\CourseNumber}{SSW 590}
\newcommand{\CourseName}{DevOps Principles and Practices}
\newcommand{\Instructor}{Darian Muresan}
\newcommand{\StudentNames}{Nicholas Kogut\\Gowri Das Lovely}
\newcommand{\PDFAuthors}{Nicholas Kogut and Gowri Das Lovely}
\newcommand{\Organization}{Stevens Institute of Technology}
\newcommand{\DocumentDate}{October 28, 2026}
\newcommand{\DocumentDate}{November 8, 2026}
\newcommand{\DueDate}{Not specified}
% Generated only in the build workspace; never committed by the workflow.
\newcommand{\BuildSuffix}{+local.unverified}
@@ -73,8 +73,8 @@
pdftitle={\CourseNumber\ --- Assignment \AssignmentNumber: \AssignmentTitle},
pdfauthor={\PDFAuthors},
pdfcreator={Darian Muresan, Ph.D., with OpenAI Codex and Anthropic Claude Code},
pdfsubject={SSW 590 Assignment 7 SRE monitoring and reliability},
pdfkeywords={DevOps, SRE, Prometheus, Grafana, alerts, SLI, SLO, incident, Jenkins}
pdfsubject={SSW 590 Assignment 8 secure delivery and rollback},
pdfkeywords={DevOps, delivery, security, Ansible, Jenkins, rollback, monitoring}
}
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
@@ -158,6 +158,7 @@
\include{devopsAutomatedManualBuild}
\include{devopsJenkinsContinuousIntegration}
\include{devopsSREMonitoringReliability}
\include{devopsSecureDeliveryRollback}
\bibliographystyle{IEEEtran}
\bibliography{devopsReferences}
@@ -0,0 +1,69 @@
{
"id": null,
"uid": "assignment8-production-health",
"title": "Assignment 8 - Production Health",
"tags": [
"SSW590",
"Assignment 8"
],
"timezone": "America/New_York",
"schemaVersion": 39,
"version": 1,
"refresh": "30s",
"time": {
"from": "now-1h",
"to": "now"
},
"editable": true,
"panels": [
{
"id": 1,
"type": "timeseries",
"title": "Production HTTPS health",
"description": "Blackbox HTTP 2xx probe; 1 = healthy, 0 = failed. Missing data is not evidence of availability.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 0
},
"targets": [
{
"expr": "probe_success{job=\"https\",instance=\"https://app.myfileagent.tech/health\"}",
"refId": "A",
"legendFormat": "Production health"
}
],
"fieldConfig": {
"defaults": {
"min": 0,
"max": 1,
"unit": "short",
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"spanNulls": false
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": [
"lastNotNull"
]
},
"tooltip": {
"mode": "single"
}
}
}
]
}
+1
View File
@@ -19,6 +19,7 @@ scrape_configs:
- targets:
- https://myfileagent.tech/user/login
- https://ci.myfileagent.tech/login
- https://app.myfileagent.tech/health
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
+75
View File
@@ -0,0 +1,75 @@
# Assignment 8 handoff — 7 November 2026
## Current state — 8 November 2026
Production is verified v1/30 after the approved rollback; staging is verified v2/36 after the delayed recovery. Main was fetched at `ee128d18bddd1763b916b40f05829f2e769f0654`. The continuation entries below supersede earlier historical status and instructions, including claims that later commits remain unmerged or that no release exists.
Monitoring is live. The `assignment8/documentation` branch is published in [PR #21](https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/21) and contains the manual draft, monitoring configuration and exercise Jenkinsfiles; independent review and merge remain pending. On 8 November an authenticated Grafana view showed the production health graph with latest value 1. The compiled PDF remains a draft and must be rebuilt from the final reviewed source. Earlier pending-status notes below are historical. No new production deployment is authorized without a separate human approval.
## Continuation check, 7 November 2026
- A fresh read-only clone in `HW8/assignment8-repo` found `main` at `6ba31a3b44906b5c19faa7ccba601e69798b142a` and `assignment8/secure-delivery` at `35523ccd3cc1dd2419981b5f536bfd61341826c3`. The merge parents are `10c85ea655efbb66a48a6c6ea7e12f7beab6493b` and the approved `c1cd3ad9af12e11af7c08c398c5fc93649cfd556`; commits `88f3bb0` and `35523cc` are later branch-only work.
- Gitea showed no open pull requests at this check. The in-app browser was signed out of Gitea, and Jenkins presented its sign-in page. The updated security job, its exact revision, live target, and registry publication/pull remain unverified in this continuation. No deployment or production approval occurred.
- This continuation note is a local, uncommitted change. It is not evidence of a successful pipeline or a substitute for independent review of the later branch commits. Recheck remote refs before proceeding.
- Subsequent continuation: SSH alias `ssw590-codex` connected as `codex`; the Assignment 8 Droplet worktree was at `35523cc` with pre-existing untracked `.DS_Store` and `__pycache__` entries. Existing infrastructure containers and the trusted agent were running; no pricing containers were running. The private network gateway matched `172.20.0.1`. Jenkins validation job selected the Assignment 8 branch and `secure-delivery/Jenkinsfile.security`. Build [#10](https://ci.myfileagent.tech/job/assignment8-validation/10/console) succeeded for `35523ccd3cc1dd2419981b5f536bfd61341826c3`: three tests, dependency audit, secret scan, Ansible syntax, test image build and HIGH/CRITICAL image scan. Its archived dependency report lists all nine packages, including packaging, without known findings; its secret summary reports zero findings and exit 0. This test image is not a published release. [PR #18](https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/18) was opened for the two post-#17 commits. It requires an independent approval and required PR check; Gitea reported the branch out of date, and a branch update was requested. Recheck the actual head and repeat validation if the update changes it.
- Gitea's branch update created head `9e96c831975d9c781bc896c304bf2151b7f4e353`. The required PR check passed at last inspection, but independent approval was still missing. Jenkins [validation #11](https://ci.myfileagent.tech/job/assignment8-validation/11/console) succeeded on that exact head, including tests, dependency and secret scans, Ansible syntax, test image build and image scan. Its archived dependency report lists all nine pinned packages without known findings. This is validation of a test image, not a registry publication or deployment. Verify the latest PR head and approval before proceeding.
- PR #18 received approval from `glovely` and merged to `main` as `935eaa86248fb3eee26e0ae43efb7d11d520b956`. A new `assignment8-release` Jenkins job uses the reviewed release draft and pins that merge commit, with full checkout and concurrent builds disabled. [Release #1](https://ci.myfileagent.tech/job/assignment8-release/1/console) failed before checkout because lightweight checkout treated the commit as a branch. Full checkout fixed the configuration; [release #2](https://ci.myfileagent.tech/job/assignment8-release/2/console) checked out the pinned commit and is running. Verify final stages and artifacts; a human must approve the restricted production gate separately.
- Release #2 built and scanned v1, pushed and pulled `myfileagent.tech/myfileagent/pricing@sha256:276746521e74e0506a22179ca5d299cd83864cb9e0c90e68e433d34d517373f3` and deployed it to staging. At 22:24 UTC, Ansible's HTTPS checks passed for v1, commit `935eaa86248fb3eee26e0ae43efb7d11d520b956`, and quantity-three total 30; an independent HTTPS request returned the same values. The identical second run failed at Compose wait because the container was unhealthy, so production approval and deployment were skipped. Docker health logs showed repeated 3-second health-check timeouts, followed by successful checks and a return to healthy; the agent also briefly disconnected during the build. No idempotence success is claimed. A local, unreviewed change increases the image health-check and HTTP timeouts to 10 and 8 seconds respectively; it requires validation and independent review, and does not establish a guaranteed fix under load. Preserve the failed run and investigate resource pressure before retrying. No production deployment has occurred.
- [PR #19](https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/19) proposes the timeout mitigation on head `746b42b72bfdb9079404b77898c2a6a252eaeea1`. It is separate from local branch `assignment8/healthcheck-reliability` (which also contains this handoff update). The trusted validation agent has Docker host access; obtain independent review before executing changed build instructions there. The PR check was pending when last observed. After approval, validate the exact reviewed head, merge through protected main, pin the release job to the new reviewed merge commit, and re-run through staging; request production approval only after staging and idempotence pass. Do not treat the health timeout change as a proven fix without that evidence.
- PR #19 was approved by `glovely` and merged as `0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2`. [Release #3](https://ci.myfileagent.tech/job/assignment8-release/3/console) used that exact source/configuration commit, passed its tests and security gates, published and pulled `myfileagent.tech/myfileagent/pricing@sha256:715a3c80d5fff4319e275583e73e58cd80bffadea6e25796dd4867135ff036c2`, and deployed staging. HTTPS returned health ok, v1, that commit, and total 30 for quantity 3. The identical second Ansible run finished `ok=9 changed=0 unreachable=0 failed=0` at 22:39 UTC. The restricted production approval input is pending, with a 30-minute timeout; no approval or production deployment has yet occurred. A human must review the evidence and use the Jenkins gate, not ask the agent to approve it.
- Release #3 was approved in Jenkins by Gowri Das Lovely at 22:44:27 UTC on 7 November. Production deployment finished successfully at 22:46:08 UTC, and the pipeline finished SUCCESS. Independent HTTPS checks returned health ok, v1, commit `0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2`, and total 30 for quantity 3 in both staging and production. Both used the same published digest above. Preserve the release artifacts and matching configuration for rollback. The earlier pending-approval note is historical.
- Opened [PR #20](https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/20) for the v2 source, test expectations and release intent, based on the v1 merge. Head at creation: `4d7e4f932fe3c8d658dcbe8d16aef806184850f2`. The exact diff matches the supplied v2 preview (six additions and six deletions across three files). A local dependency installation did not complete, so no new v2 unit or security result is claimed. Obtain independent review before using the trusted agent, and verify the latest head and required PR checks. Then execute the reviewed release pipeline with its separate production approval.
- PR #20 was approved by `glovely` and merged as `ee128d18bddd1763b916b40f05829f2e769f0654`. [Release #4](https://ci.myfileagent.tech/job/assignment8-release/4/) passed v2 tests, dependency and secret scans, Ansible syntax and image scan; it published and pulled `myfileagent.tech/myfileagent/pricing@sha256:2ab86894ada4c12bd066ae1d29be40a296b1a037f379c494dead5cad4d8b88f9`. Staging passed health, exact commit, v2 and total 36, and the unchanged rerun reported `ok=9 changed=0 unreachable=0 failed=0` at 23:02 UTC. Independent HTTPS checks confirmed v2/36 in staging and v1/30 in production. The v2 production input is pending and expires about 23:32 UTC; only an authorized human may approve it. The earlier review/validation note is historical.
- Release #4 was approved by Gowri Das Lovely at 23:03:50 UTC and completed successfully at 23:05:41 UTC. Independent HTTPS checks confirmed health ok, v2, commit `ee128d18bddd1763b916b40f05829f2e769f0654`, and total 36 in both staging and production. The next exercise is production rollback to the v1 digest and matching configuration recorded in release #3. A proposed gated orchestration is saved locally in `HW8/rollback-v1.Jenkinsfile`; it has not been reviewed, installed, or executed. It performs preflight verification, obtains a restricted human approval, samples HTTPS availability, applies the reviewed v1 Ansible configuration, and archives results. Human review and a separate production approval are still required; no rollback has occurred.
- The user reviewed the local rollback proposal. It was installed as Jenkins `assignment8-rollback-v1` and its saved script SHA-256 was checked against the local file. [Rollback run #1](https://ci.myfileagent.tech/job/assignment8-rollback-v1/1/) verified production v2/36 and checked out the reviewed v1 configuration. It reached the restricted human input at 23:10 UTC on 7 November; the gate expires approximately 23:40 UTC. It has not yet changed production. The prior sentence describing the proposal as unreviewed and uninstalled is historical.
- Rollback #1 was approved by Gowri Das Lovely at 23:12:50 UTC and succeeded. Ansible began at 23:13:01 UTC and verified recovery at 23:14:37 UTC. Availability samples show HTTP 502 from 23:13:49 through 23:13:55, a timeout at 23:13:57, and HTTP 200 at 23:14:01; intermittent sampling bounds rather than precisely measures interruption. Independent HTTPS checks confirmed production health ok, v1, commit `0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2`, and total 30; staging remained v2 at `ee128d18bddd1763b916b40f05829f2e769f0654` and total 36. The pending-approval note above is historical.
- The staging-only failure commit `c0cdd9159b430b8a27543a293cdd23aa05c8ee34` conditionally bound Gunicorn to 8001 while the health check remained on 8000. [Failure run #1](https://ci.myfileagent.tech/job/assignment8-staging-failure/1/) checked out that commit; Compose reported the staging container unhealthy, Ansible failed, and the following pipeline stage was skipped at 23:21 UTC on 7 November. A session interruption delayed recovery until the next day; do not describe it as a brief outage or infer exact downtime without continuous measurements. [Recovery run #1](https://ci.myfileagent.tech/job/assignment8-staging-recovery/1/) checked out reviewed configuration `ee128d18bddd1763b916b40f05829f2e769f0654` and selected the v2 image/release record. Recovery began 15:54:48 UTC and Ansible verified it at 15:56:45 UTC on 8 November. Independent HTTPS checks confirmed staging health ok, v2, exact commit, and total 36; production remained v1/30. Local orchestration files are `HW8/staging-failure.Jenkinsfile` and `HW8/staging-recovery.Jenkinsfile`.
This is a continuation guide for the team and its Codex session. The assignment is **not complete**. The instructor source is `dosManual-V1.43.pdf`, Chapter 6, and the provided `Examples/dosSecureDelivery` starter. The deliverable is one updated team IT manual PDF plus accessible reviewed source and evidence.
## Read this first: branch and review state
- Repository: https://myfileagent.tech/myfileagent/myfileagent-pipeline
- PR [#17](https://myfileagent.tech/myfileagent/myfileagent-pipeline/pulls/17) was approved by `nkogut` for head `c1cd3ad9af12e11af7c08c398c5fc93649cfd556` and merged to `main` as `6ba31a3b44906b5c19faa7ccba601e69798b142a`. Check the **merge parents**, not the PR's moving head, when reconstructing what was reviewed.
- Commit `88f3bb0d0aeffe3fe122ea3f5f797817e8c5523f` was pushed to `assignment8/secure-delivery` **after** PR #17 merged. It is not in that merge or in main as of this handoff. It fixes dependency-audit coverage and evidence handling. This handoff and the accompanying v2 preview patch are additional branch changes. Open a new PR against main for these changes, run checks against its exact head, and obtain the required independent review; do not treat PR #17's approval as approval of later commits.
- On the Droplet, the v1 worktree is `/home/codex/myfileagent-gitea/assignment8-secure-delivery`. The local v2 preview worktree is `/home/codex/myfileagent-gitea/assignment8-v2-preview`, branch `assignment8/v2-preview`, commit `2147b21640a3a644e9ab156bca9e7b5a82af4011`. That preview has **not** been pushed or reviewed. `v2-preview.patch` alongside this file preserves that commit for a partner who only has Gitea access. Apply it to a new branch based on the final reviewed v1 state, inspect it, and test it; do not include it in the v1 release.
## Verified foundation
- Existing Gitea, Jenkins, Caddy, Prometheus, Grafana, Blackbox Exporter, and Node Exporter were running at the last check. Continue to preserve their configurations and data.
- Jenkins has a dedicated `assignment8-trusted` agent. Its image definition and validated Compose recreation template are in `agent/`. The running container was created separately and has not been recreated with that template. The Docker socket group is currently 987; verify before any recreation. Docker socket access and the `a8deploy` account's passwordless root sudo are effectively host-administrator access. Restrict use to reviewed code and authorized jobs. Agent SSH host key is pinned in `ansible/known_hosts`; inventory uses the private gateway `172.20.0.1`. The gateway can change if the network is recreated: verify before use.
- With explicit team approval, Jenkins stores `assignment8-deploy-ssh` as a **Global** credential for `a8deploy`. Jenkins build [#4](https://ci.myfileagent.tech/job/assignment8-validation/4/console) verified SSH and sudo. Jenkins credentials `assignment8-registry-write` and `assignment8-registry-read` are configured separately; never put secret values in Git, prompts, logs or the manual. The root Docker client authenticated with the read credential in [build #5](https://ci.myfileagent.tech/job/assignment8-validation/5/console). Docker warned the credential is stored unencrypted in `/root/.docker/config.json`; limit access and remove it after assessment. A successful login is not proof of an actual image push or pull.
- `staging.myfileagent.tech` and `app.myfileagent.tech` were configured in DNS and Caddy. Both returned valid TLS and HTTP 502 before application containers existed. Gitea, Jenkins and Grafana HTTPS returned 200 after the proxy reload. The saved previous proxy config is `/home/codex/myfileagent-gitea/Caddyfile.before-assignment8`.
- The v1 app is under `secure-delivery/v1`, with pinned direct/transitive requirements and a pinned Python Alpine base image. Three unit tests passed. A test image passed an isolated health/version/price check and a HIGH/CRITICAL image scan; it used a placeholder source identity and is not a release.
- The supplied v2 starter and the isolated v2 preview each passed three unit tests. No v2 release image exists yet.
## Evidence and limitations
- Jenkins validation [#8](https://ci.myfileagent.tech/job/assignment8-validation/8/console) passed for commit `65e4011`; validation [#9](https://ci.myfileagent.tech/job/assignment8-validation/9/console) passed for `c1cd3ad`, including tests, the then-current dependency audit, secret scan, Ansible syntax, image build and image scan. Gitea reported its own PR check successful for `c1cd3ad`.
- **Dependency audit correction:** the prior resolved pip-audit report listed eight of nine pinned packages and omitted `packaging`. A separate stricter audit using `--disable-pip --no-deps` listed all nine and found no known vulnerabilities on 7 November. Commit `88f3bb0` updates the pipelines to use that mode; it needs review and a complete Jenkins run on the final commit. Findings can change with the database.
- **Artifact caution:** during build #9, a separate direct test wrote `secret-scan-summary.json` into the shared workspace shortly before archiving. That summary is independent test output, not build #9 evidence. Its image scan report and build log are separate. Guard-test #6 also archived stale reports; do not use those as #6 evidence. Guard-test [#7](https://ci.myfileagent.tech/job/assignment8-validation/7/console) blocked the unmerged branch before publication and archived no files.
- A controlled unit-test failure in [test-gate build #1](https://ci.myfileagent.tech/job/assignment8-test-gate-demo/1/console) skipped the following demonstration delivery stage. The test was restored and all three tests passed afterward. A disposable key triggered the secret scanner and blocked [secret-gate build #4](https://ci.myfileagent.tech/job/assignment8-secret-gate-demo/4/console); the fixture was removed. The updated redacted summary was also tested directly with clean input and a disposable-key fixture, but not yet in a full updated pipeline.
- Detailed chronological notes are in `WORK_LOG.md`. Raw scan and exercise evidence is under `/home/codex/myfileagent-gitea/evidence/assignment8` on the Droplet; examine and redact before copying anything into the repository or manual. Do not publish real keys or tokens.
## Continue in this order
1. Fetch `main` and the latest `assignment8/secure-delivery` branch. Review the delta after the PR #17 merge, especially `88f3bb0`, `Jenkinsfile.release.draft`, `Jenkinsfile.security`, `scan-secrets.sh`, the agent configuration and this handoff. Open a new PR for the unmerged fixes; run the updated security pipeline on its exact head and obtain the required independent review. Preserve branch protection.
2. The release pipeline is a **draft**, not an end-to-end verified production pipeline. Review its Groovy, credentials, source/config identity, report capture, restricted `ssw590` approval, idempotence check, registry digest selection and target pull. The source guard intentionally blocks a branch head not already in protected main. Groovy parsing and that guard were tested; later release stages have not been exercised. Configure the release job to use the reviewed main revision only after the changes are approved and merged.
3. Recheck Gitea organization package-write permission for `glovely` and read access for the target with an actual release push and authenticated pull. The registry login worked, the token reported `write:package`, and read-only database inspection showed `glovely` on the organization Owners team; publication itself has not been proven. Build once from the reviewed commit, scan the actual image, publish it, and record the immutable registry digest. Do not substitute a local image ID.
4. Deploy v1 to staging using Ansible and its release record. Verify HTTPS health, version, full baked source commit, and quantity-3 total 30. Repeat the unchanged playbook and capture `changed=0`. After a real restricted human Jenkins approval, promote the **same digest** to production and verify the same behavior. Record actual approver, times, build, source/config commits, scans, URLs and image digest. Never approve the human gate on the user's behalf.
5. After v1 is verified and preserved, create a separately reviewed v2 commit using the preview patch as reference, update `release-intent.json` to v2/36, and run the complete build, scan, staging, approval and production flow. Retain the v1 image and matching configuration.
6. Perform both required exercises: (a) roll healthy production v2 back to v1 image **and matching configuration**, verify v1/30 and measure interruption; (b) staging only, use the instructor's Gunicorn 8001 mismatch while the image healthcheck remains on 8000, show the Jenkins failure, restore the previous reviewed config and verify recovery. Preserve timestamps and evidence; do not stop shared services, delete volumes or claim zero downtime.
7. Add the production health probe to the existing Blackbox/Grafana monitoring, retain the earlier probes and metrics, and correlate actual observations with release and rollback times. Complete the release, failure, rollback and cleanup runbooks; describe single-Droplet and stateful-migration limitations.
8. Update the existing team IT manual (Assignment 7 v1.9.2 baseline) with a chapter titled **Secure Delivery and Rollback**, actual architecture, versions, traceability table, redacted evidence, runbooks, history and AI log. Build and visually verify one final PDF and include grader access instructions. Do not claim work that was not performed.
## Access and handling
The user has repeatedly run `/home/codex/myfileagent-gitea/push-assignment8-private.py` as `codex` to authenticate feature-branch pushes. Do not ask them to paste credentials into chat. Jenkins' existing `assignment8-validation` job should point to `secure-delivery/Jenkinsfile.security`; it was temporarily changed for SSH and guard checks and then restored. Recheck its configuration and exact job revision before relying on a result. Existing users must make the required review and production approval decisions themselves.
## Monitoring continuation, 8 November 2026
- At 16:01:05 UTC the live Assignment 7 Prometheus configuration was extended with `https://app.myfileagent.tech/health` in the existing `https` Blackbox job. The pre-change file is `/home/codex/myfileagent-gitea/assignment7-monitoring/monitoring/prometheus/prometheus.yml.before-assignment8`; Gitea and Jenkins probes were retained. `promtool check config` passed, and Prometheus logged a successful SIGHUP reload without container recreation. The first application command returned a shell error after reload due to a CRLF line ending; the reload and targets were subsequently checked independently.
- A separate provisioned dashboard, `assignment8-production-health.json`, was added under the existing Grafana provisioning dashboard directory. Local source is `HW8/production-health-dashboard.json`. Its UI provisioning and rendering have not yet been independently verified. Existing dashboard was not modified. The monitoring changes are live-only and not yet committed to Gitea; preserve and version them as part of remaining work.
- Prometheus target API reported the production, Gitea and Jenkins HTTPS probes and exporters up. An instant `probe_success` query returned 1 for all three on 8 November after the reload. The app probe did not exist during the 7 November promotions and rollback, so it cannot prove availability at those times. The rollback's separate HTTP samples are the only stated interval evidence.
- Remaining: verify Grafana dashboard; incorporate monitoring configuration and documentation into a reviewed source branch; finish the existing team IT manual with traceability, evidence, runbooks, grader access, history and AI log; build and visually verify the PDF. Preserve the local uncommitted handoff changes when updating from latest main. No additional production deployment is authorized without a new human approval.
- The manual draft `documentation/devopsSecureDeliveryRollback.tex` was compiled using the existing `manual-tex:1.7.1` image without network; the 131-page local draft is `HW8/output/pdf/SSW590-Assignment8-draft.pdf`. The new chapter pages were rendered and reviewed; an overlapping architecture label was corrected and rebuilt. It is not the reviewed final submission. The dashboard file is visible inside Grafana but an authenticated browser session is needed to verify rendering. Grafana v13's legacy `dashboard` table was empty even for the existing dashboard, so that query does not prove a provisioning failure.
@@ -0,0 +1,19 @@
pipeline {
agent { label 'assignment8-trusted' }
options { skipDefaultCheckout(); timeout(time: 5, unit: 'MINUTES') }
stages {
stage('Checkout') { steps { checkout scm } }
stage('Authenticate target registry reader') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY', usernameVariable: 'DEPLOY_USER'), usernamePassword(credentialsId: 'assignment8-registry-read', usernameVariable: 'REG_USER', passwordVariable: 'REG_TOKEN')]) {
sh '''#!/bin/sh
set +x
set -eu
case "$REG_USER" in *[!a-zA-Z0-9_.-]*|'') echo 'Invalid registry username' >&2; exit 1;; esac
printf '%s' "$REG_TOKEN" | ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WORKSPACE/secure-delivery/ansible/known_hosts" -i "$DEPLOY_KEY" "$DEPLOY_USER@172.20.0.1" "sudo -n docker login myfileagent.tech --username $REG_USER --password-stdin"
'''
}
}
}
}
}
+119
View File
@@ -0,0 +1,119 @@
pipeline {
agent { label 'assignment8-trusted' }
options { disableConcurrentBuilds(); skipDefaultCheckout(); timeout(time: 45, unit: 'MINUTES'); timestamps() }
environment { IMAGE_REPO = 'myfileagent.tech/myfileagent/pricing' }
stages {
stage('Checkout reviewed source') {
steps {
deleteDir()
checkout scm
sh '''set -eu
# Only source already present in protected main can be released.
git fetch origin main
git merge-base --is-ancestor HEAD origin/main
mkdir -p reports releases/generated
'''
script {
env.SOURCE_COMMIT = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
env.RELEASE_VERSION = sh(script: "python3 -c 'import json; print(json.load(open(\"secure-delivery/release-intent.json\"))[\"version\"])'", returnStdout: true).trim()
if (!(env.RELEASE_VERSION in ['v1', 'v2'])) { error('Unknown release version') }
env.EXPECTED_TOTAL = env.RELEASE_VERSION == 'v1' ? '30' : '36'
def configured = sh(script: "python3 -c 'import json; print(json.load(open(\"secure-delivery/release-intent.json\"))[\"quantity3_total\"])'", returnStdout: true).trim()
if (configured != env.EXPECTED_TOTAL) { error('Release intent total does not match the version') }
}
}
}
stage('Tests and dependency audit') {
steps { dir('secure-delivery/v1') { sh '''set -eu
python3 -m venv .test-venv
.test-venv/bin/pip install -r requirements.txt pip-audit==2.10.1
.test-venv/bin/python -m unittest -v
.test-venv/bin/pip-audit --disable-pip --no-deps -r requirements.txt -f json -o "$WORKSPACE/reports/dependency-audit.json"
''' } }
}
stage('Repository secret scan') { steps { sh 'sh secure-delivery/scan-secrets.sh' } }
stage('Ansible syntax') { steps { dir('secure-delivery') { sh 'ansible-playbook -i ansible/inventory.ini ansible/deploy.yml --syntax-check' } } }
stage('Build once') { steps { sh 'docker build --build-arg APP_COMMIT="$SOURCE_COMMIT" -t "$IMAGE_REPO:$SOURCE_COMMIT" secure-delivery/v1' } }
stage('Image security scan') {
steps { sh '''set -eu
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /home/codex/myfileagent-gitea/evidence/assignment8/trivy-cache:/root/.cache/ aquasec/trivy@sha256:1c78ed1ef824ab8bb05b04359d186e4c1229d0b3e67005faacb54a7d71974f73 image --quiet --scanners vuln --severity HIGH,CRITICAL --exit-code 1 --format json "$IMAGE_REPO:$SOURCE_COMMIT" > reports/image-scan.json
''' }
}
stage('Publish immutable image') {
steps {
withCredentials([usernamePassword(credentialsId: 'assignment8-registry-write', usernameVariable: 'REG_USER', passwordVariable: 'REG_TOKEN')]) {
sh '''#!/bin/sh
set +x
set -eu
export DOCKER_CONFIG=$(mktemp -d)
trap 'rm -rf "$DOCKER_CONFIG"' EXIT
printf '%s' "$REG_TOKEN" | docker login myfileagent.tech --username "$REG_USER" --password-stdin
docker push "$IMAGE_REPO:$SOURCE_COMMIT"
docker pull "$IMAGE_REPO:$SOURCE_COMMIT"
docker image inspect "$IMAGE_REPO:$SOURCE_COMMIT" --format '{{index .RepoDigests 0}}' > reports/image-digest.txt
'''
}
script {
env.RELEASE_IMAGE = readFile('reports/image-digest.txt').trim()
if (!(env.RELEASE_IMAGE ==~ /myfileagent\.tech\/myfileagent\/pricing@sha256:[0-9a-f]{64}/)) { error('Registry digest is missing or unexpected') }
}
}
}
stage('Pull published digest on target') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY', usernameVariable: 'DEPLOY_USER')]) {
sh '''#!/bin/sh
set +x
set -eu
ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WORKSPACE/secure-delivery/ansible/known_hosts" -i "$DEPLOY_KEY" "$DEPLOY_USER@172.20.0.1" sudo -n docker pull "$RELEASE_IMAGE" > reports/target-pull.txt
cat reports/target-pull.txt
'''
}
}
}
stage('Deploy staging') {
steps {
script { writeFile file: "releases/generated/${env.RELEASE_VERSION}-staging.yml", text: "target_env: staging\nrelease_image: ${env.RELEASE_IMAGE}\nexpected_version: ${env.RELEASE_VERSION}\nexpected_commit: ${env.SOURCE_COMMIT}\nconfiguration_commit: ${env.SOURCE_COMMIT}\nbuild_url: ${env.BUILD_URL}\nexpected_total: ${env.EXPECTED_TOTAL}\npublic_url: https://staging.myfileagent.tech\nproxy_network: myfileagent-gitea_gitea-private\n" }
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''set +x
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @releases/generated/$RELEASE_VERSION-staging.yml
'''
}
}
}
stage('Confirm staging idempotence') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''set +x
set -eu
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @releases/generated/$RELEASE_VERSION-staging.yml > reports/staging-second-run.txt
cat reports/staging-second-run.txt
grep -Eq 'startup[[:space:]]*:.*changed=0[[:space:]]+unreachable=0[[:space:]]+failed=0' reports/staging-second-run.txt
'''
}
}
}
stage('Production approval') {
steps {
script {
def approver = timeout(time: 30, unit: 'MINUTES') { input message: "Source/configuration: ${env.SOURCE_COMMIT}\nImage: ${env.RELEASE_IMAGE}\nSecurity gates: passed\nStaging checks and unchanged rerun: passed\nEvidence: ${env.BUILD_URL}\nApprove production promotion?", ok: 'Promote', submitter: 'ssw590', submitterParameter: 'APPROVER' }
writeFile file: 'reports/approval.txt', text: "Approver: ${approver}\nDecision: approved\nTime (UTC): ${sh(script: 'date -u +%FT%TZ', returnStdout: true).trim()}\nBuild: ${env.BUILD_URL}\nSource and configuration commit: ${env.SOURCE_COMMIT}\nImage: ${env.RELEASE_IMAGE}\nVersion: ${env.RELEASE_VERSION}\nExpected total for 3: ${env.EXPECTED_TOTAL}\nStaging and scans: passed\n"
}
}
}
stage('Deploy production') {
steps {
script { writeFile file: "releases/generated/${env.RELEASE_VERSION}-production.yml", text: "target_env: production\nrelease_image: ${env.RELEASE_IMAGE}\nexpected_version: ${env.RELEASE_VERSION}\nexpected_commit: ${env.SOURCE_COMMIT}\nconfiguration_commit: ${env.SOURCE_COMMIT}\nbuild_url: ${env.BUILD_URL}\nexpected_total: ${env.EXPECTED_TOTAL}\npublic_url: https://app.myfileagent.tech\nproxy_network: myfileagent-gitea_gitea-private\n" }
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''set +x
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @releases/generated/$RELEASE_VERSION-production.yml
'''
}
}
}
}
post { always { archiveArtifacts artifacts: 'reports/*,releases/generated/*', allowEmptyArchive: true } }
}
+25
View File
@@ -0,0 +1,25 @@
pipeline {
agent { label 'assignment8-trusted' }
options { disableConcurrentBuilds(); timeout(time: 20, unit: 'MINUTES'); timestamps(); skipDefaultCheckout() }
stages {
stage('Checkout') { steps { deleteDir(); checkout scm; sh 'mkdir -p reports' } }
stage('Unit tests and dependency audit') {
steps { dir('secure-delivery/v1') { sh '''set -eu
python3 -m venv .test-venv
.test-venv/bin/pip install -r requirements.txt pip-audit==2.10.1
.test-venv/bin/python -m unittest -v
.test-venv/bin/pip-audit --disable-pip --no-deps -r requirements.txt -f json -o "$WORKSPACE/reports/dependency-audit.json"
''' } }
}
stage('Secret scan') { steps { sh 'sh secure-delivery/scan-secrets.sh' } }
stage('Ansible syntax') { steps { dir('secure-delivery') { sh 'ansible-playbook -i ansible/inventory.ini ansible/deploy.yml --syntax-check' } } }
stage('Build test image') { steps { sh 'docker build --build-arg APP_COMMIT=$(git rev-parse HEAD) -t assignment8-pricing:security-check secure-delivery/v1' } }
stage('Image vulnerability scan') {
steps { sh '''set -eu
mkdir -p reports
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /home/codex/myfileagent-gitea/evidence/assignment8/trivy-cache:/root/.cache/ aquasec/trivy@sha256:1c78ed1ef824ab8bb05b04359d186e4c1229d0b3e67005faacb54a7d71974f73 image --quiet --scanners vuln --severity HIGH,CRITICAL --exit-code 1 --format json assignment8-pricing:security-check > reports/image-scan.json
''' }
}
}
post { always { archiveArtifacts artifacts: 'reports/*.json', allowEmptyArchive: true } }
}
+17
View File
@@ -0,0 +1,17 @@
pipeline {
agent { label 'assignment8-trusted' }
options { timeout(time: 5, unit: 'MINUTES'); skipDefaultCheckout() }
stages {
stage('Checkout') { steps { checkout scm } }
stage('Verify deployment connection') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY', usernameVariable: 'DEPLOY_USER')]) {
sh '''set +x
set -eu
ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WORKSPACE/secure-delivery/ansible/known_hosts" -i "$DEPLOY_KEY" "$DEPLOY_USER@172.20.0.1" 'id; sudo -n id'
'''
}
}
}
}
}
@@ -0,0 +1,26 @@
pipeline {
agent { label 'assignment8-trusted' }
options { timeout(time: 10, unit: 'MINUTES') }
stages {
stage('Checkout v1') {
steps { git branch: 'assignment8/secure-delivery', url: 'https://myfileagent.tech/myfileagent/myfileagent-pipeline.git' }
}
stage('Controlled failing test') {
steps {
dir('secure-delivery/v1') {
sh '''#!/bin/sh
set -eu
python3 -m venv .test-venv
.test-venv/bin/pip install -r requirements.txt
trap 'git checkout -- test_app.py' EXIT
python3 -c 'from pathlib import Path; p=Path("test_app.py"); s=p.read_text(); old="self.assertEqual(total_price(3), 30)"; assert old in s; p.write_text(s.replace(old,"self.assertEqual(total_price(3), 31)",1))'
.test-venv/bin/python -m unittest -v
'''
}
}
}
stage('Delivery would proceed') {
steps { echo 'This stage must be skipped when tests fail.' }
}
}
}
+22
View File
@@ -0,0 +1,22 @@
pipeline {
agent { label 'assignment8-trusted' }
options { disableConcurrentBuilds(); timeout(time: 15, unit: 'MINUTES'); timestamps() }
stages {
stage('Checkout') { steps { checkout scm } }
stage('Unit tests') {
steps {
dir('secure-delivery/v1') {
sh '''set -eu
python3 -m venv .test-venv
.test-venv/bin/pip install -r requirements.txt
.test-venv/bin/python -m py_compile app.py test_app.py
.test-venv/bin/python -m unittest -v
'''
}
}
}
stage('Ansible syntax') {
steps { dir('secure-delivery') { sh 'ansible-playbook -i ansible/inventory.ini ansible/deploy.yml --syntax-check' } }
}
}
}
+18
View File
@@ -0,0 +1,18 @@
# Secure delivery operations (draft)
These procedures must be updated with verified hostnames, release records, commit links and actual roles before use. Never put passwords, tokens or private keys in release records or logs.
## Release
1. Review source and configuration changes. Record source commit, configuration commit, base digest, locked dependencies, scan reports, build ID, resulting image digest and expected behavior.
2. Deploy that digest to staging with the reviewed Ansible configuration. Verify HTTPS health, version, full source commit and price for quantity three. Run the same playbook again and investigate any unexpected changes.
3. An authorized person reviews the digest, scan and staging results in Jenkins. Record their identity and decision. If rejected or timed out, stop.
4. Promote the same digest to production using its matching release record and verify the same checks. Record times and monitoring observations.
## Failed staging deployment
Stop promotion. Preserve the failed build and checks. Restore the last reviewed template/configuration commit and its matching release record, rerun Ansible and verify HTTPS health, identity and business result. The playbook does not roll back automatically. Avoid changing shared Docker, proxy or monitoring services.
## Production rollback
Record decision and start time. Restore the reviewed v1 deployment configuration and v1 production release record, then run Ansible. Verify health, v1 identity, original source commit and total 30. Record recovery time and observed interruption. This stateless demonstration does not prove a real database migration can be rolled back; use an expand-and-contract compatible migration for stateful services.
## Cleanup after grading
Only when assessment and retention requirements permit, remove the two application projects, their routes, test DNS records and dedicated credentials. Preserve shared volumes, infrastructure and required evidence. Do not use compose down -v or system pruning.
+129
View File
@@ -0,0 +1,129 @@
# Chapter 6: Startup Pricing Service
`v1/` and `v2/` are two releases of the same stateless Flask service. Version 1
charges USD 10 per unit; version 2 charges USD 12. Three units cost 30 and 36.
Both use Gunicorn, run as a non-root container user, and expose port 8000.
No database, real customer data, payment processing, or credentials are involved.
## Local checks
Run from either version directory, using a disposable virtual environment:
```sh
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
python -m unittest -v
```
Requirements are compatibility ranges, not a reproducible lock. Before the
assessed release, resolve, review, scan, and commit exact dependency versions
(including transitive dependencies) and an approved base-image digest. Save
scanner versions and reports. These starter files make no vulnerability claim.
## Build and publish
Copy v1 into the team application's working directory and commit it. Build from
that directory on the trusted Jenkins agent. Use the Gitea registry hostname
without a URL scheme; replace the owner/team with its actual lowercase name.
```sh
COMMIT=$(git rev-parse HEAD)
IMAGE=gitea.example.edu/team/pricing
# Authenticate separately using a Jenkins credential and --password-stdin.
docker build --build-arg APP_COMMIT="$COMMIT" -t "$IMAGE:$COMMIT" .
docker push "$IMAGE:$COMMIT"
docker pull "$IMAGE:$COMMIT"
docker image inspect "$IMAGE:$COMMIT" --format '{{index .RepoDigests 0}}'
```
Save that repository digest in a release record. Build once; use the same digest
in staging and production. For v2, replace app.py and test_app.py with the v2
files, commit, and repeat the pipeline. Do not build the entire parent directory.
Use a Linux image architecture compatible with the droplet.
## One-time deployment preparation
Install Ansible in a virtual environment on a trusted Linux Jenkins agent; use a
Python version supported by your selected ansible-core release. Record exact
resolved versions after installation.
```sh
python3 -m venv .ansible-venv
. .ansible-venv/bin/activate
pip install ansible-core
ansible-galaxy collection install -r ansible/requirements.yml
ansible --version
ansible-galaxy collection list
```
On the target droplet, install Python 3, Docker Engine and the Compose v2 plugin
(at least 2.18); verify `docker compose version`. Configure a dedicated SSH
account and the approved escalation policy. The playbook uses become and needs
noninteractive sudo; this is powerful host access. Do not grant it to untrusted
pull-request jobs. Verify/pin the SSH host key in the Jenkins agent's known_hosts.
Keep private keys, sudo credentials and package tokens in Jenkins credentials.
Identify the existing reverse proxy's Docker network with `docker network ls`
and its current Compose configuration. Both app projects join that external
network. Configure the proxy once, preserving all existing routes:
```caddyfile
staging.example.edu {
reverse_proxy pricing-staging:8000
}
app.example.edu {
reverse_proxy pricing-production:8000
}
```
Use your real DNS names pointing to the droplet and valid TLS certificates.
The proxy must be attached to that network. For a host-based proxy, adapt the
Compose template to distinct loopback ports and proxy to those ports instead.
The supplied template is for a container-based proxy; do not publish raw 8000.
Authenticate Docker on the target as the account used by become (normally root)
using a read-only package credential and `docker login --password-stdin` through
a protected administrator session. The Jenkins build agent separately needs a
package-write credential. Never commit either credential or Docker config.json.
Do not enable insecure registry access or disable certificate verification.
## Deploy and roll back
Fill inventory.ini and copy release.example.yml to releases/v1-staging.yml.
Replace every placeholder. Keep this release metadata in Git; it has no secrets.
Use the exact source commit, registry digest, proxy network, URL and expected
values. From this starter directory:
```sh
ansible-playbook -i ansible/inventory.ini ansible/deploy.yml --syntax-check
ansible-playbook -i ansible/inventory.ini ansible/deploy.yml -e @releases/v1-staging.yml
```
Run again unchanged and show changed=0. If the module reports unexpected
changes, inspect Compose/plugin versions and the task diff before claiming
idempotence. Create a production record with the same image digest and the
production target and URL; deploy only after an authorized Jenkins approval.
Disable concurrent delivery builds to prevent competing releases.
Preserve each release's Compose template/configuration commit as well as its
image digest. For rollback, check out the previous reviewed deployment files
and run its production release record again. The current playbook does not
perform an automatic rollback: a failed check fails the run and requires the
explicit rollback stage/runbook. Never use `down -v`, prune shared volumes, or
roll back Gitea/Jenkins as part of the application exercise.
For a controlled failure, use staging only: temporarily set the service's
Compose `command` to `["gunicorn", "--bind", "0.0.0.0:8001", "app:app"]` in a
separate configuration commit. The image healthcheck still probes 8000, so
Compose wait should fail. Save the failure, restore the previous configuration
commit, and redeploy its release record. Do not stop the host Docker service.
For the business rollback, deploy healthy v2, verify version v2 and total 36,
then redeploy v1 and verify version v1 and total 30. Measure interruption and
recovery time. This recreate strategy does not provide zero downtime.
Implement the Jenkins stages, security policy, approval and evidence described
in Chapter 6; the examples are application/deployment starters, not a complete
Jenkins pipeline. Container builds and remote deployment were not executed by
the author in a student environment.
+7
View File
@@ -0,0 +1,7 @@
# Assignment 8 release security policy
The trusted release job must run only reviewed source and must not expose deployment or registry credentials to pull-request builds. Restrict the agent to labeled release jobs and authorized Jenkins users. Docker daemon access confers host-administrator privileges. Record agent identity, access scope, tool versions, scan time, database version, exit status, and archived reports for each release.
Before publication, fail on discovered secrets and on HIGH or CRITICAL vulnerabilities unless a documented time-limited exception is accepted by the instructor. Fail closed if a scanner fails or its database is unavailable. Investigate false positives and unfixed findings; document owner, reason, expiry, and approval for any exception. Never publish a deliberately vulnerable image as the working release.
Run a dependency audit against the exact locked requirements, a repository secret scan, and an image vulnerability scan against the built release image. Demonstrate a blocked gate with a scanner-supported synthetic fixture and remove it before release. The initial pip-audit result in WORK_LOG.md is a baseline, not the final release scan.
+98
View File
@@ -0,0 +1,98 @@
# Assignment 8 work log
## 2026-11-04 baseline
- Starting repository main: 10c85ea (Assignment 7 manual 1.9.2 merge). Working branch: assignment8/secure-delivery.
- Existing Gitea, Jenkins, Caddy, and four monitoring containers observed running. Docker 29.8.1; Compose 5.5.1; architecture x86_64.
- Jenkins controller is containerized; no dedicated agent found in initial inspection. Ansible core 2.22.0 and community.docker 5.0.4 installed under persistent Jenkins home. Python venv system package installed in running container; container recreation provisioning still needed. Controller must not be used for assessed deployment.
- Starter v1 unit tests: 3 passed locally and inside isolated Jenkins Python 3.13 environment. Exact direct/transitive versions recorded in requirements.txt.
- pip-audit against pinned requirements reported no known vulnerabilities at time of check. This does not establish image or secret scan status; retain a formal report in pipeline.
- Python 3.13 slim base digest pinned to sha256:ae14d4ce8771606477a81446e7ef429edd6762305fc50c84507c1041fa8285d1 (linux/amd64). Local baseline image built with APP_COMMIT=baseline-test; this is not an assessed release or registry digest.
- Droplet baseline: 961 MiB RAM, 270 MiB available and 840 MiB swap used at inspection. Recheck before adding services.
- No staging/production deployment, approval, image publication, controlled failure, or rollback has been performed.
## Agent setup
- Created Jenkins permanent node assignment8-trusted with one executor and label-only scheduling. An official inbound-agent container connects through the existing private Docker network using WebSocket and a protected secret file. Agent logs reported Connected. No Docker socket or deployment credentials were granted.
- Built a draft agent Dockerfile with Python, Docker and Ansible, but image packaging stalled while the host reported all 1 GiB swap in use; the build was interrupted to avoid overloading existing services. The Dockerfile is not yet validated: the Docker collection was installed under root and must be moved to a location readable by the Jenkins user. The running agent remains the original image and does not yet have Python, Docker or Ansible. No agent job has been verified.
## Agent progress after swap increase
- Total swap verified at 2 GiB. Agent image built and connected; Python 3.13.5, Ansible core 2.22.0 and community.docker 5.0.4 verified as Jenkins user. Docker CLI 26.1.5 installed in running container; Dockerfile corrected to include docker-cli but requires rebuilding and recreation to persist that change. No Docker socket or deployment credentials have been added. A Jenkins job has not yet been run on the agent.
- Corrected agent image built as assignment8-jenkins-agent:2 and agent reconnected on 2026-11-04. Python 3.13.5 and Docker CLI 26.1.5 observed in recreated container. Ansible and community.docker were verified in previous image with identical installation steps; recheck after recreation. No Docker socket, deployment credential, or Jenkins test job yet.
## Agent Jenkins verification
- Jenkins job assignment8-agent-check build #1 failed during pipeline parsing because the initial one-line declarative script lacked section separators; no agent work occurred. Corrected script and reran. Build #2 succeeded on assignment8-trusted and verified Python 3.13.5, Git 2.47.3, Docker CLI 26.1.5, Ansible core 2.22.0, and community.docker 5.0.4. Evidence: https://ci.myfileagent.tech/job/assignment8-agent-check/2/console . Docker daemon access and deployment credentials remain unconfigured.
## Validation preparation
- Ansible syntax check passed on assignment8-trusted against the starter playbook on 2026-11-04. The inventory and release records still contain placeholders; syntax success is not deployment. Added a separate draft validation Jenkinsfile for tests and syntax checks; it has not been run in Jenkins.
## Gitea-backed validation
- Published branch assignment8/secure-delivery at 242372e381ecbcab4078e7d8c0916073d600d970. Jenkins assignment8-validation build #1 checked out that commit on assignment8-trusted, passed all 3 v1 unit tests and passed Ansible syntax check. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/1/console . This does not demonstrate deployment, security gates, or image publication.
## Initial image security checks
- User approved host Docker daemon access for the label-restricted trusted agent; its connection was verified. This access is effectively host administration. Agent-built test image succeeded with placeholder identity, not a release.
- Trivy 0.69.1 scan of the Debian slim test image failed the HIGH/CRITICAL gate: 45 Debian and 5 Python findings. A pinned Python Alpine candidate had no OS findings but 5 Python tooling findings. After removing pip and ensurepip bundled wheels from runtime, the candidate scan reported zero HIGH/CRITICAL findings, exit 0, at the time of scan. Reports are in server evidence/assignment8; rescan the actual release image and archive results.
- Isolated candidate smoke test initially ran before startup and got connection refused; after allowing startup, health was ok, v1 identity returned development placeholder, and quantity 3 returned 30. No production deployment occurred.
- Trivy 0.69.1 secret scanner standalone test: an example-format fixture was ignored (exit 0), then a newly generated disposable private-key fixture produced one finding and exit 1. Both fixture files were removed. This proves scanner behavior only; a blocked Jenkins pipeline run remains required.
## Jenkins synthetic secret gate
- Jenkins assignment8-secret-gate-demo #4 detected one generated disposable private key and failed with scanner exit 1; the job removed the fixture. Earlier attempts #1-3 failed due to transfer or job-script errors, not secret detections. Evidence: https://ci.myfileagent.tech/job/assignment8-secret-gate-demo/4/console . Prepared source-controlled security pipeline; it has not yet been run.
## Jenkins security validation build #2
- Jenkins assignment8-validation #2 checked out commit 28d13ef5b8757645bee640ca1dd9a8eea417ce18 on assignment8-trusted. Three unit tests, pip-audit, v1 application-source secret scan, Ansible syntax, image build and HIGH/CRITICAL image scan all passed; image JSON report was archived. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/2/console . Agent briefly disconnected and reconnected during syntax check; build completed successfully. This was a test image, not a registry-published or deployed release. Secret scan currently covers v1 source, not the entire repository.
- Added .test-venv to Docker ignore after observing a 47 MB test environment in the build context; this change has not yet run in Jenkins.
- At inspection, staging.myfileagent.tech and app.myfileagent.tech did not resolve via the Droplet resolver. Existing Caddy routes serve Gitea, Jenkins and Grafana; no pricing routes added yet.
- Expanded secret scan to the checked-out repository (excluding Git metadata, disposable test environment and generated reports); direct agent test returned zero findings and exit 0. This change still requires a Jenkins run after publication.
## Jenkins validation #3 and deployment preparation
- Jenkins assignment8-validation #3 succeeded for commit dd7c12c519b14f59d9842ebd6d417e7117d92e94, including tests, dependency audit, expanded repository secret scan, Ansible syntax, image build and HIGH/CRITICAL image scan; report archived. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/3/console . Build context was 7.68 kB after excluding test venv.
- Verified agent-to-host private SSH gateway 172.20.0.1 matches the host ED25519 fingerprint SHA256:CXrEv4+pv1jTwBtwxdTGlouS6I4H1Q6TkKbvQrbacu0. Prepared inventory and verified public known_hosts entry; dedicated account and Jenkins SSH credential are not yet configured. Prepared private deployment key and a reviewable administrator setup script, not yet executed. Gitea registry endpoint returns 401 as expected for authentication; registry push/pull has not been verified.
## Deployment access and DNS verification
- On 2026-11-04, a8deploy account existed. Both staging.myfileagent.tech and app.myfileagent.tech resolved to 142.93.193.110 via Droplet resolver. From assignment8-trusted, SSH using the dedicated private key and pinned host key returned uid 1001; sudo -n id returned root. The test key was removed from the agent after verification. Passwordless sudo grants host-administrator access. No Jenkins SSH credential configured yet.
- Prepared Caddy route and v1 release-record templates; neither route nor application deployment has been applied. Registry endpoint requires authentication; no registry package-write or package-read credential has been verified.
## Jenkins deployment credential
- With explicit team approval for Global scope, created Jenkins credential assignment8-deploy-ssh for a8deploy. It permits host-administrator access through the deployment account. A temporary key copy on the controller was removed after credential creation; credential binding still needs a Jenkins job verification.
- Jenkins assignment8-validation #4 successfully bound the approved assignment8-deploy-ssh credential on assignment8-trusted, verified pinned SSH host key, connected as a8deploy, and confirmed noninteractive root sudo. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/4/console . Job currently points to Jenkinsfile.ssh-check; restore security validation before further security runs. Registry endpoint requires authentication and no Jenkins package-specific credential was found.
## Registry authentication
- Jenkins assignment8-registry-check #1 authenticated to myfileagent.tech using assignment8-registry-write, with a temporary Docker config removed at job exit. Evidence: https://ci.myfileagent.tech/job/assignment8-registry-check/1/console . Login alone does not prove permission to publish to the myfileagent organization or target-host pull access.
- Restored assignment8-validation job configuration to Jenkinsfile.security after SSH check. Registry login #1 succeeded using a temporary Docker config, which the job removed. The glovely credential can authenticate, but organization package write and target-host read remain unverified.
## Proxy preparation
- Validated and reloaded existing Caddy configuration with staging.myfileagent.tech -> pricing-staging:8000 and app.myfileagent.tech -> pricing-production:8000. Saved previous configuration at /home/codex/myfileagent-gitea/Caddyfile.before-assignment8. Gitea, Jenkins and Grafana HTTPS login routes returned 200 with certificate validation. New staging and app HTTPS endpoints returned 502 with certificate validation successful, expected before app containers exist. One initial staging DNS lookup timed out; retry reached HTTPS.
- Jenkinsfile.release.draft is untested and not enabled. It requires reviewed source on protected main, package publication rights, target registry authentication, scan and deployment validation before operational use.
- Prepared Jenkinsfile.registry-read-setup to configure root Docker registry authentication using a separate read-only Jenkins credential over pinned SSH. Draft only; not run. Root Docker configuration will hold authentication material and must be protected and removed after assessment.
## Registry reader and release guard
- Jenkins assignment8-validation #5 authenticated the Droplet root Docker client with assignment8-registry-read; login succeeded. Docker warned that its root configuration stores credentials without encryption; restrict access and remove after assessment. Actual image pull has not yet been proven. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/5/console .
- Draft release pipeline parsed and Jenkins build #6 stopped at the protected-main ancestry guard for the unmerged feature commit; image publication and deployment stages were skipped. Evidence: https://ci.myfileagent.tech/job/assignment8-validation/6/console . Added a workspace clean before checkout to prevent old reports being archived in future runs; that revision remains untested.
- Build #6 used a reused workspace and its post step archived pre-existing reports; those artifacts are stale and must not be presented as build #6 scan evidence. The draft now deletes the workspace before checkout to prevent recurrence; that correction is not yet verified.
## 2026-11-07 release draft review
- Verified branch b8a2529 on Gitea, shared services healthy and pricing routes still return 502 while application is absent. Jenkins guard build #7 rejected unmerged source before image publication; no files were archived. https://ci.myfileagent.tech/job/assignment8-validation/7/console
- Extended the local release draft to explicitly pull the published digest on the target and read a reviewed version/expected-total intent for v1 and v2. Jenkins Groovy 2.4 parser accepted syntax only; stages after the source guard, registry publication, promotion, and recovery remain untested. The v2 source is not yet applied.
- Hardened the secret scan to fail if the source archive fails, then directly tested it on the trusted agent: zero findings and exit 0. No claim is made about a new Jenkins pipeline run.
- Registry permission-only check #4 returned token scope write:package; this does not prove glovely can publish to the organization. https://ci.myfileagent.tech/job/assignment8-registry-check/4/console
- Jenkins assignment8-test-gate-demo #1 deliberately changed one pricing assertion in its own workspace; the test failed (30 versus 31), and its following demonstration delivery stage was skipped. The trap restored the test, git diff confirmed no test change, and all three tests subsequently passed directly on the agent. https://ci.myfileagent.tech/job/assignment8-test-gate-demo/1/console
- Supplied v2 starter was tested separately on the trusted agent: all three tests passed. It has not been applied to the reviewed v1 source, committed as v2, built, published, or deployed.
- Prepared reproducible agent Compose configuration and validated it with docker compose config; it documents the currently used Docker socket group and private network but has not replaced the running container.
- Prepared isolated v2 preview commit 2147b21 on local branch assignment8/v2-preview based on the v1 feature branch. It changes the application/tests and release intent; all three tests passed on the trusted agent. It is not yet reviewed, published, built as a release or deployed, and must be based on the final reviewed v1 state before promotion.
- Jenkins security validation #8 passed on Gitea commit 65e401172b0e4ec40116df0d07876484020ce454, including three unit tests, dependency audit, repository secret scan, Ansible syntax, image build and HIGH/CRITICAL image scan. The scan report was archived: https://ci.myfileagent.tech/job/assignment8-validation/8/console . This is validation of that commit, not an approved release.
- Agent Compose draft was checked against the running image, socket group, memory and restart policy and passed docker compose config. It has not been used to recreate the agent.
## PR-head validation and report corrections
- PR #17 was checked at c1cd3ad9af12e11af7c08c398c5fc93649cfd556; Gitea reported its existing PR Jenkins check successful. Jenkins assignment8-validation #9 ran the separate security pipeline on that head.
- During #9, a separate direct test of the revised secret-scan summary wrote a summary file into the shared validation workspace shortly before artifact archiving. That summary is independent test output, not generated by build #9, and must not be presented as #9 evidence. The build log and its own image-scan report remain distinct. Future validation now starts with a clean workspace; the updated pipeline and scan summary remain unvalidated in a full Jenkins run.
- Follow-up audit review found the prior pip-audit resolved report listed eight of nine pinned packages and omitted packaging==26.3; earlier green dependency-audit results should not be characterized as covering every pinned input. Tested pip-audit --disable-pip --no-deps against the exact pinned requirements: all nine listed, zero known vulnerabilities on 2026-11-07. Updated local security and release pipeline drafts to use this mode; the updated Jenkins pipeline has not yet been run.
- Revised secret scanner produces a redacted JSON summary and independently detected one disposable key with exit 1; its clean-source test reported zero findings. Both revised Jenkinsfiles passed Groovy parsing, but parsing alone does not establish end-to-end behavior.
- Read-only inspection of Gitea organization membership showed glovely in the myfileagent Owners team. Together with the token scope check this supports, but does not prove, package publication access; an actual registry push is still required.
+6
View File
@@ -0,0 +1,6 @@
FROM jenkins/inbound-agent@sha256:5069347cd3e72e5924e54c04fceb67209b41c8d0a3ab1c2b3f740e5fb2fab92a
USER root
RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-venv docker-cli openssh-client && rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/ansible && /opt/ansible/bin/pip install --no-cache-dir ansible-core==2.22.0 && /opt/ansible/bin/ansible-galaxy collection install -p /usr/share/ansible/collections community.docker:5.0.4
ENV PATH="/opt/ansible/bin:${PATH}"
USER jenkins
+10
View File
@@ -0,0 +1,10 @@
pipeline {
agent { label 'assignment8-trusted' }
stages {
stage('Verify tools') {
steps {
sh 'hostname; python3 --version; git --version; docker --version; ansible --version; ansible-galaxy collection list community.docker'
}
}
}
}
+21
View File
@@ -0,0 +1,21 @@
# Run only after reviewing host paths, Docker socket group and privileges.
services:
assignment8-agent:
image: assignment8-jenkins-agent:2
build: .
container_name: assignment8-jenkins-agent
restart: unless-stopped
mem_limit: 256m
group_add:
- "987" # Current Docker socket group; verify on the target host.
networks:
- private
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /home/codex/myfileagent-gitea/secrets/assignment8-agent-secret:/run/secrets/agent-secret:ro
entrypoint: ["java"]
command: ["-jar", "/usr/share/jenkins/agent.jar", "-url", "http://myfileagent-jenkins:8080/", "-webSocket", "-secret", "@/run/secrets/agent-secret", "-name", "assignment8-trusted", "-workDir", "/home/jenkins/agent"]
networks:
private:
external: true
name: myfileagent-gitea_gitea-private
@@ -0,0 +1,7 @@
# Add to the existing Caddy configuration; preserve all existing routes.
staging.myfileagent.tech {
reverse_proxy pricing-staging:8000
}
app.myfileagent.tech {
reverse_proxy pricing-production:8000
}
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
# Run as root after reviewing the deployment privilege scope.
set -eu
[ "$(id -u)" -eq 0 ] || { echo "Run as root" >&2; exit 1; }
key=/home/codex/myfileagent-gitea/secrets/assignment8-deploy.pub
[ -s "$key" ] || { echo "Deployment public key missing" >&2; exit 1; }
if ! id a8deploy >/dev/null 2>&1; then useradd -m -s /bin/bash a8deploy; fi
home=$(getent passwd a8deploy | cut -d: -f6)
[ "$home" = /home/a8deploy ] || { echo "Unexpected account home" >&2; exit 1; }
install -d -o a8deploy -g a8deploy -m 700 "$home/.ssh"
touch "$home/.ssh/authorized_keys"
chown a8deploy:a8deploy "$home/.ssh/authorized_keys"
chmod 600 "$home/.ssh/authorized_keys"
grep -qxF "$(cat "$key")" "$home/.ssh/authorized_keys" || cat "$key" >> "$home/.ssh/authorized_keys"
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
printf '%s\n' 'a8deploy ALL=(root) NOPASSWD: ALL' > "$tmp"
visudo -cf "$tmp" >/dev/null
install -o root -g root -m 440 "$tmp" /etc/sudoers.d/90-assignment8-deploy
echo 'Assignment 8 deploy account prepared.'
+62
View File
@@ -0,0 +1,62 @@
- name: Deploy a selected immutable pricing release
hosts: delivery
become: true
vars:
project_dir: "/opt/startup/pricing-{{ target_env }}"
tasks:
- name: Validate release selection
ansible.builtin.assert:
that:
- target_env in ['staging', 'production']
- "'@sha256:' in release_image"
- expected_version in ['v1', 'v2']
- expected_total | int > 0
- public_url.startswith('https://')
- proxy_network | length > 0
- name: Create deployment directory
ansible.builtin.file:
path: "{{ project_dir }}"
state: directory
mode: '0750'
- name: Render selected Compose configuration
ansible.builtin.template:
src: compose.yaml.j2
dest: "{{ project_dir }}/compose.yaml"
mode: '0640'
- name: Converge application without rebuilding
community.docker.docker_compose_v2:
project_src: "{{ project_dir }}"
project_name: "pricing-{{ target_env }}"
state: present
build: never
pull: missing
wait: true
wait_timeout: 90
- name: Verify health through public TLS endpoint
ansible.builtin.uri:
url: "{{ public_url }}/health"
return_content: true
validate_certs: true
register: health
until: health.status == 200 and health.json.status == 'ok'
retries: 12
delay: 5
changed_when: false
- name: Read release identity
ansible.builtin.uri:
url: "{{ public_url }}/"
return_content: true
register: identity
changed_when: false
- name: Exercise business behavior
ansible.builtin.uri:
url: "{{ public_url }}/price?quantity=3"
return_content: true
register: price
changed_when: false
- name: Check release identity and calculation
ansible.builtin.assert:
that:
- identity.json.version == expected_version
- identity.json.commit == expected_commit
- price.json.total | int == expected_total | int
+2
View File
@@ -0,0 +1,2 @@
[delivery]
startup ansible_host=172.20.0.1 ansible_user=a8deploy
+2
View File
@@ -0,0 +1,2 @@
# 172.20.0.1:22 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.20
172.20.0.1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMLfpbUktZ4Q6KaAKA5quOhM/rc9asSxloPJFOsIv2/B
@@ -0,0 +1,8 @@
# Copy to a release-specific file and replace EVERY placeholder.
target_env: staging
release_image: gitea.example.edu/team/pricing@sha256:REPLACE_DIGEST
expected_version: v1
expected_commit: REPLACE_FULL_GIT_COMMIT
expected_total: 30
public_url: https://staging.example.edu
proxy_network: REPLACE_EXISTING_PROXY_NETWORK
+3
View File
@@ -0,0 +1,3 @@
collections:
- name: community.docker
version: ">=4.8.0,<6.0.0"
@@ -0,0 +1,19 @@
services:
app:
image: "{{ release_image }}"
restart: unless-stopped
read_only: true
tmpfs:
- /tmp
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
networks:
edge:
aliases:
- "pricing-{{ target_env }}"
networks:
edge:
external: true
name: "{{ proxy_network }}"
@@ -0,0 +1,67 @@
pipeline {
agent { label 'assignment8-trusted' }
options { disableConcurrentBuilds(); timeout(time: 45, unit: 'MINUTES'); timestamps() }
stages {
stage('Prepare reviewed v1 configuration') {
steps {
deleteDir()
git url: 'https://myfileagent.tech/myfileagent/myfileagent-pipeline.git', branch: 'main'
sh '''set -eu
git checkout --detach 0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2
test "$(git rev-parse HEAD)" = 0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2
mkdir -p reports
cat > reports/v1-production.yml <<'EOF'
target_env: production
release_image: myfileagent.tech/myfileagent/pricing@sha256:715a3c80d5fff4319e275583e73e58cd80bffadea6e25796dd4867135ff036c2
expected_version: v1
expected_commit: 0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2
configuration_commit: 0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2
expected_total: 30
public_url: https://app.myfileagent.tech
proxy_network: myfileagent-gitea_gitea-private
EOF
curl -fsS https://app.myfileagent.tech/ > reports/before-identity.json
curl -fsS 'https://app.myfileagent.tech/price?quantity=3' > reports/before-price.json
python3 -c 'import json; a=json.load(open("reports/before-identity.json")); p=json.load(open("reports/before-price.json")); assert a["version"]=="v2" and a["commit"]=="ee128d18bddd1763b916b40f05829f2e769f0654" and p["total"]==36'
'''
}
}
stage('Human rollback approval') {
steps {
script {
def approver = timeout(time: 30, unit: 'MINUTES') { input message: 'Approve the Assignment 8 production rollback exercise from verified v2/36 to v1/30 using configuration 0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2 and image sha256:715a3c80d5fff4319e275583e73e58cd80bffadea6e25796dd4867135ff036c2? Recreating the container may interrupt traffic.', ok: 'Roll back', submitter: 'ssw590', submitterParameter: 'APPROVER' }
writeFile file: 'reports/approval.txt', text: "Approver: ${approver}\nDecision: approved\nTime UTC: ${sh(script: 'date -u +%FT%TZ', returnStdout: true).trim()}\n"
}
}
}
stage('Roll back and verify') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''#!/bin/sh
set +x
set -eu
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
(
while :; do
stamp=$(date -u +%FT%TZ)
code=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 3 https://app.myfileagent.tech/health 2>/dev/null || true)
printf '%s %s\n' "$stamp" "$code" >> reports/availability-samples.txt
sleep 1
done
) &
probe=$!
trap 'kill "$probe" 2>/dev/null || true; wait "$probe" 2>/dev/null || true' EXIT
date -u +%FT%TZ > reports/rollback-start.txt
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @reports/v1-production.yml > reports/rollback-ansible.txt 2>&1
date -u +%FT%TZ > reports/rollback-verified.txt
curl -fsS https://app.myfileagent.tech/health > reports/after-health.json
curl -fsS https://app.myfileagent.tech/ > reports/after-identity.json
curl -fsS 'https://app.myfileagent.tech/price?quantity=3' > reports/after-price.json
python3 -c 'import json; h=json.load(open("reports/after-health.json")); a=json.load(open("reports/after-identity.json")); p=json.load(open("reports/after-price.json")); assert h["status"]=="ok" and a["version"]=="v1" and a["commit"]=="0cb5a34cc4c2709ea3eb95f58bf5b0b2fa350ef2" and p["total"]==30'
'''
}
}
}
}
post { always { archiveArtifacts artifacts: 'reports/*', allowEmptyArchive: true } }
}
@@ -0,0 +1,41 @@
pipeline {
agent { label 'assignment8-trusted' }
options { disableConcurrentBuilds(); timeout(time: 20, unit: 'MINUTES'); timestamps() }
stages {
stage('Prepare staging-only failure') {
steps {
deleteDir()
git url: 'https://myfileagent.tech/myfileagent/myfileagent-pipeline.git', branch: 'assignment8/staging-failure-exercise'
sh '''set -eu
test "$(git rev-parse HEAD)" = c0cdd9159b430b8a27543a293cdd23aa05c8ee34
mkdir -p reports
cat > reports/staging.yml <<'EOF'
target_env: staging
release_image: myfileagent.tech/myfileagent/pricing@sha256:2ab86894ada4c12bd066ae1d29be40a296b1a037f379c494dead5cad4d8b88f9
expected_version: v2
expected_commit: ee128d18bddd1763b916b40f05829f2e769f0654
configuration_commit: c0cdd9159b430b8a27543a293cdd23aa05c8ee34
expected_total: 36
public_url: https://staging.myfileagent.tech
proxy_network: myfileagent-gitea_gitea-private
EOF
date -u +%FT%TZ > reports/failure-start.txt
'''
}
}
stage('Deploy deliberate mismatch') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''#!/bin/sh
set +x
set -eu
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @reports/staging.yml > reports/failure-ansible.txt 2>&1
'''
}
}
}
stage('Must not run after failure') { steps { error('Unexpected success: the staging failure did not block the pipeline') } }
}
post { always { archiveArtifacts artifacts: 'reports/*', allowEmptyArchive: true } }
}
@@ -0,0 +1,41 @@
pipeline {
agent { label 'assignment8-trusted' }
options { disableConcurrentBuilds(); timeout(time: 20, unit: 'MINUTES'); timestamps() }
stages {
stage('Restore reviewed staging configuration') {
steps {
deleteDir()
git url: 'https://myfileagent.tech/myfileagent/myfileagent-pipeline.git', branch: 'main'
sh '''set -eu
git checkout --detach ee128d18bddd1763b916b40f05829f2e769f0654
test "$(git rev-parse HEAD)" = ee128d18bddd1763b916b40f05829f2e769f0654
mkdir -p reports
cat > reports/staging.yml <<'EOF'
target_env: staging
release_image: myfileagent.tech/myfileagent/pricing@sha256:2ab86894ada4c12bd066ae1d29be40a296b1a037f379c494dead5cad4d8b88f9
expected_version: v2
expected_commit: ee128d18bddd1763b916b40f05829f2e769f0654
configuration_commit: ee128d18bddd1763b916b40f05829f2e769f0654
expected_total: 36
public_url: https://staging.myfileagent.tech
proxy_network: myfileagent-gitea_gitea-private
EOF
date -u +%FT%TZ > reports/recovery-start.txt
'''
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
sh '''#!/bin/sh
set +x
set -eu
export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts"
ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @reports/staging.yml > reports/recovery-ansible.txt 2>&1
date -u +%FT%TZ > reports/recovery-verified.txt
curl -fsS https://staging.myfileagent.tech/health > reports/health.json
curl -fsS https://staging.myfileagent.tech/ > reports/identity.json
curl -fsS 'https://staging.myfileagent.tech/price?quantity=3' > reports/price.json
'''
}
}
}
}
post { always { archiveArtifacts artifacts: 'reports/*', allowEmptyArchive: true } }
}
+1
View File
@@ -0,0 +1 @@
{"version": "v2", "quantity3_total": 36}
@@ -0,0 +1,8 @@
# Replace digest and commit with the approved build values. No secrets belong here.
target_env: production
release_image: myfileagent.tech/myfileagent/pricing@sha256:REPLACE_DIGEST
expected_version: v1
expected_commit: REPLACE_FULL_GIT_COMMIT
expected_total: 30
public_url: https://app.myfileagent.tech
proxy_network: myfileagent-gitea_gitea-private
@@ -0,0 +1,8 @@
# Replace digest and commit with the approved build values. No secrets belong here.
target_env: staging
release_image: myfileagent.tech/myfileagent/pricing@sha256:REPLACE_DIGEST
expected_version: v1
expected_commit: REPLACE_FULL_GIT_COMMIT
expected_total: 30
public_url: https://staging.myfileagent.tech
proxy_network: myfileagent-gitea_gitea-private
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
set -eu
scanner="a8-secret-${BUILD_NUMBER}"
archive=$(mktemp)
trap 'docker rm -f "$scanner" >/dev/null 2>&1 || true; rm -f secret-report.json "$archive"' EXIT
docker create --name "$scanner" aquasec/trivy@sha256:1c78ed1ef824ab8bb05b04359d186e4c1229d0b3e67005faacb54a7d71974f73 fs --quiet --scanners secret --exit-code 1 --format json /repo >/dev/null
tar --exclude=./.git --exclude=./secure-delivery/v1/.test-venv --exclude='*/__pycache__' --exclude=./reports --transform='s,^\.,repo,' -cf "$archive" .
docker cp - "$scanner":/ < "$archive"
set +e
docker start -a "$scanner" > secret-report.json
result=$?
set -e
mkdir -p reports
SCAN_EXIT="$result" python3 -c 'import datetime,json,os; p=json.load(open("secret-report.json")); n=sum(len(r.get("Secrets",[])) for r in p.get("Results",[])); summary={"scanner":"Trivy 0.69.1", "scope":"checked-out repository excluding Git metadata, temporary test environment and generated reports", "findings":n, "exit_code":int(os.environ["SCAN_EXIT"]), "timestamp_utc":datetime.datetime.now(datetime.timezone.utc).isoformat()}; json.dump(summary,open("reports/secret-scan-summary.json","w"),indent=2); print("Secret findings:",n)'
echo "Secret scanner exit status: $result"
exit "$result"
+5
View File
@@ -0,0 +1,5 @@
__pycache__
.venv
.git
*.pyc
.test-venv
+12
View File
@@ -0,0 +1,12 @@
FROM python:3.13-alpine@sha256:7984cf56ceaddebe4fefeb75d64000b9f45d8b77b11a09b24524da6cdc3af0c8
ARG APP_COMMIT=development
ENV APP_COMMIT=$APP_COMMIT PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN python -m pip uninstall -y pip && rm -rf /usr/local/lib/python3.13/ensurepip/_bundled
COPY app.py .
USER 10001:10001
EXPOSE 8000
HEALTHCHECK --interval=10s --timeout=10s --start-period=10s --retries=3 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=8)"
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--worker-tmp-dir", "/tmp", "app:app"]
+33
View File
@@ -0,0 +1,33 @@
import os
from flask import Flask, jsonify, request
app = Flask(__name__)
VERSION = "v2"
UNIT_PRICE = 12
COMMIT = os.environ.get("APP_COMMIT", "development")
def total_price(quantity):
if quantity < 1 or quantity > 1000:
raise ValueError("quantity must be between 1 and 1000")
return UNIT_PRICE * quantity
@app.get("/")
def index():
return jsonify(service="Startup Pricing", version=VERSION, commit=COMMIT)
@app.get("/health")
def health():
return jsonify(status="ok", version=VERSION)
@app.get("/price")
def price():
try:
quantity = int(request.args.get("quantity", "1"))
total = total_price(quantity)
except ValueError as error:
return jsonify(error=str(error)), 400
return jsonify(quantity=quantity, total=total, currency="USD")
+9
View File
@@ -0,0 +1,9 @@
blinker==1.9.0
click==8.5.0
Flask==3.1.3
gunicorn==23.0.0
itsdangerous==2.2.0
Jinja2==3.1.6
MarkupSafe==3.0.4
packaging==26.3
Werkzeug==3.1.9
+25
View File
@@ -0,0 +1,25 @@
import unittest
from app import app, total_price
class PricingTests(unittest.TestCase):
def setUp(self):
self.client = app.test_client()
def test_price(self):
self.assertEqual(total_price(3), 36)
response = self.client.get("/price?quantity=3")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json["total"], 36)
def test_invalid_quantity(self):
for value in ["0", "-1", "1001", "abc", "1.5"]:
self.assertEqual(self.client.get("/price?quantity=" + value).status_code, 400)
def test_release_identity(self):
self.assertEqual(self.client.get("/").json["version"], "v2")
self.assertEqual(self.client.get("/health").json["status"], "ok")
if __name__ == "__main__":
unittest.main()
+61
View File
@@ -0,0 +1,61 @@
From 2147b21640a3a644e9ab156bca9e7b5a82af4011 Mon Sep 17 00:00:00 2001
From: Codex <codex@localhost>
Date: Sat, 7 Nov 2026 21:29:14 +0000
Subject: [PATCH] Prepare v2 pricing behavior and release intent
---
secure-delivery/release-intent.json | 2 +-
secure-delivery/v1/app.py | 4 ++--
secure-delivery/v1/test_app.py | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/secure-delivery/release-intent.json b/secure-delivery/release-intent.json
index 1afb9db..910e70c 100644
--- a/secure-delivery/release-intent.json
+++ b/secure-delivery/release-intent.json
@@ -1 +1 @@
-{"version": "v1", "quantity3_total": 30}
+{"version": "v2", "quantity3_total": 36}
diff --git a/secure-delivery/v1/app.py b/secure-delivery/v1/app.py
index 1ea1194..a6dd3f0 100644
--- a/secure-delivery/v1/app.py
+++ b/secure-delivery/v1/app.py
@@ -2,8 +2,8 @@ import os
from flask import Flask, jsonify, request
app = Flask(__name__)
-VERSION = "v1"
-UNIT_PRICE = 10
+VERSION = "v2"
+UNIT_PRICE = 12
COMMIT = os.environ.get("APP_COMMIT", "development")
diff --git a/secure-delivery/v1/test_app.py b/secure-delivery/v1/test_app.py
index 40b4207..669294b 100644
--- a/secure-delivery/v1/test_app.py
+++ b/secure-delivery/v1/test_app.py
@@ -7,17 +7,17 @@ class PricingTests(unittest.TestCase):
self.client = app.test_client()
def test_price(self):
- self.assertEqual(total_price(3), 30)
+ self.assertEqual(total_price(3), 36)
response = self.client.get("/price?quantity=3")
self.assertEqual(response.status_code, 200)
- self.assertEqual(response.json["total"], 30)
+ self.assertEqual(response.json["total"], 36)
def test_invalid_quantity(self):
for value in ["0", "-1", "1001", "abc", "1.5"]:
self.assertEqual(self.client.get("/price?quantity=" + value).status_code, 400)
def test_release_identity(self):
- self.assertEqual(self.client.get("/").json["version"], "v1")
+ self.assertEqual(self.client.get("/").json["version"], "v2")
self.assertEqual(self.client.get("/health").json["status"], "ok")
--
2.43.0