some brush
This commit is contained in:
@@ -8,14 +8,14 @@ You should add `PLATFORMS_GIT` environment to your Jenkins with url to git repo,
|
||||
contains single `platforms.json` file.
|
||||
|
||||
Next you should register this library in Jenkins -> System settings -> Global Pipeline Libraries:
|
||||
* Library name: `SHS`
|
||||
* Library name: `SHS.Platforms`
|
||||
* Default version: `master`
|
||||
* Project Repository: `https://git.shs.tools/SHS/jenkins_lib.git`
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
@Library('SHS') _
|
||||
@Library('SHS.Platforms') _
|
||||
node {
|
||||
def pl = new org.SHS.Platforms(this)
|
||||
pl.get()
|
||||
@@ -26,4 +26,5 @@ node {
|
||||
```
|
||||
|
||||
`dist` is JSON element of current platform
|
||||
|
||||
`"-test"` is a stage suffix
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.SHS
|
||||
|
||||
class Platforms {
|
||||
def steps
|
||||
def _root
|
||||
|
||||
public Platforms(steps) {this.steps = steps}
|
||||
|
||||
@@ -10,15 +11,17 @@ class Platforms {
|
||||
steps.dir("platforms_git") {
|
||||
steps.deleteDir()
|
||||
steps.git url: "${steps.env.PLATFORMS_GIT}"
|
||||
this._root = steps.readJSON(file: 'platforms_git/platforms.json')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void forEach(functor, stage_suffix = "") {
|
||||
def root = steps.readJSON(file: 'platforms_git/platforms.json')
|
||||
root.Platforms.each { key, dist ->
|
||||
public def root() {return _root;}
|
||||
|
||||
public void forEach(functor, stageSuffix = "", whiteList = [], blackList = []) {
|
||||
_root.Platforms.each { key, dist ->
|
||||
if (dist.enabled) {
|
||||
steps.stage ("${key}${stage_suffix}") {
|
||||
steps.stage ("${key}${stageSuffix}") {
|
||||
functor(dist)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user