Initial commit
This commit is contained in:
parent
e5bca0dbb6
commit
9171d4d093
1 changed files with 61 additions and 0 deletions
61
product/foreach.groovy
Normal file
61
product/foreach.groovy
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
def productcollectionstore = null
|
||||
|
||||
/* Example expected JSON
|
||||
{
|
||||
"ProductReleaseRepos": [
|
||||
"git@hydra:print-server-releases/print_server_whole.git"
|
||||
]
|
||||
}*/
|
||||
|
||||
def String asJsonText() {
|
||||
return writeJSON(returnText: true, json: productcollectionstore, pretty: 1)
|
||||
}
|
||||
|
||||
def boolean exists() {
|
||||
return (productcollectionstore != null)
|
||||
}
|
||||
|
||||
def set(String jsontext) {
|
||||
productcollectionstore = readJSON(text: jsontext)
|
||||
echo "Product collection:\n${asJsonText()}"
|
||||
}
|
||||
|
||||
def get() {
|
||||
return productcollectionstore
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent { label AGENT_LABEL }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
|
||||
meta = autobuilderscript.startnonbuild(this)
|
||||
|
||||
set(PRODUCT_COLLECTION)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean folders') {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Iterate product collection') {
|
||||
steps {
|
||||
script {
|
||||
def productcollection = get()
|
||||
for (productrepo in productcollection.ProductReleaseRepos) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PRODUCT_COLLECTION
|
||||
Loading…
Add table
Add a link
Reference in a new issue