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

  1. Log in to your Jenkins server
  2. Click New Item in the left sidebar
  3. Enter a name for your job (e.g., MyGame-Build)
  4. Select Pipeline as the job type
  5. Click OK

Step 3: Configure the Pipeline Source

Under the Pipeline section at the bottom of the job configuration page:

For Git repositories:

  1. Set Definition to Pipeline script from SCM
  2. Set SCM to Git
  3. Enter your Repository URL
  4. If private, select the appropriate Credentials (see Server Setup - Git Credentials)
  5. Set Branch Specifier to */main (or your build branch)
  6. Leave Script Path as Jenkinsfile

For Perforce repositories:

  1. Set Definition to Pipeline script from SCM

  2. Set SCM to Perforce Software

  3. Select your Perforce Credentials (see Credentials - Perforce Credentials)

  4. Set Workspace behaviour to Manual (custom view)

  5. 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}/...
      
  6. Under Populate options, select Auto cleanup and sync with REPLACE and DELETE checked, QUIET checked

  7. Leave Script Path as Jenkinsfile

  8. 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)

  1. Click Save
  2. Click Build Now
  3. This first build will likely fail — that is expected. It registers all pipeline parameters with Jenkins.
  4. After it completes, you should see Build with Parameters in the left sidebar.

Step 5: Configure Parameters and Build

  1. Click Build with Parameters
  2. Fill in the parameters relevant to your project (paths, credentials, etc.)
  3. 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