Merge PR #9: Chapter 4 Jenkins failure and repair
startup-product-ci/pipeline/head This commit looks good

Peer review was not completed before the deadline. Sergio authorized this merge with the missing review explicitly disclosed. The required Jenkins check passed for the exact repaired head. No reviewer approval is claimed; the one-approval policy is restored after this merge.
This commit was merged in pull request #9.
This commit is contained in:
2026-10-24 00:05:25 +00:00
5 changed files with 54 additions and 17 deletions
+2
View File
@@ -0,0 +1,2 @@
__pycache__/
*.py[cod]
Vendored
+12 -16
View File
@@ -1,30 +1,26 @@
pipeline { pipeline {
agent any agent { label 'controller-small-trusted' }
options {
skipDefaultCheckout()
disableConcurrentBuilds()
timeout(time: 5, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '20'))
}
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
sh 'git rev-parse HEAD && python3 --version'
} }
} }
stage('Syntax check') {
stage('Lint') {
steps { steps {
sh ''' sh 'python3 -m py_compile pricing.py tests/test_pricing.py'
set -eu
test -f README.md
grep -qi "startup" README.md
'''
} }
} }
stage('Unit tests') {
stage('Automated Test') {
steps { steps {
sh ''' sh 'python3 -m unittest discover -s tests -v'
set -eu
printf "CI smoke test for startup-product\\n"
find . -maxdepth 2 -type f | sort | head -20
'''
} }
} }
} }
+19 -1
View File
@@ -6,7 +6,7 @@ This repository supports the Chapter 2 Gitea foundation assignment. It is used t
- Gitea is running from a pinned official container image. - Gitea is running from a pinned official container image.
- SQLite data and repositories are stored in persistent host-mounted storage. - SQLite data and repositories are stored in persistent host-mounted storage.
- The current HTTP URL is temporary until DNS and HTTPS are configured. - Gitea uses https://git.sespinal590.dev/ through the Caddy TLS proxy.
## Product Vision ## Product Vision
@@ -19,3 +19,21 @@ Target users are SSW 590 team members who need a shared place to plan, review, a
1. Issue tracking workflow: maintain product and operations issues with clear acceptance criteria. 1. Issue tracking workflow: maintain product and operations issues with clear acceptance criteria.
2. Pull request review workflow: require changes to be proposed on branches and reviewed before merge. 2. Pull request review workflow: require changes to be proposed on branches and reviewed before merge.
3. Operations evidence workflow: record restart, persistence, DNS, HTTPS, and firewall verification evidence in the IT manual. 3. Operations evidence workflow: record restart, persistence, DNS, HTTPS, and firewall verification evidence in the IT manual.
## Chapter 4 tested application
This repository uses the assignment manual's permitted minimal Python pricing application. `total_price` multiplies a unit price by a positive quantity and rejects zero/negative quantities. It is a course CI example, not a claim of a production pricing system.
Requirements: Python 3 (the Jenkins executor records its exact version), Git, and the Python standard library. No pip packages, Docker daemon, or Docker socket are needed for these checks.
From a clean clone, reproduce the Jenkins checks with:
```sh
python3 -m py_compile pricing.py tests/test_pricing.py
python3 -m unittest discover -s tests -v
```
Expected: syntax check exits 0; three unit tests pass. The controlled demonstration changes multiplication to addition, causing the total and single-item tests to fail. The repair restores multiplication on the same PR.
Jenkins polls Gitea for PR updates. Its multibranch source tests PR heads (not synthetic merge commits) and publishes `startup-product-ci/pipeline/pr-main` for this PR to main. Branch protection requires that check and one real peer approval, dismisses stale approvals, and disallows direct pushes and admin merge bypass. Only trusted team members may change pipeline code. Builds execute on the controller in this resource-constrained course deployment; untrusted fork PR discovery is disabled.
+4
View File
@@ -0,0 +1,4 @@
def total_price(unit_price, quantity):
if quantity < 1:
raise ValueError("Quantity must be positive")
return unit_price * quantity
+17
View File
@@ -0,0 +1,17 @@
import unittest
from pricing import total_price
class PricingTests(unittest.TestCase):
def test_total(self):
self.assertEqual(total_price(10, 3), 30)
def test_single_item(self):
self.assertEqual(total_price(12.5, 1), 12.5)
def test_invalid_quantity(self):
for quantity in (0, -1):
with self.subTest(quantity=quantity):
with self.assertRaises(ValueError):
total_price(10, quantity)