README.md
This commit is contained in:
65
README.md
65
README.md
@@ -1,70 +1,31 @@
|
||||
# Helper class for Jenkins
|
||||
|
||||
This repo add functionality for automate building with `platforms.json` configuration.
|
||||
This repo add functionality for automate building with SHS plugin.
|
||||
|
||||
## Setup
|
||||
|
||||
You should add `PLATFORMS_GIT` environment to your Jenkins with url to git repo, which
|
||||
contains single `platforms.json` file.
|
||||
First install [SHS.Platforms](https://git.shstk.ru/SHS/jenkins_lib) Jenkins library
|
||||
|
||||
You should add `SHSSDK_DIR` environment to your Jenkins with path to local directory on server
|
||||
where all plugins will be saved. SHS Server plugins manager works with this directory.
|
||||
|
||||
Next you should register this library in Jenkins -> System settings -> Global Pipeline Libraries:
|
||||
* Library name: `SHS.Platforms`
|
||||
* Library name: `SHS.SDK`
|
||||
* Default version: `master`
|
||||
* Project Repository: `https://git.shs.tools/SHS/jenkins_lib.git`
|
||||
* Project Repository: `https://git.shstk.ru/SHS/SHS_jenkins_lib.git`
|
||||
|
||||
## API
|
||||
|
||||
`org.SHS.Platforms` Class:
|
||||
* `get()` - download and parse `platforms.json` file from `PLATFORMS_GIT`
|
||||
* `root()` - returns root JSON object of `platforms.json`
|
||||
* `forEach(func, ...)` - iterate over platforms, `func` is only mandatory parameter:
|
||||
* `func` - method to execute for each enabled platform, pass JSON element of current platform and optional CMake toolchain argument
|
||||
* `stagePrefix` - prefix string for `stage`
|
||||
* `stageSuffix` - suffix string for `stage`
|
||||
* `whiteList` - array of permitted names, ignored if empty
|
||||
* `blackList` - array of denied names, ignored if empty
|
||||
|
||||
`whiteList` and `blackList` are case-insensitive, and can be part of platform name
|
||||
`org.SHS.SDK` Class:
|
||||
* `build()` - build plugin for all major SHS versions for all platforms, then register for further autobuild on SHS change
|
||||
|
||||
## Usage
|
||||
|
||||
Simple:
|
||||
Typically *any* plugin Jenkinfile is like this:
|
||||
```
|
||||
@Library('SHS.Platforms') _
|
||||
@Library(['SHS.Platforms', 'SHS.SDK']) _
|
||||
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"]
|
||||
)
|
||||
def sdk = new org.SHS.SDK(this)
|
||||
sdk.build()
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user