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.
|
contains single `platforms.json` file.
|
||||||
|
|
||||||
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`
|
* Library name: `SHS.Platforms`
|
||||||
* Default version: `master`
|
* Default version: `master`
|
||||||
* Project Repository: `https://git.shs.tools/SHS/jenkins_lib.git`
|
* Project Repository: `https://git.shs.tools/SHS/jenkins_lib.git`
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
@Library('SHS') _
|
@Library('SHS.Platforms') _
|
||||||
node {
|
node {
|
||||||
def pl = new org.SHS.Platforms(this)
|
def pl = new org.SHS.Platforms(this)
|
||||||
pl.get()
|
pl.get()
|
||||||
@@ -26,4 +26,5 @@ node {
|
|||||||
```
|
```
|
||||||
|
|
||||||
`dist` is JSON element of current platform
|
`dist` is JSON element of current platform
|
||||||
|
|
||||||
`"-test"` is a stage suffix
|
`"-test"` is a stage suffix
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.SHS
|
|||||||
|
|
||||||
class Platforms {
|
class Platforms {
|
||||||
def steps
|
def steps
|
||||||
|
def _root
|
||||||
|
|
||||||
public Platforms(steps) {this.steps = steps}
|
public Platforms(steps) {this.steps = steps}
|
||||||
|
|
||||||
@@ -10,15 +11,17 @@ class Platforms {
|
|||||||
steps.dir("platforms_git") {
|
steps.dir("platforms_git") {
|
||||||
steps.deleteDir()
|
steps.deleteDir()
|
||||||
steps.git url: "${steps.env.PLATFORMS_GIT}"
|
steps.git url: "${steps.env.PLATFORMS_GIT}"
|
||||||
|
this._root = steps.readJSON(file: 'platforms_git/platforms.json')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forEach(functor, stage_suffix = "") {
|
public def root() {return _root;}
|
||||||
def root = steps.readJSON(file: 'platforms_git/platforms.json')
|
|
||||||
root.Platforms.each { key, dist ->
|
public void forEach(functor, stageSuffix = "", whiteList = [], blackList = []) {
|
||||||
|
_root.Platforms.each { key, dist ->
|
||||||
if (dist.enabled) {
|
if (dist.enabled) {
|
||||||
steps.stage ("${key}${stage_suffix}") {
|
steps.stage ("${key}${stageSuffix}") {
|
||||||
functor(dist)
|
functor(dist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user