Add Jenkins CI service, pricing app, tests and Jenkinsfile (refs #14)
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good

Deploy Jenkins LTS 2.580.1 beside Gitea on The-Ocean:
- deploy/jenkins: official image pinned by digest plus python3 and a
  hashed 60-plugin lockfile (Pipeline + Gitea bundle tested by
  ci/jenkins-capacity, plus matrix-auth for named roles)
- compose: jenkins service with persistent jenkins-home, no published
  ports, 512 MiB RAM / 768 MiB RAM+swap / 0.75 CPU, 256 MiB heap
- Gitea webhooks restricted to the private jenkins host; Caddy alias
  keeps Jenkins->Gitea checkout and status traffic on the droplet
- Caddy serves ci.yebilly.me only to Stevens 155.246.0.0/16 and team
  IPs from the untracked .env

Add the instructor's pricing example, unit tests and Declarative
Jenkinsfile (checkout, syntax check, unit tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 18:55:59 -04:00
co-authored by Claude Opus 5.5
parent 1389c53165
commit ad35197ee4
8 changed files with 188 additions and 1 deletions
+36
View File
@@ -149,3 +149,39 @@ port; Caddy reaches it on the private `gitea_web` network.
```
Remove it with `docker rm -f color-buttons-app`, delete the block, and reload.
## Jenkins CI (Assignment 6 / Instructor Manual Chapter 4)
`jenkins/Dockerfile` extends the official `jenkins/jenkins:2.580.1-lts-jdk21`
image (digest pinned) with `python3` and the plugins in `jenkins/plugins.txt`.
Builds run on the controller's single executor. Jenkins publishes no port:
browsers reach it through Caddy at `https://ci.yebilly.me/login`, and the Gitea
webhook reaches `http://jenkins:8080/gitea-webhook/post` on the private network.
1. DNS: `A` record `ci` -> droplet IPv4.
2. On the droplet, put team source IPs in the untracked `~/gitea/.env`
(space separated CIDRs; Stevens 155.246.0.0/16 is already in the Caddyfile):
```bash
echo 'CI_TEAM_IPS=203.0.113.7/32' > ~/gitea/.env # example address
```
3. Copy `docker-compose.yml`, `Caddyfile` (with `cat >`, see above) and the
`jenkins/` folder, then:
```bash
cd ~/gitea
docker compose build jenkins
docker compose up -d jenkins
docker compose up -d --force-recreate gitea caddy # webhook allowlist + CI_TEAM_IPS + alias
```
4. Unlock Jenkins with `docker compose exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword`
(read it yourself; never paste it anywhere), install **no** suggested
plugins, create one named administrator per teammate, and set the Jenkins
URL to `https://ci.yebilly.me/`.
Operate:
```bash
docker compose restart jenkins # settings and jobs live in the jenkins-home volume
docker compose logs --tail 100 jenkins # failed build or webhook: check here, then
# Gitea repo Settings -> Webhooks -> Recent Deliveries
docker stats --no-stream; free -m # memory pressure on the 512 MB droplet
```