From 7ac2020f9bf6ec25dc4db23678f44809b834f565 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:48:38 +0100 Subject: [PATCH 01/32] GIS-1621 - Use script prompting to obtain publishing info from user --- remoteaccess/hostedftp.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy index fd81d6d..c977b97 100644 --- a/remoteaccess/hostedftp.groovy +++ b/remoteaccess/hostedftp.groovy @@ -1,7 +1,7 @@ ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") -FTPSiteInfo getHostedFTPSiteInfo() { - FTPSiteInfo hostedftpsiteinfo = +ftpremote.FTPSiteInfo getHostedFTPSiteInfo() { + ftpremote.FTPSiteInfo hostedftpsiteinfo = ftpremote.createFTPSiteInfo("ftp.hostedftp.com", "ftp@globalinkjetsystems.com", "ramshorn42", @@ -13,7 +13,7 @@ def getCustomerList() { def List customerfilenames = new ArrayList() def List customers = new ArrayList() - FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() + ftpremote.FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) customerfilenames = ftpclient.listNames() From e98c4bfb228dcc73de588f62219ac701dcfe9689 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:50:45 +0100 Subject: [PATCH 02/32] GIS-1621 - Use script prompting to obtain publishing info from user --- remoteaccess/hostedftp.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy index c977b97..eab365e 100644 --- a/remoteaccess/hostedftp.groovy +++ b/remoteaccess/hostedftp.groovy @@ -1,7 +1,7 @@ ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") -ftpremote.FTPSiteInfo getHostedFTPSiteInfo() { - ftpremote.FTPSiteInfo hostedftpsiteinfo = +def getHostedFTPSiteInfo() { + hostedftpsiteinfo = ftpremote.createFTPSiteInfo("ftp.hostedftp.com", "ftp@globalinkjetsystems.com", "ramshorn42", @@ -13,7 +13,7 @@ def getCustomerList() { def List customerfilenames = new ArrayList() def List customers = new ArrayList() - ftpremote.FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() + def ftpsiteinfo = getHostedFTPSiteInfo() FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) customerfilenames = ftpclient.listNames() From 104df0232af8c8b21e005840a77b35a19f94119c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:51:57 +0100 Subject: [PATCH 03/32] GIS-1621 - Use script prompting to obtain publishing info from user --- remoteaccess/hostedftp.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy index eab365e..5d16de5 100644 --- a/remoteaccess/hostedftp.groovy +++ b/remoteaccess/hostedftp.groovy @@ -14,7 +14,7 @@ def getCustomerList() { def List customers = new ArrayList() def ftpsiteinfo = getHostedFTPSiteInfo() - FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) + def ftpclient = ftpremote.createFTPClient(ftpsiteinfo) customerfilenames = ftpclient.listNames() for(customer in customerfilenames) { From bc89834064392d47f32a4875fdba58ccb3ce5c34 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 15:06:22 +0100 Subject: [PATCH 04/32] GIS-1621 - Use script prompting to obtain publishing info from user --- remoteaccess/ftp.groovy | 32 ++++++++++++++++---------------- remoteaccess/hostedftp.groovy | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/remoteaccess/ftp.groovy b/remoteaccess/ftp.groovy index 750319f..bdc441f 100644 --- a/remoteaccess/ftp.groovy +++ b/remoteaccess/ftp.groovy @@ -2,32 +2,32 @@ import org.apache.commons.net.ftp.FTPClient class FTPSiteInfo { - String url - String username - String password - String workingdirectory - - FTPSiteInfo(String url, String username, String password, String workingdirectory) { + String url + String username + String password + String workingdirectory + + FTPSiteInfo(String url, String username, String password, String workingdirectory) { this.url = url this.username = username this.password = password - this.workingdirectory = workingdirectory - } + this.workingdirectory = workingdirectory + } } FTPSiteInfo createFTPSiteInfo(String url, String username, String password, String workingdirectory) { FTPSiteInfo ftpsiteinfo = new FTPSiteInfo(url, username, password, workingdirectory) - return ftpsiteinfo + return ftpsiteinfo } FTPClient createFTPClient(FTPSiteInfo ftpsiteinfo) { - FTPClient ftpclient = new FTPClient().with { - connect ftpsiteinfo.url - enterLocalPassiveMode() - login ftpsiteinfo.username, ftpsiteinfo.password - changeWorkingDirectory ftpsiteinfo.workingdirectory - } - return ftpclient + FTPClient ftpclient = new FTPClient() + ftpclient.connect(ftpsiteinfo.url) + ftpclient.enterLocalPassiveMode() + ftpclient.login(ftpsiteinfo.username, ftpsiteinfo.password) + ftpclient.changeWorkingDirectory(ftpsiteinfo.workingdirectory) + + return ftpclient } return this; \ No newline at end of file diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy index 5d16de5..cf62d32 100644 --- a/remoteaccess/hostedftp.groovy +++ b/remoteaccess/hostedftp.groovy @@ -14,7 +14,7 @@ def getCustomerList() { def List customers = new ArrayList() def ftpsiteinfo = getHostedFTPSiteInfo() - def ftpclient = ftpremote.createFTPClient(ftpsiteinfo) + def ftpclient = ftpremote.createFTPClient(ftpsiteinfo) customerfilenames = ftpclient.listNames() for(customer in customerfilenames) { From 10f872058104cdcfe40625e1c3105f48090f0bf4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 15:22:24 +0100 Subject: [PATCH 05/32] GIS-1621 - Use script prompting to obtain publishing info from user --- versioncontrol/git.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index d24f3ff..719af98 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -26,9 +26,12 @@ String getGitInfo(String workingSetRootPath) { } List gettaglist(String workingSetRootPath) { + List taglist = new List() dir(workingSetRootPath) { - return clh.getCommandOutput('git tag --sort=-version:refname') + def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') + taglist = tagliststring.split() } + return taglist } @NonCPS From 6b33cd97fdb610b8f5f3f06971302bd7d974e4c7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 15:29:43 +0100 Subject: [PATCH 06/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 2 +- versioncontrol/git.groovy | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index deffec8..0ab87af 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -50,7 +50,7 @@ pipeline { steps { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - def List releases = gh.gettaglist(SOURCEDIR) + def releases = gh.gettaglist(SOURCEDIR) release = input( message: 'Please select the software version', ok: 'Ok', diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 719af98..77ca734 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -25,8 +25,8 @@ String getGitInfo(String workingSetRootPath) { } } -List gettaglist(String workingSetRootPath) { - List taglist = new List() +ArrayList gettaglist(String workingSetRootPath) { + ArrayList taglist = new ArrayList() dir(workingSetRootPath) { def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') taglist = tagliststring.split() From 5c585e5555ae2b54a864af64a021bcf99b9f5a11 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 17:47:57 +0100 Subject: [PATCH 07/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/ftp_query.groovy | 18 ---- publish/promptingpublish.groovy | 27 +++++- publish/publish_item_select.groovy | 135 ----------------------------- publish/publishitems.groovy | 92 ++++++++++++++++++++ versioncontrol/git.groovy | 2 +- 5 files changed, 118 insertions(+), 156 deletions(-) delete mode 100644 publish/ftp_query.groovy delete mode 100755 publish/publish_item_select.groovy create mode 100644 publish/publishitems.groovy diff --git a/publish/ftp_query.groovy b/publish/ftp_query.groovy deleted file mode 100644 index 02a4c2d..0000000 --- a/publish/ftp_query.groovy +++ /dev/null @@ -1,18 +0,0 @@ -ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") - -def getCustomerListFromFTP(FTPSiteInfo ftpsiteinfo) { - def List customerfilenames = new ArrayList() - def List customers = new ArrayList() - - FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) - - customerfilenames = ftpclient.listNames() - for(customer in customerfilenames) { - def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8") - customers.add(converted) - } - ftpclient.disconnect() - return customers -} - -return this; diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 0ab87af..8b2cbf6 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -4,7 +4,8 @@ pipeline { stage('Initial setup') { steps { script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = load(autobuilderscript).startnonbuild(this) } } } @@ -72,7 +73,7 @@ pipeline { } } } - stage('Get release artifact meta') { + stage('Get release artifact info') { steps { script { def mfs = autobuilderscript.getmetafolderscript() @@ -80,6 +81,28 @@ pipeline { } } } + stage('Select which items from software release to publish') { + steps { + script { + publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") + def itemsobject = publishitems.getItems(this, releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) + def selecteditems = input( + message: 'Select which items from the release are to be published', + ok: 'Ok', + parameters: [ + itemsobject.multiSelect() + ] + ) + echo "Chosen software version is: ${release}" + } + } + } + + + + + + stage('Publish components') { steps { script { diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy deleted file mode 100755 index 99e424f..0000000 --- a/publish/publish_item_select.groovy +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/local/bin/groovy - -jobnameext = jobname ?: "jobunique" -metarepoext = metarepo ?: "git@hydra:print-server-releases/print_server_whole.git" -outputselectext = outputselect ?: "description" -metalevelsstringext = metalevels ?: "2" - -//jobnameext = "jobunique" -//metarepoext = "git@hydra:print-server-releases/print_server_whole.git" -//outputselectext = "description" -//metalevelsstringext = "2" - -metalevelsext = metalevelsstringext.toInteger() -dolog = false - -commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git" - -def log(message) { - if (dolog) { - println message - } -} - -def createfolder(String folder) { - def sout = new StringBuilder() - def serr = new StringBuilder() - - log("Creating directory: ${folder}") - def s = ['mkdir', '-p', folder].execute() - s.consumeProcessOutput(sout, serr) - s.waitFor() - - log("Out: ${sout} Err: ${serr}") - return [sout, serr] -} - -def gitCloneOrPull(String repo, String folder) { - def sout = new StringBuilder() - def serr = new StringBuilder() - - if (!(new File(folder).exists())) { - log("Cloning: ${repo} to: ${folder}") - createfolder(folder) - def s = ['git', 'clone', repo, folder].execute() - s.consumeProcessOutput(sout, serr) - s.waitFor() - } else { - log("Pull in: ${folder}") - def s = ['git', 'pull'].execute(null, new File(folder)) - s.consumeProcessOutput(sout, serr) - s.waitFor() - } - - log("Out: ${sout} Err: ${serr}") - return [sout, serr] -} - -def loadmetaclass(String commonscripts, String metafolder) { - def metafolderscriptfile = "${commonscripts}/meta/folder.groovy" - - GroovyShell shell = new GroovyShell() - def metafolderscript = shell.parse(new File(metafolderscriptfile)) - def meta = metafolderscript.metafromfolderSlurper(metafolder) - return meta -} - -def makeworking() { - def r = ['whoami'].execute() - r.waitFor() - def user = r.text.trim() - - def rootfolder = "/home/${user}/tmp" - createfolder(rootfolder) - - def commonscripts = "${rootfolder}/commonscripts" - gitCloneOrPull(commonscriptsrepo, commonscripts) - - // Clone or pull the relevant meta repo - def metareporoot = "${rootfolder}/${jobnameext}" - gitCloneOrPull(metarepoext, metareporoot) - def metafolder = "${metareporoot}/meta" - - // Load the meta folder class that interprets the meta repo - def meta = loadmetaclass(commonscripts, metareporoot) - return meta -} - -def String outputDescription(menuitems, releaseinfo) { - meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") - } -} - -def String outputSelection(menuitems, releaseinfo) { - meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") - } -} - -def List getItems(meta) { - def List menuitems = new ArrayList() - def metaitems = meta.releasewalkerunique(metalevelsext) - log("metaitems is ${metaitems.getClass()}") - - try { - for (key in metaitems.keySet()) { - def releaseinfo = metaitems[key] - if (outputselectext == "description") { - outputDescription(menuitems, releaseinfo) - } - if (outputselectext == "selection") { - outputSelection(menuitems, releaseinfo) - } - } - return menuitems - } catch (Exception e) { - menuitems.add("Error ${e}") - return menuitems - } -} - -def meta = makeworking() -def items = getItems(meta) - -count = 0 -for (item in items) { - count += 1 - log ("${count}: ${item}") -} - -return items \ No newline at end of file diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy new file mode 100644 index 0000000..93ef05b --- /dev/null +++ b/publish/publishitems.groovy @@ -0,0 +1,92 @@ +import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition + +class PublishableItemsSelection { + def script + def ArrayList preselectedmenuitems + def ArrayList menuitemdescriptions + def ArrayList menuitemsfull + + ExtendedChoiceParameterDefinition multiselect + + def outputSelectionfromPreselect(menuitems, preselectedext) { + script.echo ("preselectext: ${preselectedext}") + def menuitemstemp = preselectedext.split(',') + menuitemstemp = menuitemstemp*.trim() + script.echo ("Menuitemstemp: ${menuitemstemp}") + + for (menuitem in menuitemstemp) { + menuitems.add(menuitem) + } + } + + def String outputDescription(menuitems, releaseinfo) { + def meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + } + } + + def String outputSelection(menuitems, releaseinfo) { + meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") + } + } + + PublishableItemsSelection(script, releasemeta, String preselectedext, String metalevelsstringext) { + this.script = script + preselectedmenuitems = new ArrayList() + outputSelectionfromPreselect(preselectedmenuitems, preselectedext) + menuitemdescriptions = new ArrayList() + menuitemsfull = new ArrayList() + + def Integer metalevelsext = metalevelsstringext.toInteger() + def metaitems = releasemeta.releasewalkerunique(metalevelsext) + for (key in metaitems.keySet()) { + def releaseinfo = metaitems[key] + outputDescription(menuitemdescriptions, releaseinfo) + outputSelection(menuitemsfull, releaseinfo) + } + + multiselect = new ExtendedChoiceParameterDefinition( + "name", // String name + "PT_MULTI_SELECT", // String type + menuitemsfull, // String value + "project name", // String projectName + "", // String propertyFile + "", // String groovyScript + "", // String groovyScriptFile + "", // String bindings + "", // String groovyClasspath + "", // String propertyKey + preselectedmenuitems, // String defaultValue + "", // String defaultPropertyFile + "", // String defaultGroovyScript + "", // String defaultGroovyScriptFile + "", // String defaultBindings + "", // String defaultGroovyClasspath + "", // String defaultPropertyKey + menuitemdescriptions, // String descriptionPropertyValue + "", // String descriptionPropertyFile + "", // String descriptionGroovyScript + "", // String descriptionGroovyScriptFile + "", // String descriptionBindings + "", // String descriptionGroovyClasspath + "", // String descriptionPropertyKey + "", // String javascriptFile + "", // String javascript + false, // boolean saveJSONParameterToFile + false, // boolean quoteValue + 3, // int visibleItemCount + "multiselect", // String description + ",") // String multiSelectDelimiter + } + + def multiSelect() { + return multiselect + } +} + +return this; \ No newline at end of file diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 77ca734..751d1c8 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -29,7 +29,7 @@ ArrayList gettaglist(String workingSetRootPath) { ArrayList taglist = new ArrayList() dir(workingSetRootPath) { def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') - taglist = tagliststring.split() + taglist = tagliststring.split('\\n') } return taglist } From b854e0431fc39ed6114f564ae676bda131b6181f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:04:32 +0100 Subject: [PATCH 08/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 2 +- publish/publishitems.groovy | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 8b2cbf6..c11b907 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -85,7 +85,7 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - def itemsobject = publishitems.getItems(this, releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) + def itemsobject = publishitems.getItems(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) def selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 93ef05b..175eda7 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -89,4 +89,10 @@ class PublishableItemsSelection { } } +PublishableItemsSelection createItemSelector(releasemeta, String preselectedext, String metalevelsstringext) { + PublishableItemsSelection pis = new PublishableItemsSelection(this, releasemeta, preselectedext, metalevelsstringext) + + return pis +} + return this; \ No newline at end of file From ba463fa7305ee4eeb960321739c9b1c465906fc6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:07:11 +0100 Subject: [PATCH 09/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index c11b907..38e1b42 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -5,7 +5,7 @@ pipeline { steps { script { autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = load(autobuilderscript).startnonbuild(this) + meta = autobuilderscript.startnonbuild(this) } } } @@ -85,7 +85,7 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - def itemsobject = publishitems.getItems(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) + def itemsobject = publishitems.createItemSelector(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) def selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', From 804c895fc69e873ee9b0f6e0fa06b7790590687a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:10:15 +0100 Subject: [PATCH 10/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 38e1b42..4d921d9 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -85,6 +85,7 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") + ITEMSDEFAULTLIST = "sgfdfsdf,sdfsdfsdfsf" def itemsobject = publishitems.createItemSelector(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) def selecteditems = input( message: 'Select which items from the release are to be published', From 466d9ce33bbbcf8a7d0b49751ad76714d3a20dcf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:14:21 +0100 Subject: [PATCH 11/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 175eda7..35ac1d1 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -11,11 +11,10 @@ class PublishableItemsSelection { def outputSelectionfromPreselect(menuitems, preselectedext) { script.echo ("preselectext: ${preselectedext}") def menuitemstemp = preselectedext.split(',') - menuitemstemp = menuitemstemp*.trim() script.echo ("Menuitemstemp: ${menuitemstemp}") for (menuitem in menuitemstemp) { - menuitems.add(menuitem) + menuitems.add(menuitem.trim()) } } From 233dab89d442e016a01d67bef3ac16bc28f30100 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:17:03 +0100 Subject: [PATCH 12/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 55 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 35ac1d1..a6b73f5 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -5,34 +5,7 @@ class PublishableItemsSelection { def ArrayList preselectedmenuitems def ArrayList menuitemdescriptions def ArrayList menuitemsfull - - ExtendedChoiceParameterDefinition multiselect - - def outputSelectionfromPreselect(menuitems, preselectedext) { - script.echo ("preselectext: ${preselectedext}") - def menuitemstemp = preselectedext.split(',') - script.echo ("Menuitemstemp: ${menuitemstemp}") - - for (menuitem in menuitemstemp) { - menuitems.add(menuitem.trim()) - } - } - - def String outputDescription(menuitems, releaseinfo) { - def meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") - } - } - - def String outputSelection(menuitems, releaseinfo) { - meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") - } - } + def ExtendedChoiceParameterDefinition multiselect PublishableItemsSelection(script, releasemeta, String preselectedext, String metalevelsstringext) { this.script = script @@ -83,6 +56,32 @@ class PublishableItemsSelection { ",") // String multiSelectDelimiter } + def outputSelectionfromPreselect(menuitems, preselectedext) { + script.echo ("preselectext: ${preselectedext}") + def menuitemstemp = preselectedext.split(',') + script.echo ("Menuitemstemp: ${menuitemstemp}") + + for (menuitem in menuitemstemp) { + menuitems.add(menuitem.trim()) + } + } + + def String outputDescription(menuitems, releaseinfo) { + def meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + } + } + + def String outputSelection(menuitems, releaseinfo) { + meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") + } + } + def multiSelect() { return multiselect } From 2456add31ac72e8c4e1cf925eacc0f6f7ca40ec6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:33:11 +0100 Subject: [PATCH 13/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index a6b73f5..5f7e2c2 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -7,13 +7,15 @@ class PublishableItemsSelection { def ArrayList menuitemsfull def ExtendedChoiceParameterDefinition multiselect - PublishableItemsSelection(script, releasemeta, String preselectedext, String metalevelsstringext) { + PublishableItemsSelection(script) { this.script = script preselectedmenuitems = new ArrayList() - outputSelectionfromPreselect(preselectedmenuitems, preselectedext) menuitemdescriptions = new ArrayList() menuitemsfull = new ArrayList() + } + def init(releasemeta, String preselectedext, String metalevelsstringext) { + outputSelectionfromPreselect(preselectedmenuitems, preselectedext) def Integer metalevelsext = metalevelsstringext.toInteger() def metaitems = releasemeta.releasewalkerunique(metalevelsext) for (key in metaitems.keySet()) { @@ -88,7 +90,9 @@ class PublishableItemsSelection { } PublishableItemsSelection createItemSelector(releasemeta, String preselectedext, String metalevelsstringext) { - PublishableItemsSelection pis = new PublishableItemsSelection(this, releasemeta, preselectedext, metalevelsstringext) + PublishableItemsSelection pis = new PublishableItemsSelection(this) + + pis.init(releasemeta, preselectedext, metalevelsstringext) return pis } From 44d4744d68f5f20e550704e522384c7f508e0dc8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:39:49 +0100 Subject: [PATCH 14/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 5f7e2c2..517e41d 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -64,23 +64,23 @@ class PublishableItemsSelection { script.echo ("Menuitemstemp: ${menuitemstemp}") for (menuitem in menuitemstemp) { - menuitems.add(menuitem.trim()) + menuitems.add(menuitem.trim()) } } - def String outputDescription(menuitems, releaseinfo) { + def outputDescription(menuitems, releaseinfo) { def meta = releaseinfo.meta for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") } } - def String outputSelection(menuitems, releaseinfo) { - meta = releaseinfo.meta + def outputSelection(menuitems, releaseinfo) { + def meta = releaseinfo.meta for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") + menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") } } From 5998729f0e9355d1a2a9ee3fcd7de38e2781ed72 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:49:14 +0100 Subject: [PATCH 15/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 517e41d..c959292 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -23,11 +23,16 @@ class PublishableItemsSelection { outputDescription(menuitemdescriptions, releaseinfo) outputSelection(menuitemsfull, releaseinfo) } + + script.echo("menuitemsfull is: ${menuitemsfull}") + script.echo("preselectedmenuitems is: ${preselectedmenuitems}") + script.echo("menuitemdescriptions is: ${menuitemdescriptions}") + def seperator = "," multiselect = new ExtendedChoiceParameterDefinition( "name", // String name "PT_MULTI_SELECT", // String type - menuitemsfull, // String value + menuitemsfull.join(seperator), // String value "project name", // String projectName "", // String propertyFile "", // String groovyScript @@ -35,14 +40,14 @@ class PublishableItemsSelection { "", // String bindings "", // String groovyClasspath "", // String propertyKey - preselectedmenuitems, // String defaultValue + preselectedmenuitems.join(seperator),// String defaultValue "", // String defaultPropertyFile "", // String defaultGroovyScript "", // String defaultGroovyScriptFile "", // String defaultBindings "", // String defaultGroovyClasspath "", // String defaultPropertyKey - menuitemdescriptions, // String descriptionPropertyValue + menuitemdescriptions.join(seperator),// String descriptionPropertyValue "", // String descriptionPropertyFile "", // String descriptionGroovyScript "", // String descriptionGroovyScriptFile @@ -55,7 +60,7 @@ class PublishableItemsSelection { false, // boolean quoteValue 3, // int visibleItemCount "multiselect", // String description - ",") // String multiSelectDelimiter + seperator) // String multiSelectDelimiter } def outputSelectionfromPreselect(menuitems, preselectedext) { From 8db6e6a864d91423d440dd83bcc98092e49410c3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:02:41 +0100 Subject: [PATCH 16/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 10 ++-------- publish/publishitems.groovy | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 4d921d9..e8182df 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -94,21 +94,15 @@ pipeline { itemsobject.multiSelect() ] ) - echo "Chosen software version is: ${release}" + echo "Chosen items are: ${selecteditems}" } } } - - - - - - stage('Publish components') { steps { script { def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, ITEMS_TO_PUBLISH, customer, release, MAX_META_DEPTH) + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, selecteditems, customer, release, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index c959292..6ee6392 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -31,7 +31,7 @@ class PublishableItemsSelection { multiselect = new ExtendedChoiceParameterDefinition( "name", // String name - "PT_MULTI_SELECT", // String type + "PT_CHECKBOX", // String type menuitemsfull.join(seperator), // String value "project name", // String projectName "", // String propertyFile @@ -58,7 +58,7 @@ class PublishableItemsSelection { "", // String javascript false, // boolean saveJSONParameterToFile false, // boolean quoteValue - 3, // int visibleItemCount + 100, // int visibleItemCount "multiselect", // String description seperator) // String multiSelectDelimiter } From c2f2a01bff1f914d37a4d5eac08932b38a0a92e0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:23:38 +0100 Subject: [PATCH 17/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 8 ++++++-- publish/publishitems.groovy | 27 +++++++++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index e8182df..4919116 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -85,8 +85,12 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - ITEMSDEFAULTLIST = "sgfdfsdf,sdfsdfsdfsf" - def itemsobject = publishitems.createItemSelector(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) + def itemsobject = publishitems.createItemSelector( + 'Select software items', + 'Print Server software items', + releasemeta, + ITEMSDEFAULTLIST, + MAX_META_DEPTH) def selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 6ee6392..5c33921 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -14,9 +14,17 @@ class PublishableItemsSelection { menuitemsfull = new ArrayList() } - def init(releasemeta, String preselectedext, String metalevelsstringext) { + def init( + String name, + String description, + releasemeta, + String preselectedext, + String metalevelsstringext, + String visibleItemCountExt, + String type) { outputSelectionfromPreselect(preselectedmenuitems, preselectedext) def Integer metalevelsext = metalevelsstringext.toInteger() + def Integer visibleItemCount = visibleItemCountExt.toInteger() def metaitems = releasemeta.releasewalkerunique(metalevelsext) for (key in metaitems.keySet()) { def releaseinfo = metaitems[key] @@ -30,7 +38,7 @@ class PublishableItemsSelection { def seperator = "," multiselect = new ExtendedChoiceParameterDefinition( - "name", // String name + name, // String name "PT_CHECKBOX", // String type menuitemsfull.join(seperator), // String value "project name", // String projectName @@ -58,8 +66,8 @@ class PublishableItemsSelection { "", // String javascript false, // boolean saveJSONParameterToFile false, // boolean quoteValue - 100, // int visibleItemCount - "multiselect", // String description + visibleItemCount, // int visibleItemCount + description, // String description seperator) // String multiSelectDelimiter } @@ -94,10 +102,17 @@ class PublishableItemsSelection { } } -PublishableItemsSelection createItemSelector(releasemeta, String preselectedext, String metalevelsstringext) { +PublishableItemsSelection createItemSelector( + String name, + String description, + releasemeta, + String preselectedext, + String metalevelsstringext, + String visibleItemCountExt = '100', + String type = 'PS_MULTI_SELECT') { // Could also be "PT_CHECKBOX" PublishableItemsSelection pis = new PublishableItemsSelection(this) - pis.init(releasemeta, preselectedext, metalevelsstringext) + pis.init(String name, String description, String visibleItemCountExt, releasemeta, preselectedext, metalevelsstringext) return pis } From eef4f7322c4c06e9501a0dd644e7540c963eaaa6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:28:27 +0100 Subject: [PATCH 18/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 5c33921..6a99385 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -112,7 +112,7 @@ PublishableItemsSelection createItemSelector( String type = 'PS_MULTI_SELECT') { // Could also be "PT_CHECKBOX" PublishableItemsSelection pis = new PublishableItemsSelection(this) - pis.init(String name, String description, String visibleItemCountExt, releasemeta, preselectedext, metalevelsstringext) + pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type) return pis } From 8bddadda9c4f3ed9cc311ed666717bbd5aa9ff3c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:32:24 +0100 Subject: [PATCH 19/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 6a99385..aa14c71 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -39,7 +39,7 @@ class PublishableItemsSelection { multiselect = new ExtendedChoiceParameterDefinition( name, // String name - "PT_CHECKBOX", // String type + type, // String type menuitemsfull.join(seperator), // String value "project name", // String projectName "", // String propertyFile From 6c0bd777490004baabfba4f4095282fde619aa05 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:43:01 +0100 Subject: [PATCH 20/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 4 ++-- publish/publishitems.groovy | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 4919116..6186d49 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -56,7 +56,7 @@ pipeline { message: 'Please select the software version', ok: 'Ok', parameters: [ - choice(name: 'release', choices: releases, description: 'Which release?') + choice(name: 'release', choices: releases, description: 'Which software release?') ] ) echo "Chosen software version is: ${release}" @@ -91,7 +91,7 @@ pipeline { releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) - def selecteditems = input( + selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', parameters: [ diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index aa14c71..4510554 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -21,7 +21,7 @@ class PublishableItemsSelection { String preselectedext, String metalevelsstringext, String visibleItemCountExt, - String type) { + String controltype) { outputSelectionfromPreselect(preselectedmenuitems, preselectedext) def Integer metalevelsext = metalevelsstringext.toInteger() def Integer visibleItemCount = visibleItemCountExt.toInteger() @@ -32,14 +32,21 @@ class PublishableItemsSelection { outputSelection(menuitemsfull, releaseinfo) } + script.echo("name is: ${name}") + script.echo("description is: ${description}") script.echo("menuitemsfull is: ${menuitemsfull}") script.echo("preselectedmenuitems is: ${preselectedmenuitems}") script.echo("menuitemdescriptions is: ${menuitemdescriptions}") + script.echo("visibleItemCount is: ${visibleItemCount}") + script.echo("controltype is: ${controltype}") + def seperator = "," + visibleItemCount = min(visibleItemCount, menuitemsfull.size()) + script.echo("visibleItemCount is now: ${visibleItemCount}") multiselect = new ExtendedChoiceParameterDefinition( name, // String name - type, // String type + controltype, // String type menuitemsfull.join(seperator), // String value "project name", // String projectName "", // String propertyFile From 7abe9801c379eea33f95e8112a12927bfca31b74 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:47:53 +0100 Subject: [PATCH 21/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 4510554..12c264b 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -41,7 +41,7 @@ class PublishableItemsSelection { script.echo("controltype is: ${controltype}") def seperator = "," - visibleItemCount = min(visibleItemCount, menuitemsfull.size()) + visibleItemCount = Math.min(visibleItemCount, menuitemsfull.size()) script.echo("visibleItemCount is now: ${visibleItemCount}") multiselect = new ExtendedChoiceParameterDefinition( From 40cfa28f21a419064bc625101974ea8565de2f2d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:58:16 +0100 Subject: [PATCH 22/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 4 ++-- publish/publishitems.groovy | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 6186d49..1683876 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -86,8 +86,8 @@ pipeline { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") def itemsobject = publishitems.createItemSelector( - 'Select software items', - 'Print Server software items', + 'name', //'Select software items', + 'description', //'Print Server software items', releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 12c264b..ebf42d1 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -115,7 +115,7 @@ PublishableItemsSelection createItemSelector( releasemeta, String preselectedext, String metalevelsstringext, - String visibleItemCountExt = '100', + String visibleItemCountExt = '50', String type = 'PS_MULTI_SELECT') { // Could also be "PT_CHECKBOX" PublishableItemsSelection pis = new PublishableItemsSelection(this) From ebc1d6e3796f3c66628e0e2c4c92894b051b9215 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:01:43 +0100 Subject: [PATCH 23/32] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index ebf42d1..a8c1297 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -115,8 +115,8 @@ PublishableItemsSelection createItemSelector( releasemeta, String preselectedext, String metalevelsstringext, - String visibleItemCountExt = '50', - String type = 'PS_MULTI_SELECT') { // Could also be "PT_CHECKBOX" + String visibleItemCountExt = '20', + String type = 'PT_CHECKBOX') { // Could also be "PS_MULTI_SELECT" PublishableItemsSelection pis = new PublishableItemsSelection(this) pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type) From 1572be9a9124878526e3aa8b274b0ffe811afffd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:15:13 +0100 Subject: [PATCH 24/32] GIS-1621 - The PRODUCT_NAME variable is not necessarily defined --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 18ec404..0ce6925 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -26,7 +26,7 @@ def productuniquefolder(releasemeta) { } def uniquereleasefolder(String softwarerelease, releasemeta) { - return "Software/${PRODUCT_NAME} ${softwarerelease}/${productuniquefolder(releasemeta)}" + return "Software/${softwarerelease}/${productuniquefolder(releasemeta)}" } def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) { From b85ff94505d339a6f52a81fe5557e6eef93d1e60 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:23:04 +0100 Subject: [PATCH 25/32] GIS-1621 - The PRODUCT_NAME variable is not necessarily defined --- publish/promptingpublish.groovy | 66 ++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 1683876..843a217 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -36,14 +36,16 @@ pipeline { script { hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") def List customers = hostedftb.getCustomerList() - customer = input( - message: 'Please select customer to publish to', - ok: 'Ok', - parameters: [ - choice(name: 'customer', choices: customers, description: 'Which customer?') - ] - ) - echo "Chosen customer is: ${customer}" + timeout(time: 10, unit: 'MINUTES') { + customer = input( + message: 'Please select customer to publish to', + ok: 'Ok', + parameters: [ + choice(name: 'customer', choices: customers, description: 'Which customer?') + ] + ) + echo "Chosen customer is: ${customer}" + } } } } @@ -52,14 +54,16 @@ pipeline { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def releases = gh.gettaglist(SOURCEDIR) - release = input( - message: 'Please select the software version', - ok: 'Ok', - parameters: [ - choice(name: 'release', choices: releases, description: 'Which software release?') - ] - ) - echo "Chosen software version is: ${release}" + timeout(time: 10, unit: 'MINUTES') { + release = input( + message: 'Please select the software version', + ok: 'Ok', + parameters: [ + choice(name: 'release', choices: releases, description: 'Which software release?') + ] + ) + echo "Chosen software version is: ${release}" + } } } } @@ -85,20 +89,22 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - def itemsobject = publishitems.createItemSelector( - 'name', //'Select software items', - 'description', //'Print Server software items', - releasemeta, - ITEMSDEFAULTLIST, - MAX_META_DEPTH) - selecteditems = input( - message: 'Select which items from the release are to be published', - ok: 'Ok', - parameters: [ - itemsobject.multiSelect() - ] - ) - echo "Chosen items are: ${selecteditems}" + timeout(time: 10, unit: 'MINUTES') { + def itemsobject = publishitems.createItemSelector( + 'name', //'Select software items', + 'description', //'Print Server software items', + releasemeta, + ITEMSDEFAULTLIST, + MAX_META_DEPTH) + selecteditems = input( + message: 'Select which items from the release are to be published', + ok: 'Ok', + parameters: [ + itemsobject.multiSelect() + ] + ) + echo "Chosen items are: ${selecteditems}" + } } } } From d1475e7619b5ad0256be8733908bcf00d1eb1dc5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:42:03 +0100 Subject: [PATCH 26/32] GIS-1621 - The PRODUCT_NAME variable is not necessarily defined; Use the top level product name instead --- publish/do.groovy | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 0ce6925..166a74b 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -25,12 +25,12 @@ def productuniquefolder(releasemeta) { return "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" } -def uniquereleasefolder(String softwarerelease, releasemeta) { - return "Software/${softwarerelease}/${productuniquefolder(releasemeta)}" +def uniquereleasefolder(String productline, String softwarerelease, releasemeta) { + return "Software/${productline} ${softwarerelease}/${productuniquefolder(releasemeta)}" } -def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) { - return "${releaserepofolder}/${uniquereleasefolder(softwarerelease, releasemeta)}" +def uniqueabsoluterreleasefolder(String productline, String releaserepofolder, String softwarerelease, releasemeta) { + return "${releaserepofolder}/${uniquereleasefolder(productline, softwarerelease, releasemeta)}" } def preconditions() { @@ -116,9 +116,9 @@ def copydirectory(File dirFrom, File dirTo) { } } -def recallcomponent(releaseinfo, String softwarerelease, itempathstopublish) { +def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) { def releasemeta = releaseinfo.meta - def String uniquefolderforrepo = uniqueabsoluterreleasefolder(releaserepofolder, softwarerelease, releasemeta) + def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta) summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") @@ -149,6 +149,7 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, resetfolders() preconditions() + def productline = releasemeta.productinfo.productname // Walk the meta information to a max depth, looking for artifacts to publish def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md) @@ -162,7 +163,7 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, def itempathstopublish = convertitemstopublish(itemstopublishstring) for (key in componentReleaseInfoVersionUnique.keySet()) { def releaseinfo = componentReleaseInfoVersionUnique[key] - recallcomponent(releaseinfo, softwarerelease, itempathstopublish) + recallcomponent(productline, releaseinfo, softwarerelease, itempathstopublish) } gh.stripgithistory(releaserepofolder) publish(customer) From d4e83fc00a40fed685734669f4371cac652d7060 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:56:14 +0100 Subject: [PATCH 27/32] GIS-1621 - Use one object to define hosted FTP site --- publish/do.groovy | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 166a74b..681c809 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -1,5 +1,7 @@ import groovy.io.FileType +hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") + markunstable = false unstablereason = "" @@ -88,15 +90,12 @@ def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { def publish(String customer, String finalreleaserepofolder = releaserepofolder) { summaryappend(" FTP operations: ") - def String FTP_CLIENT_LOCATION='ftp' - def String FTP_URL='ie1.hostedftp.com' - def String FTP_USER='ftp@globalinkjetsystems.com' - def String FTP_CUSTOMER_ROOT="/Customers/${customer}" - def String FTP_PASSWORD='ramshorn42' + def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() + def String ftproot = "${hostedftpsiteinfo.workingdirectory}${customer}" dir(finalreleaserepofolder) { - summaryappend("FTP operations: Transferring to ${FTP_CUSTOMER_ROOT}") + summaryappend("FTP operations: Transferring to ${ftproot}") sh """#!/bin/bash - ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" . + ncftpput -u ${hostedftpsiteinfo.username} -p ${hostedftpsiteinfo.password} -R ${hostedftpsiteinfo.url} "${ftproot}" . """ summaryappend(", Transferred ") } From 60c68622cdd5d95e432a864e338616143a401c0e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 22:56:43 +0100 Subject: [PATCH 28/32] GIS-1621 - Alter how hostedftpsite object is passed around - surtsey2 is crashing --- publish/do.groovy | 13 +++++-------- publish/promptingpublish.groovy | 3 ++- publish/publish.groovy | 4 +++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 681c809..1b227f4 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -1,7 +1,5 @@ import groovy.io.FileType -hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") - markunstable = false unstablereason = "" @@ -87,10 +85,9 @@ def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { } } -def publish(String customer, String finalreleaserepofolder = releaserepofolder) { +def publish(hostedftpsiteinfo, String customer, String finalreleaserepofolder = releaserepofolder) { summaryappend(" FTP operations: ") - def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() def String ftproot = "${hostedftpsiteinfo.workingdirectory}${customer}" dir(finalreleaserepofolder) { summaryappend("FTP operations: Transferring to ${ftproot}") @@ -143,7 +140,7 @@ def convertitemstopublish(String itemstopublishstring) { // Publish selected items from a release to the customer folder on the ftp site // itemstopublishstring is a comma-seperated set of strings in this format ## -def publishhierarchy(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { +def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { int md = maxdepth.toInteger() resetfolders() preconditions() @@ -165,13 +162,13 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, recallcomponent(productline, releaseinfo, softwarerelease, itempathstopublish) } gh.stripgithistory(releaserepofolder) - publish(customer) + publish(hostedftpsiteinfo, customer) return [summarystring, markunstable, unstablereason] } -def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) { - return publishhierarchy(releasemeta, "", customer, softwarerelease, maxdepth) +def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) { + return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth) } return this; diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 843a217..3d3e114 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -112,7 +112,8 @@ pipeline { steps { script { def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, selecteditems, customer, release, MAX_META_DEPTH) + def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, selecteditems, customer, release, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' diff --git a/publish/publish.groovy b/publish/publish.groovy index b478a5d..5750275 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -44,7 +44,9 @@ pipeline { steps { script { def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, ITEMS_TO_PUBLISH, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH) + def hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") + def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, ITEMS_TO_PUBLISH, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' From ebce149ada00f422efe4c81d888d6d3737898835 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 23:06:50 +0100 Subject: [PATCH 29/32] GIS-1621 - Alter name of dialog --- publish/promptingpublish.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 3d3e114..500c609 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -91,8 +91,8 @@ pipeline { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") timeout(time: 10, unit: 'MINUTES') { def itemsobject = publishitems.createItemSelector( - 'name', //'Select software items', - 'description', //'Print Server software items', + 'Select software items', + 'Print Server software items', releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) From 512279a5f1d7971a84bb9f6a0d0084deec529d1c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 23:14:42 +0100 Subject: [PATCH 30/32] GIS-1621 - Alter name of dialog --- publish/promptingpublish.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 500c609..47f1e9e 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -95,7 +95,9 @@ pipeline { 'Print Server software items', releasemeta, ITEMSDEFAULTLIST, - MAX_META_DEPTH) + MAX_META_DEPTH, + '20', + 'PS_MULTI_SELECT') selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', From af39d5d8f91c2af23458d8cdc963df45e43f3d2c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 23:18:21 +0100 Subject: [PATCH 31/32] GIS-1621 - Alter name of dialog --- publish/promptingpublish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 47f1e9e..c9138b0 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -97,7 +97,7 @@ pipeline { ITEMSDEFAULTLIST, MAX_META_DEPTH, '20', - 'PS_MULTI_SELECT') + 'PT_MULTI_SELECT') selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', From fec34dd485dd37aa8f8d062f6676e32ac640a4ec Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 23:19:02 +0100 Subject: [PATCH 32/32] GIS-1621 - Alter name of dialog --- publish/publishitems.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index a8c1297..d84123d 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -116,7 +116,7 @@ PublishableItemsSelection createItemSelector( String preselectedext, String metalevelsstringext, String visibleItemCountExt = '20', - String type = 'PT_CHECKBOX') { // Could also be "PS_MULTI_SELECT" + String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT" PublishableItemsSelection pis = new PublishableItemsSelection(this) pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type)