Harden delivery checks and record test-gate evidence
myfileagent-python-ci/pipeline/pr-main This commit looks good
myfileagent-python-ci/pipeline/pr-main This commit looks good
This commit is contained in:
@@ -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.' }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user