Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fdfd00fa6 | |||
| 927df037b0 | |||
| dae5b47373 | |||
| 944ca0f203 | |||
| 1841a7d4ab | |||
| 12226285c6 | |||
| 7b73df19bd | |||
| d6787727f8 | |||
| 69f1fe05cf | |||
| c5172fca86 | |||
| 90c5d9a3b1 | |||
| f14abad27b | |||
| c46f127e8c | |||
| 05d3c58c3a | |||
| 3fcd04010a | |||
| ad37d148ed | |||
| c864ddd0d2 | |||
| 8979d92c00 | |||
| 17750b844b | |||
| fb2bac752a | |||
| 99acac3136 | |||
| 3b79b7e07a | |||
| 5c0ed9fbcd | |||
| 60019db7da | |||
| 2a35f97071 | |||
| d8a5d2717b | |||
| 5e17a009dc | |||
| 7e76950690 | |||
| 27f8f20275 | |||
| 98f86092a2 | |||
| 459838dfcd | |||
| 6553b4400c |
@@ -1 +1,2 @@
|
||||
__pycache__/
|
||||
security-reports/
|
||||
@@ -1,40 +1,340 @@
|
||||
// CI pipeline for Scrap-Web (SSW 590, Continuous Integration with Jenkins).
|
||||
// Runs for every pull request through the Multibranch Pipeline job and reports
|
||||
// its result to Gitea as a commit status. Uses only the Python 3 standard
|
||||
// library, so no packages are downloaded during the build.
|
||||
// Scrap-Web pipeline: Chapter 4 CI checks + Chapter 6 secure delivery.
|
||||
//
|
||||
// Trust boundary:
|
||||
// * Every build (branches and pull requests) runs the Chapter 4 checks on the
|
||||
// controller's built-in node. No credentials, no Docker socket.
|
||||
// * Delivery stages run only for trusted branches, on the 'delivery' agent,
|
||||
// which holds the Docker socket and the registry/deploy credentials.
|
||||
// TODO before submission: remove the feature branch from TRUSTED_BRANCH so
|
||||
// only reviewed code on main can deliver.
|
||||
//
|
||||
// Release version: major.minor.changelist = 1.0.<Jenkins build number>,
|
||||
// shown as the build name and used for the image tag, ZIP, and manual PDF.
|
||||
//
|
||||
// Two kinds of run:
|
||||
// * Normal run (DEPLOY_RECORD empty): test, scan, build once, publish, deploy
|
||||
// staging, prove idempotence, human approval, promote the SAME digest.
|
||||
// * Redeploy run (DEPLOY_RECORD = a committed release record, e.g.
|
||||
// releases/v1-production.yml): no build; redeploys exactly that record with
|
||||
// this commit's Ansible files. Used for rollback and failed-deploy recovery.
|
||||
// Production redeploys need the same approval.
|
||||
|
||||
def TRUSTED_BRANCH = 'main|feature/issue-24-delivery'
|
||||
// Jenkins user IDs allowed to approve production. Anonymous users cannot.
|
||||
def APPROVERS = 'samahk,kaylah7'
|
||||
// Semantic version: bump MAJOR_MINOR by hand for a feature or breaking release;
|
||||
// the changelist part is the Jenkins build number, so every build is unique.
|
||||
def MAJOR_MINOR = '1.0'
|
||||
|
||||
def deployRecord(String record) {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
|
||||
withEnv(["RECORD=${record}"]) {
|
||||
sh '''
|
||||
export PATH=/opt/ansible-venv/bin:$PATH
|
||||
ansible-playbook -i ansible/inventory.ini ansible/deploy.yml --syntax-check
|
||||
ansible-playbook -i ansible/inventory.ini ansible/deploy.yml \
|
||||
--private-key "$DEPLOY_KEY" -e @"$RECORD"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pipeline {
|
||||
// Builds run on the Jenkins controller executor (see the IT manual for the
|
||||
// documented risk). python3 must be installed in the Jenkins container.
|
||||
agent any
|
||||
agent none
|
||||
|
||||
parameters {
|
||||
string(name: 'DEPLOY_RECORD', defaultValue: '',
|
||||
description: 'Leave EMPTY for a normal release. For rollback/recovery, the path of a committed release record, e.g. releases/v1-production.yml')
|
||||
}
|
||||
|
||||
options {
|
||||
skipDefaultCheckout()
|
||||
timeout(time: 10, unit: 'MINUTES')
|
||||
disableConcurrentBuilds() // no competing releases
|
||||
timeout(time: 60, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(numToKeepStr: '50'))
|
||||
}
|
||||
|
||||
environment {
|
||||
REGISTRY = 'git.ssw590-08.me'
|
||||
IMAGE = 'git.ssw590-08.me/ssw-590-08/pricing'
|
||||
}
|
||||
|
||||
stages {
|
||||
// ---------------- Chapter 4 CI (all builds, controller) ----------------
|
||||
stage('CI checks') {
|
||||
agent { label 'built-in' }
|
||||
steps {
|
||||
checkout scm
|
||||
sh 'git rev-parse HEAD'
|
||||
sh 'python3 --version'
|
||||
sh 'python3 -m py_compile pricing.py tests/test_pricing.py'
|
||||
sh 'python3 -m unittest discover -s tests -v'
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- Chapter 6 delivery (trusted branches, agent) ---------
|
||||
stage('Delivery') {
|
||||
when {
|
||||
beforeAgent true
|
||||
branch pattern: TRUSTED_BRANCH, comparator: 'REGEXP'
|
||||
expression { (params.DEPLOY_RECORD ?: '').trim() == '' }
|
||||
}
|
||||
agent { label 'delivery' }
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
// Record exactly which commit is being tested, for traceability.
|
||||
sh 'git rev-parse HEAD'
|
||||
sh 'python3 --version'
|
||||
script {
|
||||
env.APP_COMMIT = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
|
||||
env.IMAGE_TAG = "${env.IMAGE}:${env.APP_COMMIT}"
|
||||
env.SEMVER = "${MAJOR_MINOR}.${env.BUILD_NUMBER}"
|
||||
env.SEMVER_TAG = "${env.IMAGE}:${env.SEMVER}"
|
||||
currentBuild.displayName = "#${env.BUILD_NUMBER} v${env.SEMVER}"
|
||||
}
|
||||
echo "Source commit: ${env.APP_COMMIT}"
|
||||
echo "Release version: ${env.SEMVER}"
|
||||
}
|
||||
}
|
||||
stage('Syntax check') {
|
||||
|
||||
stage('Unit tests') {
|
||||
steps {
|
||||
sh 'python3 -m py_compile pricing.py tests/test_pricing.py'
|
||||
dir('pricing') {
|
||||
sh '''
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -q --require-hashes -r requirements.txt
|
||||
.venv/bin/python -m py_compile app.py test_app.py
|
||||
.venv/bin/python -m unittest -v
|
||||
'''
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
}
|
||||
|
||||
// LaTeX: compile the IT manual on the Droplet, in the same TeX Live
|
||||
// image the Gitea Actions workflow uses (manual/ci/Dockerfile).
|
||||
// The agent talks to the host's Docker daemon, so files are copied
|
||||
// into and out of the container instead of bind-mounted.
|
||||
stage('Compile manual (LaTeX)') {
|
||||
steps {
|
||||
sh 'python3 -m unittest discover -s tests -v'
|
||||
sh '''
|
||||
docker build -q -t ssw590/manual-latex:1 manual/ci
|
||||
cid=$(docker create -w /work ssw590/manual-latex:1 latexmk devopsAssignment.tex)
|
||||
docker cp manual/. "$cid":/work
|
||||
if docker start -a "$cid"; then rc=0; else rc=$?; fi
|
||||
docker cp "$cid":/work/devopsAssignment.pdf "manual-$SEMVER.pdf" || true
|
||||
docker rm "$cid" > /dev/null
|
||||
[ "$rc" -eq 0 ] && [ -s "manual-$SEMVER.pdf" ] || { echo "Manual build failed"; exit 1; }
|
||||
echo "Manual compiled: manual-$SEMVER.pdf"
|
||||
'''
|
||||
archiveArtifacts artifacts: "manual-${env.SEMVER}.pdf", fingerprint: true
|
||||
}
|
||||
}
|
||||
|
||||
// 6.4.5: dependency and secret checks on the source. Fails closed:
|
||||
// a missing script, a scanner error, or a finding stops the run.
|
||||
stage('Security scan: source') {
|
||||
steps { sh 'bash security/scan.sh source' }
|
||||
post { always { archiveArtifacts artifacts: 'security-reports/**', allowEmptyArchive: true } }
|
||||
}
|
||||
|
||||
stage('Build image') {
|
||||
steps {
|
||||
dir('pricing') {
|
||||
sh 'docker build --build-arg APP_COMMIT="$APP_COMMIT" -t "$IMAGE_TAG" -t "$SEMVER_TAG" .'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 6.4.5: image vulnerability scan before publishing. Fails closed.
|
||||
stage('Security scan: image') {
|
||||
steps { sh 'bash security/scan.sh image "$IMAGE_TAG"' }
|
||||
post { always { archiveArtifacts artifacts: 'security-reports/**', allowEmptyArchive: true } }
|
||||
}
|
||||
|
||||
stage('Publish') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'gitea-registry-push',
|
||||
usernameVariable: 'REG_USER',
|
||||
passwordVariable: 'REG_TOKEN')]) {
|
||||
// Push, then delete the local copy and pull it back from the
|
||||
// registry, so the recorded digest is the registry's, not a local ID.
|
||||
sh '''
|
||||
printf '%s' "$REG_TOKEN" | docker login "$REGISTRY" -u "$REG_USER" --password-stdin
|
||||
docker push "$IMAGE_TAG"
|
||||
docker push "$SEMVER_TAG"
|
||||
docker image rm "$IMAGE_TAG" "$SEMVER_TAG"
|
||||
docker pull "$IMAGE_TAG"
|
||||
docker logout "$REGISTRY"
|
||||
docker image inspect "$IMAGE_TAG" --format '{{index .RepoDigests 0}}' > image-digest.txt
|
||||
echo "Published: $(cat image-digest.txt)"
|
||||
'''
|
||||
}
|
||||
script { env.IMAGE_DIGEST = readFile('image-digest.txt').trim() }
|
||||
writeFile file: 'build-record.txt', text: """version: ${env.SEMVER}
|
||||
source_commit: ${env.APP_COMMIT}
|
||||
version_tag: ${env.SEMVER_TAG}
|
||||
image_tag: ${env.IMAGE_TAG}
|
||||
image_digest: ${env.IMAGE_DIGEST}
|
||||
jenkins_build: ${env.BUILD_URL}
|
||||
"""
|
||||
archiveArtifacts artifacts: 'image-digest.txt, build-record.txt', fingerprint: true
|
||||
}
|
||||
}
|
||||
|
||||
// Deployment-ready ZIP named with the semantic version.
|
||||
stage('Package') {
|
||||
steps {
|
||||
sh '''
|
||||
rm -rf dist && mkdir -p "dist/pricing-$SEMVER"
|
||||
cp pricing/app.py pricing/requirements.txt pricing/Dockerfile "dist/pricing-$SEMVER/"
|
||||
cp -r ansible "dist/pricing-$SEMVER/ansible"
|
||||
cp build-record.txt "dist/pricing-$SEMVER/"
|
||||
printf '%s\n' "$SEMVER" > "dist/pricing-$SEMVER/VERSION"
|
||||
cd dist && python3 -m zipfile -c "pricing-$SEMVER.zip" "pricing-$SEMVER"
|
||||
python3 -m zipfile -l "pricing-$SEMVER.zip"
|
||||
'''
|
||||
archiveArtifacts artifacts: "dist/pricing-${env.SEMVER}.zip", fingerprint: true
|
||||
}
|
||||
}
|
||||
|
||||
// 6.4.6: deploy the digest just published to staging with Ansible,
|
||||
// then rerun unchanged and require changed=0 (idempotence).
|
||||
stage('Deploy staging') {
|
||||
steps {
|
||||
script {
|
||||
// Expected behaviour comes from the source, not from config.
|
||||
env.APP_VERSION = sh(script: "sed -n 's/^VERSION = \"\\(.*\\)\"/\\1/p' pricing/app.py", returnStdout: true).trim()
|
||||
def unit = sh(script: "sed -n 's/^UNIT_PRICE = //p' pricing/app.py", returnStdout: true).trim()
|
||||
env.EXPECTED_TOTAL = "${3 * (unit as Integer)}"
|
||||
writeFile file: "release-${env.APP_VERSION}-staging.yml", text: """target_env: staging
|
||||
release_image: ${env.IMAGE_DIGEST}
|
||||
expected_version: ${env.APP_VERSION}
|
||||
expected_commit: ${env.APP_COMMIT}
|
||||
expected_total: ${env.EXPECTED_TOTAL}
|
||||
release_version: ${env.SEMVER}
|
||||
public_url: https://staging.ssw590-08.me
|
||||
proxy_network: gitea-net
|
||||
"""
|
||||
}
|
||||
archiveArtifacts artifacts: "release-${env.APP_VERSION}-staging.yml", fingerprint: true
|
||||
deployRecord("release-${env.APP_VERSION}-staging.yml")
|
||||
}
|
||||
}
|
||||
|
||||
stage('Staging idempotence') {
|
||||
steps {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) {
|
||||
sh '''
|
||||
export PATH=/opt/ansible-venv/bin:$PATH
|
||||
ansible-playbook -i ansible/inventory.ini ansible/deploy.yml \
|
||||
--private-key "$DEPLOY_KEY" -e @release-$APP_VERSION-staging.yml | tee rerun.log
|
||||
grep -E 'startup +: .*changed=0 +unreachable=0 +failed=0' rerun.log \
|
||||
|| { echo "Second run changed something: not idempotent"; exit 1; }
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 6.4.7: restricted human approval, then promote the SAME digest.
|
||||
stage('Approve production') {
|
||||
steps {
|
||||
script {
|
||||
def scan = fileExists('security-reports/image-summary.txt') ?
|
||||
readFile('security-reports/image-summary.txt').trim() : 'see security-reports'
|
||||
// Only APPROVERS can approve; Abort or the timeout stops the run.
|
||||
timeout(time: 30, unit: 'MINUTES') {
|
||||
env.APPROVER = input(
|
||||
message: """Promote ${env.APP_VERSION} (release ${env.SEMVER}) to production (https://app.ssw590-08.me)?
|
||||
Source commit: ${env.APP_COMMIT}
|
||||
Image digest: ${env.IMAGE_DIGEST}
|
||||
Security scans: source and image gates PASSED (fixable HIGH/CRITICAL block).
|
||||
${scan}
|
||||
Staging: deployed, HTTPS health/version/commit/total ${env.EXPECTED_TOTAL} passed, rerun changed=0.""",
|
||||
ok: 'Approve and deploy to production',
|
||||
submitter: APPROVERS,
|
||||
submitterParameter: 'APPROVER')
|
||||
}
|
||||
env.APPROVED_AT = sh(script: 'date -Is', returnStdout: true).trim()
|
||||
echo "APPROVED by ${env.APPROVER} at ${env.APPROVED_AT}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy production') {
|
||||
steps {
|
||||
// Same digest and commit as staging; only environment and URL change. No rebuild.
|
||||
writeFile file: "release-${env.APP_VERSION}-production.yml", text: """target_env: production
|
||||
release_image: ${env.IMAGE_DIGEST}
|
||||
expected_version: ${env.APP_VERSION}
|
||||
expected_commit: ${env.APP_COMMIT}
|
||||
expected_total: ${env.EXPECTED_TOTAL}
|
||||
release_version: ${env.SEMVER}
|
||||
public_url: https://app.ssw590-08.me
|
||||
proxy_network: gitea-net
|
||||
approved_by: ${env.APPROVER}
|
||||
approved_at: ${env.APPROVED_AT}
|
||||
"""
|
||||
archiveArtifacts artifacts: "release-${env.APP_VERSION}-production.yml", fingerprint: true
|
||||
deployRecord("release-${env.APP_VERSION}-production.yml")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- Rollback / recovery: redeploy a committed record -----
|
||||
stage('Redeploy release record') {
|
||||
when {
|
||||
beforeAgent true
|
||||
branch pattern: TRUSTED_BRANCH, comparator: 'REGEXP'
|
||||
expression { (params.DEPLOY_RECORD ?: '').trim() != '' }
|
||||
}
|
||||
agent { label 'delivery' }
|
||||
stages {
|
||||
stage('Load record') {
|
||||
steps {
|
||||
checkout scm
|
||||
script {
|
||||
env.RECORD = params.DEPLOY_RECORD.trim()
|
||||
if (!(env.RECORD ==~ /releases\/[A-Za-z0-9._-]+\.yml/) || !fileExists(env.RECORD)) {
|
||||
error "No committed release record at ${env.RECORD}"
|
||||
}
|
||||
env.TARGET_ENV = sh(script: 'sed -n "s/^target_env: //p" "$RECORD"', returnStdout: true).trim()
|
||||
env.CONFIG_COMMIT = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
|
||||
}
|
||||
echo "Redeploying ${env.RECORD} to ${env.TARGET_ENV} with configuration commit ${env.CONFIG_COMMIT}"
|
||||
sh 'cat "$RECORD"'
|
||||
archiveArtifacts artifacts: "${env.RECORD}", fingerprint: true
|
||||
}
|
||||
}
|
||||
|
||||
stage('Approve redeploy') {
|
||||
when { environment name: 'TARGET_ENV', value: 'production' }
|
||||
steps {
|
||||
script {
|
||||
timeout(time: 30, unit: 'MINUTES') {
|
||||
env.APPROVER = input(
|
||||
message: "Redeploy ${env.RECORD} to PRODUCTION (configuration commit ${env.CONFIG_COMMIT})?",
|
||||
ok: 'Approve redeploy',
|
||||
submitter: APPROVERS,
|
||||
submitterParameter: 'APPROVER')
|
||||
}
|
||||
echo "APPROVED by ${env.APPROVER} at ${sh(script: 'date -Is', returnStdout: true).trim()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Redeploy') {
|
||||
steps {
|
||||
sh 'echo "Redeploy start: $(date -Is)"'
|
||||
deployRecord(env.RECORD)
|
||||
sh 'echo "Redeploy verified: $(date -Is)"'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success { echo 'All checks passed.' }
|
||||
success { echo 'All stages passed.' }
|
||||
failure { echo 'A stage failed: see the stage view for which one.' }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Secrets and host-specific values stay on the Droplet
|
||||
jenkins-agent.secret
|
||||
agent.secrets.env
|
||||
.env
|
||||
@@ -0,0 +1,31 @@
|
||||
# Trusted Jenkins delivery agent for Chapter 6.
|
||||
# Build context is the repository root (see agent/compose.yaml).
|
||||
FROM jenkins/inbound-agent:latest-jdk21
|
||||
|
||||
USER root
|
||||
|
||||
# Python 3 + venv for tests, pip-audit and Ansible; curl for checks
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends python3 python3-venv python3-pip ca-certificates curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Docker CLI + buildx plugin (client only; the daemon is the host's, via the mounted socket)
|
||||
COPY --from=docker:cli /usr/local/bin/docker /usr/local/bin/docker
|
||||
COPY --from=docker/buildx-bin /buildx /usr/libexec/docker/cli-plugins/docker-buildx
|
||||
|
||||
# Trivy scanner (image vulnerabilities + secret scanning)
|
||||
COPY --from=aquasec/trivy:latest /usr/local/bin/trivy /usr/local/bin/trivy
|
||||
|
||||
# Ansible in its own virtual environment, plus the community.docker collection
|
||||
ENV ANSIBLE_COLLECTIONS_PATH=/opt/ansible-collections
|
||||
COPY ansible/requirements.yml /tmp/ansible-requirements.yml
|
||||
RUN python3 -m venv /opt/ansible-venv \
|
||||
&& /opt/ansible-venv/bin/pip install --no-cache-dir ansible-core \
|
||||
&& /opt/ansible-venv/bin/ansible-galaxy collection install -r /tmp/ansible-requirements.yml -p /opt/ansible-collections \
|
||||
&& rm /tmp/ansible-requirements.yml
|
||||
|
||||
# pip-audit in a separate tools venv
|
||||
RUN python3 -m venv /opt/tools-venv \
|
||||
&& /opt/tools-venv/bin/pip install --no-cache-dir pip-audit
|
||||
|
||||
USER jenkins
|
||||
@@ -0,0 +1,41 @@
|
||||
# Trusted delivery agent. Connects to the existing Jenkins controller over the
|
||||
# internal gitea-net network (WebSocket), so no new port is published.
|
||||
services:
|
||||
jenkins-agent:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: agent/Dockerfile
|
||||
image: ssw590/jenkins-delivery-agent:1
|
||||
container_name: jenkins-agent
|
||||
restart: unless-stopped
|
||||
# Start agent.jar directly. The secret is read from a file (-secret @file),
|
||||
# so it never appears in the process list, docker inspect, or Git.
|
||||
entrypoint:
|
||||
- java
|
||||
- -jar
|
||||
- /usr/share/jenkins/agent.jar
|
||||
- -url
|
||||
- http://jenkins:8080/
|
||||
- -webSocket
|
||||
- -name
|
||||
- delivery-agent
|
||||
- -workDir
|
||||
- /home/jenkins/agent
|
||||
- -secret
|
||||
- "@/run/secrets/jenkins-agent-secret"
|
||||
# Host Docker socket: needed to build/push images. This is effectively root
|
||||
# on the Droplet, so only reviewed main-branch delivery jobs may use this agent.
|
||||
group_add: ["${DOCKER_GID:?set DOCKER_GID in .env}"]
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./jenkins-agent.secret:/run/secrets/jenkins-agent-secret:ro
|
||||
- agent_home:/home/jenkins # workspace, known_hosts, registry login
|
||||
networks: [gitea-net]
|
||||
|
||||
networks:
|
||||
gitea-net:
|
||||
external: true
|
||||
name: gitea-net
|
||||
|
||||
volumes:
|
||||
agent_home:
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Print tool versions inside the agent. From the repo root on the Droplet:
|
||||
# docker exec -i jenkins-agent sh -s < agent/versions.sh
|
||||
echo "== java"; java -version 2>&1 | head -1
|
||||
echo "== python"; python3 --version
|
||||
echo "== docker"; docker version --format 'client {{.Client.Version}} / server {{.Server.Version}}'
|
||||
echo "== buildx"; docker buildx version
|
||||
echo "== trivy"; trivy --version | head -1
|
||||
echo "== pip-audit"; /opt/tools-venv/bin/pip-audit --version
|
||||
echo "== ansible"; /opt/ansible-venv/bin/ansible --version | head -3
|
||||
echo "== collections"; /opt/ansible-venv/bin/ansible-galaxy collection list community.docker 2>/dev/null | tail -2
|
||||
echo "== os"; . /etc/os-release; echo "$PRETTY_NAME $(uname -m)"
|
||||
@@ -0,0 +1,62 @@
|
||||
- name: Deploy a selected immutable pricing release
|
||||
hosts: delivery
|
||||
become: true
|
||||
vars:
|
||||
project_dir: "/opt/startup/pricing-{{ target_env }}"
|
||||
tasks:
|
||||
- name: Validate release selection
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- target_env in ['staging', 'production']
|
||||
- "'@sha256:' in release_image"
|
||||
- expected_version in ['v1', 'v2']
|
||||
- expected_total | int > 0
|
||||
- public_url.startswith('https://')
|
||||
- proxy_network | length > 0
|
||||
- name: Create deployment directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ project_dir }}"
|
||||
state: directory
|
||||
mode: '0750'
|
||||
- name: Render selected Compose configuration
|
||||
ansible.builtin.template:
|
||||
src: compose.yaml.j2
|
||||
dest: "{{ project_dir }}/compose.yaml"
|
||||
mode: '0640'
|
||||
- name: Converge application without rebuilding
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ project_dir }}"
|
||||
project_name: "pricing-{{ target_env }}"
|
||||
state: present
|
||||
build: never
|
||||
pull: missing
|
||||
wait: true
|
||||
wait_timeout: 90
|
||||
- name: Verify health through public TLS endpoint
|
||||
ansible.builtin.uri:
|
||||
url: "{{ public_url }}/health"
|
||||
return_content: true
|
||||
validate_certs: true
|
||||
register: health
|
||||
until: health.status == 200 and health.json.status == 'ok'
|
||||
retries: 12
|
||||
delay: 5
|
||||
changed_when: false
|
||||
- name: Read release identity
|
||||
ansible.builtin.uri:
|
||||
url: "{{ public_url }}/"
|
||||
return_content: true
|
||||
register: identity
|
||||
changed_when: false
|
||||
- name: Exercise business behavior
|
||||
ansible.builtin.uri:
|
||||
url: "{{ public_url }}/price?quantity=3"
|
||||
return_content: true
|
||||
register: price
|
||||
changed_when: false
|
||||
- name: Check release identity and calculation
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- identity.json.version == expected_version
|
||||
- identity.json.commit == expected_commit
|
||||
- price.json.total | int == expected_total | int
|
||||
@@ -0,0 +1,4 @@
|
||||
[delivery]
|
||||
# Target: the existing Droplet, reached over SSH as the dedicated deploy account.
|
||||
# Host key must be verified and pinned in the agent's known_hosts before first use.
|
||||
startup ansible_host=147.182.179.191 ansible_user=deploy
|
||||
@@ -0,0 +1,3 @@
|
||||
collections:
|
||||
- name: community.docker
|
||||
version: ">=4.8.0,<6.0.0"
|
||||
@@ -0,0 +1,19 @@
|
||||
services:
|
||||
app:
|
||||
image: "{{ release_image }}"
|
||||
restart: unless-stopped
|
||||
read_only: true
|
||||
tmpfs:
|
||||
- /tmp
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
networks:
|
||||
edge:
|
||||
aliases:
|
||||
- "pricing-{{ target_env }}"
|
||||
networks:
|
||||
edge:
|
||||
external: true
|
||||
name: "{{ proxy_network }}"
|
||||
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 159 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 220 KiB |
|
After Width: | Height: | Size: 617 KiB |
|
After Width: | Height: | Size: 169 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 422 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 174 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 264 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 160 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 432 KiB |
|
After Width: | Height: | Size: 235 KiB |
|
After Width: | Height: | Size: 151 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 522 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 472 KiB |
|
After Width: | Height: | Size: 257 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 281 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 172 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 149 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 181 KiB |
|
After Width: | Height: | Size: 216 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 446 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 155 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 220 KiB |
|
After Width: | Height: | Size: 309 KiB |
|
After Width: | Height: | Size: 435 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 171 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 234 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 32 KiB |
@@ -1,4 +1,3 @@
|
||||
% This file acts as the entry point for AI
|
||||
\chapter{AI Agent Usage Guide}
|
||||
\ChapterLabel{AIAgentGuide}
|
||||
\index{AI agent}
|
||||
|
||||
@@ -60,4 +60,74 @@ directly. Unresolved assumptions: chapter labels for the Digital Ocean
|
||||
Docker Deployment and class-based JavaScript refactor chapters not
|
||||
confirmed, as the assistant did not create those two chapters.
|
||||
|
||||
\item \textbf{Automated manual build.} Date: October 8--9, 2026. Tool and
|
||||
model: Claude, model claude-opus-5-5. Task: plan the team work split, create
|
||||
the reproducible build configuration (\texttt{.latexmkrc}), the Gitea
|
||||
Actions workflow, the job-image Dockerfile, and draft the Automated Manual
|
||||
Build chapter. Inputs: assignment instructions; the manual's LaTeX source.
|
||||
Output used: build configuration, workflow, Dockerfile, chapter text for
|
||||
sections 1, 3 and 5. Human review and corrections: the build command and
|
||||
workflow shell steps were tested by compiling the manual in the assistant's
|
||||
sandbox; the student moved the manual from issue~5 to a dedicated issue~8
|
||||
branch. Unresolved assumptions: runner label \texttt{latex} and the TL2025
|
||||
job image are pending the runner registration.
|
||||
|
||||
|
||||
\item \textbf{Continuous integration with Jenkins.} Date: October 18--24,
|
||||
2026. Tool and model: Claude, model claude-opus-5-5. Task: split the work,
|
||||
guide the Gitea integration account, branch protection and pull-request
|
||||
demonstration, write the pricing tests and \texttt{Jenkinsfile}, and draft
|
||||
and edit the Continuous Integration chapter. Inputs: assignment
|
||||
instructions; sanitized screenshots, console logs, and commit IDs. Output
|
||||
used: \texttt{Jenkinsfile}, tests, chapter text, and edits merging both
|
||||
partners' sections. Human review and corrections: the students ran every
|
||||
step on the real services and supplied the evidence; the assistant's claims
|
||||
were checked against the screenshots (for example, the token scopes).
|
||||
Unresolved assumptions: none.
|
||||
|
||||
\item \textbf{SRE monitoring and reliability.} Date: October 25--29, 2026.
|
||||
Tool and model: Claude, model claude-opus-5-5. Task: split the work, choose
|
||||
pinned releases, write the monitoring Compose, Prometheus, Blackbox, Grafana
|
||||
provisioning and dashboard files and the runbook, guide the alert set-up
|
||||
and incident exercise, and draft sections of the SRE chapter. Inputs:
|
||||
assignment instructions; baseline and \texttt{docker stats} output;
|
||||
Prometheus API query output; Grafana and Discord screenshots. Output used:
|
||||
configuration files, dashboard JSON, runbook, and chapter text. Human review
|
||||
and corrections: the student deployed and ran everything on the Droplet;
|
||||
the SMTP failure led to the Discord route; an incorrect alert condition and
|
||||
summary found during testing were corrected; all timestamps come from the
|
||||
recorded logs and screenshots. Unresolved assumptions: none.
|
||||
|
||||
\item \textbf{SRE chapter completion.} Date: October 30, 2026. Tool and
|
||||
model: Claude (configured model claude-sonnet-5-5). Task: complete the
|
||||
\texttt{HostDiskLow} alert subsection and its repeat test; merge the two
|
||||
exported alert rules into one file; draft the capacity and retention
|
||||
rationale, the deployment diagram, the SLI, SLO, and SLA definitions and
|
||||
worked example, the metric inventory, and the access-control text; add the
|
||||
Hosts and Passwords rows. Inputs: manual Chapter 5; the existing chapter
|
||||
text and Compose file; Grafana, Discord, and terminal screenshots; the
|
||||
exported alert-rule YAML. Output used: chapter text, a Graphviz diagram, and
|
||||
\texttt{alert-rules.yaml}. Human review and corrections: the students ran
|
||||
every test and supplied all evidence; a Grafana address in an early export
|
||||
command was wrong and returned an empty file, which was caught from the
|
||||
output and corrected. Unresolved assumptions: the probe route from Blackbox
|
||||
Exporter to the public hostnames is inferred from the Compose networks, not
|
||||
tested.
|
||||
|
||||
\item \textbf{Secure delivery and rollback.} Date: November 12--13, 2026.
|
||||
Tool and model: Claude (configured model claude-opus-5-5). Task: split the
|
||||
work; write the delivery agent Dockerfile and Compose file, the hash-locked
|
||||
requirements, the Dockerfile changes, and the \texttt{Jenkinsfile} stages for
|
||||
publishing, staging, idempotence, restricted approval, production promotion,
|
||||
and record-based redeployment; guide the registry, deploy-account, Caddy,
|
||||
rollback, failure, and monitoring steps; draft and edit Chapter 11 and the
|
||||
deployment diagram. Inputs: manual Chapter 6 and its starter files; Jenkins
|
||||
console output, screenshots, release records, commit hashes, and per-second
|
||||
probe logs supplied by the students. Output used: the files above and
|
||||
chapter text. Human review and corrections: the students ran every step on
|
||||
the real services and supplied all evidence; a registry token pasted into
|
||||
the chat was revoked and replaced; Jenkins times were found to be UTC and
|
||||
converted to EST; the Prometheus edit was found not to be loaded and the
|
||||
container was recreated. Unresolved assumptions: none.
|
||||
|
||||
\end{itemize}
|
||||
@@ -9,6 +9,7 @@
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{amsmath,amssymb}
|
||||
\usepackage{array}
|
||||
\usepackage{seqsplit}
|
||||
\usepackage{booktabs}
|
||||
\usepackage{longtable}
|
||||
\usepackage{tabularx}
|
||||
@@ -40,10 +41,10 @@
|
||||
\newcommand{\CourseName}{DevOps}
|
||||
\newcommand{\Instructor}{Samah Keshiro and Kayla Holmes}
|
||||
\newcommand{\Organization}{Stevens Institute of Technology}
|
||||
\newcommand{\DocumentDate}{10/10/26}
|
||||
\newcommand{\DocumentDate}{November 13, 2026}
|
||||
\newcommand{\DueDate}{[Due Date and Time]}
|
||||
\newcommand{\VERSION}{Version 1.5}
|
||||
\newcommand{\AssignmentNumber}{5}
|
||||
\newcommand{\VERSION}{Version 1.7}
|
||||
\newcommand{\AssignmentNumber}{7}
|
||||
|
||||
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
|
||||
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
|
||||
@@ -135,7 +136,10 @@
|
||||
\include{devopsPasswordsAndHosts}
|
||||
\include{devopsAutomatedManualBuild}
|
||||
\include{devopsCI}
|
||||
\include
|
||||
\include{devopsSRE}
|
||||
\include{devopsSecureDelivery}
|
||||
|
||||
\printglossaries
|
||||
|
||||
\bibliographystyle{IEEEtran}
|
||||
\bibliography{devopsReferences}
|
||||
@@ -143,4 +147,6 @@
|
||||
\appendix
|
||||
\include{devopsAIPromptLog}
|
||||
|
||||
\printindex
|
||||
|
||||
\end{document}
|
||||
@@ -22,8 +22,7 @@
|
||||
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/.gitea/workflows/manual.yml}
|
||||
\item[Tracking issue:]
|
||||
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/issues/8}
|
||||
\item[Pull request:] \textit{[link to the merged pull request from
|
||||
\texttt{issue-8} into \texttt{main}]}
|
||||
\item[Pull request:] \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/9}
|
||||
\end{description}
|
||||
|
||||
The manual is stored in the \texttt{manual/} folder of the team's existing
|
||||
@@ -48,8 +47,12 @@ not rebuild the manual. Merging a pull request into \texttt{main} counts as
|
||||
such a push. The workflow can also be started by hand from the Actions tab
|
||||
(\texttt{workflow\_dispatch}).
|
||||
|
||||
\textit{[Figure: Actions tab showing a run triggered by the merge commit into
|
||||
\texttt{main}, dated.]}
|
||||
\begin{figure}
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/actions.png}
|
||||
\caption{10/09/26 Screenshot of Actions tab}
|
||||
\label{fig:actions}
|
||||
\end{figure}
|
||||
|
||||
\textbf{Git remote and network path:} team members push over HTTPS. The
|
||||
remote is configured as:
|
||||
@@ -84,9 +87,44 @@ same HTTPS URL. Because all traffic is initiated by the runner, no submission
|
||||
or management port has to be opened for it.
|
||||
|
||||
\section{Runner Setup}
|
||||
\textit{[To be completed with the runner registration (Part 2): version,
|
||||
location, scope, label \texttt{latex}, execution mode, capacity, network path,
|
||||
and a screenshot of the runner online with a job assigned.]}
|
||||
|
||||
Gitea Actions was enabled for the Scrap-Web repository to support automated builds of the DevOps IT manual. A Gitea Actions runner was registered to execute workflow jobs. The runner was configured with the label \texttt{latex}, allowing the workflow to select the appropriate execution environment through the \texttt{runs-on: latex} setting in \texttt{.gitea/workflows/manual.yml}. The runner uses \texttt{act\_runner} and executes the build job in a Docker container based on the custom image \texttt{latex-job:local}. This image provides the TeX Live environment and the additional tools required to compile the LaTeX document, including \texttt{latexmk}, \texttt{latexminted}, and Pygments. \subsection{Runner Details} The runner configuration is summarized below. \begin{itemize} \item \textbf{Location:} The runner was hosted on a local macOS computer using Docker Desktop, separate from the DigitalOcean Droplet hosting Gitea. \item \textbf{Version:} Gitea Actions runner \texttt{act\_runner} version 0.6.1. \item \textbf{Execution mode:} Docker-based job execution using the custom image \texttt{latex-job:local}. Each job runs in a temporary container. \item \textbf{Capacity:} One concurrent job, configured with \texttt{capacity: 1} in the runner configuration. \item \textbf{Registration scope:} The runner was registered for the repository's Actions workflow. The registration scope was configured through the Gitea repository's runner settings. \end{itemize}
|
||||
|
||||
\subsection{Connectivity and Security} The runner connects to the Gitea instance at \texttt{https://git.ssw590-08.me}. The runner container uses the configured Gitea instance URL and Docker socket to retrieve workflow jobs and launch their job containers. Docker-based execution isolates the build environment from the Gitea application container. The Docker daemon socket is mounted inside the runner container so that it can create job containers; therefore, access to the socket is restricted to the trusted runner environment. No separate runner-management or Docker daemon port was intentionally exposed to the public internet. The runner communicates with Gitea over HTTPS, while the job environment must have network access to the resources required for the build.
|
||||
|
||||
\subsection{Resource Considerations} The DigitalOcean Droplet hosting Gitea had approximately 458 MiB of total memory, with approximately 114 MiB available during the earlier resource check. Because this was limited memory, the LaTeX runner was placed on the local macOS computer rather than adding another resource-intensive service to the Droplet. This arrangement reduces the additional memory and disk load on the Gitea server while allowing the runner to use the custom Docker image required for the manual build.
|
||||
|
||||
\subsection{Network Path and Runner Verification}
|
||||
|
||||
The Gitea Actions runner operates on the local macOS computer
|
||||
using Docker Desktop. It connects to the Gitea instance at
|
||||
\texttt{https://git.ssw590-08.me} over HTTPS. The runner retrieves
|
||||
workflow jobs from Gitea and launches the assigned job in a
|
||||
Docker container using the custom image
|
||||
\texttt{latex-job:local}.
|
||||
|
||||
The workflow targets the runner through the label
|
||||
\texttt{latex}, configured with \texttt{runs-on: latex}.
|
||||
The runner has a capacity of one concurrent job, allowing
|
||||
one workflow job to execute at a time.
|
||||
|
||||
The runner uses the Docker socket to create job containers.
|
||||
The Docker daemon is not intentionally exposed through a
|
||||
public network port. Because access to the Docker socket
|
||||
provides substantial control over the Docker host, access is
|
||||
restricted to the trusted runner environment.
|
||||
|
||||
Figure~\ref{fig:runner-job-assigned} provides evidence of the
|
||||
runner's status and its assignment to a workflow job.
|
||||
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]
|
||||
{HW5 images/runner-verification.png}
|
||||
\caption{Gitea Actions runner online with a workflow job assigned.}
|
||||
\label{fig:runner-job-assigned}
|
||||
\end{figure}
|
||||
|
||||
|
||||
\section{Reproducible Compilation}
|
||||
|
||||
@@ -98,7 +136,7 @@ and a screenshot of the runner online with a job assigned.]}
|
||||
\item[Expected PDF path:] \texttt{manual/devopsAssignment.pdf}
|
||||
\item[Job image definition:] \texttt{manual/ci/Dockerfile}
|
||||
\item[Base image:] \texttt{texlive/texlive:TL2025-historic}
|
||||
\item[Resolved image ID/digest:] \textit{[from the runner host]}
|
||||
\item[Resolved image ID/digest:] \textit{b5c35d6bdbb9}
|
||||
\end{description}
|
||||
|
||||
\textbf{Where TeX runs:} the compiler is not installed in the Gitea
|
||||
@@ -127,7 +165,8 @@ sub run_makeglossaries { return system("makeglossaries \"$_[0]\""); }
|
||||
\texttt{bibtex}, \texttt{makeindex}, and \texttt{makeglossaries} when their
|
||||
inputs change. \texttt{-shell-escape} is required by \texttt{minted}.
|
||||
|
||||
\textbf{Workflow:} the complete workflow file is shown below.
|
||||
\textbf{Workflow:} the complete workflow file,
|
||||
\texttt{.gitea/workflows/manual.yml}, is shown below.
|
||||
\begin{minted}[breaklines]{yaml}
|
||||
name: Build IT manual
|
||||
|
||||
@@ -149,6 +188,30 @@ jobs:
|
||||
- name: Check out the triggering commit
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Generate build metadata
|
||||
working-directory: manual
|
||||
env:
|
||||
GIT_COMMIT: ${{ github.sha }}
|
||||
BUILD_NUMBER: ${{ github.run_number }}
|
||||
run: |
|
||||
MANUAL_VERSION="v1.4"
|
||||
SHORT_SHA="${GIT_COMMIT:0:7}"
|
||||
BUILD_ID="${MANUAL_VERSION}+build.${BUILD_NUMBER}.${SHORT_SHA}"
|
||||
|
||||
cat > build-metadata.tex <<EOF
|
||||
\newcommand{\ManualVersion}{${MANUAL_VERSION}}
|
||||
\newcommand{\BuildIdentifier}{${BUILD_ID}}
|
||||
\newcommand{\BuildCommit}{${GIT_COMMIT}}
|
||||
\newcommand{\BuildRunNumber}{${BUILD_NUMBER}}
|
||||
EOF
|
||||
|
||||
cat >> build-metadata.tex <<'EOF'
|
||||
\noindent\textbf{Manual version:} \ManualVersion\\
|
||||
\textbf{Build identifier:} \BuildIdentifier\\
|
||||
\textbf{Commit hash:} \BuildCommit\\
|
||||
\textbf{Gitea Actions run:} \BuildRunNumber
|
||||
EOF
|
||||
|
||||
- name: Record build identity and toolchain
|
||||
run: |
|
||||
SHORT_SHA="${GITHUB_SHA::7}"
|
||||
@@ -173,7 +236,7 @@ jobs:
|
||||
ls -l devopsAssignment.pdf
|
||||
|
||||
- name: Upload the PDF as an artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: it-manual-build-${{ github.run_number }}-${{ env.SHORT_SHA }}
|
||||
path: manual/devopsAssignment.pdf
|
||||
@@ -201,14 +264,146 @@ temporary job container, and \texttt{actions/upload-artifact} sends the PDF
|
||||
back to Gitea over HTTPS, where it is attached to the matching run. The
|
||||
container is discarded when the job ends.
|
||||
|
||||
\textit{[Link to a successful run log, and a dated screenshot of the
|
||||
compile and verify steps passing.]}
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/run-build-log.png}
|
||||
\caption{Successful build log}
|
||||
\label{fig:run-log}
|
||||
\end{figure}
|
||||
|
||||
\section{PDF Version Traceability}
|
||||
\textit{[To be completed (Part 4): human-maintained version, generated build
|
||||
identifier such as \texttt{v1.4+build.N.abcdef0}, visible commit hash and run
|
||||
number in the PDF, matching Gitea run, and how the metadata is injected
|
||||
without committing back to the branch.]}
|
||||
|
||||
Every PDF produced by the workflow carries two kinds of version information:
|
||||
a \emph{human-maintained} manual version, which the team changes deliberately
|
||||
when the manual's content is revised, and a \emph{generated} build
|
||||
identifier, which the workflow creates automatically for every run. The
|
||||
build identifier appends the run number and the triggering commit to the
|
||||
manual version:
|
||||
\begin{center}
|
||||
\texttt{<manual version>+build.<run number>.<short commit hash>}
|
||||
\end{center}
|
||||
|
||||
\subsection{Build Identifier for Run \#10}
|
||||
|
||||
The table below traces one build from its source commit to the finished PDF.
|
||||
|
||||
\begin{tabularx}{\linewidth}{L{3.4cm}L{4.4cm}Y}
|
||||
\toprule
|
||||
\textbf{Field} & \textbf{Where it comes from} & \textbf{Value for run \#10}\\ \midrule
|
||||
Manual version & \texttt{MANUAL\_VERSION} in the \emph{Generate build metadata} step of \texttt{manual.yml}, edited by the team & \texttt{v1.4}\\
|
||||
Workflow run number & \texttt{GITHUB\_RUN\_NUMBER}, set by Gitea Actions & \texttt{10}\\
|
||||
Source commit & \texttt{GITHUB\_SHA}, the triggering commit, shortened to 7 characters & \texttt{67e9e17}\\
|
||||
Build identifier & Combined by the workflow & \texttt{v1.4+build.10.67e9e17}\\
|
||||
Gitea run & Actions tab & \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/actions/runs/10}\\
|
||||
Artifact & Uploaded by the same run & \texttt{it-manual-build-10-67e9e17}\\ \bottomrule
|
||||
\end{tabularx}
|
||||
|
||||
The same three values appear in three places: the run's log
|
||||
(Figure~\ref{fig:gitea-buildhash}), the artifact name, and the generated
|
||||
PDF itself (Figure~\ref{fig:pdf-buildhash}). In the PDF, the build
|
||||
identifier, full commit hash, and run number are printed on
|
||||
\textit{[the title page / in the page footer: state where]}. Because the
|
||||
commit hash in the PDF matches the commit listed on run \#10, a reader
|
||||
holding only the PDF can find the exact source revision that produced it.
|
||||
|
||||
\subsection{How the Metadata Is Injected}
|
||||
|
||||
The human-maintained version is set once, in the \emph{Generate build
|
||||
metadata} step of the workflow, and is kept equal to \texttt{\string\VERSION}
|
||||
on the title page. The team changes it only when the manual's content is
|
||||
revised, together with a new Document History entry. The run number and
|
||||
commit hash are never typed by hand: Gitea Actions supplies them to every
|
||||
job as \texttt{github.run\_number} and \texttt{github.sha}.
|
||||
|
||||
Before compiling, the workflow combines these values and writes a small
|
||||
LaTeX file, \texttt{manual/build-metadata.tex}, inside the job container.
|
||||
The file defines four macros and a short block that prints them:
|
||||
\begin{minted}[breaklines]{yaml}
|
||||
- name: Generate build metadata
|
||||
working-directory: manual
|
||||
env:
|
||||
GIT_COMMIT: ${{ github.sha }}
|
||||
BUILD_NUMBER: ${{ github.run_number }}
|
||||
run: |
|
||||
MANUAL_VERSION="v1.4"
|
||||
SHORT_SHA="${GIT_COMMIT:0:7}"
|
||||
BUILD_ID="${MANUAL_VERSION}+build.${BUILD_NUMBER}.${SHORT_SHA}"
|
||||
|
||||
cat > build-metadata.tex <<EOF
|
||||
\newcommand{\ManualVersion}{${MANUAL_VERSION}}
|
||||
\newcommand{\BuildIdentifier}{${BUILD_ID}}
|
||||
\newcommand{\BuildCommit}{${GIT_COMMIT}}
|
||||
\newcommand{\BuildRunNumber}{${BUILD_NUMBER}}
|
||||
EOF
|
||||
|
||||
cat >> build-metadata.tex <<'EOF'
|
||||
\noindent\textbf{Manual version:} \ManualVersion\\
|
||||
\textbf{Build identifier:} \BuildIdentifier\\
|
||||
\textbf{Commit hash:} \BuildCommit\\
|
||||
\textbf{Gitea Actions run:} \BuildRunNumber
|
||||
EOF
|
||||
\end{minted}
|
||||
For run \#10 the generated file therefore defined
|
||||
\texttt{\string\BuildIdentifier} as \texttt{v1.4+build.10.67e9e17}. The manual
|
||||
reads the file during compilation:
|
||||
\begin{minted}[breaklines]{latex}
|
||||
run: |
|
||||
MANUAL_VERSION="v1.4"
|
||||
SHORT_SHA="${GIT_COMMIT:0:7}"
|
||||
BUILD_ID="${MANUAL_VERSION}+build.${BUILD_NUMBER}.${SHORT_SHA}"
|
||||
|
||||
cat > build-metadata.tex <<EOF
|
||||
\newcommand{\ManualVersion}{${MANUAL_VERSION}}
|
||||
\newcommand{\BuildIdentifier}{${BUILD_ID}}
|
||||
\newcommand{\BuildCommit}{${GIT_COMMIT}}
|
||||
\newcommand{\BuildRunNumber}{${BUILD_NUMBER}}
|
||||
EOF
|
||||
|
||||
cat >> build-metadata.tex <<'EOF'
|
||||
\noindent\textbf{Manual version:} \ManualVersion\\
|
||||
\textbf{Build identifier:} \BuildIdentifier\\
|
||||
\textbf{Commit hash:} \BuildCommit\\
|
||||
\textbf{Gitea Actions run:} \BuildRunNumber
|
||||
EOF
|
||||
\end{minted}
|
||||
The first \texttt{cat} uses an unquoted heredoc so that the shell
|
||||
substitutes the version, run number and commit into the macro definitions;
|
||||
the second uses a quoted heredoc (\texttt{<<'EOF'}) so that the LaTeX
|
||||
commands are written literally.
|
||||
|
||||
\subsection{No Commit or Push Loop}
|
||||
|
||||
The metadata file exists only inside the temporary job container, and
|
||||
\texttt{build-metadata.tex} is listed in \texttt{manual/.gitignore} so that a
|
||||
local test build cannot commit it by accident. The workflow contains no \texttt{git commit} or \texttt{git push} step, so the
|
||||
generated version is never written back to \texttt{main}; the container and
|
||||
the file are discarded when the job ends. This matters because the workflow
|
||||
is triggered by pushes to \texttt{main}: a workflow that committed its own
|
||||
version file would trigger itself again on every build. The human-maintained
|
||||
version and the Document History table therefore stay entirely under the
|
||||
team's control, and change only when a team member edits them.
|
||||
|
||||
\subsection{Re-runs}
|
||||
|
||||
Re-running a workflow in Gitea keeps the same run number and checks out the
|
||||
same commit, so a re-run produces a PDF with the same build identifier.
|
||||
Because the source is identical, the team treats such a re-run as the same
|
||||
build, and the run-attempt number is not included in the identifier.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/gitea-buildhash.png}
|
||||
\caption{Gitea build report}
|
||||
\label{fig:gitea-buildhash}
|
||||
\end{figure}
|
||||
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/pdf-buildhas.png}
|
||||
\caption{PDF compiled build report}
|
||||
\label{fig:pdf-buildhash}
|
||||
\end{figure}
|
||||
|
||||
\section{Downloadable Artifact}
|
||||
|
||||
@@ -218,10 +413,8 @@ without committing back to the branch.]}
|
||||
commit hash; for example, \texttt{it-manual-build-12-a1b2c3d}
|
||||
\item[Contents:] \texttt{devopsAssignment.pdf}
|
||||
\item[Retention:] 30 days, set in the workflow
|
||||
(\texttt{retention-days: 30}). \textit{[Confirm the server's maximum
|
||||
artifact retention; Gitea applies the lower of the two.]}
|
||||
\item[Example artifact link:] \textit{[link to the artifact on a successful
|
||||
run]}
|
||||
(\texttt{retention-days: 30}).
|
||||
\item[Example artifact link:] \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/actions/runs/10/artifacts/it-manual-build-10-67e9e17}
|
||||
\end{description}
|
||||
|
||||
Because the run number and commit hash are part of the artifact name, each
|
||||
@@ -242,20 +435,83 @@ Artifacts expire after the retention period and are not a backup. The
|
||||
permanent record is the LaTeX source in Git, from which any version of the
|
||||
manual can be rebuilt.
|
||||
|
||||
\textit{[Figure: run page with the artifact listed, and the downloaded PDF
|
||||
open, dated.]}
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/gitea-running-artifact.png}
|
||||
\caption{Run page with the artifact listed, and the downloaded PDF open, dated}
|
||||
\label{fig:fig:gitea-artifact-running}
|
||||
\end{figure}
|
||||
|
||||
\section{Change, Failure, and Repair Evidence}
|
||||
\textit{[To be completed together (Part 6): two successive commits with
|
||||
their runs and PDF identifiers, one deliberate LaTeX error with its failed
|
||||
run, and the repaired passing run.]}
|
||||
|
||||
To verify the automated manual-build pipeline, two successive changes were committed to the main branch of the Scrap-Web repository. Each commit triggered a separate Gitea Actions run. Both builds completed successfully, and the generated PDF artifacts were checked to confirm that their build identifiers corresponded to the appropriate commits and run numbers.
|
||||
|
||||
A deliberate LaTeX error was then introduced into the manual source. The workflow detected the compilation error and terminated with a failed status because the build uses the -halt-on-error option. The failed run and its error log were recorded as evidence that the pipeline prevents an invalid manual from being treated as a successful build.
|
||||
|
||||
The invalid command was subsequently removed in a repair commit. A new Actions run compiled the corrected source successfully and produced a new PDF artifact. The repaired artifact's commit hash and run number were compared with the corresponding Gitea Actions run to verify that the output was generated from the repaired revision.
|
||||
|
||||
The generated metadata was produced during the workflow rather than committed back to the source branch. This kept the build identifier associated with the specific build while preserving the distinction between source commits and generated artifacts.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/run-build-log.png}
|
||||
\caption{Run log showing 2 successive builds, followed by an error, and another successful build}
|
||||
\label{fig:buildlogs}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/errormessage.png}
|
||||
\caption{Failed build error message}
|
||||
\label{fig:error-message}
|
||||
\end{figure}
|
||||
|
||||
\section{Runner and Secret Boundary}
|
||||
\textit{[To be completed (Part 7): workflow edit rights, where the runner
|
||||
registration token is stored (without its value), runner isolation, and
|
||||
Docker socket risk.]}
|
||||
\subsection{Workflow edit permissions} The automated build workflow is stored in .gitea/workflows/manual.yml. Users who can modify the workflow may change the commands executed by the runner. Repository write permissions and any branch-protection rules were reviewed to identify who can modify the workflow and its associated source files. The repository's actual permissions and branch-protection configuration are recorded in the accompanying evidence.
|
||||
|
||||
\subsection{Runner registration credentials} The Gitea Actions runner is hosted on the local macOS development machine. Its configuration is stored in ~/gitea-runner/runner-data/config.yaml, and its local runner credentials are stored in the runner-data directory, including the .runner file when present. These files are not included in the report or committed to the repository because they may contain sensitive authentication information. The registration token is used to register the runner; it is distinct from the credentials subsequently stored by the registered runner.
|
||||
|
||||
\subsection{Runner isolation} The runner uses the latex label, which matches the workflow's runs-on: latex setting. The runner executes the manual-build job in a Docker container based on the custom latex-job:local image. Its configured capacity is one job at a time. Hosting the runner on the development machine rather than the DigitalOcean Gitea server avoids placing the additional build workload on the server's limited memory and disk resources. Containerization provides isolation for the build environment, but it is not treated as a complete security boundary.
|
||||
|
||||
\subsection{Docker socket risk} The runner container has access to the Docker Desktop socket so that it can create job containers. Access to this socket is security-sensitive because it may allow control over Docker resources and potentially affect the host system. The socket is mounted locally for runner operation rather than deliberately exposed as a public network endpoint. The runner is therefore restricted to trusted coursework workflows, and its credentials and configuration files are kept out of source control.
|
||||
|
||||
Evidence includes the repository permission settings, runner configuration with secrets omitted, and the runner's Docker configuration. No authentication tokens or credential values are reproduced in this report.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/adminpage.png}
|
||||
\caption{Listed repo admins}
|
||||
\label{fig:admin-perms}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/ownerpage.png}
|
||||
\caption{Listed repo owners}
|
||||
\label{fig:owner-perms}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/tokenlocations.png}
|
||||
\caption{Verification of token existence}
|
||||
\label{fig:tokenlocations}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/twosuccessruns.png}
|
||||
\caption{Two Successive Runs}
|
||||
\label{fig:successfulruns}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=1\linewidth]{HW5 images/pdfidentifiers.png}
|
||||
\caption{Associated PDF identifiers}
|
||||
\label{fig:pdfidentify}
|
||||
\end{figure}
|
||||
|
||||
\section{Manual Quality and Controls}
|
||||
\textit{[To be completed (Part 8): version and history update, whether the
|
||||
Hosts and Passwords tables changed, and a short failed-build troubleshooting
|
||||
procedure.]}
|
||||
\subsection{Common Troubleshooting Methods}
|
||||
Throughout this exercise, there came many times where the builds failed (around 8 times). The main method of troubleshooting involved checking version statuses, updating and restarting file instances, and parsing of error messages to pinpoint.
|
||||
|
||||
@@ -9,8 +9,7 @@ Jenkins was deployed on the existing DigitalOcean Droplet used for the Gitea env
|
||||
|
||||
Jenkins was deployed as a Docker Compose service rather than installed directly on the host operating system. This approach makes the service configuration reproducible and allows the container to be managed independently of the other services running on the Droplet. The Jenkins container is named \texttt{jenkins}.
|
||||
|
||||
The Docker Compose configuration defines the Jenkins image, container name, restart policy, Java memory settings, persistent storage, and shared Docker network. The configuration file is located at \texttt{/root/jenkins/docker-compose.yml} on the Droplet. The corresponding source-controlled configuration should be linked here for reproducibility.
|
||||
|
||||
The Docker Compose configuration defines the Jenkins image, container name, restart policy, Java memory settings, persistent storage, and shared Docker network. The configuration file is located at \texttt{/root/jenkins/docker-compose.yml} on the Droplet.
|
||||
The relevant configuration is shown below. It contains no passwords, personal access tokens, or other authentication secrets.
|
||||
|
||||
\begin{minted}[fontsize=\small,breaklines,linenos]{yaml}
|
||||
@@ -36,7 +35,7 @@ networks:
|
||||
name: gitea-net
|
||||
\end{minted}
|
||||
|
||||
\noindent\textbf{Configuration file:} \texttt{/root/jenkins/docker-compose.yml} on the Droplet. Add the URL to the source-controlled Compose file here: \url{[INSERT COMPOSE FILE LINK]}.
|
||||
\noindent\textbf{Configuration file:} \texttt{/root/jenkins/docker-compose.yml} on the Droplet. The source-controlled copy is at \url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/deployment/docker-compose.yml}.
|
||||
|
||||
The container uses the external Docker network \texttt{gitea-net}, which allows Jenkins to communicate with the existing Gitea and Caddy services. Jenkins listens on container port 8080, but the Compose configuration does not publish port 8080 or the Jenkins agent port 50000 directly on the host. Browser access is provided through Caddy using the HTTPS address \url{https://ci.ssw590-08.me/}.
|
||||
|
||||
@@ -53,6 +52,13 @@ The Jenkins container is configured with the following Java heap limits:
|
||||
|
||||
After the Droplet upgrade, the reported host memory usage was approximately 503 MiB used out of 1.9 GiB, with approximately 931 MiB free and 1.4 GiB available. The reported disk usage was approximately 3.3 GB out of 48 GB, leaving approximately 45 GB available. These values describe the host at the time of measurement and may change as builds execute and logs accumulate.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.8\linewidth]{HW6 images/droplet-resize.png}
|
||||
\caption{DigitalOcean resize configuration for the Droplet \texttt{devops-gitea-server}: Basic plan, 1 vCPU, 2 GB RAM, 50 GB disk.}
|
||||
\label{fig:ci-droplet-resize}
|
||||
\end{figure}
|
||||
|
||||
Because the Droplet hosts several services on a relatively small resource allocation, memory and disk usage should be monitored during builds. The Java heap limit helps constrain Jenkins' Java memory allocation, but it does not represent a limit on the container's total memory usage.
|
||||
|
||||
\subsection{Persistent Storage and Restart Policy}
|
||||
@@ -84,7 +90,14 @@ A container restart test was performed using the following command:
|
||||
docker restart jenkins
|
||||
\end{minted}
|
||||
|
||||
The command completed successfully. Following the restart, Jenkins was accessible through its HTTPS address, and the existing Jenkins configuration and job remained available. This demonstrated that Jenkins could restart without requiring the service to be reinstalled or configured from scratch.
|
||||
The command completed successfully. Following the restart, Jenkins was accessible through its HTTPS address, and the existing Jenkins configuration and job remained available. This demonstrated that Jenkins could restart without requiring the service to be reinstalled or configured from scratch. Figure~\ref{fig:ci-restart} shows the running Jenkins, Caddy, and Gitea containers and the Jenkins log after the restart.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{HW6 images/persisting-jenkins.png}
|
||||
\caption{Container inspection and \texttt{docker restart jenkins}: the \texttt{unless-stopped} restart policy, the \texttt{jenkins\_home} volume mount, and the Jenkins log after restart (2026-10-22, 02:03 UTC) showing all jobs loaded and Jenkins fully up and running.}
|
||||
\label{fig:ci-restart}
|
||||
\end{figure}
|
||||
|
||||
The test also supports the use of the named \texttt{jenkins\_home} volume for persistent Jenkins data. A container restart is not, however, a backup or disaster-recovery test. It does not demonstrate that data can be recovered after volume deletion, disk failure, Droplet loss, or corruption. Separate backups of the Jenkins home data and a documented restoration procedure are necessary to establish recoverability.
|
||||
|
||||
@@ -101,7 +114,14 @@ Jenkins is accessible through the following HTTPS address:
|
||||
|
||||
The hostname \texttt{ci.ssw590-08.me} resolves to the public IP address of the DigitalOcean Droplet hosting the DevOps services. Jenkins is not intended to be accessed through a publicly exposed container port. Instead, incoming browser requests reach the Caddy reverse proxy, which forwards requests to the Jenkins service over the shared Docker network.
|
||||
|
||||
The instructor-approved access path for this deployment is: \textbf{[INSERT THE ACCESS METHOD APPROVED BY THE INSTRUCTOR]}. Access was verified by opening the HTTPS login page in a browser on \textbf{[INSERT VERIFICATION DATE]}.
|
||||
The instructor-approved access path for this deployment is \textbf{HTTPS}, through the Caddy reverse proxy. HTTPS access, including the Caddy-issued certificate, was verified on October 22, 2026 (Figure~\ref{fig:ci-site}).
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.8\linewidth]{HW6 images/jenkins-site.png}
|
||||
\caption{Jenkins 2.580.1 reached in a browser at \texttt{ci.ssw590-08.me} through Caddy.}
|
||||
\label{fig:ci-site}
|
||||
\end{figure}
|
||||
|
||||
\subsection{DNS and TLS Certificate}
|
||||
|
||||
@@ -122,12 +142,12 @@ The certificate details should be recorded from the certificate actually present
|
||||
|
||||
\begin{itemize}
|
||||
\item \textbf{Hostname:} \texttt{ci.ssw590-08.me}
|
||||
\item \textbf{Certificate issuer:} [INSERT VERIFIED CERTIFICATE ISSUER]
|
||||
\item \textbf{Certificate expiration:} [INSERT VERIFIED EXPIRATION DATE]
|
||||
\item \textbf{Certificate verification date:} [INSERT DATE]
|
||||
\item \textbf{Certificate issuer:} Caddy (automatic certificate management)
|
||||
\item \textbf{Certificate expiration:} January 20, 2027
|
||||
\item \textbf{Certificate verification date:} October 22, 2026
|
||||
\end{itemize}
|
||||
|
||||
Caddy supports automatic HTTPS certificate provisioning and renewal. The deployment uses Caddy for TLS termination, with its configuration and persistent data stored separately from the Jenkins container. The certificate issuer, expiration date, and renewal status should be verified from the active certificate and Caddy logs before this section is finalized.
|
||||
Caddy supports automatic HTTPS certificate provisioning and renewal. The deployment uses Caddy for TLS termination, with its configuration and persistent data stored separately from the Jenkins container.
|
||||
|
||||
\subsection{HTTP-to-HTTPS Redirect and Jenkins Proxy Configuration}
|
||||
|
||||
@@ -154,14 +174,14 @@ This URL should also be configured in Jenkins under \textit{Manage Jenkins} $\ri
|
||||
|
||||
Jenkins requires authentication to access its administrative interface and configure continuous integration jobs. Access to Jenkins administration and configuration should be restricted to authorized project members.
|
||||
|
||||
The Gitea integration uses a dedicated \texttt{jenkins} account and a Gitea Personal Access Token stored in Jenkins credentials. The account has the repository permissions needed for Jenkins to interact with \texttt{SSW-590-08/Scrap-Web}. During integration troubleshooting, repository webhook management initially failed with HTTP 403 responses. The account's repository permissions were subsequently adjusted, and the Jenkins webhook was created successfully in Gitea.
|
||||
The Gitea integration uses a dedicated \texttt{jenkins-ci} account and a Gitea Personal Access Token stored in Jenkins credentials. The account has the repository permissions needed for Jenkins to interact with \texttt{SSW-590-08/Scrap-Web}. During integration troubleshooting, repository webhook management initially failed with HTTP 403 responses. The account's repository permissions were subsequently adjusted, and the Jenkins webhook was created successfully in Gitea.
|
||||
|
||||
The following account and role information should be completed based on the actual Jenkins security configuration:
|
||||
The Jenkins accounts and roles are:
|
||||
|
||||
\begin{itemize}
|
||||
\item \textbf{Jenkins administrators:} [INSERT AUTHORIZED ADMINISTRATOR ACCOUNTS OR ROLES]
|
||||
\item \textbf{Jenkins users:} [INSERT AUTHORIZED USER ACCOUNTS OR ROLES]
|
||||
\item \textbf{Gitea integration identity:} \texttt{jenkins}
|
||||
\item \textbf{Jenkins administrators:} \texttt{samahk} and \texttt{kaylah7}
|
||||
\item \textbf{Jenkins users:} \texttt{samahk} and \texttt{kaylah7}
|
||||
\item \textbf{Gitea integration identity:} \texttt{jenkins-ci}
|
||||
\item \textbf{Credential storage:} Jenkins Credentials
|
||||
\end{itemize}
|
||||
|
||||
@@ -184,7 +204,7 @@ Direct public access to Jenkins on TCP 8080 is not required. The Jenkins contain
|
||||
|
||||
The host's UFW firewall was reported as inactive during deployment verification. Consequently, the DigitalOcean Cloud Firewall and Docker's network and port configuration are important parts of the external access restrictions.
|
||||
|
||||
The actual Cloud Firewall rules should be captured in a dated screenshot and compared with the rules listed above. Unneeded inbound rules, including direct public access to TCP 3000 and TCP 5432, should be removed if they are not required by another service.
|
||||
Any inbound rule that is not required, such as direct public access to TCP 3000 or TCP 5432, should be removed from the Cloud Firewall.
|
||||
|
||||
\subsection{Docker Port Mappings}
|
||||
|
||||
@@ -206,7 +226,7 @@ This arrangement avoids exposing Jenkins' application port directly to the publi
|
||||
|
||||
\subsection{External Connectivity Tests}
|
||||
|
||||
External tests were performed from a machine outside the Droplet to verify that selected ports were reachable or blocked from the public network. The test results must be recorded with their execution date and the source machine's network context.
|
||||
Connectivity tests were run twice: first from a shell on the Droplet, and later from a machine outside it, to check which ports are reachable or blocked from the public network. The date and source of each run are recorded below.
|
||||
|
||||
The following command tests the public IPv4 address for TCP connectivity:
|
||||
|
||||
@@ -222,49 +242,41 @@ The expected results are:
|
||||
\item \textbf{TCP 8080:} The connection should fail because Jenkins' internal web port is not published on the host and is not intended to be publicly accessible.
|
||||
\end{itemize}
|
||||
|
||||
Previous external tests of TCP ports 3000, 5432, 8080, and 50000 returned connection failures. These observations support the conclusion that those ports were not reachable from the test machine at that time. A separate dated test of TCP 443 and TCP 8080 should be included as direct evidence for this section.
|
||||
|
||||
The test record should include:
|
||||
Previous external tests of TCP ports 3000, 5432, 8080, and 50000 returned connection failures.
|
||||
|
||||
\begin{itemize}
|
||||
\item \textbf{Test date and time:} [INSERT DATE, TIME, AND TIME ZONE]
|
||||
\item \textbf{Test source:} [INSERT EXTERNAL MACHINE OR NETWORK]
|
||||
\item \textbf{Test date and time:} October 24, 2026, 4:25 AM EDT
|
||||
\item \textbf{Test source:} Shell on the Droplet itself (\texttt{root@devops-gitea-server}), connecting to its own public IPv4 address
|
||||
\item \textbf{Droplet IPv4 address:} \texttt{147.182.179.191}
|
||||
\item \textbf{TCP 443 result:} [INSERT OBSERVED RESULT]
|
||||
\item \textbf{TCP 8080 result:} [INSERT OBSERVED RESULT]
|
||||
\item \textbf{TCP 443 result:} Succeeded (\texttt{nc} reported the connection to port 443 succeeded)
|
||||
\item \textbf{TCP 8080 result:} Failed with ``Connection refused,'' so nothing is listening on host port 8080
|
||||
\end{itemize}
|
||||
|
||||
A failed connection alone does not establish which control blocked it. The firewall configuration and Docker port inspection provide complementary evidence for the intended exposure restrictions.
|
||||
Because the test ran on the Droplet itself, it shows that Caddy answers on TCP 443 and that nothing listens on host port 8080; it does not exercise the cloud firewall. A failed connection alone does not establish which control blocked it. The firewall configuration and Docker port inspection provide complementary evidence for the intended exposure restrictions.
|
||||
|
||||
\textbf{Test from outside the Droplet (October 30, 2026).} The same two commands were run from a team member's MacBook on a network outside the Droplet, at 2026-10-31T01:58:14Z (9:58~PM EDT). TCP 443 succeeded. \textbf{TCP 8080 also succeeded}, which differs from the expected result.
|
||||
|
||||
The result was investigated rather than accepted. At 2026-10-31T02:14:23Z (10:14~PM EDT) a follow-up from the same machine gave:
|
||||
\begin{itemize}
|
||||
\item TCP 8081 and 8888, ports with no service, \textbf{timed out}, so the outside network does not accept every port.
|
||||
\item \texttt{curl -v http://147.182.179.191:8080} connected, sent \texttt{GET /}, and after 5 seconds closed the connection with \textbf{0 bytes received}. Jenkins would have answered with HTTP headers, so Jenkins did not serve this connection.
|
||||
\end{itemize}
|
||||
On the Droplet, \texttt{ss -tlnp} showed no process listening on ports 8080 or 50000, and \texttt{iptables -t nat -S DOCKER} showed no forwarding rule for them. \texttt{docker ps} showed the Jenkins container with the unpublished ports \texttt{8080/tcp, 50000/tcp}; the only host-published ports were Caddy's 80 and 443 and Gitea's SSH on 222.
|
||||
|
||||
\textbf{Conclusion.} Jenkins' web port is not published and no Jenkins content was reachable on port 8080. The TCP handshake that succeeded on 8080 alone was not explained: its source was not identified, and the test was not repeated from a second outside network. This report does not claim that port 8080 is closed to the Internet, only that nothing on the Droplet listens on it and no HTTP response was received. A repeat from a second network, and a cloud-firewall rule that admits only the ports in use, would settle it.
|
||||
|
||||
|
||||
\section{Gitea Trigger and Traceability}
|
||||
\label{sec:ci-trigger}
|
||||
|
||||
\subsection{Deployment and Network Paths}
|
||||
|
||||
Figure~\ref{fig:ci-deployment} adapts the reference deployment to the team's
|
||||
actual setup. Gitea and Jenkins run as containers on the same DigitalOcean
|
||||
Droplet behind the Caddy TLS proxy. Two paths are separate:
|
||||
\begin{itemize}
|
||||
\item \textbf{Browser path:} a team member's browser reaches
|
||||
\url{https://ci.ssw590-08.me} on port 443 through the Cloud Firewall and
|
||||
Caddy, which forwards to Jenkins on the private Docker network. Jenkins'
|
||||
own port 8080 is not published (Section~\ref{sec:ci-https}).
|
||||
\item \textbf{Integration path:} Jenkins initiates every connection to
|
||||
Gitea. It calls the Gitea API at \url{https://git.ssw590-08.me} to
|
||||
discover branches and pull requests, clones the pull request's head
|
||||
commit, and posts the commit status back. Gitea never needs to reach
|
||||
Jenkins for builds to run, because the job polls for changes
|
||||
(Section~\ref{sec:ci-trigger-config}).
|
||||
\end{itemize}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
% Uncomment once the diagram image is uploaded:
|
||||
% \includegraphics[width=\linewidth]{HW6 images/ci-deployment.png}
|
||||
\fbox{\parbox[c][3cm][c]{0.9\linewidth}{\centering\textit{[Diagram to be added]}}}
|
||||
\caption{Adapted UML deployment diagram of the Gitea and Jenkins CI paths}
|
||||
\label{fig:ci-deployment}
|
||||
\end{figure}
|
||||
The continuous integration workflow connects the Gitea repository
|
||||
\texttt{SSW-590-08/Scrap-Web} to Jenkins. The repository is hosted at
|
||||
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web}, and Jenkins is
|
||||
accessible through \url{https://ci.ssw590-08.me/}. Jenkins uses the
|
||||
Gitea integration to discover repository changes and report build
|
||||
statuses associated with commits and pull requests.
|
||||
|
||||
\subsection{Repository and Integration Identity}
|
||||
|
||||
@@ -312,6 +324,65 @@ this integration and limited to what Jenkins needs:
|
||||
\label{fig:ci-token}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Webhook Configuration and Delivery}
|
||||
|
||||
The Jenkins Gitea integration is configured to communicate with the
|
||||
Gitea server at \url{https://git.ssw590-08.me/}. The Gitea webhook
|
||||
connects repository events to the Jenkins service. Jenkins is
|
||||
reachable externally through Caddy over HTTPS, while the Jenkins
|
||||
container itself is attached to the shared Docker network
|
||||
\texttt{gitea-net}. The Caddy reverse proxy forwards requests for
|
||||
\url{https://ci.ssw590-08.me/} to the Jenkins service on port 8080
|
||||
inside the Docker network.
|
||||
|
||||
The webhook was created in Gitea (\emph{Scrap-Web $\rightarrow$ Settings
|
||||
$\rightarrow$ Webhooks}) and points at the endpoint exposed by the Jenkins
|
||||
Gitea plugin. Its details, as shown in
|
||||
Figures~\ref{fig:ci-webhook-list} and~\ref{fig:ci-webhook-delivery}, are:
|
||||
|
||||
\begin{description}
|
||||
\item[Name:] \texttt{Jenkins Webhook}
|
||||
\item[Target URL:] \url{https://ci.ssw590-08.me/gitea-webhook/post}, reached
|
||||
over HTTPS through Caddy
|
||||
\item[Status:] Listed with a green (healthy) indicator in the repository's
|
||||
webhook list
|
||||
\item[Verification:] A \emph{Test Push Event} was sent from Gitea on
|
||||
October 23, 2026. \emph{Recent Deliveries} lists delivery
|
||||
\texttt{6b542d91-02b7-45be-a6c2-ba9989df7f4f} with a green check mark,
|
||||
meaning Gitea delivered the event to the Jenkins endpoint successfully.
|
||||
\item[Trigger events and secret:] Push and pull-request events from the
|
||||
repository. No webhook secret is set; a secret would let Jenkins verify
|
||||
that a delivery really came from Gitea, and adding one is a recommended
|
||||
hardening step (Section~\ref{sec:ci-credentials}).
|
||||
\end{description}
|
||||
|
||||
Figure~\ref{fig:ci-job-list} shows the Jenkins job list shortly after the
|
||||
test delivery: the \texttt{Scrap-Web} Multibranch Pipeline reports a last
|
||||
success 25 seconds earlier and no failures. The Multibranch Pipeline also
|
||||
scans the repository every minute as a fallback (Section~\ref{sec:ci-trigger-config}), so a missed webhook delivery
|
||||
delays a build rather than losing it.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.9\linewidth]{HW6 images/webhook-list.png}
|
||||
\caption[10/23/26 --- Gitea webhook \texttt{Jenkins Webhook} for Scrap-Web]{\textit{10/23/26} --- Gitea webhook \texttt{Jenkins Webhook} for Scrap-Web, targeting \url{https://ci.ssw590-08.me/gitea-webhook/post}.}
|
||||
\label{fig:ci-webhook-list}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.9\linewidth]{HW6 images/webhook-delivery.png}
|
||||
\caption{\textit{10/23/26} --- Gitea \emph{Recent Deliveries} for the Jenkins webhook, showing a successful \emph{Test Push Event} delivery.}
|
||||
\label{fig:ci-webhook-delivery}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.9\linewidth]{HW6 images/jenkins-job-list.png}
|
||||
\caption{\textit{10/23/26} --- Jenkins job list showing the \texttt{Scrap-Web} Multibranch Pipeline, last success 25 seconds earlier, captured shortly after the test delivery.}
|
||||
\label{fig:ci-job-list}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Job Configuration and Trigger}
|
||||
\label{sec:ci-trigger-config}
|
||||
|
||||
@@ -349,14 +420,14 @@ Scan repository trigger & Periodically if not otherwise run, every
|
||||
\label{fig:ci-branch-source}
|
||||
\end{figure}
|
||||
|
||||
\textbf{Trigger: polling fallback.} The job scans Scrap-Web every minute and
|
||||
starts a build for any branch or pull request whose head commit has changed.
|
||||
The assignment permits polling in place of a webhook. It was chosen because a
|
||||
webhook from Gitea to Jenkins on the private container network requires
|
||||
changing Gitea's allowed webhook hosts, and Jenkins' web interface was not
|
||||
opened merely to receive webhooks. The cost is a delay of up to one minute
|
||||
between a push and the start of its build. In practice, each push in
|
||||
Section~\ref{sec:ci-failure} was built within about two minutes.
|
||||
\textbf{Trigger: webhook with polling fallback.} The Gitea webhook
|
||||
(Section~\ref{sec:ci-trigger}) notifies Jenkins when a push or pull-request
|
||||
event occurs, so a build can start without waiting for the next scan. As a
|
||||
safety net, the job also scans Scrap-Web every minute and starts a build for
|
||||
any branch or pull request whose head commit has changed. A missed or failed
|
||||
webhook delivery therefore delays a build by about one minute instead of
|
||||
losing it. In practice, each push in Section~\ref{sec:ci-failure} was built
|
||||
within about two minutes.
|
||||
|
||||
Each scan is recorded in the job's \emph{Scan Repository Log}
|
||||
(Figure~\ref{fig:ci-scan-log}). The scan at 04:15 UTC on October 23, 2026
|
||||
@@ -373,25 +444,81 @@ were checked and skipped.
|
||||
\label{fig:ci-scan-log}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Build and Commit Traceability}
|
||||
|
||||
The Jenkins job is configured as a Multibranch Pipeline using the
|
||||
Gitea source integration. Jenkins discovers branches and pull
|
||||
requests from the repository and associates builds with the relevant
|
||||
revision. This makes it possible to trace a proposed change from its
|
||||
Gitea pull request to the Jenkins build and its reported status.
|
||||
|
||||
During verification, Jenkins logs showed pull-request build activity
|
||||
for pull request \#13. The logs also showed status notifications for
|
||||
the following revisions:
|
||||
|
||||
\begin{itemize}
|
||||
\item \texttt{1de58d4742d1ad600dacad50890c845ab963e985}
|
||||
\item \texttt{84a44f0477dac51b540d038bf3a94b8f49bec275}
|
||||
\end{itemize}
|
||||
|
||||
The Jenkins log included messages indicating that a pending build
|
||||
was being reported and that the notification completed for each of these
|
||||
revisions; the same commit IDs appear in Gitea's commit list for pull
|
||||
request \#13.
|
||||
|
||||
The traceability path is therefore:
|
||||
|
||||
\begin{enumerate}
|
||||
\item A developer pushes a commit or creates or updates a pull
|
||||
request in the Gitea repository.
|
||||
\item Gitea delivers the webhook event to Jenkins, or the next
|
||||
one-minute repository scan detects the new commit.
|
||||
\item The Jenkins Multibranch Pipeline discovers the relevant
|
||||
branch or pull-request revision and starts the associated
|
||||
build.
|
||||
\item Jenkins records the build result and reports the associated
|
||||
status back to Gitea.
|
||||
\item A reviewer can inspect the pull request, commit, and Jenkins
|
||||
result to determine whether the proposed change passed the
|
||||
configured checks.
|
||||
\end{enumerate}
|
||||
|
||||
\subsection{Deployment Diagram}
|
||||
|
||||
Figure~\ref{fig:gitea-jenkins-deployment} illustrates the deployment
|
||||
and communication paths between the developer, Gitea, the webhook,
|
||||
Jenkins, and the repository's build process. The HTTPS browser path
|
||||
is shown separately from the webhook path to distinguish normal user
|
||||
access from automated event delivery.
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{figures/gitea-jenkins-deployment.png}
|
||||
\caption{Deployment and communication paths for Gitea and Jenkins
|
||||
continuous integration.}
|
||||
\label{fig:gitea-jenkins-deployment}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Traceability: Commit to Jenkins Run}
|
||||
|
||||
The table below traces one trigger from the commit in Gitea to the Jenkins
|
||||
run that tested it. The commit ID is the same in Gitea's commit list, in the
|
||||
run's Checkout log (\texttt{git rev-parse HEAD}), and on the status Gitea
|
||||
displays for that commit (Figure~\ref{fig:ci-pr-fail-fix}).
|
||||
displays for that commit.
|
||||
|
||||
\begin{tabularx}{\linewidth}{L{4.2cm}Y}
|
||||
\toprule
|
||||
\textbf{Item} & \textbf{Value}\\ \midrule
|
||||
Event & Repair commit pushed to branch \texttt{feature/issue-11}, the source
|
||||
of pull request \#13\\
|
||||
Time & October 23, 2026; Jenkins run started at 11:07 PM\\
|
||||
Detected by & Repository scan (polling); build started automatically\\
|
||||
Time pushed & October 23, 2026, 11:07 PM\\
|
||||
Detected by & Webhook or repository scan; build started automatically\\
|
||||
Pull request & \#13,
|
||||
\url{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13}\\
|
||||
Triggering commit & \texttt{84a44f0477}\\
|
||||
Jenkins run & \texttt{Scrap-Web/PR-13} run \#9 (Figure~\ref{fig:ci-runs};
|
||||
the job was later removed by Jenkins, see below)\\
|
||||
Triggering commit & \texttt{84a44f0}\\
|
||||
Jenkins run & \texttt{Scrap-Web/PR-13} run \#9 (the job was later
|
||||
removed by Jenkins; see below)\\
|
||||
Run history & Figure~\ref{fig:ci-runs}\\
|
||||
Status posted to Gitea & \texttt{Scrap-Web/pipeline/pr-main}: success,
|
||||
visible on the commit in
|
||||
\href{https://git.ssw590-08.me/SSW-590-08/Scrap-Web/pulls/13/commits}{pull
|
||||
@@ -403,13 +530,13 @@ Status posted to Gitea & \texttt{Scrap-Web/pipeline/pr-main}: success,
|
||||
|
||||
Checkout, the syntax check, and the tests all run on the Jenkins
|
||||
controller's built-in node, inside the Jenkins container; the stage view of
|
||||
each run lists the node as \emph{Jenkins} (the built-in node,
|
||||
Figure~\ref{fig:ci-stage-view}). There is no separate build agent and no inbound
|
||||
agent port. Jenkins clones the commit from Gitea over HTTPS into its
|
||||
workspace under \texttt{/var/jenkins\_home/workspace/} and runs the
|
||||
\texttt{Jenkinsfile} stages there (Section~\ref{sec:ci-pipeline}). The risk
|
||||
of building on the controller and the restrictions that limit it are covered
|
||||
in Section~\ref{sec:ci-credentials}.
|
||||
each run lists the node as \emph{Jenkins (built-in)}. There is no separate
|
||||
build agent and no inbound agent port. Jenkins clones the commit from Gitea
|
||||
over HTTPS into its workspace under \texttt{/var/jenkins\_home/workspace/}
|
||||
and runs the \texttt{Jenkinsfile} stages there
|
||||
(Section~\ref{sec:ci-pipeline}). The risk of building on the controller and
|
||||
the restrictions that limit it are covered in
|
||||
Section~\ref{sec:ci-credentials}.
|
||||
|
||||
\subsection{Failure Diagnoses}
|
||||
|
||||
@@ -417,35 +544,40 @@ Four integration problems were diagnosed and corrected.
|
||||
|
||||
\textbf{Repository not visible to Jenkins.} When the job was first
|
||||
configured, the Repository list for owner \texttt{SSW-590-08} was empty,
|
||||
even though the token had repository access. \textit{[Cause and fix.]}
|
||||
After the correction the repository appeared and the first scan discovered
|
||||
pull request \#13 (Figure~\ref{fig:ci-scan-log}).
|
||||
even though the \texttt{jenkins-ci} account was a collaborator on the
|
||||
repository. The token was regenerated with the scopes \texttt{write:repository}
|
||||
and \texttt{read:user} (Gitea did not keep any other scope selected), the
|
||||
Jenkins credential \texttt{gitea-jenkins-ci} was updated, and the old tokens
|
||||
were deleted. After the correction the repository appeared in the list and
|
||||
the first scan discovered pull request \#13.
|
||||
|
||||
\textbf{First build failed: \texttt{python3: not found}.} Run \#1 of
|
||||
\texttt{PR-13} (October 23, 2026, 00:13) checked out the commit
|
||||
successfully, proving the integration worked, but failed in the Checkout
|
||||
stage at \texttt{python3 --version} with exit code 127; the later stages were
|
||||
skipped (Figure~\ref{fig:ci-runs}). The official Jenkins image does not
|
||||
include Python. The fix was a deployment change, not a code change:
|
||||
\texttt{python3} was added to the Jenkins container \textit{[confirm how:
|
||||
e.g.\ by building it from \texttt{jenkins/Dockerfile}]}. Run \#2, started
|
||||
manually on the same commit at 9:39 PM, then passed and reported Python
|
||||
3.13.5 (Figure~\ref{fig:ci-stage-view}).
|
||||
\texttt{PR-13} (October 23, 2026) checked out the commit successfully,
|
||||
proving the integration worked, but failed in the Checkout stage at
|
||||
\texttt{python3 --version} with exit code 127. The official Jenkins image
|
||||
does not include Python. The fix was a deployment change, not a code change:
|
||||
\texttt{python3} was added to the Jenkins container. Jenkins now runs the
|
||||
custom image \texttt{custom-jenkins:lts-jdk21-python3}, which adds Python to
|
||||
the Jenkins LTS JDK~21 image (recorded on October 28, 2026), so Python survives
|
||||
a container rebuild. Run \#2 on the same
|
||||
pull request then passed, reporting Python 3.13.5.
|
||||
|
||||
\textbf{Required check reported as missing.} After the status-check
|
||||
requirement was added, Gitea showed the Jenkins check as green but still
|
||||
reported ``some required checks are missing'' and blocked the merge.
|
||||
\textit{[Cause and fix.]}
|
||||
The branch rule contained a pattern that did
|
||||
not exactly match the reported context \texttt{Scrap-Web/pipeline/pr-main}.
|
||||
It was corrected to that exact name.
|
||||
|
||||
\textbf{Pull request runs deleted after merge.} Shortly after pull request
|
||||
\#13 was merged, the \texttt{PR-13} job and all of its runs disappeared from
|
||||
Jenkins. The pull request was closed, and the Multibranch job's default
|
||||
orphaned item strategy discards the jobs of closed pull requests. Deleted
|
||||
runs cannot be restored without a backup of \texttt{jenkins\_home}. The
|
||||
evidence survives in Gitea, because the commit statuses Jenkins posted remain
|
||||
attached to each commit of pull request \#13, and in the screenshots captured
|
||||
while the runs existed. To keep future evidence, the job's \emph{Orphaned
|
||||
Item Strategy} was changed to keep old items for 30 days.
|
||||
Jenkins. The Scan Repository Log showed that the job had been removed as an
|
||||
orphaned item: the pull request was closed, and the Multibranch job's default
|
||||
orphaned item strategy discards such jobs immediately. Deleted runs cannot be
|
||||
restored without a backup of \texttt{jenkins\_home}. The evidence survives in
|
||||
Gitea, because the commit statuses Jenkins posted remain attached to each
|
||||
commit of pull request \#13. To keep future evidence, the job's
|
||||
\emph{Orphaned Item Strategy} was changed to keep old items for 30 days.
|
||||
|
||||
If a trigger fails in future, the operator follows the procedure in
|
||||
Section~\ref{sec:ci-troubleshoot}.
|
||||
@@ -547,9 +679,9 @@ The application and tests use only the Python 3 standard library
|
||||
(\texttt{unittest} and \texttt{py\_compile}), so the pipeline downloads no
|
||||
packages and has no external dependency source to trust or pin. The only
|
||||
requirement is a \texttt{python3} interpreter on the Jenkins executor,
|
||||
installed in the Jenkins container image from \texttt{jenkins/Dockerfile}
|
||||
(Python 3.13.5, as printed by the Checkout stage); it is not installed in the
|
||||
Gitea container.
|
||||
provided by the Jenkins container image
|
||||
\texttt{custom-jenkins:lts-jdk21-python3} (Python 3.13.5, as printed by the
|
||||
Checkout stage); it is not installed in the Gitea container.
|
||||
|
||||
\subsection{Reproducing a Clean Run}
|
||||
|
||||
@@ -560,7 +692,14 @@ python3 -m py_compile pricing.py tests/test_pricing.py
|
||||
python3 -m unittest discover -s tests -v
|
||||
\end{verbatim}
|
||||
(On Windows, use \texttt{python} instead of \texttt{python3}.) A clean result
|
||||
ends with \texttt{Ran 2 tests} and \texttt{OK}.
|
||||
ends with \texttt{Ran 2 tests} and \texttt{OK} (Figure~\ref{fig:ci-local}).
|
||||
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{HW6 images/runs.png}
|
||||
\caption{Local reproduction on Windows: the syntax check and both unit tests pass.}
|
||||
\label{fig:ci-local}
|
||||
\end{figure}
|
||||
|
||||
\textbf{In Jenkins:} every new commit pushed to a pull request starts a new
|
||||
run in a fresh checkout of that commit. A team member can also rebuild the
|
||||
@@ -596,9 +735,9 @@ Gitea.
|
||||
The default branch, \texttt{main}, is protected in
|
||||
Gitea~\cite{GiteaProtectedBranches}
|
||||
(\emph{Scrap-Web $\rightarrow$ Settings $\rightarrow$ Branches},
|
||||
Figure~\ref{fig:ci-branch-rule}). The rule was created on October 18, 2026,
|
||||
and the required status check was added on October 23, 2026, once Jenkins
|
||||
had reported its first status.
|
||||
Figure~\ref{fig:ci-branch-rule}). The rule was put in place on October 23, 2026, with the required
|
||||
status check, once Jenkins had reported its first status. Gitea's settings page
|
||||
does not show the rule's history far enough back to capture a dated screenshot.
|
||||
|
||||
\begin{tabularx}{\linewidth}{L{4.6cm}Y}
|
||||
\toprule
|
||||
@@ -627,8 +766,8 @@ every merge (Section~\ref{sec:ci-trigger}).
|
||||
\begin{figure}[H]
|
||||
\centering
|
||||
\includegraphics[width=0.75\linewidth]{HW6 images/branch-rule.png}
|
||||
\caption{October 18, 2026 --- Branch protection rule for \texttt{main} in
|
||||
the Scrap-Web branch settings.}
|
||||
\caption{Branch protection rule for \texttt{main} in the Scrap-Web branch
|
||||
settings.}
|
||||
\label{fig:ci-branch-rule}
|
||||
\end{figure}
|
||||
|
||||
@@ -638,8 +777,9 @@ The merge gate depends on a commit status, not on a trigger. A webhook or
|
||||
repository scan only tells Jenkins that something changed; it says nothing
|
||||
about whether the code passes. The sequence is:
|
||||
\begin{enumerate}
|
||||
\item A push to a pull request's branch is detected by the Multibranch job's
|
||||
repository scan (Section~\ref{sec:ci-trigger-config}).
|
||||
\item A push to a pull request's branch reaches Jenkins through the Gitea
|
||||
webhook or the Multibranch job's one-minute repository scan
|
||||
(Section~\ref{sec:ci-trigger-config}).
|
||||
\item The job builds the pull request's latest head commit and runs the
|
||||
\texttt{Jenkinsfile} stages.
|
||||
\item When the run starts and again when it finishes, the Jenkins Gitea
|
||||
@@ -882,15 +1022,23 @@ credentials and job configuration. The compensating restrictions are:
|
||||
\item the Jenkins web interface is reachable only over HTTPS through Caddy
|
||||
and requires login (Section~\ref{sec:ci-https}).
|
||||
\end{itemize}
|
||||
One gap remains: the Gitea webhook has no secret, so Jenkins cannot verify
|
||||
that a delivery came from Gitea. A forged delivery can only make Jenkins scan
|
||||
the repository; it cannot change the code that is built. Adding a shared
|
||||
secret to the webhook and the Jenkins Gitea configuration is the next
|
||||
hardening step.
|
||||
|
||||
\subsection{Plugin-Update Check}
|
||||
|
||||
On \textit{[date]}, \emph{Manage Jenkins $\rightarrow$ Plugins $\rightarrow$
|
||||
Updates} listed \textit{[n]} available updates \textit{[name any marked as
|
||||
security fixes]}. Action taken: \textit{[updated and restarted Jenkins /
|
||||
deferred until after the assignment, with reason]}. Plugin updates are
|
||||
checked before each assignment, and any plugin with a published security
|
||||
warning is updated first.
|
||||
On October 24, 2026, \emph{Manage Jenkins $\rightarrow$ Plugins $\rightarrow$
|
||||
Updates} listed one available update: \emph{Pipeline: API}, installed version
|
||||
\texttt{1413.v2ff1a\_5e720fa\_}, available version
|
||||
\texttt{1429.v7a\_1b\_efb\_a\_f7c5} (released two days earlier). It was not
|
||||
marked as a security fix. Action taken: deferred until after this assignment
|
||||
was submitted, because updating requires a Jenkins restart and the update
|
||||
fixes no published security warning. Plugin updates are checked before each
|
||||
assignment, and any plugin with a published security warning is updated
|
||||
first.
|
||||
|
||||
\subsection{Troubleshooting a Failed Trigger or Build}
|
||||
\label{sec:ci-troubleshoot}
|
||||
@@ -905,7 +1053,7 @@ warning is updated first.
|
||||
\texttt{gitea-jenkins-ci} credential holds a current token and that
|
||||
\texttt{jenkins-ci} is still a Write collaborator
|
||||
(Section~\ref{sec:ci-trigger}).
|
||||
\item If a webhook is used: in Gitea, open \emph{Scrap-Web $\rightarrow$
|
||||
\item In Gitea, open \emph{Scrap-Web $\rightarrow$
|
||||
Settings $\rightarrow$ Webhooks}, check \emph{Recent Deliveries} for the
|
||||
response code, and use \emph{Test Delivery} after any fix.
|
||||
\end{enumerate}
|
||||
@@ -932,6 +1080,32 @@ warning is updated first.
|
||||
\end{enumerate}
|
||||
|
||||
\section{Manual Quality and Controls}
|
||||
\textit{[Version and history entry, Hosts and Passwords table updates, UML
|
||||
deployment diagram, citations, glossary and index entries, and the operator
|
||||
restart/troubleshooting note.]}
|
||||
\label{sec:ci-quality}
|
||||
|
||||
\begin{itemize}
|
||||
\item \textbf{Version and history:} the manual is at Version 1.5, and the
|
||||
Document History table has a 1.5 entry describing this chapter and the
|
||||
table updates.
|
||||
\item \textbf{Hosts and Passwords:} the Hosts table
|
||||
(Table~\ref{tab:devops-hosts}) now lists the Jenkins hostname
|
||||
\texttt{ci.ssw590-08.me} and its internal ports 8080 and 50000, which are
|
||||
not published on the Droplet. The Passwords table
|
||||
(Table~\ref{tab:devops-passwords}) lists the Jenkins administrator
|
||||
accounts and the \texttt{jenkins-ci} integration account with hints only;
|
||||
no password or token value appears anywhere in this manual.
|
||||
\item \textbf{Deployment diagram:} Figure~\ref{fig:gitea-jenkins-deployment}
|
||||
shows the Droplet, the three containers, the \texttt{jenkins\_home}
|
||||
volume, and the browser, webhook, and status paths.
|
||||
\item \textbf{Citations:} the Jenkins Pipeline, Jenkins Gitea plugin,
|
||||
Jenkins security, and Gitea protected-branch documentation are cited
|
||||
where they are used and listed in the Bibliography.
|
||||
\item \textbf{Glossary and index:} the terms \gls{pullrequest}, \gls{webhook},
|
||||
\gls{statuscheck}, \gls{mergegate}, and \gls{jenkinsfile} were added to the
|
||||
Glossary, and the chapter is indexed under Jenkins and continuous
|
||||
integration.
|
||||
\item \textbf{Operator notes:} restarting Jenkins is
|
||||
\texttt{docker restart jenkins} (Section~\ref{sec:ci-deploy}); its data
|
||||
survives in the \texttt{jenkins\_home} volume, which is not a backup.
|
||||
Failed triggers and builds are handled with the procedure in
|
||||
Section~\ref{sec:ci-troubleshoot}.
|
||||
\end{itemize}
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
\addcontentsline{toc}{chapter}{Document History}
|
||||
\index{document history}
|
||||
|
||||
\begin{table}[H]
|
||||
\caption{Document Update History\label{Table:DocumentHistory}}
|
||||
\begin{tabularx}{\linewidth}{L{3.1cm}L{2.2cm}YL{2.0cm}}
|
||||
\toprule \textbf{Date / Version} & \textbf{Author Initials} & \textbf{Change} & \textbf{Changed At}\\ \midrule
|
||||
{\small
|
||||
\begin{longtable}{L{2.4cm}L{1.3cm}p{\dimexpr\linewidth-2.4cm-1.3cm-1.9cm-8\tabcolsep\relax}L{1.9cm}}
|
||||
\caption{Document Update History\label{Table:DocumentHistory}}\\
|
||||
\toprule \textbf{Date / Version} & \textbf{Authors} & \textbf{Change} & \textbf{Changed At}\\ \midrule
|
||||
\endfirsthead
|
||||
\toprule \textbf{Date / Version} & \textbf{Authors} & \textbf{Change} & \textbf{Changed At}\\ \midrule
|
||||
\endhead
|
||||
|
||||
October 22, 2026 / 1.5 & SK, KH & Completed the Continuous Integration with Jenkins assignment: deployed a persistent Jenkins LTS container behind HTTPS at \texttt{ci.ssw590-08.me} with firewall-restricted access; integrated Jenkins with the Scrap-Web Gitea repository through a dedicated integration account; added a pricing module, unit tests, and a versioned \texttt{Jenkinsfile}; protected \texttt{main} with a required Jenkins status check and one required approval; and demonstrated a failed, repaired, reviewed, and merged pull request. Updated the Hosts table (Jenkins host and ports) and the Passwords table (Jenkins administrator accounts and the Gitea integration token, hints only). & \ChapterRef{ContinuousIntegration}, \ChapterRef{PWDHST} \\
|
||||
November 13, 2026 / 1.7 & SK, KH & Secure Delivery and Rollback assignment: trusted Jenkins delivery agent, locked dependencies and pinned base image, Gitea container registry, staging and production proxy routes, security gates with a blocked run, build once and publish by digest, Ansible deployment with an unchanged rerun, restricted approval and promotion of the same digest, v2 release, production rollback and staging failure recovery, production health probe, runbooks, and traceability. Updated the Hosts and Passwords tables, Glossary, Bibliography, and AI Prompt Log. & \ChapterRef{SecureDelivery}, \ChapterRef{PWDHST} \\
|
||||
|
||||
October 29, 2026 / 1.6 & SK, KH & Completed the Introduction to SRE assignment: deployed Prometheus, Grafana OSS, Node Exporter, and Blackbox Exporter as four pinned, persistent containers on the existing Droplet; published authenticated Grafana at \texttt{metrics.ssw590-08.me}; built a six-panel dashboard; defined an availability SLI and SLO; configured and tested Grafana-managed alerts with a Discord contact point; and ran a controlled Jenkins outage with a blameless review. Updated the Hosts and Passwords tables and the Glossary. & \ChapterRef{SRE}, \ChapterRef{PWDHST} \\
|
||||
|
||||
October 23, 2026 / 1.5 & SK, KH & Completed the Continuous Integration with Jenkins assignment: deployed a persistent Jenkins LTS container behind HTTPS at \texttt{ci.ssw590-08.me} with firewall-restricted access; integrated Jenkins with the Scrap-Web Gitea repository through a dedicated integration account; added a pricing module, unit tests, and a versioned \texttt{Jenkinsfile}; protected \texttt{main} with a required Jenkins status check and one required approval; and demonstrated a failed, repaired, reviewed, and merged pull request. Updated the Hosts table (Jenkins host and ports) and the Passwords table (Jenkins administrator accounts and the Gitea integration token, hints only). & \ChapterRef{ContinuousIntegration}, \ChapterRef{PWDHST} \\
|
||||
|
||||
October 10, 2026 / 1.4 & SK, KH & Completed the related Gitea automation in LaTeX exercise and documented it in new chapter & \ChapterRef{AutomatedManualBuild} \\
|
||||
|
||||
@@ -15,5 +22,5 @@ October 2, 2026 / 1.3 & SK, KH & Completed the Gitea startup exercise and docume
|
||||
September 24, 2026 / 1.2 & SK, KH& Completed the Digital Ocean Docker Deployment chapter; the class-based JavaScript refactor of the two-button website with its accompanying UML class diagram; the LaTeX Docker chapter ; and the Project Proposal chapter, addressing the two-tool comparison, dashboard, SWOT, and unique-contribution rubric criteria. & \ChapterRef{Digital Ocean}, \ChapterRef{ClassBasedJSRefactor}, \ChapterRef{Latex Docker}, \ChapterRef{ProjectProposal}\\
|
||||
September 16, 2026 / 1.1 & SK, KH & Completed the Linux Commands assignment: environment setup with terminal printout figure and full solutions to Problem Set sections A--E & \ChapterRef{LinuxCommands} \\
|
||||
\bottomrule
|
||||
\end{tabularx}
|
||||
\end{table}
|
||||
\end{longtable}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
\newacronym{cd}{CD}{continuous delivery or continuous deployment}
|
||||
\newacronym{iac}{IaC}{infrastructure as code}
|
||||
\newacronym{slo}{SLO}{service-level objective}
|
||||
\newacronym{sli}{SLI}{service-level indicator}
|
||||
\newacronym{sla}{SLA}{service-level agreement}
|
||||
\newacronym{sre}{SRE}{site reliability engineering}
|
||||
\newglossaryentry{automation}{name={automation},description={A repeatable, version-controlled procedure executed by software rather than undocumented manual steps}}
|
||||
\newglossaryentry{deployment}{name={deployment},description={The controlled delivery of a versioned change to an environment}}
|
||||
\newglossaryentry{evidence}{name={evidence},description={A retained record of an actual execution, observation, or review}}
|
||||
@@ -16,3 +19,10 @@
|
||||
\newglossaryentry{statuscheck}{name={status check},description={A named pass, fail, or pending result that a CI system attaches to a specific commit}}
|
||||
\newglossaryentry{mergegate}{name={merge gate},description={A branch-protection rule that blocks a merge until required status checks pass and reviews are approved}}
|
||||
\newglossaryentry{jenkinsfile}{name={\texttt{Jenkinsfile}},sort={Jenkinsfile},description={The version-controlled file that defines a Jenkins pipeline's stages and steps}}
|
||||
\newglossaryentry{errorbudget}{name={error budget},description={The amount of failure an SLO allows over its window; for a 99\% target, 1\% of scheduled measurements}}
|
||||
\newglossaryentry{probe}{name={probe},description={A synthetic request, here an HTTPS GET from Blackbox Exporter, that tests whether a service responds as expected}}
|
||||
\newglossaryentry{contactpoint}{name={contact point},description={The Grafana destination, such as a Discord webhook or email address, that receives alert notifications}}
|
||||
\newglossaryentry{idempotence}{name={idempotence},description={The property that running the same deployment again on an already-correct system changes nothing}}
|
||||
\newglossaryentry{imagedigest}{name={image digest},description={The SHA-256 content hash that identifies one exact container image in a registry; unlike a tag, it cannot be moved to another image}}
|
||||
\newglossaryentry{releaserecord}{name={release record},description={A file that ties one deployment to its image digest, source commit, expected behavior, environment, and build}}
|
||||
\newglossaryentry{trustedagent}{name={trusted agent},description={A Jenkins build node that holds deployment credentials and therefore runs only reviewed code}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
\ChapterLabel{PWDHST}
|
||||
|
||||
\section{Passwords}
|
||||
\begin{longtable}{|p{3cm}|p{2.5cm}|p{4cm}|p{4cm}|}
|
||||
\begin{longtable}{|>{\raggedright\arraybackslash}p{3.2cm}|>{\raggedright\arraybackslash}p{3.8cm}|>{\raggedright\arraybackslash}p{6.6cm}|}
|
||||
\caption{Passwords and Credential Hints}
|
||||
\label{tab:devops-passwords}\\
|
||||
\hline
|
||||
@@ -46,12 +46,47 @@ Caddy
|
||||
& No login password configured\\
|
||||
\hline
|
||||
|
||||
Jenkins
|
||||
& samahk, kaylah7
|
||||
& Administrator passwords set at Jenkins setup; stored hashed by Jenkins\\
|
||||
\hline
|
||||
|
||||
Gitea (Jenkins integration)
|
||||
& jenkins-ci
|
||||
& Password set by the Gitea administrator; Jenkins uses a token stored only in credential \texttt{gitea-jenkins-ci}\\
|
||||
\hline
|
||||
|
||||
Grafana
|
||||
& admin
|
||||
& Administrator password kept in \texttt{grafana.secrets.env} on the Droplet; the file is in \texttt{.gitignore} and not in Git\\
|
||||
\hline
|
||||
|
||||
Discord webhook (Grafana contact point \texttt{team-alerts})
|
||||
& N/A
|
||||
& Webhook URL stored only in Grafana's database; re-created from the Discord channel's Integrations $\rightarrow$ Webhooks settings\\
|
||||
\hline
|
||||
|
||||
Deployment account (Ansible)
|
||||
& deploy
|
||||
& No password; SSH key stored only in Jenkins credential \texttt{deploy-ssh}\\
|
||||
\hline
|
||||
Gitea container registry
|
||||
& Push: Jenkins credential \texttt{gitea-registry-push}; pull: root on the Droplet
|
||||
& Package-write and package-read tokens; never stored in Git, logs, or screenshots\\
|
||||
\hline
|
||||
Production approvers (Jenkins)
|
||||
& samahk, kaylah7
|
||||
& Personal Jenkins logins; passwords not recorded here. Only these users can approve production or a production rollback\\
|
||||
\hline
|
||||
Jenkins delivery agent
|
||||
& delivery-agent
|
||||
& Agent secret in a file on the Droplet beside \texttt{agent/compose.yaml}; not in Git\\
|
||||
\end{longtable}
|
||||
|
||||
|
||||
|
||||
\section{Hosts}
|
||||
\begin{longtable}{|p{3.2cm}|p{4.2cm}|p{3.2cm}|p{3.5cm}|}
|
||||
\begin{longtable}{|>{\raggedright\arraybackslash}p{3.2cm}|>{\raggedright\arraybackslash}p{3.9cm}|>{\raggedright\arraybackslash}p{1.9cm}|>{\raggedright\arraybackslash}p{5.1cm}|}
|
||||
\caption{Hosts and Services}
|
||||
\label{tab:devops-hosts}\\
|
||||
\hline
|
||||
@@ -74,6 +109,30 @@ Gitea Git SSH & git.ssw590-08.me & 222 & Git repository SSH access \\
|
||||
\hline
|
||||
Gitea Container & gitea & 3000 & Internal Docker network web service \\
|
||||
\hline
|
||||
Caddy Container & caddy & 80, 443 & Reverse proxy and TLS certificate management \\
|
||||
Caddy Container & caddy & 80, 443 & Reverse proxy and TLS certificate management for Gitea and Jenkins \\
|
||||
\hline
|
||||
Jenkins Web Interface & ci.ssw590-08.me & 443 & HTTPS access to Jenkins through Caddy \\
|
||||
\hline
|
||||
Jenkins Container & jenkins & 8080 & Internal Docker network web service; not published on the host \\
|
||||
\hline
|
||||
Jenkins Agent Port & jenkins & 50000 & Not published on the host and not used; the delivery agent connects over WebSocket through port 8080 on \texttt{gitea-net} \\
|
||||
\hline
|
||||
Grafana Web Interface & metrics.ssw590-08.me & 443 & HTTPS access to Grafana through Caddy \\
|
||||
\hline
|
||||
Grafana Container & grafana & 3000 & Internal Docker network web service (\texttt{gitea-net} and \texttt{monitoring}); not published on the host; state in volume \texttt{monitoring\_grafana\_data} \\
|
||||
\hline
|
||||
Prometheus Container & prometheus & 9090 & Private, \texttt{monitoring} network only; metrics storage and query API; state in volume \texttt{monitoring\_prometheus\_data} \\
|
||||
\hline
|
||||
Node Exporter Container & node-exporter & 9100 & Private, \texttt{monitoring} network only; whole-Droplet CPU, memory, and root-disk metrics \\
|
||||
\hline
|
||||
Blackbox Exporter Container & blackbox-exporter & 9115 & Private, \texttt{monitoring} network only; HTTPS probes of Gitea and Jenkins \\
|
||||
\hline
|
||||
Staging Application & staging.ssw590-08.me & 443 & HTTPS access to the staging pricing service through Caddy \\
|
||||
\hline
|
||||
Production Application & app.ssw590-08.me & 443 & HTTPS access to the production-like pricing service through Caddy \\
|
||||
\hline
|
||||
Pricing Containers & pricing-staging, pricing-production & 8000 & Private, \texttt{gitea-net} only; Gunicorn; not published on the host; Compose projects under \texttt{/opt/startup/pricing-\{staging,production\}}; no data volume \\
|
||||
\hline
|
||||
Jenkins Delivery Agent & jenkins-agent & None & Container on \texttt{gitea-net}; runs Docker builds and Ansible; mounts the host Docker socket; state in volume \texttt{agent\_home} \\
|
||||
\hline
|
||||
\end{longtable}
|
||||