Assignment 6: enforce Python CI before merging #11
@@ -0,0 +1,7 @@
|
|||||||
|
# Merge this site block into the deployment's existing Caddyfile.
|
||||||
|
# Gitea delivers directly to Jenkins through the private Docker bridge.
|
||||||
|
ci.myfileagent.tech {
|
||||||
|
@giteaHook path /gitea-webhook /gitea-webhook/*
|
||||||
|
respond @giteaHook "Webhook is available only on the private network" 403
|
||||||
|
reverse_proxy jenkins:8080
|
||||||
|
}
|
||||||
@@ -22,3 +22,38 @@ The printed checkout commit identifies what was actually tested.
|
|||||||
|
|
||||||
Webhook delivery, status reporting, branch protection, and the controlled
|
Webhook delivery, status reporting, branch protection, and the controlled
|
||||||
failure/repair demonstration must be configured and verified separately.
|
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.
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Apply with the existing base compose.yaml and compose.jenkins.yaml.
|
||||||
|
# Allows only the named Jenkins destination in addition to Gitea's default
|
||||||
|
# external destinations; never use '*' to allow every private address.
|
||||||
|
services:
|
||||||
|
gitea:
|
||||||
|
environment:
|
||||||
|
GITEA__webhook__ALLOWED_HOST_LIST: "external,jenkins"
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"branch_name": "main",
|
||||||
|
"rule_name": "main",
|
||||||
|
"priority": 1,
|
||||||
|
"enable_push": false,
|
||||||
|
"enable_push_whitelist": false,
|
||||||
|
"push_whitelist_usernames": [],
|
||||||
|
"push_whitelist_teams": [],
|
||||||
|
"push_whitelist_deploy_keys": false,
|
||||||
|
"enable_force_push": false,
|
||||||
|
"enable_force_push_allowlist": false,
|
||||||
|
"force_push_allowlist_usernames": [],
|
||||||
|
"force_push_allowlist_teams": [],
|
||||||
|
"force_push_allowlist_deploy_keys": false,
|
||||||
|
"enable_merge_whitelist": false,
|
||||||
|
"merge_whitelist_usernames": [],
|
||||||
|
"merge_whitelist_teams": [],
|
||||||
|
"enable_bypass_allowlist": false,
|
||||||
|
"bypass_allowlist_usernames": [],
|
||||||
|
"bypass_allowlist_teams": [],
|
||||||
|
"enable_status_check": true,
|
||||||
|
"status_check_contexts": [
|
||||||
|
"myfileagent-python-ci/pipeline/pr-main"
|
||||||
|
],
|
||||||
|
"required_approvals": 1,
|
||||||
|
"enable_approvals_whitelist": false,
|
||||||
|
"approvals_whitelist_username": [],
|
||||||
|
"approvals_whitelist_teams": [],
|
||||||
|
"block_on_rejected_reviews": true,
|
||||||
|
"block_on_official_review_requests": true,
|
||||||
|
"block_on_outdated_branch": false,
|
||||||
|
"dismiss_stale_approvals": true,
|
||||||
|
"ignore_stale_approvals": false,
|
||||||
|
"require_signed_commits": false,
|
||||||
|
"protected_file_patterns": "",
|
||||||
|
"unprotected_file_patterns": "",
|
||||||
|
"block_admin_merge_override": true,
|
||||||
|
"created_at": "2026-10-09T19:03:48Z",
|
||||||
|
"updated_at": "2026-10-09T19:04:32Z"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user