From 9171d4d09383dd99d0fa5f06e3f4b50cbb26dca8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Feb 2022 17:01:43 +0000 Subject: [PATCH] Initial commit --- product/foreach.groovy | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 product/foreach.groovy 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