A Shared Library to reuse functions between Jenkins Pipelines
The Swarm and Discord scripts read from a JSON file containing groups.
The format for these groups look like this:
{
"groups": [
{
"name": "<GROUPNAME>",
"discordID": "<DISCORD_ID>",
"swarmID": ["<SWARM_ID>", "<SWARM_ID>"],
"type": "<GROUPTYPE>"
}
]
}
<GROUPNAME>
is the name of the group. This could be "PR", "David" or "GENERAL" for example.
<DISCORD_ID>
is the Discord ID of a "user", "role" or "channel" from the <GROUPTYPE>
.
<SWARM_ID>
is the Swarm ID of a user from the <GROUPTYPE>
.
<GROUPTYPE>
determines the type of the group. This can be "user", "role" or "channel".
Here is an example of a groups.json file:
{
"groups": [
{
"name": "<ROLE_NAME>",
"discordID": "<DISCORD_ROLE_ID>",
"swarmID": ["<SWARM_ID_ONE>", "<SWARM_ID_TWO>"],
"type": "role"
},
{
"name": "<CHANNEL_NAME>",
"discordID": "<DISCORD_CHANNEL_ID>",
"swarmID": ["<SWARM_ID_ONE>", "<SWARM_ID_TWO>", "<SWARM_ID_THREE>"],
"type": "channel"
},
{
"name": "<USER_NAME>",
"discordID": "<DISCORD_USER_ID>",
"swarmID": ["<SWARM_ID>"],
"type": "user"
}
]
}
Used to log messages to the console
Functions:
log(message)
- Log a custom messagelog.warning(message)
- Log a warninglog.error(message)
- Log an errorlog.currStage()
- Log the current stage
Handles all Perforce related functions
Functions:
init(p4credential, p4host, p4workspace, p4viewMapping, cleanForce = true)
- Syncs Perforce workspace (Should be called before all other p4v functions!)clean()
- Cleans workspace default changelist (Don't use other p4v functions after calling this function!)createTicket()
- Creates a valid ticket for Perforce/Swarm operationsunshelve(id)
- Unshelves a shelved changelistgetChangelistDescr(id)
- Get the description from a changelistgetCurrChangelistDescr()
- Get the description from the current changelist
Allows operations on the swarm server
Functions:
init(swarmUser, p4ticket, swarmUrl)
- Initializes swarm data (Should be called before all other swarm functions!)clear()
- Clears swarm data (Don't use other swarm functions after calling this function!)getParticipantsOfGroup(groupName, group)
- Get participants from a group in a JSON filegetParticipantsOfGroups(groupNames, groups)
- Get participants from multiple groups in a JSON filecreateReview(id, participants = null)
- Create a review from a shelved changelistgetReviewID(curlResponse)
- Get the ID of a reviewgetReviewAuthor(curlResponse)
- Get the author of a reviewupVote(id)
- Upvotes a swarm reviewdownVote(id)
- Downvotes a swarm reviewcomment(id, comment)
- Comments on a swarm reviewneedsReview(id)
- Sets the state of a review to "needsReview"needsRevision(id)
- Sets the state of a review to "needsRevision"approve(id)
- Approve a reviewarchive(id)
- Archive a reviewreject(id)
- Reject a reviewsetState(id, state)
- Set a review to a custom state
Handles all Unreal Engine 5 related operations
Functions
build(ue5EngineRoot, ue5ProjectName, ue5Project, config, platform, outputDir, blueprintOnly = false, logFile = "${env.WORKSPACE}\\Logs\\UE5Build-${env.BUILD_NUMBER}.txt")
- Build a (blueprintOnly) Unreal Engine 5 projectrunAllTests(config = "Development", platform = "Win64")
- Runs all tests defined in an Unreal Engine 5 projectrunNamedTests(testNames, config = "Development", platform = "Win64")
- Runs named tests defined in an Unreal Engine 5 projectrunFilteredTests(testFilter, config = "Development", platform = "Win64")
- Runs all tests in a filter. Valid filters are: Engine, Smoke, Stress, Perf & ProductrunAutomationCommand(testCommand, config = "Development", platform = "Win64")
- Runs an automation command from the Unreal Engine 5 command linefixupRedirects(platform = "Win64")
- Fixs up all redirects in an Unreal Engine 5 project
Handles all Unreal Engine 4 related operations
Functions
build(ue4EngineRoot, ue4ProjectName, ue4Project, config, platform, outputDir, blueprintOnly = false, logFile = "${env.WORKSPACE}\\Logs\\UE4Build-${env.BUILD_NUMBER}.txt")
- Build a (blueprintOnly) Unreal Engine 4 projectrunAllTests(config = "Development", platform = "Win64")
- Runs all tests defined in an Unreal Engine 4 projectrunNamedTests(testNames, config = "Development", platform = "Win64")
- Runs named tests defined in an Unreal Engine 4 projectrunFilteredTests(testFilter, config = "Development", platform = "Win64")
- Runs all tests in a filter. Valid filters are: Engine, Smoke, Stress, Perf & ProductrunAutomationCommand(testCommand, config = "Development", platform = "Win64")
- Runs an automation command from the Unreal Engine 4 command linefixupRedirects(platform = "Win64")
- Fixs up all redirects in an Unreal Engine 4 project
Uses MSBuild to compile Visual Studio projects
Functions:
build(MSBuildPath, projectPath, config, platform)
- Builds Visual Studio project
Handles communication between Jenkins and Discord
Functions:
createGroup(groupName, groupDiscordID, groupSwarmID, groupType, groupsList)
- Adds a JSON group object to a listmentionGroup(groupName, groups)
- Mention a group on discord (use with discord.createMessage)mentionGroups(groupNames, groups)
- Mention multiple groups on discord (use with discord.createMessage)swarmIDtoDiscordID(swarmID, groups)
- Convert a swarm ID to a discord IDcreateMessage(title, messageColor, fields, footer = null, content = null)
- Send a message to discord (use with discord.sendMessage)sendMessage(message, webhook)
- Uses cURL to send a message to discordsucceeded(config, platform, webhook)
- Sends build information to discord if the build succeedsfailed(config, platform, webhook)
- Sends build information to discord if the build failsnewReview(id, author, swarmUrl, webhook, buildStatus = "not built", description = null)
- Sends review information to discord when a new review is ready
Used to archive files into a zip folder using 7z
Functions:
pack(source, archiveName, use7z = true)
- Packs the content of the source folder to .zip (Uses 7z by default)unpack(archiveName, destination, use7z = true)
- Unpacks the content of a zip file to the destination folder (Uses 7z by default)
Sends files to Google Drive using cURL
Functions:
upload(source, fileName, clientID, clientSecret, refreshToken, parents)
- Uploads files to a folder in Google Drive (Shared Drives are supported)
Tool to diagnose, fix and optimize performance and debug crashes. More information: https://sentry.io/
Functions:
upload(sentryCLIPath, authToken, organisation, project, outputFolder)
- Uploads debug symbols to Sentry server
Uploads packaged projects to Steam
Functions:
init(steamCredential, steamCmdPath)
- Initializes steam data (Should be called before all other steam functions!)createDepotManifest(depotID, contentRoot, localPath = "*", depotPath = ".", isRecursive = true, exclude = "*.pdb")
- Creates the depot manifestcreateAppManifest(appID, depotID, contentRoot, description = "", isPreview = false, localContentPath = "", branch = "", outputDir= "output")
- Creates app manifesttryDeploy(appManifest)
- Tries to deploy to Steam using SteamGuarddeploy(appManifest, steamGuard = null)
- Deploy to Steam (Prefer using tryDeploy when trying to deploy to Steam!)