From 4b914018772260e54de9add6519d4f55803c2c13 Mon Sep 17 00:00:00 2001 From: Ben Dowding Date: Thu, 20 Jun 2019 11:11:41 +0100 Subject: [PATCH 01/96] Update to load both sg600 and ktb logic --- copy/logic.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index f71c083..a5b134b 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -24,10 +24,12 @@ pipeline { stage('Copying logic artifacts') { steps { script { - env.LOGICDEST = "${WORKSPACE}/logic" + env.SG600_LOGICDEST = "${WORKSPACE}/sg600_logic" + env.KTB_LOGICDEST = "${WORKSPACE}/ktb_logic" if (LOGIC_ARTIFACT_LOCATION == "Jenkins job artifact") { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - importer.artifactimport(meta, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGICDEST) + importer.artifactimport(meta, KTB_LOGIC_ARTIFACT_PROJECT, KTB_LOGIC_ARTIFACT_BUILD_SELECTOR, KTB_LOGICDEST) + importer.artifactimport(meta, SG600_LOGIC_ARTIFACT_PROJECT, SG600_LOGIC_ARTIFACT_BUILD_SELECTOR, SG600_LOGICDEST) } } } From 9858ef75a61da7303b2cc60e476c9782c7c78f80 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:12:50 +0100 Subject: [PATCH 02/96] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 27 +++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 302b4f8..e93ed4b 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -54,7 +54,7 @@ def doCheck(checkpathlist, build_variant = "") { return result } -def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { +def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { def result = 0 def destFolder = "" def srcFile = "" @@ -71,9 +71,12 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } else { echo "No build variant" - destFolder = "${exportfolder}/${project}" + destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + if (partdest) { + destFolder += "/" + partdest + } } dir (destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" @@ -146,7 +149,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] if (variantstobuild) { toBuildUntrimmed = variantstobuild.split(',') @@ -162,32 +165,26 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo + (build, project, variants, exportpathlist, destpart) = appInfo if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" - } - else { - buildtype = "-build" - } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" timeout(time: 10, unit: 'MINUTES') { if (isUnix()) { sh """ echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" """ } } @@ -195,7 +192,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, "", build_variant) + result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." } @@ -214,7 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - result = doExport(exportfolder, exportpathlist, project) + result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } From 231f87a98d58b1267978e1c14581e32b2cc0dc96 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:38:21 +0100 Subject: [PATCH 03/96] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e93ed4b..bb79b36 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -79,10 +79,11 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } } dir (destFolder) { - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ - cp -r -v "${srcFileExpanded}" "${destFolder}" + cp -r -v "${srcFileExpanded}" "${destFolderExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true @@ -93,7 +94,7 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } else { result = bat( script: """ - copy "${srcFileExpanded}" "${destFolder}" + copy "${srcFileExpanded}" "${destFolderExpanded}" if errorlevel 1 EXIT /b 1 """, returnStatus: true @@ -209,12 +210,20 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } } } } From 08f6b9b0d9b93d3d267e7862122f7657cfed9732 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:49:24 +0100 Subject: [PATCH 04/96] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index bb79b36..9ebe541 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -78,8 +78,8 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { destFolder += "/" + partdest } } - dir (destFolder) { - def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + dir (destFolderExpanded) { echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ From 63c4ae0b608be0febc86dbfb5f9f998bbf51d345 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:05:02 +0100 Subject: [PATCH 05/96] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 9ebe541..b3e25bd 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -62,18 +62,16 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { - echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - destFolder = "${exportfolder}/${build_variant}" srcFile = "${WORKSPACE}/${exportpath}" srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" - destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + destFolder = "${exportfolder}" if (partdest) { destFolder += "/" + partdest } @@ -165,7 +163,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } - for (appInfo in apps ) { + for (appInfo in apps) { (build, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { From c6eade9db243490c5a21a0d6d99b9187a3cb40a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:20:48 +0100 Subject: [PATCH 06/96] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 34 ++++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b3e25bd..721a024 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, project, variants, exportpathlist, destpart) = appInfo + (build, export, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,9 +191,11 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } else { @@ -208,17 +210,19 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } } From 8307a878e8590d0a662e5d0a564427c79b93ac9b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:43:26 +0100 Subject: [PATCH 07/96] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 721a024..77124d7 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, export, project, variants, exportpathlist, destpart) = appInfo + (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,7 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - if (export) { + if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." @@ -210,7 +210,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (export) { + if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { From 69f2b9031ad426bcccb3acc85f2845b2055291a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:52:24 +0100 Subject: [PATCH 08/96] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 77124d7..e3d2ffb 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -191,6 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } + echo "Doing export: ${doexport}" if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { @@ -202,7 +203,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou echo "Not building ${build_variant} variant of project: ${project}" } } catch (Exception e) { - echo "Build failed - Waiting for a while" + echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') error "Build failed..." } @@ -210,6 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { + echo "Doing export: ${doexport}" if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) @@ -231,7 +233,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } catch (Exception e) { // doKillLeftovers() - error "Build failed - Killing leftovers" + error "Exception: ${e.message()}\nBuild failed - Killing leftovers" } } } From 9eec8e8822a25af77b13b533943d337858eec0e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:32:08 +0100 Subject: [PATCH 09/96] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 133 +++++++++++--------- 1 file changed, 71 insertions(+), 62 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e3d2ffb..b5b5401 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,6 +147,74 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } +def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing build and export project: ${project} : ${doexport}" + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" + """ + } + } + result = doCheck(exportpathlist, build_variant) + if (result != 0) { + error "Failed to check files...." + } + echo "Doing export: ${doexport}" + if (doexport) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + else { + echo "Not building ${build_variant} variant of project: ${project}" + } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } + } + } +} + +def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing export only project: ${project} : ${doexport}" + if (doexport) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + } + } +} + // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] @@ -166,74 +234,15 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" - """ - } - } - result = doCheck(exportpathlist, build_variant) - if (result != 0) { - error "Failed to check files...." - } - echo "Doing export: ${doexport}" - if (doexport) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - else { - echo "Not building ${build_variant} variant of project: ${project}" - } - } catch (Exception e) { - echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } - } - } + doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } else { - echo "Doing export: ${doexport}" - if (doexport) { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - } - } + doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } } catch (Exception e) { // doKillLeftovers() - error "Exception: ${e.message()}\nBuild failed - Killing leftovers" + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" } } } From 3702a176238222d7b7faf30b55ae53a12fb34a0a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:39:32 +0100 Subject: [PATCH 10/96] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b5b5401..0de368c 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -234,7 +234,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) + doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) } else { doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) From 71b5f14aebcd7f1d151ec65ec412ce045b8b45a4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:46:24 +0100 Subject: [PATCH 11/96] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 0de368c..3070e4e 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { +// try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } - } catch (Exception e) { - echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } +// } catch (Exception e) { +// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" +// sleep(time: 4, unit: 'SECONDS') +// error "Build failed..." +// } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - try { +// try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -240,10 +240,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } - } catch (Exception e) { - // doKillLeftovers() - error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" - } +// } catch (Exception e) { +// // doKillLeftovers() +// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" +// } } } From 26ccb7c61103daae6805b9054ef0bb5f6136f8f9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:59:14 +0100 Subject: [PATCH 12/96] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 3070e4e..779c235 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -194,7 +194,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 } } -def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doExportOnlyProject(String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing export only project: ${project} : ${doexport}" if (doexport) { if (!variants) { @@ -232,6 +232,8 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { + def Boolean build + def Boolean doexport (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) From 82fc5b6e05e9932527420aa318628f4e2a83a5f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 18:37:16 +0100 Subject: [PATCH 13/96] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 779c235..9ab8df3 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) -// try { + try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } -// } catch (Exception e) { -// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" -// sleep(time: 4, unit: 'SECONDS') -// error "Build failed..." -// } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { -// try { + try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -242,10 +242,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } -// } catch (Exception e) { -// // doKillLeftovers() -// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" -// } + } catch (Exception e) { + // doKillLeftovers() + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" + } } } From a0f4bcac3f89c19e0d2744fd8816dc819fc429c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:24:14 +0100 Subject: [PATCH 14/96] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 packaging/debian.groovy diff --git a/packaging/debian.groovy b/packaging/debian.groovy new file mode 100644 index 0000000..d55b6a9 --- /dev/null +++ b/packaging/debian.groovy @@ -0,0 +1,49 @@ +class DebRootDefinitions { + String PACKAGE_PREFIX + String PACKAGE_FOLDER_NAME + String PACKAGE_NAME + + String DEBPATH + + String ETC + String GIS_OPT_BIN + String GIS_OPT_LIB + String GIS_OPT_SCRIPTS_APP + String GIS_OPT_SCRIPTS_EL + String GIS_OPT_WWW + String GIS_OPT_OTHER + String GIS_OPT_LOGIC + String GIS_OPT_PRINTHEAD + + String USR_BIN + String USR_LIB_ARCH + String LIB_FIRMWARE + String HTTP_DEV_DIV + String LIB_SYSTEMD + + DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + PACKAGE_PREFIX = packageprefix + PACKAGE_FOLDER_NAME = packageprefix + buildstamp + PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + + DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + + ETC = "${DEBPATH}/etc" + GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + + USR_BIN = "${DEBPATH}/usr/bin" + USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + } +} + +return this; \ No newline at end of file From 0b7491ef4913a06b16dcc8dd598857bda23b9fe2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:39:05 +0100 Subject: [PATCH 15/96] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index d55b6a9..127173e 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,4 @@ -class DebRootDefinitions { +class DebRootDefinition { String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -21,7 +21,7 @@ class DebRootDefinitions { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" @@ -46,4 +46,8 @@ class DebRootDefinitions { } } +def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packageprefix, buildstamp) +} + return this; \ No newline at end of file From 99bc0a33fc5d0e2e7a8130656a71c7622de381db Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:47:37 +0100 Subject: [PATCH 16/96] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 127173e..84ba090 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -3,6 +3,7 @@ class DebRootDefinition { String PACKAGE_FOLDER_NAME String PACKAGE_NAME + String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH String ETC @@ -26,6 +27,7 @@ class DebRootDefinition { PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" From 3b5b2d11819ca02b472fc39fc27a55129a5a7e79 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:59:08 +0100 Subject: [PATCH 17/96] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 84ba090..9340180 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,5 @@ class DebRootDefinition { + String ROOTPATH String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -23,12 +24,13 @@ class DebRootDefinition { String LIB_SYSTEMD DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" - PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" - DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" + DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" From 6f37f6256364bc748d5de6e4096a9c748e30e7ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 14:42:12 +0100 Subject: [PATCH 18/96] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 9340180..a7de1f0 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -54,4 +54,30 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix, Strin return new DebRootDefinition(rootpath, packageprefix, buildstamp) } +def buildPackage(String packageout, DebRootDefinition packagedefs) { + sh """#!/bin/bash + # Exit if any command fails + set -e + + mkdir -v -p "${packagedefs.USR_BIN}" + mkdir -v -p "${packagedefs.USR_LIB_ARCH}" + mkdir -v -p "${packagedefs.LIB_FIRMWARE}" + + mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" + mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" + + cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/preinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/prerm" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postrm" + + mkdir -v -p "${packageout}" + dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + + dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + """ +} + return this; \ No newline at end of file From b2cbec1d7cf8faf0b920b122662037e0c021639b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 18:08:54 +0100 Subject: [PATCH 19/96] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index a7de1f0..25d06a2 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -12,6 +12,7 @@ class DebRootDefinition { String GIS_OPT_LIB String GIS_OPT_SCRIPTS_APP String GIS_OPT_SCRIPTS_EL + String GIS_OPT_SCRIPTS_CONTROL String GIS_OPT_WWW String GIS_OPT_OTHER String GIS_OPT_LOGIC @@ -37,6 +38,7 @@ class DebRootDefinition { GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" From e09b9e780eb477cfb1a08d5ae504d540a6f4d2ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 18:53:12 +0100 Subject: [PATCH 20/96] GIS-1621 - Do static analysis --- staticanalysis/ccm.groovy | 110 ++++++++++++++++++++++++++ staticanalysis/cpd.groovy | 139 +++++++++++++++++++++++++++++++++ staticanalysis/cppcheck.groovy | 104 ++++++++++++++++++++++++ 3 files changed, 353 insertions(+) create mode 100644 staticanalysis/ccm.groovy create mode 100644 staticanalysis/cpd.groovy create mode 100644 staticanalysis/cppcheck.groovy diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy new file mode 100644 index 0000000..290c897 --- /dev/null +++ b/staticanalysis/ccm.groovy @@ -0,0 +1,110 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + CCMURL = 'git@hydra:tools/ccm.git' + CCMBRANCH = 'origin/master' + CCMDIR = "${WORKSPACE}/ccm" + configurationhelper.gitCheckoutAndRegister(meta, 'ccm', CCMURL, CCMBRANCH, CCMDIR) + CCM = "${CCMDIR}/bin/CCM.exe" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEREVISION = "${SOURCE_REVISION}" + SOURCEDIR = "${WORKSPACE}/source" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = "${SOURCEDIR}" + env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}" + } + } + } + stage("Clean exports") { + steps { + script { + STATICANALYSIS = 'staticanalysis' + cleanfolders = [ + STATICANALYSIS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Static analysis') { + steps { + script { + def CCMOLDER = "${STATICANALYSIS}/ccm" + dir(CCMOLDER) { + bat """ + "${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml + """ + } + recordIssues(tools: [ + ccm(pattern: "**/ccm.xml", reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy new file mode 100644 index 0000000..18cdb43 --- /dev/null +++ b/staticanalysis/cpd.groovy @@ -0,0 +1,139 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + if (isUnix()) { + PYTHONBRANCH = 'origin/3.6.3_linux' + } else { + PYTHONBRANCH = 'origin/3.6.3_windows' + } + PYTHONDIR = "${WORKSPACE}/python" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + JAVAURL = 'git@hydra:tools/openjdk.git' + if (isUnix()) { + JAVABRANCH = 'origin/openjdk-11.0.2_linux-x64_bin' + } else { + JAVABRANCH = 'origin/openjdk-11.0.2_windows-x64_bin' + } + JAVADIR = "${WORKSPACE}/java" + configurationhelper.gitCheckoutAndRegister(meta, 'java', JAVAURL, JAVABRANCH, JAVADIR) + JAVA = "${JAVADIR}/ver/bin" + if (isUnix()) { + env.PATH = JAVA + ':' + PATH + } else { + env.PATH = JAVA + ';' + PATH + } + + PPDURL = 'git@hydra:tools/pmd.git' + PPDBRANCH = 'origin/master' + PPDDIR = "${WORKSPACE}/ppd" + configurationhelper.gitCheckoutAndRegister(meta, 'ppd', PPDURL, PPDBRANCH, PPDDIR) + PPD = "${PPDDIR}/bin" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEREVISION = "${SOURCE_REVISION}" + SOURCEDIR = "${WORKSPACE}/source" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = "${SOURCEDIR}" + env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}" + } + } + } + stage("Clean exports") { + steps { + script { + STATICANALYSIS = 'staticanalysis' + cleanfolders = [ + STATICANALYSIS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Static analysis') { + steps { + script { + def PPDFOLDER = "${STATICANALYSIS}/ppd" + dir(PPDFOLDER) { + if (isUnix()) { + sh """#!/bin/bash + set -e + + export PMD_JAVA_OPTS=-Xmx16384m + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml + """ + } else { + bat """ + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml + """ + } + } + recordIssues(tools: [ + cpd(pattern: "**/cpd.xml", reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy new file mode 100644 index 0000000..b3b997e --- /dev/null +++ b/staticanalysis/cppcheck.groovy @@ -0,0 +1,104 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEREVISION = "${SOURCE_REVISION}" + SOURCEDIR = "${WORKSPACE}/source" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = "${SOURCEDIR}" + env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}" + } + } + } + stage("Clean exports") { + steps { + script { + STATICANALYSIS = 'staticanalysis' + cleanfolders = [ + STATICANALYSIS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Static analysis') { + steps { + script { + def CPPCHECKFOLDER = "${STATICANALYSIS}/cppcheck" + dir(CPPCHECKFOLDER) { + bat """ + "${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml + """ + } + recordIssues(tools: [ + cppCheck(pattern: "**/cppcheck.xml", reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} From a87215229efa2b30d451217216c3d93fc8dcf534 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 19:43:30 +0100 Subject: [PATCH 21/96] Update static analysis --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 18cdb43..d1a227f 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -84,7 +84,7 @@ pipeline { dir(PPDFOLDER) { if (isUnix()) { sh """#!/bin/bash - set -e + set -xe export PMD_JAVA_OPTS=-Xmx16384m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml From 3ad05866a5c50d26e2b1c786bf19211d7b8ff230 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 19:50:44 +0100 Subject: [PATCH 22/96] Update static analysis --- staticanalysis/cpd.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index d1a227f..9277ca9 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -87,12 +87,12 @@ pipeline { set -xe export PMD_JAVA_OPTS=-Xmx16384m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnValidation false > cpd.xml """ } else { bat """ set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnValidation false > cpd.xml """ } } From 34fd570e60cda2b21df321f6dc8a60bde5581720 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 19:52:55 +0100 Subject: [PATCH 23/96] Update static analysis --- staticanalysis/cpd.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 9277ca9..b114ee8 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -87,12 +87,12 @@ pipeline { set -xe export PMD_JAVA_OPTS=-Xmx16384m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnValidation false > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml """ } else { bat """ set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnValidation false > cpd.xml + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml """ } } From d4aea83255d773ff9b59a8df08bc0b0ac9f1391f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 19:56:19 +0100 Subject: [PATCH 24/96] Update static analysis --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index b114ee8..4691eb4 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -84,7 +84,7 @@ pipeline { dir(PPDFOLDER) { if (isUnix()) { sh """#!/bin/bash - set -xe + set -e export PMD_JAVA_OPTS=-Xmx16384m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml From 0a198ebd1cf5e714338794c11b04702838e4cf98 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 08:33:35 +0100 Subject: [PATCH 25/96] Increase max mem that can be used for cpd --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 4691eb4..defca8a 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,7 +86,7 @@ pipeline { sh """#!/bin/bash set -e - export PMD_JAVA_OPTS=-Xmx16384m + export PMD_JAVA_OPTS=-Xmx49152m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml """ } else { From 97e540f2c219587c0d0e68d818bfea93e29767c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 19:20:40 +0100 Subject: [PATCH 26/96] Up the amount of memory that cpd can use --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index defca8a..21b8a5e 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,7 +86,7 @@ pipeline { sh """#!/bin/bash set -e - export PMD_JAVA_OPTS=-Xmx49152m + export PMD_JAVA_OPTS=-Xmx65536m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml """ } else { From 653623282ec8dad33944edd51d1d3661decd9d63 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 14:57:02 +0100 Subject: [PATCH 27/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 109 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 publish/package.groovy diff --git a/publish/package.groovy b/publish/package.groovy new file mode 100644 index 0000000..3efe70b --- /dev/null +++ b/publish/package.groovy @@ -0,0 +1,109 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + if (isUnix()) { + PYTHONBRANCH = "origin/3.6.3_linux" + } + else { + PYTHONBRANCH = "origin/3.6.3_windows" + } + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + } + stage('Clean exports') { + steps { + script { + PACKAGEDEST = "${WORKSPACE}/package" + cleanfolders = [ + PACKAGEDEST, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Copying package artifacts') { + steps { + script { + packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + } + } + } + stage('Aptly environment') { + steps { + script { + echo "Aptly config file is ${APTLY_CONFIG_FILE}" + sh """!/#bin/bash + aptly config show + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + stage('Create repo - if not already there') { + steps { + script { + echo "Repo name is ${REPO_NAME}" + sh """!/#bin/bash + aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" + if [ \$? -ne 0 ]; then + echo "aptly repo ${REPO_NAME} does not exist; Creating it" + aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + fi + """ + } + } + } + stage('Create snapshot - if not already there') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """!/#bin/bash + # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + """ + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + From 0d396b78b9a208804ca9cba33f92c80020ddb586 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:10:03 +0100 Subject: [PATCH 28/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/package.groovy b/publish/package.groovy index 3efe70b..da6791c 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -47,6 +47,7 @@ pipeline { stage('Copying package artifacts') { steps { script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) } } From fc780b39ac0e77a8b887906c9e9b11369ba7262e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:11:54 +0100 Subject: [PATCH 29/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index da6791c..bf48231 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -56,7 +56,7 @@ pipeline { steps { script { echo "Aptly config file is ${APTLY_CONFIG_FILE}" - sh """!/#bin/bash + sh """#!/bin/bash -v aptly config show if [ \$? -ne 0 ]; then exit 1; fi """ @@ -67,7 +67,7 @@ pipeline { steps { script { echo "Repo name is ${REPO_NAME}" - sh """!/#bin/bash + sh """#!/bin/bash -v aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" if [ \$? -ne 0 ]; then echo "aptly repo ${REPO_NAME} does not exist; Creating it" @@ -84,7 +84,7 @@ pipeline { echo "Snapshot name is ${SNAPSHOT_NAME}" FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" - sh """!/#bin/bash + sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" """ From 11c4c7ab0e21a8530ca2fcf09a9cfb3fbc9c0426 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:17:50 +0100 Subject: [PATCH 30/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/package.groovy b/publish/package.groovy index bf48231..8626a61 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -87,6 +87,7 @@ pipeline { sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" """ } } From 9da4613bfca89e156ab90454c8b0e4af62a52e0f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:41:19 +0100 Subject: [PATCH 31/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/publish/package.groovy b/publish/package.groovy index 8626a61..5fe46e8 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -49,6 +49,7 @@ pipeline { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + PACKAGE_FOLDER = "${PACKAGEDEST}/package" } } } @@ -78,6 +79,17 @@ pipeline { } } } + stage('Add/update package in snapshot') { + steps { + script { + echo "Package folder is ${PACKAGE_FOLDER}" + sh """#!/bin/bash -v + aptly snapshot -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } stage('Create snapshot - if not already there') { steps { script { @@ -86,8 +98,11 @@ pipeline { echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } From acb477c98433989ddf77a6098b046276b34aa110 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:42:28 +0100 Subject: [PATCH 32/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 5fe46e8..253f22e 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly snapshot -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 691c3bb58eb4fc0e3647405688c48397e861c8f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:44:26 +0100 Subject: [PATCH 33/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 253f22e..99a2bdf 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 6684ef24f0fe98fee8b65fe9b0323c3f632ea271 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:46:25 +0100 Subject: [PATCH 34/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 99a2bdf..b3256a8 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From e4b42daad4ba89c2704138c84b033eb35bc3d7c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:51:48 +0100 Subject: [PATCH 35/96] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/publish/package.groovy b/publish/package.groovy index b3256a8..eac8553 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -86,6 +86,8 @@ pipeline { sh """#!/bin/bash -v aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi + aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } From 95c87fad2b6374d0aec64804a3f268a0ab6e89aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:22:15 +0100 Subject: [PATCH 36/96] HMBXR5601-827 - Publish package --- publish/package.groovy | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index eac8553..8e91143 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -92,7 +92,7 @@ pipeline { } } } - stage('Create snapshot - if not already there') { + stage('Create snapshot') { steps { script { echo "Snapshot name is ${SNAPSHOT_NAME}" @@ -109,6 +109,21 @@ pipeline { } } } + stage('Publish snapshot') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } } post { always { From f7e227ce0175b0d7cc3d818b9d5997149264363a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:29:06 +0100 Subject: [PATCH 37/96] HMBXR5601-827 - Publish package --- publish/package.groovy | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 8e91143..2a84034 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -79,7 +79,20 @@ pipeline { } } } - stage('Add/update package in snapshot') { + stage('Drop published repo - if any') { + steps { + script { + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + + stage('Add/update package in repo') { steps { script { echo "Package folder is ${PACKAGE_FOLDER}" @@ -112,12 +125,7 @@ pipeline { stage('Publish snapshot') { steps { script { - echo "Snapshot name is ${SNAPSHOT_NAME}" - FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" - echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" sh """#!/bin/bash -v - # This errors if the published repo exists already; Ignore it - aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi """ From fa69b27231d007ce8c2a3e5882a360bc3d7f33ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 11:36:05 +0100 Subject: [PATCH 38/96] HMBXR5601-827 - Show more status; Handle component areas of published repos --- publish/package.groovy | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 2a84034..00f5923 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -69,12 +69,14 @@ pipeline { script { echo "Repo name is ${REPO_NAME}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" + aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}" if [ \$? -ne 0 ]; then echo "aptly repo ${REPO_NAME} does not exist; Creating it" aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi fi + aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } @@ -116,7 +118,7 @@ pipeline { aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi """ } @@ -126,7 +128,11 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" -force-overwrite snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 5c86cf641de5ad239511216363ded7574c917ed3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 3 Sep 2019 17:22:13 +0100 Subject: [PATCH 39/96] HMBXR5601-827 - Change names of packages to be neutral and without buildstamps to make future jobs easier --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 25d06a2..57d84fb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -27,8 +27,8 @@ class DebRootDefinition { DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix - PACKAGE_FOLDER_NAME = packageprefix + buildstamp - PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_FOLDER_NAME = packageprefix + PACKAGE_NAME = packageprefix + "_armhf.deb" PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" From 78ed8a7e50e09f589cedc6ced581e764df80b7f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:35:37 +0100 Subject: [PATCH 40/96] HMBXR5601-827 - Use release tag rather than build number to make each package unique --- packaging/debian.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 57d84fb..9799ba9 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -24,7 +24,7 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix @@ -52,8 +52,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { - return new DebRootDefinition(rootpath, packageprefix, buildstamp) +def DebRootDefinition debDefinition(String rootpath, String packageprefix) { + return new DebRootDefinition(rootpath, packageprefix) } def buildPackage(String packageout, DebRootDefinition packagedefs) { From c10055c58c6b3980a992965a8de821d40777e797 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:40:02 +0100 Subject: [PATCH 41/96] HMBXR5601-827 - Use release tag rather than build number to make each package unique --- meta/folder.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index ddc99c4..6967def 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -722,6 +722,10 @@ class MetaInfo extends GISJsonSerialised { return buildstampinfo.buildstamp + "_" + jenkinsbuildinfo.buildnumber } + String releasetagfordebpackage() { + return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber + } + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] From b83050abc00d2e1efda12d60710ba2554297e458 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:56:49 +0100 Subject: [PATCH 42/96] HMBXR5601-827 - Versionstamper.py is leaving excess files in package --- versionstamping/versionstamper.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 4c380a6..7a9c397 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -19,21 +19,15 @@ def main(argv): print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert)) - filecopy = filetoconvert + ".orig" - try: - shutil.move(filetoconvert, filecopy) - except FileNotFoundError: - print("Could not find file: {0}\n".format(filetoconvert)) - return 1 + with open(filetoconvert,'r') as c: + fileread = c.read() count = 0 with open(filetoconvert, 'x') as f: - with open(filecopy,'r') as c: - fileread = c.read() - print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) - converted = fileread.replace(pattern, substitute) - count = converted.count(substitute) - print("Confirmed %s instances of %s post-conversion"%(count,substitute)) + print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) + converted = fileread.replace(pattern, substitute) + count = converted.count(substitute) + print("Confirmed %s instances of %s post-conversion"%(count,substitute)) f.write(converted) if count == 0: From 383fe72e7bf827509f4fc9fe70f023fa886b602b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 09:00:42 +0100 Subject: [PATCH 43/96] HMBXR5601-827 - Versionstamper.py is leaving excess files in package --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 7a9c397..1a65e6d 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -23,7 +23,7 @@ def main(argv): fileread = c.read() count = 0 - with open(filetoconvert, 'x') as f: + with open(filetoconvert, 'w') as f: print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) converted = fileread.replace(pattern, substitute) count = converted.count(substitute) From b0835c04deae3eecde5bf372cfc47af6ac73de5b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 6 Sep 2019 18:56:50 +0100 Subject: [PATCH 44/96] HMBXR5601-827 - Remove force command options --- publish/package.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 00f5923..32cc9eb 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -99,7 +99,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi @@ -128,7 +128,7 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" -force-overwrite snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi From 15332b794c185a7b16d939ddeb9c4e2e39158ee4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:19:21 +0100 Subject: [PATCH 45/96] HMBXR5601-827 - Add lintian output to debian package --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 9799ba9..6b3426f 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -79,6 +79,8 @@ def buildPackage(String packageout, DebRootDefinition packagedefs) { dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + + lintian "${packageout}/${packagedefs.PACKAGE_NAME}" || true """ } From b9eefabe9c7a01354f1d78a4d50b953664bafaf1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:34:22 +0100 Subject: [PATCH 46/96] HMBXR5601-827 - Change file permissions to satisfy lintian --- packaging/debian.groovy | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 6b3426f..eb53f44 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -56,11 +56,13 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { return new DebRootDefinition(rootpath, packageprefix) } -def buildPackage(String packageout, DebRootDefinition packagedefs) { +def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { sh """#!/bin/bash # Exit if any command fails set -e + echo "${password}" | sudo -S echo + mkdir -v -p "${packagedefs.USR_BIN}" mkdir -v -p "${packagedefs.USR_LIB_ARCH}" mkdir -v -p "${packagedefs.LIB_FIRMWARE}" @@ -69,10 +71,9 @@ def buildPackage(String packageout, DebRootDefinition packagedefs) { mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/preinst" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postinst" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/prerm" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postrm" + + sudo chmod -v -R 755 "${packagedefs.DEBPATH}" + sudo chown -v -R root: "${packagedefs.DEBPATH}" mkdir -v -p "${packageout}" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" From 3b5b7606d5a07ec2392a0a95f0a75c214c831f02 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:49:44 +0100 Subject: [PATCH 47/96] HMBXR5601-827 - Change file permissions to satisfy lintian --- packaging/debian.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index eb53f44..3dda8eb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -81,7 +81,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" - lintian "${packageout}/${packagedefs.PACKAGE_NAME}" || true + lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true """ } From c036622a82eeed56381a749027d153377e81f1c4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:40:47 +0100 Subject: [PATCH 48/96] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 52 ++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 3dda8eb..cef692f 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -57,32 +57,46 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { } def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { - sh """#!/bin/bash - # Exit if any command fails - set -e + try { + sh """#!/bin/bash + # Exit if any command fails + set -e - echo "${password}" | sudo -S echo + echo "${password}" | sudo -S echo - mkdir -v -p "${packagedefs.USR_BIN}" - mkdir -v -p "${packagedefs.USR_LIB_ARCH}" - mkdir -v -p "${packagedefs.LIB_FIRMWARE}" + mkdir -v -p "${packagedefs.USR_BIN}" + mkdir -v -p "${packagedefs.USR_LIB_ARCH}" + mkdir -v -p "${packagedefs.LIB_FIRMWARE}" - mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" - mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" + mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" + mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" - cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" - sudo chmod -v -R 755 "${packagedefs.DEBPATH}" - sudo chown -v -R root: "${packagedefs.DEBPATH}" + sudo chmod -v -R 755 "${packagedefs.DEBPATH}" + sudo chown -v -R root: "${packagedefs.DEBPATH}" - mkdir -v -p "${packageout}" - dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + mkdir -v -p "${packageout}" + dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" - dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" - dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" - - lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true - """ + dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + + lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true + + sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + """ + } + catch (Exception e) { + echo "Exception occurred" + sh """#!/bin/bash -v + echo "${password}" | sudo -S echo + + sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + + exit 1 + """ + } } return this; \ No newline at end of file From 01f570e3481640d8c7da9a12915ecffcec42e778 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:43:42 +0100 Subject: [PATCH 49/96] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index cef692f..4981c78 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -84,7 +84,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true - sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + sudo chown -R ${USER}: "${packagedefs.DEBPATH}" """ } catch (Exception e) { @@ -92,7 +92,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo sh """#!/bin/bash -v echo "${password}" | sudo -S echo - sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + sudo chown -R ${USER}: "${packagedefs.DEBPATH}" exit 1 """ From 0b81e15e34eb6ca52bcaed9e8bf488e5fae38523 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:47:12 +0100 Subject: [PATCH 50/96] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 4981c78..1bd8a6e 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -77,11 +77,15 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo sudo chown -v -R root: "${packagedefs.DEBPATH}" mkdir -v -p "${packageout}" + echo "Building package:" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package:" dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package contents:" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package lintian output:" lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true sudo chown -R ${USER}: "${packagedefs.DEBPATH}" From 2c62802a84fcb7008a676c5e638fa272912372f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:48:15 +0100 Subject: [PATCH 51/96] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 8 ++++++-- publish/package.groovy | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 1bd8a6e..7762951 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -24,11 +24,12 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix) { + DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix PACKAGE_NAME = packageprefix + "_armhf.deb" + UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb" PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" @@ -56,7 +57,7 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { return new DebRootDefinition(rootpath, packageprefix) } -def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { +def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { try { sh """#!/bin/bash # Exit if any command fails @@ -80,6 +81,9 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo echo "Building package:" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + mkdir -v -p "${uniquepackageout}" + cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}" + echo "Showing package:" dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" echo "Showing package contents:" diff --git a/publish/package.groovy b/publish/package.groovy index 32cc9eb..ea79cfd 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -50,6 +50,7 @@ pipeline { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) PACKAGE_FOLDER = "${PACKAGEDEST}/package" + UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage" } } } @@ -97,9 +98,9 @@ pipeline { stage('Add/update package in repo') { steps { script { - echo "Package folder is ${PACKAGE_FOLDER}" + echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${UNIQUE_PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From d4012e0dbbce8b82e276126ec5d46f49bc9fdb6d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:51:34 +0100 Subject: [PATCH 52/96] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 7762951..0323cea 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -53,8 +53,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix) { - return new DebRootDefinition(rootpath, packageprefix) +def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packageprefix, buildstamp) } def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { From b1f0476725d07b18ee45cbb7fc30916cc679a402 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:53:07 +0100 Subject: [PATCH 53/96] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 0323cea..0d6e7e4 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -3,6 +3,7 @@ class DebRootDefinition { String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME + String UNIQUE_PACKAGE_NAME String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH From 7a3bb4426e53b82854c1ace35e9b79d9d2f7f58e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Sep 2019 21:44:08 +0100 Subject: [PATCH 54/96] HMBXR5601-827 - Tar up export to preserve links --- compile/eclipsebuild/eclipseds5build.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 9ab8df3..63c8d45 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -81,7 +81,7 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ - cp -r -v "${srcFileExpanded}" "${destFolderExpanded}" + cp -v --no-dereference --preserve=links -r "${srcFileExpanded}" "${destFolderExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true From c79dbb6bae9f08717eb0e5a67800b1655a8eda7a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 19:45:48 +0100 Subject: [PATCH 55/96] HMBXR5601-827 - Avoid XR specific path in Common_scripts --- packaging/debian.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 0d6e7e4..6c5240c 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -5,6 +5,7 @@ class DebRootDefinition { String PACKAGE_NAME String UNIQUE_PACKAGE_NAME + String PACKAGE_SOURCE_ROOT String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH @@ -25,13 +26,14 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix PACKAGE_NAME = packageprefix + "_armhf.deb" UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb" + PACKAGE_SOURCE_ROOT = packagesourceroot PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" @@ -54,8 +56,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { - return new DebRootDefinition(rootpath, packageprefix, buildstamp) +def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp) } def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { @@ -73,7 +75,7 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" - cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" sudo chmod -v -R 755 "${packagedefs.DEBPATH}" sudo chown -v -R root: "${packagedefs.DEBPATH}" From 5bc28decb2bfdb539a95231f1641c7ea885e5b57 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 20:27:44 +0100 Subject: [PATCH 56/96] HMBXR5601-827 - Keep published repos of different products and branches seperate --- publish/package.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index ea79cfd..0f1ad9e 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -87,7 +87,7 @@ pipeline { script { sh """#!/bin/bash -v # This errors if the published repo exists already; Ignore it - aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}" aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi """ @@ -129,11 +129,11 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" "${PUBLISH_PATH_PREFIX}" if [ \$? -ne 0 ]; then exit 1; fi aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi - aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}" if [ \$? -ne 0 ]; then exit 1; fi """ } From f7ea682f6dd92a65ff4019a46b93e493eb5a4fdf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 23:30:06 +0100 Subject: [PATCH 57/96] HMBXR5601-827 - Had to reverse the changes of this commonly used script --- copy/logic.groovy | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index a5b134b..3f3f48d 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -24,12 +24,10 @@ pipeline { stage('Copying logic artifacts') { steps { script { - env.SG600_LOGICDEST = "${WORKSPACE}/sg600_logic" - env.KTB_LOGICDEST = "${WORKSPACE}/ktb_logic" + env.LOGICDEST = "${WORKSPACE}/logic" if (LOGIC_ARTIFACT_LOCATION == "Jenkins job artifact") { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - importer.artifactimport(meta, KTB_LOGIC_ARTIFACT_PROJECT, KTB_LOGIC_ARTIFACT_BUILD_SELECTOR, KTB_LOGICDEST) - importer.artifactimport(meta, SG600_LOGIC_ARTIFACT_PROJECT, SG600_LOGIC_ARTIFACT_BUILD_SELECTOR, SG600_LOGICDEST) + importer.artifactimport(meta, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGICDEST) } } } @@ -39,7 +37,7 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - rm -v -rf diff meta embedded_logic + rm -v -rf meta mv -v logic/* . """ archiveArtifacts "${artifactlist}" @@ -61,4 +59,4 @@ pipeline { echo 'Succeeded build' } } -} +} \ No newline at end of file From c50f45705d58019973e17a732b91ac58ff116017 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:27:44 +0100 Subject: [PATCH 58/96] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 0f1ad9e..9a77259 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -113,11 +113,16 @@ pipeline { script { echo "Snapshot name is ${SNAPSHOT_NAME}" FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" - echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + PACKAGE_VERSION_PREFIX = packagemeta.buildstampinfo.buildstampprefix + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME} containing packages of versions beginning with: ${PACKAGE_VERSION_PREFIX}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All" + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All" from repo "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" ${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From 0f5768c4b262c1b25b605156a7796e96caba8b29 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:30:28 +0100 Subject: [PATCH 59/96] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 9a77259..9bd9824 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -122,7 +122,7 @@ pipeline { if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" ${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From 4c68d44b75be8d878aa8d62f847f927302d4eb0b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:37:09 +0100 Subject: [PATCH 60/96] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 9bd9824..2d5fdcc 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -117,12 +117,12 @@ pipeline { echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME} containing packages of versions beginning with: ${PACKAGE_VERSION_PREFIX}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it - aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All" - aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All" from repo "${REPO_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All_${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All_${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From a01d7ed17cceb5936676e8282f8431a1b53f283c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 13 Sep 2019 15:26:48 +0100 Subject: [PATCH 61/96] HMBFDHV-12 - Logic copy was failing as there was an odd folder in the artifacts --- copy/logic.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 3f3f48d..4b3d521 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -14,7 +14,7 @@ pipeline { cleanfolders = [ "${WORKSPACE}/logic", "${WORKSPACE}/embedded_logic", - "${WORKSPACE}/diff", + "${WORKSPACE}/diff", // Some old artifacts have this folder ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -37,8 +37,9 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ + rm -v -rf diff rm -v -rf meta - mv -v logic/* . + mv -v "logic"/* . """ archiveArtifacts "${artifactlist}" } From 473d9042acb9d6edd362f043b6c8e74ce188a5e9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 13 Sep 2019 16:45:35 +0100 Subject: [PATCH 62/96] HMBFDHV-15 - Place firmware in correct position --- packaging/debian.groovy | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 6c5240c..6c7e006 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -68,13 +68,6 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p echo "${password}" | sudo -S echo - mkdir -v -p "${packagedefs.USR_BIN}" - mkdir -v -p "${packagedefs.USR_LIB_ARCH}" - mkdir -v -p "${packagedefs.LIB_FIRMWARE}" - - mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" - mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" - cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" sudo chmod -v -R 755 "${packagedefs.DEBPATH}" From 8858c55b23bd25db2e9790e7b3f11bc4d5ba9a41 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:17:49 +0100 Subject: [PATCH 63/96] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/ftp_query.groovy | 18 +++++ publish/promptingpublish.groovy | 129 ++++++++++++++++++++++++++++++++ remoteaccess/ftp.groovy | 33 ++++++++ remoteaccess/hostedftp.groovy | 28 +++++++ versioncontrol/git.groovy | 6 ++ 5 files changed, 214 insertions(+) create mode 100644 publish/ftp_query.groovy create mode 100644 publish/promptingpublish.groovy create mode 100644 remoteaccess/ftp.groovy create mode 100644 remoteaccess/hostedftp.groovy diff --git a/publish/ftp_query.groovy b/publish/ftp_query.groovy new file mode 100644 index 0000000..02a4c2d --- /dev/null +++ b/publish/ftp_query.groovy @@ -0,0 +1,18 @@ +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 new file mode 100644 index 0000000..deffec8 --- /dev/null +++ b/publish/promptingpublish.groovy @@ -0,0 +1,129 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Clean folders') { + steps { + script { + cleanfolders = [ + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Checkout release repo') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + SOURCEURL = RELEASE_REPO + SOURCEREVISION = "origin/master" + SOURCEDIR = "${WORKSPACE}/whole" + configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + } + } + } + stage('Identify customer to publish to') { + steps { + 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}" + } + } + } + stage('Identify software release to publish') { + steps { + script { + gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + def List releases = gh.gettaglist(SOURCEDIR) + release = input( + message: 'Please select the software version', + ok: 'Ok', + parameters: [ + choice(name: 'release', choices: releases, description: 'Which release?') + ] + ) + echo "Chosen software version is: ${release}" + } + } + } + stage('Checkout release repo at selected software version') { + steps { + script { + SOURCEURL = RELEASE_REPO + SOURCEREVISION = "refs/tags/${release}" + SOURCEDIR = "${WORKSPACE}/whole" + configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + } + } + } + stage('Get release artifact meta') { + steps { + script { + def mfs = autobuilderscript.getmetafolderscript() + releasemeta = mfs.metafromfolder(SOURCEDIR) + } + } + } + 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) + if (markunstable) { + env.unstablereason = unstablereason + currentBuild.result = 'UNSTABLE' + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts() + archiveArtifacts "summary/**,${artifactlist}" + } + } + } + stage('Summarise') { + steps { + script { + echo "Summary:\n${summarystring}\n" + if (env.unstablereason) { + echo "Instability reason: ${env.unstablereason}" + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + diff --git a/remoteaccess/ftp.groovy b/remoteaccess/ftp.groovy new file mode 100644 index 0000000..750319f --- /dev/null +++ b/remoteaccess/ftp.groovy @@ -0,0 +1,33 @@ +@Grab(group='commons-net', module='commons-net', version='2.0') +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) { + this.url = url + this.username = username + this.password = password + this.workingdirectory = workingdirectory + } +} + +FTPSiteInfo createFTPSiteInfo(String url, String username, String password, String workingdirectory) { + FTPSiteInfo ftpsiteinfo = new FTPSiteInfo(url, username, password, workingdirectory) + 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 +} + +return this; \ No newline at end of file diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy new file mode 100644 index 0000000..fd81d6d --- /dev/null +++ b/remoteaccess/hostedftp.groovy @@ -0,0 +1,28 @@ +ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") + +FTPSiteInfo getHostedFTPSiteInfo() { + FTPSiteInfo hostedftpsiteinfo = + ftpremote.createFTPSiteInfo("ftp.hostedftp.com", + "ftp@globalinkjetsystems.com", + "ramshorn42", + "/Customers/") + return hostedftpsiteinfo +} + +def getCustomerList() { + def List customerfilenames = new ArrayList() + def List customers = new ArrayList() + + FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() + 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; \ No newline at end of file diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index bb7c0ce..d24f3ff 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -25,6 +25,12 @@ String getGitInfo(String workingSetRootPath) { } } +List gettaglist(String workingSetRootPath) { + dir(workingSetRootPath) { + return clh.getCommandOutput('git tag --sort=-version:refname') + } +} + @NonCPS def ArrayList sparsecheckoutconfig(ArrayList paths) { ArrayList sparsecheckoutpaths = new ArrayList() From 7ac2020f9bf6ec25dc4db23678f44809b834f565 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:48:38 +0100 Subject: [PATCH 64/96] 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 65/96] 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 66/96] 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 67/96] 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 68/96] 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 69/96] 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 70/96] 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 71/96] 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 72/96] 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 73/96] 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 74/96] 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 75/96] 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 76/96] 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 77/96] 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 78/96] 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 79/96] 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 80/96] 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 81/96] 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 82/96] 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 83/96] 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 84/96] 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 85/96] 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 86/96] 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 87/96] 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 88/96] 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 89/96] 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 90/96] 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 91/96] 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 92/96] 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 93/96] 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 94/96] 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 95/96] 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) From a30a23d3c2ae1ea6608a50e075d6ad735c4b2699 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 16 Sep 2019 16:35:31 +0100 Subject: [PATCH 96/96] GIS-1621 - Remove reference to a product in the common area --- publish/promptingpublish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index c9138b0..ced73a2 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -92,7 +92,7 @@ pipeline { timeout(time: 10, unit: 'MINUTES') { def itemsobject = publishitems.createItemSelector( 'Select software items', - 'Print Server software items', + 'Software items', releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH,