diff --git a/ci/HANDOFF.txt b/ci/HANDOFF.txt new file mode 100644 index 0000000..74fbf34 --- /dev/null +++ b/ci/HANDOFF.txt @@ -0,0 +1,50 @@ +Member 2 handoff — 2026-11-25 + +Owner: Gowri (Member 2), implementation assisted by Codex. +Branch: feature/final-ci-demo +Base: 5373351a7e7ac2bc0f34bae19c25383de3843ca7 (current merged Homework 9 main). +Workspace: /home/codex/ssw590-member2 +Get current revision: git rev-parse HEAD + +Implemented: +- Independent fixture reviewer; no edits to Member 1's reviewer/demo/tests. +- Exact-SHA/run/attempt/mode artifact contract and strict bounded ZIP parsing. +- Gitea Actions fixture workflow using existing pins and manual-latex runner. +- Separate Jenkins pipeline/job definition, existing assignment8-trusted agent + and gitea-jenkins-ci credential binding (value never read). +- Isolated pinned TeX container, final-project report mode and required chapter. +- Durable locked versions; immutable release reuse; no conflicting overwrite. +- ZIP manifest/hash and reviewed-file behavior gates. +- Live-only metric emitter and dashboard proposal (not deployed). +- 18 pipeline/publication tests passed in the pinned image; 2 existing + pricing tests passed. Host lacks pypdf, so 4 publication tests require + the image rather than host-only Python. + +Observed evidence: +- Gitea Actions run 35 succeeded on bed90200d2e309a63b644a5f138624e6710be3bf. +- Its exact artifact was downloaded through the actual authenticated route. +- Full final-project report compiled in the pinned container on the Droplet. +- Fixture version 1.0.1 ZIP passed all payload hashes and fresh extraction/ + runtime smoke verification. ci/evidence/fixture-run35.json records its hash. +- These downstream stages were executed directly in the isolated toolchain, + NOT by a Jenkins job. Subsequent fixes/tests must retain their own run IDs. + +Pending before calling Member 2 remotely complete: +- User creates the prepared Jenkins job from the signed-in browser; browser + click/type automation is unavailable in this chat. No API login was assumed. +- Run the latest successful Actions SHA/run/attempt through the Jenkins job; + verify credential access, stage execution and downloadable archive. +- Rehearse downstream failure/no-publication and retry in Jenkins itself. +- Agree source baseline and final version line with Member 1 (1.0 provisional). +- Integrate actual model/runtime, measured token/memory results, AI/human SWOT + text and reviewable metrics collector configuration. No fake/live substitution. +- Record final issue/comment, cloud-load screenshots, peer review and demo. + +Next operator action: +Read ci/OPERATIONS.txt and ci/jenkins-job.xml. Use the provided browser setup +snippet to create only final-project-fixture; keep existing jobs untouched. + +Persistence/cleanup: +Volume ssw590-final-project-state contains fixture reservations/releases. +Temporary container names begin ssw590-final-. Remove only the known current +container, never the state volume or unrelated application/monitoring services. diff --git a/ci/evidence/fixture-run35.json b/ci/evidence/fixture-run35.json new file mode 100644 index 0000000..610e19f --- /dev/null +++ b/ci/evidence/fixture-run35.json @@ -0,0 +1,10 @@ +{ + "source_sha": "bed90200d2e309a63b644a5f138624e6710be3bf", + "actions_run": "35", + "mode": "fixture", + "version": "1.0.1", + "payload_hashes": "passed", + "smoke": "passed", + "zip_sha256": "ecfecf00849828e22ad8be3e9f5dd3f330993fffa30224f3ab1eff13df94f4c6", + "execution": "isolated toolchain on Droplet; not a Jenkins job" +} diff --git a/ci/tests/test_release.py b/ci/tests/test_release.py new file mode 100644 index 0000000..e96716b --- /dev/null +++ b/ci/tests/test_release.py @@ -0,0 +1,71 @@ +"""Publication gate tests run in the pinned compiler image (which provides pypdf).""" +import importlib.util +import io +import json +from pathlib import Path +import sys +import tempfile +import unittest +import zipfile +sys.path.insert(0,str(Path(__file__).resolve().parents[2])) +from ci.final_project import identity,create_bundle,publish,digest + + +@unittest.skipUnless(importlib.util.find_spec('pypdf'), 'pypdf is supplied by the pinned TeX image') +class ReleaseTests(unittest.TestCase): + def setUp(self): + from pypdf import PdfWriter + from pypdf.generic import DictionaryObject,NameObject,DecodedStreamObject + self.temp=tempfile.TemporaryDirectory();self.addCleanup(self.temp.cleanup) + self.root=Path(self.temp.name);self.meta=identity('a'*40,'1','1','fixture') + self.review=self.root/'review';self.review.mkdir() + (self.review/'reviewed.py').write_text('print("hello")\n') + (self.review/'review.json').write_text(json.dumps(dict(source_commit='a'*40,model_id='fixture-model', + mode='fixture',status='corrected',summary='fixture',diff='fixture',input_tokens=24,output_tokens=8))) + self.bundle=self.root/'review.zip';create_bundle(self.review,self.bundle,self.meta) + self.pdf=self.root/'main.pdf' + writer=PdfWriter();page=writer.add_blank_page(width=1200,height=800) + font=DictionaryObject({NameObject('/Type'):NameObject('/Font'),NameObject('/Subtype'):NameObject('/Type1'),NameObject('/BaseFont'):NameObject('/Helvetica')}) + page[NameObject('/Resources')]=DictionaryObject({NameObject('/Font'):DictionaryObject({NameObject('/F1'):font})}) + stream=DecodedStreamObject();stream.set_data(('BT /F1 10 Tf 40 700 Td (1.0.1 '+ 'a'*40+' Configuring and Running the DevOps Pipeline) Tj ET').encode()) + page[NameObject('/Contents')]=writer._add_object(stream) + with self.pdf.open('wb') as f:writer.write(f) + self.manifest=dict(release_version='1.0.1',commit='a'*40,review_sha256=digest((self.review/'review.json').read_bytes()), + reviewed_sha256=digest((self.review/'reviewed.py').read_bytes()),pdf_sha256=digest(self.pdf.read_bytes()),run_id='1',attempt='1',mode='fixture') + self.write_manifest() + + def write_manifest(self): + self.pdf.with_name('build-manifest.json').write_text(json.dumps(self.manifest)) + + def run_publish(self,build='1'): + return publish(self.bundle,self.meta,self.pdf,self.root/'state',self.root/'out','1.0',build) + + def test_publish_and_retry_preserve_bytes(self): + name=self.run_publish();before=(self.root/'out'/name).read_bytes() + with zipfile.ZipFile(io.BytesIO(before)) as z: + manifest=json.loads(z.read('manifest.json')) + for path,sha in manifest['payload_sha256'].items():self.assertEqual(digest(z.read(path)),sha) + self.run_publish('2') + self.assertEqual((self.root/'out'/name).read_bytes(),before) + self.assertEqual(json.loads((self.root/'out/release.json').read_text())['jenkins_build'],'1') + + def test_report_mismatch_prevents_release(self): + self.manifest['reviewed_sha256']='b'*64;self.write_manifest() + with self.assertRaisesRegex(ValueError,'manifest'):self.run_publish() + self.assertFalse((self.root/'out').exists()) + self.assertFalse((self.root/'state/releases').exists()) + + def test_runtime_failure_prevents_release(self): + (self.review/'reviewed.py').write_text('raise RuntimeError("fixture")\n') + self.bundle.unlink();create_bundle(self.review,self.bundle,self.meta) + self.manifest['reviewed_sha256']=digest((self.review/'reviewed.py').read_bytes());self.write_manifest() + with self.assertRaisesRegex(ValueError,'smoke'):self.run_publish() + self.assertFalse((self.root/'state/releases').exists()) + + def test_existing_version_refuses_changed_review(self): + self.run_publish() + data=json.loads((self.review/'review.json').read_text());data['summary']='different' + (self.review/'review.json').write_text(json.dumps(data)) + self.bundle.unlink();create_bundle(self.review,self.bundle,self.meta) + self.manifest['review_sha256']=digest((self.review/'review.json').read_bytes());self.write_manifest() + with self.assertRaisesRegex(ValueError,'different reviewed payload'):self.run_publish('2') diff --git a/documentation/ci/build_manual.py b/documentation/ci/build_manual.py index ab8dfa2..3efa931 100644 --- a/documentation/ci/build_manual.py +++ b/documentation/ci/build_manual.py @@ -116,6 +116,9 @@ def main(): "FinalModel": review["model_id"], "FinalInputTokens": review["input_tokens"], "FinalOutputTokens": review["output_tokens"]} generated += r"\renewcommand{\DocumentVersion}{" + args.release_version + "}\n" + generated += r"\renewcommand{\AssignmentTitle}{DevOps Pipeline Final Project}" + "\n" + generated += r"\renewcommand{\AssignmentNumber}{Final}" + "\n" + generated += r"\renewcommand{\DocumentStatus}{" + args.mode + " validation}\n" for key, value in fields.items(): generated += "\\newcommand{\\" + key + "}{" + tex(value) + "}\n" (workspace / "final-reviewed.txt").write_bytes(review_files["reviewed.py"]) diff --git a/documentation/devopsConfiguringAndRunningDevOpsPipeline.tex b/documentation/devopsConfiguringAndRunningDevOpsPipeline.tex index ec58a57..da7ee55 100644 --- a/documentation/devopsConfiguringAndRunningDevOpsPipeline.tex +++ b/documentation/devopsConfiguringAndRunningDevOpsPipeline.tex @@ -111,7 +111,17 @@ and manifest. Payload hashes exclude the manifest itself; a companion digest covers the complete ZIP. Unit tests exercise malicious archives, wrong identity, corruption, runtime failure, mode separation and locked reservation. Build-specific results belong in retained logs, not invented static claims. +On November 25, fixture Actions +\href{https://myfileagent.tech/myfileagent/myfileagent-pipeline/actions/runs/35}{run 35} +succeeded on source \texttt{bed9020}. Its exact artifact was downloaded and +validated, and the report/tests/package path was exercised in the isolated +compiler on the Droplet. A fresh extraction of fixture ZIP 1.0.1 passed all +manifest hashes and printed \texttt{hello}. The retained record is +\path{ci/evidence/fixture-run35.json}. This was direct toolchain validation, +not evidence that a Jenkins job had run; later revisions require their own +job evidence. +\clearpage \section{SWOT comparison} \begin{tabularx}{\linewidth}{L{2.0cm}YY} \toprule & Gitea Actions & Jenkins \\ \midrule diff --git a/monitoring/final-project/README.txt b/monitoring/final-project/README.txt new file mode 100644 index 0000000..50edcbf --- /dev/null +++ b/monitoring/final-project/README.txt @@ -0,0 +1,24 @@ +Final-project monitoring integration — prepared, not deployed + +Use Member 1's measured live review metadata only. The metric adapter is: + python3 ci/final_project.py metrics --review-dir VERIFIED_LIVE_DIRECTORY \ + --completed-at MEASURED_COMPLETION_EPOCH --output DIRECTORY/final-project.prom + +Coordinate a dedicated host directory and readonly mount into Node Exporter. +Enable --collector.textfile and --collector.textfile.directory=/textfiles +in addition to the existing cpu, meminfo and filesystem collectors. Do not +replace the existing deployment Compose file with an unverified template. +The job's Actions container currently has no host-volume access. Use the +trusted integration step to transfer validated metrics to that host directory. + +Validate with Node Exporter target health and node_textfile_scrape_error == 0. +Retain last-run gauges through at least two 30-second scrapes. Unknown counts +are omitted and explicitly represented by *_available == 0. Do not substitute +zero tokens for an unknown count. Refresh/remove stale samples intentionally. + +Import/provision dashboard.json after review. Keep existing dashboard copies +in sync where the existing monitoring deployment requires it. Add annotations +for source SHA, Actions run/attempt and Jenkins build; use a fixed window. +Fixture metrics must not populate the live panels. Shared-host CPU includes +Zammad, pricing and other services. Record baseline and after observations; +do not manufacture load or claim per-model RSS from host available memory. diff --git a/monitoring/final-project/dashboard.json b/monitoring/final-project/dashboard.json new file mode 100644 index 0000000..4542096 --- /dev/null +++ b/monitoring/final-project/dashboard.json @@ -0,0 +1,189 @@ +{ + "title": "SSW590 final project \u2014 live evidence", + "uid": "ssw590-final-project", + "schemaVersion": 39, + "version": 1, + "timezone": "America/New_York", + "refresh": "30s", + "time": { + "from": "now-15m", + "to": "now" + }, + "panels": [ + { + "id": 1, + "title": "Live input tokens", + "type": "timeseries", + "gridPos": { + "x": 0, + "y": 0, + "w": 12, + "h": 8 + }, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "targets": [ + { + "expr": "review_input_tokens{mode=\"live\"}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + } + }, + { + "id": 2, + "title": "Live output tokens", + "type": "timeseries", + "gridPos": { + "x": 12, + "y": 0, + "w": 12, + "h": 8 + }, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "targets": [ + { + "expr": "review_output_tokens{mode=\"live\"}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + } + }, + { + "id": 3, + "title": "Host CPU", + "type": "timeseries", + "gridPos": { + "x": 0, + "y": 8, + "w": 12, + "h": 8 + }, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "targets": [ + { + "expr": "100 * (1 - avg by(instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[2m])))", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "percent" + }, + "overrides": [] + } + }, + { + "id": 4, + "title": "Available host memory", + "type": "timeseries", + "gridPos": { + "x": 12, + "y": 8, + "w": 12, + "h": 8 + }, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "targets": [ + { + "expr": "node_memory_MemAvailable_bytes{job=\"node\"}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "bytes" + }, + "overrides": [] + } + }, + { + "id": 5, + "title": "Token count availability", + "type": "timeseries", + "gridPos": { + "x": 0, + "y": 16, + "w": 12, + "h": 8 + }, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "targets": [ + { + "expr": "review_input_tokens_available{mode=\"live\"} or review_output_tokens_available{mode=\"live\"}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short" + }, + "overrides": [] + } + }, + { + "id": 6, + "title": "Seconds since review completed", + "type": "timeseries", + "gridPos": { + "x": 12, + "y": 16, + "w": 12, + "h": 8 + }, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "targets": [ + { + "expr": "time() - review_completed_timestamp_seconds{mode=\"live\"}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "s" + }, + "overrides": [] + } + } + ], + "templating": { + "list": [ + { + "name": "DS_PROMETHEUS", + "type": "datasource", + "query": "prometheus", + "label": "Prometheus" + } + ] + }, + "annotations": { + "list": [] + } +}