Configuration

This section covers essential settings for Jenkins master, agents, registries, credentials, and storage used by Friendly Jenkins.

Core Files

  • jenkins-master/.env — main configuration for Jenkins container and integrations.

  • jenkins-master/docker-compose.yml — master runtime; adjust ports/networks for production.

  • jenkins-master/casc.yaml — Jenkins Configuration as Code (JCasC) for folders, jobs, credentials, libraries.

  • shared-library/resources/templates/<service>/ — per-service Docker Compose templates, defaults, and configs.

Environment File (jenkins-master/.env)

Recommended keys:

# Jenkins admin + endpoints
JENKINS_ADMIN_USER=admin
JENKINS_ADMIN_PASS=<generate: openssl rand -base64 24>
JENKINS_URL=https://jenkins.example.com
JENKINS_PORT=8080
JENKINS_AGENT_PORT=50000

# Registries (Harbor example)
HARBOR_USER=robot$jenkins-qa
HARBOR_PASS=robot-token

# Git for shared library sync
GIT_USER=git-username
GIT_PASS=git-token

# Optional SMTP
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=jenkins@example.com
SMTP_PASS=app-password

# Optional webhook secret for GitLab
WEBHOOK_SECRET_EXPECTED=SHLIB_WEBHOOK_SECRET

Security tips

  • Do not commit .env files or jenkins-master/data/.

  • Generate the admin password: openssl rand -base64 24.

  • Never publish port 8080. The master is on the harbor_harbor Docker network, and nginx-proxy is the only way in.

Access and permissions

JENKINS_ADMIN_USER is the account Jenkins creates at start. To add further administrators, list their Jenkins user IDs in .env, separated by commas, and restart. The accounts must already exist:

JENKINS_ADMINS=alice,bob

An invalid ID stops the container with an error naming it. Do not set authorizationStrategy in casc.yaml: it is generated at start, and a second definition stops Jenkins from starting.

Action Logged-in user Administrator

See jobs, agents and build logs; download artifacts

Yes

Yes

Run and cancel jobs (Build with Parameters)

Yes

Yes

Own profile and API tokens

Yes

Yes

Create or configure jobs; Replay a build; delete builds; browse workspaces

No

Yes

Create or configure nodes; read agent secrets

No

Yes

Credentials, plugins, system settings, In-process Script Approval

No

Yes

Script Console

No

Through an SSH tunnel only

Anonymous visitors see nothing. Who may change which environment is decided separately, by its owners and QA_ADMIN_USERS; see the RBAC page of the shared library. A Jenkins administrator is not automatically in QA_ADMIN_USERS, or the other way round.

If the nginx allow-list is enabled, the UI and the API are reachable only from the listed IP addresses, and webhooks stay reachable from anywhere.

Docker Compose (Master)

  • The master joins the external harbor_harbor network. nginx-proxy reaches it at jenkins-qa-master:8080.

  • Only agent port 50000 is published. Do not publish 8080.

  • After the container is recreated, run docker exec nginx-proxy nginx -s reload, because its IP may have changed.

  • Do not name the image jenkins/jenkins: a docker compose pull would replace it with the official image, which lacks the tools the pipelines need.

  • The controller runs as uid 1000 with all capabilities dropped. Never mount docker.sock on it and never add user: "0:0": either one gives whoever controls Jenkins root on the host. Environments run on agents.

  • Mount volumes persistently for /var/jenkins_home/ and backup paths. They must belong to uid 1000.

Jenkins Configuration as Code (JCasC)

Key items to tune in casc.yaml:

  • Executors: keep numExecutors above 0. The QA pipelines run on the built-in node, because they work on /var/jenkins_home paths.

  • Agent port: slaveAgentPort: 50000, for inbound agents.

  • Global Library: ensure qa-shared points to your Git URL and credentials ID.

  • Credentials: Git, registry, SMTP, and webhook tokens.

  • Folders/Jobs: seed jobs provisioned via Job DSL will create the QA folders on first boot.

Storage Layout

On master (/var/jenkins_home/qa-data/):

  • envs/<env-name>/ — rendered compose files, .env, per-service env files and metadata.

  • shared-lib/ — optional synced copy of the shared library.

On agents (/opt/qa-envs/<env-name>/):

  • docker-compose.yml, .env, <service>/.env and service config dirs.

Agents

  • Labels (e.g., qa-agent, qa-perf) control targeting; auto-detection reads meta.json when deploying.

  • Ensure agents can reach registries and master: nginx for JENKINS_URL, and TCP port 50000 directly.

  • Each agent should have Docker, Compose, and git installed.

Registries

  • Harbor, Docker Hub, or private registries are supported.

  • Provide credentials through Jenkins credentials or .env variables consumed by pipelines.

  • Push/pull performed in pipelines running on agents; validate access with docker login on each agent.

Webhook Integration (GitLab)

  • Configure Generic Webhook Trigger in Jenkins.

  • Webhook URL example: http(s)://<jenkins>/generic-webhook-trigger/invoke?token=SYNC-SHARED-LIB

  • Header: X-Gitlab-Token should match WEBHOOK_SECRET_EXPECTED.

  • Regex for branches/tags can be restricted (e.g., ^(refs/heads/main|refs/tags/v\\d+\\.\\d+\\.\\d+)).

Target

The items in this section are not active on the production Jenkins server. The check on 2026-11-02 found these results. Do not describe these items as active.

Item Result of the check Owner

nginx rate limits

Not configured

verify with <owner>

nginx IP allow-list

Not configured

verify with <owner>

HTTP Strict Transport Security in nginx

Not configured

verify with <owner>

fail2ban jail for Jenkins logins

Not configured. Only the sshd jail is active

verify with <owner>

Current agent image on each QA server

Not checked on every server

QA team

Clean JENKINS_HOME and full secret rotation

Not done

verify with <owner>

For the steps, see ops/README.md in this repository.