Files
myfileagent-pipeline/secure-delivery/Jenkinsfile.test-gate-demo
T
Codex 65e401172b
myfileagent-python-ci/pipeline/pr-main This commit looks good
Harden delivery checks and record test-gate evidence
2026-11-07 21:23:35 +00:00

27 lines
860 B
Plaintext

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.' }
}
}
}