6b93814f10f0e2b0b1277af4350ad89f3e290a45
Helper class for Jenkins
This repo add functionality for automate building with platforms.json configuration.
Setup
You should add PLATFORMS_GIT environment to your Jenkins with url to git repo, which
contains single platforms.json file.
Next you should register this library in Jenkins -> System settings -> Global Pipeline Libraries:
- Library name:
SHS.Platforms - Default version:
master - Project Repository:
https://git.shstk.ru/SHS/jenkins_lib.git
API
org.SHS.Platforms Class:
get()- download and parseplatforms.jsonfile fromPLATFORMS_GITroot()- returns root JSON object ofplatforms.jsonforEach(func, ...)- iterate over platforms,funcis only mandatory parameter:func- method to execute for each enabled platform, pass JSON element of current platform and optional CMake toolchain argumentstagePrefix- prefix string forstagestageSuffix- suffix string forstagewhiteList- array of permitted names, ignored if emptyblackList- array of denied names, ignored if empty
whiteList and blackList are case-insensitive, and can be part of platform name
Usage
Simple:
@Library('SHS.Platforms') _
node {
def pl = new org.SHS.Platforms(this)
pl.get()
pl.forEach ({ dist ->
print("works in ${dist.docker_image}")
})
}
With toolchain:
@Library('SHS.Platforms') _
node {
def pl = new org.SHS.Platforms(this)
pl.get()
pl.forEach ({ dist, cmake_toolchain ->
print("compile in ${dist.docker_image} with arg ${cmake_toolchain}")
})
}
With filter:
@Library('SHS.Platforms') _
node {
def pl = new org.SHS.Platforms(this)
pl.get()
pl.forEach ({ dist ->
print("works in ${dist.docker_image}")
},
stagePrefix: "Build ",
stageSuffix: " soft",
whiteList: ["ubuntu", "debian", "osx"],
blackList: ["20.04", "11"]
)
}
Description
Languages
Groovy
100%