README.md

This commit is contained in:
2024-04-24 09:39:33 +03:00
parent 91ddc4343e
commit e919b79431

View File

@@ -1,70 +1,31 @@
# Helper class for Jenkins # 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 ## Setup
You should add `PLATFORMS_GIT` environment to your Jenkins with url to git repo, which First install [SHS.Platforms](https://git.shstk.ru/SHS/jenkins_lib) Jenkins library
contains single `platforms.json` file.
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: Next you should register this library in Jenkins -> System settings -> Global Pipeline Libraries:
* Library name: `SHS.Platforms` * Library name: `SHS.SDK`
* Default version: `master` * 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 ## API
`org.SHS.Platforms` Class: `org.SHS.SDK` Class:
* `get()` - download and parse `platforms.json` file from `PLATFORMS_GIT` * `build()` - build plugin for all major SHS versions for all platforms, then register for further autobuild on SHS change
* `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
## Usage ## Usage
Simple: Typically *any* plugin Jenkinfile is like this:
``` ```
@Library('SHS.Platforms') _ @Library(['SHS.Platforms', 'SHS.SDK']) _
node { node {
def pl = new org.SHS.Platforms(this) def sdk = new org.SHS.SDK(this)
pl.get() sdk.build()
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"]
)
} }
``` ```