Fix noninteractive Ansible deployment and record delivery gates
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good

This commit is contained in:
2026-11-15 18:07:48 -05:00
parent 09731acb03
commit 5b703edc79
15 changed files with 313 additions and 57 deletions
+12 -1
View File
@@ -1,4 +1,15 @@
# Preparation evidence — not completed release evidence
# Assignment 8 evidence
## Reviewed Jenkins execution, 15 November 2026
PR 24 is merged. The actual [test/secret gate demonstrations](evidence/gates-20261115.md)
blocked as intended. [Release attempt 3](evidence/release-attempt-3-20261115.md)
passed scans and published v1, then stopped before any app change at the
Ansible PTY request. The noninteractive SSH correction was verified in
agent-preflight build 3 but awaits source review/merge. No successful promotion,
production approval or recovery has occurred.
## Preparation evidence — historical baseline
All timestamps below are UTC on 14 November 2026. No assessed application
release, image publication, production approval or rollback has occurred yet.
+12 -24
View File
@@ -1,27 +1,15 @@
# Prepare secure delivery and rollback for Assignment 8
# Fix noninteractive Ansible deployment over the restricted SSH key
The existing CI checks code but does not publish or promote an application.
Add the instructor's pricing service with locked inputs and a trusted-agent
pipeline for security gates, digest-based staging/production deployment,
unchanged Ansible reruns, recorded human approval and recovery operations.
Keep the earlier PR job separate from folder-scoped deployment credentials.
The first reviewed v1 release passed its tests and security gates and published
an image, but stopped during Ansible Gathering Facts: Ansible forced a PTY
that the dedicated deploy key forbids. Set `ansible_ssh_use_tty=false` in the
delivery inventory and extend the administrator preflight to exercise Ansible's
actual SSH/sudo path. Keep the key restriction and pinned host verification.
Include the reproducible agent/bootstrap, scan policy, runbooks, actual
prerequisite evidence and a clearly marked preparation chapter. Billy's DNS
records and Caddy HTTPS routes are now verified; app requests return 502 until
the backends are deployed. Monitoring additions await healthy production.
The release job is configured but disabled until reviewed source
reaches main. Assessed v1/v2 promotions and both recovery exercises remain
pending and will require separate reviewed changes and execution evidence.
Record the actual Jenkins test/secret blocks, passing image scans and publication,
zero-change staging connection failure, and successful connection preflight.
No app deployment or production approval is claimed. Retry v1 after merge;
v2 promotion, both recoveries and monitoring evidence still remain.
Validation: two existing tests, three Flask tests, twelve control tests;
controlled test/secret blocks; passing source/dependency and runtime-image
gates; Ansible syntax, agent Compose and installed Jenkins parser checks;
successful prerequisite builds 1 (laptop) and 2 (Droplet), including pinned
deployment SSH and noninteractive sudo. The agent now runs on the existing
2 GiB Droplet to avoid campus SSH restrictions, with separate agent/builder
resource caps and a passing bounded build/scan/smoke trial. Shared-host Docker
administration is documented. The original Gitea Actions runner also moved to
the Droplet with its existing identity, separate daemon/job caps and a passing
reviewed-main run 12 rerun (attempt 3); the initial low-memory attempt is retained.
No production approval or completed release is claimed.
Validation: credential-bound Jenkins agent-preflight build 3 passed and returned
root UID 0 through Ansible without a PTY; twelve release-control tests passed.
+17 -9
View File
@@ -8,8 +8,16 @@ Chapter 6 of instructor manual version 1.43.
`app/` contains the Flask/Gunicorn service, nine exact direct/transitive
dependencies, and a pinned Python 3.13 Alpine base digest for Linux/amd64.
The inventory selects The-Ocean's dedicated deploy account. The example
release record remains explicitly an example; real registry digests will be
generated by Jenkins after the source has been reviewed and merged.
release record remains explicitly an example; real registry digests are
generated by Jenkins from reviewed source.
Current execution status, 15 November: PR 24 is merged and the delivery job
is enabled. Real Jenkins test/secret demonstrations blocked as intended. The
first v1 image was scanned and published, but staging stopped before any app
change because Ansible requested a PTY forbidden by the deploy key. The
noninteractive inventory correction and expanded, passing Ansible preflight
await review/merge. See [gate evidence](evidence/gates-20261115.md) and
[release attempt 3](evidence/release-attempt-3-20261115.md).
Run the tests from `app/` after installing its requirements into the selected
Linux test environment. The expected v1 result for three units is USD 30.
@@ -60,7 +68,7 @@ No campus SSH connection is needed to run a delivery job from the browser.
passed using the dedicated deploy key, pinned host key and root sudo. Its
non-secret tool inventory is versioned in `evidence/agent-preflight-1.txt`.
The `secure-delivery/pricing` job loads `delivery/Jenkinsfile` from protected
main and is disabled pending reviewed source. Release credentials are scoped
main and was enabled after PR 24 merged. Release credentials are scoped
to that Jenkins folder; the PR job does not bind them or the Docker socket.
The original inventory above is historical. [Remote prerequisite build 2](https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/2/)
@@ -94,19 +102,19 @@ See `RUNBOOKS.md`.
Ansible syntax, agent Compose configuration, and the installed Jenkins
controller's declarative parser checks passed. These are preparation checks;
**v1/v2 registry releases, promotion and recovery are not yet demonstrated**.
**successful v1/v2 deployment, promotion and recovery are not yet demonstrated**.
## Remaining checkpoints
Vincent pushed preparation commit `bf28adc` and opened PR #24. The later
migration changes are uncommitted and need the same review path. Create the
issue and obtain Billy's PR review. Keep main protection. Billy added the A
Vincent merged PR #24, including runner migration and HTTPS, after Billy's
latest review. Review/merge the noninteractive Ansible correction before
retrying v1. Create the assignment issue if still absent. Keep main protection.
Billy added the A
records; Google and Cloudflare now resolve both names to `147.182.178.136`.
On 15 November Caddy's prepared routes were validated and gracefully reloaded;
both names have trusted HTTPS and HTTP redirects. They currently return 502
because the app containers are not deployed. See `evidence/https-20261115.md`.
Enable the
release job after the reviewed source reaches main, then follow `RUNBOOKS.md`.
The release job is enabled; follow `RUNBOOKS.md` after the corrected source reaches main.
Keep Jenkins and the remote delivery node available. Production approval requires an authorized
human; an agent must not approve unattended.
+6 -1
View File
@@ -6,7 +6,12 @@ Current status, 15 November 2026: Billy's DNS records resolve correctly and the
two Caddy routes are active with trusted certificates and HTTP-to-HTTPS redirects.
502 is expected while the app backends are absent. The one-time HTTPS helper
has already run; use the normal validate/reload procedure for later changes.
Monitoring additions and assessed releases remain pending.
The reviewed preparation is merged, the release job is enabled, and real
Jenkins test/secret blocks are recorded. Release build 3 published v1 but
stopped at Ansible's PTY request before any app change. Review/merge the
noninteractive inventory correction and retry from the corrected main SHA.
The expanded Ansible/sudo preflight passed; full deployment remains unverified.
Monitoring additions and successful releases remain pending.
## Authority and preparation
+4
View File
@@ -1,3 +1,7 @@
[delivery]
# The SSH host key must be verified and supplied by the trusted delivery job.
startup ansible_host=147.182.178.136 ansible_user=deploy ansible_python_interpreter=/usr/bin/python3
[delivery:vars]
# The dedicated deploy key forbids PTY allocation; sudo is noninteractive.
ansible_ssh_use_tty=false
+8
View File
@@ -23,6 +23,14 @@ docker compose version
trivy --version
pip-audit --version
ssh -i "$DEPLOY_KEY" -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o "UserKnownHostsFile=$DEPLOY_KNOWN_HOSTS" deploy@147.182.178.136 'id; sudo -n true; python3 --version; sudo -n docker --version; sudo -n docker compose version; free -m; nproc; df -h /'
# Exercise Ansible's own SSH/become path as well as plain SSH. Its default
# PTY request is incompatible with the intentionally restricted deploy key.
export ANSIBLE_HOST_KEY_CHECKING=True
export ANSIBLE_PRIVATE_KEY_FILE="$DEPLOY_KEY"
export ANSIBLE_SSH_ARGS="-o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$DEPLOY_KNOWN_HOSTS"
ansible all -i '147.182.178.136,' -u deploy --become \
-e '{"ansible_ssh_use_tty":false,"ansible_python_interpreter":"/usr/bin/python3"}' \
-m ansible.builtin.command -a 'id -u'
} > build/preflight/tools-and-target.txt
cat build/preflight/tools-and-target.txt
'''
+35
View File
@@ -0,0 +1,35 @@
Sun Nov 15 22:50:10 UTC 2026
uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins),987
Python 3.13.5
ansible [core 2.21.6]
config file = None
configured module search path = ['/home/jenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/delivery-tools/lib/python3.13/site-packages/ansible
ansible collection location = /opt/ansible-collections
executable location = /opt/delivery-tools/bin/ansible
python version = 3.13.5 (main, Aug 10 2026, 12:06:59) [GCC 14.2.0] (/opt/delivery-tools/bin/python3)
jinja version = 3.1.6
pyyaml version = 6.0.3 (with libyaml v0.2.5)
# /opt/ansible-collections/ansible_collections
Collection Version
---------------------------------------- -------
community.docker 5.4.0
community.library_inventory_filtering_v1 1.1.5
Docker version 29.9.3, build 5457199
Docker Compose version v5.7.1
Version: 0.76.2
pip-audit 2.10.1
uid=1000(deploy) gid=1000(deploy) groups=1000(deploy)
Python 3.12.3
Docker version 29.9.3, build 5457199
Docker Compose version v5.7.1
total used free shared buff/cache available
Mem: 1967 1239 86 3 817 728
Swap: 2047 413 1634
1
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 24G 15G 9.2G 61% /
147.182.178.136 | CHANGED | rc=0 >>
0
+31
View File
@@ -0,0 +1,31 @@
# Assessed Jenkins gate demonstrations — 15 November 2026
Reviewed source: `09731acb0370566471dd4e401e59bafe55e927dc`, the merge of
[PR 24](https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/24).
Billy (`bill`) approved the latest preparation head `ed0a862` at 21:06 UTC;
Vincent merged it at 21:59 UTC. The merge-triggered manual workflow
[run 13](https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/13)
passed in 2m25s before the delivery demonstrations began.
| Jenkins pricing run | Mode | Actual result |
|---|---|---|
| [1](https://ci.yebilly.me/job/secure-delivery/job/pricing/1/) | `blocked-test` | FAILURE as intended, 54.202 seconds. Twelve control tests and three normal Flask tests passed; the additional expected-total=-1 assertion failed against the real v1 total 30. All later security, publication, deployment and approval stages were skipped. |
| [2](https://ci.yebilly.me/job/secure-delivery/job/pricing/2/) | `blocked-secret` | FAILURE as intended, 31.375 seconds. Twelve control tests and three Flask tests passed. Clean-source scanning and all nine locked dependency audits passed; the generated synthetic-secret fixture was detected, blocking publication, deployment and approval. |
Run 1 began at 22:11:34.732 UTC. Run 2 began at 22:12:51.073 UTC;
its source gate ran from 22:13:14.233 to 22:13:20.115 UTC. The scanner itself
returned zero after writing a valid report; the gate wrapper returned one
because that report contained a finding. This is expected policy enforcement,
not a scanner execution error. The synthetic fixture is nonfunctional and
generated only in a temporary directory; captured match/code fields are redacted.
Jenkins archives the test and gate reports for each run. Exact local copies,
selected build metadata and console logs are retained in ignored
`build/evidence/assignment8-execution/jenkins-{1,2}/`. These two negative
demonstrations do not establish a successful release or production approval.
The job was enabled only after the merge. A bootstrap MODE choice parameter
allowed the first run to select `blocked-test`; the reviewed Jenkinsfile then
installed its normal four parameter definitions and retained its approval,
timeout, concurrency and ancestry checks. Existing credentials and access
permissions were unchanged.
@@ -0,0 +1,55 @@
# v1 publication and blocked deployment — 15 November 2026
[Pricing build 3](https://ci.yebilly.me/job/secure-delivery/job/pricing/3/)
ran in `release` mode from reviewed source/configuration commit
`09731acb0370566471dd4e401e59bafe55e927dc`. It began at 22:25:23.584 UTC,
took 77.799 seconds, and finished FAILURE. This was a published image followed
by a connection failure, **not a successful staging or production release**.
Tests, clean-source scanning and all nine locked dependency audits passed.
Both pre-push and registry-digest Trivy image reports analyzed two targets and
contained zero HIGH/CRITICAL findings. The agent built the image once, pushed
the source-SHA tag, pulled it back and verified this registry reference:
```text
git.yebilly.me/ssw590-group1/pricing@sha256:cccd47f112f839f3443c88c4d16fd7a1ed0fec2100a26464156526d53ccc2695
```
The generated staging/production records were timestamped 22:26:29.144 UTC.
Staging deployment began 22:26:33.530 and stopped at 22:26:39.422 UTC
(5.892 seconds), before any application configuration or container was created:
```text
TASK [Gathering Facts]
Failed to connect to the host via ssh: PTY allocation request failed on channel 0
startup : ok=0 changed=0 unreachable=1 failed=0
Ansible exit code: 4
```
Jenkins skipped the unchanged rerun and production approval/deployment.
The generated records and scans are archived in that build and copied to ignored
`build/evidence/assignment8-execution/jenkins-3/`. They are deliberately absent
from `delivery/releases/`: neither environment has been verified healthy.
## Correction and verification
Ansible's SSH connection plugin defaults to forcing a terminal. The deploy
key intentionally forbids PTY allocation. The inventory now selects
`ansible_ssh_use_tty=false` for the delivery group, matching that restriction.
See the official [Ansible 2.21 SSH connection options](https://docs.ansible.com/projects/ansible-core/2.21/collections/ansible/builtin/ssh_connection.html#parameter-use_tty).
Pinned host verification, key restrictions, credentials and sudo policy are unchanged.
The administrator-only preflight was extended to exercise Ansible's actual
SSH/become path using the same bound credentials, rather than plain SSH alone.
[Agent preflight build 3](https://ci.yebilly.me/job/secure-delivery/job/agent-preflight/3/)
passed in 17 seconds at 22:50 UTC. Its `ansible.builtin.command` invocation
of `id -u` returned `0`, proving the noninteractive module and sudo path.
The module reports CHANGED by default for a command; this is not a pricing
deployment or an unchanged-rerun result. Exact non-secret output is retained in
[`agent-preflight-3.txt`](agent-preflight-3.txt).
The source correction awaits Vincent's commit/push and Billy's review/merge.
Retry `release` from the corrected full main SHA; let the pipeline generate
fresh records for that reviewed source/configuration. Do not manually change
the failed attempt's record to imply a successful deployment or reuse it for
rollback. Retain its published image and reports as evidence.