myfileagent-python-ci/pipeline/pr-main This commit looks good
60 lines
3.2 KiB
Markdown
60 lines
3.2 KiB
Markdown
# Assignment 6 Python CI
|
|
|
|
The pipeline runs on the trusted Jenkins controller executor. Only trusted
|
|
team members may change pipeline code. Do not supply secrets or privileged
|
|
Docker access to untrusted pull requests. Fork PR discovery is disabled.
|
|
|
|
The controller uses the official Jenkins LTS image recorded in compose.jenkins.yaml.
|
|
Python comes from that image's Debian package repositories; record the actual
|
|
Python version from each build. No pip dependencies or Docker socket are needed.
|
|
After replacing the container, run `sh ops/jenkins/install-python.sh` on the
|
|
Droplet before building. A restart retains Python; replacement requires reinstall.
|
|
Jenkins jobs and settings persist in the jenkins-home volume.
|
|
|
|
From the repository root, reproduce checks with:
|
|
|
|
python3 -m py_compile pricing.py tests/test_pricing.py
|
|
python3 -m unittest discover -s tests -v
|
|
|
|
Expected: both tests pass. Syntax or test failures must fail the Jenkins run.
|
|
Multibranch origin PR discovery tests the current PR revision, not a merged revision.
|
|
The printed checkout commit identifies what was actually tested.
|
|
|
|
Webhook delivery, status reporting, branch protection, and the controlled
|
|
failure/repair demonstration must be configured and verified separately.
|
|
|
|
## Gitea webhook and required merge gate
|
|
|
|
Configure the repository Gitea webhook with POST, application/json, active,
|
|
push and pull-request events, branch filter `*`, and target
|
|
`http://jenkins:8080/gitea-webhook/post`. Gitea must allow the exact `jenkins`
|
|
host through its webhook destination allowlist; see `compose.webhook.yaml`.
|
|
The deployed base Compose file includes this same environment setting.
|
|
The hook is configured manually, so Jenkins does not manage repository hooks.
|
|
|
|
The installed Gitea plugin handler does not verify a shared-secret signature.
|
|
Leave the hook secret empty and use the existing private Docker network.
|
|
Block `/gitea-webhook` and `/gitea-webhook/*` at the public Caddy site, as in
|
|
`Caddyfile.jenkins`. Raw port 8080 remains loopback-only. Do not claim HMAC
|
|
authentication, and do not expose the unsigned receiver publicly.
|
|
|
|
Require `myfileagent-python-ci/pipeline/pr-main` on `main`; this is the
|
|
observed PR-head context. The branch context ending `/pipeline/head` is
|
|
not the PR context. `main-branch-protection.json` records the applied rule:
|
|
no direct or force pushes, one approval, dismiss stale approvals, reject
|
|
changes-requested reviews, and no administrator merge override.
|
|
|
|
October 9, 2026 acceptance exercise, linked to issue #10 and PR #11:
|
|
- PR build 1 passed on ad056a3 after a real pull-request-open webhook.
|
|
- Commit d6477b3 changed multiplication to addition; PR build 2 failed with
|
|
`AssertionError: 13 != 30`; Gitea showed the required check failed.
|
|
- Commit 02d3169 restored multiplication; the webhook started PR build 3,
|
|
which passed both tests and updated the same required context.
|
|
- PR #11 remains open for reviewer nkogut. No review approval or merge has
|
|
been performed by automation.
|
|
|
|
For delivery diagnosis, inspect Gitea's recent delivery response and compare
|
|
its event/head SHA with Jenkins' console. A 200 `Processed` delivery alone
|
|
is not proof that tests passed. Save the failed and repaired PR gate views
|
|
before further commits. A new commit needs a new success status and review.
|