Server Setup - BredaUniversityGames/JenkinsLib GitHub Wiki
Administration guide for setting up and configuring a Jenkins server for BUAS game development projects. This guide covers plugin installation, security configuration, credential management, and multi-tenant isolation for student teams.
Install these plugins via Manage Jenkins > Plugins > Available plugins:
| Plugin | Purpose |
|---|---|
| Pipeline | Core pipeline support (usually pre-installed) |
| P4 | Perforce/Helix Core integration |
| Git | Git SCM integration |
| Credentials | Credential storage (usually pre-installed) |
| Folders | Organize jobs into folders with scoped credentials |
| Workspace Cleanup | Clean workspaces after builds |
| Lockable Resources | Prevents concurrent UE5 builds on the same node |
Optional plugins depending on which stages you use:
| Plugin | Required for |
|---|---|
| JUnit |
ue5.test(), vs.test() — test result publishing |
JenkinsLib must be configured as a Global Trusted Pipeline Library so it can run outside the Groovy sandbox. This is required for features like auto-detecting installed UE5 engine versions.
- Go to Manage Jenkins > System
- Scroll to Global Trusted Pipeline Libraries and click Add
- Configure:
-
Name:
JenkinsLib— identifier used in@Library('JenkinsLib')in Jenkinsfiles -
Default version:
main(ordevfor testing) — the branch, tag, or commit to use -
Load implicitly: unchecked — pipelines must explicitly load the library with
@Library - Allow default version to be overridden: checked — lets Jenkinsfiles specify a different branch/tag
- Include @Library changes in job recent changes: checked — shows library changes in build history
-
Cache fetched versions on controller for quick retrieval: checked — avoids re-fetching from Git on every build
-
Cache refresh time in minutes:
1440(1 day) -
Versions to exclude:
dev(exclude branches under active development from caching)
-
Cache refresh time in minutes:
- Retrieval method: Modern SCM
- Source Code Management: Git
-
Project Repository:
https://github.com/BredaUniversityGames/JenkinsLib - Credentials: leave empty for public repositories, or select a credential for private ones
- All other settings (Behaviors, Library Path) can be left at their defaults
-
Name:
- Click Save
Important: The library must be loaded in the Jenkinsfile using the
@Libraryannotation (not thelibrary()step) for trusted execution to apply. See the example Jenkinsfile for the correct syntax:@Library('JenkinsLib') _
Use Jenkins Folders to isolate student teams. Each folder gets its own credential store, preventing teams from accessing each other's credentials.
Jenkins
├── Team-Alpha/ (Folder)
│ ├── Credentials (only visible to Team-Alpha jobs)
│ │ ├── p4-alpha (Perforce credential)
│ │ └── steam-alpha (Steam credential)
│ └── Alpha-Build (Pipeline job)
├── Team-Beta/ (Folder)
│ ├── Credentials (only visible to Team-Beta jobs)
│ │ ├── p4-beta
│ │ └── discord-beta
│ └── Beta-Build
└── Shared/ (Folder - optional)
└── Credentials (shared credentials, if any)- Click New Item
- Enter the team name (e.g.,
Team-Alpha) - Select Folder
- Click OK
All pipeline jobs and credentials for that team go inside this folder.
See the Credentials page for full setup instructions covering Perforce tickets, Git PATs, SSH keys, GitHub Apps, and service credentials.
JenkinsLib pipelines expect a Windows build agent.
- Windows 10/11 or Windows Server
- Node label:
Windows(the pipeline usesnode('Windows')— see Setting the Node Label below) - Tools installed on the agent:
-
Perforce CLI (
p4.exe) if usingperforce.sync() -
Unreal Engine 5 if using
ue5.build() -
Visual Studio / MSBuild if using
vs.build() -
SteamCMD if using
steam.deploy() -
Butler if using
itch.deploy() -
BuildPatchTool if using
epic.deploy() -
sentry-cli if using
sentry.upload()
-
Perforce CLI (
The pipeline runs on a node with the label Windows. You must assign this label to your build agent.
For a new agent:
- Go to Manage Jenkins > Nodes > New Node
- Enter a name (e.g.,
build-agent-01), select Permanent Agent, click Create - In the Labels field, enter
Windows - Configure the remaining fields (remote root directory, launch method, etc.)
- Click Save
For an existing agent:
- Go to Manage Jenkins > Nodes
- Click the agent name
- Click Configure in the left sidebar
- Add
Windowsto the Labels field (space-separated if there are other labels) - Click Save
Tip: The built-in controller node can also have labels. Go to Manage Jenkins > Nodes > Built-In Node > Configure and add
Windowsto the labels. This is useful for single-machine setups but not recommended for production — use a dedicated agent instead.
Configure these environment variables on each build agent under Manage Jenkins > Nodes > (node) > Configure > Node Properties > Environment variables:
| Variable | Example | Description |
|---|---|---|
UE5_ENGINE_ROOT |
C:\Epic |
Parent directory containing UE5 installations (e.g. UE_5.3, UE_5.4). Required for ue5.build(). The pipeline auto-detects installed versions and presents them as a build parameter. |
ITCH_BUTLER_PATH |
C:\Butler\butler.exe |
Path to the Butler executable. Required for itch.deploy(). |
The pipeline uses a fixed workspace path: C:\Jenkins\<JOB_NAME>. This is hardcoded in vars/stages.groovy and overrides Jenkins' default workspace. It ensures workspace reuse between builds for faster incremental syncs (especially for Perforce, where only changed files are synced).
This path is not configurable through Jenkins — it is set by the pipeline itself. The only requirement is that the Jenkins agent has write access to C:\Jenkins\.
For a multi-student environment, use one of these authorization strategies:
This is included with Jenkins by default (via the Matrix Authorization Strategy plugin, usually pre-installed).
- Go to Manage Jenkins > Security
- Under Authorization, select Project-based Matrix Authorization Strategy
- Add your admin user and grant Administer permissions
- Add an
Authenticated Usersentry with minimal global permissions:- Overall: Read
- Job: none at the global level (permissions are set per-folder)
- Click Save
Then configure per-folder permissions:
- Navigate to a team's folder (e.g.,
Team-Alpha) - Click Configure
- Under Properties, check Enable project-based security
- Add the team members and grant:
- Job: Build, Cancel, Read
- Run: Replay, Update
- SCM: Tag
- Click Save
Repeat for each team folder. Students will only see folders where they have been explicitly granted access.
Install the Role-based Authorization Strategy plugin for a more structured approach.
- Go to Manage Jenkins > Security
- Under Authorization, select Role-Based Strategy
- Click Save
- Go to Manage Jenkins > System
- Check Restrict project naming
- Select Role-Based Strategy
- Click Save
This prevents users from creating projects outside the naming patterns defined in their roles.
Create roles:
- Go to Manage Jenkins > Manage and Assign Roles > Manage Roles
- Under Global roles, create:
-
admin— grant Overall: Administer (implies all other permissions) -
viewer— grant only Overall: Read
-
- Under Item roles, create a role per team:
- Role name:
team-alpha - Pattern:
Team-Alpha/.*(matches all jobs inside the Team-Alpha folder) - Grant: Job: Build, Cancel, Read; Run: Replay, Update
- Role name:
- Click Save
Assign roles:
- Go to Manage Jenkins > Manage and Assign Roles > Assign Roles
- Under Global roles, assign
adminto administrators andviewerto all students - Under Item roles, assign each student to their team's role
- Click Save
This ensures:
- Students can only see and run their own team's jobs
- Students cannot view or use other teams' credentials
- Students cannot modify Jenkins system settings
- All student credentials are folder-scoped (not global)
- Each team has its own folder
- Students don't have access to Manage Jenkins > Credentials
- Perforce tickets are per-team (not a shared service account, unless intentional)
- Global credentials (if any) contain only shared, non-sensitive items
Under Manage Jenkins > System > Usage Statistics or per-job configuration:
- Keep last 5-10 builds (game builds are large)
- Discard old builds to save disk space
- Set executors per agent based on available CPU/RAM
- UE5 builds are resource-intensive — 1-2 executors per agent is typical
- VS builds are lighter — 2-4 executors may work
Configure per-job under job configuration:
-
Poll SCM: check for changes on schedule (e.g.,
H/15 * * * *for every 15 min) - Webhook: configure Git/Perforce to notify Jenkins on push/submit
-
Build periodically: fixed schedule (e.g.,
H 2 * * *for nightly at 2 AM)
| Issue | Solution |
|---|---|
| Students can see other teams' credentials | Credentials are stored globally. Move them to folder-scoped credentials. |
| "Trust not established" | Server uses SSL and agent hasn't trusted the fingerprint. See Trusting the SSL Fingerprint. |
| Ticket expired | Re-run p4 login -p to generate a new ticket and update the credential in Jenkins. |