Quick Start - BredaUniversityGames/JenkinsLib GitHub Wiki
Quick Start
Set up a Jenkins pipeline for your project in 5 steps.
Step 1: Add the Jenkinsfile to Your Project
Copy the root Jenkinsfile from this repository into the root of your project repository. Uncomment the modules you need:
@Library('JenkinsLib') _
stages {
perforce.sync()
ue5.build()
// steam.deploy()
discord.alert()
}
If your project uses Git, commit and push the Jenkinsfile to the branch you want to build (e.g., main). If your project uses Perforce, submit it to the depot.
Step 2: Create a Pipeline Job
- Log in to your Jenkins server
- Click New Item in the left sidebar
- Enter a name for your job (e.g.,
MyGame-Build) - Select Pipeline as the job type
- Click OK
Step 3: Configure the Pipeline Source
Under the Pipeline section at the bottom of the job configuration page:
For Git repositories:
- Set Definition to
Pipeline script from SCM - Set SCM to
Git - Enter your Repository URL
- If private, select the appropriate Credentials (see Server Setup - Git Credentials)
- Set Branch Specifier to
*/main(or your build branch) - Leave Script Path as
Jenkinsfile
For Perforce repositories:
-
Set Definition to
Pipeline script from SCM -
Set SCM to
Perforce Software -
Select your Perforce Credentials (see Credentials - Perforce Credentials)
-
Set Workspace behaviour to
Manual (custom view) -
Configure the workspace fields:
-
Workspace name: leave the default (
jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}) — Jenkins will create this workspace on the Perforce server automatically. This workspace is only used to fetch the Jenkinsfile, not for the build itself. -
Options: check
CLOBBER -
View Mappings: map the depot path containing your Jenkinsfile to the root of the workspace — use
${P4_CLIENT}as the workspace client name, e.g.://depot/MyProject/... //${P4_CLIENT}/...
-
-
Under Populate options, select
Auto cleanup and syncwith REPLACE and DELETE checked, QUIET checked -
Leave Script Path as
Jenkinsfile -
Lightweight checkout can be left enabled as long as the Jenkinsfile is at the root of the workspace (which the view mapping above ensures). Otherwise, uncheck it.
Multiple Jenkinsfiles
You can create separate Jenkinsfiles for different tasks and point each Jenkins job at a different Script Path. For example:
| Jenkinsfile | Script Path | Purpose |
|---|---|---|
Jenkinsfile |
Jenkinsfile |
Default build |
Jenkinsfile.daily |
Jenkinsfile.daily |
Nightly/daily build with full tests |
Jenkinsfile.deploy |
Jenkinsfile.deploy |
Build + deploy to Steam/itch.io |
Each Jenkinsfile can include different stages — for example, a daily build might run tests that are too slow for every commit, while a deploy Jenkinsfile includes steam.deploy() but the default one does not.
To use this, create multiple pipeline jobs in Jenkins (e.g., MyGame-Build, MyGame-Nightly, MyGame-Deploy), each pointing to the same repository but with a different Script Path.
Step 4: First Run (Parameter Population)
- Click Save
- Click Build Now
- This first build will likely fail — that is expected. It registers all pipeline parameters with Jenkins.
- After it completes, you should see Build with Parameters in the left sidebar.
Step 5: Configure Parameters and Build
- Click Build with Parameters
- Fill in the parameters relevant to your project (paths, credentials, etc.)
- Click Build
Each stage has its own set of parameters. See the stage reference pages for details on what each parameter does.
Tip: Jenkins remembers the last parameter values you used. You only need to configure them once.
Matrix Builds (Optional)
If you need to build for multiple platforms or configurations, wrap the relevant stages in a matrix() block:
@Library('JenkinsLib') _
stages {
perforce.sync()
matrix(UE5_BUILD_PLATFORM: ['Win64', 'PS4'],
UE5_BUILD_CONFIG: ['Development', 'Shipping']) {
ue5.build()
only(UE5_BUILD_CONFIG: 'Shipping') {
steam.deploy()
}
}
discord.alert()
}
This builds all 4 platform/config combinations, but only deploys to Steam for Shipping builds. See Matrix Builds for full documentation.
Next Steps
- Server Setup — If you need to install plugins or configure credentials
- Stage Reference — Detailed documentation for each stage
- Matrix Builds — Multi-axis builds for platform/config combinations
- Architecture — How the module system works