diff --git a/product/foreach.groovy b/product/foreach.groovy new file mode 100644 index 0000000..690c5e1 --- /dev/null +++ b/product/foreach.groovy @@ -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 \ No newline at end of file