Author SHA1 Message Date
sespinal ed8684a289 Fix pricing multiplication and document clean CI run for issue #8
startup-product-ci/pipeline/pr-main This commit looks good
startup-product-ci/pipeline/head This commit looks good
2026-10-21 23:11:38 +00:00
sespinal 35605c33b9 Add pricing checks and controlled defect for issue #8
startup-product-ci/pipeline/pr-main There was a failure building this commit
2026-10-21 23:07:42 +00:00
Sergio b0eee02470 add-jenkins-ci-pipeline
startup-product-ci/pipeline/head This commit looks good
2026-10-07 05:27:05 +00:00
sespinal ff266cf33c Merge pull request #7
Approved by reviewer account for Chapter 2 workflow evidence.
2026-09-29 00:13:08 +00:00
sespinal 95573e8741 Merge main into backlog branch 2026-09-29 00:12:38 +00:00
sespinal a1db8766f3 Resolve backlog branch with product vision 2026-09-29 00:11:44 +00:00
sespinal 9ba3da247f Add feature backlog for issue 2 2026-09-29 00:01:29 +00:00
5 changed files with 75 additions and 1 deletions
+2
View File
@@ -0,0 +1,2 @@
__pycache__/
*.py[cod]
Vendored
+27
View File
@@ -0,0 +1,27 @@
pipeline {
agent { label 'controller-small-trusted' }
options {
skipDefaultCheckout()
disableConcurrentBuilds()
timeout(time: 5, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '20'))
}
stages {
stage('Checkout') {
steps {
checkout scm
sh 'git rev-parse HEAD && python3 --version'
}
}
stage('Syntax check') {
steps {
sh 'python3 -m py_compile pricing.py tests/test_pricing.py'
}
}
stage('Unit tests') {
steps {
sh 'python3 -m unittest discover -s tests -v'
}
}
}
}
+25 -1
View File
@@ -6,10 +6,34 @@ This repository supports the Chapter 2 Gitea foundation assignment. It is used t
- Gitea is running from a pinned official container image.
- 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
The startup product will help a small student team practice disciplined DevOps work by tracking product ideas, operations tasks, reviews, and deployment evidence in a self-hosted Gitea environment.
Target users are SSW 590 team members who need a shared place to plan, review, and preserve technical work. The first milestone is to keep the repository, issues, and pull request history available after container replacement.
## Initial Feature Backlog
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.
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)