Compare commits

...
Author SHA1 Message Date
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
40 changed files with 913 additions and 70 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.
+3 -3
View File
@@ -19,12 +19,12 @@
\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 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. \\
+3 -3
View File
@@ -20,12 +20,12 @@
\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} \\
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.
+2 -2
View File
@@ -51,8 +51,8 @@
% 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{\DocumentVersion}{1.9.2}
\newcommand{\DocumentStatus}{Final Draft}
\newcommand{\CourseNumber}{SSW 590}
\newcommand{\CourseName}{DevOps Principles and Practices}
\newcommand{\Instructor}{Darian Muresan}
+42
View File
@@ -0,0 +1,42 @@
# Assignment 8 handoff — 7 November 2026
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.
@@ -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 }}"
+1
View File
@@ -0,0 +1 @@
{"version": "v1", "quantity3_total": 30}
@@ -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=3s --start-period=10s --retries=3 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2)"
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 = "v1"
UNIT_PRICE = 10
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), 30)
response = self.client.get("/price?quantity=3")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json["total"], 30)
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("/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