From 0852aed1da0acae2040eac5d584e46d1c7dbef90 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 22:14:00 +0000 Subject: [PATCH] Squashed 'Common_scripts/' changes from 2c26b22..6a415af 6a415af CORE-594 - Debug installer creation cdd00fd CORE-594 - Debug installer creation eda4801 CORE-594 - Debug installer creation fb721bb CORE-594 - Debug installer creation f1987cb CORE-594 - Debug installer creation d282099 CORE-594 - Debug installer creation 05a32d0 CORE-594 - Debug installer creation d70f633 CORE-594 - Debug installer creation 945f837 CORE-594 - Debug installer creation 36ed63e CORE-594 - Debug installer creation a1c2d3b CORE-594 - Debug installer creation 5b3f7a7 CORE-594 - Debug installer creation cfcdf5c CORE-594 - Debug installer creation f821da7 CORE-594 - Debug installer creation git-subtree-dir: Common_scripts git-subtree-split: 6a415afe26eaa813ef1a5df891b9cfc52f1ee2ce --- import/importer.groovy | 35 ++++++++++++++++++++++++++++++++--- install/installhelper.groovy | 25 ++++++++++++++++++++++--- 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index bb0d32e..4948cad 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -20,6 +20,8 @@ class ImportOptions { String m_repo String m_revision + + boolean m_showdetails ImportOptions(script, String sourceselect = 'Jenkins job artifact', @@ -31,7 +33,8 @@ class ImportOptions { boolean flatten = false, boolean includemetainfilter = true, boolean clean = true, - appendtoparentmeta = true) { + appendtoparentmeta = true, + showdetails = false) { m_script = script m_sourceselect = sourceselect.trim() m_incrementversionnumber = incrementversionnumber @@ -43,6 +46,25 @@ class ImportOptions { m_includemetainfilter = includemetainfilter m_clean = clean m_appendtoparentmeta = appendtoparentmeta + m_showdetails = showdetails + } + + String show() { + return """m_incrementversionnumber: ${m_incrementversionnumber} + m_filter: ${m_filter} + m_excludes: ${m_excludes} + m_fingerprint: ${m_fingerprint} + m_nested: ${m_nested} + m_flatten: ${m_flatten} + m_includemetainfilter: ${m_includemetainfilter} + m_clean: ${m_clean} + m_appendtoparentmeta: ${m_appendtoparentmeta} + m_sourceselect: ${m_sourceselect} + m_jobname: ${m_jobname} + m_buildnumberorselector: ${m_buildnumberorselector} + m_repo: ${m_repo} + m_revision: ${m_revision} + """ } void setsourceselect(String sourceselect) { @@ -96,7 +118,7 @@ class ImportOptions { m_appendtoparentmeta = appendtoparentmeta } - void jenkinsjob(String jobname, buildnumberorselector) { + void jenkinsjob(String jobname, String buildnumberorselector) { m_jobname = jobname.trim() m_buildnumberorselector = [ $class: 'ParameterizedBuildSelector', @@ -109,7 +131,7 @@ class ImportOptions { m_jobname = jobname.trim() m_buildnumberorselector = [ $class: 'ParameterizedBuildSelector', - parameterName: "${buildnumberorselector}" + parameterName: "${buildnumberorselector}" ] setsourceselect('Jenkins job artifact') } @@ -125,6 +147,10 @@ class ImportOptions { releaserepo(repo, revision) setsourceselect(sourceselect) } + + void showdetails(boolean showdetails) { + m_showdetails = showdetails + } } ImportOptions getNewImportOptions() { @@ -263,6 +289,9 @@ def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { } def artifactimport(meta, ImportOptions importoptions, String destpath) { + if (importoptions.m_showdetails) { + echo "Importing artifacts:\nImport options:\n${importoptions.show()}\nto: ${destpath}" + } switch (importoptions.m_sourceselect) { case 'Jenkins job artifact': case 'Jenkins job artefact': diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 96a8b2e..57fe65b 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -23,17 +23,32 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin } // Given details about artifacts to import and details of installers to build, import artifacts that are required -def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) { +def Map artifactsImporter(meta, importer, toBuild, artifactDetails, installerDetails, boolean showdetails = false) { artifactFetched = [:] + if (showdetails) { + echo ("toBuild:\n${toBuild}\nartifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}") + } def importoptions = importer.getNewImportOptions() + importoptions.showdetails(showdetails) for (installer in toBuild) { - def artifactKeys = installerDetails.get(installer)[1] + def installerinfo = installerDetails.get(installer) + if (showdetails) { + echo ("installer:\n${installer}\ninstallerinfo:\n${installerinfo}") + } + def artifactKeys = installerinfo[1] if (artifactKeys instanceof java.lang.String) { artifactKeys = [ artifactKeys ] } + if (showdetails) { + echo ("artifactKeys:\n${artifactKeys}") + } for (artifactKey in artifactKeys) { - (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + artifactDetail = artifactDetails.get(artifactKey) + if (showdetails) { + echo ("artifactKey: ${artifactKey}\nartifactDetail:\n${artifactDetail}") + } + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetail if (artifactFetched.get(artifactKey) == null) { importoptions.jenkinsjob(sourceProject, sourceselector) importoptions.setincrementversionnumber(incrementversionnumber) @@ -45,6 +60,9 @@ def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) { } } } + if (showdetails) { + echo ("artifactFetched:\n${artifactFetched}") + } return artifactFetched } @@ -93,6 +111,7 @@ def checkISMfilebackend(String xml) { def checkISMfile(String ISMfile) { echo "Checking ISM file: ${ISMfile}" def xml = readFile(ISMfile) + echo "ISM file xml: ${xml}" (exitcode, message) = checkISMfilebackend(xml) echo message if (exitcode > 0) {