14 Commits

Author SHA1 Message Date
samahk13 fa52a28a0c Merge pull request 'Feature/issue 24 delivery' (#27) from feature/issue-24-delivery into main
Scrap-Web/pipeline/head This commit looks good
Reviewed-on: #27
Reviewed-by: kholmes <kholmes2@stevens.edu>
2026-11-13 21:14:35 +00:00
samahk13 8979d92c00 Merge remote-tracking branch 'origin/main' into feature/issue-24-delivery
Scrap-Web/pipeline/pr-main Build started...
Scrap-Web/pipeline/head This commit looks good
# Conflicts:
#	Jenkinsfile
2026-11-13 16:14:14 -05:00
samahk13 17750b844b Merge pull request 'Docs/chapter 11' (#26) from docs/chapter-11 into main
Scrap-Web/pipeline/head There was a failure building this commit
Build IT manual / build-manual (push) Successful in 2m41s
Reviewed-on: #26
Reviewed-by: kholmes <kholmes2@stevens.edu>
2026-11-13 20:58:39 +00:00
samahk13 fb2bac752a Add Chapter 11 draft (Secure Delivery and Rollback)
Scrap-Web/pipeline/pr-main This commit looks good
Scrap-Web/pipeline/head This commit looks good
2026-11-13 15:55:41 -05:00
samahk13 3b79b7e07a Merge pull request 'Update manual to v1.6 and merge SRE chapter into one file' (#25) from fix/manual-v1.6 into main
Scrap-Web/pipeline/head This commit looks good
Build IT manual / build-manual (push) Successful in 2m13s
Reviewed-on: #25
Reviewed-by: kholmes <kholmes2@stevens.edu>
2026-11-13 19:58:27 +00:00
samahk13 60019db7da Change TRUSTED_BRANCH line of Jenkinsfile
Scrap-Web/pipeline/head This commit looks good
Scrap-Web/pipeline/pr-main This commit looks good
2026-11-12 19:16:59 -05:00
samahk13 2a35f97071 Add Ansible staging deploy and idempotence check for #24
Scrap-Web/pipeline/head This commit looks good
2026-11-12 18:51:25 -05:00
samahk13 d8a5d2717b Revert "Controlled failing test: wrong expected total (demo for #24)"
Scrap-Web/pipeline/head This commit looks good
This reverts commit 5e17a009dc.
2026-11-12 18:20:28 -05:00
samahk13 5e17a009dc Controlled failing test: wrong expected total (demo for #24)
Scrap-Web/pipeline/head There was a failure building this commit
2026-11-12 18:18:53 -05:00
samahk13 7e76950690 Fix base image FROM line for #24
Scrap-Web/pipeline/head This commit looks good
2026-11-12 18:13:03 -05:00
samahk13 27f8f20275 Add build, scan hooks and registry publish stages for #24
Scrap-Web/pipeline/head There was a failure building this commit
2026-11-12 18:05:14 -05:00
samahk13 98f86092a2 Start delivery agent directly with secret file for #24
Scrap-Web/pipeline/head This commit looks good
2026-11-11 13:37:57 -05:00
samahk13 459838dfcd Add trusted delivery agent for #24
Scrap-Web/pipeline/head This commit looks good
2026-11-11 13:23:25 -05:00
samahk13 6553b4400c Add v1 pricing service, Ansible starter and locked deps for #24
Scrap-Web/pipeline/head This commit looks good
2026-11-11 13:01:00 -05:00
27 changed files with 980 additions and 5 deletions
Vendored
+1 -1
View File
@@ -8,7 +8,7 @@
// TODO before submission: remove the feature branch from TRUSTED_BRANCH so // TODO before submission: remove the feature branch from TRUSTED_BRANCH so
// only reviewed code on main can deliver. // only reviewed code on main can deliver.
def TRUSTED_BRANCH = 'main|feature/issue-24-delivery' def TRUSTED_BRANCH = 'main'
pipeline { pipeline {
agent none agent none
+4
View File
@@ -0,0 +1,4 @@
# Secrets and host-specific values stay on the Droplet
jenkins-agent.secret
agent.secrets.env
.env
+31
View File
@@ -0,0 +1,31 @@
# Trusted Jenkins delivery agent for Chapter 6.
# Build context is the repository root (see agent/compose.yaml).
FROM jenkins/inbound-agent:latest-jdk21
USER root
# Python 3 + venv for tests, pip-audit and Ansible; curl for checks
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-venv python3-pip ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
# Docker CLI + buildx plugin (client only; the daemon is the host's, via the mounted socket)
COPY --from=docker:cli /usr/local/bin/docker /usr/local/bin/docker
COPY --from=docker/buildx-bin /buildx /usr/libexec/docker/cli-plugins/docker-buildx
# Trivy scanner (image vulnerabilities + secret scanning)
COPY --from=aquasec/trivy:latest /usr/local/bin/trivy /usr/local/bin/trivy
# Ansible in its own virtual environment, plus the community.docker collection
ENV ANSIBLE_COLLECTIONS_PATH=/opt/ansible-collections
COPY ansible/requirements.yml /tmp/ansible-requirements.yml
RUN python3 -m venv /opt/ansible-venv \
&& /opt/ansible-venv/bin/pip install --no-cache-dir ansible-core \
&& /opt/ansible-venv/bin/ansible-galaxy collection install -r /tmp/ansible-requirements.yml -p /opt/ansible-collections \
&& rm /tmp/ansible-requirements.yml
# pip-audit in a separate tools venv
RUN python3 -m venv /opt/tools-venv \
&& /opt/tools-venv/bin/pip install --no-cache-dir pip-audit
USER jenkins
+41
View File
@@ -0,0 +1,41 @@
# Trusted delivery agent. Connects to the existing Jenkins controller over the
# internal gitea-net network (WebSocket), so no new port is published.
services:
jenkins-agent:
build:
context: ..
dockerfile: agent/Dockerfile
image: ssw590/jenkins-delivery-agent:1
container_name: jenkins-agent
restart: unless-stopped
# Start agent.jar directly. The secret is read from a file (-secret @file),
# so it never appears in the process list, docker inspect, or Git.
entrypoint:
- java
- -jar
- /usr/share/jenkins/agent.jar
- -url
- http://jenkins:8080/
- -webSocket
- -name
- delivery-agent
- -workDir
- /home/jenkins/agent
- -secret
- "@/run/secrets/jenkins-agent-secret"
# Host Docker socket: needed to build/push images. This is effectively root
# on the Droplet, so only reviewed main-branch delivery jobs may use this agent.
group_add: ["${DOCKER_GID:?set DOCKER_GID in .env}"]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./jenkins-agent.secret:/run/secrets/jenkins-agent-secret:ro
- agent_home:/home/jenkins # workspace, known_hosts, registry login
networks: [gitea-net]
networks:
gitea-net:
external: true
name: gitea-net
volumes:
agent_home:
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# Print tool versions inside the agent. From the repo root on the Droplet:
# docker exec -i jenkins-agent sh -s < agent/versions.sh
echo "== java"; java -version 2>&1 | head -1
echo "== python"; python3 --version
echo "== docker"; docker version --format 'client {{.Client.Version}} / server {{.Server.Version}}'
echo "== buildx"; docker buildx version
echo "== trivy"; trivy --version | head -1
echo "== pip-audit"; /opt/tools-venv/bin/pip-audit --version
echo "== ansible"; /opt/ansible-venv/bin/ansible --version | head -3
echo "== collections"; /opt/ansible-venv/bin/ansible-galaxy collection list community.docker 2>/dev/null | tail -2
echo "== os"; . /etc/os-release; echo "$PRETTY_NAME $(uname -m)"
+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
+4
View File
@@ -0,0 +1,4 @@
[delivery]
# Target: the existing Droplet, reached over SSH as the dedicated deploy account.
# Host key must be verified and pinned in the agent's known_hosts before first use.
startup ansible_host=147.182.179.191 ansible_user=deploy
+3
View File
@@ -0,0 +1,3 @@
collections:
- name: community.docker
version: ">=4.8.0,<6.0.0"
+19
View File
@@ -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 }}"
Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

+4 -3
View File
@@ -41,10 +41,10 @@
\newcommand{\CourseName}{DevOps} \newcommand{\CourseName}{DevOps}
\newcommand{\Instructor}{Samah Keshiro and Kayla Holmes} \newcommand{\Instructor}{Samah Keshiro and Kayla Holmes}
\newcommand{\Organization}{Stevens Institute of Technology} \newcommand{\Organization}{Stevens Institute of Technology}
\newcommand{\DocumentDate}{October 29, 2026} \newcommand{\DocumentDate}{November 13, 2026}
\newcommand{\DueDate}{[Due Date and Time]} \newcommand{\DueDate}{[Due Date and Time]}
\newcommand{\VERSION}{Version 1.6} \newcommand{\VERSION}{Version 1.7 (draft)}
\newcommand{\AssignmentNumber}{6} \newcommand{\AssignmentNumber}{7}
\newcolumntype{Y}{>{\raggedright\arraybackslash}X} \newcolumntype{Y}{>{\raggedright\arraybackslash}X}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
@@ -137,6 +137,7 @@
\include{devopsAutomatedManualBuild} \include{devopsAutomatedManualBuild}
\include{devopsCI} \include{devopsCI}
\include{devopsSRE} \include{devopsSRE}
\include{devopsSecureDelivery}
\printglossaries \printglossaries
+2
View File
@@ -10,6 +10,8 @@
\toprule \textbf{Date / Version} & \textbf{Authors} & \textbf{Change} & \textbf{Changed At}\\ \midrule \toprule \textbf{Date / Version} & \textbf{Authors} & \textbf{Change} & \textbf{Changed At}\\ \midrule
\endhead \endhead
November 13, 2026 / 1.7 (draft) & SK, KH & In progress: Secure Delivery and Rollback assignment. Added the trusted Jenkins delivery agent, locked dependencies and pinned base image, the Gitea container registry, staging and production proxy routes, image build and publish by digest, and Ansible deployment to staging with an idempotence check. Security gates, approval and promotion, v2 and recovery, and monitoring sections still to be completed. Updated the Hosts and Passwords tables and the Glossary. & \ChapterRef{SecureDelivery}, \ChapterRef{PWDHST} \\
October 29, 2026 / 1.6 & SK, KH & Completed the Introduction to SRE assignment: deployed Prometheus, Grafana OSS, Node Exporter, and Blackbox Exporter as four pinned, persistent containers on the existing Droplet; published authenticated Grafana at \texttt{metrics.ssw590-08.me}; built a six-panel dashboard; defined an availability SLI and SLO; configured and tested Grafana-managed alerts with a Discord contact point; and ran a controlled Jenkins outage with a blameless review. Updated the Hosts and Passwords tables and the Glossary. & \ChapterRef{SRE}, \ChapterRef{PWDHST} \\ October 29, 2026 / 1.6 & SK, KH & Completed the Introduction to SRE assignment: deployed Prometheus, Grafana OSS, Node Exporter, and Blackbox Exporter as four pinned, persistent containers on the existing Droplet; published authenticated Grafana at \texttt{metrics.ssw590-08.me}; built a six-panel dashboard; defined an availability SLI and SLO; configured and tested Grafana-managed alerts with a Discord contact point; and ran a controlled Jenkins outage with a blameless review. Updated the Hosts and Passwords tables and the Glossary. & \ChapterRef{SRE}, \ChapterRef{PWDHST} \\
October 23, 2026 / 1.5 & SK, KH & Completed the Continuous Integration with Jenkins assignment: deployed a persistent Jenkins LTS container behind HTTPS at \texttt{ci.ssw590-08.me} with firewall-restricted access; integrated Jenkins with the Scrap-Web Gitea repository through a dedicated integration account; added a pricing module, unit tests, and a versioned \texttt{Jenkinsfile}; protected \texttt{main} with a required Jenkins status check and one required approval; and demonstrated a failed, repaired, reviewed, and merged pull request. Updated the Hosts table (Jenkins host and ports) and the Passwords table (Jenkins administrator accounts and the Gitea integration token, hints only). & \ChapterRef{ContinuousIntegration}, \ChapterRef{PWDHST} \\ October 23, 2026 / 1.5 & SK, KH & Completed the Continuous Integration with Jenkins assignment: deployed a persistent Jenkins LTS container behind HTTPS at \texttt{ci.ssw590-08.me} with firewall-restricted access; integrated Jenkins with the Scrap-Web Gitea repository through a dedicated integration account; added a pricing module, unit tests, and a versioned \texttt{Jenkinsfile}; protected \texttt{main} with a required Jenkins status check and one required approval; and demonstrated a failed, repaired, reviewed, and merged pull request. Updated the Hosts table (Jenkins host and ports) and the Passwords table (Jenkins administrator accounts and the Gitea integration token, hints only). & \ChapterRef{ContinuousIntegration}, \ChapterRef{PWDHST} \\
+4
View File
@@ -22,3 +22,7 @@
\newglossaryentry{errorbudget}{name={error budget},description={The amount of failure an SLO allows over its window; for a 99\% target, 1\% of scheduled measurements}} \newglossaryentry{errorbudget}{name={error budget},description={The amount of failure an SLO allows over its window; for a 99\% target, 1\% of scheduled measurements}}
\newglossaryentry{probe}{name={probe},description={A synthetic request, here an HTTPS GET from Blackbox Exporter, that tests whether a service responds as expected}} \newglossaryentry{probe}{name={probe},description={A synthetic request, here an HTTPS GET from Blackbox Exporter, that tests whether a service responds as expected}}
\newglossaryentry{contactpoint}{name={contact point},description={The Grafana destination, such as a Discord webhook or email address, that receives alert notifications}} \newglossaryentry{contactpoint}{name={contact point},description={The Grafana destination, such as a Discord webhook or email address, that receives alert notifications}}
\newglossaryentry{idempotence}{name={idempotence},description={The property that running the same deployment again on an already-correct system changes nothing}}
\newglossaryentry{imagedigest}{name={image digest},description={The SHA-256 content hash that identifies one exact container image in a registry; unlike a tag, it cannot be moved to another image}}
\newglossaryentry{releaserecord}{name={release record},description={A file that ties one deployment to its image digest, source commit, expected behavior, environment, and build}}
\newglossaryentry{trustedagent}{name={trusted agent},description={A Jenkins build node that holds deployment credentials and therefore runs only reviewed code}}
+20 -1
View File
@@ -66,6 +66,17 @@ Discord webhook (Grafana contact point \texttt{team-alerts})
& Webhook URL stored only in Grafana's database; re-created from the Discord channel's Integrations $\rightarrow$ Webhooks settings\\ & Webhook URL stored only in Grafana's database; re-created from the Discord channel's Integrations $\rightarrow$ Webhooks settings\\
\hline \hline
Deployment account (Ansible)
& deploy
& No password; SSH key stored only in Jenkins credential \texttt{deploy-ssh}\\
\hline
Gitea container registry
& Push: Jenkins credential \texttt{gitea-registry-push}; pull: root on the Droplet
& Package-write and package-read tokens; never stored in Git, logs, or screenshots\\
\hline
Jenkins delivery agent
& delivery-agent
& Agent secret in a file on the Droplet beside \texttt{agent/compose.yaml}; not in Git\\
\end{longtable} \end{longtable}
@@ -100,7 +111,7 @@ Jenkins Web Interface & ci.ssw590-08.me & 443 & HTTPS access to Jenkins through
\hline \hline
Jenkins Container & jenkins & 8080 & Internal Docker network web service; not published on the host \\ Jenkins Container & jenkins & 8080 & Internal Docker network web service; not published on the host \\
\hline \hline
Jenkins Agent Port & jenkins & 50000 & Not published on the host; no separate build agent is used \\ Jenkins Agent Port & jenkins & 50000 & Not published on the host and not used; the delivery agent connects over WebSocket through port 8080 on \texttt{gitea-net} \\
\hline \hline
Grafana Web Interface & metrics.ssw590-08.me & 443 & HTTPS access to Grafana through Caddy \\ Grafana Web Interface & metrics.ssw590-08.me & 443 & HTTPS access to Grafana through Caddy \\
\hline \hline
@@ -112,4 +123,12 @@ Node Exporter Container & node-exporter & 9100 & Private, \texttt{monitoring} ne
\hline \hline
Blackbox Exporter Container & blackbox-exporter & 9115 & Private, \texttt{monitoring} network only; HTTPS probes of Gitea and Jenkins \\ Blackbox Exporter Container & blackbox-exporter & 9115 & Private, \texttt{monitoring} network only; HTTPS probes of Gitea and Jenkins \\
\hline \hline
Staging Application & staging.ssw590-08.me & 443 & HTTPS access to the staging pricing service through Caddy \\
\hline
Production Application & app.ssw590-08.me & 443 & HTTPS access to the production-like pricing service through Caddy \\
\hline
Pricing Containers & pricing-staging, pricing-production & 8000 & Private, \texttt{gitea-net} only; Gunicorn; not published on the host; Compose projects under \texttt{/opt/startup/pricing-\{staging,production\}}; no data volume \\
\hline
Jenkins Delivery Agent & jenkins-agent & None & Container on \texttt{gitea-net}; runs Docker builds and Ansible; mounts the host Docker socket; state in volume \texttt{agent\_home} \\
\hline
\end{longtable} \end{longtable}
+45
View File
@@ -95,3 +95,48 @@
url = {https://docs.digitalocean.com/support/why-is-smtp-blocked/}, url = {https://docs.digitalocean.com/support/why-is-smtp-blocked/},
note = {Accessed: Oct. 28, 2026} note = {Accessed: Oct. 28, 2026}
} }
@misc{AnsibleCompose,
author = {{Ansible Project}},
title = {{community.docker.docker\_compose\_v2 module}},
howpublished = {Ansible Documentation},
year = {2026},
url = {https://docs.ansible.com/ansible/latest/collections/community/docker/docker_compose_v2_module.html},
note = {Accessed: Nov. 13, 2026}
}
@misc{AnsibleInstall,
author = {{Ansible Project}},
title = {{Installing Ansible}},
howpublished = {Ansible Documentation},
year = {2026},
url = {https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html},
note = {Accessed: Nov. 13, 2026}
}
@misc{GiteaContainerRegistry,
author = {{Gitea}},
title = {{Container Registry}},
howpublished = {Gitea Documentation},
year = {2026},
url = {https://docs.gitea.com/usage/packages/container},
note = {Accessed: Nov. 13, 2026}
}
@misc{DockerPullDigest,
author = {{Docker Inc.}},
title = {{docker image pull: Pull an image by digest}},
howpublished = {Docker Documentation},
year = {2026},
url = {https://docs.docker.com/reference/cli/docker/image/pull/},
note = {Accessed: Nov. 13, 2026}
}
@misc{JenkinsAgents,
author = {{Jenkins Project}},
title = {{Using Jenkins agents}},
howpublished = {Jenkins User Documentation},
year = {2026},
url = {https://www.jenkins.io/doc/book/using/using-agents/},
note = {Accessed: Nov. 13, 2026}
}
+445
View File
@@ -0,0 +1,445 @@
\chapter{Secure Delivery and Rollback}
\ChapterLabel{SecureDelivery}
\index{continuous delivery}
\index{Ansible}
\index{rollback}
\sloppy
% Red marker for values still to be filled in from the team's own outputs.
% Search this file for \FillIn before submitting; none should remain.
\providecommand{\FillIn}[1]{\textcolor{devopsRed}{\textbf{[TO FILL: #1]}}}
% Figure helper: shows a labelled box until the screenshot file exists.
\providecommand{\delfig}[4]{%
\begin{figure}[H]\centering
\IfFileExists{HW8 images/#1}{\includegraphics[width=#2\linewidth]{HW8 images/#1}}%
{\fbox{\parbox{0.8\linewidth}{\centering\vspace{1em}\textit{[Screenshot needed: HW8 images/#1]}\vspace{1em}}}}
\caption{#3}\label{#4}\end{figure}}
This chapter closes the delivery loop for the team's startup. The Startup
Pricing Service, a small stateless Flask application served by Gunicorn, is
built once into a container image, published to the Gitea container registry,
and deployed by Ansible to a staging environment on the existing Droplet behind
the existing Caddy proxy. The same image digest is then approved and promoted
to a production-like environment, a second release (v2) is delivered, and two
recovery cases are exercised.
The existing Gitea, Jenkins, Caddy, and monitoring containers from earlier
chapters are reused unchanged. Nothing was reinstalled, and no Kubernetes,
Argo CD, cAdvisor, or database was added. Staging and production share one
Droplet, so they share a failure domain and its CPU, memory, and disk: separate
Compose projects give configuration separation, not high availability.
\textbf{Division of work.} Sections~\ref{sec:del-baseline}--\ref{sec:del-build}
and Section~\ref{sec:del-ansible} were carried out by \texttt{samahk13}, who
holds the Gitea administrator, Jenkins, DNS, and Droplet SSH access.
Sections~\ref{sec:del-security} and~\ref{sec:del-promote}--\ref{sec:del-ops}
were carried out by \texttt{kholmes}.
\section{Deployment Architecture}
\label{sec:del-architecture}
\begin{itemize}
\item \textbf{Source and images:} the existing Gitea server
(\texttt{git.ssw590-08.me}) holds the repository and, with its package
registry enabled~\cite{GiteaContainerRegistry}, the application images under
\texttt{git.ssw590-08.me/ssw-590-08/pricing}.
\item \textbf{Orchestration:} the existing Jenkins controller schedules the
pipeline. Delivery stages run on a new \gls{trustedagent} container~\cite{JenkinsAgents},
\texttt{jenkins-agent} (node \texttt{delivery-agent}, label
\texttt{delivery}), on the same Droplet. Ansible runs inside this agent, not
on the controller and not in the application container.
\item \textbf{Target:} Ansible connects over SSH to the Droplet host as the
dedicated \texttt{deploy} account and applies a separate Compose project
for each environment under \texttt{/opt/startup/pricing-staging} and
\texttt{/opt/startup/pricing-production}.
\item \textbf{Traffic:} browser $\rightarrow$ Caddy (HTTPS 443)
$\rightarrow$ \texttt{pricing-staging:8000} or
\texttt{pricing-production:8000} over the private \texttt{gitea-net}
network. No application port is published on the host.
\item \textbf{Monitoring:} the Chapter~\ref{Chapter:SRE} stack (Prometheus,
Grafana, Blackbox Exporter, Node Exporter) is reused; see
Section~\ref{sec:del-ops}.
\end{itemize}
\FillIn{team deployment diagram (HW8 images/delivery-architecture.png) showing
actual hosts, container boundaries, volumes and bind mounts, Ansible SSH, both
environments, proxy, and monitoring}
\section{Prepare the Repository and Establish a Baseline}
\label{sec:del-baseline}
\textbf{Issue and branch.} The work is tracked in Gitea issue~\#24 and developed
on branch \texttt{feature/issue-24-delivery} of the existing
\texttt{SSW-590-08/Scrap-Web} repository. The supplied v1 starter was copied into
\texttt{pricing/}, the Ansible files into \texttt{ansible/}, and release-record
documentation into \texttt{releases/}.
\textbf{Locked dependencies.} The starter's \texttt{requirements.txt} gives
version ranges (\texttt{Flask>=3.1,<3.2}, \texttt{gunicorn>=23,<24}). These
ranges were moved to \texttt{pricing/requirements.in}, and a lockfile with exact
versions and SHA-256 hashes for every direct and transitive dependency was
generated with:
\begin{minted}[breaklines,breakanywhere]{text}
uv pip compile requirements.in --universal --python-version 3.13 --generate-hashes -o requirements.txt
\end{minted}
\begin{tabularx}{\linewidth}{L{3.2cm}L{2.4cm}Y}
\toprule
\textbf{Package} & \textbf{Version} & \textbf{Role}\\ \midrule
flask & 3.1.3 & Direct: web framework\\
gunicorn & 23.0.0 & Direct: application server\\
werkzeug & 3.1.9 & Transitive (Flask)\\
jinja2 & 3.1.6 & Transitive (Flask)\\
markupsafe & 3.0.4 & Transitive (Jinja2, Werkzeug)\\
itsdangerous & 2.2.0 & Transitive (Flask)\\
click & 8.5.1 & Transitive (Flask)\\
blinker & 1.9.0 & Transitive (Flask)\\
packaging & 26.3 & Transitive (Gunicorn)\\
\bottomrule
\end{tabularx}
\medskip
Both the pipeline's test environment and the image build install with
\texttt{pip install --require-hashes -r requirements.txt}, so a changed or
unlisted package fails the install instead of being used silently. When
dependencies are updated, the lockfile is regenerated and the image is rebuilt
and rescanned. No claim is made that these versions are free of
vulnerabilities; that is the job of the security gates in
Section~\ref{sec:del-security}.
\textbf{Base image.} The Dockerfile pins \texttt{python:3.13-slim} by digest for
\texttt{linux/amd64}, the Droplet's architecture:
\texttt{python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d\allowbreak 45a8d350d98134cf1070bc106ee9ed90}. Python 3.13 is
supported by the selected \texttt{ansible-core} release.
\textbf{Baseline and controlled failure.} The v1 unit tests
(\texttt{test\_price}, \texttt{test\_invalid\_quantity},
\texttt{test\_release\_identity}) run in the pipeline's \emph{Unit tests} stage
inside a fresh virtual environment:
\begin{minted}[breaklines,breakanywhere]{text}
python3 -m venv .venv
.venv/bin/pip install -q --require-hashes -r requirements.txt
.venv/bin/python -m py_compile app.py test_app.py
.venv/bin/python -m unittest -v
\end{minted}
\begin{itemize}
\item \textbf{Controlled failure:} Jenkins run
\texttt{feature/issue-24-delivery} \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/6/}{\#6}, started by a push at 11:19 PM EST on
November 12, 2026, ran on \texttt{delivery-agent}. The deliberately
broken test \texttt{test\_price} failed, so the \emph{Unit tests} stage
failed after 6 seconds and every later delivery stage (security scans,
build, publish, deploy) was skipped
(Figure~\ref{fig:del-test-fail}). A failing test therefore prevents
delivery. The test's expected total was changed from 30 to 31, so it
failed with \texttt{AssertionError: 30 != 31} while the application itself
was unchanged.
\item \textbf{Passing baseline and restore:} run \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/5/}{\#5} (11:13 PM EST), before the
controlled failure, passed all three tests. The test was then restored to
expect 30, and run \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/7/}{\#7} (11:20 PM EST) passed all three tests again. The same tests also
pass locally in a fresh virtual environment (\texttt{Ran 3 tests in
0.085s, OK}).
\end{itemize}
All times in this chapter are Eastern Standard Time (EST), as displayed by Jenkins.
\delfig{build6-unit-test-fail.png}{1.0}{November 12, 2026, 11:19 PM EST ---
Jenkins \texttt{feature/issue-24-delivery} run \#6 on \texttt{delivery-agent}:
\texttt{test\_price} fails, the Unit tests stage stops the run, and the build,
publish, and deploy stages are skipped.}{fig:del-test-fail}
\section{Prepare the Trusted Agent and Target}
\label{sec:del-agent}
\subsection{Trusted Delivery Agent}
The Chapter~\ref{Chapter:ContinuousIntegration} pipeline ran only on the
controller's built-in node, which has no Docker or Ansible. A dedicated agent
was added rather than enabling deployment jobs on the controller. It is built
from \texttt{agent/Dockerfile} and started by \texttt{agent/compose.yaml}, both
in Gitea, so recreating the container keeps every tool:
\begin{itemize}
\item \textbf{Base:} \texttt{jenkins/inbound-agent:latest-jdk21}.
\item \textbf{Tools:} Python 3 with \texttt{venv}; Docker CLI and the
\texttt{buildx} plugin (client only; the daemon is the host's); Trivy;
\texttt{pip-audit} in \texttt{/opt/tools-venv}; and \texttt{ansible-core}
with the \texttt{community.docker} collection~\cite{AnsibleInstall} in
\texttt{/opt/ansible-venv}. Every Jenkins deployment step puts
\texttt{/opt/ansible-venv/bin} first on its \texttt{PATH}.
\item \textbf{Connection:} the agent connects to the controller at
\texttt{http://jenkins:8080/} over WebSocket on the internal
\texttt{gitea-net} network, so no new port is published. Its secret is
read from a file (\texttt{-secret @/run/secrets/jenkins-agent-secret}) that
is not in Git, so it does not appear in the process list or
\texttt{docker inspect}.
\item \textbf{Docker access:} the host Docker socket is mounted so the agent
can build and push images. This is effectively root on the Droplet, so only
trusted-branch delivery stages may run on this agent
(Section~\ref{sec:del-trust}).
\end{itemize}
Installed versions, printed by \texttt{agent/versions.sh} inside the agent:
\begin{tabularx}{\linewidth}{L{3.6cm}Y}
\toprule
\textbf{Tool} & \textbf{Version}\\ \midrule
Java & OpenJDK 21.0.13 LTS\\
Python & 3.13.5\\
Docker client / server & 29.9.3 / 29.8.2\\
Docker buildx & v0.38.2\\
Trivy & 0.76.2\\
pip-audit & 2.10.1\\
ansible-core & 2.22.0\\
community.docker & 5.4.0\\
Agent OS & Debian GNU/Linux 13 (trixie), x86\_64\\
\bottomrule
\end{tabularx}
\medskip
The agent image \texttt{ssw590/jenkins-delivery-agent:1} has image ID
\texttt{sha256:e8e72e1c89d3\allowbreak 72fff4a920b581b1a0daa7c885164ff6668dfcc2e22f85e6aa83}.
\subsection{Target Prerequisites}
The target is the same Droplet (\texttt{147.182.179.191}). Before the first
playbook run its prerequisites were verified:
\begin{tabularx}{\linewidth}{L{4.2cm}Y}
\toprule
\textbf{Requirement} & \textbf{Observed}\\ \midrule
Python 3 & 3.12.3\\
Docker Engine & 29.8.2\\
Compose plugin ($\geq$ 2.18) & v5.5.1 (meets the minimum)\\
\bottomrule
\end{tabularx}
\subsection{Deployment Account and Credentials}
\label{sec:del-trust}
\begin{itemize}
\item \textbf{Deployment account:} a dedicated \texttt{deploy} user on the
Droplet, used only by Ansible. Its private key is stored only in the Jenkins
credential \texttt{deploy-ssh}. It is an Ed25519 key with comment
\texttt{jenkins-deploy} and fingerprint
\texttt{SHA256:jy/MveXnRjD+HOLWi6fuR+WNGA3gpkS0kudqPi/prJY}. The Droplet's
Ed25519 host key was read on the Droplet itself over the existing
administrator SSH session
(\texttt{SHA256:zL7qulFmdVDZQ3oBGvXWyWnKjNWUpPh1BDbfAOC+nbk}). The key
scanned from \texttt{147.182.179.191} had the same fingerprint, and it was
then pinned in the agent's \texttt{known\_hosts}. Its non-interactive
\texttt{sudo} rule, in \texttt{/etc/sudoers.d/}, is
\texttt{deploy ALL=(root) NOPASSWD: ALL}. This scope is deliberately broad:
the playbook uses \texttt{become: true} to create directories under
\texttt{/opt/startup} and to drive Docker Compose as \texttt{root}, and
Docker access is already equivalent to root on the host. The account
therefore effectively administers the Droplet. A separate account limits
who holds the key and makes its use auditable, but it does not remove that
risk, so the key is held only by Jenkins and used only by trusted-branch
delivery stages.
\item \textbf{Registry access:} the Gitea package registry was enabled
(\texttt{[packages] ENABLED = true}). A package-\emph{write} token is held
only in the Jenkins credential \texttt{gitea-registry-push} and used by the
\emph{Publish} stage through \texttt{docker login --password-stdin}. A
package-\emph{read} token is logged in for \texttt{root} on the Droplet,
the account that runs Docker under Ansible escalation. Tokens are never in
Git, command arguments, screenshots, or pipeline logs.
\item \textbf{Trust boundary:} every branch and pull request runs only the
Chapter~\ref{Chapter:ContinuousIntegration} checks on the controller, with
no credentials and no Docker socket. The \emph{Delivery} stages run only for
the trusted branch pattern \texttt{TRUSTED\_BRANCH}. During development it
also allowed \texttt{feature/issue-24-delivery}; for the assessed runs it is
\texttt{main} only, so only reviewed code can build, publish, or deploy.
\FillIn{confirm the change to main only and its commit} No Docker daemon API is published to the Internet.
\end{itemize}
\section{Connect the Application to the Existing Proxy}
\label{sec:del-proxy}
\begin{itemize}
\item \textbf{DNS:} \texttt{staging.ssw590-08.me} and
\texttt{app.ssw590-08.me} point to the Droplet (\texttt{147.182.179.191}).
\item \textbf{Proxy network:} Caddy runs in a container on the existing
\texttt{gitea-net} network. The Compose template joins each pricing
container to that external network with a distinct alias
(\texttt{pricing-staging}, \texttt{pricing-production}) and publishes no
host port, so port 8000 is reachable only from containers on
\texttt{gitea-net}.
\item \textbf{Routes:} added to the existing \texttt{/root/gitea/Caddyfile},
keeping the Gitea, Jenkins, and Grafana routes. The file was validated and
Caddy reloaded, and Caddy obtained valid TLS certificates for both
hostnames automatically.
\end{itemize}
\begin{minted}[breaklines,breakanywhere]{text}
staging.ssw590-08.me {
reverse_proxy pricing-staging:8000
}
app.ssw590-08.me {
reverse_proxy pricing-production:8000
}
\end{minted}
The firewall policy is unchanged: public HTTPS (443, and 80 for redirects),
restricted SSH, and no public infrastructure or metrics ports.
\textbf{Accepted simplification.} Sharing \texttt{gitea-net} means a
compromised pricing container could reach Gitea, Jenkins, Grafana, and the
agent on that network directly, not only through Caddy. A separate proxy-only
network per application would give stronger lateral isolation.
\section{Build Once and Record an Immutable Release}
\label{sec:del-build}
The \texttt{Jenkinsfile} keeps the Chapter~\ref{Chapter:ContinuousIntegration}
checks and adds a \emph{Delivery} block on the \texttt{delivery} agent with
these stages: Checkout, Unit tests, Security scan: source, Build image, Security
scan: image, Publish, Deploy staging, Staging idempotence, and Approve and deploy
production. The pipeline sets \texttt{disableConcurrentBuilds()}, so two runs
cannot change staging or production at the same time.
The image is built once per source commit, with the commit baked in at build
time. The \emph{Publish} stage pushes it, deletes the local copy, and pulls it
back, so the recorded \gls{imagedigest} is the registry's and not a local image ID~\cite{DockerPullDigest}:
\begin{minted}[breaklines,breakanywhere]{bash}
docker build --build-arg APP_COMMIT="$APP_COMMIT" -t "$IMAGE:$APP_COMMIT" .
printf '%s' "$REG_TOKEN" | docker login "$REGISTRY" -u "$REG_USER" --password-stdin
docker push "$IMAGE:$APP_COMMIT"
docker image rm "$IMAGE:$APP_COMMIT"
docker pull "$IMAGE:$APP_COMMIT"
docker logout "$REGISTRY"
docker image inspect "$IMAGE:$APP_COMMIT" --format '{{index .RepoDigests 0}}'
\end{minted}
The stage archives \texttt{image-digest.txt} and \texttt{build-record.txt}
(source commit, tag, digest, and Jenkins build URL) as fingerprinted build
artifacts. The image runs Gunicorn as the non-root user \texttt{10001}, and the
Compose template drops all capabilities and makes the root filesystem read-only
with a \texttt{tmpfs} for \texttt{/tmp}.
\begin{tabularx}{\linewidth}{L{3.2cm}Y}
\toprule
\textbf{Release} & \textbf{v1}\\ \midrule
Source commit & \texttt{2a35f97071c95b23bccb8c973099f2991c998599}\\
Jenkins build & \texttt{feature/issue-24-delivery} \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8}\\
Image digest & \texttt{git.ssw590-08.me/ssw-590-08/\allowbreak pricing@sha256:\allowbreak ce91d0552da2a4580557ec65aedec04b\allowbreak 278fe918df1f02b23c971ca45cc3d97c}\\
Published & November 12, 2026, 11:51 PM EST\\
\bottomrule
\end{tabularx}
\delfig{publish-digest.png}{1.0}{November 12, 2026, run \#8 --- Jenkins Publish
stage: the v1 image is pushed, the local copy deleted and pulled back from the
registry, and its registry digest recorded. The registry token is masked and
never printed.}{fig:del-publish}
\section{Apply Proportionate Security Gates}
\label{sec:del-security}
\FillIn{kholmes: scan policy, tools and database versions, source and image
scan results, blocked synthetic fixture run, fix and rerun
(\texttt{security/scan.sh})}
\section{Deploy v1 with Ansible and Prove Idempotence}
\label{sec:del-ansible}
\textbf{Inputs.} \texttt{ansible/inventory.ini} names one host,
\texttt{startup}, at \texttt{147.182.179.191} with user \texttt{deploy}; it
contains no secrets. \texttt{ansible/deploy.yml} and
\texttt{ansible/templates/compose.yaml.j2} are the supplied playbook and
template with every placeholder replaced.
\textbf{Release record.} The \emph{Deploy staging} stage writes the
\gls{releaserecord} from the build it belongs to, so the digest and commit cannot be
mistyped. The expected version and total are read from the application source
(\texttt{VERSION} and \texttt{3 $\times$ UNIT\_PRICE}), not from configuration.
The record is archived with the build. For v1 it contains:
\begin{minted}[breaklines,breakanywhere]{yaml}
target_env: staging
release_image: git.ssw590-08.me/ssw-590-08/pricing@sha256:ce91d0552da2a4580557ec65aedec04b278fe918df1f02b23c971ca45cc3d97c
expected_version: v1
expected_commit: 2a35f97071c95b23bccb8c973099f2991c998599
expected_total: 30
public_url: https://staging.ssw590-08.me
proxy_network: gitea-net
\end{minted}
The record holds metadata only, never credentials.
\textbf{Deployment.} The stage runs a syntax check and then the deployment:
\begin{minted}[breaklines,breakanywhere]{bash}
ansible-playbook -i ansible/inventory.ini ansible/deploy.yml --syntax-check
ansible-playbook -i ansible/inventory.ini ansible/deploy.yml \
--private-key "$DEPLOY_KEY" -e @release-v1-staging.yml
\end{minted}
The playbook validates its inputs, creates \texttt{/opt/startup/pricing-staging},
renders the Compose file, starts the selected digest without rebuilding~\cite{AnsibleCompose}, waits
for the container health check, and then checks
\url{https://staging.ssw590-08.me} for \texttt{/health}, version \texttt{v1},
the exact source commit, and a total of USD~30 for \texttt{quantity=3}. It
fails the run if any check fails; it does not roll back on its own.
\textbf{\Gls{idempotence}.} The \emph{Staging idempotence} stage runs exactly the
same command again and fails the build unless the recap shows
\texttt{changed=0 unreachable=0 failed=0}:
\begin{tabularx}{\linewidth}{L{2.6cm}Y}
\toprule
\textbf{Run} & \textbf{PLAY RECAP for \texttt{startup}}\\ \midrule
First & \texttt{ok=9 changed=3 unreachable=0 failed=0 skipped=0}\\
Second & \texttt{ok=9 changed=0 unreachable=0 failed=0 skipped=0}\\
\bottomrule
\end{tabularx}
\medskip
Jenkins run \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8} (November 12, 2026, 11:51 PM EST): the first run created the environment and started the
container (\texttt{changed=3}); the identical second run changed nothing, and the
stage's check matched the recap line
\texttt{startup : ok=9 changed=0 unreachable=0 failed=0}. In the second run every
task reported \texttt{ok}, including the public HTTPS health, release-identity,
and price checks (\texttt{"msg": "All assertions passed"}).
\delfig{staging-idempotence.png}{1.0}{November 12, 2026, run \#8 --- Jenkins
Staging idempotence stage: the second, unchanged run passes every check and
reports \texttt{changed=0}.}{fig:del-idempotence}
\delfig{staging-check.png}{1.0}{November 13, 2026 --- staging, v1:
\url{https://staging.ssw590-08.me/} returns version \texttt{v1} and commit
\texttt{2a35f97}, and \texttt{/price?quantity=3} returns a total of USD 30.}{fig:del-staging}
\section{Approve and Promote the Same Image}
\label{sec:del-promote}
\FillIn{kholmes: restricted Jenkins input step with timeout, approver and
decision, v1-production record with the same digest, production smoke tests}
\section{Release v2 and Exercise Two Recovery Cases}
\label{sec:del-v2}
\FillIn{kholmes: v2 release in both environments, healthy rollback of
production to v1, failed staging deployment (Gunicorn on 8001) and recovery,
timeline and measured interruption, state-compatibility discussion}
\section{Reuse Monitoring and Document Operations}
\label{sec:del-ops}
\FillIn{kholmes: production /health Blackbox probe and Grafana panel, release
and rollback timestamps correlated with monitoring, runbooks, approvers,
resource use, cleanup plan}
\section{Traceability}
\label{sec:del-trace}
\begin{tabularx}{\linewidth}{L{3.4cm}YY}
\toprule
\textbf{Item} & \textbf{v1} & \textbf{v2}\\ \midrule
Source commit & \texttt{2a35f97} & \FillIn{}\\
Configuration commit & \FillIn{} & \FillIn{}\\
Image digest & \texttt{sha256:ce91d055\ldots} & \FillIn{}\\
Jenkins build & \href{https://ci.ssw590-08.me/job/Scrap-Web/job/feature\%252Fissue-24-delivery/8/}{\#8} (staging) & \FillIn{}\\
Scan result & \FillIn{} & \FillIn{}\\
Staging result & Passed: health, v1, commit, total 30; rerun \texttt{changed=0} & \FillIn{}\\
Approver and time & \FillIn{} & \FillIn{}\\
Production result & \FillIn{} & \FillIn{}\\
\bottomrule
\end{tabularx}
\fussy
+6
View File
@@ -0,0 +1,6 @@
__pycache__
.venv
.ansible-venv
.git
*.pyc
requirements.in
+13
View File
@@ -0,0 +1,13 @@
# Base image pinned by digest (python:3.13-slim, linux/amd64 for the Droplet).
FROM python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90
ARG APP_COMMIT=development
ENV APP_COMMIT=$APP_COMMIT PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
# Exact, hash-checked dependency versions (direct + transitive) from requirements.txt
RUN pip install --no-cache-dir --require-hashes -r requirements.txt
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")
+2
View File
@@ -0,0 +1,2 @@
Flask>=3.1,<3.2
gunicorn>=23,<24
+190
View File
@@ -0,0 +1,190 @@
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.in --universal --python-version 3.13 --generate-hashes -o requirements.txt
blinker==1.9.0 \
--hash=sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf \
--hash=sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc
# via flask
click==8.5.1 \
--hash=sha256:8bb5376d2006950386f8c6427613334a2acadc5f559cb80e638d00b4df957e37 \
--hash=sha256:9bbfada76703fd1d784b83eea012e3e8c6a001a876543ef104fa56aaaeb072b4
# via flask
flask==3.1.3 \
--hash=sha256:0ef0e52b8a9cd932855379197dd8f94047b359ca0a78695144304cb45f87c9eb \
--hash=sha256:f4bcbefc124291925f1a26446da31a5178f9483862233b23c0c96a20701f670c
# via -r requirements.in
gunicorn==23.0.0 \
--hash=sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d \
--hash=sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec
# via -r requirements.in
itsdangerous==2.2.0 \
--hash=sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef \
--hash=sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173
# via flask
jinja2==3.1.6 \
--hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \
--hash=sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67
# via flask
markupsafe==3.0.4 \
--hash=sha256:007e1ffd9bf65bb6ee96df7b258fc632a4868dd5566037986c64781f35a36e98 \
--hash=sha256:02fa4acbc6a3fc5c693c34d4dd8c1130b7fe99cc915181b0ddd6f72aeb296002 \
--hash=sha256:03470d1a8268e692ecf79ecd565593e59d44219377a7ead61f1f1b94c1f7ff6b \
--hash=sha256:04e7902ba80ee4bac1d50a549606527a1dcf0476cd81403db41099d3b60ec653 \
--hash=sha256:051417f74bcaaefa316276e0ff723f541616ca51043d070da00249d9bddd3e3c \
--hash=sha256:05295589e619b9bed252a86b532b8e27350abc372d18ba89b59375325e91ec1e \
--hash=sha256:06de8ef6331f6e822c28d577dc8bf43fe398800477c49498f38fc38b67ff33fc \
--hash=sha256:0764a13d34cae40db7bbf3a09b7e9b491bf4603e20b263a7a9d6b8e324975d0a \
--hash=sha256:077293e425f28ec737dbcad442a71752e28f8ae27cde3d68acd1fb212091cd92 \
--hash=sha256:0930db9bdc62d22944e10b066448bb65dc9abe9112880c7cab8da54db4284d5f \
--hash=sha256:0cee7cb0f9a1b6892ea482237d9403b3d1b4603aee057d0ff01f0fac2d019a97 \
--hash=sha256:0d9c47709875fdb321452056622e930c52afbc07a7d780762fbb8b4d91ce6fa4 \
--hash=sha256:11935df9bf455ed0c04eb87bcd720f02b1fe5e02128a9430f23aed6f93336fc7 \
--hash=sha256:12a606a492de952afcb43b59a14aaaaad120e708d3663dd0fdf2d738d427a691 \
--hash=sha256:14bd2d845d62ab678eaf81da89d7b621b51756c72346745c1a594c09d49207a2 \
--hash=sha256:15ba9e28640feef770374b116a6f019c21f52404aeabe516aa7f800587b98cfc \
--hash=sha256:18a801868a884f216e784d7d14db2a4077143ce7610440aee2ce8f734e7cfcde \
--hash=sha256:1c0df495a977d10460a94941799c72d5b5ab03d3858d949b55b5a66c8f371c99 \
--hash=sha256:1caa2fa5a6184fb233153b35f654e6687bd555476f6170f29d8ee9be1a8b0af9 \
--hash=sha256:1e1451fab512d1bcc3dc26988ec1edb0b82c2db909132872cd9356070a6b63df \
--hash=sha256:1f1f9477e174582b0a1b583d60b66e1f2cf5d3fe12cee985e4aedf44766600e5 \
--hash=sha256:2628d3a8cb648ecebb3c5d6b0a1052d400e4d8b7ac0fb786be8d285b50040d17 \
--hash=sha256:26e9867520db70d37f7fb421a7f0d8adb40171011fb84ce869afa1a83370dfa8 \
--hash=sha256:2a6ef68ae94aed8721934072b27a3b654ea2100b97e4ab864cf1489c90926fbc \
--hash=sha256:2b2b1e18af909b448bb3cf9e3433366f7a8726271fc214e8b10e0f62a78c724b \
--hash=sha256:2cb3dd71fc6be918ad4264346a8ed69485f9b7ed7bf35495d8e22807cd6b8bea \
--hash=sha256:2d1b7d9308288661f56672b1b157d75fc536714d3638487bbea17b6318a78248 \
--hash=sha256:2dad610540cb2e6272855c178f08ae9a1c7ac258a7fb71660553a5f104b42741 \
--hash=sha256:2e5a7cd7fdd14fcb1ae5d7d8bf23d24fbd1daefd1fbca2580132e1ea75f098b5 \
--hash=sha256:2e9ad7dd851bf45fab9f75cbff4cb493fee9979e8d8c7c9c3ee119022518edd6 \
--hash=sha256:340cbb1957ba99929cbf19a75626d36ba1ae21d1730b287d1cf7f824a20c4fc7 \
--hash=sha256:34bdde374c5932765d7dc685c4a1d191a3207852d67e8e0a9eb6ea85156181f1 \
--hash=sha256:353bd63081912ab8cfa6a0c7d185934cdf8426f04c618bba6bc4b394f2069b67 \
--hash=sha256:387d8cd30e69b3f0a72877b9ae717033396404e19095b17fe89753a981fda44f \
--hash=sha256:3882fb412298575bae3b9c46868251f15cc69307359f87bb1b382e53d6e5a2c9 \
--hash=sha256:38fc55594dab834470b6733dead2ee9e3f657fb0608c769dcafa0ba5ab52f45c \
--hash=sha256:396ec4e65cc889f69786b3b89478b471cee5a3bcf468b9d9bb03e1a30fb291fc \
--hash=sha256:39dbacefc411633db5b4378b066a9aca70a3d7e2922c9e578d825f844026eeba \
--hash=sha256:3a93d9616ddecfb393727a0041a562cf0b15a244e20f2bd25efc7949be4c4f17 \
--hash=sha256:3d23795802fc8bd72534836d64489bbf0f67c088959091bdb22e10735a5107bf \
--hash=sha256:434139499bb20b502ed3baa1f169e618f924a97e7a777fea1a49446d80106cf6 \
--hash=sha256:436e3ffc6310d3c41878c601db29098102fe5d8a467c49da4a4125254e0980f2 \
--hash=sha256:489505b03f692c3f376394e49194fa7a7f9e8558d6e293a7056a0032b0c38163 \
--hash=sha256:4a540e2d3192792fc84eced57bef37851ccb2b41f73291bb17408eea77bcd278 \
--hash=sha256:4a7cdc2a420ca01058182da4253329764d4bfa055564d1eced90e6ba1e8b1d3d \
--hash=sha256:4bced6e2a6dba6a28f7dd3c6ce14df1b2dd495923f16ea484cad03decd463b2b \
--hash=sha256:4cf3468d5ec187ffffcaca8e61929a37448f215dafc1386a12c750a72fe53634 \
--hash=sha256:4e2c4809c14559aa7ef426f27fb35afbb38104c349a903bf8f3600456764bb38 \
--hash=sha256:4ed644d75aa94a2baf7ec3a96eaa160ea58c742eb9d27c6506053c5c40fc84ed \
--hash=sha256:4f6e0852a0283b1b1fd776eeb7b766a5f440b3e2bd31ab51af3b400585f3965c \
--hash=sha256:5066b244f576f91afc8ee3ba029a89f99d39c79b1853fe9d39bea9f0afbec148 \
--hash=sha256:5086f9975abb1ab531ee6afca1761e4b59a19b446f3f6522ed776963228cfe5a \
--hash=sha256:50b5bedc9ed8a94fc8857a42ef4f84a81ea88f8d4f05dc8705fb23ee6d8dcca7 \
--hash=sha256:52704c5d36eb6dda8866493decd61111fff86244c9b1ad225ca01b9e91e5970f \
--hash=sha256:55ffd6ce583d97dc71dc92e930324c8c0d25aea7e3ade6ae54ef77cedb096811 \
--hash=sha256:569d65055d367e3dcdf30c3f41119467b73d9ee9faf332bdf40402644f5ac08e \
--hash=sha256:57f9947a7e57a081c1e3e0a2dd0d2dcf290a4531450e6f611e30084c222a7295 \
--hash=sha256:5989cb26b2e1efc6a42216a9f6b5ee495ce5ace2e5b352a9af489976b32d1ee2 \
--hash=sha256:5c22873ad1f0532ba40fa1727f3c0fc1bbbaab6d373d4cbe3f0dc74b2e2521c7 \
--hash=sha256:5e8b3d0b18fd623afa12ecb2ce8d8becef69f9b5440c6330c7972200e0bb84b0 \
--hash=sha256:61631e08084be9e21a8967ec3139c7616ed7c5e9368e05c86d1b39562c8a57b6 \
--hash=sha256:64511c54db4e4987aef4c41923235927428729e8174c5dba488429be70a998ed \
--hash=sha256:6669c1bf34080161ce49c589cc512ef24d4c704ac9d2b2d3667f519c60418378 \
--hash=sha256:672d207103e6b16ca098611b0f9efad6bc00afd47c03d6ef62186495ca677dc0 \
--hash=sha256:6768d67d1bce64270e0fdc2e69309d68b9b18ae56ddf6c711d168e9d051c2cac \
--hash=sha256:6a45c3d514f2436064db00d7fc8778d888f0236ebfed649b53d13a59e69ad51b \
--hash=sha256:6bd9e1788e15bfcf6a9082de42e30387e7b85d211ab21e57a939bb8cfaaf8d96 \
--hash=sha256:6d2a9efe686f9de00d0d1ea32a4a5a86d558a2277501bd78d964214eab625e59 \
--hash=sha256:6da83a088f8ef93b2d483a8232a4dbf4d69d3d8496b568a03c56becac43e1808 \
--hash=sha256:7018d4af1cd272e847aa5917983ab5e83e4f6579f9dbfecd4a79c0ca80b144c2 \
--hash=sha256:71f88e749ea29f67f21f3b36433c1dc54c7729ed2a6d9e2da2e0d9e0d7b224eb \
--hash=sha256:737c9c3981998eba27f11786f84fddcbabc74068b72a4a1f454ea02094b57b65 \
--hash=sha256:73e77980c7207854f00fc4e71fb1626868d5740ab4012623d55c7a99ad122a72 \
--hash=sha256:799c39bdf5e2f1292fedd3009f7b3c9e760f10b2420cb9638d56920840ff6db8 \
--hash=sha256:7a83aa6e4805df46fed18e989d3d16f86ef60cb50bbc8d9ce3a6be89165fbf6e \
--hash=sha256:7d3391b2188d18737cb2fa147028b1096236eaa7e156446c650a489fa2cadc91 \
--hash=sha256:7e1636da3d8dfc220b6dd10264db5f2b165e4888c4518594898fbe381049af8a \
--hash=sha256:805c8b84534fa10891890f0e4be39f3a99e94615d93e8836bf9fa1fdca2feeb2 \
--hash=sha256:811d02d5122171c1941357efd8f9bf4ffe907b7f0a1a4e729a880e4be3f46e3e \
--hash=sha256:8138eb83940ec7299024d92d4dee45f601b9e6c5ffde9d25f4e35e326203c707 \
--hash=sha256:83b3944fea42a8400edf92fd1770fb8d0d4f7de651353bd2d8525a92dba69a21 \
--hash=sha256:849dd2bb0e5e4ab2b71c7191726a4a8d5aa8a610daa584728cbee0b710ddc4ef \
--hash=sha256:8698d70a8081ee8c090dbb394768b5789a1da8b131b5499f89d071dd3cfaf6be \
--hash=sha256:8781a792a070cf2bd1b86d3aa943894115faaba6e88122a7bf32d62072742453 \
--hash=sha256:88d59b473bfb03259722600839af9bbd7fa13a2eb514beefeedb95997882f69a \
--hash=sha256:8909c2f1c6dd65e054ac4b573a91c8384d1492281e55d82d159d653f7a13adf6 \
--hash=sha256:8965520ac587c94a4ac48b729be3d8b8de00af39699b17585dfb599babe77977 \
--hash=sha256:8b5d563170ff8ba3181caa967c99a3c804d1dedb702c7cb93a6a7c32247da978 \
--hash=sha256:8e124f974786f831d6043728e38296969d3579db8896fe004682f5758e613581 \
--hash=sha256:8f0fac8b13d14bb06c68195f849371924ae53dd7b1c00fed24650f704383b692 \
--hash=sha256:9240187afb63d2f9ddc3e032c670356fe941f6e20662ea168a5dc3f1f317e1b3 \
--hash=sha256:925f929d6b59a8b3f8b8c6ac363cd0af7eecc81efb3071770b3c6717c450a369 \
--hash=sha256:9348cbb300d224fe3b89793262cb093504d4ae927004468463f745188a193e4a \
--hash=sha256:9388003072b95f2f1e3fd908604194d653ba21330d811961a78b7da1a77e9e36 \
--hash=sha256:9438a2648b2195980cb2dd8e53ed7b8df91319e2d0b70ae61a9e1d1bc8d3bec9 \
--hash=sha256:94e4c421742086aeee4c32a506eec8859d7634aad943f7e6aacf70f813478768 \
--hash=sha256:94f5407f7bc64fa6463906b896f9904beeeb7dd8dc116ee8e9056c8714ff9916 \
--hash=sha256:971a3bbb75d97ae4e2e8f7d4834236f86f85f0c85e04ab2e191db1123b04f80b \
--hash=sha256:9e227f3dbe6bde7491cf0a9965d00b88c6b1a4a95d11480ddf88bb96d397c19f \
--hash=sha256:9e25feb9e330b63edb0278a0acdf85e50d0cb0fbf49c3084abbe4e24ae195346 \
--hash=sha256:9f098115c247e11d138ab83a28fa0323c77015007ea2df73ba5fd714dfefd67c \
--hash=sha256:a18f38cafc329bac5e3c2b96c765b4c96d3d103421ed22ab7988c1e3fce27464 \
--hash=sha256:a4bbd2d87dd233b9fc5812160c3d0ffbe42edc22a26ce0469f58479ede633fe9 \
--hash=sha256:a5fcffb37e602b0b3c1638a97746b9b96125caa9bcf6fa41d337a9261de231ee \
--hash=sha256:a8e9f292fcda89b324f2f5c91d13f1424a153e40fc2756f38ee23b15835ff300 \
--hash=sha256:a9f54054101545a9a9cccefddf54316aa6e4491611fcbef9e91b3b6bebec04f6 \
--hash=sha256:aa2c838cc024642cc04c6854232f32b43e5e22833dd11119c1766c7873b8370d \
--hash=sha256:ac0c7c9f1609b0c4c114feb1d7a3409564c7fb77e360bed9e97e5d25dfeaf868 \
--hash=sha256:add96447a86d205ab616665d53b2950ee81083757f56e6ea833c8b2917646b46 \
--hash=sha256:ae9dcb8fbe244cb82f8a6458b455b927a03685e383d9bacf1ea5ce180b96dc97 \
--hash=sha256:b4a635a0487774f841cb1fb62e907e7195cc95bc761e053184b8acc3ceb20733 \
--hash=sha256:b4d12837e0203bbace818ff4a7461afdcd78bcd782351cea148139180d7bcffe \
--hash=sha256:b61687d0828e72bf5cda24a2690188f37170bd31c9359ac97e4e66569f120a16 \
--hash=sha256:b807e598953730f82e4eae3bd30f6a122cf6b31c398c6b504c0e04c13c170429 \
--hash=sha256:b8cd1f918b26fd7b1832ece557cc18f2d8747309ff8b3f0ef9d4250c5ad67a39 \
--hash=sha256:b91cc9d336957239ff200f30097e6fea2dc6d6fb3c81e853eaa09eac904fd894 \
--hash=sha256:bd3ce56ae2cbae3ba82b683bc425cd7e48d2ed8b10f3e818186b6f5646d9271c \
--hash=sha256:be6cb0c799abb0e2ba3e618e6d28ddddf7e485f6c2ce938dfa237daf3905072c \
--hash=sha256:befb4158af32106b9a93db8d6d1d1cbbd418c0d5aca0cabb7b1780abf0c89169 \
--hash=sha256:bf053da3c97a4bc5ecfbb218cdd2983febd91c617be8367d139882aa11e490aa \
--hash=sha256:c02e8f18bdedba082cef725942ac823b9b60656db07f7e265cb31618dfd00d77 \
--hash=sha256:c1bc67752d5f21013cfe430df4062441714eab79f65a6a05e01505957e9c35fe \
--hash=sha256:c61750fadcd119d0825bcb7d7d675dd264dcc89cc05292aab5be68ebdbb374ad \
--hash=sha256:c90d5b3d4e944e065a301d741b3c1d784f6bd1f503aa68b4967e32b2ba313d85 \
--hash=sha256:c9a7f43c0b202b334cc9184af09bb8f21d3a209e038efaf106936fb69e6b026e \
--hash=sha256:cb96e6e088d6cf71c1ea977510948320234824cf226e32f6f6e044f7a9c82b34 \
--hash=sha256:cf63c214fe879a65e69a386f915e36104fc84254ab141240f8854602d8e0be2a \
--hash=sha256:d1aca03ede943eb80ab3d63bb082c84b7aab85ea83bd0fd0c200260945fb49d9 \
--hash=sha256:d2e56fd3b00222722abfb3f5f0759ddbae4b90811b5ad4343c64030ad1bde70c \
--hash=sha256:d5f93ebbeb8032d47e349328ec8662d973d9b05a70b3c35df1f91fe419b84749 \
--hash=sha256:d882a373d8093c2941e01291b7ced96e9cbe4781da9a7751ca7e6c70385e5214 \
--hash=sha256:d920abdfa61279ba1a2ef9484aab07bf03331f8c08a10120fa332353d06e6932 \
--hash=sha256:da2af0d7aebfc2074080d72efa6ab8317c62481ef1f896f65d9999c1c01f4494 \
--hash=sha256:dd8ea6ebee7aedbf7c749fa80521d9ccf1ba473e0d1e14805caafbaad281c889 \
--hash=sha256:de8b364c423ef0a4bad9069657d617f9a5d2b2062457a89b1fa16ee199c399c1 \
--hash=sha256:df1ae86ff54725a01fa1a0510b914ca53a161b7050be74f6204e24aded5971d0 \
--hash=sha256:dff05cb7016dff1e9fd68f4122c127b65dfc59de5306cfb7ad92f956f230bee2 \
--hash=sha256:e1a622f13970d81f95d0c72f9dc090dce9085fccfa4c9f2174377ee32bd15786 \
--hash=sha256:e49fb0d1ce92cfa0cb198cc5b1b11cdf9d0638658e2a2db2687e39db7c87fc78 \
--hash=sha256:e5c802729725bd07e2bc3ab7b76dc7e0bbfc53129d8f1eb1c002c24cf774717e \
--hash=sha256:e841068dc0be4cb6dfb5c890eb88cbdcff2f4a332393c7ec94e8e618bd32c1a8 \
--hash=sha256:e916035e3e9930cbdfdd10abf48861340221857f45509565898e012263f7b289 \
--hash=sha256:eba154571c16e032112afac0dc2dfe9e63c2ceb7aedd07bb7eecf2ce26d4dd4c \
--hash=sha256:f03460ff076f70ab595bb45a0205ccea1971443575b6920c52e755dec2b3fbfe \
--hash=sha256:f0ec3b750b59375eab5b0fb2b9254810c00a3375be6d789899f1055a1d556237 \
--hash=sha256:f291bcf42ae98eb5107edb162c3c998b4a89648fd8e99ed4cbd12705292788cd \
--hash=sha256:f61efe1d2fe0de16158a5fe1d1cf3c14bdb6aecd54d8938fd26512c525c1f624 \
--hash=sha256:f68edfc67aabac33708941f26f22a7b8e9f81429bc0cf249fcf7d66b23af8d19 \
--hash=sha256:fa95848c929b6a75f6848d3c9793e59db365ee436776e57db835cdbfa79ba977 \
--hash=sha256:fd9f8797427910198f95bced71ddfed61130d7e349213bfb8466c9c99e2c46a8 \
--hash=sha256:fdb4ca07ab75ffadab4a8b135ad59cdbb3156b99310f3d565370da74a15d6bd3
# via
# flask
# jinja2
# werkzeug
packaging==26.3 \
--hash=sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79 \
--hash=sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c
# via gunicorn
werkzeug==3.1.9 \
--hash=sha256:55ca7c70a75689be937aa27f8ff4b018f06ff4838fc73045560bf0f5a1291060 \
--hash=sha256:6392e50c78460ba618e5b21f08a71f59c99ce99cdc6cf6e3dd7e6ccca8754fab
# via flask
+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()
+6
View File
@@ -0,0 +1,6 @@
# Release records
One file per environment and release, e.g. `v1-staging.yml`, `v1-production.yml`.
Each holds metadata only (image digest, full source commit, expected version and
total, public URL, proxy network) - never credentials. Production uses the same
image digest as staging. Keep old records for rollback.
+8
View File
@@ -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