From dc35fbbff6320cd927c9beba6ce595c2fcf7612b Mon Sep 17 00:00:00 2001 From: Christos Spirotis Date: Fri, 20 Mar 2020 07:38:56 +0000 Subject: [PATCH 001/115] Adding files for autobuild --- compile/eclipsebuild/eclipseSTM8build.groovy | 180 +++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 compile/eclipsebuild/eclipseSTM8build.groovy diff --git a/compile/eclipsebuild/eclipseSTM8build.groovy b/compile/eclipsebuild/eclipseSTM8build.groovy new file mode 100644 index 0000000..592483a --- /dev/null +++ b/compile/eclipsebuild/eclipseSTM8build.groovy @@ -0,0 +1,180 @@ +def doDisplayLeftovers() { +} + +def doKillLeftovers() { +} + +def doCheck(checkpathlist, build_variant = "") { + def result = 0 + for (checkpath in checkpathlist) { + echo "Checking file at: ${checkpath}" + script { + echo "Build variant is ${build_variant}" + if (build_variant) { + def srcFile = "${WORKSPACE}\${checkpath}" + def srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + // Print out dependencies of the built file + echo "Showing dependencies of ${srcFileExpanded}" + if (srcFileExpanded.endsWith(".elf")) { + result = bat ( script: """ + ${CYGWINDIR}/bin/readelf -hS ${srcFileExpanded} + if errorlevel 1 EXIT /b 1 + """, + returnStatus: true + ) + } + else if (srcFileExpanded.endsWith(".stm8bin")) { + result = bat ( script: """ + ${COSMICDIR}/cobj -hs ${srcFileExpanded} + if errorlevel 1 EXIT /b 1 + """, + returnStatus: true + ) + } + if (result != 0) { + return result + } + } + } + } + return result +} + +def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { + def result = 0 + def destFolder = "" + def srcFile = "" + def srcFileExpanded = "" + for (exportpath in exportpathlist) { + echo "Export path at: ${exportpath}" + script { + if (build_variant) { + echo "Build variant is ${build_variant}" + srcFile = "${WORKSPACE}\\${exportpath}" + srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + } + else { + echo "No build variant" + srcFileExpanded = "${WORKSPACE}\\${exportpath}" + } + destFolder = "${exportfolder}" + if (partdest) { + destFolder += "\\" + partdest + } + } + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + dir (destFolderExpanded) { + echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" + result = bat( script: """ + copy "${srcFileExpanded}" "${destFolderExpanded}" + if errorlevel 1 EXIT /b 1 + """, + returnStatus: true + ) + if (result != 0) { + return result + } + } + } + return result +} + +// Import all eclipse projects in a given folder +def doImportProjects(ds5folder, ds5shellcommand, buildcommand, sourcefolder) { + bat """ + "${ds5shellcommand}" ${buildcommand} -no-indexer -importAll "${sourcefolder}" + """ +} + +def doBuildAndExportProject(String ds5folder, 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) + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build ${project}/${build_variant}\'" + timeout(time: 20, unit: 'MINUTES') { + 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, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}") { + toBuild = [] + if (variantstobuild) { + toBuildUntrimmed = variantstobuild.split(',') + toBuildUntrimmed.each { + toBuild.add(it.trim()) + } + } + // The lock is being used because it was being found that the doKillLeftovers was affecting other builds + lock(resource: "eclipsebuild_${env.NODE_NAME}") { + try { + timeout(time: 5, unit: 'MINUTES') { + doImportProjects(ds5folder, ds5shellcommand, buildcommand, sourcefolder) + } + for (appInfo in apps) { + def Boolean build + def Boolean doexport + (build, doexport, project, variants, exportpathlist, destpart) = appInfo + if (build) { + doBuildAndExportProject(ds5folder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) + } + else { + doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) + } + } + } catch (Exception e) { + // doKillLeftovers() + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" + } + } +} + +return this; From d147e91fd31c01455c2d8178858d040c0d7b1b0f Mon Sep 17 00:00:00 2001 From: Christos Spirotis Date: Wed, 22 Apr 2020 19:14:29 +0100 Subject: [PATCH 002/115] CORE-58 added cygwin_folder env variable, removed check for binary file --- compile/eclipsebuild/eclipseSTM8build.groovy | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compile/eclipsebuild/eclipseSTM8build.groovy b/compile/eclipsebuild/eclipseSTM8build.groovy index 592483a..2aef386 100644 --- a/compile/eclipsebuild/eclipseSTM8build.groovy +++ b/compile/eclipsebuild/eclipseSTM8build.groovy @@ -23,14 +23,6 @@ def doCheck(checkpathlist, build_variant = "") { returnStatus: true ) } - else if (srcFileExpanded.endsWith(".stm8bin")) { - result = bat ( script: """ - ${COSMICDIR}/cobj -hs ${srcFileExpanded} - if errorlevel 1 EXIT /b 1 - """, - returnStatus: true - ) - } if (result != 0) { return result } From 7515aadc46267c14609a9c12dca7d660373597d7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 10 May 2020 22:03:12 +0100 Subject: [PATCH 003/115] Debug why prompting publish is not filtering --- publish/promptingpublish.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 9f2d7dc..4af0d62 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -66,10 +66,10 @@ pipeline { !release.toLowerCase().startsWith("faulty") && !release.toLowerCase().startsWith("ignore") && !release.toLowerCase().startsWith("inmainline")) { - //echo("Showing release: ${release}") + echo("Showing release: ${release}") releases.add(release) } else { - //echo("Not showing release: ${release}") + echo("Not showing release: ${release}") } } } From b77403c92f93fcf6f729751cc39b3de5086d2ed3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Jun 2020 11:16:28 +0100 Subject: [PATCH 004/115] Remove redundant parameter --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f600155..4e7dc99 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -184,14 +184,14 @@ class BuildStampInfo extends GISJsonSerialised { script.echo("Build stamp now ${buildstamp}") } - void set(String buildstampprefix, int revision) { + void set(String buildstampprefix, int revision = 0) { buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.' this.buildstampprefix = buildstampprefix this.buildstamp = buildstampprefix + "0" changerevision(revision) } - void set(String buildstampprefix, String revision) { + void set(String buildstampprefix, String revision = '0') { set(buildstampprefix, revision.toInteger()) } From 5559b50a78444bf359529bb3418e6d5b23e735e1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Jun 2020 11:19:22 +0100 Subject: [PATCH 005/115] Remove redundant parameter --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 4e7dc99..aac8b6c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -184,7 +184,7 @@ class BuildStampInfo extends GISJsonSerialised { script.echo("Build stamp now ${buildstamp}") } - void set(String buildstampprefix, int revision = 0) { + void set(String buildstampprefix, int revision) { buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.' this.buildstampprefix = buildstampprefix this.buildstamp = buildstampprefix + "0" From 5e9689a8587ade2bc3957ef706ad900ae217e6eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 27 Jun 2020 11:49:15 +0100 Subject: [PATCH 006/115] Handle version regex properly --- publish/package.groovy | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 2d5fdcc..e81d2c2 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -115,6 +115,20 @@ pipeline { FULL_SNAPSHOT_NAME = "${REPO_NAME}_${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}" + // Convert prefix to regular expression + PACKAGE_VERSION_PREFIX_SPLIT = PACKAGE_VERSION_PREFIX.split("[.]") + PACKAGE_VERSION_REGEX = '' + i = 0 + while(true) { + if (i == list.size() - 1) { + PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] + break; + } + PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] { + PACKAGE_VERSION_REGEX += '\\\.' + } + i++ + } sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" @@ -122,7 +136,7 @@ pipeline { aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All_${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${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_REGEX}.*)' 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 50cb58a77c5a3468ac3170007e7f49e6a0f1b37b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 27 Jun 2020 20:10:21 +0100 Subject: [PATCH 007/115] CORE-52 - Adding additional resources for controlling remote upgrades - debug --- publish/package.groovy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index e81d2c2..3bd9565 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -120,13 +120,12 @@ pipeline { PACKAGE_VERSION_REGEX = '' i = 0 while(true) { - if (i == list.size() - 1) { + if (i == PACKAGE_VERSION_PREFIX_SPLIT.size() - 1) { PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] break; } - PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] { - PACKAGE_VERSION_REGEX += '\\\.' - } + PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] + PACKAGE_VERSION_REGEX += '\\.' i++ } sh """#!/bin/bash -v From ed6e997a1a29fe8d83bef37ca3b38c420198c27d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 30 Jun 2020 15:54:51 +0100 Subject: [PATCH 008/115] Reset the branch to remove some SOM variant stuff that came from master --- meta/folder.groovy | 2 +- publish/package.groovy | 15 ++++++++++++++- publish/promptingpublish.groovy | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f600155..aac8b6c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -191,7 +191,7 @@ class BuildStampInfo extends GISJsonSerialised { changerevision(revision) } - void set(String buildstampprefix, String revision) { + void set(String buildstampprefix, String revision = '0') { set(buildstampprefix, revision.toInteger()) } diff --git a/publish/package.groovy b/publish/package.groovy index 2d5fdcc..3bd9565 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -115,6 +115,19 @@ pipeline { FULL_SNAPSHOT_NAME = "${REPO_NAME}_${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}" + // Convert prefix to regular expression + PACKAGE_VERSION_PREFIX_SPLIT = PACKAGE_VERSION_PREFIX.split("[.]") + PACKAGE_VERSION_REGEX = '' + i = 0 + while(true) { + if (i == PACKAGE_VERSION_PREFIX_SPLIT.size() - 1) { + PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] + break; + } + PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] + PACKAGE_VERSION_REGEX += '\\.' + i++ + } sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" @@ -122,7 +135,7 @@ pipeline { aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All_${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${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_REGEX}.*)' 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 diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 9f2d7dc..4af0d62 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -66,10 +66,10 @@ pipeline { !release.toLowerCase().startsWith("faulty") && !release.toLowerCase().startsWith("ignore") && !release.toLowerCase().startsWith("inmainline")) { - //echo("Showing release: ${release}") + echo("Showing release: ${release}") releases.add(release) } else { - //echo("Not showing release: ${release}") + echo("Not showing release: ${release}") } } } From d5ad9c75fa9e50bc5dc9f6314dd7e6428bd1bcaa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 10 Jul 2020 12:57:17 +0100 Subject: [PATCH 009/115] Increase time to do project importing before timeout --- 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 9225100..1fd9078 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -227,7 +227,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 { - timeout(time: 5, unit: 'MINUTES') { + timeout(time: 10, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } From 95f1278e4c5ba88fbc9f90e1a7e6b4ca13272cde Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 22:20:44 +0100 Subject: [PATCH 010/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 75 +++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 documentation/doxygen_deploy.groovy diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy new file mode 100644 index 0000000..736ed10 --- /dev/null +++ b/documentation/doxygen_deploy.groovy @@ -0,0 +1,75 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Clean imports') { + steps { + script { + env.DOXYGEN = "doxygen" + cleanfolders = [ + DOXYGEN, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Import doxygen artifacts') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + def importoptions = new ImportOptions(this) + + importoptions.jenkinsjob(BUILD_JOB_WITH_DOXYGEN_ARTIFACTS, BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR) + importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**') + doxygenmeta = importer.artifactimportfrombuildjob(meta, importoptions, DOXYGEN) + } + } + } +/* + + stage('Clean exports') { + steps { + script { + env.DOXYGEN = "api_docs" + cleanfolders = [ + API_DOCS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + + stage('Copy api docs') { + steps { + script { + dir("${SOURCEDIR}/documents/api/public") { + fileOperations([fileCopyOperation(targetLocation: "${WORKSPACE}/${API_DOCS}", includes: '*.docx,*.pptx')]) + } + } + } + } +*/ + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} From 6fa1bdaeaf4acf494a2161792fbdb762baec94e7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 22:22:08 +0100 Subject: [PATCH 011/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 736ed10..af127ea 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -24,7 +24,7 @@ pipeline { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def importoptions = new ImportOptions(this) + def importoptions = new importer.ImportOptions(this) importoptions.jenkinsjob(BUILD_JOB_WITH_DOXYGEN_ARTIFACTS, BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR) importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**') From 906714ac24a2992fa790cf2e6358f80bc329bbcb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 22:26:05 +0100 Subject: [PATCH 012/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index af127ea..dc442b6 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -24,7 +24,7 @@ pipeline { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def importoptions = new importer.ImportOptions(this) + def importoptions = importer.getNewImportOptions(this) importoptions.jenkinsjob(BUILD_JOB_WITH_DOXYGEN_ARTIFACTS, BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR) importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**') From caf62da190dc894ef5749bda54537f4b98e3afa9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 22:30:24 +0100 Subject: [PATCH 013/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index dc442b6..ae0c063 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -24,7 +24,7 @@ pipeline { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def importoptions = importer.getNewImportOptions(this) + def importoptions = importer.getNewImportOptions() importoptions.jenkinsjob(BUILD_JOB_WITH_DOXYGEN_ARTIFACTS, BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR) importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**') From bbbd7b6af6a3bc1943853ac55796cf639e848a1e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 22:42:54 +0100 Subject: [PATCH 014/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index ae0c063..3586860 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -29,6 +29,11 @@ pipeline { importoptions.jenkinsjob(BUILD_JOB_WITH_DOXYGEN_ARTIFACTS, BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR) importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**') doxygenmeta = importer.artifactimportfrombuildjob(meta, importoptions, DOXYGEN) + + productname = doxygenmeta.productinfo.productname + buildstampprefix = doxygenmeta.buildstampinfo.buildstampprefix + + echo "Doyxgen imported for product: ${productname} and build stamp prefix: ${buildstampprefix}" } } } From 9c81da3e19c970f80f0317304ca46e130428b133 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 23:02:33 +0100 Subject: [PATCH 015/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 3586860..f84e7b0 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -34,34 +34,34 @@ pipeline { buildstampprefix = doxygenmeta.buildstampinfo.buildstampprefix echo "Doyxgen imported for product: ${productname} and build stamp prefix: ${buildstampprefix}" + + pathonserver = "${ROOT_PATH_ON_SERVER}/${productname}/${buildstampprefix}" } } } -/* - - stage('Clean exports') { + stage('Clean destination') { steps { script { - env.DOXYGEN = "api_docs" cleanfolders = [ - API_DOCS, + pathonserver, ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) } } } - - stage('Copy api docs') { + + stage('Copy doxygen to server') { steps { script { - dir("${SOURCEDIR}/documents/api/public") { - fileOperations([fileCopyOperation(targetLocation: "${WORKSPACE}/${API_DOCS}", includes: '*.docx,*.pptx')]) + doxygensource = "${DOXYGEN}/${DOXYGEN ARTIFACT_PATH_TO_DOXYGEN_ROOT)" + echo "Copying from ${doxygensource} to ${pathonserver}" + dir(doxygensource { + fileOperations([fileCopyOperation(targetLocation: pathonserver)]) } } } } -*/ } post { always { From e4086c3aee9a00341f059cf47cba84b1c411e5cb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 23:04:32 +0100 Subject: [PATCH 016/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index f84e7b0..6c92467 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -54,7 +54,7 @@ pipeline { stage('Copy doxygen to server') { steps { script { - doxygensource = "${DOXYGEN}/${DOXYGEN ARTIFACT_PATH_TO_DOXYGEN_ROOT)" + doxygensource = "${DOXYGEN}/${DOXYGEN ARTIFACT_PATH_TO_DOXYGEN_ROOT}" echo "Copying from ${doxygensource} to ${pathonserver}" dir(doxygensource { fileOperations([fileCopyOperation(targetLocation: pathonserver)]) From 748d9f7e667112aee4de508e741727468c9744a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 23:07:30 +0100 Subject: [PATCH 017/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 6c92467..8fd41ce 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -56,7 +56,7 @@ pipeline { script { doxygensource = "${DOXYGEN}/${DOXYGEN ARTIFACT_PATH_TO_DOXYGEN_ROOT}" echo "Copying from ${doxygensource} to ${pathonserver}" - dir(doxygensource { + dir(doxygensource) { fileOperations([fileCopyOperation(targetLocation: pathonserver)]) } } From 8477a500ceff047471bd8a4d6eca87067a8f56f8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 23:09:48 +0100 Subject: [PATCH 018/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 8fd41ce..0c2d4a2 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -54,7 +54,7 @@ pipeline { stage('Copy doxygen to server') { steps { script { - doxygensource = "${DOXYGEN}/${DOXYGEN ARTIFACT_PATH_TO_DOXYGEN_ROOT}" + doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}" echo "Copying from ${doxygensource} to ${pathonserver}" dir(doxygensource) { fileOperations([fileCopyOperation(targetLocation: pathonserver)]) From 6daa1d6106b8e0a07748563f35cddab03ea300b4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Sep 2020 23:19:12 +0100 Subject: [PATCH 019/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 0c2d4a2..d8422a4 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -56,6 +56,8 @@ pipeline { script { doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}" echo "Copying from ${doxygensource} to ${pathonserver}" + dir(pathonserver) { + } dir(doxygensource) { fileOperations([fileCopyOperation(targetLocation: pathonserver)]) } From 2ae9dfcecc4ad6271be1a5a83326e69c6cb1d68d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 6 Sep 2020 08:27:55 +0100 Subject: [PATCH 020/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 34 +++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index d8422a4..db96b43 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -34,32 +34,28 @@ pipeline { buildstampprefix = doxygenmeta.buildstampinfo.buildstampprefix echo "Doyxgen imported for product: ${productname} and build stamp prefix: ${buildstampprefix}" - - pathonserver = "${ROOT_PATH_ON_SERVER}/${productname}/${buildstampprefix}" } } } - stage('Clean destination') { - steps { - script { - cleanfolders = [ - pathonserver, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Copy doxygen to server') { steps { script { doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}" - echo "Copying from ${doxygensource} to ${pathonserver}" - dir(pathonserver) { - } - dir(doxygensource) { - fileOperations([fileCopyOperation(targetLocation: pathonserver)]) + pathonserver = "${ROOT_PATH_ON_SERVER.trim()}/${productname}/${buildstampprefix}" + echo "Moving from ${doxygensource} to ${pathonserver}" + if isUnix() { + sh """#!/bin/bash + rm -rfv "${pathonserver}" + if [ \$? -ne 0 ]; then exit 1; fi + + mkdir -pv "${pathonserver}" + if [ \$? -ne 0 ]; then exit 1; fi + + mv -v "${doxygensource}"/* "${pathonserver}" + if [ \$? -ne 0 ]; then exit 1; fi + + } else { + error("This job does not run on Windows at the moment") } } } From 226ac5916263e17984c1fa0d2c935a7528a802c9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 6 Sep 2020 08:28:58 +0100 Subject: [PATCH 021/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index db96b43..474307b 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -43,7 +43,7 @@ pipeline { doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}" pathonserver = "${ROOT_PATH_ON_SERVER.trim()}/${productname}/${buildstampprefix}" echo "Moving from ${doxygensource} to ${pathonserver}" - if isUnix() { + if (isUnix()) { sh """#!/bin/bash rm -rfv "${pathonserver}" if [ \$? -ne 0 ]; then exit 1; fi From 8fd7cda8b6be6f337bdc027aece4af86b9354adf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 6 Sep 2020 08:40:47 +0100 Subject: [PATCH 022/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 474307b..2077b25 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -75,4 +75,4 @@ pipeline { echo 'Succeeded build' } } -} +} \ No newline at end of file From fcd01335deadd3229be32a57a06d55c817a6d5e4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 6 Sep 2020 08:45:52 +0100 Subject: [PATCH 023/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 2077b25..9eeb55d 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -75,4 +75,5 @@ pipeline { echo 'Succeeded build' } } -} \ No newline at end of file +} + From 1e9b5afaf0f0be61fedd74600e3f78dacdabed6e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 6 Sep 2020 08:47:50 +0100 Subject: [PATCH 024/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 9eeb55d..d30ddf6 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -53,7 +53,7 @@ pipeline { mv -v "${doxygensource}"/* "${pathonserver}" if [ \$? -ne 0 ]; then exit 1; fi - + """ } else { error("This job does not run on Windows at the moment") } From c473cfbb6efe6b43cda4148ddd2b6a302b42174b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 6 Sep 2020 08:57:56 +0100 Subject: [PATCH 025/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index d30ddf6..26a15f3 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -42,7 +42,7 @@ pipeline { script { doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}" pathonserver = "${ROOT_PATH_ON_SERVER.trim()}/${productname}/${buildstampprefix}" - echo "Moving from ${doxygensource} to ${pathonserver}" + echo "Copying from ${doxygensource} to ${pathonserver}" if (isUnix()) { sh """#!/bin/bash rm -rfv "${pathonserver}" @@ -51,7 +51,7 @@ pipeline { mkdir -pv "${pathonserver}" if [ \$? -ne 0 ]; then exit 1; fi - mv -v "${doxygensource}"/* "${pathonserver}" + cp -rv "${doxygensource}"/* "${pathonserver}" if [ \$? -ne 0 ]; then exit 1; fi """ } else { From b1262ef4ee42dbfbad7221b0e7f5226e0759f0e1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 6 Sep 2020 09:05:12 +0100 Subject: [PATCH 026/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 26a15f3..c57eedd 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -50,7 +50,8 @@ pipeline { mkdir -pv "${pathonserver}" if [ \$? -ne 0 ]; then exit 1; fi - + + echo cp -rv "${doxygensource}"/* "${pathonserver}" cp -rv "${doxygensource}"/* "${pathonserver}" if [ \$? -ne 0 ]; then exit 1; fi """ From bde11981fcc1f2efae0438cd091c5dd24748a7ff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 6 Sep 2020 09:15:15 +0100 Subject: [PATCH 027/115] Add doxygen deployment script --- documentation/doxygen_deploy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index c57eedd..6642256 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -51,8 +51,8 @@ pipeline { mkdir -pv "${pathonserver}" if [ \$? -ne 0 ]; then exit 1; fi - echo cp -rv "${doxygensource}"/* "${pathonserver}" - cp -rv "${doxygensource}"/* "${pathonserver}" + echo mv -v "${doxygensource}"/ "${pathonserver}" + mv -v "${doxygensource}"/ "${pathonserver}" if [ \$? -ne 0 ]; then exit 1; fi """ } else { From f0959d32caf2416b30a2343c3b8de8a73440fbf0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Sep 2020 08:02:15 +0100 Subject: [PATCH 028/115] Add an exclude list --- staticanalysis/cpd.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 2bd12d9..07bbe70 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -81,18 +81,18 @@ pipeline { steps { script { def PPDFOLDER = "${STATICANALYSIS}/ppd" - dir(PPDFOLDER) { + dir(SRC) { if (isUnix()) { sh """#!/bin/bash set -e export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --exclude "${EXCLUDED_PATH_LIST.trim()}" --language cpp --format xml --failOnViolation false > "${PPDFOLDER}/cpd.xml" """ } else { bat """ set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml + "${PPD}/cpd.bat" --minimum-tokens 100 --files . --exclude "${EXCLUDED_PATH_LIST.trim()}" --language cpp --format xml --failOnViolation false > "${PPDFOLDER}/cpd.xml" """ } } From 1cc691ee7a3d86886ad68ba817eb3377cb29db8c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Sep 2020 08:08:50 +0100 Subject: [PATCH 029/115] Add an exclude list --- staticanalysis/cpd.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 07bbe70..ee1b1c7 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -81,18 +81,21 @@ pipeline { steps { script { def PPDFOLDER = "${STATICANALYSIS}/ppd" + excludeoptions = '' + if (EXCLUDED_PATH_LIST) { + excludeoptions = """--exclude "${EXCLUDED_PATH_LIST}" """ dir(SRC) { if (isUnix()) { sh """#!/bin/bash set -e export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --exclude "${EXCLUDED_PATH_LIST.trim()}" --language cpp --format xml --failOnViolation false > "${PPDFOLDER}/cpd.xml" + "${PPD}/run.sh" cpd --minimum-tokens 100 --files . ${excludeoptions} --language cpp --format xml --failOnViolation false > "${PPDFOLDER}/cpd.xml" """ } else { bat """ set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files . --exclude "${EXCLUDED_PATH_LIST.trim()}" --language cpp --format xml --failOnViolation false > "${PPDFOLDER}/cpd.xml" + "${PPD}/cpd.bat" --minimum-tokens 100 --files . ${excludeoptions} --language cpp --format xml --failOnViolation false > "${PPDFOLDER}/cpd.xml" """ } } From c6ea368a3d7d0f9b058b00ecd34adeb12684f414 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Sep 2020 08:10:52 +0100 Subject: [PATCH 030/115] Add an exclude list --- staticanalysis/cpd.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index ee1b1c7..35d8094 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -84,6 +84,7 @@ pipeline { excludeoptions = '' if (EXCLUDED_PATH_LIST) { excludeoptions = """--exclude "${EXCLUDED_PATH_LIST}" """ + } dir(SRC) { if (isUnix()) { sh """#!/bin/bash From d8d59ba518bb732f8133f1217a33acb5d56da690 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Sep 2020 08:31:52 +0100 Subject: [PATCH 031/115] 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 35d8094..233da57 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -60,7 +60,7 @@ pipeline { stage("Clean exports") { steps { script { - STATICANALYSIS = 'staticanalysis' + STATICANALYSIS = "${WORKSPACE}/staticanalysis" cleanfolders = [ STATICANALYSIS, ] From efc258daedf609cdf7eb8c0e7dd5603a0b56430e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Sep 2020 08:35:48 +0100 Subject: [PATCH 032/115] Update static analysis --- staticanalysis/cpd.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 233da57..ef10e37 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,6 +86,7 @@ pipeline { excludeoptions = """--exclude "${EXCLUDED_PATH_LIST}" """ } dir(SRC) { + dir(PPDFOLDER) {} if (isUnix()) { sh """#!/bin/bash set -e From 67f5113cf43655f3a2cc027bdfb620a938f81c2b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Sep 2020 08:44:12 +0100 Subject: [PATCH 033/115] Update static analysis --- staticanalysis/cpd.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index ef10e37..d421446 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,16 +86,17 @@ pipeline { excludeoptions = """--exclude "${EXCLUDED_PATH_LIST}" """ } dir(SRC) { - dir(PPDFOLDER) {} if (isUnix()) { sh """#!/bin/bash set -e + mkdir -pv "${PPDFOLDER}" export PMD_JAVA_OPTS=-Xmx65536m "${PPD}/run.sh" cpd --minimum-tokens 100 --files . ${excludeoptions} --language cpp --format xml --failOnViolation false > "${PPDFOLDER}/cpd.xml" """ } else { bat """ + mkdir "${PPDFOLDER}" set PMD_JAVA_OPTS=-Xmx2048m "${PPD}/cpd.bat" --minimum-tokens 100 --files . ${excludeoptions} --language cpp --format xml --failOnViolation false > "${PPDFOLDER}/cpd.xml" """ From 46b29279ce80d47ffd932519da052ea755678a64 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Sep 2020 12:14:48 +0100 Subject: [PATCH 034/115] Include kernel zImage in app package --- packaging/debian.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 2ef1ba8..857cb32 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -45,6 +45,7 @@ class DebRootDefinition { 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_KERNEL = "${DEBPATH}/opt/gis/kernel" GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" From 7da9f89a3925294f9be7b42744f160c6a192e67a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Sep 2020 15:09:44 +0100 Subject: [PATCH 035/115] Include kernel zImage in app package --- packaging/debian.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 857cb32..a5fc773 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -17,6 +17,7 @@ class DebRootDefinition { String GIS_OPT_SCRIPTS_CONTROL String GIS_OPT_WWW String GIS_OPT_OTHER + String GIS_OPT_KERNEL String GIS_OPT_LOGIC String GIS_OPT_PRINTHEAD From ea7faf51c7b64eabd33e959d5557c1db05eca45c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 10:03:00 +0100 Subject: [PATCH 036/115] Show environment --- staticanalysis/cpd.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 2bd12d9..05c00fb 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -5,6 +5,9 @@ pipeline { steps { script { meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + sh """#!/bin/bash + env + """ } } } From caf5ddbe8c06b44f4eee4f32c883685a4832b6b4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 10:18:32 +0100 Subject: [PATCH 037/115] Handle path exclusions --- staticanalysis/cpd.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 05c00fb..7d4ccb7 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -85,17 +85,21 @@ pipeline { script { def PPDFOLDER = "${STATICANALYSIS}/ppd" dir(PPDFOLDER) { + def EXCLUDE_PARAM = '' + if (EXCLUDE_PATHS) { + EXCLUDE_PARAM = """--exclude "%EXCLUDE_PATHS%" """ + } if (isUnix()) { sh """#!/bin/bash set -e export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml %EXCLUDE_PARAM% --failOnViolation false > cpd.xml """ } else { bat """ set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml %EXCLUDE_PARAM% --failOnViolation false > cpd.xml """ } } From 4ec0d0e1b6ba2fb63b06b7fcd82b0d9169d57b2b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 10:28:14 +0100 Subject: [PATCH 038/115] Handle path exclusions --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 7d4ccb7..49dde7c 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -85,7 +85,7 @@ pipeline { script { def PPDFOLDER = "${STATICANALYSIS}/ppd" dir(PPDFOLDER) { - def EXCLUDE_PARAM = '' + EXCLUDE_PARAM = '' if (EXCLUDE_PATHS) { EXCLUDE_PARAM = """--exclude "%EXCLUDE_PATHS%" """ } From 1d18f769e533383118c73ce1c0c12e420badd9ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 10:30:21 +0100 Subject: [PATCH 039/115] Handle path exclusions --- staticanalysis/cpd.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 49dde7c..60dad56 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -89,6 +89,7 @@ pipeline { if (EXCLUDE_PATHS) { EXCLUDE_PARAM = """--exclude "%EXCLUDE_PATHS%" """ } + echo "EXCLUDE_PARAM=%EXCLUDE_PARAM%" if (isUnix()) { sh """#!/bin/bash set -e From 7aa4e9299e41bab76093557b3faefb08ee17231b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 10:31:48 +0100 Subject: [PATCH 040/115] Handle path exclusions --- staticanalysis/cpd.groovy | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 60dad56..b4fb1ad 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -85,22 +85,21 @@ pipeline { script { def PPDFOLDER = "${STATICANALYSIS}/ppd" dir(PPDFOLDER) { - EXCLUDE_PARAM = '' + def EXCLUDE_PARAM = '' if (EXCLUDE_PATHS) { - EXCLUDE_PARAM = """--exclude "%EXCLUDE_PATHS%" """ + EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS}" """ } - echo "EXCLUDE_PARAM=%EXCLUDE_PARAM%" if (isUnix()) { sh """#!/bin/bash set -e export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml %EXCLUDE_PARAM% --failOnViolation false > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml """ } else { bat """ set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml %EXCLUDE_PARAM% --failOnViolation false > cpd.xml + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml """ } } From d75fd3ca51627df7e38861842a453f19bf14b860 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 10:38:38 +0100 Subject: [PATCH 041/115] Handle path exclusions --- staticanalysis/cpd.groovy | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index b4fb1ad..6731c94 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -89,18 +89,20 @@ pipeline { if (EXCLUDE_PATHS) { EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS}" """ } - if (isUnix()) { - sh """#!/bin/bash - set -e - - export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ - } else { - bat """ - set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ + dir(SRC) { + if (isUnix()) { + sh """#!/bin/bash + set -e + + export PMD_JAVA_OPTS=-Xmx65536m + "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + """ + } else { + bat """ + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + """ + } } } recordIssues(tools: [ From c82bbc6b4752b6c1582eaee6549c3f2888085572 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 10:41:30 +0100 Subject: [PATCH 042/115] Handle path exclusions --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 6731c94..127db9f 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -92,7 +92,7 @@ pipeline { dir(SRC) { if (isUnix()) { sh """#!/bin/bash - set -e + set -ev export PMD_JAVA_OPTS=-Xmx65536m "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml From 9c9e0999fcd8ecfef74d3e6a38e755938f93314f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 10:59:05 +0100 Subject: [PATCH 043/115] Handle path exclusions --- staticanalysis/cpd.groovy | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 127db9f..649ba89 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -87,22 +87,26 @@ pipeline { dir(PPDFOLDER) { def EXCLUDE_PARAM = '' if (EXCLUDE_PATHS) { - EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS}" """ - } - dir(SRC) { - if (isUnix()) { - sh """#!/bin/bash - set -ev - - export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ - } else { - bat """ - set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ + EXCLUDE_PARAM = '--exclude "' + def exclude_path_list = EXCLUDE_PATHS.split() + for (exclude_path in exclude_path_list) { + EXCLUDE_PARAM += "${WORKSPACE}/${exclude_path.trim()}," } + EXCLUDE_PARAM += '"' + } + if (isUnix()) { + sh """#!/bin/bash + set -ev + + export PMD_JAVA_OPTS=-Xmx65536m + echo "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + """ + } else { + bat """ + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + """ } } recordIssues(tools: [ From ec496bb55743616fae5a6b7a3f40cde9525a2e79 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 11:11:17 +0100 Subject: [PATCH 044/115] Handle path exclusions --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 649ba89..d4956b1 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -90,7 +90,7 @@ pipeline { EXCLUDE_PARAM = '--exclude "' def exclude_path_list = EXCLUDE_PATHS.split() for (exclude_path in exclude_path_list) { - EXCLUDE_PARAM += "${WORKSPACE}/${exclude_path.trim()}," + EXCLUDE_PARAM += "${SRC}/${exclude_path.trim()}," } EXCLUDE_PARAM += '"' } From 0890fb01b3123b9475987dea37f760123ddeba8c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 11:16:10 +0100 Subject: [PATCH 045/115] Handle path exclusions --- staticanalysis/cpd.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index d4956b1..6d717a5 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -56,7 +56,10 @@ pipeline { SOURCEDIR = "${WORKSPACE}/source" configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) SOURCE_PATH = "${SOURCEDIR}" - env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}" + SRC = "${SOURCE_PATH}" + if (SOURCE_OFFSET_PATH) { + SRC += "/${SOURCE_OFFSET_PATH}" + } } } } From 35018f9956528b297d05579d2db8a26a2520c1fb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 11:18:18 +0100 Subject: [PATCH 046/115] Handle path exclusions --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 6d717a5..e20b0de 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -91,7 +91,7 @@ pipeline { def EXCLUDE_PARAM = '' if (EXCLUDE_PATHS) { EXCLUDE_PARAM = '--exclude "' - def exclude_path_list = EXCLUDE_PATHS.split() + def exclude_path_list = EXCLUDE_PATHS.split(',') for (exclude_path in exclude_path_list) { EXCLUDE_PARAM += "${SRC}/${exclude_path.trim()}," } From 7a590ecad57b4cd3700960759053fa73337efed5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 11:37:38 +0100 Subject: [PATCH 047/115] Handle path exclusions --- staticanalysis/cpd.groovy | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index e20b0de..07f922e 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -97,19 +97,21 @@ pipeline { } EXCLUDE_PARAM += '"' } - if (isUnix()) { - sh """#!/bin/bash - set -ev + dir(SRC) { + if (isUnix()) { + sh """#!/bin/bash + set -ev - export PMD_JAVA_OPTS=-Xmx65536m - echo "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ - } else { - bat """ - set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ + export PMD_JAVA_OPTS=-Xmx65536m + echo "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + """ + } else { + bat """ + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml + """ + } } } recordIssues(tools: [ From 29cfbbf9d651f5d511eef37b92d203251feec579 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 12:05:45 +0100 Subject: [PATCH 048/115] Handle path exclusions --- staticanalysis/cpd.groovy | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 07f922e..5f357ce 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -1,13 +1,10 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { script { meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - sh """#!/bin/bash - env - """ } } } @@ -103,7 +100,6 @@ pipeline { set -ev export PMD_JAVA_OPTS=-Xmx65536m - echo "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml """ } else { From 562c1cbc21f1f3ac246a06ff2771644458eae6c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 12:29:19 +0100 Subject: [PATCH 049/115] Handle path exclusions --- staticanalysis/cpd.groovy | 41 +++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 5f357ce..0bc5c12 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -84,30 +84,25 @@ pipeline { steps { script { def PPDFOLDER = "${STATICANALYSIS}/ppd" - dir(PPDFOLDER) { - def EXCLUDE_PARAM = '' - if (EXCLUDE_PATHS) { - EXCLUDE_PARAM = '--exclude "' - def exclude_path_list = EXCLUDE_PATHS.split(',') - for (exclude_path in exclude_path_list) { - EXCLUDE_PARAM += "${SRC}/${exclude_path.trim()}," - } - EXCLUDE_PARAM += '"' - } - dir(SRC) { - if (isUnix()) { - sh """#!/bin/bash - set -ev + def EXCLUDE_PARAM = '' + if (EXCLUDE_PATHS) { + EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS.trim}"""" + } + dir(SRC) { + if (isUnix()) { + sh """#!/bin/bash + set -ev - export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ - } else { - bat """ - set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > cpd.xml - """ - } + mkdir "${PPDFOLDER}" + export PMD_JAVA_OPTS=-Xmx65536m + "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" + """ + } else { + bat """ + mkdir "${PPDFOLDER}" + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" + """ } } recordIssues(tools: [ From 0514270ca56dfacf90740100ed70fa03be537ed7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 12:31:18 +0100 Subject: [PATCH 050/115] Handle path exclusions --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 0bc5c12..90c0efa 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,7 +86,7 @@ pipeline { def PPDFOLDER = "${STATICANALYSIS}/ppd" def EXCLUDE_PARAM = '' if (EXCLUDE_PATHS) { - EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS.trim}"""" + EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS.trim}" """ } dir(SRC) { if (isUnix()) { From df2bd2f03760bf060d0d9c4092c5c202bfba9633 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 12:32:48 +0100 Subject: [PATCH 051/115] Handle path exclusions --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 90c0efa..6651870 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,7 +86,7 @@ pipeline { def PPDFOLDER = "${STATICANALYSIS}/ppd" def EXCLUDE_PARAM = '' if (EXCLUDE_PATHS) { - EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS.trim}" """ + EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS.trim()}" """ } dir(SRC) { if (isUnix()) { From 0114f4e16b3e98afea231f430e4b81fc684bd484 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 12:34:45 +0100 Subject: [PATCH 052/115] Handle path exclusions --- staticanalysis/cpd.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 6651870..9e21374 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -93,13 +93,13 @@ pipeline { sh """#!/bin/bash set -ev - mkdir "${PPDFOLDER}" + mkdir -p "${PPDFOLDER}" export PMD_JAVA_OPTS=-Xmx65536m "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" """ } else { bat """ - mkdir "${PPDFOLDER}" + mkdir -p "${PPDFOLDER}" set PMD_JAVA_OPTS=-Xmx2048m "${PPD}/cpd.bat" --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" """ From 21bc371542991ea4c4964115b3e5dc8105c27bec Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 12:43:41 +0100 Subject: [PATCH 053/115] Handle path exclusions --- staticanalysis/cpd.groovy | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 9e21374..01cdc64 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,24 +86,27 @@ pipeline { def PPDFOLDER = "${STATICANALYSIS}/ppd" def EXCLUDE_PARAM = '' if (EXCLUDE_PATHS) { - EXCLUDE_PARAM = """--exclude "${EXCLUDE_PATHS.trim()}" """ - } - dir(SRC) { - if (isUnix()) { - sh """#!/bin/bash - set -ev - - mkdir -p "${PPDFOLDER}" - export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" - """ - } else { - bat """ - mkdir -p "${PPDFOLDER}" - set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files . --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" - """ + EXCLUDE_PARAM = '--exclude "' + def exclude_path_list = EXCLUDE_PATHS.split(',') + for (exclude_path in exclude_path_list) { + EXCLUDE_PARAM += "${SRC}/${exclude_path.trim()}," } + EXCLUDE_PARAM += '"' + } + if (isUnix()) { + sh """#!/bin/bash + set -ev + + mkdir -p "${PPDFOLDER}" + export PMD_JAVA_OPTS=-Xmx65536m"${SRC}""${SRC}" + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" + """ + } else { + bat """ + mkdir -p "${PPDFOLDER}" + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" + """ } recordIssues(tools: [ cpd(pattern: "**/cpd.xml", reportEncoding: 'UTF-8'), From edb44517747f02f2054bdcaaff4bb0cec729458b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 12:47:06 +0100 Subject: [PATCH 054/115] Handle path exclusions --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 01cdc64..d4bf093 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -98,7 +98,7 @@ pipeline { set -ev mkdir -p "${PPDFOLDER}" - export PMD_JAVA_OPTS=-Xmx65536m"${SRC}""${SRC}" + export PMD_JAVA_OPTS=-Xmx65536m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" """ } else { From be93f030970c724c0cdeb48764e7ea8a34947071 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Oct 2020 12:52:31 +0100 Subject: [PATCH 055/115] Handle path exclusions --- staticanalysis/cpd.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index d4bf093..6f3a33f 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -99,13 +99,13 @@ pipeline { mkdir -p "${PPDFOLDER}" export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/cpd.xml" """ } else { bat """ mkdir -p "${PPDFOLDER}" set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}cpd.xml" + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/cpd.xml" """ } recordIssues(tools: [ From 41ec5e4630bdac11f8d4315699637a4fbce42731 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 16 Oct 2020 11:00:08 +0100 Subject: [PATCH 056/115] Release_to_git: Handle the case where the URI to the source repo associated with a subsystem and product name has changed --- release/do.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 3221d25..9148572 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -1,3 +1,5 @@ +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + markunstable = false unstablereason = "" @@ -373,7 +375,8 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) { def buildmeta = buildinfo.meta - def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" + def uriconverted = gh.uniquereporootname(buildmeta.gitinfo.remoteurl) + def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${uriconverted}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" From b9a22c19899b19a2a6eed719389fe45e038db74b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Oct 2020 11:08:33 +0000 Subject: [PATCH 057/115] Initial commit --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b6daf1 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Atlas_Custom_Modules_autobuild_scripts + +Autobuild scripts for Atlas Custom Modules \ No newline at end of file From 2d66e342df7eaebf40518f9cb7d6aa40da608fff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Oct 2020 12:12:30 +0100 Subject: [PATCH 058/115] Copy from Atlas Autobuild scripts as a starting point --- Common_scripts/.project | 17 + Common_scripts/.pydevproject | 8 + .../org.eclipse.core.resources.prefs | 2 + Common_scripts/artifacts/metaexport.groovy | 22 + Common_scripts/autobuilder.groovy | 98 ++ Common_scripts/check/build_meta.groovy | 86 ++ Common_scripts/check/do_meta.groovy | 77 ++ Common_scripts/checksum/utils.groovy | 14 + Common_scripts/clean/clean.groovy | 10 + Common_scripts/commandline/commandline.groovy | 13 + .../eclipsebuild/disableparallelbuilds.groovy | 12 + .../eclipsebuild/eclipseSTM8build.groovy | 172 ++++ .../eclipsebuild/eclipseds5build.groovy | 252 ++++++ .../eclipsebuild/eclipseniosbuild.groovy | 116 +++ .../configuration/configuration.groovy | 18 + Common_scripts/copy/all.groovy | 86 ++ Common_scripts/copy/esw.groovy | 63 ++ Common_scripts/copy/filtered.groovy | 70 ++ Common_scripts/copy/logic.groovy | 62 ++ Common_scripts/differences/.project | 17 + Common_scripts/differences/.pydevproject | 8 + .../differences/dometahierarchy.groovy | 836 ++++++++++++++++++ Common_scripts/differences/file.groovy | 16 + Common_scripts/differences/json.groovy | 15 + .../differences/metahierarchy.groovy | 91 ++ .../documentation/doxygen_deploy.groovy | 80 ++ Common_scripts/import/importer.groovy | 333 +++++++ Common_scripts/install/installhelper.groovy | 117 +++ Common_scripts/meta/folder.groovy | 772 ++++++++++++++++ Common_scripts/packaging/debian.groovy | 106 +++ Common_scripts/platform/lineendings.groovy | 5 + Common_scripts/publish/.classpath | 9 + Common_scripts/publish/.gitignore | 7 + Common_scripts/publish/.project | 18 + .../org.eclipse.jdt.groovy.core.prefs | 3 + Common_scripts/publish/do.groovy | 174 ++++ Common_scripts/publish/package.groovy | 176 ++++ .../publish/promptingpublish.groovy | 179 ++++ Common_scripts/publish/publish.groovy | 91 ++ Common_scripts/publish/publishitems.groovy | 127 +++ Common_scripts/publishing/utils.groovy | 27 + Common_scripts/release/do.groovy | 439 +++++++++ Common_scripts/release/registerrepo.groovy | 12 + Common_scripts/release/release.groovy | 88 ++ Common_scripts/remoteaccess/ftp.groovy | 32 + Common_scripts/remoteaccess/hostedftp.groovy | 28 + Common_scripts/staticanalysis/ccm.groovy | 119 +++ Common_scripts/staticanalysis/cpd.groovy | 151 ++++ Common_scripts/staticanalysis/cppcheck.groovy | 113 +++ Common_scripts/textutils/subst.groovy | 8 + .../vs2017install/buildmachines.vsconfig | 25 + Common_scripts/versioncontrol/git.groovy | 376 ++++++++ Common_scripts/versionnumbering/do.groovy | 23 + .../versionnumbering/generate.groovy | 169 ++++ Common_scripts/versionstamping/.project | 17 + Common_scripts/versionstamping/.pydevproject | 8 + .../versionstamping/versionstamper.py | 38 + build/build_all.groovy | 326 +++++++ cloning/cloning.groovy | 212 +++++ compile/compile.groovy | 255 ++++++ compile/compile_ink_ui.groovy | 216 +++++ .../build_atlas_documentation.groovy | 226 +++++ .../build_ink_ui_documentation.groovy | 222 +++++ documentation/release_note.groovy | 162 ++++ install/install_atlas_ink_ui.groovy | 336 +++++++ install/install_atlas_professional.groovy | 333 +++++++ install/install_atlas_sdk.groovy | 330 +++++++ localisation_check/localisation_check.groovy | 164 ++++ nuget/createpackages.groovy | 204 +++++ publish/.project | 17 + publish/.pydevproject | 8 + publish/build_post_2_0_27_atlas.py | 53 ++ publish/build_post_2_0_28_atlas.py | 54 ++ publish/publish.bat | 42 + publish/publishLibrary.py | 274 ++++++ publish/reset_imports_and_exports.bat | 8 + release_to_git/javascript_release_to_git.gsh | 149 ++++ release_to_git/release_to_git.gsh | 150 ++++ resharper/atlas_ink_resharper.groovy | 206 +++++ resharper/atlas_sdk_resharper.groovy | 208 +++++ resharper/atlas_ui_resharper.groovy | 208 +++++ resharper/ccm.groovy | 144 +++ static_analysis/static_analysis.groovy | 123 +++ test/check_node_status.groovy | 44 + test/check_te_licences.groovy | 23 + test/flesh_install_dispatcher.groovy | 24 + test/fresh_install_master.groovy | 157 ++++ test/fresh_install_test.groovy | 203 +++++ test/test_all.groovy | 204 +++++ test/ui_mcs_tools_testing_dev.groovy | 172 ++++ test/ui_meta_test.groovy | 240 +++++ test/ui_printserver_testing_dev.groovy | 149 ++++ 92 files changed, 11897 insertions(+) create mode 100644 Common_scripts/.project create mode 100644 Common_scripts/.pydevproject create mode 100644 Common_scripts/.settings/org.eclipse.core.resources.prefs create mode 100644 Common_scripts/artifacts/metaexport.groovy create mode 100644 Common_scripts/autobuilder.groovy create mode 100644 Common_scripts/check/build_meta.groovy create mode 100644 Common_scripts/check/do_meta.groovy create mode 100644 Common_scripts/checksum/utils.groovy create mode 100644 Common_scripts/clean/clean.groovy create mode 100644 Common_scripts/commandline/commandline.groovy create mode 100644 Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy create mode 100644 Common_scripts/compile/eclipsebuild/eclipseSTM8build.groovy create mode 100644 Common_scripts/compile/eclipsebuild/eclipseds5build.groovy create mode 100644 Common_scripts/compile/eclipsebuild/eclipseniosbuild.groovy create mode 100644 Common_scripts/configuration/configuration.groovy create mode 100644 Common_scripts/copy/all.groovy create mode 100644 Common_scripts/copy/esw.groovy create mode 100644 Common_scripts/copy/filtered.groovy create mode 100644 Common_scripts/copy/logic.groovy create mode 100644 Common_scripts/differences/.project create mode 100644 Common_scripts/differences/.pydevproject create mode 100644 Common_scripts/differences/dometahierarchy.groovy create mode 100644 Common_scripts/differences/file.groovy create mode 100644 Common_scripts/differences/json.groovy create mode 100644 Common_scripts/differences/metahierarchy.groovy create mode 100644 Common_scripts/documentation/doxygen_deploy.groovy create mode 100644 Common_scripts/import/importer.groovy create mode 100644 Common_scripts/install/installhelper.groovy create mode 100644 Common_scripts/meta/folder.groovy create mode 100644 Common_scripts/packaging/debian.groovy create mode 100644 Common_scripts/platform/lineendings.groovy create mode 100644 Common_scripts/publish/.classpath create mode 100644 Common_scripts/publish/.gitignore create mode 100644 Common_scripts/publish/.project create mode 100644 Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs create mode 100644 Common_scripts/publish/do.groovy create mode 100644 Common_scripts/publish/package.groovy create mode 100644 Common_scripts/publish/promptingpublish.groovy create mode 100644 Common_scripts/publish/publish.groovy create mode 100644 Common_scripts/publish/publishitems.groovy create mode 100644 Common_scripts/publishing/utils.groovy create mode 100644 Common_scripts/release/do.groovy create mode 100644 Common_scripts/release/registerrepo.groovy create mode 100644 Common_scripts/release/release.groovy create mode 100644 Common_scripts/remoteaccess/ftp.groovy create mode 100644 Common_scripts/remoteaccess/hostedftp.groovy create mode 100644 Common_scripts/staticanalysis/ccm.groovy create mode 100644 Common_scripts/staticanalysis/cpd.groovy create mode 100644 Common_scripts/staticanalysis/cppcheck.groovy create mode 100644 Common_scripts/textutils/subst.groovy create mode 100644 Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig create mode 100644 Common_scripts/versioncontrol/git.groovy create mode 100644 Common_scripts/versionnumbering/do.groovy create mode 100644 Common_scripts/versionnumbering/generate.groovy create mode 100644 Common_scripts/versionstamping/.project create mode 100644 Common_scripts/versionstamping/.pydevproject create mode 100644 Common_scripts/versionstamping/versionstamper.py create mode 100644 build/build_all.groovy create mode 100644 cloning/cloning.groovy create mode 100644 compile/compile.groovy create mode 100644 compile/compile_ink_ui.groovy create mode 100644 documentation/build_atlas_documentation.groovy create mode 100644 documentation/build_ink_ui_documentation.groovy create mode 100644 documentation/release_note.groovy create mode 100644 install/install_atlas_ink_ui.groovy create mode 100644 install/install_atlas_professional.groovy create mode 100644 install/install_atlas_sdk.groovy create mode 100644 localisation_check/localisation_check.groovy create mode 100644 nuget/createpackages.groovy create mode 100644 publish/.project create mode 100644 publish/.pydevproject create mode 100644 publish/build_post_2_0_27_atlas.py create mode 100644 publish/build_post_2_0_28_atlas.py create mode 100644 publish/publish.bat create mode 100644 publish/publishLibrary.py create mode 100644 publish/reset_imports_and_exports.bat create mode 100644 release_to_git/javascript_release_to_git.gsh create mode 100644 release_to_git/release_to_git.gsh create mode 100644 resharper/atlas_ink_resharper.groovy create mode 100644 resharper/atlas_sdk_resharper.groovy create mode 100644 resharper/atlas_ui_resharper.groovy create mode 100644 resharper/ccm.groovy create mode 100644 static_analysis/static_analysis.groovy create mode 100644 test/check_node_status.groovy create mode 100644 test/check_te_licences.groovy create mode 100644 test/flesh_install_dispatcher.groovy create mode 100644 test/fresh_install_master.groovy create mode 100644 test/fresh_install_test.groovy create mode 100644 test/test_all.groovy create mode 100644 test/ui_mcs_tools_testing_dev.groovy create mode 100644 test/ui_meta_test.groovy create mode 100644 test/ui_printserver_testing_dev.groovy diff --git a/Common_scripts/.project b/Common_scripts/.project new file mode 100644 index 0000000..e329c3f --- /dev/null +++ b/Common_scripts/.project @@ -0,0 +1,17 @@ + + + Common Build Scripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/Common_scripts/.pydevproject b/Common_scripts/.pydevproject new file mode 100644 index 0000000..1ce5929 --- /dev/null +++ b/Common_scripts/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 2.7 +python35 + diff --git a/Common_scripts/.settings/org.eclipse.core.resources.prefs b/Common_scripts/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..1174a06 --- /dev/null +++ b/Common_scripts/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//versionnumbering/versioninfo.py=utf-8 diff --git a/Common_scripts/artifacts/metaexport.groovy b/Common_scripts/artifacts/metaexport.groovy new file mode 100644 index 0000000..67d13c3 --- /dev/null +++ b/Common_scripts/artifacts/metaexport.groovy @@ -0,0 +1,22 @@ + +// Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders +def combineSubjobArtifacts(meta, importer, subJobs) { + def ArrayList artifactFolders = new ArrayList() + for (subJob in subJobs) { + def subJobObject = subJob[0] + if (subJobObject != null) { + def subJobName = subJobObject.getProjectName() + def subJobNumber = subJobObject.getNumber() + def destFolder = subJob[1] + def boolean incrementversionnumber = subJob[2] + dir(destFolder) { + deleteDir() + } + importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) + artifactFolders.add("${destFolder}/**") + } + } + return artifactFolders +} + +return this; diff --git a/Common_scripts/autobuilder.groovy b/Common_scripts/autobuilder.groovy new file mode 100644 index 0000000..71d9b6a --- /dev/null +++ b/Common_scripts/autobuilder.groovy @@ -0,0 +1,98 @@ +// Assume that WORKSPACE environment variable is set + +autobuildroot = 'autobuild' +commonscriptsroot = "${autobuildroot}/Common_scripts" +metafolderscript = null + +def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { + if (doclean) { + echo "Cleaning workspace" + // Save any script files that were loaded into the workspace at first and are required after cleaning the workspace + def stashname = 'Clean workspace stash' + stash(allowEmpty: true, + includes: "${autobuildroot}/**,${autobuildroot}/.git/**", + name: stashname, + useDefaultExcludes: false + ) + cleanWs() + unstash name: stashname + } + else { + echo "Not cleaning workspace" + } +} + +def commonscripts() { + return commonscriptsroot +} + +def getautobuildpath() { + return autobuildroot +} + +def getmetafolderscript() { + return metafolderscript +} + +// Start up boilderplate +def startbuild(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String releaserepo = RELEASE_REPO, String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) { + echo "Starting...." + + autobuildroot = autobuildpath + commonscriptsroot = commonscriptspath + metafolderscript = load("${commonscripts()}/meta/folder.groovy") + + conditionalclean() + + def meta = getmetafolderscript().metareset(script) + echo "Product name: ${productname} Subcomponent name: ${subcomponentname}" + meta.productinfo.set(productname, subcomponentname) + def now = new Date() + now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) + meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) + + def rr = load("${commonscripts()}/release/registerrepo.groovy") + echo "Release repo: ${releaserepo}" + rr.registerrepo(meta, releaserepo) + + def ch = load("${commonscripts()}/configuration/configuration.groovy") + ch.registerPipelineScriptConfiguration(meta) + + return meta +} + +def start(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String jirakey = JIRA_KEY, String releaserepo = RELEASE_REPO, String repoRootSuffix = "", String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) { + echo "DEPRECATED method: start(script, String productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, ...)" + return startbuild(script, productname, subcomponentname, releaserepo, autobuildpath, commonscriptspath) +} + +// Start up boilderplate +def startnonbuild(script, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { + echo "Starting non-build job...." + + autobuildroot = autobuildpath + commonscriptsroot = commonscriptspath + metafolderscript = load("${commonscripts()}/meta/folder.groovy") + + conditionalclean() + + def meta = getmetafolderscript().metareset(script) + meta.productinfo.set("Non-build-product", "Non-build-subcomponent") + def now = new Date() + now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) + meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) + + def ch = load("${commonscripts()}/configuration/configuration.groovy") + ch.registerPipelineScriptConfiguration(meta) + + return meta +} + +def configurationhelper() { + return load("${commonscripts()}/configuration/configuration.groovy") +} + +// Everyone wants to know this +autobuilder = this + +return this; diff --git a/Common_scripts/check/build_meta.groovy b/Common_scripts/check/build_meta.groovy new file mode 100644 index 0000000..34eed98 --- /dev/null +++ b/Common_scripts/check/build_meta.groovy @@ -0,0 +1,86 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.startnonbuild(this) + } + } + } + stage('Clean exports') { + steps { + script { + cleanfolders = [ + "${WORKSPACE}/build_artifacts", + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Get build artifact meta') { + steps { + script { + BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts" + copyArtifacts( + projectName: BUILD_JOB, + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: BUILD_JOB_SELECTOR + ], + target: BUILD_ARTIFACTS + ) + def mfs = autobuilderscript.getmetafolderscript() + buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS) + } + } + } + stage('Check components') { + steps { + script { + def checker = load("${autobuilder.commonscripts()}/check/do_meta.groovy") + (summarystring, markunstable, unstablereason) = checker.checkhierarchy(buildmeta, MAX_META_DEPTH, BUILD_ARTIFACTS) + 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/Common_scripts/check/do_meta.groovy b/Common_scripts/check/do_meta.groovy new file mode 100644 index 0000000..7bfe2d1 --- /dev/null +++ b/Common_scripts/check/do_meta.groovy @@ -0,0 +1,77 @@ +markunstable = false +unstablereason = "" + +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" +releaserepofolder = "${WORKSPACE}/releaserepos" +sourcerepofolder = "${WORKSPACE}/sourcerepos" +tempfolder = "${WORKSPACE}/temp" +gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" + +metascript = autobuilder.getmetafolderscript() + +def resetfolders() { + dir(summaryfolder) { + deleteDir() + } + dir(releaserepofolder) { + deleteDir() + } + dir(tempfolder) { + deleteDir() + } +} + +def preconditions() { + markunstable = false + unstablereason = "" + summarystring = "" + writeFile(file: summaryfile, text: "Release summary: \n") +} + +def setunstable(String reason) { + markunstable = true + unstablereason += reason + "\n" + echo "Marked build as unstable: Reason: ${reason}" +} + +def summaryappend(String summary) { + def String currentsummarycontents = readFile(file: summaryfile) + writeFile(file: summaryfile, text: currentsummarycontents + summary) + summarystring += summary +} + +def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { + int md = maxdepth.toInteger() + resetfolders() + preconditions() + + // Walk the meta information to a max depth + def buildinfo = buildmeta.releasewalker(md) + echo "All components:" + def String componentinfo = "" + for (entry in buildinfo) { + def name = entry.meta.componentversionuniqueidentifier() + def offsetpath = entry.offsetpath + def abspath = "${buildpathroot}/${offsetpath}" + componentinfo += "Name: ${name} \t\t\t\tPath: ${offsetpath} \t\t\t\tFile exists in import: ${fileExists(abspath)}\n" + } + echo componentinfo + + // Walk the meta information to a max depth + def componentReleaseInfo = buildmeta.releasewalkerunique(md) + echo "Unique components:" + def String versioncomponent = "" + for (key in componentReleaseInfo.keySet()) { + def buildinfo2 = componentReleaseInfo[key] + def offsetpath = buildinfo2.offsetpath + def abspath = "${buildpathroot}/${offsetpath}" + versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n" + } + echo versioncomponent + + return [summarystring, markunstable, unstablereason] +} + +return this; diff --git a/Common_scripts/checksum/utils.groovy b/Common_scripts/checksum/utils.groovy new file mode 100644 index 0000000..c2503cd --- /dev/null +++ b/Common_scripts/checksum/utils.groovy @@ -0,0 +1,14 @@ + +// Generate a checksum file of from a list of files/directories relative to workspace +def generatelist(meta, checksummable) { + for (filepath in checksummable) { + def checksumset = meta.checksuminfo.addChecksumSet(filepath) + def files = findFiles(glob: filepath) + for (file in files) { + def sum = sha1(file: file.path).trim() + checksumset.addChecksumPair(file.path, sum) + } + } +} + +return this; \ No newline at end of file diff --git a/Common_scripts/clean/clean.groovy b/Common_scripts/clean/clean.groovy new file mode 100644 index 0000000..4707ba0 --- /dev/null +++ b/Common_scripts/clean/clean.groovy @@ -0,0 +1,10 @@ + +def clean(folderlist) { + for (folder in folderlist) { + dir(folder) { + deleteDir() + } + } +} + +return this; \ No newline at end of file diff --git a/Common_scripts/commandline/commandline.groovy b/Common_scripts/commandline/commandline.groovy new file mode 100644 index 0000000..df99a75 --- /dev/null +++ b/Common_scripts/commandline/commandline.groovy @@ -0,0 +1,13 @@ +String getCommandOutput(String cmd) { + if (isUnix()) { + return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim() + } else { + return bat(returnStdout: true, script: """ + @echo off + ${cmd} + """ + ).trim() + } +} + +return this \ No newline at end of file diff --git a/Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy b/Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy new file mode 100644 index 0000000..03e4c8f --- /dev/null +++ b/Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy @@ -0,0 +1,12 @@ + +// Disable parallel make builds - which may be causing autobuild issues +def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { + if (isUnix()) { + sh """ + # Looks for " sparseitemlist = gh.convertSparseItemsString(filter) + gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) + + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) +} + +return this diff --git a/Common_scripts/copy/all.groovy b/Common_scripts/copy/all.groovy new file mode 100644 index 0000000..b7c4607 --- /dev/null +++ b/Common_scripts/copy/all.groovy @@ -0,0 +1,86 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Clean exports') { + steps { + script { + IMPORTS = 'imports' + cleanfolders = [ + IMPORTS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Import source artifacts') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + def copyoptions = importer.getNewImportOptions() + copyoptions.source( + SOURCE_ARTIFACT_LOCATION, + SOURCE_ARTIFACT_BUILD_JOB, + SOURCE_ARTIFACT_BUILD_SELECTOR, + SOURCE_ARTIFACT_RELEASE_REPO, + SOURCE_ARTIFACT_RELEASE_REVISION) + echo "Nested: ${NESTED_COPY}" + copyoptions.setnested(NESTED_COPY == 'true') + importer.artifactimport(meta, copyoptions, IMPORTS) + } + } + } + stage('Copy source artifacts') { + steps { + script { + dir(IMPORTS) { + fileOperations([ + fileCopyOperation(excludes: '', + flattenFiles: false, + includes: '**/*', + targetLocation: WORKSPACE) + ]) + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def includes = '**/*' + def excludes = "${IMPORTS}/*" + echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" + // This does not work: archiveArtifacts artifacts: includes, excludes: excludes + // so + cleanfolders = [ + IMPORTS, + 'autobuild', + ] + cleaner.clean(cleanfolders) + archiveArtifacts artifacts: includes + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} \ No newline at end of file diff --git a/Common_scripts/copy/esw.groovy b/Common_scripts/copy/esw.groovy new file mode 100644 index 0000000..2a63171 --- /dev/null +++ b/Common_scripts/copy/esw.groovy @@ -0,0 +1,63 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + } + } + } + stage('Clean exports') { + steps { + script { + env.ESW = 'esw' + env.ESWDEST = "${WORKSPACE}/${ESW}" + env.ESWEXPORT = 'embedded_software' + cleanfolders = [ + ESWDEST, + ESWEXPORT, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Copying embedded software artifacts') { + steps { + script { + importer.artifactimport(meta, ESW_ARTIFACT_LOCATION, ESW_ARTIFACT_BUILD_JOB, ESW_ARTIFACT_BUILD_SELECTOR, ESW_ARTIFACT_RELEASE_REPO, ESW_ARTIFACT_RELEASE_REVISION, ESWDEST) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["${ESWEXPORT}/**"]) + sh """ + rm -v -rf diff + rm -v -rf meta + mv -v "${ESW}"/* . + """ + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} \ No newline at end of file diff --git a/Common_scripts/copy/filtered.groovy b/Common_scripts/copy/filtered.groovy new file mode 100644 index 0000000..feaa2ab --- /dev/null +++ b/Common_scripts/copy/filtered.groovy @@ -0,0 +1,70 @@ +pipeline { + agent { label AGENT_LABEL } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + } + } + } + stage('Clean') { + steps { + script { + env.IMPORT = "${WORKSPACE}/import" + env.FILTEREDDEST = "${WORKSPACE}/filtered" + cleanfolders = [ + FILTEREDDEST, + IMPORT, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Import artifacts') { + steps { + script { + importer.artifactimport(meta, ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION, IMPORT) + } + } + } + stage('Filtered copy') { + steps { + script { + dir(IMPORT) { + fileOperations([ + fileCopyOperation(excludes: EXCLUDES, + flattenFiles: FLATTENOUTPUT, + includes: INCLUDES, + targetLocation: FILTEREDDEST)]) + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["filtered/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/Common_scripts/copy/logic.groovy b/Common_scripts/copy/logic.groovy new file mode 100644 index 0000000..d1ece6d --- /dev/null +++ b/Common_scripts/copy/logic.groovy @@ -0,0 +1,62 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + } + } + } + stage('Clean exports') { + steps { + script { + env.LOGICDEST = "${WORKSPACE}/logic" + cleanfolders = [ + LOGICDEST, + "${WORKSPACE}/embedded_logic", + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Copying logic artifacts') { + steps { + script { + importer.artifactimport(meta, LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_RELEASE_REPO, LOGIC_RELEASE_REVISION, LOGICDEST) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["embedded_logic/**"]) + sh """ + rm -v -rf meta + # The following is removing a deprecated folder + rm -v -rf diff + mv -v "logic"/* . + """ + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} \ No newline at end of file diff --git a/Common_scripts/differences/.project b/Common_scripts/differences/.project new file mode 100644 index 0000000..75af0fc --- /dev/null +++ b/Common_scripts/differences/.project @@ -0,0 +1,17 @@ + + + Release_difference + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/Common_scripts/differences/.pydevproject b/Common_scripts/differences/.pydevproject new file mode 100644 index 0000000..c3434da --- /dev/null +++ b/Common_scripts/differences/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Default + diff --git a/Common_scripts/differences/dometahierarchy.groovy b/Common_scripts/differences/dometahierarchy.groovy new file mode 100644 index 0000000..6280960 --- /dev/null +++ b/Common_scripts/differences/dometahierarchy.groovy @@ -0,0 +1,836 @@ +import groovy.json.JsonSlurper + +markunstable = false +unstablereason = "" + +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" + +sourcerepofolder = "${WORKSPACE}/sourcerepos" +tempfolder = "${WORKSPACE}/temp" + +reportfolder = "${WORKSPACE}/reports" + +class JiraTicketInfo { + String jiranumber + String uri + + JiraTicketInfo() { + jiranumber = '' + uri = '' + } + + def String dump() { + return "jiranumber: ${jiranumber} uri: ${uri}" + } +} + +class DifferenceRecord { + String productname + String subcomponentname + + String rawdifferencetext + String sha + String type + String mergeinfo + String squashinfo + List jiraticketinfo + String comment + + DifferenceRecord() { + productname = "" + subcomponentname = "" + + rawdifferencetext = "" + sha = "" + type = "" + mergeinfo = "" + squashinfo = "" + jiraticketinfo = [] + comment = "" + } + + def String dump() { + String jiraticketstring = '' + for (j in jiraticketinfo) { + jiraticketstring += j.dump() + " " + } + return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketstring}\ncomment: ${comment}" + } +} + +def resetfolders() { + dir(summaryfolder) { + deleteDir() + } + dir(tempfolder) { + deleteDir() + } + dir(reportfolder) { + deleteDir() + } +} + +def preconditions() { + markunstable = false + unstablereason = "" + summarystring = "" + writeFile(file: summaryfile, text: "Release summary: \n") +} + +def setunstable(String reason) { + markunstable = true + unstablereason += reason + "\n" + echo "Marked build as unstable: Reason: ${reason}" +} + +def summaryappend(String summary) { + def String currentsummarycontents = readFile(file: summaryfile) + writeFile(file: summaryfile, text: currentsummarycontents + summary) + summarystring += summary +} + +def showmetaitems(metaitems) { + String info = '' + for (key in metaitems.keySet()) { + def relatedmetainfo = metaitems[key] + def offsetpath = relatedmetainfo.offsetpath + info += "Name: ${key}\t\t\t\tPath: ${offsetpath}\n" + } + echo info +} + +def boolean checkoutsourcerepo(buildmeta, String checkoutfolder) { + boolean checkedout = false + def String sourcerepo = buildmeta.gitinfo.remoteurl + if (sourcerepo?.trim()) { + echo "Updating source repo: ${sourcerepo} in folder: ${checkoutfolder}" + if (sourcerepo) { + // Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component + if (fileExists(checkoutfolder)) { + dir(checkoutfolder) { + sh(""" + git reset --hard + git clean -fdx + git pull + """ + ) + } + } + else { + dir(sourcerepofolder) { + sh("git clone ${sourcerepo} ${checkoutfolder}") + } + } + } + checkedout = true + } + return checkedout +} + +def String getcomponent(meta) { + def String uniquefolder = "${meta.productinfo.productname}_${meta.productinfo.subcomponentname}" + def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" + def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" + + boolean checkedout = checkoutsourcerepo(meta, uniquefolderforsourcerepo) + + return [checkedout, uniquefolderforsourcerepo] +} + +def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { + def String releaseexpression + if (tripledot) { + releaseexpression = earlyrevision + "..." + laterrevision + } else { + releaseexpression = earlyrevision + ".." + laterrevision + } + def String differencetext + dir(gitrootfolder) { + differencetext = sh(returnStdout: true, script: "git --no-pager log --oneline ${releaseexpression}").trim() + } + return differencetext +} + +def extractsha(String line) { + def pattern = ~"^(\\p{XDigit}*) (.*)" + def match = (line =~ pattern) + match.find() + + def sha = match.group(1) + def restofline = match.group(2) + + //echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}" + + return [sha.trim(), restofline.trim()] +} + +def extractsquashes(String line) { + def pattern1 = "^(.*)(Squashed .*)" + def match1 = (line =~ pattern1) + if (match1.find()) { + return [true, match1.group(2)] + } + + return [false, line] +} + +def extractmerges(String line) { + def pattern1 = "^(.*)(Merge branch .*)" + def match1 = (line =~ pattern1) + if (match1.find()) { + return [true, match1.group(2)] + } + + def pattern2 = "^(.*)(Merge remote-tracking branch .*)" + def match2 = (line =~ pattern2) + if (match2.find()) { + return [true, match2.group(2)] + } + + def pattern3 = "^(.*)(Merge commit .*)" + def match3 = (line =~ pattern3) + if (match3.find()) { + return [true, match3.group(2)] + } + + def pattern4 = "^(.*)(Add .* from commit .*)" + def match4 = (line =~ pattern4) + if (match4.find()) { + return [true, match4.group(2)] + } + + return [false, line] +} + +def jiraticketexists(String jiraticket) { + def String URI = "${JIRA_URI}/browse/${jiraticket}" + def String RestfulURI = "${JIRA_URI}/rest/api/latest/issue/${jiraticket}?fields=summary" + def get = new URL(RestfulURI).openConnection(); + get.setRequestProperty( 'X-AUSERNAME', "${JIRA_USERNAME}" ) + get.setRequestProperty( 'Authorization', "Basic ${JIRA_ENCODED_PASSWORD}" ) + get.setRequestProperty( 'User-Agent', 'groovy-2.4.4' ) + get.setRequestProperty( 'Accept', 'application/json' ) + def getRC = get.getResponseCode(); + + def String redirectedjiraticket = jiraticket + if(!getRC.equals(200)) { + return [false, '', jiraticket] + } else { + def jsonresponse = new JsonSlurper().parseText(get.inputStream.getText('UTF-8')) + redirectedjiraticket = jsonresponse['key'] + } + return [true, URI, redirectedjiraticket] +} + +def extractjiraticketinfo(String line) { + def List jiratickets = [] + boolean exists = false + String URI = '' + + while (true) { + line = line.trim() + def commapattern = '^\\s*,(.*)' // Consume separating commas at the beginning of the line + def commamatch = (line =~ commapattern) + if (commamatch.find()) { + line = commamatch.group(1).trim() + } + def pattern1 = '^(\\w+-\\d+)(.*)' //GIS-1234 hmbxr5601-1234 + def match1 = (line =~ pattern1) + if (match1.find()) { + jiraticket = match1.group(1) + (exists, URI, jiraticket) = jiraticketexists(jiraticket) + if (exists) { + def JiraTicketInfo j = new JiraTicketInfo() + j.jiranumber = jiraticket + j.uri = URI + jiratickets.add(j) + line = match1.group(2) + } else { + break + } + } else { + def pattern2 = '^(\\w+)(\\d+)(.*)' //GIS1234 smb1234 + def match2 = (line =~ pattern2) + if (match2.find()) { + jiraticket = match2.group(1) + "-" + match2.group(2) + (exists, URI, jiraticket) = jiraticketexists(jiraticket) + if (exists) { + def JiraTicketInfo j = new JiraTicketInfo() + j.jiranumber = jiraticket + j.uri = URI + jiratickets.add(j) + line = match2.group(3) + } else { + break + } + } else { + def pattern3 = '^(\\w+)\\s(\\d+)(.*)' //GIS 1234 smb 1234 + def match3 = (line =~ pattern3) + if (match3.find()) { + jiraticket = match3.group(1) + "-" + match3.group(2) + (exists, URI, jiraticket) = jiraticketexists(jiraticket) + if (exists) { + def JiraTicketInfo j = new JiraTicketInfo() + j.jiranumber = jiraticket + j.uri = URI + jiratickets.add(j) + line = match3.group(3) + } else { + break + } + } else { + break + } + } + } + } + boolean result = jiratickets.size() > 0 + return [result, jiratickets, line] +} + +def extractreverts(String line) { + boolean result = true + + def pattern1 = '^(.*)Revert \"(.*)\"' + def match1 = (line =~ pattern1) + if (match1.find()) { + def line2 = match1.group(2) + (result, originaljiraticketinfo, originalcomment) = extractjiraticketinfo(line2) + return [true, originaljiraticketinfo, originalcomment] + } + + def pattern2 = '^(.*)Partial Revert \"(.*)\"' + def match2 = (line =~ pattern2) + if (match2.find()) { + def line2 = match2.group(2) + (result, originaljiraticketinfo, originalcomment) = extractjiraticketinfo(line2) + return [true, originaljiraticketinfo, originalcomment] + } + + return [false, [], line] +} + +def getgitlogdifferencesfromsquash(String gitrootfolder, String squashedrevision) { + def String differencetext + dir(gitrootfolder) { + differencetext = sh(returnStdout: true, script: "git --no-pager log --oneline ${squashedrevision}").trim() + } + return differencetext +} + +def List fillsquashrecords(String sourcepath, String sha) { + def List differencerecords = [] + + String squashloglines = getgitlogdifferencesfromsquash(sourcepath, sha) + int count = 0 + squashloglines.split('\n').each { + if (count > 0) { // Ignore first line + def line = it + if (line?.trim()) { + def List drs = fillrecord(meta, line.trim(), sourcepath) + differencerecords.addAll(drs) + //echo "${dr.dump()}" + } + } + count += 1 + } + return differencerecords +} + +def List fillrecord(meta, line, String sourcepath) { + def List differencerecords = [] + def DifferenceRecord dr = new DifferenceRecord() + + dr.productname = meta.productinfo.productname + dr.subcomponentname = meta.productinfo.subcomponentname + + dr.rawdifferencetext = line + + // Example of raw text to process: + // 76056562e4 GIS-1621 - Removing redundant lines and effects of this - Restore nuget_version_edit.py + + (sha, line2) = extractsha(line) + dr.sha = sha + + (result, squashinfo) = extractsquashes(line2) + if (result) { + dr.type = "Squash" + dr.squashinfo = squashinfo + squashrecords = fillsquashrecords(sourcepath, sha) + differencerecords.addAll(squashrecords) + } else { + (result, mergeinfo) = extractmerges(line2) + if (result) { + dr.type = "Merge" + dr.mergeinfo = mergeinfo + } else { + (result, jiraticketinfo, comment) = extractreverts(line2) + if (result) { + dr.type = "Revert" + dr.jiraticketinfo = jiraticketinfo + dr.comment = comment + } else { + (result, jiraticketinfo, comment) = extractjiraticketinfo(line2) + if (result) { + dr.type = "Ticketed" + dr.jiraticketinfo = jiraticketinfo + dr.comment = comment + } else { + dr.type = "Unticketed" + dr.comment = line2 + } + } + } + } + differencerecords.add(dr) + return differencerecords +} + +def List processtext(meta, String text, String sourcepath) { + def List differencerecords = [] + + text.split('\n').each { + def line = it + if (line?.trim()) { + def List drs = fillrecord(meta, line.trim(), sourcepath) + differencerecords.addAll(drs) + //echo "${dr.dump()}" + } + } + return differencerecords +} + +def getdifferencerecords(earlymeta, latermeta, String sourcepath) { + boolean result = true; + def List differencerecords = [] + + def earlygitinfo = earlymeta.gitinfo + def latergitinfo = latermeta.gitinfo + + if (earlygitinfo.remoteurl == latergitinfo.remoteurl) { + def earlyrevision = earlygitinfo.gitrevision + def laterrevision = latergitinfo.gitrevision + echo "Comparing early revision: ${earlyrevision} with: ${laterrevision} Working copy path: ${sourcepath}" + summaryappend("Early revision: ${earlyrevision} Later revision: ${laterrevision}") + def String differencetext = getgitlogdifferences(sourcepath, earlyrevision, laterrevision) + differencerecords = processtext(earlymeta, differencetext, sourcepath) + if (earlyrevision == laterrevision) { + summaryappend(" No change") + } + } else { + summaryappend("The early and later git urls don't match") + echo "The early and later git urls don't match" + result = false; + setunstable("The early and later git urls don't match in: ${earlymeta.componentidentifier()}") + } + + return [result, differencerecords] +} + +def deletedcomponent(earlymetaitems, key) { + echo "Component ${key} has been deleted in later version" + summaryappend("Deleted ") +} + +def addedcomponent(latermetaitems, key) { + echo "Component ${key} has been added in later version" + summaryappend("Added ") +} + +class SquashReportRecord { + String comment + int duplicates + + SquashReportRecord() { + comment = '' + duplicates = 0 + } +} + +def squashreport(String reportsubfolder, String title, LinkedHashMap squashes, boolean iscomponent = true) { + dir(reportsubfolder) { + def String squashlist = "${title}\nSquash list:\n" + def squashessorted = squashes.sort() + for (asquash in squashessorted) { + def SquashReportRecord s = asquash.value + squashlist += "${s.comment} (${s.duplicates})\n" + } + writeFile(file: "squashlist.txt", text: squashlist) + } +} + +class MergeReportRecord { + String comment + int duplicates + + MergeReportRecord() { + comment = '' + duplicates = 0 + } +} + +def mergereport(String reportsubfolder, String title, LinkedHashMap merges, boolean iscomponent = true) { + dir(reportsubfolder) { + def String mergelist = "${title}\nMerge list:\n" + def mergessorted = merges.sort() + for (amerge in mergessorted) { + def MergeReportRecord m = amerge.value + mergelist += "${m.comment} (${m.duplicates})\n" + } + writeFile(file: "mergelist.txt", text: mergelist) + } +} + +class CommentsRecord { + String comment + int duplicates + + CommentsRecord() { + comment = '' + duplicates = 0 + } +} + +class RevertsReportRecord { + String jiraticket + String ticketURI + LinkedHashMap commentscollection + + RevertsReportRecord() { + jiraticket = '' + ticketURI = '' + commentscollection = new LinkedHashMap() + } +} + +def revertsreport(String reportsubfolder, String title, LinkedHashMap reverts, boolean iscomponent = true) { + dir(reportsubfolder) { + def String revertlist = "${title}\nRevert list:\n" + def revertssorted = reverts.sort() + for (arevert in revertssorted) { + def RevertsReportRecord r = arevert.value + revertlist += "${r.jiraticket} (${r.ticketURI}):\n" + def commentscollection = r.commentscollection + def sortedcommentscollection = commentscollection.sort() + for (commentrecord in sortedcommentscollection) { + def CommentsRecord c = commentrecord.value + revertlist += "${c.comment} (${c.duplicates})\n" + } + revertlist += "\n" + } + writeFile(file: "revertlist.txt", text: revertlist) + } +} + +class TicketedReportRecord { + String jiraticket + String ticketURI + LinkedHashMap commentscollection + + TicketedReportRecord() { + jiraticket = '' + ticketURI = '' + commentscollection = new LinkedHashMap() + } +} + +def ticketedreport(String reportsubfolder, String title, LinkedHashMap ticketed, boolean iscomponent = true) { + dir(reportsubfolder) { + def String ticketedlist = "${title}\nTicketed list:\n" + def ticketedsorted = ticketed.sort() + for (aticketed in ticketedsorted) { + def TicketedReportRecord r = aticketed.value + ticketedlist += "${r.jiraticket} (${r.ticketURI}):\n" + def commentscollection = r.commentscollection + def sortedcommentscollection = commentscollection.sort() + for (commentrecord in sortedcommentscollection) { + def CommentsRecord c = commentrecord.value + ticketedlist += "${c.comment} (${c.duplicates})\n" + } + ticketedlist += "\n" + } + writeFile(file: "ticketedlist.txt", text: ticketedlist) + } +} + +class UnticketedReportRecord { + String comment + int duplicates + + UnticketedReportRecord() { + comment = '' + duplicates = 0 + } +} + +def unticketedreport(String reportsubfolder, String title, LinkedHashMap unticketed, boolean iscomponent = true) { + dir(reportsubfolder) { + def String unticketedlist = "${title}\nUnticketed list:\n" + def unticketedsorted = unticketed.sort() + for (anunticketed in unticketedsorted) { + UnticketedReportRecord u = anunticketed.value + unticketedlist += "${u.comment} (${u.duplicates})\n" + } + writeFile(file: "unticketedlist.txt", text: unticketedlist) + } +} + +class TicketsReportRecord { + String jiraticket + String ticketURI + int duplicates + + TicketsReportRecord() { + jiraticket = '' + ticketURI = '' + duplicates = 0 + } +} + +def ticketsreport(String reportsubfolder, String title, tickets, boolean iscomponent = true) { + dir(reportsubfolder) { + String ticketlist = "${title}\nTicket list:\n" + ticketssorted = tickets.sort() + for (ticketnumber in ticketssorted) { + TicketsReportRecord t = ticketnumber.value + ticketlist += "${t.jiraticket} (${t.ticketURI}) (${t.duplicates})\n" + } + writeFile(file: "ticketlist.txt", text: ticketlist) + } +} + +def differencerecordsreport(String reportsubfolder, String title, differencerecords, boolean iscomponent = true) { + dir(reportsubfolder) { + String recordlist = "${title}\n" + for (dr in differencerecords) { + recordlist += dr.dump() + "\n\n" + } + writeFile(file: "recordlist.txt", text: recordlist) + } +} + +def boolean report(meta, title, differencerecords, boolean iscomponent = true) { + def Map ticketed = [:] + def Map squashes = [:] + def Map merges = [:] + def Map reverts = [:] + def Map unticketed = [:] + def Map tickets = [:] + + for (dr in differencerecords) { + if (dr.type == "Squash") { + def SquashReportRecord s + if (!squashes.containsKey(dr.mergeinfo)) { + s = new SquashReportRecord() + s.comment = dr.squashinfo + s.duplicates = 1 + } else { + s = squashes[dr.squashinfo] + s.duplicates += 1 + } + squashes[dr.squashinfo] = s + } + if (dr.type == "Merge") { + def MergeReportRecord m + if (!merges.containsKey(dr.mergeinfo)) { + m = new MergeReportRecord() + m.comment = dr.mergeinfo + m.duplicates = 1 + } else { + m = merges[dr.mergeinfo] + m.duplicates += 1 + } + merges[dr.mergeinfo] = m + } + if (dr.type == "Revert") { + def RevertsReportRecord r + for (ticket in dr.jiraticketinfo) { + JiraTicketInfo j = ticket + if (!reverts.containsKey(j.jiranumber)) { + r = new RevertsReportRecord() + r.jiraticket = j.jiranumber + r.ticketURI = j.uri + CommentsRecord c = new CommentsRecord() + c.comment = dr.comment + c.duplicates = 1 + r.commentscollection[dr.comment] = c + } else { + r = reverts[j.jiranumber] + def CommentsRecord c + if (!r.commentscollection.containsKey(dr.comment)) { + c = new CommentsRecord() + c.comment = dr.comment + c.duplicates = 1 + r.commentscollection[dr.comment] = c + } else { + c = r.commentscollection[dr.comment] + c.duplicates += 1 + } + r.commentscollection[dr.comment] = c + } + reverts[j.jiranumber] = r + def TicketsReportRecord t + if (!tickets.containsKey(j.jiranumber)) { + t = new TicketsReportRecord() + t.jiraticket = j.jiranumber + t.ticketURI = j.uri + t.duplicates = 1 + } else { + t = tickets[j.jiranumber] + t.duplicates += 1 + } + tickets[j.jiranumber] = t + } + } + if (dr.type == "Ticketed") { + def TicketedReportRecord t + for (ticket in dr.jiraticketinfo) { + JiraTicketInfo j = ticket + if (!ticketed.containsKey(j.jiranumber)) { + t = new TicketedReportRecord() + t.jiraticket = j.jiranumber + t.ticketURI = j.uri + CommentsRecord c = new CommentsRecord() + c.comment = dr.comment + c.duplicates = 1 + t.commentscollection[dr.comment] = c + } else { + t = ticketed[j.jiranumber] + def CommentsRecord c + if (!t.commentscollection.containsKey(dr.comment)) { + c = new CommentsRecord() + c.comment = dr.comment + c.duplicates = 1 + t.commentscollection[dr.comment] = c + } else { + c = t.commentscollection[dr.comment] + c.duplicates += 1 + } + t.commentscollection[dr.comment] = c + } + ticketed[j.jiranumber] = t + def TicketsReportRecord ti + if (!tickets.containsKey(j.jiranumber)) { + ti = new TicketsReportRecord() + ti.jiraticket = j.jiranumber + ti.ticketURI = j.uri + ti.duplicates = 1 + } else { + ti = tickets[j.jiranumber] + ti.duplicates += 1 + } + tickets[j.jiranumber] = ti + } + } + if (dr.type == "Unticketed") { + UnticketedReportRecord u + if (!unticketed.containsKey(dr.comment)) { + u = new UnticketedReportRecord() + u.comment = dr.comment + u.duplicates = 1 + } else { + u = unticketed[dr.comment] + u.duplicates += 1 + } + unticketed[dr.comment] = u + } + } + String reportsubfolder = "" + if (iscomponent) { + reportsubfolder = "${reportfolder}/${meta.componentidentifier()}" + } else { + reportsubfolder = "${reportfolder}/Combined" + } + mergereport(reportsubfolder, title, merges, iscomponent) + squashreport(reportsubfolder, title, squashes, iscomponent) + revertsreport(reportsubfolder, title, reverts, iscomponent) + ticketedreport(reportsubfolder, title, ticketed, iscomponent) + unticketedreport(reportsubfolder, title, unticketed, iscomponent) + ticketsreport(reportsubfolder, title, tickets, iscomponent) + differencerecordsreport(reportsubfolder, title, differencerecords, iscomponent) +} + +def title(earlymeta, latermeta) { + return """ + Differences in: + Product: ${earlymeta.productinfo.productname} Subcomponent: ${earlymeta.productinfo.subcomponentname} + between: + then: + Build date: ${earlymeta.jenkinsbuildinfo.builddate} Build stamp: ${earlymeta.buildstampinfo.buildstamp} Git revision: ${earlymeta.gitinfo.gitrevision} + now: + Build date: ${latermeta.jenkinsbuildinfo.builddate} Build stamp: ${latermeta.buildstampinfo.buildstamp} Git revision: ${latermeta.gitinfo.gitrevision} + """ +} + +def compare(earlymetaitems, latermetaitems, key) { + boolean result = true; + echo "Collecting changes between early and later versions of component: ${key}" + + def earlymeta = earlymetaitems[key].meta + def latermeta = latermetaitems[key].meta + + summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ") + + def boolean repoavailable + def String uniquefolderforsourcerepo + (repoavailable, uniquefolderforsourcerepo) = getcomponent(earlymeta) + + List differencerecords = [] + if (repoavailable) { + (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) + + summaryappend(" Items: ${differencerecords.size()} ") + report(earlymeta, title(earlymeta, latermeta), differencerecords) + } else { + summaryappend(" No source repo ") + } + summaryappend("\n") + + return [result, differencerecords]; +} + +def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { + def List differencerecords = [] + + def int md = maxdepth.toInteger() + resetfolders() + preconditions() + + echo "Comparing product meta hierarchy from folders: ${earlymetafolder} and ${latermetafolder} to a depth of ${md}. Exporting summary to ${summaryfolder}" + + def earlymeta = meta.importrelated(true, earlymetafolder) + def latermeta = meta.importrelated(true, latermetafolder) + + def earlymetaitems = earlymeta.releasewalkerunique(md) + def latermetaitems = latermeta.releasewalkerunique(md) + + echo "Early items:" + showmetaitems(earlymetaitems) + + echo "Later items:" + showmetaitems(latermetaitems) + + for (key in earlymetaitems.keySet()) { + if (latermetaitems.containsKey(key)) { + (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) + differencerecords = differencerecords + componentdifferencerecords + } else { + summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") + deletedcomponent(earlymetaitems, key) + summaryappend("\n") + } + } + for (key in latermetaitems.keySet()) { + if (!earlymetaitems.containsKey(key)) { + summaryappend("${latermeta.productinfo.productname} ${latermeta.productinfo.subcomponentname}: ") + addedcomponent(latermetaitems, key) + summaryappend("\n") + } + } + report(meta, title(earlymeta, latermeta), differencerecords, false) + return [summarystring, markunstable, unstablereason] +} + +return this; diff --git a/Common_scripts/differences/file.groovy b/Common_scripts/differences/file.groovy new file mode 100644 index 0000000..ab4102f --- /dev/null +++ b/Common_scripts/differences/file.groovy @@ -0,0 +1,16 @@ +def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { + if (isUnix()) { + def wsparameter = "-w" + if (!ignorewhitespace) { + wsparameter = "" + } + sh """ + diff -c ${wsparameter} "${importedfile}" "${currentfile}" + """ + } + else { + error "Windows not currently supporting file comparison" + } +} + +return this; diff --git a/Common_scripts/differences/json.groovy b/Common_scripts/differences/json.groovy new file mode 100644 index 0000000..5ac37f2 --- /dev/null +++ b/Common_scripts/differences/json.groovy @@ -0,0 +1,15 @@ +def comparefiles(importedjsonfile, currentjsonfile) { + if (isUnix()) { + sh """ + which jq + if [ \$? -ne 0 ]; then exit 1; fi + # jq -S sorts json output + diff -c <(jq -S . "${importedjsonfile}") <(jq -S . "${currentjsonfile}") + """ + } + else { + error "Windows not currently supporting json file comparison" + } +} + +return this; diff --git a/Common_scripts/differences/metahierarchy.groovy b/Common_scripts/differences/metahierarchy.groovy new file mode 100644 index 0000000..4bcdcdc --- /dev/null +++ b/Common_scripts/differences/metahierarchy.groovy @@ -0,0 +1,91 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.startnonbuild(this) + } + } + } + stage('Clean exports') { + steps { + script { + SUMMARYDIR = "${WORKSPACE}/summary" + REPORTDIR = "${WORKSPACE}/reports" + EARLYROOTDIR = 'early' + EARLYDIR = "${WORKSPACE}/${EARLYROOTDIR}" + LATERROOTDIR = 'later' + LATERDIR = "${WORKSPACE}/${LATERROOTDIR}" + + cleanfolders = [ + "${WORKSPACE}/build_artifacts", + "${EARLYDIR}", + "${LATERDIR}", + "${SUMMARYDIR}", + "${REPORTDIR}", + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Obtain top level meta') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + SOURCEURL = TOP_LEVEL_META_REPOSITORY.trim() + importer.artifactimport(meta, EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION, EARLYROOTDIR, false, 'meta/**') + importer.artifactimport(meta, LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION, LATERROOTDIR, false, 'meta/**') + } + } + } + stage('Diff components') { + steps { + script { + def comparator = load("${autobuilder.commonscripts()}/differences/dometahierarchy.groovy") + (summarystring, markunstable, unstablereason) = comparator.comparehierarchy(meta, EARLYDIR, LATERDIR, MAX_META_DEPTH, SUMMARYDIR) + if (markunstable) { + env.unstablereason = unstablereason + currentBuild.result = 'UNSTABLE' + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts() + archiveArtifacts "summary/**,reports/**,${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/Common_scripts/documentation/doxygen_deploy.groovy b/Common_scripts/documentation/doxygen_deploy.groovy new file mode 100644 index 0000000..6642256 --- /dev/null +++ b/Common_scripts/documentation/doxygen_deploy.groovy @@ -0,0 +1,80 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Clean imports') { + steps { + script { + env.DOXYGEN = "doxygen" + cleanfolders = [ + DOXYGEN, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Import doxygen artifacts') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + def importoptions = importer.getNewImportOptions() + + importoptions.jenkinsjob(BUILD_JOB_WITH_DOXYGEN_ARTIFACTS, BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR) + importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**') + doxygenmeta = importer.artifactimportfrombuildjob(meta, importoptions, DOXYGEN) + + productname = doxygenmeta.productinfo.productname + buildstampprefix = doxygenmeta.buildstampinfo.buildstampprefix + + echo "Doyxgen imported for product: ${productname} and build stamp prefix: ${buildstampprefix}" + } + } + } + stage('Copy doxygen to server') { + steps { + script { + doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}" + pathonserver = "${ROOT_PATH_ON_SERVER.trim()}/${productname}/${buildstampprefix}" + echo "Copying from ${doxygensource} to ${pathonserver}" + if (isUnix()) { + sh """#!/bin/bash + rm -rfv "${pathonserver}" + if [ \$? -ne 0 ]; then exit 1; fi + + mkdir -pv "${pathonserver}" + if [ \$? -ne 0 ]; then exit 1; fi + + echo mv -v "${doxygensource}"/ "${pathonserver}" + mv -v "${doxygensource}"/ "${pathonserver}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } else { + error("This job does not run on Windows at the moment") + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + diff --git a/Common_scripts/import/importer.groovy b/Common_scripts/import/importer.groovy new file mode 100644 index 0000000..8624421 --- /dev/null +++ b/Common_scripts/import/importer.groovy @@ -0,0 +1,333 @@ +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") +versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + +class ImportOptions { + def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) + + boolean m_incrementversionnumber // If true, increment the parent's (4th) version number with the (4th) version number of this object being imported + String m_filter // Only import files/paths/folders that match the filter + String m_excludes // Exclude files/paths/folders that match the exclude filter + boolean m_fingerprint // Do Jenkins fingerprinting on imported artifacts + boolean m_nested // Import all child artifacts too (identified in the related meta info + boolean m_flatten // Flatten files and folders imported + boolean m_includemetainfilter // Make sure meta is also included in filter + boolean m_clean // Clean import folder before obtaining artifacts + boolean m_appendtoparentmeta // Append to parent meta + String m_sourceselect // Where are the artifacts coming from + + String m_jobname + def m_buildnumberorselector + + String m_repo + String m_revision + + ImportOptions(script, + String sourceselect = 'Jenkins job artifact', + boolean incrementversionnumber = true, + String filter = '', + String excludes = '', + boolean fingerprint = false, + boolean nested = false, + boolean flatten = false, + boolean includemetainfilter = true, + boolean clean = true, + appendtoparentmeta = true) { + m_script = script + m_sourceselect = sourceselect.trim() + m_incrementversionnumber = incrementversionnumber + m_filter = filter.trim() + m_excludes = excludes.trim() + m_fingerprint = fingerprint + m_nested = nested + m_flatten = flatten + m_includemetainfilter = includemetainfilter + m_clean = clean + m_appendtoparentmeta = appendtoparentmeta + } + + void setsourceselect(String sourceselect) { + sourceselect = sourceselect.trim() + switch (sourceselect) { + case 'Jenkins job artefact': + m_sourceselect = 'Jenkins job artifact' + break + case 'Jenkins job artifact': + case 'Release repository': + m_sourceselect = sourceselect + break + default: + error("Unknown type of artifact source select: ${m_sourceselect}") + } + } + + void setincrementversionnumber(boolean incrementversionnumber = true) { + m_incrementversionnumber = incrementversionnumber + } + + void setfilter(String filter) { + m_filter = filter.trim() + } + + void setexcludes(String excludes) { + m_excludes = excludes.trim() + } + + void setfingerprint(boolean fingerprint = true) { + m_fingerprint = fingerprint + } + + void setnested(boolean nested = true) { + m_nested = nested + } + + void flattenimports(boolean flatten = true) { + m_flatten = flatten + } + + void includemetainfilter(boolean includemetainfilter = true) { + m_includemetainfilter = includemetainfilter + } + + void clean(boolean clean = true) { + m_clean = clean + } + + void setappendtoparentmeta(boolean appendtoparentmeta) { + m_appendtoparentmeta = appendtoparentmeta + } + + void jenkinsjob(String jobname, String buildnumberorselector) { + m_jobname = jobname.trim() + m_buildnumberorselector = buildnumberorselector.trim() + setsourceselect('Jenkins job artifact') + } + + void releaserepo(String repo, String revision) { + m_repo = repo.trim() + m_revision = revision.trim() + setsourceselect('Release repository') + } + + void source(String sourceselect, String jobname, String buildnumberorselector, String repo, String revision) { + jenkinsjob(jobname, buildnumberorselector) + releaserepo(repo, revision) + setsourceselect(sourceselect) + } +} + +ImportOptions getNewImportOptions() { + return new ImportOptions(this) +} + +def formFilter(ImportOptions importoptions) { + def String filter = importoptions.m_filter + if (filter != '') { + if (importoptions.m_includemetainfilter) { + filter = 'meta/**,' + filter + } + } + echo "Import options filter is: ${filter}" + return filter +} + +def conditionalClean(ImportOptions importoptions, String destpath) { + if (importoptions.m_clean) { + echo "Cleaning ${destpath}" + dir(destpath) { + deleteDir() + } + } +} + +def artifactimportfrombuildjob(meta, importoptions, String destpath) { + if (importoptions.m_sourceselect != 'Jenkins job artifact') { + error("Import options settings have not been set for: Jenkins job artifact") + return + } + + conditionalClean(importoptions, destpath) + + copyArtifacts( + filter: formFilter(importoptions), + excludes: importoptions.m_excludes, + fingerprintArtifacts: importoptions.m_fingerprint, + projectName: importoptions.m_jobname, + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: importoptions.m_buildnumberorselector + ], + flatten: importoptions.m_flatten, + target: destpath + ) + def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath) + if (importoptions.m_incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } + return importedmeta +} + +def rewritemetafileasreleased(meta, String filepath) { + // Modify the meta info to say that is has already been released + meta.markreleased() + meta.saveJsonSerialised(filepath) +} + +def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { + if (importoptions.m_sourceselect != 'Release repository') { + error("Import options settings have not been set for: Release repository") + return + } + + def rooturl = importoptions.m_repo + def rootrevision = importoptions.m_revision + echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" + + conditionalClean(importoptions, destpath) + + def ArrayList sparseitemlist = gh.convertSparseItemsString(formFilter(importoptions)) + gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) + + def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) + + relatedimportinfo = importedmeta.getassociated() + echo "Cloning associated repos" + for(relatedmetainfo in relatedimportinfo) { + def relatedmeta = relatedmetainfo.meta + def relatedoffsetpath = relatedmetainfo.offsetpath + def cloneurl = relatedmeta.releaseinfo.releaserepoURL + def clonerevision = "refs/tags/${relatedmeta.releasetag()}" + def clonepath = "${destpath}/${relatedoffsetpath}" + echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}" + + gh.gitCheckoutAlt(cloneurl, clonerevision, clonepath, "", 1, true, []) + + gh.stripgithistory(clonepath) + + def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}" + echo "Marking related meta as released and rewriting meta file: ${metafilepath}" + rewritemetafileasreleased(relatedmeta, metafilepath) + } + gh.stripgithistory(destpath) + def metafilepath = "${destpath}/${meta.metafilepath()}" + echo "Marking root meta as released and rewriting meta file: ${metafilepath}" + rewritemetafileasreleased(importedmeta, metafilepath) + + if (importoptions.m_incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } + return importedmeta +} + +def artifactimportfromrepo(meta, importoptions, String destpath) { + if (importoptions.m_sourceselect != 'Release repository') { + error("Import options settings have not been set for: Release repository") + return + } + + conditionalClean(importoptions, destpath) + + def rooturl = importoptions.m_repo + def rootrevision = importoptions.m_revision + echo "Cloning release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" + + def ArrayList sparseitemlist = gh.convertSparseItemsString(formFilter(importoptions)) + gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) + + def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) + + gh.stripgithistory(destpath) + def metafilepath = "${destpath}/${meta.metafilepath()}" + echo "Marking meta as released and rewriting meta file: ${metafilepath}" + rewritemetafileasreleased(importedmeta, metafilepath) + + if (importoptions.m_incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } + return importedmeta +} + +def artifactimport(meta, importoptions, String destpath) { + switch (importoptions.m_sourceselect) { + case 'Jenkins job artifact': + case 'Jenkins job artefact': + return artifactimportfrombuildjob(meta, importoptions, destpath) + case 'Release repository': + if (importoptions.m_nested) { + return hierarchyartifactimportfromrepo(meta, importoptions, destpath) + } + return artifactimportfromrepo(meta, importoptions, destpath) + default: + error("Unknown type of artifact source: ${source}") + } + return meta +} + +// Deprecated (use above) +def artifactimport(meta, + String sourceselect, + String jenkinsjob, + buildnumberorselector, + String repo, + String revision, + String destpath, + boolean incrementversionnumber = true, + String filter = '', + String excludes = '', + boolean fingerprint = false, + boolean nested = false) { + echo "DEPRECATED method: artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath ...)" + def importoptions = getNewImportOptions() + + importoptions.source(sourceselect, jenkinsjob, buildnumberorselector, repo, revision) + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(filter) + importoptions.setexcludes(excludes) + importoptions.setfingerprint(fingerprint) + importoptions.setnested(nested) + + return artifactimport(meta, importoptions, destpath) +} + +// Deprecated (use above) +def artifactimport(meta, + String buildjob, + int buildnumber, + String destpath, + boolean incrementversionnumber = true, + String filter = '**', + String excludes = '', + boolean fingerprint = false) { + echo "DEPRECATED method: artifactimport(meta, String buildjob, int buildnumber, String destpath, ...)" + def importoptions = getNewImportOptions() + + importoptions.jenkinsjob(buildjob, " ${buildnumber}") + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(filter) + importoptions.setexcludes(excludes) + importoptions.setfingerprint(fingerprint) + + return artifactimport(meta, importoptions, destpath) +} + +// Deprecated (use above) +def artifactimport(meta, + String buildjob, + buildnumberorselector, + String destpath, + boolean incrementversionnumber = true, + String filter = '', + String excludes = '', + boolean fingerprint = false) { + echo "DEPRECATED method: artifactimport(meta, String buildjob, buildnumberorselector, String destpath, ...)" + def importoptions = getNewImportOptions() + + importoptions.jenkinsjob(buildjob, buildnumberorselector) + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(filter) + importoptions.setexcludes(excludes) + importoptions.setfingerprint(fingerprint) + + return artifactimport(meta, importoptions, destpath) +} + +return this; diff --git a/Common_scripts/install/installhelper.groovy b/Common_scripts/install/installhelper.groovy new file mode 100644 index 0000000..96a8b2e --- /dev/null +++ b/Common_scripts/install/installhelper.groovy @@ -0,0 +1,117 @@ +import hudson.FilePath + +// Transfer file from intermediate position to final position; +// creating necessary folders on the way; +// deleting intermediate file +def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, String finalFilename) { + def channel = Jenkins.getInstance().getComputer(env['NODE_NAME']).getChannel() + + def String abs_exports_root_path = "${WORKSPACE}/${finalBaseFolder}" + def String abs_export_out = "${abs_exports_root_path}/${finalFilename}" + def export_filepath = new hudson.FilePath(channel, abs_export_out) + def export_out_folder = export_filepath.getParent() + def export_out_folder_string = export_out_folder.toString() + def export_out_file = export_filepath.getName() + + echo "Creating folder ${export_out_folder_string}" + export_out_folder.mkdirs() + + echo "Copying from ${pathToIntermediate} to ${abs_export_out}" + def intermediate_filepath = new hudson.FilePath(channel, pathToIntermediate) + intermediate_filepath.copyTo(export_filepath) + intermediate_filepath.delete() +} + +// Given details about artifacts to import and details of installers to build, import artifacts that are required +def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) { + artifactFetched = [:] + + def importoptions = importer.getNewImportOptions() + for (installer in toBuild) { + def artifactKeys = installerDetails.get(installer)[1] + if (artifactKeys instanceof java.lang.String) { + artifactKeys = [ artifactKeys ] + } + for (artifactKey in artifactKeys) { + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + if (artifactFetched.get(artifactKey) == null) { + importoptions.jenkinsjob(sourceProject, sourceselector) + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(toCopy) + importoptions.setexcludes(notToCopy) + + def importmeta = importer.artifactimport(meta, importoptions, destFolder) + artifactFetched.put(artifactKey, importmeta) + } + } + } + return artifactFetched +} + +@NonCPS +def checkISMfilebackend(String xml) { + def String message = "" + + def parsedxml = new XmlParser(true, true, true).parseText(xml) + def pathvariableinfo = [:] + def exitcode = 0 + // Load up a map of path variable and path pairs + // Ignore blank path definitions + // Ignore the workspace definition which should have the only absolute path + parsedxml.each{ table -> + if (table.@name == "ISPathVariable") { + table['row'].each{ row -> + def pathname = row['td'][0].value()[0] + def path = row['td'][1].value()[0] + if (path && pathname != 'WORKSPACE') { + pathvariableinfo[pathname] = path + } + } + } + } + // Check that each path variable is defined beginning with a path variable or the WORKSPACE one + pathvariableinfo.each{ pair -> + message += "pair key: ${pair.key} value: ${pair.value}\n" + def path = pair.value + def pathvarmatcher = path =~ /<(.*)>.*/ + if (pathvarmatcher.matches()) { + def pathvarfound = pathvarmatcher.group(1) + if (pathvarfound != 'WORKSPACE') { + if (!pathvariableinfo.containsKey(pathvarfound)) { + message += "Undefined path variable ${pathvarfound} found\n" + exitcode = 1 + } + } + } else { + message += "Path: ${path} does not begin with a path variable\n" + exitcode = 1 + } + } + return [exitcode, message] +} + +def checkISMfile(String ISMfile) { + echo "Checking ISM file: ${ISMfile}" + def xml = readFile(ISMfile) + (exitcode, message) = checkISMfilebackend(xml) + echo message + if (exitcode > 0) { + error "ISM file errors found" + } else { + echo "Checked ISM file - ok" + } +} + +certificatethumbprints = [:] +certificatethumbprints['floreana'] = '0FDEB0A227982C877146CA595091173AC9655479' // Authoring takes place on this machine - so this is what should be in the ISM file already +certificatethumbprints['hawaii'] = '49FD1B361CFF35014B81940C5B046543045DD34B' + +def selectSigningCertificate(String nodeName, String ISMfile) { + def masterpattern = '0FDEB0A227982C877146CA595091173AC9655479' + echo "Substituting occurrences of ${masterpattern} with ${certificatethumbprints[nodeName]} in ISM file: ${ISMfile}" + + textutils_subst = load("${autobuilder.commonscripts()}/textutils/subst.groovy") + textutils_subst.substitute(ISMfile, masterpattern, certificatethumbprints[nodeName]) +} + +return this; diff --git a/Common_scripts/meta/folder.groovy b/Common_scripts/meta/folder.groovy new file mode 100644 index 0000000..aac8b6c --- /dev/null +++ b/Common_scripts/meta/folder.groovy @@ -0,0 +1,772 @@ +import java.nio.file.Paths +import java.nio.file.Path +import groovy.json.JsonSlurperClassic + +abstract class GISJsonSerialised implements Serializable { + def script + + GISJsonSerialised(script) { + this.script = script + } + + abstract LinkedHashMap serialisationdata() + + abstract void deserialiseJson(rawmeta) + + def saveJsonSerialised(String outputfile, int prettylevel = 4) { + def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) + script.writeJSON(file: outputfile, json: outJson, pretty: prettylevel) + } +} + +class ProductInfo extends GISJsonSerialised { + String productname + String subcomponentname + + ProductInfo(script, productname = "", subcomponentname = "") { + super(script) + this.productname = productname + this.subcomponentname = subcomponentname + } + + void set(String productname, String subcomponentname) { + // Make sure the fields can be used in git tags + def int pstatus = 0 + if (script.isUnix()) { + pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) + } + else { + pstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true) + } + if (pstatus > 0) { + script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name") + } + def int sstatus = 0 + if (script.isUnix()) { + sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true) + } + else { + sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true) + } + if (sstatus > 0) { + script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name") + } + this.productname = productname + this.subcomponentname = subcomponentname + } + + void deserialiseJson(rawmeta) { + productname = rawmeta['productname'] + subcomponentname = rawmeta['subcomponentname'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'productname' : productname, + 'subcomponentname' : subcomponentname, + ] + return data + } +} + +class GitInfo extends GISJsonSerialised { + private String sourcepath + private String sourcerevision + private String gitrevision + private String remoteurl + private String remoteinfo + + GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") { + super(script) + this.sourcepath = sourcepath + this.sourcerevision = sourcerevision + this.gitrevision = gitrevision + this.remoteurl = remoteurl + this.remoteinfo = remoteinfo + } + + void set(String sourcepath, String sourcerevision, String gitrevision, String remoteurl, String remoteinfo) { + this.sourcepath = sourcepath + this.sourcerevision = sourcerevision + this.gitrevision = gitrevision + this.remoteurl = remoteurl + this.remoteinfo = remoteinfo + } + + void deserialiseJson(rawmeta) { + sourcepath = rawmeta['sourcepath'] + sourcerevision = rawmeta['sourcerevision'] + gitrevision = rawmeta['gitrevision'] + remoteurl = rawmeta['remoteurl'] + remoteinfo = rawmeta['remoteinfo'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'sourcepath' : sourcepath, + 'sourcerevision' : sourcerevision, + 'gitrevision' : gitrevision, + 'remoteurl' : remoteurl, + 'remoteinfo' : remoteinfo, + ] + return data + } +} + +class JenkinsBuildInfo extends GISJsonSerialised { + String buildjobname + int buildnumber + private String buildmachine + private String builddate + + JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "") { + super(script) + this.buildjobname = buildjobname + this.buildnumber = buildnumber + this.buildmachine = buildmachine + this.builddate = builddate + } + + void set(String buildjobname, int buildnumber, String buildmachine, String builddate) { + this.buildjobname = buildjobname + this.buildnumber = buildnumber + this.buildmachine = buildmachine + this.builddate = builddate + } + + void deserialiseJson(rawmeta) { + buildjobname = rawmeta['buildjobname'] + buildnumber = rawmeta['buildnumber'] + buildmachine = rawmeta['buildmachine'] + builddate = rawmeta['builddate'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'buildjobname' : buildjobname, + 'buildnumber' : buildnumber, + 'buildmachine' : buildmachine, + 'builddate' : builddate, + ] + return data + } +} + +class BuildStampInfo extends GISJsonSerialised { + String buildstampprefix + int revision + String buildstamp + + BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { + super(script) + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + } + + void set(String buildstampprefix, int revision, String buildstamp) { + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + } + + String buildstampcommasep() { + def String buildstampcommasep = buildstamp.replace(".", ",") + return buildstampcommasep + } + + void changerevision(int newrevision) { + script.echo("Build stamp currently ${buildstamp}") + revision = newrevision + def List buildstampsplit = buildstamp.split('\\.') + buildstampsplit[-1] = newrevision.toString() + buildstamp = buildstampsplit.join('.') + script.echo("Build stamp now ${buildstamp}") + } + + void set(String buildstampprefix, int revision) { + buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.' + this.buildstampprefix = buildstampprefix + this.buildstamp = buildstampprefix + "0" + changerevision(revision) + } + + void set(String buildstampprefix, String revision = '0') { + set(buildstampprefix, revision.toInteger()) + } + + void deserialiseJson(rawmeta) { + buildstampprefix = rawmeta['buildstampprefix'] + revision = rawmeta['revision'] + buildstamp = rawmeta['buildstamp'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'buildstampprefix' : buildstampprefix, + 'revision' : revision, + 'buildstamp' : buildstamp, + ] + return data + } +} + +class ReleaseInfo extends GISJsonSerialised { + String releaserepoURL + ArrayList releaseitems + boolean released + + ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { + super(script) + this.releaserepoURL = releaserepoURL + this.releaseitems = new ArrayList() + this.released = released + } + + void set(String releaserepoURL = "") { + this.releaserepoURL = releaserepoURL + } + + void addReleaseItem(String releaseitem) { + script.echo("Adding release item: ${releaseitem} to release items") + releaseitems.add(releaseitem) + } + + void markreleased() { + this.released = true + } + + List releaseitemssserialised() { + def items = [] + for (ri in releaseitems) { + items.add(ri) + } + return items + } + + void deserialiseJson(rawmeta) { + releaserepoURL = rawmeta['releaserepoURL'] + releaseitems = new ArrayList() + for (rawreleaseitem in rawmeta['releaseitems']) { + releaseitems.add(rawreleaseitem) + } + released = rawmeta['released'] ?: false + } + + LinkedHashMap serialisationdata() { + def data = [ + 'releaserepoURL' : releaserepoURL, + 'releaseitems' : releaseitemssserialised(), + 'released' : released + ] + return data + } +} + +class ConfigurationInfo extends GISJsonSerialised { + private String configurationname + private String configurationURL + private String configurationversion + private String configurationSHA + + ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") { + super(script) + this.configurationname = configurationname + this.configurationURL = configurationURL + this.configurationversion = configurationversion + this.configurationSHA = configurationSHA + } + + void deserialiseJson(rawmeta) { + configurationname = rawmeta['configurationname'] + configurationURL = rawmeta['configurationURL'] + configurationversion = rawmeta['configurationversion'] + configurationSHA = rawmeta['configurationSHA'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'configurationname' : configurationname, + 'configurationURL' : configurationURL, + 'configurationversion' : configurationversion, + 'configurationSHA' : configurationSHA, + ] + return data + } +} + +class ChecksumPair extends GISJsonSerialised { + private String filepath + private String sum + + ChecksumPair(script, String filepath = "", String sum = "") { + super(script) + this.filepath = filepath + this.sum = sum + } + + void deserialiseJson(rawmeta) { + filepath = rawmeta['filepath'] + sum = rawmeta['sum'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'filepath' : filepath, + 'sum' : sum, + ] + return data + } +} + +class ChecksumSet extends GISJsonSerialised { + private String artifactpath + private ArrayList checksumpairs + + ChecksumSet(script, artifactpath = "") { + super(script) + this.artifactpath = artifactpath + checksumpairs = new ArrayList() + } + + ChecksumPair addChecksumPair(String filepath, String sum) { + def cp = new ChecksumPair(script, filepath, sum) + checksumpairs.add(cp) + return cp + } + + List checksumpairsserialised() { + def associated = [] + for (cp in checksumpairs) { + associated.add(cp.serialisationdata()) + } + return associated + } + + void deserialiseJson(rawmeta) { + artifactpath = rawmeta['artifactpath'] + checksumpairs = new ArrayList() + for (rawchecksumpair in rawmeta['checksumpairs']) { + def csp = new ChecksumPair(script) + csp.deserialiseJson(rawchecksumpair) + checksumpairs.add(csp) + } + } + + LinkedHashMap serialisationdata() { + def data = [ + 'artifactpath' : artifactpath, + 'checksumpairs' : checksumpairsserialised(), + ] + return data + } +} + +class ChecksumInfo extends GISJsonSerialised { + private ArrayList checksumsets + + ChecksumInfo(script) { + super(script) + checksumsets = new ArrayList() + } + + ChecksumSet addChecksumSet(String artifactpath) { + def cs = new ChecksumSet(script, artifactpath) + checksumsets.add(cs) + return cs + } + + List checksumsetsserialised() { + def associated = [] + for (cs in checksumsets) { + associated.add(cs.serialisationdata()) + } + return associated + } + + void deserialiseJson(rawmeta) { + checksumsets = new ArrayList() + for (rawchecksumset in rawmeta['checksumsets']) { + def cs = new ChecksumSet(script) + cs.deserialiseJson(rawchecksumset) + checksumsets.add(cs) + } + } + + LinkedHashMap serialisationdata() { + def data = [ + 'checksumsets' : checksumsetsserialised(), + ] + return data + } +} + +class PublishableInfo extends GISJsonSerialised { + private String filepath + + PublishableInfo(script, String filepath = "") { + super(script) + this.filepath = filepath + } + + void deserialiseJson(rawmeta) { + filepath = rawmeta['filepath'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'filepath' : filepath, + ] + return data + } +} + +class MetaInfo extends GISJsonSerialised { + private static String FORMAT = "0.1" + private static String METAFOLDERNAME = "meta" + private static String METAFILENAME = "info.json" + private static String METAARTIFACTS = "${METAFOLDERNAME}/**" + + class RelatedMetaInfo extends GISJsonSerialised { + String offsetpath + MetaInfo meta + + RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) { + super(script) + this.offsetpath = offsetpath + this.meta = meta + } + + void deserialiseJson(rawmeta) { + offsetpath = rawmeta['offsetpath'] + meta = new MetaInfo(script) + meta.deserialiseJson(rawmeta['meta']) + } + + LinkedHashMap serialisationdata() { + def data = [ + 'offsetpath' : offsetpath, + 'meta' : meta.serialisationdata(), + ] + return data + } + } + + private String format = FORMAT + ProductInfo productinfo + GitInfo gitinfo + JenkinsBuildInfo jenkinsbuildinfo + BuildStampInfo buildstampinfo + ReleaseInfo releaseinfo + ChecksumInfo checksuminfo + private ArrayList configurationinfo + private ArrayList publishableinfo + private LinkedHashMap custominfo + private ArrayList associatedmeta + + MetaInfo(script) { + super(script) + productinfo = new ProductInfo(script) + gitinfo = new GitInfo(script) + jenkinsbuildinfo = new JenkinsBuildInfo(script) + buildstampinfo = new BuildStampInfo(script) + releaseinfo = new ReleaseInfo(script) + checksuminfo = new ChecksumInfo(script) + configurationinfo = new ArrayList() + publishableinfo = new ArrayList() + custominfo = new LinkedHashMap() + associatedmeta = new ArrayList() + } + + List getassociated() { + return associatedmeta + } + + void markreleased() { + script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") + releaseinfo.markreleased() + for (associated in associatedmeta) { + associated.meta.releaseinfo.markreleased() + } + } + + List configurationinfoserialised() { + def configuration = [] + for (configurationitem in configurationinfo) { + configuration.add(configurationitem.serialisationdata()) + } + return configuration + } + + void addPublishable(String filepath) { + def PublishableInfo pi = new PublishableInfo(script, filepath) + script.echo("Adding ${filepath} to publishable list") + publishableinfo.add(pi) + } + + void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { + def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) + script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}") + configurationinfo.add(ci) + } + + void addCustomInfo(String customId, String customValue) { + custominfo.put(customId.trim(), customValue) + } + + String getCustomInfo(String customId) { + return custominfo.getAt(customId.trim()) + } + + List publishableinfoserialised() { + def publishable = [] + for (publishableitem in publishableinfo) { + publishable.add(publishableitem.serialisationdata()) + } + return publishable + } + + List associatedmetaserialised() { + def associated = [] + for (metaitem in associatedmeta) { + associated.add(metaitem.serialisationdata()) + } + return associated + } + + void deserialiseJson(rawmeta) { + if (rawmeta['format'] != FORMAT) { + script.error("Unsupported meta format found at ${filepath}") + return + } + productinfo.deserialiseJson(rawmeta['productinfo']) + gitinfo.deserialiseJson(rawmeta['gitinfo']) + jenkinsbuildinfo.deserialiseJson(rawmeta['jenkinsbuildinfo']) + buildstampinfo.deserialiseJson(rawmeta['buildstampinfo']) + releaseinfo.deserialiseJson(rawmeta['releaseinfo']) + checksuminfo.deserialiseJson(rawmeta['checksuminfo']) + for (rawconfig in rawmeta['configuration']) { + def cf = new ConfigurationInfo(script) + cf.deserialiseJson(rawconfig) + configurationinfo.add(cf) + } + for (rawpublishable in rawmeta['publishableinfo']) { + def pb = new PublishableInfo(script) + pb.deserialiseJson(rawpublishable) + publishableinfo.add(pb) + } + custominfo = rawmeta['custominfo'] + for (rawrelatedmeta in rawmeta['associatedmeta']) { + def rm = new RelatedMetaInfo(script) + rm.deserialiseJson(rawrelatedmeta) + associatedmeta.add(rm) + } + } + + def deserialiseJson(String filepath) { + script.echo("Deserialising JSON at file: ${filepath}") + def rawmeta = script.readJSON(file: filepath) + deserialiseJson(rawmeta) + } + + def deserialiseJsonSlurper(String filepath) { + File jsonfile = new File(filepath) + def jsonfiletext = jsonfile.getText() + def rawmeta = new JsonSlurperClassic().parseText(jsonfiletext) + deserialiseJson(rawmeta) + } + + String relativize(String mypath) { + String pathRelative + script.echo("Seeing if ${mypath} begins with ${script.WORKSPACE}") + if (mypath.startsWith(script.WORKSPACE)) { + pathRelative = mypath.minus(script.WORKSPACE) + script.echo("Extracted ${pathRelative} from ${script.WORKSPACE} and ${mypath}") + } else { + pathRelative = mypath + script.echo("Path relative is unchanged: ${pathRelative}") + } + // Convert \ with / + pathRelative = pathRelative.tokenize('\\').join('/') + // Strip leading / if any + pathRelative = pathRelative.replaceAll('^/+', '') + + script.echo("Path relative is ${pathRelative}") + + return pathRelative + } + + static String metafilepath() { + return METAFOLDERNAME + "/" + METAFILENAME + } + + MetaInfo importrelated(boolean appendtoparentmeta, String destpath, String givenRepo = 'Unknown', String givenRevision = 'Unknown', String givenSHA = 'Unknown') { + MetaInfo mi = new MetaInfo(script) + + def String adjustedpath = relativize(destpath) + def importedmetafile = adjustedpath + "/" + metafilepath() + if (script.fileExists(importedmetafile)) { + mi.deserialiseJson(importedmetafile) + } else { + script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist") + mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA) + } + + RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) + if (appendtoparentmeta) { + associatedmeta.add(rmi) + } + + return mi + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'productinfo' : productinfo.serialisationdata(), + 'gitinfo' : gitinfo.serialisationdata(), + 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), + 'buildstampinfo' : buildstampinfo.serialisationdata(), + 'releaseinfo' : releaseinfo.serialisationdata(), + 'configuration' : configurationinfoserialised(), + 'checksuminfo' : checksuminfo.serialisationdata(), + 'publishableinfo' : publishableinfoserialised(), + 'custominfo' : custominfo, + 'associatedmeta' : associatedmetaserialised(), + ] + return data + } + + static String folder() { + return METAFOLDERNAME + } + + String generateartifacts(ArrayList releasedfromhere = new ArrayList(), // These items are recorded in meta as released from here + ArrayList releasedfromsubmeta = new ArrayList(), // These items are not recorded in meta as released from here + String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}" + ) { + def String artifactlist = METAARTIFACTS + releaseinfo.addReleaseItem(METAARTIFACTS) + for (releaseitem in releasedfromhere) { + artifactlist += "," + releaseitem + releaseinfo.addReleaseItem(releaseitem) + } + for (releaseitem in releasedfromsubmeta) { + artifactlist += "," + releaseitem + } + saveJsonSerialised(metafilepath) + return artifactlist + } + + // Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java + private ArrayList releasewalkerp(int maxdepth, ArrayList releasemetacollection, String pathsofar) { + if (maxdepth > 0) { + if (releaseinfo.releaserepoURL) { + RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) + releasemetacollection.add(rmi) + } + if (pathsofar) { + pathsofar += "/" + } + for (relatedmetainfo in associatedmeta) { + MetaInfo othermeta = relatedmetainfo.meta + String newpathsofar = pathsofar + relatedmetainfo.offsetpath + releasemetacollection = othermeta.releasewalkerp(maxdepth - 1, releasemetacollection, newpathsofar) + } + } + return releasemetacollection + } + + ArrayList releasewalker(int maxdepth, String startpath = "") { + ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) + return releasemetacollection + } + + String componentidentifier() { + return productinfo.productname + "_" + productinfo.subcomponentname + } + + String componentversionuniqueidentifier() { + return componentidentifier() + "_" + buildstampinfo.buildstamp + } + + String globalreleasetag() { + return componentversionuniqueidentifier() + "_" + jenkinsbuildinfo.buildnumber + } + + String releasetag() { + 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] + if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) { + releasemetacollection.put(uniquestring, relatedmetainfo) + } + } else { + releasemetacollection.put(uniquestring, relatedmetainfo) + } + return releasemetacollection + } + + Map releasewalkerunique(int maxdepth, String startpath = "") { + def ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) + + def Map releasemetauniquecollection = new LinkedHashMap() + for (relatedmetainfo in releasemetacollection) { + def String uniquestring = relatedmetainfo.meta.componentidentifier() + releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo) + } + + return releasemetauniquecollection + } + + Map releasewalkerversionunique(int maxdepth, String startpath = "") { + ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) + + def Map releasemetaversionuniquecollection = new LinkedHashMap() + for (relatedmetainfo in releasemetacollection) { + def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier() + releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo) + } + + return releasemetaversionuniquecollection + } + + MetaInfo getNewMetaObject(script) { + return new MetaInfo(script) + } +} + +MetaInfo metareset(script) { + echo "Resetting meta folder" + def mi = new MetaInfo(script) + + dir(mi.folder()) { + deleteDir() + } + + return mi +} + +MetaInfo metafromfolder(String folder = "") { + MetaInfo buildmeta = new MetaInfo(this) + buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") + return buildmeta +} + +MetaInfo metafromfolderSlurper(String folder = "") { + MetaInfo buildmeta = new MetaInfo(this) + buildmeta.deserialiseJsonSlurper("${folder}/${MetaInfo.metafilepath()}") + return buildmeta +} + +return this; diff --git a/Common_scripts/packaging/debian.groovy b/Common_scripts/packaging/debian.groovy new file mode 100644 index 0000000..2ef1ba8 --- /dev/null +++ b/Common_scripts/packaging/debian.groovy @@ -0,0 +1,106 @@ +class DebRootDefinition { + String ROOTPATH + String PACKAGE_PREFIX + String PACKAGE_FOLDER_NAME + String PACKAGE_NAME + String UNIQUE_PACKAGE_NAME + + String PACKAGE_SOURCE_ROOT + String PACKAGE_SOURCE_FOLDER_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_SCRIPTS_CONTROL + 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 + + 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}" + + 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_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" + 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" + } +} + +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) { + try { + sh """#!/bin/bash + # Exit if any command fails + set -xe + + echo "${password}" | sudo -S echo + + 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}" + + mkdir -v -p "${packageout}" + 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:" + 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}" + """ + } + catch (Exception e) { + echo "Exception occurred" + sh """#!/bin/bash -v + echo "${password}" | sudo -S echo + + sudo chown -R ${USER}: "${packagedefs.DEBPATH}" + + exit 1 + """ + } +} + +return this; \ No newline at end of file diff --git a/Common_scripts/platform/lineendings.groovy b/Common_scripts/platform/lineendings.groovy new file mode 100644 index 0000000..9657b0d --- /dev/null +++ b/Common_scripts/platform/lineendings.groovy @@ -0,0 +1,5 @@ + +// Put ${nl} into strings when wanting a newline +nl = System.properties['line.separator'] + +return this; diff --git a/Common_scripts/publish/.classpath b/Common_scripts/publish/.classpath new file mode 100644 index 0000000..287c1ab --- /dev/null +++ b/Common_scripts/publish/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Common_scripts/publish/.gitignore b/Common_scripts/publish/.gitignore new file mode 100644 index 0000000..abed335 --- /dev/null +++ b/Common_scripts/publish/.gitignore @@ -0,0 +1,7 @@ +/do$_publish_closure4.class +/do$_resetfolders_closure1.class +/do$_resetfolders_closure2.class +/do$_resetfolders_closure3.class +/do$_stripgithistory_closure5.class +/do.class +/publish_item_select.class diff --git a/Common_scripts/publish/.project b/Common_scripts/publish/.project new file mode 100644 index 0000000..5c60328 --- /dev/null +++ b/Common_scripts/publish/.project @@ -0,0 +1,18 @@ + + + publish_item_select + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.groovy.core.groovyNature + org.eclipse.jdt.core.javanature + + diff --git a/Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs b/Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs new file mode 100644 index 0000000..1e68ed6 --- /dev/null +++ b/Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +groovy.compiler.level=25 +groovy.script.filters=**/*.dsld,y,**/*.gradle,n diff --git a/Common_scripts/publish/do.groovy b/Common_scripts/publish/do.groovy new file mode 100644 index 0000000..1b227f4 --- /dev/null +++ b/Common_scripts/publish/do.groovy @@ -0,0 +1,174 @@ +import groovy.io.FileType + +markunstable = false +unstablereason = "" + +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" +releaserepofolder = "${WORKSPACE}/releaserepos" +filteredreleaserepofolder = "${WORKSPACE}/filteredreleaserepos" + +def resetfolders() { + dir(summaryfolder) { + deleteDir() + } + dir(releaserepofolder) { + deleteDir() + } + dir(filteredreleaserepofolder) { + deleteDir() + } +} + +def productuniquefolder(releasemeta) { + return "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" +} + +def uniquereleasefolder(String productline, String softwarerelease, releasemeta) { + return "Software/${productline} ${softwarerelease}/${productuniquefolder(releasemeta)}" +} + +def uniqueabsoluterreleasefolder(String productline, String releaserepofolder, String softwarerelease, releasemeta) { + return "${releaserepofolder}/${uniquereleasefolder(productline, softwarerelease, releasemeta)}" +} + +def preconditions() { + markunstable = false + unstablereason = "" + summarystring = "" + writeFile(file: summaryfile, text: "Publish summary: \n") +} + +def setunstable(String reason) { + markunstable = true + unstablereason = reason +} + +def summaryappend(String summary) { + def String currentsummarycontents = readFile(file: summaryfile) + writeFile(file: summaryfile, text: currentsummarycontents + summary) + summarystring += summary +} + +def guessreporootsuffix(componentURL) { + def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') + return guess +} + +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") +def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { + summaryappend("Artifacts: ") + + def releasemeta = releaseinfo.meta + def String componentURL = releasemeta.releaseinfo.releaserepoURL + def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}" + def publishableitems = releasemeta.publishableinfo + + def ArrayList publishablepaths = new ArrayList() + if (publishableitems.size() > 0) { + for (publishableitem in publishableitems) { + def String productuniquepublishableitem = "${productuniquefolder(releasemeta)}/${publishableitem.filepath}" + echo "publishableitem: ${productuniquepublishableitem}" + if (itempathstopublish.size() == 0 || productuniquepublishableitem in itempathstopublish) { + publishablepaths.add(publishableitem.filepath) + summaryappend("${publishableitem.filepath},") + } + } + } + if (publishablepaths.size() > 0) { + def reporootsuffix = guessreporootsuffix(componentURL) + gh.gitCheckoutAlt(componentURL, revision, repofolder, reporootsuffix, 1, true, publishablepaths) // Shallow clone + } + else { + summaryappend("None ") + } +} + +def publish(hostedftpsiteinfo, String customer, String finalreleaserepofolder = releaserepofolder) { + summaryappend(" FTP operations: ") + + def String ftproot = "${hostedftpsiteinfo.workingdirectory}${customer}" + dir(finalreleaserepofolder) { + summaryappend("FTP operations: Transferring to ${ftproot}") + sh """#!/bin/bash + ncftpput -u ${hostedftpsiteinfo.username} -p ${hostedftpsiteinfo.password} -R ${hostedftpsiteinfo.url} "${ftproot}" . + """ + summaryappend(", Transferred ") + } +} + +def copydirectory(File dirFrom, File dirTo) { + if (!dirTo.exists()) { + dirTo.mkdirs(); + } + dirFrom.eachFile(FileType.FILES) { File source -> + File target = new File(dirTo, source.getName()) + target.bytes = source.bytes + } + dirFrom.eachFile(FileType.DIRECTORIES) { File source -> + File target = new File(dirTo, source.getName()) + copyLargeDir(source, target) + } +} + +def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) { + def releasemeta = releaseinfo.meta + def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta) + + summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") + + getcomponentartifacts(releaseinfo, uniquefolderforrepo, itempathstopublish) + + summaryappend("\n") +} + +def convertitemstopublish(String itemstopublishstring) { + def List paths = [] + + def String[] items = itemstopublishstring.split(',') + def String allpaths = "" + for(String item : items) { + def String[] pathitems = item.split('#') + def String path = "${pathitems[0]}_${pathitems[1]}/${pathitems[2]}" + paths.add(path) + allpaths += "${path}\n" + } + echo "Selected item to publish:\n${allpaths}" + return paths +} + +// 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(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { + int md = maxdepth.toInteger() + 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) + + echo "Version unique components:" + def String versionuniquecomponent = "" + for (key in componentReleaseInfoVersionUnique.keySet()) { + versionuniquecomponent += "${key}\n" + } + echo versionuniquecomponent + + def itempathstopublish = convertitemstopublish(itemstopublishstring) + for (key in componentReleaseInfoVersionUnique.keySet()) { + def releaseinfo = componentReleaseInfoVersionUnique[key] + recallcomponent(productline, releaseinfo, softwarerelease, itempathstopublish) + } + gh.stripgithistory(releaserepofolder) + publish(hostedftpsiteinfo, customer) + + return [summarystring, markunstable, unstablereason] +} + +def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) { + return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth) +} + +return this; diff --git a/Common_scripts/publish/package.groovy b/Common_scripts/publish/package.groovy new file mode 100644 index 0000000..3bd9565 --- /dev/null +++ b/Common_scripts/publish/package.groovy @@ -0,0 +1,176 @@ +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 { + 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" + } + } + } + stage('Aptly environment') { + steps { + script { + echo "Aptly config file is ${APTLY_CONFIG_FILE}" + sh """#!/bin/bash -v + 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 -v + 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 + """ + } + } + } + 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}" "${PUBLISH_PATH_PREFIX}" + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + + stage('Add/update package in repo') { + steps { + script { + echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}" + sh """#!/bin/bash -v + 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 + """ + } + } + } + stage('Create snapshot') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${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}" + // Convert prefix to regular expression + PACKAGE_VERSION_PREFIX_SPLIT = PACKAGE_VERSION_PREFIX.split("[.]") + PACKAGE_VERSION_REGEX = '' + i = 0 + while(true) { + if (i == PACKAGE_VERSION_PREFIX_SPLIT.size() - 1) { + PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] + break; + } + PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] + PACKAGE_VERSION_REGEX += '\\.' + i++ + } + 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}" 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 filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_REGEX}.*)' + 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 + """ + } + } + } + stage('Publish snapshot') { + 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}" "${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}" "${PUBLISH_PATH_PREFIX}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + diff --git a/Common_scripts/publish/promptingpublish.groovy b/Common_scripts/publish/promptingpublish.groovy new file mode 100644 index 0000000..4af0d62 --- /dev/null +++ b/Common_scripts/publish/promptingpublish.groovy @@ -0,0 +1,179 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.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() + 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}" + } + } + } + } + stage('Identify software release to publish') { + steps { + script { + gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + def allreleases = gh.gettaglist(SOURCEDIR) + def releases = new ArrayList() + if (FILTER_REDUNDANT_RELEASES == 'false') { + echo("Showing all releases") + releases = allreleases + } else { + echo("Showing filtered releases") + for (release in allreleases) { + if (!release.toLowerCase().startsWith("superceded") && + !release.toLowerCase().startsWith("erroneous") && + !release.toLowerCase().startsWith("faulty") && + !release.toLowerCase().startsWith("ignore") && + !release.toLowerCase().startsWith("inmainline")) { + echo("Showing release: ${release}") + releases.add(release) + } else { + echo("Not showing release: ${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}" + } + } + } + } + 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 info') { + steps { + script { + def mfs = autobuilderscript.getmetafolderscript() + releasemeta = mfs.metafromfolder(SOURCEDIR) + } + } + } + stage('Select which items from software release to publish') { + steps { + script { + publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") + timeout(time: 10, unit: 'MINUTES') { + def itemsobject = publishitems.createItemSelector( + 'Select software items', + 'Software items', + releasemeta, + ITEMSDEFAULTLIST, + MAX_META_DEPTH, + '20', + 'PT_MULTI_SELECT') + selecteditems = input( + message: 'Select which items from the release are to be published', + ok: 'Ok', + parameters: [ + itemsobject.multiSelect() + ] + ) + echo "Chosen items are: ${selecteditems}" + } + } + } + } + stage('Publish components') { + steps { + script { + def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") + 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' + } + } + } + } + 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/Common_scripts/publish/publish.groovy b/Common_scripts/publish/publish.groovy new file mode 100644 index 0000000..7beb134 --- /dev/null +++ b/Common_scripts/publish/publish.groovy @@ -0,0 +1,91 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + 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 = "refs/tags/${SOFTWARE_RELEASE}" + SOURCEDIR = "${WORKSPACE}/whole" + SOURCEROOTDIR = 'whole' + configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 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") + 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' + } + } + } + } + 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/Common_scripts/publish/publishitems.groovy b/Common_scripts/publish/publishitems.groovy new file mode 100644 index 0000000..677970e --- /dev/null +++ b/Common_scripts/publish/publishitems.groovy @@ -0,0 +1,127 @@ +import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition + +class PublishableItemsSelection { + def script + def ArrayList preselectedmenuitems + def ArrayList menuitemdescriptions + def ArrayList menuitemsfull + def ExtendedChoiceParameterDefinition multiselect + + PublishableItemsSelection(script) { + this.script = script + preselectedmenuitems = new ArrayList() + menuitemdescriptions = new ArrayList() + menuitemsfull = new ArrayList() + } + + def init( + String name, + String description, + releasemeta, + String preselectedext, + String metalevelsstringext, + String visibleItemCountExt, + String controltype) { + 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] + outputDescription(menuitemdescriptions, releaseinfo) + 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 = Math.min(visibleItemCount, menuitemsfull.size()) + script.echo("visibleItemCount is now: ${visibleItemCount}") + + multiselect = new ExtendedChoiceParameterDefinition( + name, // String name + controltype, // String type + menuitemsfull.join(seperator), // String value + "project name", // String projectName + "", // String propertyFile + "", // String groovyScript + "", // String groovyScriptFile + "", // String bindings + "", // String groovyClasspath + "", // String propertyKey + preselectedmenuitems.join(seperator),// String defaultValue + "", // String defaultPropertyFile + "", // String defaultGroovyScript + "", // String defaultGroovyScriptFile + "", // String defaultBindings + "", // String defaultGroovyClasspath + "", // String defaultPropertyKey + menuitemdescriptions.join(seperator),// String descriptionPropertyValue + "", // String descriptionPropertyFile + "", // String descriptionGroovyScript + "", // String descriptionGroovyScriptFile + "", // String descriptionBindings + "", // String descriptionGroovyClasspath + "", // String descriptionPropertyKey + "", // String javascriptFile + "", // String javascript + false, // boolean saveJSONParameterToFile + false, // boolean quoteValue + visibleItemCount, // int visibleItemCount + description, // String description + seperator) // 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 outputDescription(menuitems, releaseinfo) { + def meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + } + } + + def outputSelection(menuitems, releaseinfo) { + def meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") + } + } + + def multiSelect() { + return multiselect + } +} + +PublishableItemsSelection createItemSelector( + String name, + String description, + releasemeta, + String preselectedext, + String metalevelsstringext, + String visibleItemCountExt = '20', + String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT" + PublishableItemsSelection pis = new PublishableItemsSelection(this) + + pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type) + + return pis +} + +return this; diff --git a/Common_scripts/publishing/utils.groovy b/Common_scripts/publishing/utils.groovy new file mode 100644 index 0000000..2daf6f6 --- /dev/null +++ b/Common_scripts/publishing/utils.groovy @@ -0,0 +1,27 @@ + + +// The filepath must end in "/**" or "/" - Glob wildcard - as a git sparse checkout +def allowed(String filepath) { + if (filepath.endsWith('/**') || filepath.endsWith('/')) { + def files = findFiles glob: filepath + if (files.length > 0) { + return + } else { + error "There are no files/folders under the publishable item: ${filepath}" + } + } + error "The publishable item: ${filepath} does not end in /** or / (for git sparse checkouts)" +} + +// Generate a list of artifact files that are publishable to outside parties +def generatelist(meta, publishable) { + filelist = [] + for (filepath in publishable) { + if (filepath != meta.METAARTIFACTS) { + allowed(filepath) + } + meta.addPublishable(filepath) + } +} + +return this; diff --git a/Common_scripts/release/do.groovy b/Common_scripts/release/do.groovy new file mode 100644 index 0000000..3221d25 --- /dev/null +++ b/Common_scripts/release/do.groovy @@ -0,0 +1,439 @@ +markunstable = false +unstablereason = "" + +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" +repoandtagsfile = "${summaryfolder}/repoandtags.txt" +repoandtagsstring = "" +releaserepofolder = "${WORKSPACE}/releaserepos" +sourcerepofolder = "${WORKSPACE}/sourcerepos" +tempfolder = "${WORKSPACE}/temp" +gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" + +metascript = autobuilder.getmetafolderscript() + +def resetfolders() { + dir(summaryfolder) { + deleteDir() + } + dir(releaserepofolder) { + deleteDir() + } + dir(tempfolder) { + deleteDir() + } +} + +def preconditions() { + markunstable = false + unstablereason = "" + summarystring = "" + writeFile(file: summaryfile, text: "Release summary: \n") + repoandtagsstring = "" + writeFile(file: repoandtagsfile, text: "Repository summary: \n") +} + +def setunstable(String reason) { + markunstable = true + unstablereason += reason + "\n" + echo "Marked build as unstable: Reason: ${reason}" +} + +def summaryappend(String summary) { + def String currentsummarycontents = readFile(file: summaryfile) + writeFile(file: summaryfile, text: currentsummarycontents + summary) + summarystring += summary +} + +def repoandtagsappend(String summary) { + def String repoandtagscontents = readFile(file: repoandtagsfile) + writeFile(file: repoandtagsfile, text: repoandtagscontents + summary) + repoandtagsstring += summary +} + +def getpreviousreleasemeta(buildmeta, String checkoutfolder) { + def previousreleasemeta = buildmeta.getNewMetaObject(this) + // See if there is meta data file from the current release + def String releasemetafolderpath = "${checkoutfolder}/${buildmeta.folder()}" + if (fileExists(releasemetafolderpath)) { + previousreleasemeta = metascript.metafromfolder(checkoutfolder) + } + return previousreleasemeta +} + +def checkoutreleaserepo(buildmeta, String checkoutfolder) { + def String releaserepo = buildmeta.releaseinfo.releaserepoURL + // Get the latest head revision of the release repo without checking out working copy; Check out to a folder unique to component; Extract any meta + repoandtagsappend(" Release repo: ${releaserepo}") + def previousreleasemeta = buildmeta.getNewMetaObject(this) + dir(releaserepofolder) { + sh("git clone ${releaserepo} ${checkoutfolder}") + } + previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + dir(checkoutfolder) { + // Clear all existing files - Note that this does not remove .git* + sh("git rm -r *") + } + return previousreleasemeta +} + +def checkoutsourcerepo(buildmeta, String checkoutfolder) { + def String sourcerepo = buildmeta.gitinfo.remoteurl + if (sourcerepo) { + repoandtagsappend(" Source repo: ${sourcerepo}") + // Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component + if (fileExists(checkoutfolder)) { + dir(checkoutfolder) { + sh(""" + git reset --hard + git clean -fdx + git pull + # Remove all tags that are not already on the remote + git tag -l | xargs git tag -d >/dev/null + git fetch -t >/dev/null + """ + ) + } + } + else { + dir(sourcerepofolder) { + sh("git clone ${sourcerepo} ${checkoutfolder}") + } + } + } else { + repoandtagsappend(" Source repo: None") + } +} + +def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { + // Copy relevant artifacts to temp folder + summaryappend("Artifacts: ") + def boolean result = true + for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { + def filterpath = artifactfilter + if (buildinfo.offsetpath) { + filterpath = buildinfo.offsetpath + '/' + artifactfilter + } + // Copy relevant artifacts to temp folder + echo "Copying artifacts: ${filterpath} to ${tempfolder}" + try { + copyArtifacts( + filter: filterpath, + projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname, + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" + ], + target: tempfolder + ) + } catch (Exception e) { + echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" + result = false + summaryappend("Does not exist:") + } + if (result) { + // Move relevant artifacts from temp folder to release position + def originalrootdir = tempfolder + "/" + buildinfo.offsetpath + dir(originalrootdir) { + sh("mv * ${repofolder}") + } + } + summaryappend("${artifactfilter},") + } + return result +} + +def releasegitadd() { + // Add anything new + sh("git add .") + summaryappend("Add,") +} + +def releasegitreset() { + // Add anything new + sh("git reset --hard") + sh("git clean -fdx") + summaryappend("Reset,") +} + +def releasegitcommit(String buildstamp) { + sh("git commit -a -m ${buildstamp}") + summaryappend("Commit,") +} + +// Determine if there has been a change by comparing the sha code in previous release meta and the build meta +def boolean checkforchange(buildmeta, previousreleasemeta) { + String buildsha = buildmeta.gitinfo.gitrevision + String previoussha = previousreleasemeta.gitinfo.gitrevision + + def boolean shachanged = (buildsha != previoussha) + echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${shachanged}" + + String buildstamp = buildmeta.buildstampinfo.buildstamp + String previousbuildstamp = previousreleasemeta.buildstampinfo.buildstamp + + def boolean buildstampchanged = (buildstamp != previousbuildstamp) + echo "buildstamp: ${buildstamp} previousbuildstamp: ${previousbuildstamp} changed: ${buildstampchanged}" + + def boolean changed = (shachanged | buildstampchanged) + echo "changed: ${changed}" + + return changed +} + +def ArrayList maketaglist(buildmeta, String buildstamp, String otherreleasetags) { + def ArrayList taglist = new ArrayList() + taglist.add(buildstamp) + + def ArrayList othertaglist = otherreleasetags.split(',') + for (othertagitem in othertaglist) { + if (othertagitem?.trim()) { + def componentothertagitem = "${othertagitem.trim()}_${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" + taglist.add(componentothertagitem) + } + } + return taglist +} + +def String releasegitgetshacode(String tag) { + def existingshacode = "" + // Check if tag exists already + def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" >\"${gitrevparseoutputfile}\" 2>/dev/null", returnStatus: true) + if (gitrevparsestatus == 0) { // Tag exists + existingshacode = readFile(file: gitrevparseoutputfile).trim() + } + return existingshacode +} + +def boolean releasegittag(String postcommitshacode, String tag) { + def boolean tagadded = false + // Check if tag exists already + def String existingshacode = releasegitgetshacode(tag) + if (existingshacode) { // Tag exists + if (existingshacode != postcommitshacode) { // If the existing tag is not associated with the one expected + // This is a problem - The tag is already at another position in git repo + setunstable("The release tag ${tag} has been used at another commit other than one expected - You must decide what to do with it - Not good practice to delete it or move it (Existing sha code: ${existingshacode} Post commit sha code: ${postcommitshacode})") + summaryappend("(${tag} - Could not add!)") + } else { + summaryappend("(${tag} - Already added)") + } + } else { // If tag does not exist already + // Tag + sh("git tag \"${tag}\"") + summaryappend("(${tag})") + tagadded = true + } + return tagadded +} + +def boolean releasegittags(String postcommitshacode, ArrayList taglist) { + boolean tagadded = false + + summaryappend("Rel Tag ") + for (tag in taglist) { + if (releasegittag(postcommitshacode, tag)) { + tagadded = true + } + } + return tagadded +} + +def boolean sourcegittag(String shacode, String tag) { + def boolean tagadded = false + // Check if tag exists already + def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" >\"${gitrevparseoutputfile}\" 2>/dev/null", returnStatus: true) + if (gitrevparsestatus == 0) { // Tag exists + def existingshacode = readFile(file: gitrevparseoutputfile).trim() + if (existingshacode != shacode) { // If the existing tag is not associated with HEAD + // This is a problem - The tag is already at another position in git repo + setunstable("The source tag ${tag} has been used at another commit (${existingshacode}) - You must decide what to do with it - Not good practice to delete it or move it (Existing sha code: ${existingshacode} Post commit sha code: ${shacode})") + summaryappend("(${tag} - Could not add!)") + } + else { + summaryappend("(${tag} - Already added)") + } + } + else { // If tag does not exist already + // Tag + sh("git tag \"${tag}\" ${shacode}") + summaryappend("(${tag})") + tagadded = true + } + return tagadded +} + +def sourcegittags(String buildsha, List taglist) { + boolean tagadded = false + + summaryappend(",Src Tag ") + for (tag in taglist) { + if (sourcegittag(buildsha, tag)) { + tagadded = true + } + } + return tagadded +} + +def releasegitpush(String dryrunpush ) { + sh("git remote -v") + if (dryrunpush == "true") { + sh("git push -n --tags origin master") + summaryappend(",Dry-Run-Push") + setunstable("The artifact(s) have not been pushed/saved (\"Dry run push\" parameter/option is selected)") + } + else { + sh("git push --tags origin master") + summaryappend(",Push") + } +} + +def sourcegitpush(String dryrunpush ) { + sh("git remote -v") + if (dryrunpush == "true") { + sh("git push -n --tags") + summaryappend(",Src-Dry-Run-Push") + setunstable("The source tag(s) have not been pushed/saved (\"Dry run push\" parameter/option is selected)") + } + else { + sh("git push --tags") + summaryappend(",Src Push") + } +} + +def boolean isalreadyreleased(buildmeta, tag) { + def boolean alreadyreleased = buildmeta.releaseinfo.released + if (alreadyreleased) { + echo "Component is already marked as released: ${alreadyreleased}" + } else { + String commitshacode = releasegitgetshacode(tag) + if (commitshacode) { + echo "Tag: ${tag} already exists in this repo therefore marking as already released" + alreadyreleased = true + } else { + alreadyreleased = false + } + } + return alreadyreleased +} + +def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String sourcerepo, String otherreleasetags, String dryrunpush) { + summaryappend(" Git operations: ") + def String buildstamptag = buildmeta.releasetag() + + dir(releaserepo) { + def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Pre commit sha code: ${precommitshacode}" + + def boolean alreadyreleased = isalreadyreleased(buildmeta, buildstamptag) + + def String postcommitshacode + def boolean changed = false + if (alreadyreleased) { + summaryappend("Already-released,") + postcommitshacode = releasegitgetshacode(buildstamptag) + echo "Previous release sha code: ${postcommitshacode}" + } else { + releasegitadd() + + changed = checkforchange(buildmeta, previousreleasemeta) + if (changed) { + releasegitcommit(buildstamptag) + } else { + releasegitreset() + summaryappend("No-commit,") + } + + postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Post commit sha code: ${postcommitshacode}" + } + + ArrayList taglist = maketaglist(buildmeta, buildstamptag, otherreleasetags) + def tagadded = releasegittags(postcommitshacode, taglist) + + if (changed || tagadded) { + releasegitpush(dryrunpush) + } + } + dir(sourcerepo) { + def String srcbuildstamptag = buildmeta.globalreleasetag() + def String buildsha = buildmeta.gitinfo.gitrevision + + if (buildsha) { + def ArrayList srctaglist = maketaglist(buildmeta, srcbuildstamptag, otherreleasetags) + def tagadded = sourcegittags(buildsha, srctaglist) + if (tagadded) { + sourcegitpush(dryrunpush) + } + } else { + summaryappend(",No Src ") + } + } +} + +def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) { + def buildmeta = buildinfo.meta + def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" + def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" + def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" + def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" + + summaryappend("${buildmeta.productinfo.productname} ${buildmeta.productinfo.subcomponentname}: ") + repoandtagsappend("${buildmeta.productinfo.productname} ${buildmeta.productinfo.subcomponentname}: ") + def previousreleasemeta = checkoutreleaserepo(buildmeta, uniquefolderforrepo) + + checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo) + + if (getcomponentartifacts(toplevelbuildmeta, buildinfo, uniquefolderforrepo, uniquefoldertemp)) { + gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) + } + + summaryappend("\n") + repoandtagsappend("\n") +} + +def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) { + def int md = maxdepth.toInteger() + resetfolders() + preconditions() + + // Walk the meta information to a max depth, looking for components to release + def componentReleaseInfo = buildmeta.releasewalkerunique(md) + echo "Unique components:" + def String versioncomponent = "" + for (key in componentReleaseInfo.keySet()) { + versioncomponent += "${key}\n" + } + echo versioncomponent + + // Walk the meta information to a max depth, looking for components to release + def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md) + echo "Version unique components:" + def String versionuniquecomponent = "" + for (key in componentReleaseInfoVersionUnique.keySet()) { + versionuniquecomponent += "${key}\n" + } + echo versionuniquecomponent + + if (DO_INTEGRITY_CHECK == "true") { + if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) { + error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct?" + } + } + + def toplevelid = buildmeta.componentidentifier() + // For each component + for (key in componentReleaseInfo.keySet()) { + def buildinfo = componentReleaseInfo[key] + if (toplevelid != key) { + releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) + } + } + // Do the top level last + def toplevelbuildinfo = componentReleaseInfo[toplevelid] + releasecomponent(buildmeta, toplevelbuildinfo, otherreleasetags, dryrunpush) + + return [summarystring, markunstable, unstablereason] +} + +return this; diff --git a/Common_scripts/release/registerrepo.groovy b/Common_scripts/release/registerrepo.groovy new file mode 100644 index 0000000..f565706 --- /dev/null +++ b/Common_scripts/release/registerrepo.groovy @@ -0,0 +1,12 @@ + +vc = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + +// Prove the existence of the release repo - otherwise there is a large wait to cycle the build to correct the meta data +def registerrepo(meta, String releaserepo) { + if (releaserepo?.trim()) { + vc.checkRepoExists(releaserepo) + } + meta.releaseinfo.set(releaserepo) +} + +return this; diff --git a/Common_scripts/release/release.groovy b/Common_scripts/release/release.groovy new file mode 100644 index 0000000..e51a174 --- /dev/null +++ b/Common_scripts/release/release.groovy @@ -0,0 +1,88 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + stage('Clean exports') { + steps { + script { + cleanfolders = [ + "${WORKSPACE}/build_artifacts", + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Get build artifact meta') { + steps { + script { + BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts" + copyArtifacts( + filter: 'meta/**', + projectName: BUILD_JOB, + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: BUILD_JOB_SELECTOR + ], + target: BUILD_ARTIFACTS + ) + def mfs = autobuilderscript.getmetafolderscript() + buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS) + } + } + } + stage('Release components') { + steps { + script { + def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") + // Place the top level build stamp on all + OTHER_RELEASE_TAGS = "${buildmeta.globalreleasetag()},${OTHER_RELEASE_TAGS}" + (summarystring, markunstable, unstablereason) = releaser.releasehierarchy(buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH) + 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/Common_scripts/remoteaccess/ftp.groovy b/Common_scripts/remoteaccess/ftp.groovy new file mode 100644 index 0000000..25b9143 --- /dev/null +++ b/Common_scripts/remoteaccess/ftp.groovy @@ -0,0 +1,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) { + 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() + ftpclient.connect(ftpsiteinfo.url) + ftpclient.enterLocalPassiveMode() + ftpclient.login(ftpsiteinfo.username, ftpsiteinfo.password) + ftpclient.changeWorkingDirectory(ftpsiteinfo.workingdirectory) + + return ftpclient +} + +return this; diff --git a/Common_scripts/remoteaccess/hostedftp.groovy b/Common_scripts/remoteaccess/hostedftp.groovy new file mode 100644 index 0000000..cf62d32 --- /dev/null +++ b/Common_scripts/remoteaccess/hostedftp.groovy @@ -0,0 +1,28 @@ +ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") + +def getHostedFTPSiteInfo() { + 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() + + def ftpsiteinfo = getHostedFTPSiteInfo() + def 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/Common_scripts/staticanalysis/ccm.groovy b/Common_scripts/staticanalysis/ccm.groovy new file mode 100644 index 0000000..f0e5b80 --- /dev/null +++ b/Common_scripts/staticanalysis/ccm.groovy @@ -0,0 +1,119 @@ +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) + } + } + } + stage('Static analysis') { + steps { + script { + def CCMOLDER = "${STATICANALYSIS}/ccm" + dir(CCMOLDER) { + echo "Executing: ${CCM} ${SRC} /xml /nummetrics=100 > ccm.xml" + if (isUnix()) { + sh """#!/bin/bash + find "${SRC}" -type f ! -name "*.cpp" -a ! -name "*.h" -a ! -name "*.hpp" -a ! -name "*.c" -exec rm -r {} \\; + # Uses mono + "${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml + """ + } else { + 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/Common_scripts/staticanalysis/cpd.groovy b/Common_scripts/staticanalysis/cpd.groovy new file mode 100644 index 0000000..6f3a33f --- /dev/null +++ b/Common_scripts/staticanalysis/cpd.groovy @@ -0,0 +1,151 @@ +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}" + SRC = "${SOURCE_PATH}" + if (SOURCE_OFFSET_PATH) { + SRC += "/${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) + } + } + } + stage('Static analysis') { + steps { + script { + def PPDFOLDER = "${STATICANALYSIS}/ppd" + def EXCLUDE_PARAM = '' + if (EXCLUDE_PATHS) { + EXCLUDE_PARAM = '--exclude "' + def exclude_path_list = EXCLUDE_PATHS.split(',') + for (exclude_path in exclude_path_list) { + EXCLUDE_PARAM += "${SRC}/${exclude_path.trim()}," + } + EXCLUDE_PARAM += '"' + } + if (isUnix()) { + sh """#!/bin/bash + set -ev + + mkdir -p "${PPDFOLDER}" + export PMD_JAVA_OPTS=-Xmx65536m + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/cpd.xml" + """ + } else { + bat """ + mkdir -p "${PPDFOLDER}" + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/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/Common_scripts/staticanalysis/cppcheck.groovy b/Common_scripts/staticanalysis/cppcheck.groovy new file mode 100644 index 0000000..bdc6a2a --- /dev/null +++ b/Common_scripts/staticanalysis/cppcheck.groovy @@ -0,0 +1,113 @@ +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) + } + } + } + stage('Static analysis') { + steps { + script { + def CPPCHECKFOLDER = "${STATICANALYSIS}/cppcheck" + dir(CPPCHECKFOLDER) { + echo "Executing: ${CPPCHECK} --xml --xml-version=2 ${SRC} 2> cppcheck.xml" + if (isUnix()) { + sh """#!/bin/bash + set -e + + "${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml + """ + } else { + 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' + } + } +} diff --git a/Common_scripts/textutils/subst.groovy b/Common_scripts/textutils/subst.groovy new file mode 100644 index 0000000..c0207a3 --- /dev/null +++ b/Common_scripts/textutils/subst.groovy @@ -0,0 +1,8 @@ + +def substitute(String filepath, pattern, String subst) { + fileText = readFile(file: filepath, encoding: 'UTF-8') + def converted = fileText.replaceAll(pattern, subst) + writeFile(file: filepath, text: converted, encoding: 'UTF-8') +} + +return this; \ No newline at end of file diff --git a/Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig b/Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig new file mode 100644 index 0000000..ea618a3 --- /dev/null +++ b/Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig @@ -0,0 +1,25 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedDesktop", + "Microsoft.VisualStudio.Workload.NativeDesktop", + "Microsoft.VisualStudio.Workload.NetWeb", + "Microsoft.VisualStudio.Workload.NetCoreTools", + "microsoft.net.componentgroup.targetingpacks.common", + "microsoft.componentgroup.blend", + "microsoft.visualstudio.component.entityframework", + "microsoft.visualstudio.component.debugger.justintime", + "microsoft.visualstudio.component.wcf.tooling", + "microsoft.visualstudio.component.vc.diagnostictools", + "microsoft.visualstudio.component.vc.cmake.project", + "microsoft.visualstudio.component.vc.testadapterforboosttest", + "microsoft.visualstudio.component.vc.testadapterforgoogletest", + "microsoft.visualstudio.component.vc.atlmfc", + "microsoft.visualstudio.component.appinsights.tools", + "microsoft.visualstudio.component.diagnostictools", + "microsoft.visualstudio.componentgroup.web.cloudtools", + "microsoft.visualstudio.component.aspnet45", + "microsoft.visualstudio.component.webdeploy", + "microsoft.visualstudio.component.nuget.buildtools" + ] +} \ No newline at end of file diff --git a/Common_scripts/versioncontrol/git.groovy b/Common_scripts/versioncontrol/git.groovy new file mode 100644 index 0000000..f5b2ebd --- /dev/null +++ b/Common_scripts/versioncontrol/git.groovy @@ -0,0 +1,376 @@ +import hudson.plugins.git.* +import hudson.plugins.git.extensions.* +import hudson.plugins.git.extensions.impl.* + +clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") + +def boolean isShallowClonedRepo(String gitrootpath) { + def boolean isshallowclone = true + + dir( gitrootpath) { + if (isUnix()) { + isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() + } + else { + isshallowclone = bat(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() + } + echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" + } + return isshallowclone +} + +String getGitInfo(String workingSetRootPath) { + dir(workingSetRootPath) { + return clh.getCommandOutput('git rev-parse HEAD') + } +} + +ArrayList gettaglist(String workingSetRootPath) { + ArrayList taglist = new ArrayList() + dir(workingSetRootPath) { + def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') + taglist = tagliststring.split('\\n') + } + return taglist +} + +@NonCPS +def ArrayList sparsecheckoutconfig(ArrayList paths) { + ArrayList sparsecheckoutpaths = new ArrayList() + for (path in paths) { + sparsecheckoutpaths.add(new SparseCheckoutPath(path)) + } + return sparsecheckoutpaths +} + +def String uniquereporootname(String gitURL) { + def uniquename = gitURL.replaceAll("[^A-Za-z0-9]", "_") + echo "Unique reporoot name for URL: ${gitURL} is: ${uniquename}" + return uniquename +} + +// The REPO_ROOT is a folder where a cache of git checkouts can be kept - each subfolder name is unique to a particular git repo +def String checkouttoreporoot(String gitURL) { + def String reporootsubfolder + def String reporootenv = env.REPO_ROOT + if (!reporootenv) { + reporootsubfolder = "" + echo "To improve Git performance: Define the REPO_ROOT enviroment to a path where a cache of git repositories can be placed on this slave" + } else { + def reporootname = uniquereporootname(gitURL) + reporootsubfolder = "${reporootenv}/${reporootname}" + + if (!fileExists(reporootsubfolder)) { + echo "Checking out ${gitURL} to ${reporootsubfolder}" + checkout([ + $class: 'GitSCM', + userRemoteConfigs: [ + [url: gitURL] + ], + branches: [ + [name: 'origin/master'] + ], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'GitLFSPull'], + [$class: 'CleanBeforeCheckout'], + [$class: 'CheckoutOption', timeout: 180], + [$class: 'RelativeTargetDirectory', relativeTargetDir: reporootsubfolder], + ], + submoduleCfg: [], + ]) + } else { + echo "Found ${gitURL} checked out at ${reporootsubfolder}" +/* + dir(reporootsubfolder) { + if (isUnix()) { + sh """ + git status + if [ \$? -ne 0 ]; then exit 1; fi + """ + } else { + bat """ + git status + if errorlevel 1 EXIT /b 1 + """ + } + } +*/ + } + } + return reporootsubfolder +} + +def checkgitlfsinstall() { + if (isUnix()) { + sh """ + git lfs install + if [ \$? -ne 0 ]; then exit 1; fi + """ + + } else { + bat """ + git lfs install + if errorlevel 1 EXIT /b 1 + """ + } +} + +//No credentials specified +//Cloning the remote Git repository +//Cloning repository git@hydra:print-server-releases/print_server_whole.git +//> git init /home/jenkins_user/jenkins/jobs/Print_Server_publish_to_customer/ws/whole # timeout=10 +//Using reference repository: /home/jenkins_user/reporoot/git_hydra_print_server_releases_print_server_whole_git +//Fetching upstream changes from git@hydra:print-server-releases/print_server_whole.git +// > git --version # timeout=10 +// > git fetch --tags --progress git@hydra:print-server-releases/print_server_whole.git +refs/heads/*:refs/remotes/origin/* # timeout=120 +// > git config remote.origin.url git@hydra:print-server-releases/print_server_whole.git # timeout=10 +// > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 +// > git config remote.origin.url git@hydra:print-server-releases/print_server_whole.git # timeout=10 +// Cleaning workspace +// > git rev-parse --verify HEAD # timeout=10 +// No valid HEAD. Skipping the resetting +// > git clean -fdx # timeout=10 +// Fetching upstream changes from git@hydra:print-server-releases/print_server_whole.git +// > git fetch --tags --progress git@hydra:print-server-releases/print_server_whole.git +refs/heads/*:refs/remotes/origin/* # timeout=120 +// > git rev-parse refs/tags/2.10180.7389.21125_7^{commit} # timeout=10 +// > git rev-parse refs/remotes/origin/refs/tags/2.10180.7389.21125_7^{commit} # timeout=10 +// Checking out Revision 64cac35e9a7603c060135f61f91b3f809bbdf160 (refs/tags/2.10180.7389.21125_7) +// Enabling Git LFS pull +// > git config core.sparsecheckout # timeout=10 +// > git checkout -f 64cac35e9a7603c060135f61f91b3f809bbdf160 # timeout=120 +// > git config --get remote.origin.url # timeout=10 +// > git lfs pull origin # timeout=120 +// Commit message: "2.10180.7389.21125_7" +// > git rev-list --no-walk 64cac35e9a7603c060135f61f91b3f809bbdf160 # timeout=10 + + +// > git rev-parse --is-inside-work-tree # timeout=10 +// Fetching changes from the remote Git repository +// > git config remote.origin.url git@hydra:releases/print-server-installer.git # timeout=10 +// Cleaning workspace +// > git rev-parse --verify HEAD # timeout=10 +// Resetting working tree +// > git reset --hard # timeout=10 +// > git clean -fdx # timeout=10 +// Using shallow fetch with depth 1 +// Fetching upstream changes from git@hydra:releases/print-server-installer.git +// > git --version # timeout=10 +// > git fetch --tags --progress git@hydra:releases/print-server-installer.git +refs/heads/*:refs/remotes/origin/* --depth=1 # timeout=120 +// > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 +// > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 +// Checking out Revision d0788d22622862e441c5995a22629846573c39f3 (refs/remotes/origin/master) +// Enabling Git LFS pull +// > git config core.sparsecheckout # timeout=10 +// > git read-tree -mu HEAD # timeout=10 +// > git checkout -f d0788d22622862e441c5995a22629846573c39f3 # timeout=120 +// > git config --get remote.origin.url # timeout=10 +// > git lfs pull origin # timeout=120 +// Commit message: "2.10180.7389.21125_3" +// > git rev-list --no-walk d0788d22622862e441c5995a22629846573c39f3 # timeout=10 + +def String lfsinstallandreporoot(String gitURL) { + checkgitlfsinstall() + return checkouttoreporoot(gitURL) +} + +def showsparseitemlist(ArrayList sparseitemlist = new ArrayList()) { + if (!sparseitemlist.isEmpty()) { + def itemstring = "Items in sparse item list:\n" + for (item in sparseitemlist) { + itemstring += item + "\n" + } + echo itemstring + } +} + +def docheckout(String gitURL, String revision, int cloneDepth, String reporootpath, boolean shallowClone, String targetDir, sparseitemlist) { + checkout([ + $class: 'GitSCM', + userRemoteConfigs: [ + [url: gitURL] + ], + branches: [ + [name: revision] + ], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'GitLFSPull'], + [$class: 'CleanBeforeCheckout'], + [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], + [$class: 'CheckoutOption', timeout: 120], + [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], + [$class: 'SparseCheckoutPaths', sparseCheckoutPaths: sparsecheckoutconfig(sparseitemlist)], + ], + submoduleCfg: [], + ]) +} + +// gitCheckout (below) cannot handle sparse checkout and lfs at the moment - see https://issues.jenkins-ci.org/browse/JENKINS-43427 - see gitCheckoutAlt() +def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + def String reporootpath = lfsinstallandreporoot(gitURL) + showsparseitemlist(sparseitemlist) + docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist) +} + +def gitinit(String targetDir, String reporootpath) { + if (!fileExists("${targetDir}/.git")) { // Git folder does not already exist + echo "git init ${targetDir}" + if (isUnix()) { + sh """ + git init "${targetDir}" + """ + } else { + bat """ + git init "${targetDir}" + """ + } + } + echo "Writing ${reporootpath}/.git/objects to ${targetDir}/.git/objects/info/alternates" + dir("${targetDir}/.git/objects/info") { + writeFile(file: 'alternates', text: "${reporootpath}/.git/objects") + } +} + +def setlfsfetchinclude(String targetDir, ArrayList sparseitemlist) { + def String sparseitemliststring = "" + if (!sparseitemlist.isEmpty()) { + for (item in sparseitemlist) { + sparseitemliststring += "${item}," + } + echo "git config lfs.fetchinclude ${sparseitemliststring}" + dir(targetDir) { + if (isUnix()) { + sh """ + git config lfs.fetchinclude "${sparseitemliststring}" + """ + } else { + bat """ + git config lfs.fetchinclude "${sparseitemliststring}" + """ + } + } + } +} + +def gitsparserestore(String targetDir) { + echo "Clean out full fetch; Force a sparse fetch" + dir(targetDir) { + if (isUnix()) { + sh """ + git rm -rf . > /dev/null + git clean -fxd > /dev/null + git reset --hard > /dev/null + """ + } else { + bat """ + git rm -rf . 2> nul + git clean -fxd 2> nul + git reset --hard 2> nul + """ + } + } + } + +def List convertSparseItemsString(String itemstopublish) { + def List sparsepaths = [] + + boolean nonempty = itemstopublish?.trim() + if (nonempty) { + def String[] items = itemstopublish.trim().split(',') + def String allpaths = "" + for(String item : items) { + sparsepaths.add(item) + allpaths += "${item}\n" + } + echo "Selected item to publish:\n${allpaths}" + } + return sparsepaths +} + +def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + echo "Performing alternative checkout" + def String reporootpath = lfsinstallandreporoot(gitURL) + showsparseitemlist(sparseitemlist) + if (!sparseitemlist.isEmpty()) { + gitinit(targetDir, reporootpath) + setlfsfetchinclude(targetDir, sparseitemlist) + } + docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist) + if (!sparseitemlist.isEmpty()) { + gitsparserestore(targetDir) + } +} + +def checkRepoExists(String gitURL) { + def int result = 0 + if (isUnix()) { + result = sh( script: """ + git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY + """, + returnStatus: true + ) + } else { + result = bat( script: """ + @git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY + """, + returnStatus: true + ) + } + echo "git ls-remote return result: ${result}" + if (result > 0) { + error("The release repo: ${gitURL} cannot be found. Please ensure this exists before building") + } else { + echo "The release repo: ${gitURL} exists" + } +} + +String getSHAFromVersion(String versionFolder) { + dir (versionFolder) { + srcRevision = readFile("gitrevision.txt").trim() + } + return srcRevision +} + +boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { + def keys = versions.keySet() + if (keys.size() < 1) { + return false + } + if (keys.size() == 1) { + return true + } + else { + version = "" + for (key in keys) { + nextversion = versions.get(key) + if (version == "") { + version = nextversion + } + if (nextversion != version) { + return false + } + } + } + return true +} + +def stripgithistory(String rootfolder) { + echo "Stripping git history out of ${rootfolder}" + dir(rootfolder) { + if (isUnix()) { + sh """#!/bin/bash + pwd + find . -type d -name ".git" | xargs -iXX rm -rf XX + find . -name ".gitignore" | xargs -iXX rm -rf XX + find . -name ".gitmodules" | xargs -iXX rm -rf XX + find . -iname ".gitattributes" | xargs -iXX rm -rf XX + find . -iname "*@tmp" | xargs -iXX rm -rf XX + """ + } else { + echo "Not supporting git stripping in Windows at the moment" + } + } +} + +return this diff --git a/Common_scripts/versionnumbering/do.groovy b/Common_scripts/versionnumbering/do.groovy new file mode 100644 index 0000000..666aee3 --- /dev/null +++ b/Common_scripts/versionnumbering/do.groovy @@ -0,0 +1,23 @@ + +def stamp(convertdetails) { + for (convertdetail in convertdetails) { + def filetoconvert = convertdetail[0] + def pattern = convertdetail[1] + def replacement = convertdetail[2] + //echo "Converting any instances of pattern: ${pattern} with replacement: ${replacement} in file: ${filetoconvert}" + def stampscript = "${autobuilder.commonscripts()}/versionstamping/versionstamper.py" + //echo "Using python: ${PYTHON} and script: ${stampscript}" + if (isUnix()) { + sh """ + "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + """ + } + else { + bat """ + "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + """ + } + } +} + +return this; diff --git a/Common_scripts/versionnumbering/generate.groovy b/Common_scripts/versionnumbering/generate.groovy new file mode 100644 index 0000000..71d7bf6 --- /dev/null +++ b/Common_scripts/versionnumbering/generate.groovy @@ -0,0 +1,169 @@ +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + +def int maxversionnumber() { + def int MAXVERSIONNUMBER = 65535 + return MAXVERSIONNUMBER +} + +int incrementrevision(int current, int increment) { + def int newrevision = (current + increment) % (maxversionnumber() + 1) + echo "Current revision: ${current} Increment: ${increment} New revision: ${newrevision}" + return newrevision +} + +def getGitRevision(String gitrootpath, int basebuildnumber) { + def int adjustedchangecount + def String gitrevision + def String remoteinfo + def String remoteurl + + def boolean isShallowCloned = gh.isShallowClonedRepo(gitrootpath) + if (isShallowCloned) { + error("Cannot generate a version number from a shallow cloned repo at ${gitrootpath}") + } + + dir( gitrootpath) { + def int changecount = 0 + if (isUnix()) { + changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger() + } + else { + changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger() + } + echo "Change count: ${changecount}" + def int mvnp1 = maxversionnumber() + 1 + basebuildnumber = (basebuildnumber < 0) ? mvnp1 - (basebuildnumber.abs() % mvnp1) : basebuildnumber + adjustedchangecount = incrementrevision(changecount, basebuildnumber) + echo "Adjusted change count: ${adjustedchangecount}" + if (isUnix()) { + gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() + } + else { + gitrevision = bat(returnStdout: true, script: "@git rev-parse HEAD").trim() + } + echo "Revision: ${gitrevision}" + if (isUnix()) { + remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() + } + else { + remoteinfo = bat(returnStdout: true, script: "@git remote show origin").trim() + } + echo "Remote info: ${remoteinfo}" + if (isUnix()) { + remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() + } + else { + remoteurl = bat(returnStdout: true, script: "@git config --get remote.origin.url").trim() + } + echo "Remote URL: ${remoteurl}" + } + return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] +} + +// Handle: +// origin/master +// origin/2.0.x +def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) { + echo "Determining version number prefix from source branch name: ${sourcebranch}" + sourcebranch = sourcebranch.toLowerCase() + + def defaultversionprefix = "0.30000.0." + def splits = sourcebranch.split('/') + if (splits.size() < 1) { + echo "Source branch name is invalid. Defaulting to: ${defaultversionprefix}" + return defaultversionprefix + } + + def mastertypeversionprefix = "0.20000.0." + sourcebranch = splits.last() + if (sourcebranch.toLowerCase().find("master") != null) { + echo "Source branch name has 'master' in it. Defaulting to: ${mastertypeversionprefix}" + return mastertypeversionprefix + } + + def splits2 = sourcebranch.split('\\.') + if (splits2.size() < 1) { + def thirdpartyversionprefix = "0.25000.0." + echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" + return thirdpartyversionprefix + } + + for (split in splits2) { + if (split == "x") { + echo "Source branch name has '.x' or 'x.' in it. Defaulting to: ${mastertypeversionprefix}" + return mastertypeversionprefix + } + } + + def integerstrings = sourcebranch.findAll(/\d+/) + def integers = [] + for (integerstring in integerstrings) { + int integer = integerstring.toInteger() + integer = integer % (maxversionnumber() + 1) + integers.add(integer) + } + + def versionprefix = "" + if (integers.size() < 1) { + echo "This source branch name has no numbers in its name so defaulting to: ${defaultversionprefix}" + versionprefix = defaultversionprefix + } + else { + def int integernumbercount = 0 + for (integer in integers) { + versionprefix += integer + "." + integernumbercount += 1 + if (integernumbercount > 2) { + break + } + } + if (integernumbercount == 0) { + echo "No leading numbers were found in source branch name so defaulting to: ${defaultversionprefix}" + versionprefix = defaultversionprefix + } + else if (integernumbercount == 1) { + versionprefix += "0.0." + } + else if (integernumbercount == 2) { + versionprefix += "0." + } + } + if (droptrailingdot == true) { + versionprefix = versionprefix.substring(0, versionprefix.length() - 1); + } + echo "Determined version prefix to be: ${versionprefix}" + return versionprefix +} + +String generate(meta, String sourcerevision, String sourcepath, int basebuildnumber = 1000) { + def int gitrevisioncount + def String gitrevision + def String remoteinfo + def String remoteurl + + (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) + + def versionprefix = getVersionPrefix(sourcerevision) + + def buildstamp = versionprefix + gitrevisioncount.toString() + echo "Build stamp is: ${buildstamp}" + + meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) + meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp) + + return buildstamp +} + +String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) { + def int bbn = basebuildnumber.trim().toInteger() + return generate(meta, sourcerevision, sourcepath, bbn) +} + +String copyfrom(meta, othermeta) { + meta.gitinfo = othermeta.gitinfo + meta.buildstampinfo = othermeta.buildstampinfo + + return meta.buildstampinfo.buildstamp +} + +return this; \ No newline at end of file diff --git a/Common_scripts/versionstamping/.project b/Common_scripts/versionstamping/.project new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/Common_scripts/versionstamping/.project @@ -0,0 +1,17 @@ + + + versionstamping + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/Common_scripts/versionstamping/.pydevproject b/Common_scripts/versionstamping/.pydevproject new file mode 100644 index 0000000..746d0f0 --- /dev/null +++ b/Common_scripts/versionstamping/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +python35 + diff --git a/Common_scripts/versionstamping/versionstamper.py b/Common_scripts/versionstamping/versionstamper.py new file mode 100644 index 0000000..441ad06 --- /dev/null +++ b/Common_scripts/versionstamping/versionstamper.py @@ -0,0 +1,38 @@ +import argparse +import sys +import shutil +from builtins import FileNotFoundError + +def main(argv): + parser = argparse.ArgumentParser(description="Look for version number pattern in file and replace with autobuild version number") + + # Call once arguments to allow or disallow something + parser.add_argument('-f', '--filetoconvert', help='The file to convert') + parser.add_argument('-p', '--pattern', default='0.30000.0.0', help='The pattern to search for and replace') + parser.add_argument('-s', '--substitute', help='The new version number that will substitute the pattern') + + args = parser.parse_args(argv) + + filetoconvert = args.filetoconvert + pattern = args.pattern + substitute = args.substitute + + print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert)) + + with open(filetoconvert,'r') as c: + fileread = c.read() + + count = 0 + 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) + print("Confirmed %s instances of %s post-conversion"%(count,substitute)) + f.write(converted) + + if count == 0: + return 1 + return 0 + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/build/build_all.groovy b/build/build_all.groovy new file mode 100644 index 0000000..0792b1d --- /dev/null +++ b/build/build_all.groovy @@ -0,0 +1,326 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = "${SOURCE_REVISION}".trim() + SOURCEROOTDIR = 'atlas_ui' + SOURCEDIR = "${WORKSPACE}/atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, SOURCEROOTDIR, SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCEREVISION, SOURCEDIR, BASEBUILDNUMBER) + } + } + } + stage('Import Print server to adjust version number') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def importoptions = importer.getNewImportOptions() + importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, 'ps_bin') + } + } + } + stage('Import Atlas services to adjust version number') { + steps { + script { + def importoptions = importer.getNewImportOptions() + importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, 'as_bin') + } + } + } + stage('Compile') { + steps { + script { + atlas_compile_job = build job: ATLAS_COMPILE_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), + string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), + string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), + string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), + string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), + string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), + string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), + string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), + string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), + string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('Compile Atlas Ink UI') { + steps { + script { + ink_ui_compile_job = build job: INK_UI_COMPILE_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), + string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), + string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), + string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), + string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), + string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), + string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), + string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), + string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), + string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), + string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), + string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('Second stage') { + failFast true + parallel { + stage('Check localisations') { + steps { + script { + localisation_check_job = build job: ATLAS_LOCALISATION_CHECK_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), + string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('Build Atlas Professional installers') { + steps { + script { + atlas_pro_installer_job = build job: ATLAS_PROFESSIONAL_INSTALLER_BUILD_JOB + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), + string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), + string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), + string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), + string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), + string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), + string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), + string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), + string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), + string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), + string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), + string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + + if(atlas_pro_installer_job.result.equals("UNSTABLE") || atlas_pro_installer_job.result.equals("FAILURE")) + { + currentBuild.result = atlas_pro_installer_job.result + } + } + } + } + stage('Build Atlas SDK installers') { + steps { + script { + atlas_sdk_installer_job = build job: ATLAS_SDK_INSTALLER_BUILD_JOB + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), + string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), + string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), + string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), + string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), + string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), + string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), + string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), + string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), + string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), + string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), + string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + + if(atlas_sdk_installer_job.result.equals("UNSTABLE") || atlas_sdk_installer_job.result.equals("FAILURE")) + { + currentBuild.result = atlas_sdk_installer_job.result + } + } + } + } + stage('Build Ink UI installers') { + steps { + script { + ink_ui_installer_job = build job: INK_UI_INSTALLER_BUILD_JOB + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), + string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), + string(name: 'INK_UI_COMPILE_JOB', value: ink_ui_compile_job.getProjectName()), + string(name: 'INK_UI_COMPILE_BUILD_SELECTOR', value: " ${ink_ui_compile_job.getNumber()}"), + string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), + string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), + string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), + string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), + string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), + string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), + string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), + string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), + string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), + string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + + if(ink_ui_installer_job.result.equals("UNSTABLE") || ink_ui_installer_job.result.equals("FAILURE")) + { + currentBuild.result = ink_ui_installer_job.result + } + } + } + } + stage('Release Documentation') { + steps { + script { + release_notes_job = build job: RELEASE_NOTES_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), + string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), + string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), + string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), + string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), + string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), + string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), + string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), + string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), + string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + } + } + stage('Accumulate artifacts') { + steps { + script { + artifacthelper = load("${autobuilder.commonscripts()}/artifacts/metaexport.groovy") + subJobs = [ + // Sub-job variable, Artifact folder Increment Version Number + [ atlas_compile_job, "atlas_binaries", false, ], + [ ink_ui_compile_job, "ink_ui_binaries", false, ], + [ atlas_pro_installer_job, "atlas_pro_installers", false, ], + [ atlas_sdk_installer_job, "atlas_sdk_installer", false, ], + [ ink_ui_installer_job, "ink_ui_installers", false, ], + [ release_notes_job, "release_notes", false, ], + ] + artifactFolders = artifacthelper.combineSubjobArtifacts(meta, importer, subJobs) + } + } + } + stage('Check installers for consistency') { + steps { + script { + def mfs = autobuilder.getmetafolderscript() + + echo "Checking meta data for version consistency." + + def atlasmeta = mfs.metafromfolder("atlas_binaries") + def atlasrevision = atlasmeta.buildstampinfo.revision + echo "Atlas meta has revision ${atlasrevision}." + + def proinstallmeta = mfs.metafromfolder("atlas_pro_installers") + def proinstallrevision = proinstallmeta.buildstampinfo.revision + echo "Pro installer meta has revision ${proinstallrevision}." + + def sdkinstallmeta = mfs.metafromfolder("atlas_sdk_installer") + def sdkinstallrevision = sdkinstallmeta.buildstampinfo.revision + echo "SDK installer meta has revision ${sdkinstallrevision}." + + def inkinstallmeta = mfs.metafromfolder("ink_ui_installers") + def inkinstallrevision = inkinstallmeta.buildstampinfo.revision + echo "Ink installer meta has revision ${inkinstallrevision}." + + if(atlasrevision != proinstallrevision) { + echo "A git check-in has been made during the pipeline (Atlas compile revision: ${atlasrevision} does not equal Professional Installer revison: ${proinstallrevision}) so marking build UNSTABLE" + currentBuild.result = 'UNSTABLE' + } + + if(atlasrevision != sdkinstallrevision) { + echo "A git check-in has been made during the pipeline (Atlas compile revision: ${atlasrevision} does not equal SDK Installer revison: ${sdkinstallrevision}) so marking build UNSTABLE" + currentBuild.result = 'UNSTABLE' + } + + if(atlasrevision != inkinstallrevision) { + echo "A git check-in has been made during the pipeline (Atlas compile revision: ${atlasrevision} does not equal Ink Installer revison: ${inkinstallrevision}) so marking build UNSTABLE" + currentBuild.result = 'UNSTABLE' + } + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + 'meta/**', + ] + def publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts([], artifactFolders) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/cloning/cloning.groovy b/cloning/cloning.groovy new file mode 100644 index 0000000..36d6fc2 --- /dev/null +++ b/cloning/cloning.groovy @@ -0,0 +1,212 @@ +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" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + stage("Clean exports") { + steps { + script { + cleanfolders = [ + ] + def cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generate new job name prefix') { + steps { + script { + def version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + versionprefix = version.getVersionPrefix("origin/${BRANCH_TO_BUILD}", true) + echo "From revision: ${BRANCH_TO_BUILD} creating prefix: ${versionprefix}" + } + } + } + stage('Clone jobs') { + steps { + script { + def templates = [] + def stringreplace = [] + + def defaultMCSJob = "MCS_master_compile" + def defaultMCSTag = "refs/tags/1.0.1.40053_35" + def defaultPrintServerJob = "Print_Server_master_compile" + def defaultPrintServerTag = "refs/tags/2.0.31.21210_34" + + if (BRANCH_TO_COPY == "3.0.x") { + templates = [ // Build jobs + "Atlas_3.0.x_build", + "Atlas_3.0.x_CCM_analysis", + "Atlas_3.0.x_compile", + "Atlas_3.0.x_documentation_build", + "Atlas_3.0.x_documentation_ink_ui_build", + "Atlas_3.0.x_ink_ui_compile", + "Atlas_3.0.x_ink_ui_installer_build", + "Atlas_3.0.x_ink_ui_resharper_code_analysis", + "Atlas_3.0.x_localisation_check", + "Atlas_3.0.x_professional_installer_build", + "Atlas_3.0.x_release_notes", + "Atlas_3.0.x_resharper_code_analysis", + "Atlas_3.0.x_sdk_installer_build", + "Atlas_3.0.x_sdk_resharper_code_analysis", + "Atlas_3.0.x_static_analysis", + // Test jobs + ] + stringreplace = [ "3.0.x" ] + } + for (gisjobname in templates) { + def job = hudson.model.Hudson.instance.getItem(gisjobname) + def newjobname = gisjobname.replaceAll(BRANCH_TO_COPY, versionprefix) + echo "Creating new job name: ${newjobname} from: ${gisjobname}" + + def alreadyexistingjob = hudson.model.Hudson.instance.getItem(newjobname) + if (!alreadyexistingjob) { + def configXMLFile = job.getConfigFile() + //def file = configXMLFile.getFile() + + def configXMLString = configXMLFile.asString() + echo "XML is: ${configXMLString}" + + echo "Changing instances of: origin/${BRANCH_TO_COPY} with: origin/${BRANCH_TO_BUILD}" + configXMLString = configXMLString.replaceAll("origin/${BRANCH_TO_COPY}", "origin/${BRANCH_TO_BUILD}") + + echo "Changing instances of: ${BRANCH_TO_COPY} with: ${BRANCH_TO_BUILD}" + configXMLString = configXMLString.replaceAll("${BRANCH_TO_COPY}", "${BRANCH_TO_BUILD}") + + echo "Changing instances of: ${defaultMCSJob} with: ${ATLAS_SERVICES_BUILD_JOB}" + configXMLString = configXMLString.replaceAll("${defaultMCSJob}", "${ATLAS_SERVICES_BUILD_JOB}") + + echo "Changing instances of: ${defaultMCSTag} with: ${ATLAS_SERVICES_RELEASE_REVISION}" + configXMLString = configXMLString.replaceAll("${defaultMCSTag}", "${ATLAS_SERVICES_RELEASE_REVISION}") + + echo "Changing instances of: ${defaultPrintServerJob} with: ${PRINT_SERVER_COMPILE_JOB}" + configXMLString = configXMLString.replaceAll("${defaultPrintServerJob}", "${PRINT_SERVER_COMPILE_JOB}") + + echo "Changing instances of: ${defaultPrintServerTag} with: ${PRINT_SERVER_RELEASE_REVISION}" + configXMLString = configXMLString.replaceAll("${defaultPrintServerTag}", "${PRINT_SERVER_RELEASE_REVISION}") + + for (replacement in stringreplace) { + echo "Changing instances of: ${replacement} with: ${versionprefix}" + configXMLString = configXMLString.replaceAll(replacement, versionprefix) + } + + + echo "Edit choice parameters" + //split string on new line + def lines = configXMLString.split('\n') + + //iterate array for param name + for(int i = 0; i < lines.length; i++){ + //if the line is the name of a choice parameter + if(lines[i].contains("ATLAS_SERVICES_ARTIFACT_LOCATION")){ + //set index [i+4] and [i+5] based on build selection + echo "Found ATLAS_SERVICES_ARTIFACT_LOCATION line" + if("${ATLAS_SERVICES_ARTIFACT_LOCATION}" == "Release repository"){ + echo "Set default to release repo" + lines[i+4] = "Release repository" + lines[i+5] = "Jenkins job artifact" + } + else{ + echo "Set default to job artifact" + lines[i+4] = "Jenkins job artifact" + lines[i+5] = "Release repository" + } + } + if(lines[i].contains("PRINT_SERVER_ARTIFACT_LOCATION")){ + //set index [i+4] and [i+5] based on build selection + echo "Found PRINT_SERVER_ARTIFACT_LOCATION line" + if("${PRINT_SERVER_ARTIFACT_LOCATION}" == "Release repository"){ + echo "Set default to release repo" + lines[i+4] = "Release repository" + lines[i+5] = "Jenkins job artifact" + } + else{ + echo "Set default to job artifact" + lines[i+4] = "Jenkins job artifact" + lines[i+5] = "Release repository" + } + } + } + + //rejoin array + configXMLString = lines.join('\n') + + echo "XML is now: ${configXMLString}" + def InputStream is = new ByteArrayInputStream(configXMLString.getBytes()) + + //def InputStream is = new FileInputStream(file) + + echo "Creating new job ${newjobname}" + def newjob = Jenkins.instance.createProjectFromXML(newjobname, is) + newjob.save(); + echo "Created and saved new job ${newjob.getDisplayName()}" + } else { + echo "Job ${alreadyexistingjob.getDisplayName()} already exists" + } + } + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts([]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/compile/compile.groovy b/compile/compile.groovy new file mode 100644 index 0000000..05da1af --- /dev/null +++ b/compile/compile.groovy @@ -0,0 +1,255 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_Atlas" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/build" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + env.PSSOURCE = "${WORKSPACE}/newsw" + cleanfolders = [ + BUILDOUTPUT, + "${WORKSPACE}/SharedPackages", + PSBIN, + ASBIN, + "${WORKSPACE}/bin", + "${WORKSPACE}/binKiosk", + "${WORKSPACE}/documentation", + "${WORKSPACE}/ildasm", + "${WORKSPACE}/Libraries", + "${WORKSPACE}/Atlas Release", + "${WORKSPACE}/LocalisationSDK", + ] + 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('Import Print server to adjust version number') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def psartifactfiles = "meta/**,bin/x64/Release/Engine - Render.dll,bin/x64/Release/Engine - Render.lib,bin/x64/Release/Engine - Render.pdb,bin/x64/Release/TBarCode11_x64.dll,bin/x64/Release/GIS Utility - Toolbox.dll,bin/x64/Release/GIS Utility - Toolbox.lib,bin/x64/Release/GIS Utility - Toolbox.pdb,bin/x64/Release/zlib1.dll,bin/x64/Release/zlib1.lib,bin/x64/Release/zlib1.pdb,bin/x64/Release/GIS Utility - TCP-IP Comms.dll,bin/x64/Release/GIS Utility - TCP-IP Comms.lib,bin/x64/Release/GIS Utility - TCP-IP Comms.pdb,bin/x64/Release/Dialog - Tree Node Editor.dll,bin/x64/Release/Dialog - Tree Node Editor.lib,bin/x64/Release/Dialog - Tree Node Editor.pdb" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) // This should increment the version number + } + } + } + stage('Checkout relevant Print server source') { + steps { + script { + def pssourceartifacts = "src/Engine Common" + def pssourceurl = psmeta.gitinfo.remoteurl + def pscommit = psmeta.gitinfo.gitrevision + + configurationhelper.gitCheckoutAndRegister(meta, 'print_server_source', pssourceurl, pscommit, PSSOURCE, '', 0, false, pssourceartifacts) + } + } + } + stage('Import Atlas services to adjust version number') { + steps { + script { + def asartifactfiles = "meta/**,SharedPackages/**" + asmeta = importer.artifactimport(meta, + ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION, + ASBIN, + true, + asartifactfiles) + } + } + } + stage('Version stamp files') { + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate + env.PS_VERSION="1.0.${psmeta.buildstampinfo.revision}.0" + env.PS_PACKAGE_VERSION=psmeta.buildstampinfo.buildstampprefix + env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp + bat """ + call "${JOBSCRIPTS_COMMON}\\create_ps_nuget.bat" + if errorlevel 1 exit /b 1 + call "${JOBSCRIPTS_COMMON}\\version_atlas_ui_files.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Compile application') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + call "${JOBSCRIPTS}\\autobuild.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Update localisation files') { + steps { + script { + bat """ + call "${JOBSCRIPTS}\\UpdateLocalisationFiles.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Build documentation for installer') { + steps { + script { + bat """ + call "${JOBSCRIPTS}\\documentation_build_for_installers.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Prepare exports') { + steps { + script { + bat """ + move "${SRC}\\bin" . + if errorlevel 1 exit /b 1 + + move "${SRC}\\binKiosk" . + if errorlevel 1 exit /b 1 + + move "${SRC}\\Atlas Release" . + if errorlevel 1 exit /b 1 + + move "${SRC}\\AtlasSDK\\LocalisationSDK" . + if errorlevel 1 exit /b 1 + + move "${SRC}\\documentation" . + if errorlevel 1 exit /b 1 + + move "${SRC}\\ildasm" . + if errorlevel 1 exit /b 1 + + move "${SRC}\\Libraries" . + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues(tools: [ + msBuild(enabledForFailure: true, reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["bin/**","binKiosk/**","documentation/**","ildasm/**","Libraries/**","Atlas Release/**","LocalisationSDK/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/compile/compile_ink_ui.groovy b/compile/compile_ink_ui.groovy new file mode 100644 index 0000000..e1f9894 --- /dev/null +++ b/compile/compile_ink_ui.groovy @@ -0,0 +1,216 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_inksystem_ui" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/build" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + env.AULIB = "${WORKSPACE}/atlaslibraries" + env.TESTRESULTS = "${WORKSPACE}/testresults" + env.PSSOURCE = "${WORKSPACE}/newsw" + cleanfolders = [ + BUILDOUTPUT, + "${WORKSPACE}/SharedPackages", + PSBIN, + ASBIN, + AULIB, + "${WORKSPACE}/binInk", + TESTRESULTS, + ] + 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('Import Atlas UI libraries') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + libmeta = importer.artifactimport(meta, + ATLAS_UI_ARTIFACT_LOCATION, + ATLAS_UI_COMPILE_JOB, + ATLAS_UI_BUILD_SELECTOR, + ATLAS_UI_RELEASE_REPO, + ATLAS_UI_RELEASE_REVISION, + AULIB, + false) + } + } + } + stage('Import Print server to adjust version number') { + steps { + script { + def psartifactfiles = "meta/**" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) // This should increment the version number + } + } + } + stage('Import Atlas services to adjust version number') { + steps { + script { + def asartifactfiles = "meta/**" + asmeta = importer.artifactimport(meta, + ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION, + ASBIN, + true, + asartifactfiles) + } + } + } + stage('Version stamp files') { + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate + env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp + bat """ + call "${JOBSCRIPTS_COMMON}\\version_ink_ui_files.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Compile application') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + call "${JOBSCRIPTS}\\autobuild.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Prepare exports') { + steps { + script { + bat """ + move "${SRC}\\binInk" . + if errorlevel 1 exit /b 1 + + move "${SRC}\\testresults" . + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues(tools: [ + msBuild(enabledForFailure: true, reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["binInk/**","testresults/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/documentation/build_atlas_documentation.groovy b/documentation/build_atlas_documentation.groovy new file mode 100644 index 0000000..7d1f548 --- /dev/null +++ b/documentation/build_atlas_documentation.groovy @@ -0,0 +1,226 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\documentation" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/build" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + env.PSSOURCE = "${WORKSPACE}/newsw" + cleanfolders = [ + BUILDOUTPUT, + "${WORKSPACE}/SharedPackages", + PSBIN, + ASBIN, + "${WORKSPACE}/bin", + "${WORKSPACE}/binKiosk", + "${WORKSPACE}/documentation", + "${WORKSPACE}/Libraries", + "${WORKSPACE}/Atlas Release", + + ] + 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('Import Print server dependencies') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def psartifactfiles = "meta/**,bin/x64/Release/Engine - Render.dll,bin/x64/Release/Engine - Render.lib,bin/x64/Release/Engine - Render.pdb,bin/x64/Release/TBarCode11_x64.dll,bin/x64/Release/GIS Utility - Toolbox.dll,bin/x64/Release/GIS Utility - Toolbox.lib,bin/x64/Release/GIS Utility - Toolbox.pdb,bin/x64/Release/zlib1.dll,bin/x64/Release/zlib1.lib,bin/x64/Release/zlib1.pdb,bin/x64/Release/GIS Utility - TCP-IP Comms.dll,bin/x64/Release/GIS Utility - TCP-IP Comms.lib,bin/x64/Release/GIS Utility - TCP-IP Comms.pdb,bin/x64/Release/Dialog - Tree Node Editor.dll,bin/x64/Release/Dialog - Tree Node Editor.lib,bin/x64/Release/Dialog - Tree Node Editor.pdb" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) + } + } + } + stage('Checkout relevant Print server source') { + steps { + script { + def pssourceartifacts = "src/Engine Common" + def pssourceurl = psmeta.gitinfo.remoteurl + def pscommit = psmeta.gitinfo.gitrevision + + configurationhelper.gitCheckoutAndRegister(meta, 'print_server_source', pssourceurl, pscommit, PSSOURCE, '', 0, false, pssourceartifacts) + } + } + } + stage('Import Atlas services dependencies') { + steps { + script { + def asartifactfiles = "meta/**,SharedPackages/**" + asmeta = importer.artifactimport(meta, + ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION, + ASBIN, + true, + asartifactfiles) + } + } + } + stage('Version files') { + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate + env.PS_VERSION="1.0.${psmeta.buildstampinfo.revision}.0" + env.PS_PACKAGE_VERSION=psmeta.buildstampinfo.buildstampprefix + env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp + bat """ + call "${JOBSCRIPTS_COMMON}\\create_ps_nuget.bat" + if errorlevel 1 exit /b 1 + call "${JOBSCRIPTS_COMMON}\\version_atlas_ui_files.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Compile application') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + call "${JOBSCRIPTS}\\build_atlas.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Build documentation') { + steps { + script { + bat """ + call "${JOBSCRIPTS}\\documentation_build.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Prepare exports') { + steps { + script { + bat """ + move "${SRC}\\documentation" . + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues(tools: [ + msBuild(enabledForFailure: true, reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["documentation/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/documentation/build_ink_ui_documentation.groovy b/documentation/build_ink_ui_documentation.groovy new file mode 100644 index 0000000..8046b71 --- /dev/null +++ b/documentation/build_ink_ui_documentation.groovy @@ -0,0 +1,222 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\documentation" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/build" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + env.AULIB = "${WORKSPACE}/atlaslibraries" + env.PSSOURCE = "${WORKSPACE}/newsw" + cleanfolders = [ + BUILDOUTPUT, + "${WORKSPACE}/SharedPackages", + PSBIN, + ASBIN, + AULIB, + "${WORKSPACE}/binInk", + "${WORKSPACE}/documentation", + ] + 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('Import Atlas UI libraries') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + libmeta = importer.artifactimport(meta, + ATLAS_UI_ARTIFACT_LOCATION, + ATLAS_UI_COMPILE_JOB, + ATLAS_UI_BUILD_SELECTOR, + ATLAS_UI_RELEASE_REPO, + ATLAS_UI_RELEASE_REVISION, + AULIB, + false) + } + } + } + stage('Import Print server to adjust version number') { + steps { + script { + def psartifactfiles = "meta/**" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) // This should increment the version number + } + } + } + stage('Import Atlas services to adjust version number') { + steps { + script { + def asartifactfiles = "meta/**" + asmeta = importer.artifactimport(meta, + ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION, + ASBIN, + true, + asartifactfiles) + } + } + } + stage('Version stamp files') { + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate + env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp + bat """ + call "${JOBSCRIPTS_COMMON}\\version_ink_ui_files.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Compile application') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + call "${JOBSCRIPTS}\\build_ink_ui.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Build documentation') { + steps { + script { + bat """ + call "${JOBSCRIPTS}\\ink_ui_documentation_build.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Prepare exports') { + steps { + script { + bat """ + move "${SRC}\\documentation" . + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues(tools: [ + msBuild(enabledForFailure: true, reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["documentation/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/documentation/release_note.groovy b/documentation/release_note.groovy new file mode 100644 index 0000000..4060098 --- /dev/null +++ b/documentation/release_note.groovy @@ -0,0 +1,162 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + 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('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + SOURCEROOTDIR = 'atlas_ui' + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_Atlas" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.RELEASE_NOTES = "release_notes" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + cleanfolders = [ + RELEASE_NOTES, + PSBIN, + ASBIN, + ] + 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('Import Print server to adjust version number') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def psartifactfiles = "meta/**" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) + } + } + } + stage('Import Atlas services to adjust version number') { + steps { + script { + def asartifactfiles = "meta/**" + asmeta = importer.artifactimport(meta, + ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION, + ASBIN, + true, + asartifactfiles) + } + } + } + stage('Copy release notes') { + steps { + script { + dir("${SOURCEDIR}/releasenotes") { + fileOperations([fileCopyOperation(targetLocation: "${WORKSPACE}/${RELEASE_NOTES}", includes: '*.txt')]) + } + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + "${RELEASE_NOTES}/**", + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + "${RELEASE_NOTES}/**", + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["${RELEASE_NOTES}/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/install/install_atlas_ink_ui.groovy b/install/install_atlas_ink_ui.groovy new file mode 100644 index 0000000..0ba4502 --- /dev/null +++ b/install/install_atlas_ink_ui.groovy @@ -0,0 +1,336 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + + if (INSTALLSHIELD2015_CMD == "" || INSTALLSHIELD2018_CMD == "" || INSTALLSHIELD2019_CMD == "" || DOTNET_FRAMEWORK64_PATH == "" || WINDOWS_DRIVER_KIT_8_1 == "") { + echo "Either INSTALLSHIELD2015_CMD, INSTALLSHIELD2018_CMD, INSTALLSHIELD2019_CMD, DOTNET_FRAMEWORK64_PATH or WINDOWS_DRIVER_KIT_8_1 environment variables have not been defined" + currentBuild.result = 'FAILED' + exit(1) + } + installerlist = env.INSTALLERS_TO_BUILD + if (installerlist != null) { + installerlist = installerlist.trim() + } else { + installerlist = '' + } + toBuild = [] + if (installerlist) { + toBuildUntrimmed = installerlist.split(',') + toBuildUntrimmed.each { + toBuild.add(it.trim()) + } + } + } + echo "Installer list: ${installerlist}" + } + } + stage('Nothing to build check') { + when { + expression { + !toBuild + } + } + steps { + echo 'No installers to build' + script { + currentBuild.result = 'UNSTABLE' + } + } + } + stage('Checkout dependencies') { + when { + expression { + toBuild + } + } + 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" + + SUPPORTURL = 'git@hydra:gis/gissupport.git' + SUPPORTBRANCH = 'origin/master' + SUPPORTDIR = "${WORKSPACE}\\gissupport" + configurationhelper.gitCheckoutAndRegister(meta, 'gissupport', SUPPORTURL, SUPPORTBRANCH, SUPPORTDIR) + env.INST_SUPPORT = SUPPORTDIR + + EULAURL = 'git@hydra:gis/giseula.git' + EULABRANCH = 'origin/master' + EULADIR = "${WORKSPACE}\\giseula" + configurationhelper.gitCheckoutAndRegister(meta, 'giseula', EULAURL, EULABRANCH, EULADIR) + env.INST_EULA = EULADIR + + PREREQURL = 'git@hydra:gis/installerprerequisites.git' + PREREQBRANCH = 'origin/master' + PREREQDIR = "${WORKSPACE}\\prereq" + configurationhelper.gitCheckoutAndRegister(meta, 'installerprerequisites', PREREQURL, PREREQBRANCH, PREREQDIR) + env.INST_PREQ = PREREQDIR + + DIGSIGURL = 'git@hydra:gis/digitalsignature.git' + DIGSIGBRANCH = 'origin/master' + DIGSIGDIR = "${WORKSPACE}\\certificates" + configurationhelper.gitCheckoutAndRegister(meta, 'digitalsignature', DIGSIGURL, DIGSIGBRANCH, DIGSIGDIR) + env.PATH_TO_CERTIFICATE_PFX = "${DIGSIGDIR}\\GIS" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.INST_RELEASE_NOTES = "${SOURCE_PATH}\\releasenotes" + env.INST_SRC = "${SOURCE_PATH}\\src" + env.ATLAS_SOURCE_PATH = SOURCE_PATH + } + } + } + stage("Clean exports") { + steps { + script { + env.IMPORTSPATH = "${WORKSPACE}\\imports" + env.INTERMEDIATEEXPORTSPATH = "${WORKSPACE}\\info" + env.EXPORTSPATH = "installers" + env.PS_ARTIFACTS_ROOT = "${IMPORTSPATH}\\ps_bin" + env.VERSIONINFO = "${WORKSPACE}\\versioninfo" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + cleanfolders = [ + "${IMPORTSPATH}", + "${INTERMEDIATEEXPORTSPATH}", + "${EXPORTSPATH}", + "${WORKSPACE}/mcs_bin", + "${VERSIONINFO}", + PSBIN, + ASBIN, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + when { + expression { + toBuild + } + } + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Import Print server to adjust version number') { + when { + expression { + toBuild + } + } + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def importoptions = importer.getNewImportOptions() + importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, PSBIN) + } + } + } + stage('Import Atlas services to adjust version number') { + when { + expression { + toBuild + } + } + steps { + script { + def importoptions = importer.getNewImportOptions() + importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, ASBIN) + } + } + } + stage("Import binaries") { + when { + expression { + toBuild + } + } + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + artifactDetails = [ + // Key, Artifacts Source project Artifacts source selector, Destination folder Increment Version Number Artifacts to copy Artifacts to not copy Binaries Folders + AtlasSet: [ATLAS_COMPILE_JOB, ATLAS_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\atlasset", false, 'meta/**, bin/**, binKiosk/**', '**/*.lib', [ 'bin' ], ], + InkUISet: [INK_UI_COMPILE_JOB, INK_UI_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\inkuiset", false, 'meta/**, binInk/**', '**/*.lib', [ 'binInk' ], ], + ] + installerDetails = [ + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + INK_CONFIG_UI: [INSTALLSHIELD2019_CMD, ['InkUISet','AtlasSet'], 'install_ink_ui', "${ATLAS_SOURCE_PATH}\\installer\\build\\ink_system_ui", 'InkSystemConfigurationUI.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_ink_ui/x64/GIS Atlas Ink System Configuration UI/DiskImages/DISK1/GIS Atlas Ink System Configuration UI.exe", "${EXPORTSPATH}/GIS Atlas Ink System Configuration UI", "GIS Atlas Ink System Configuration UI ${BUILD_STAMP}.exe" ], + INK_OPERATOR_UI: [INSTALLSHIELD2019_CMD, ['InkUISet','AtlasSet'], 'install_ink_ui', "${ATLAS_SOURCE_PATH}\\installer\\build\\ink_system_ui", 'InkSystemOperatorUI.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_ink_ui/x64/GIS Atlas Ink System Operator UI/DiskImages/DISK1/GIS Atlas Ink System Operator UI.exe", "${EXPORTSPATH}/GIS Atlas Ink System Operator UI", "GIS Atlas Ink System Operator UI ${BUILD_STAMP}.exe" ], + INK_UI_MODULES: [INSTALLSHIELD2019_CMD, ['InkUISet','AtlasSet'], 'install_ink_ui', "${ATLAS_SOURCE_PATH}\\installer\\build\\ink_system_ui", 'InkSystemToolModules.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_ink_ui/x64/GIS Atlas Ink System Tool Modules/DiskImages/DISK1/GIS Atlas Ink System Tool Modules.exe", "${EXPORTSPATH}/GIS Atlas Ink System Tool Modules", "GIS Atlas Ink System Tool Modules ${BUILD_STAMP}.exe" ], + ] + installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") + artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) + } + } + } + stage("Generate version info folder for installer") { + steps { + script { + def metamap = [ + ["${VERSIONINFO}", meta], // Incomplete until this job ends + ] + for (metaitem in metamap) { + (destfolder, componentmeta) = metaitem + dir(destfolder) { + componentmeta.saveJsonSerialised("meta.json") + } + } + } + } + } + stage("Build installers") { + when { + expression { + toBuild + } + } + steps { + script { + fileOperations([folderCreateOperation(INTERMEDIATEEXPORTSPATH)]) + installerpublishlist = [] + for (installer in toBuild) { + (installcmd, artifactKey, processingFolder, EXECUTIONPATH, ISMPROJECT, VARIANT, pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) = installerDetails.get(installer) + if (artifactKey instanceof java.util.ArrayList) { + artifactKey = artifactKey[0] + } + def importmeta = artifactFetched.get(artifactKey) + + + echo "For: ${installer} build stamp is: ${importmeta.buildstampinfo.buildstamp}" + def INST_ISVERSION = importmeta.buildstampinfo.buildstamp + + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + def COMPILE_IMPORTS = destFolder + + def INST_VERBOSE = '' + if (VERBOSE == "true") { + INST_VERBOSE = '-v' + } + + def INST_OUT = "${INTERMEDIATEEXPORTSPATH}\\${processingFolder}" + fileOperations([folderCreateOperation(INST_OUT)]) + + def INST_VARIANT = '' + if (VARIANT != "" ) { + INST_VARIANT = '-r ' + VARIANT + } + installerhelper.checkISMfile("${EXECUTIONPATH}\\${ISMPROJECT}") + installerhelper.selectSigningCertificate(NODE_NAME, "${EXECUTIONPATH}\\${ISMPROJECT}") + + dir(EXECUTIONPATH) { + // INSTALLSHIELD201X_CMD and DOTNET_FRAMEWORK64_PATH must be externally defined + bat """ + set INST_COMMON_PARAMETERS=-y "${INST_ISVERSION}" -l "WORKSPACE=${WORKSPACE}" -l "PATH_TO_CERTIFICATE_PFX=${PATH_TO_CERTIFICATE_PFX}" -l "COMPILE_IMPORTS=${COMPILE_IMPORTS}" -l "IMPORTS_ROOT=${IMPORTSPATH}" -l "PS_ARTIFACTS_ROOT=${PS_ARTIFACTS_ROOT}" -l "INST_RELEASE_NOTES=${INST_RELEASE_NOTES}" -l "INST_SRC=${INST_SRC}" -l "INST_OUT=${INST_OUT}" -l "INST_EULA=${INST_EULA}" -l "INST_SUPPORT=${INST_SUPPORT}" -prqpath "${INST_PREQ}" ${INST_VERBOSE} + "${installcmd}" -t "${DOTNET_FRAMEWORK64_PATH}" -p "${ISMPROJECT}" %INST_COMMON_PARAMETERS% ${INST_VARIANT} -a x64" + """ + } + + installerhelper.copyToFinalPosition(pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) + + def EXPORT_OUT_GLOB = "${FINALBASEFOLDER}/**" + echo "Adding ${EXPORT_OUT_GLOB} to installer publish list" + installerpublishlist.add(EXPORT_OUT_GLOB) + } + } + } + } + stage('Classifying publishable artifacts') { + when { + expression { + toBuild + } + } + steps { + script { + def publishable = installerpublishlist + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + when { + expression { + toBuild + } + } + steps { + script { + ArrayList itemsForRelease = ["info/**", "installers/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + stage('Check for unstable build') { + when { + expression { + toBuild + } + } + steps { + script { + def installersToBuild = installerDetails.size() + if (installersToBuild != toBuild.size()) { + echo "Not building the complete set of installers (${installersToBuild}) therefore marking building unstable" + currentBuild.result = 'UNSTABLE' + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/install/install_atlas_professional.groovy b/install/install_atlas_professional.groovy new file mode 100644 index 0000000..fb86e6b --- /dev/null +++ b/install/install_atlas_professional.groovy @@ -0,0 +1,333 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + + if (INSTALLSHIELD2015_CMD == "" || INSTALLSHIELD2018_CMD == "" || INSTALLSHIELD2019_CMD == "" || DOTNET_FRAMEWORK64_PATH == "" || WINDOWS_DRIVER_KIT_8_1 == "") { + echo "Either INSTALLSHIELD2015_CMD, INSTALLSHIELD2018_CMD, INSTALLSHIELD2019_CMD, DOTNET_FRAMEWORK64_PATH or WINDOWS_DRIVER_KIT_8_1 environment variables have not been defined" + currentBuild.result = 'FAILED' + exit(1) + } + installerlist = env.INSTALLERS_TO_BUILD + if (installerlist != null) { + installerlist = installerlist.trim() + } else { + installerlist = '' + } + toBuild = [] + if (installerlist) { + toBuildUntrimmed = installerlist.split(',') + toBuildUntrimmed.each { + toBuild.add(it.trim()) + } + } + } + echo "Installer list: ${installerlist}" + } + } + stage('Nothing to build check') { + when { + expression { + !toBuild + } + } + steps { + echo 'No installers to build' + script { + currentBuild.result = 'UNSTABLE' + } + } + } + stage('Checkout dependencies') { + when { + expression { + toBuild + } + } + 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" + + SUPPORTURL = 'git@hydra:gis/gissupport.git' + SUPPORTBRANCH = 'origin/master' + SUPPORTDIR = "${WORKSPACE}\\gissupport" + configurationhelper.gitCheckoutAndRegister(meta, 'gissupport', SUPPORTURL, SUPPORTBRANCH, SUPPORTDIR) + env.INST_SUPPORT = SUPPORTDIR + + EULAURL = 'git@hydra:gis/giseula.git' + EULABRANCH = 'origin/master' + EULADIR = "${WORKSPACE}\\giseula" + configurationhelper.gitCheckoutAndRegister(meta, 'giseula', EULAURL, EULABRANCH, EULADIR) + env.INST_EULA = EULADIR + + PREREQURL = 'git@hydra:gis/installerprerequisites.git' + PREREQBRANCH = 'origin/master' + PREREQDIR = "${WORKSPACE}\\prereq" + configurationhelper.gitCheckoutAndRegister(meta, 'installerprerequisites', PREREQURL, PREREQBRANCH, PREREQDIR) + env.INST_PREQ = PREREQDIR + + DIGSIGURL = 'git@hydra:gis/digitalsignature.git' + DIGSIGBRANCH = 'origin/master' + DIGSIGDIR = "${WORKSPACE}\\certificates" + configurationhelper.gitCheckoutAndRegister(meta, 'digitalsignature', DIGSIGURL, DIGSIGBRANCH, DIGSIGDIR) + env.PATH_TO_CERTIFICATE_PFX = "${DIGSIGDIR}\\GIS" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.INST_RELEASE_NOTES = "${SOURCE_PATH}\\releasenotes" + env.INST_SRC = "${SOURCE_PATH}\\src" + env.ATLAS_SOURCE_PATH = SOURCE_PATH + } + } + } + stage("Clean exports") { + steps { + script { + env.IMPORTSPATH = "${WORKSPACE}\\imports" + env.INTERMEDIATEEXPORTSPATH = "${WORKSPACE}\\info" + env.EXPORTSPATH = "installers" + env.PS_ARTIFACTS_ROOT = "${IMPORTSPATH}\\ps_bin" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + env.VERSIONINFO = "${WORKSPACE}\\versioninfo" + cleanfolders = [ + "${IMPORTSPATH}", + "${INTERMEDIATEEXPORTSPATH}", + "${EXPORTSPATH}", + "${WORKSPACE}/mcs_bin", + "${VERSIONINFO}", + PSBIN, + ASBIN, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + when { + expression { + toBuild + } + } + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Import Print server to adjust version number') { + when { + expression { + toBuild + } + } + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def importoptions = importer.getNewImportOptions() + importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, PSBIN) + } + } + } + stage('Import Atlas services to adjust version number') { + when { + expression { + toBuild + } + } + steps { + script { + def importoptions = importer.getNewImportOptions() + importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, ASBIN) + } + } + } + stage("Import binaries") { + when { + expression { + toBuild + } + } + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + artifactDetails = [ + // Key, Artifacts Source project Artifacts source selector, Destination folder Increment Version Number Artifacts to copy Artifacts to not copy Binaries Folders + AtlasSet: [ATLAS_COMPILE_JOB, ATLAS_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\atlasset", false, 'meta/**, bin/**, binKiosk/**', '**/*.lib', [ 'bin' ], ], + + ] + installerDetails = [ + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + ATLAS_PRO_PRINT_SERVER: [INSTALLSHIELD2019_CMD, 'AtlasSet', 'install_atlas', "${ATLAS_SOURCE_PATH}\\installer\\build\\atlas", 'AtlasProfessionalPrintServer.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_atlas/x64/GIS Atlas Professional for Print Server/DiskImages/DISK1/GIS Atlas Professional for Print Server.exe", "${EXPORTSPATH}/GIS Atlas Professional for Print Server", "GIS Atlas Professional for Print Server ${BUILD_STAMP}.exe" ], + ATLAS_PRO: [INSTALLSHIELD2019_CMD, 'AtlasSet', 'install_atlas', "${ATLAS_SOURCE_PATH}\\installer\\build\\atlas", 'AtlasProfessional.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_atlas/x64/GIS Atlas Professional/DiskImages/DISK1/GIS Atlas Professional.exe", "${EXPORTSPATH}/GIS Atlas Professional", "GIS Atlas Professional ${BUILD_STAMP}.exe" ], + ATLAS_PRODUCTION: [INSTALLSHIELD2019_CMD, 'AtlasSet', 'install_atlas', "${ATLAS_SOURCE_PATH}\\installer\\build\\atlas", 'AtlasProduction.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_atlas/x64/GIS Atlas Production/DiskImages/DISK1/GIS Atlas Production.exe", "${EXPORTSPATH}/GIS Atlas Production", "GIS Atlas Production ${BUILD_STAMP}.exe" ], + ] + installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") + artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) + } + } + } + stage("Generate version info folder for installer") { + steps { + script { + def metamap = [ + ["${VERSIONINFO}", meta], // Incomplete until this job ends + ] + for (metaitem in metamap) { + (destfolder, componentmeta) = metaitem + dir(destfolder) { + componentmeta.saveJsonSerialised("meta.json") + } + } + } + } + } + stage("Build installers") { + when { + expression { + toBuild + } + } + steps { + script { + fileOperations([folderCreateOperation(INTERMEDIATEEXPORTSPATH)]) + installerpublishlist = [] + for (installer in toBuild) { + (installcmd, artifactKey, processingFolder, EXECUTIONPATH, ISMPROJECT, VARIANT, pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) = installerDetails.get(installer) + + def importmeta = artifactFetched.get(artifactKey) + + echo "For: ${installer} build stamp is: ${importmeta.buildstampinfo.buildstamp}" + def INST_ISVERSION = importmeta.buildstampinfo.buildstamp + + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + def COMPILE_IMPORTS = destFolder + + def INST_VERBOSE = '' + if (VERBOSE == "true") { + INST_VERBOSE = '-v' + } + + def INST_OUT = "${INTERMEDIATEEXPORTSPATH}\\${processingFolder}" + fileOperations([folderCreateOperation(INST_OUT)]) + + def INST_VARIANT = '' + if (VARIANT != "" ) { + INST_VARIANT = '-r ' + VARIANT + } + installerhelper.checkISMfile("${EXECUTIONPATH}\\${ISMPROJECT}") + installerhelper.selectSigningCertificate(NODE_NAME, "${EXECUTIONPATH}\\${ISMPROJECT}") + + dir(EXECUTIONPATH) { + // INSTALLSHIELD201X_CMD and DOTNET_FRAMEWORK64_PATH must be externally defined + bat """ + set INST_COMMON_PARAMETERS=-y "${INST_ISVERSION}" -l "WORKSPACE=${WORKSPACE}" -l "PATH_TO_CERTIFICATE_PFX=${PATH_TO_CERTIFICATE_PFX}" -l "COMPILE_IMPORTS=${COMPILE_IMPORTS}" -l "IMPORTS_ROOT=${IMPORTSPATH}" -l "PS_ARTIFACTS_ROOT=${PS_ARTIFACTS_ROOT}" -l "INST_RELEASE_NOTES=${INST_RELEASE_NOTES}" -l "INST_SRC=${INST_SRC}" -l "INST_OUT=${INST_OUT}" -l "INST_EULA=${INST_EULA}" -l "INST_SUPPORT=${INST_SUPPORT}" -prqpath "${INST_PREQ}" ${INST_VERBOSE} + "${installcmd}" -t "${DOTNET_FRAMEWORK64_PATH}" -p "${ISMPROJECT}" %INST_COMMON_PARAMETERS% ${INST_VARIANT} -a x64" + """ + } + + installerhelper.copyToFinalPosition(pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) + + def EXPORT_OUT_GLOB = "${FINALBASEFOLDER}/**" + echo "Adding ${EXPORT_OUT_GLOB} to installer publish list" + installerpublishlist.add(EXPORT_OUT_GLOB) + } + } + } + } + stage('Classifying publishable artifacts') { + when { + expression { + toBuild + } + } + steps { + script { + def publishable = installerpublishlist + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + when { + expression { + toBuild + } + } + steps { + script { + ArrayList itemsForRelease = ["info/**", "installers/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + stage('Check for unstable build') { + when { + expression { + toBuild + } + } + steps { + script { + def installersToBuild = installerDetails.size() + if (installersToBuild != toBuild.size()) { + echo "Not building the complete set of installers (${installersToBuild}) therefore marking building unstable" + currentBuild.result = 'UNSTABLE' + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/install/install_atlas_sdk.groovy b/install/install_atlas_sdk.groovy new file mode 100644 index 0000000..68afa85 --- /dev/null +++ b/install/install_atlas_sdk.groovy @@ -0,0 +1,330 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + + if (INSTALLSHIELD2015_CMD == "" || INSTALLSHIELD2018_CMD == "" || INSTALLSHIELD2019_CMD == "" || DOTNET_FRAMEWORK64_PATH == "" || WINDOWS_DRIVER_KIT_8_1 == "") { + echo "Either INSTALLSHIELD2015_CMD, INSTALLSHIELD2018_CMD, INSTALLSHIELD2019_CMD, DOTNET_FRAMEWORK64_PATH or WINDOWS_DRIVER_KIT_8_1 environment variables have not been defined" + currentBuild.result = 'FAILED' + exit(1) + } + installerlist = env.INSTALLERS_TO_BUILD + if (installerlist != null) { + installerlist = installerlist.trim() + } else { + installerlist = '' + } + toBuild = [] + if (installerlist) { + toBuildUntrimmed = installerlist.split(',') + toBuildUntrimmed.each { + toBuild.add(it.trim()) + } + } + } + echo "Installer list: ${installerlist}" + } + } + stage('Nothing to build check') { + when { + expression { + !toBuild + } + } + steps { + echo 'No installers to build' + script { + currentBuild.result = 'UNSTABLE' + } + } + } + stage('Checkout dependencies') { + when { + expression { + toBuild + } + } + 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" + + SUPPORTURL = 'git@hydra:gis/gissupport.git' + SUPPORTBRANCH = 'origin/master' + SUPPORTDIR = "${WORKSPACE}\\gissupport" + configurationhelper.gitCheckoutAndRegister(meta, 'gissupport', SUPPORTURL, SUPPORTBRANCH, SUPPORTDIR) + env.INST_SUPPORT = SUPPORTDIR + + EULAURL = 'git@hydra:gis/giseula.git' + EULABRANCH = 'origin/master' + EULADIR = "${WORKSPACE}\\giseula" + configurationhelper.gitCheckoutAndRegister(meta, 'giseula', EULAURL, EULABRANCH, EULADIR) + env.INST_EULA = EULADIR + + PREREQURL = 'git@hydra:gis/installerprerequisites.git' + PREREQBRANCH = 'origin/master' + PREREQDIR = "${WORKSPACE}\\prereq" + configurationhelper.gitCheckoutAndRegister(meta, 'installerprerequisites', PREREQURL, PREREQBRANCH, PREREQDIR) + env.INST_PREQ = PREREQDIR + + DIGSIGURL = 'git@hydra:gis/digitalsignature.git' + DIGSIGBRANCH = 'origin/master' + DIGSIGDIR = "${WORKSPACE}\\certificates" + configurationhelper.gitCheckoutAndRegister(meta, 'digitalsignature', DIGSIGURL, DIGSIGBRANCH, DIGSIGDIR) + env.PATH_TO_CERTIFICATE_PFX = "${DIGSIGDIR}\\GIS" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.INST_RELEASE_NOTES = "${SOURCE_PATH}\\releasenotes" + env.INST_SRC = "${SOURCE_PATH}\\src" + env.ATLAS_SOURCE_PATH = SOURCE_PATH + } + } + } + stage("Clean exports") { + steps { + script { + env.IMPORTSPATH = "${WORKSPACE}\\imports" + env.INTERMEDIATEEXPORTSPATH = "${WORKSPACE}\\info" + env.EXPORTSPATH = "installers" + env.PS_ARTIFACTS_ROOT = "${IMPORTSPATH}\\ps_bin" + env.VERSIONINFO = "${WORKSPACE}\\versioninfo" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + cleanfolders = [ + "${IMPORTSPATH}", + "${INTERMEDIATEEXPORTSPATH}", + "${EXPORTSPATH}", + "${WORKSPACE}/mcs_bin", + "${VERSIONINFO}", + PSBIN, + ASBIN, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + when { + expression { + toBuild + } + } + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Import Print server to adjust version number') { + when { + expression { + toBuild + } + } + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def importoptions = importer.getNewImportOptions() + importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, PSBIN) + } + } + } + stage('Import Atlas services to adjust version number') { + when { + expression { + toBuild + } + } + steps { + script { + def importoptions = importer.getNewImportOptions() + importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, ASBIN) + } + } + } + stage("Import binaries") { + when { + expression { + toBuild + } + } + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + artifactDetails = [ + // Key, Artifacts Source project Artifacts source selector, Destination folder Increment Version Number Artifacts to copy Artifacts to not copy Binaries Folders + AtlasSDKSet: [ATLAS_COMPILE_JOB, ATLAS_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\atlassdkset", false, 'meta/**, bin/**, binKiosk/**, Libraries/**, documentation/**, LocalisationSDK/**', '**/*.lib', [ 'bin', 'binKiosk' ], ], + ] + installerDetails = [ + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + ATLAS_SDK: [INSTALLSHIELD2019_CMD, 'AtlasSDKSet', 'install_atlas_sdk', "${ATLAS_SOURCE_PATH}\\installer\\build\\atlas_sdk", 'AtlasSDK.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_atlas_sdk/x64/GIS Atlas SDK/DiskImages/DISK1/GIS Atlas SDK.exe", "${EXPORTSPATH}/GIS Atlas SDK", "GIS Atlas SDK ${BUILD_STAMP}.exe" ], + ] + installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") + artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) + } + } + } + stage("Generate version info folder for installer") { + steps { + script { + def metamap = [ + ["${VERSIONINFO}", meta], // Incomplete until this job ends + ] + for (metaitem in metamap) { + (destfolder, componentmeta) = metaitem + dir(destfolder) { + componentmeta.saveJsonSerialised("meta.json") + } + } + } + } + } + stage("Build installers") { + when { + expression { + toBuild + } + } + steps { + script { + fileOperations([folderCreateOperation(INTERMEDIATEEXPORTSPATH)]) + installerpublishlist = [] + for (installer in toBuild) { + (installcmd, artifactKey, processingFolder, EXECUTIONPATH, ISMPROJECT, VARIANT, pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) = installerDetails.get(installer) + + def importmeta = artifactFetched.get(artifactKey) + + echo "For: ${installer} build stamp is: ${importmeta.buildstampinfo.buildstamp}" + def INST_ISVERSION = importmeta.buildstampinfo.buildstamp + + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + def COMPILE_IMPORTS = destFolder + + def INST_VERBOSE = '' + if (VERBOSE == "true") { + INST_VERBOSE = '-v' + } + + def INST_OUT = "${INTERMEDIATEEXPORTSPATH}\\${processingFolder}" + fileOperations([folderCreateOperation(INST_OUT)]) + + def INST_VARIANT = '' + if (VARIANT != "" ) { + INST_VARIANT = '-r ' + VARIANT + } + installerhelper.checkISMfile("${EXECUTIONPATH}\\${ISMPROJECT}") + installerhelper.selectSigningCertificate(NODE_NAME, "${EXECUTIONPATH}\\${ISMPROJECT}") + + dir(EXECUTIONPATH) { + // INSTALLSHIELD201X_CMD and DOTNET_FRAMEWORK64_PATH must be externally defined + bat """ + set INST_COMMON_PARAMETERS=-y "${INST_ISVERSION}" -l "WORKSPACE=${WORKSPACE}" -l "PATH_TO_CERTIFICATE_PFX=${PATH_TO_CERTIFICATE_PFX}" -l "COMPILE_IMPORTS=${COMPILE_IMPORTS}" -l "IMPORTS_ROOT=${IMPORTSPATH}" -l "PS_ARTIFACTS_ROOT=${PS_ARTIFACTS_ROOT}" -l "INST_RELEASE_NOTES=${INST_RELEASE_NOTES}" -l "INST_SRC=${INST_SRC}" -l "INST_OUT=${INST_OUT}" -l "INST_EULA=${INST_EULA}" -l "INST_SUPPORT=${INST_SUPPORT}" -prqpath "${INST_PREQ}" ${INST_VERBOSE} + "${installcmd}" -t "${DOTNET_FRAMEWORK64_PATH}" -p "${ISMPROJECT}" %INST_COMMON_PARAMETERS% ${INST_VARIANT} -a x64" + """ + } + + installerhelper.copyToFinalPosition(pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) + + def EXPORT_OUT_GLOB = "${FINALBASEFOLDER}/**" + echo "Adding ${EXPORT_OUT_GLOB} to installer publish list" + installerpublishlist.add(EXPORT_OUT_GLOB) + } + } + } + } + stage('Classifying publishable artifacts') { + when { + expression { + toBuild + } + } + steps { + script { + def publishable = installerpublishlist + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + when { + expression { + toBuild + } + } + steps { + script { + ArrayList itemsForRelease = ["info/**", "installers/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + stage('Check for unstable build') { + when { + expression { + toBuild + } + } + steps { + script { + def installersToBuild = installerDetails.size() + if (installersToBuild != toBuild.size()) { + echo "Not building the complete set of installers (${installersToBuild}) therefore marking building unstable" + currentBuild.result = 'UNSTABLE' + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/localisation_check/localisation_check.groovy b/localisation_check/localisation_check.groovy new file mode 100644 index 0000000..00d0c64 --- /dev/null +++ b/localisation_check/localisation_check.groovy @@ -0,0 +1,164 @@ +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" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + SOURCEROOTDIR = 'atlas_ui' + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\localisation_test" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/build" + env.AULIB = "${WORKSPACE}/atlaslibraries" + cleanfolders = [ + BUILDOUTPUT, + AULIB, + "${WORKSPACE}/bin", + "${WORKSPACE}/documentation", + ] + 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('Import Atlas UI libraries') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + libmeta = importer.artifactimport(meta, + ATLAS_UI_ARTIFACT_LOCATION, + ATLAS_UI_COMPILE_JOB, + ATLAS_UI_BUILD_SELECTOR, + ATLAS_UI_RELEASE_REPO, + ATLAS_UI_RELEASE_REVISION, + AULIB, + false, + "LocalisationSDK/**") + } + } + } + stage('Check localisations are correct') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + call "${JOBSCRIPTS}\\test_localisations.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Prepare exports') { + steps { + script { + bat """ + move "${AULIB}\\LocalisationSDK\\bin" . + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Scan for warnings') { + steps { + script { + recordIssues(tools: [ + msBuild(enabledForFailure: true, reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["bin/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/nuget/createpackages.groovy b/nuget/createpackages.groovy new file mode 100644 index 0000000..c7a4cd0 --- /dev/null +++ b/nuget/createpackages.groovy @@ -0,0 +1,204 @@ +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" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + SOURCEROOTDIR = 'atlas_ui' + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_Atlas" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.PSBIN = "${WORKSPACE}/ps_bin" + env.PSSOURCE = "${WORKSPACE}/newsw" + cleanfolders = [ + PSBIN, + "${WORKSPACE}/packages", + ] + 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('Import Print server to adjust version number') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def psartifactfiles = "meta/**,bin/x64/Release/Engine - Render.dll,bin/x64/Release/Engine - Render.lib,bin/x64/Release/Engine - Render.pdb,bin/x64/Release/TBarCode11_x64.dll,bin/x64/Release/GIS Utility - Toolbox.dll,bin/x64/Release/GIS Utility - Toolbox.lib,bin/x64/Release/GIS Utility - Toolbox.pdb,bin/x64/Release/zlib1.dll,bin/x64/Release/zlib1.lib,bin/x64/Release/zlib1.pdb,bin/x64/Release/GIS Utility - TCP-IP Comms.dll,bin/x64/Release/GIS Utility - TCP-IP Comms.lib,bin/x64/Release/GIS Utility - TCP-IP Comms.pdb,bin/x64/Release/Dialog - Tree Node Editor.dll,bin/x64/Release/Dialog - Tree Node Editor.lib,bin/x64/Release/Dialog - Tree Node Editor.pdb" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) // This should increment the version number + } + } + } + stage('Checkout relevant Print server source') { + steps { + script { + def pssourceartifacts = "src/Engine Common" + def pssourceurl = psmeta.gitinfo.remoteurl + def pscommit = psmeta.gitinfo.gitrevision + + configurationhelper.gitCheckoutAndRegister(meta, 'print_server_source', pssourceurl, pscommit, PSSOURCE, '', 0, false, pssourceartifacts) + } + } + } + stage('Create packages') { + steps { + script { + PS_VERSION="1.0.${psmeta.buildstampinfo.revision}.0" + PS_PACKAGE_VERSION=psmeta.buildstampinfo.buildstampprefix + bat """ + REM Create nuget packages + echo Create nuget packages + + @echo on + + set NUGET_SERVER=C:\\NugetServer\\Packages\\ + + + @echo Renaming nuget package in ${SRC} with ${PS_PACKAGE_VERSION} + @echo Versioning nuget package in ${SRC} to ${PS_VERSION} + + @echo on + + REM edit autopkg file + "${PYTHON}" "${JOBSCRIPTS_COMMON}\\ps_nuget_version_edit.py" "${JOBSCRIPTS_COMMON}\\AtlasNativeDependencies.autopkg" ${PS_VERSION} ${PS_PACKAGE_VERSION} + if errorlevel 1 EXIT /b 1 + + REM Create nuget packages + REM Uses COAPP modules at %COAPP_MODULES% + set PSMODULEPATH=%COAPP_MODULES%;%PSMODULEPATH% + PowerShell.exe Write-NuGetPackage '${JOBSCRIPTS_COMMON}\\AtlasNativeDependencies.autopkg' + if errorlevel 1 EXIT /b 1 + REM Copy nuget packages + copy AtlasNativeDependencies.${PS_PACKAGE_VERSION}${PS_VERSION}.nupkg %NUGET_SERVER% + if errorlevel 1 EXIT /b 1 + + copy AtlasNativeDependencies.${PS_PACKAGE_VERSION}redist.${PS_VERSION}.nupkg %NUGET_SERVER% + if errorlevel 1 EXIT /b 1 + + copy AtlasNativeDependencies.${PS_PACKAGE_VERSION}symbols.${PS_VERSION}.nupkg %NUGET_SERVER% + if errorlevel 1 EXIT /b 1 + """ + } + } + } + stage('Prepare exports') { + steps { + script { + bat """ + REM Place files to the exports position + + mkdir packages + if errorlevel 1 EXIT /b 1 + + copy AtlasNativeDependencies.${PS_PACKAGE_VERSION}${PS_VERSION}.nupkg packages + if errorlevel 1 EXIT /b 1 + copy AtlasNativeDependencies.${PS_PACKAGE_VERSION}redist.${PS_VERSION}.nupkg packages + if errorlevel 1 EXIT /b 1 + copy AtlasNativeDependencies.${PS_PACKAGE_VERSION}symbols.${PS_VERSION}.nupkg packages + if errorlevel 1 EXIT /b 1 + """ + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["bin/**,binKiosk/**,documentation/**,ildasm/**,Libraries/**, Atlas Release/**,LocalisationSDK/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/publish/.project b/publish/.project new file mode 100644 index 0000000..2236837 --- /dev/null +++ b/publish/.project @@ -0,0 +1,17 @@ + + + publish + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/publish/.pydevproject b/publish/.pydevproject new file mode 100644 index 0000000..8bec50a --- /dev/null +++ b/publish/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Python34 + diff --git a/publish/build_post_2_0_27_atlas.py b/publish/build_post_2_0_27_atlas.py new file mode 100644 index 0000000..0c64cfe --- /dev/null +++ b/publish/build_post_2_0_27_atlas.py @@ -0,0 +1,53 @@ +import sys +import stat +from publishLibrary import CommonLibrary, VersionError,ReleaseFolderIssue, Copier, AtlasLayoutCopierPost2_0_14, AtlasSDKCopier, InkSystemUICopierPost2_0_19, AtlasUIReleaseNotesCopier + + +def main(): + # All version number specific releases have been checked out already + (major, middle, minor) = CommonLibrary.readVersionNumber(CommonLibrary.softwareRelease) + print("Release version number: Major:", major, "Middle:", middle, "Minor:", minor) + + try: + CommonLibrary.checkReleaseFolders() + except ReleaseFolderIssue: + print("Release folders are not correct") + sys.exit(1) + + try: + tsHandle = open(CommonLibrary.transferScript, 'w') + except: + print("Failed to open transfer script file:", transferScript) + sys.exit(1) + + try: + buildRoot = CommonLibrary.prepareBuildDirectory(tsHandle, CommonLibrary.softwareRelease) + except Exception as e: + print("Failed to build directory. Details:", e) + tsHandle.close() + sys.exit(1) + + copiers = [ + AtlasLayoutCopierPost2_0_14(), + AtlasSDKCopier(), + InkSystemUICopierPost2_0_19(), + AtlasUIReleaseNotesCopier(), + ] + + for copier in copiers: + print("Copying", copier.description()) + try: + copier.transfer(buildRoot, CommonLibrary.softwareRelease) + except Exception as e: + print("A problem occurred while copying:", copier.description(), " Details:", e) + tsHandle.close() + sys.exit(1) + + print("Showing built tree at:", buildRoot) + CommonLibrary.listdir(buildRoot) + + tsHandle.close() + sys.exit(0) + +if __name__ == "__main__": + sys.exit(main()) diff --git a/publish/build_post_2_0_28_atlas.py b/publish/build_post_2_0_28_atlas.py new file mode 100644 index 0000000..1a2aab0 --- /dev/null +++ b/publish/build_post_2_0_28_atlas.py @@ -0,0 +1,54 @@ +import sys +import stat +from publishLibrary import CommonLibrary, VersionError,ReleaseFolderIssue, Copier, AtlasLayoutCopierPost2_0_14, AtlasSDKCopier, InkSystemUICopierPost2_0_19, McsToolsCopierPost2_0_28, AtlasUIReleaseNotesCopier + + +def main(): + # All version number specific releases have been checked out already + (major, middle, minor) = CommonLibrary.readVersionNumber(CommonLibrary.softwareRelease) + print("Release version number: Major:", major, "Middle:", middle, "Minor:", minor) + + try: + CommonLibrary.checkReleaseFolders() + except ReleaseFolderIssue: + print("Release folders are not correct") + sys.exit(1) + + try: + tsHandle = open(CommonLibrary.transferScript, 'w') + except: + print("Failed to open transfer script file:", transferScript) + sys.exit(1) + + try: + buildRoot = CommonLibrary.prepareBuildDirectory(tsHandle, CommonLibrary.softwareRelease) + except Exception as e: + print("Failed to build directory. Details:", e) + tsHandle.close() + sys.exit(1) + + copiers = [ + AtlasLayoutCopierPost2_0_14(), + AtlasSDKCopier(), + InkSystemUICopierPost2_0_19(), + McsToolsCopierPost2_0_28(), + AtlasUIReleaseNotesCopier(), + ] + + for copier in copiers: + print("Copying", copier.description()) + try: + copier.transfer(buildRoot, CommonLibrary.softwareRelease) + except Exception as e: + print("A problem occurred while copying:", copier.description(), " Details:", e) + tsHandle.close() + sys.exit(1) + + print("Showing built tree at:", buildRoot) + CommonLibrary.listdir(buildRoot) + + tsHandle.close() + sys.exit(0) + +if __name__ == "__main__": + sys.exit(main()) diff --git a/publish/publish.bat b/publish/publish.bat new file mode 100644 index 0000000..a770b9c --- /dev/null +++ b/publish/publish.bat @@ -0,0 +1,42 @@ +if "%CUSTOMER%"=="None" echo No customer has been selected +if "%CUSTOMER%"=="None" exit /b 1 + +set TRANSFER_SCRIPT=transfer.txt +if NOT EXIST "%TRANSFER_SCRIPT%" echo No transfer file created +if NOT EXIST "%TRANSFER_SCRIPT%" exit /b 1 + +set FTP_CLIENT=%FTP_CLIENT_LOCATION% + +set FTP_PROTOCOL=ftp:// +set FTP_OPEN_CMD=%FTP_PROTOCOL%%FTP_USER%:%FTP_PASSWORD%@%FTP_URL% + +set FTP_SCRIPT=ftp_script.txt + +@echo off +echo.open %FTP_OPEN_CMD% > %FTP_SCRIPT% + +echo.option echo on >> %FTP_SCRIPT% +echo.option confirm off >> %FTP_SCRIPT% +echo.option transfer binary >> %FTP_SCRIPT% + +echo.option batch abort >> %FTP_SCRIPT% +echo.cd "%FTP_CUSTOMER_ROOT%" >> %FTP_SCRIPT% + +echo.option batch continue >> %FTP_SCRIPT% +echo.mkdir "%CUSTOMER%" >> %FTP_SCRIPT% +echo.cd "%CUSTOMER%" >> %FTP_SCRIPT% +echo.mkdir "Software" >> %FTP_SCRIPT% +echo.cd "Software" >> %FTP_SCRIPT% +echo.option batch abort >> %FTP_SCRIPT% + +echo.pwd >> %FTP_SCRIPT% + +type "%TRANSFER_SCRIPT%" >> %FTP_SCRIPT% + +echo.ls >> %FTP_SCRIPT% + +echo.exit >> %FTP_SCRIPT% +@echo on + +"%FTP_CLIENT%" /script=%FTP_SCRIPT% +IF ERRORLEVEL 1 exit /b 1 diff --git a/publish/publishLibrary.py b/publish/publishLibrary.py new file mode 100644 index 0000000..4c6feef --- /dev/null +++ b/publish/publishLibrary.py @@ -0,0 +1,274 @@ +import os +import shutil +from abc import ABCMeta, abstractmethod +import sys + +class CommonLibrary: + # Release Folder Release description + releaseDetails = { + "atlaslayout": ("atlas-layout", "Atlas Layout", ), + "atlassdk": ("atlas-sdk", "Atlas SDK", ), + "inksysui": ("ink-system-ui", "Ink System UI", ), + "atlasreleasenotes": ("atlas-ui-release-notes", "Atlas UI Release notes", ), + "atlasmcstools": ("atlas-layout", "Atlas MCS Tools Modules", ), # The MCS tools are stored in the atlas-layout releases git repo. + } + + workspace = os.getenv("WORKSPACE", "").strip() + print("Workspace folder is: ", workspace) + if not workspace: + print("Workspace folder incorrect") + sys.exit(1) + + softwareRelease = os.getenv("SOFTWARE_RELEASE", "").strip() + print("Software release to publish is:", softwareRelease) + if not softwareRelease: + print("No software release has not been specified") + sys.exit(1) + + customer = os.getenv("CUSTOMER", "").strip() + print("Customer to publish to is:", customer) + if not customer: + print("No customer has not been specified") + sys.exit(1) + + includeAtlas = os.getenv("INCLUDE_ATLAS", "false").strip().lower() + print("Include Atlas Layout in release:", includeAtlas) + if not includeAtlas: + print("No Atlas Layout include parameter has not been specified") + sys.exit(1) + + includeInkSystemUI = os.getenv("INCLUDE_INK_SYSTEM_UI", "false").strip().lower() + print("Include Ink System UI in release:", includeInkSystemUI) + if not includeInkSystemUI: + print("No Ink System UI include parameter has not been specified") + sys.exit(1) + + includeAtlasSDK = os.getenv("INCLUDE_ATLAS_SDK_TOOLS", "false").strip().lower() + print("Include Atlas SDK in release:", includeAtlasSDK) + if not includeAtlasSDK: + print("No Atlas SDK include parameter has not been specified") + sys.exit(1) + + includeMCS = os.getenv("INCLUDE_ATLAS_MCS_TOOLS", "false").strip().lower() + print("Include Atlas MCS Tools modules in release:", includeMCS) + if not includeMCS: + print("No Atlas MCS Tools include parameter has not been specified") + sys.exit(1) + + ftpCustomerRootDir = os.getenv("FTP_CUSTOMER_ROOT", "").strip() + print("FTP root directory:", ftpCustomerRootDir) + if not ftpCustomerRootDir: + print("No FTP root directory parameter has not been specified") + sys.exit(1) + + ftpClientExe = os.getenv("FTP_CLIENT_LOCATION", "").strip() + print("FTP client executable:", ftpClientExe) + if not ftpClientExe: + print("FTP client executable parameter has not been specified") + sys.exit(1) + + ftpURL = os.getenv("FTP_URL", "").strip() + print("FTP URL:", ftpURL) + if not ftpURL: + print("FTP URL parameter has not been specified") + sys.exit(1) + + ftpUser = os.getenv("FTP_USER", "").strip() + print("FTP User:", ftpUser) + if not ftpUser: + print("FTP User parameter has not been specified") + sys.exit(1) + + ftpPassword = os.getenv("FTP_PASSWORD", "").strip() + print("FTP Password: ********") + if not ftpPassword: + print("FTP Password parameter has not been specified") + sys.exit(1) + + def readVersionNumber(versionString): + versionList = versionString.split(sep='.') + items = len(versionList) + if items < 3 or items > 4: + raise VersionError(versionString) + major = versionList[0] + middle = versionList[1] + minor = versionList[2] + return (major, middle, minor) + + def removeReadonly(func, path, _): + "Clear the readonly bit and reattempt the removal" + os.chmod(path, stat.S_IWRITE) + func(path) + + buildRootDir = os.path.join(workspace, "build") + def prepareBuildDirectory(transferScriptFile, softwareRelease): + # Make sure the build directories are cleaned away + buildRootDir = CommonLibrary.buildRootDir + if os.path.isdir(buildRootDir): + shutil.rmtree(buildRootDir, onerror=CommonLibrary.removeReadonly) + + releaseFolder = "Atlas UI " + softwareRelease + buildRoot = os.path.join(buildRootDir, releaseFolder) + os.makedirs(buildRoot) + + print("option batch continue", file = transferScriptFile) + print('mkdir "', releaseFolder, '"', file = transferScriptFile, sep='') + print("option batch abort", file = transferScriptFile) + print('synchronize remote "', buildRoot, '" "', releaseFolder, '"', file = transferScriptFile, sep='') + return buildRoot + + def checkReleaseFolders(): + for _, v in sorted(CommonLibrary.releaseDetails.items()): + (folder, description) = v + fullFolderPath = os.path.join(CommonLibrary.workspace, folder) + if os.path.isdir(fullFolderPath): + print("Release of", description, "is at folder:", fullFolderPath) + else: + print("Could not find folder:", fullFolderPath, " for release of:", description) + raise ReleaseFolderIssue + + + def listdir(rootdir): + for root, directories, filenames in os.walk(rootdir): + for directory in sorted(directories): + print(os.path.join(root, directory)) + for filename in sorted(filenames): + print(os.path.join(root, filename)) + + transferScript = os.path.join(workspace, "transfer.txt") + +class VersionError(Exception): + def __init__(self, versionString): + self._versionString = versionString + + def __repr__(self): + return self._versionString + +class ReleaseFolderIssue(Exception): + def __init__(self): + pass + +class Copier: + __metaclass__ = ABCMeta + + def __init__(self, component): + (self.releaseFolderPath, self.releaseDesc) = CommonLibrary.releaseDetails[component] + + @abstractmethod + def transfer(self): pass + + def description(self): + return self.releaseDesc + + def makeDirectories(self, dirs): + print("Making directories:", dirs) + os.makedirs(dirs, exist_ok = True) + + def copyFile(self, src, dest): + print("Copying from:", src, "to:", dest) + shutil.copyfile(src, dest) + +class AtlasLayoutCopierPost2_0_14(Copier): + def __init__(self): + Copier.__init__(self, "atlaslayout") + + def transfer(self, buildRoot, softwareRelease): + # Do a copy if required + if CommonLibrary.includeAtlas == "true": + # Source + srcRelPath = os.path.join(CommonLibrary.workspace, self.releaseFolderPath) + + releaseInstaller = os.path.join(srcRelPath, "x64", "GIS Atlas 2", "DiskImages", "DISK1", "GIS Atlas Layout.exe") + + # Destination + atlasLayoutBuildRoot = os.path.join(buildRoot, "GIS Atlas Layout Installer") + self.makeDirectories(atlasLayoutBuildRoot) + destName = os.path.join(atlasLayoutBuildRoot, "GIS Inkjet OS " + softwareRelease + " Atlas Installer.exe") + self.copyFile(releaseInstaller, destName) + + +class AtlasSDKCopier(Copier): + def __init__(self): + Copier.__init__(self, "atlassdk") + + def transfer(self, buildRoot, softwareRelease): + # Do a copy if required + if CommonLibrary.includeAtlasSDK == "true": + # Source + srcRelPath = os.path.join(CommonLibrary.workspace, self.releaseFolderPath) + releaseInstaller = os.path.join(srcRelPath, "x64", "GIS Atlas SDK", "DiskImages", "DISK1", "GIS Atlas SDK.exe") + + # Destination + atlasSDKBuildRoot = os.path.join(buildRoot, "GIS Atlas Tools SDK Installer") + self.makeDirectories(atlasSDKBuildRoot) + destName = os.path.join(atlasSDKBuildRoot, "GIS Atlas Tools SDK " + softwareRelease + " Installer.exe") + self.copyFile(releaseInstaller, destName) + +class InkSystemUICopierPost2_0_19(Copier): + def __init__(self): + Copier.__init__(self, "inksysui") + + def transfer(self, buildRoot, softwareRelease): + # Do a copy if required + if CommonLibrary.includeInkSystemUI == "true": + # Source + srcRelPath = os.path.join(CommonLibrary.workspace, self.releaseFolderPath) + releaseInstaller = os.path.join(srcRelPath, "x64", "GIS Ink System Configuration UI", "DiskImages", "DISK1", "GIS Atlas Ink System Configuration UI.exe") + + # Destination + inkSystemConfigurationUIBuildRoot = os.path.join(buildRoot, "GIS Ink System UI Installer", "Configuration UI") + self.makeDirectories(inkSystemConfigurationUIBuildRoot) + destName = os.path.join(inkSystemConfigurationUIBuildRoot, "GIS Atlas Ink System Configuration UI " + softwareRelease + " Installer.exe") + self.copyFile(releaseInstaller, destName) + + # Source + releaseInstaller = os.path.join(srcRelPath, "x64", "GIS Ink System Operator UI", "DiskImages", "DISK1", "GIS Atlas Ink System Operator UI.exe") + + # Destination + inkSystemOperatorUIBuildRoot = os.path.join(buildRoot, "GIS Ink System UI Installer", "Operator UI") + self.makeDirectories(inkSystemOperatorUIBuildRoot) + destName = os.path.join(inkSystemOperatorUIBuildRoot, "GIS Atlas Ink System Operator UI " + softwareRelease + " Installer.exe") + self.copyFile(releaseInstaller, destName) + + # Source + releaseInstaller = os.path.join(srcRelPath, "x64", "GIS Ink System Tool Modules", "DiskImages", "DISK1", "GIS Atlas Ink System Tool Modules.exe") + + # Destination + inkSystemOperatorUIModuleBuildRoot = os.path.join(buildRoot, "GIS Ink System UI Installer", "Operator UI Module") + self.makeDirectories(inkSystemOperatorUIModuleBuildRoot) + destName = os.path.join(inkSystemOperatorUIModuleBuildRoot, "GIS Atlas Ink System Operator UI Module " + softwareRelease + " Installer.exe") + self.copyFile(releaseInstaller, destName) + +class McsToolsCopierPost2_0_28(Copier): + def __init__(self): + Copier.__init__(self, "atlasmcstools") + + def transfer(self, buildRoot, softwareRelease): + # Do a copy if required + if CommonLibrary.includeMCS == "true": + # Source + srcRelPath = os.path.join(CommonLibrary.workspace, self.releaseFolderPath) + releaseInstaller = os.path.join(srcRelPath, "x64", "GIS MCS Tool Modules", "DiskImages", "DISK1", "GIS Atlas MCS Tool Modules.exe") + + # Destination + mcsToolsBuildRoot = os.path.join(buildRoot, "GIS Atlas MCS Tool Modues Installer") + self.makeDirectories(mcsToolsBuildRoot) + destName = os.path.join(mcsToolsBuildRoot, "GIS MCS Tool Modules " + softwareRelease + " Installer.exe") + self.copyFile(releaseInstaller, destName) + +class AtlasUIReleaseNotesCopier(Copier): + def __init__(self): + Copier.__init__(self, "atlasreleasenotes") + + def transfer(self, buildRoot, softwareRelease): + # Unconditionally copy release notes + + # Source + srcRelPath = os.path.join(CommonLibrary.workspace, self.releaseFolderPath) + releaseInstaller = os.path.join(srcRelPath, "Release Notes.txt") + + # Destination + releaseNotesBuildRoot = buildRoot + self.makeDirectories(releaseNotesBuildRoot) + destName = os.path.join(releaseNotesBuildRoot, "Release Notes.txt") + self.copyFile(releaseInstaller, destName) \ No newline at end of file diff --git a/publish/reset_imports_and_exports.bat b/publish/reset_imports_and_exports.bat new file mode 100644 index 0000000..773eb76 --- /dev/null +++ b/publish/reset_imports_and_exports.bat @@ -0,0 +1,8 @@ +REM Reset imports and exports folders +echo Removing previous imports and exports +del dir_built.txt +del tree_built.txt +del ftp_script.txt +del transfer.txt +rmdir /s /q imports +exit /b 0 diff --git a/release_to_git/javascript_release_to_git.gsh b/release_to_git/javascript_release_to_git.gsh new file mode 100644 index 0000000..60ffdd2 --- /dev/null +++ b/release_to_git/javascript_release_to_git.gsh @@ -0,0 +1,149 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + configurationhelper = load("${WORKSPACE}/Common_scripts/configuration/configuration.gsh") + githelper = load("${WORKSPACE}/Common_scripts/versioncontrol/git.gsh") + echo "Uncomment me" + //configurationhelper.registerPipelineScriptConfiguration() + } + } + } + stage('Clean workspace') { + when { + expression { + env.CLEAN_WORKSPACE == "true" + } + } + steps { + // Save any script files that were loaded into the workspace at first and are required after cleaning the workspace + stash allowEmpty: true, includes: 'Common_scripts/**/*', name: 'Clean workspace stash', useDefaultExcludes: false + cleanWs() + unstash name: 'Clean workspace stash' + } + } + stage('Nothing to build check') { + when { + expression { + env.RELEASE_COMMIT == "false" + } + } + steps { + echo 'No installers to build' + script { + currentBuild.result = 'UNSTABLE' + } + } + } + stage('Checkout dependencies') { + when { + expression { + env.RELEASE_COMMIT == "true" + } + } + steps { + script { + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister('python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + SOURCEURL = 'git@hydra:gis/Hmb_Js_Client.git' + SOURCEBRANCH = "${SOURCE_BRANCH}" + SOURCEDIR = "${WORKSPACE}\\jsclient" + SOURCEROOTDIR = 'jsclient' + configurationhelper.gitCheckoutAndRegister('jsclient', SOURCEURL, SOURCEBRANCH, SOURCEDIR, SOURCEROOTDIR) + env.SOURCE_PATH = "${SOURCEDIR}" + } + } + } + stage("Clean imports") { + steps { + script { + env.IMPORTSPATH = "${WORKSPACE}/imports" + } + dir("${IMPORTSPATH}") { + echo "Deleting directories in ${IMPORTSPATH}" + deleteDir() + } + } + } + stage("Import binaries and versions") { + when { + expression { + env.RELEASE_COMMIT == "true" + } + } + steps { + script { + projectImports = [ + [ 'Build', "${BUILD_JOB}", "${IMPORTSPATH}", 'jsclient/**,version/**', false ], + ] + for (projectImport in projectImports) { + (importName, sourceProject, destFolder, toCopy, checkImports) = projectImport + copyArtifacts excludes: '', filter: toCopy, fingerprintArtifacts: true, projectName: "${sourceProject}", selector: lastSuccessful(), target: "${destFolder}" + if (checkImports) { + env.importDest = destFolder + bat ''' + "%PYTHON%" "%SOURCE_PATH%\\autobuild\\common\\fingerprint.py" -f "%importDest%\\pipeline\\hashes.txt" -v -p "%importDest%" + ''' + } + } + } + } + } + stage("Release to git") { + when { + expression { + env.RELEASE_COMMIT == "true" + } + } + steps { + script { + bat ''' + "%PYTHON34%" -u "%SOURCE_PATH%\\autobuild\\releasetogit\\conditional_add.py" + ''' + } + } + } + stage('Check for unstable build') { + when { + expression { + env.RELEASE_COMMIT == "true" + } + } + steps { + script { + if (env.DRY_RUN_PUSH == "true") { + echo "Not pushing the content to git therefore marking building unstable" + currentBuild.result = 'UNSTABLE' + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' +/* + step([$class: 'LogParserPublisher', + parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', + useProjectRule: true + ]) + */ + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/release_to_git/release_to_git.gsh b/release_to_git/release_to_git.gsh new file mode 100644 index 0000000..6a21a13 --- /dev/null +++ b/release_to_git/release_to_git.gsh @@ -0,0 +1,150 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + configurationhelper = load("${WORKSPACE}/Common_scripts/configuration/configuration.gsh") + githelper = load("${WORKSPACE}/Common_scripts/versioncontrol/git.gsh") + echo "Uncomment me" + //configurationhelper.registerPipelineScriptConfiguration() + } + } + } + stage('Clean workspace') { + when { + expression { + env.CLEAN_WORKSPACE == "true" + } + } + steps { + // Save any script files that were loaded into the workspace at first and are required after cleaning the workspace + stash allowEmpty: true, includes: 'Common_scripts/**/*', name: 'Clean workspace stash', useDefaultExcludes: false + cleanWs() + unstash name: 'Clean workspace stash' + } + } + stage('Nothing to build check') { + when { + expression { + env.RELEASE_COMMIT == "false" + } + } + steps { + echo 'No installers to build' + script { + currentBuild.result = 'UNSTABLE' + } + } + } + stage('Checkout dependencies') { + when { + expression { + env.RELEASE_COMMIT == "true" + } + } + steps { + script { + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister('python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEBRANCH = "${SOURCE_BRANCH}" + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + SOURCEROOTDIR = 'atlas_ui' + configurationhelper.gitCheckoutAndRegister('atlas_ui', SOURCEURL, SOURCEBRANCH, SOURCEDIR, SOURCEROOTDIR) + env.SOURCE_PATH = "${SOURCEDIR}" + } + } + } + stage("Clean imports") { + steps { + script { + env.IMPORTSPATH = "${WORKSPACE}/imports" + } + dir("${IMPORTSPATH}") { + echo "Deleting directories in ${IMPORTSPATH}" + deleteDir() + } + } + } + stage("Import binaries and versions") { + when { + expression { + env.RELEASE_COMMIT == "true" + } + } + steps { + script { + projectImports = [ + [ 'Installers and Binaries', "${INSTALLER_BUILD_JOB}", "${IMPORTSPATH}/install", '**', true ], + [ 'Build', "${BUILD_JOB}", "${IMPORTSPATH}/build", 'version/**,pipeline/**', false ], + ] + for (projectImport in projectImports) { + (importName, sourceProject, destFolder, toCopy, checkImports) = projectImport + copyArtifacts excludes: '', filter: toCopy, fingerprintArtifacts: true, projectName: "${sourceProject}", selector: lastSuccessful(), target: "${destFolder}" + if (checkImports) { + env.importDest = destFolder + bat ''' + "%PYTHON%" "%SOURCE_PATH%\\autobuild\\common\\fingerprint.py" -f "%importDest%\\pipeline\\hashes.txt" -v -p "%importDest%" + ''' + } + } + } + } + } + stage("Release to git") { + when { + expression { + env.RELEASE_COMMIT == "true" + } + } + steps { + script { + bat ''' + "%PYTHON34%" -u "%WORKSPACE%\\atlas_ui\\autobuild\\releasetogit\\conditional_add.py" + ''' + } + } + } + stage('Check for unstable build') { + when { + expression { + env.RELEASE_COMMIT == "true" + } + } + steps { + script { + if (env.DRY_RUN_PUSH == "true") { + echo "Not pushing the content to git therefore marking building unstable" + currentBuild.result = 'UNSTABLE' + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' +/* + step([$class: 'LogParserPublisher', + parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', + useProjectRule: true + ]) + */ + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/resharper/atlas_ink_resharper.groovy b/resharper/atlas_ink_resharper.groovy new file mode 100644 index 0000000..b291e9a --- /dev/null +++ b/resharper/atlas_ink_resharper.groovy @@ -0,0 +1,206 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + // Timeout becasue Resharper sometimes hangs indefinitely + options { + timeout(time: 1, unit:'HOURS') + } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + SOURCEROOTDIR = 'atlas_ui' + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\code_analysis" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/build" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + env.AULIB = "${WORKSPACE}/atlaslibraries" + env.TESTRESULTS = "${WORKSPACE}/testresults" + env.PSSOURCE = "${WORKSPACE}/newsw" + cleanfolders = [ + BUILDOUTPUT, + "${WORKSPACE}/SharedPackages", + PSBIN, + ASBIN, + AULIB, + "${WORKSPACE}/binInk", + "${WORKSPACE}/documentation", + TESTRESULTS, + ] + 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('Import Atlas UI libraries') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + libmeta = importer.artifactimport(meta, + ATLAS_UI_ARTIFACT_LOCATION, + ATLAS_UI_COMPILE_JOB, + ATLAS_UI_BUILD_SELECTOR, + ATLAS_UI_RELEASE_REPO, + ATLAS_UI_RELEASE_REVISION, + AULIB, + false) + } + } + } + stage('Import Print server to adjust version number') { + steps { + script { + def psartifactfiles = "meta/**" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) // This should increment the version number + } + } + } + stage('Import Atlas services to adjust version number') { + steps { + script { + def asartifactfiles = "meta/**" + asmeta = importer.artifactimport(meta, + ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION, + ASBIN, + true, + asartifactfiles) + } + } + } + stage('Version stamp files') { + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate + env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp + bat """ + call "${JOBSCRIPTS_COMMON}\\version_ink_ui_files.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Analyse resharper') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + call "${JOBSCRIPTS}\\build_and_analyse_ink_ui.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Analysis') { + steps { + recordIssues enabledForFailure: true, tool: resharperInspectCode(pattern: 'results/atlas_ink_ui_resharper_results.xml'), qualityGates:[[threshold: 1000, type: 'TOTAL', unstable: true],[threshold: 1250, type: 'TOTAL', unstable: false]] + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["results/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/resharper/atlas_sdk_resharper.groovy b/resharper/atlas_sdk_resharper.groovy new file mode 100644 index 0000000..9c60f76 --- /dev/null +++ b/resharper/atlas_sdk_resharper.groovy @@ -0,0 +1,208 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + // Timeout becasue Resharper sometimes hangs indefinitely + options { + timeout(time: 1, unit:'HOURS') + } + 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" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\code_analysis" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/build" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + env.PSSOURCE = "${WORKSPACE}/newsw" + cleanfolders = [ + BUILDOUTPUT, + "${WORKSPACE}/SharedPackages", + PSBIN, + ASBIN, + "${WORKSPACE}/bin", + "${WORKSPACE}/binKiosk", + "${WORKSPACE}/documentation", + "${WORKSPACE}/ildasm", + "${WORKSPACE}/Libraries", + "${WORKSPACE}/Atlas Release", + "${WORKSPACE}/LocalisationSDK", + ] + 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('Import Print server dependencies') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def psartifactfiles = "meta/**,bin/x64/Release/Engine - Render.dll,bin/x64/Release/Engine - Render.lib,bin/x64/Release/Engine - Render.pdb,bin/x64/Release/TBarCode11_x64.dll,bin/x64/Release/GIS Utility - Toolbox.dll,bin/x64/Release/GIS Utility - Toolbox.lib,bin/x64/Release/GIS Utility - Toolbox.pdb,bin/x64/Release/zlib1.dll,bin/x64/Release/zlib1.lib,bin/x64/Release/zlib1.pdb,bin/x64/Release/GIS Utility - TCP-IP Comms.dll,bin/x64/Release/GIS Utility - TCP-IP Comms.lib,bin/x64/Release/GIS Utility - TCP-IP Comms.pdb,bin/x64/Release/Dialog - Tree Node Editor.dll,bin/x64/Release/Dialog - Tree Node Editor.lib,bin/x64/Release/Dialog - Tree Node Editor.pdb" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) + } + } + } + stage('Checkout relevant Print server source') { + steps { + script { + def pssourceartifacts = "src/Engine Common" + def pssourceurl = psmeta.gitinfo.remoteurl + def pscommit = psmeta.gitinfo.gitrevision + + configurationhelper.gitCheckoutAndRegister(meta, 'print_server_source', pssourceurl, pscommit, PSSOURCE, '', 0, false, pssourceartifacts) + } + } + } + stage('Import Atlas services dependencies') { + steps { + script { + def asartifactfiles = "meta/**,SharedPackages/**" + asmeta = importer.artifactimport(meta, + ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION, + ASBIN, + true, + asartifactfiles) + } + } + } + stage('Version files') { + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate + env.PS_VERSION="1.0.${psmeta.buildstampinfo.revision}.0" + env.PS_PACKAGE_VERSION=psmeta.buildstampinfo.buildstampprefix + env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp + bat """ + call "${JOBSCRIPTS_COMMON}\\create_ps_nuget.bat" + if errorlevel 1 exit /b 1 + call "${JOBSCRIPTS_COMMON}\\version_atlas_ui_files.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Analyse resharper') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + call "${JOBSCRIPTS}\\build_and_analyse_atlas_sdk.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + + stage('Analysis') { + steps { + recordIssues enabledForFailure: true, tool: resharperInspectCode(pattern: 'results/**'), qualityGates:[[threshold: 230, type: 'TOTAL', unstable: true],[threshold: 250, type: 'TOTAL', unstable: false]] + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["results/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/resharper/atlas_ui_resharper.groovy b/resharper/atlas_ui_resharper.groovy new file mode 100644 index 0000000..6cb119b --- /dev/null +++ b/resharper/atlas_ui_resharper.groovy @@ -0,0 +1,208 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + // Timeout becasue Resharper sometimes hangs indefinitely + options { + timeout(time: 1, unit:'HOURS') + } + 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" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\code_analysis" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/build" + env.PSBIN = "${WORKSPACE}/ps_bin" + env.ASBIN = "${WORKSPACE}/as_bin" + env.PSSOURCE = "${WORKSPACE}/newsw" + cleanfolders = [ + BUILDOUTPUT, + "${WORKSPACE}/SharedPackages", + PSBIN, + ASBIN, + "${WORKSPACE}/bin", + "${WORKSPACE}/binKiosk", + "${WORKSPACE}/documentation", + "${WORKSPACE}/ildasm", + "${WORKSPACE}/Libraries", + "${WORKSPACE}/Atlas Release", + "${WORKSPACE}/LocalisationSDK", + ] + 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('Import Print server dependencies') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def psartifactfiles = "meta/**,bin/x64/Release/Engine - Render.dll,bin/x64/Release/Engine - Render.lib,bin/x64/Release/Engine - Render.pdb,bin/x64/Release/TBarCode11_x64.dll,bin/x64/Release/GIS Utility - Toolbox.dll,bin/x64/Release/GIS Utility - Toolbox.lib,bin/x64/Release/GIS Utility - Toolbox.pdb,bin/x64/Release/zlib1.dll,bin/x64/Release/zlib1.lib,bin/x64/Release/zlib1.pdb,bin/x64/Release/GIS Utility - TCP-IP Comms.dll,bin/x64/Release/GIS Utility - TCP-IP Comms.lib,bin/x64/Release/GIS Utility - TCP-IP Comms.pdb,bin/x64/Release/Dialog - Tree Node Editor.dll,bin/x64/Release/Dialog - Tree Node Editor.lib,bin/x64/Release/Dialog - Tree Node Editor.pdb" + psmeta = importer.artifactimport(meta, + PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION, + PSBIN, + true, + psartifactfiles) + } + } + } + stage('Checkout relevant Print server source') { + steps { + script { + def pssourceartifacts = "src/Engine Common" + def pssourceurl = psmeta.gitinfo.remoteurl + def pscommit = psmeta.gitinfo.gitrevision + + configurationhelper.gitCheckoutAndRegister(meta, 'print_server_source', pssourceurl, pscommit, PSSOURCE, '', 0, false, pssourceartifacts) + } + } + } + stage('Import Atlas services dependencies') { + steps { + script { + def asartifactfiles = "meta/**,SharedPackages/**" + asmeta = importer.artifactimport(meta, + ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION, + ASBIN, + true, + asartifactfiles) + } + } + } + stage('Version files') { + steps { + script { + env.BUILD_STAMP=meta.buildstampinfo.buildstamp + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate + env.PS_VERSION="1.0.${psmeta.buildstampinfo.revision}.0" + env.PS_PACKAGE_VERSION=psmeta.buildstampinfo.buildstampprefix + env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp + bat """ + call "${JOBSCRIPTS_COMMON}\\create_ps_nuget.bat" + if errorlevel 1 exit /b 1 + call "${JOBSCRIPTS_COMMON}\\version_atlas_ui_files.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + stage('Analyse resharper') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + call "${JOBSCRIPTS}\\build_and_analyse_atlas.bat" + if errorlevel 1 exit /b 1 + """ + } + } + } + + stage('Analysis') { + steps { + recordIssues enabledForFailure: true, tool: resharperInspectCode(pattern: 'results/atlas_resharper_results.xml'), qualityGates:[[threshold: 1000, type: 'TOTAL', unstable: true],[threshold: 4500, type: 'TOTAL', unstable: false]] + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["results/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/resharper/ccm.groovy b/resharper/ccm.groovy new file mode 100644 index 0000000..3670ab4 --- /dev/null +++ b/resharper/ccm.groovy @@ -0,0 +1,144 @@ +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" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' + VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" + VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" + VERSTAMPINGROOTDIR = 'ver_stamping_releases' + configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) + } + } + } + stage('Checkout CCM Tools') { + steps { + script { + CCMSOURCEURL = 'git@hydra:tools/ccm.git' + CCMSOURCEDIR = "${WORKSPACE}\\ccm" + CCMSOURCEREVISION = CCM_SOURCE_REVISION + configurationhelper.gitCheckoutAndRegister(meta, 'ccm', CCMSOURCEURL, CCMSOURCEREVISION, CCMSOURCEDIR, '', 0, false) + env.CCM_SOURCE_PATH = CCMSOURCEDIR + env.CCM_SRC = CCM_SOURCE_PATH + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\code_analysis" + env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" + env.SRC = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + env.BUILDOUTPUT = "${WORKSPACE}/results" + cleanfolders = [ + BUILDOUTPUT + ] + 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('CCM Analysis') { + steps { + script { + env.SRC_REVISION=SOURCE_REVISION + bat """ + rmdir /s /q "${BUILDOUTPUT}" + mkdir "${BUILDOUTPUT}" + + "${CCM_SRC}/bin/CCM.exe" "${JOBSCRIPTS}/ccm.config" > "${BUILDOUTPUT}/atlasui_ccm.xml" + if errorlevel 1 exit /b 1 + """ + } + } + } + + stage('Analysis') { + steps { + recordIssues enabledForFailure: true, tool: ccm(pattern: 'results/**'), qualityGates:[[threshold: 150, type: 'TOTAL', unstable: true],[threshold: 200, type: 'TOTAL', unstable: false]] + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ +/* Binaries are signed + 'build/**', + 'SharedPackages/**', +*/ + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["results/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/static_analysis/static_analysis.groovy b/static_analysis/static_analysis.groovy new file mode 100644 index 0000000..3248b7a --- /dev/null +++ b/static_analysis/static_analysis.groovy @@ -0,0 +1,123 @@ +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() + + SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEREVISION = "${SOURCE_REVISION}".trim() + SOURCEROOTDIR = 'atlas_ui' + SOURCEDIR = "${WORKSPACE}/atlas_ui" + configurationhelper.gitCheckoutAndRegister(meta, SOURCEROOTDIR, SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + } + } + } + stage('Import Print server to adjust version number') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + psartifactfiles = "meta/**" + importer.artifactimport(meta, PRINT_SERVER_ARTIFACT_LOCATION, PRINT_SERVER_COMPILE_JOB, PRINT_SERVER_BUILD_SELECTOR, PRINT_SERVER_RELEASE_REPO, PRINT_SERVER_RELEASE_REVISION, 'ps_bin', true, psartifactfiles) + } + } + } + stage('Import Atlas services to adjust version number') { + steps { + script { + asartifactfiles = "meta/**" + importer.artifactimport(meta, ATLAS_SERVICES_ARTIFACT_LOCATION, ATLAS_SERVICES_COMPILE_JOB, ATLAS_SERVICES_BUILD_SELECTOR, ATLAS_SERVICES_RELEASE_REPO, ATLAS_SERVICES_RELEASE_REVISION, 'as_bin', true, asartifactfiles) + } + } + } + stage('Atlas static analysis') { + parallel { + stage('Measure Atlas code complexity') { + steps { + script { + ccm = build job: "${ATLAS_CCM_ANALYSIS_JOB}", propagate: false + + if(ccm.result.equals("UNSTABLE") || ccm.result.equals("FAILURE")) + { + currentBuild.result = ccm.result + } + + } + } + } + stage('Perform Atlas UI Resharper Analysis') { + steps { + script { + atlas = build job: "${ATLAS_RESHARPER_ANALYSIS_JOB}", propagate: false + if(!currentBuild.result.equals("FAILURE")) + { + if(atlas.result.equals("UNSTABLE") || atlas.result.equals("FAILURE")) + { + currentBuild.result = atlas.result + } + } + } + } + } + stage('Perform Atlas SDK Resharper Analysis') { + steps { + script { + sdk = build job: "${ATLAS_SDK_RESHARPER_ANALYSIS_JOB}", propagate: false + if(!currentBuild.result.equals("FAILURE")) + { + if(sdk.result.equals("UNSTABLE") || sdk.result.equals("FAILURE")) + { + currentBuild.result = sdk.result + } + } + } + } + } + stage('Perform Atlas Ink UI Resharper Analysis') { + steps { + script { + ink = build job: "${ATLAS_INK_UI_RESHARPER_ANALYSIS_JOB}", propagate: false + if(!currentBuild.result.equals("FAILURE")) + { + if(ink.result.equals("UNSTABLE") || ink.result.equals("FAILURE")) + { + currentBuild.result = ink.result + } + } + } + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'FAILURE build' +/* + step([$class: 'LogParserPublisher', + parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', + useProjectRule: true + ]) + */ + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + diff --git a/test/check_node_status.groovy b/test/check_node_status.groovy new file mode 100644 index 0000000..a7e59b4 --- /dev/null +++ b/test/check_node_status.groovy @@ -0,0 +1,44 @@ +pipeline { + agent { label "VirtualBoxHost" } + stages { + stage('Checkout test utilites') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/master']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'Utilities']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/Utilities.git']]]) + } + } + + stage('USE_CONFIG as true') { + when { + expression { + "${USE_CONFIG}" == "true" + } + } + steps { + script { + sh ''' + python3.6 Utilities/nodeState/node.py -n ${NODE_NAME} -c ${CONFIG} + ''' + } + } + } + stage('USE_CONFIG as false') { + when { + expression { + "${USE_CONFIG}" == "false" + } + } + steps { + script { + sh ''' + python3.6 Utilities/nodeState/node.py -n ${NODE_NAME} + ''' + } + } + } + } + +} \ No newline at end of file diff --git a/test/check_te_licences.groovy b/test/check_te_licences.groovy new file mode 100644 index 0000000..0294159 --- /dev/null +++ b/test/check_te_licences.groovy @@ -0,0 +1,23 @@ +pipeline { + agent { label "VirtualBoxHost" } + stages { + stage('Checkout test utilites') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/master']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'Utilities']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/Utilities.git']]]) + } + } + stage('Check available TE licences') { + steps { + script { + sh ''' + python3.6 Utilities/TE_licence_checker/licence_checker.py -m ${MAX_TE_LICENCES} -t ${TIMEOUT} + ''' + } + } + } + } +} \ No newline at end of file diff --git a/test/flesh_install_dispatcher.groovy b/test/flesh_install_dispatcher.groovy new file mode 100644 index 0000000..07d61b8 --- /dev/null +++ b/test/flesh_install_dispatcher.groovy @@ -0,0 +1,24 @@ +pipeline { + agent { label "VirtualBoxHost" } + stages { + stage('Checkout test utilites') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/master']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'Utilities']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/Utilities.git']]]) + } + } + stage('Node dispatch') { + steps { + script { + sh ''' + python3.6 Utilities/dispatcher/node_dispatcher.py -l ${LABEL} -j ${JENKINSJOB} + ''' + } + } + } + } + +} \ No newline at end of file diff --git a/test/fresh_install_master.groovy b/test/fresh_install_master.groovy new file mode 100644 index 0000000..073f2a5 --- /dev/null +++ b/test/fresh_install_master.groovy @@ -0,0 +1,157 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Checkout test utilites') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/master']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'Utilities']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/Utilities.git']]]) + } + } + stage ('Wait for available node. Max 60min') { + steps { + script { + env.NODE = sh(script: "python3.6 Utilities/dispatcher/node_dispatcher.py -l 'FreshInstallationTest'", returnStdout: true) + } + echo "Available Node: $env.NODE" + } + } + stage ('Check VM state') { + steps{ + script{ + sh '''#!/bin/bash + echo "Check VM state" + runningVMs="$(vboxmanage list runningvms | grep $NODE)" + if [ -z "$runningVMs" ]; then exit 0; else exit 1;fi + ''' + } + } + } + stage ('Revert snapshot') { + steps{ + sh '''#!/bin/bash + echo "Revert snapshot" + VBoxManage snapshot $NODE restore "clean" + ''' + } + } + stage ('Start VM') { + steps{ + sh '''#!/bin/bash + echo "Start VM" + vboxmanage startvm $NODE --type headless + ''' + } + } + stage ('Wait till VM is up and running') { + steps{ + sh '''#!/bin/bash + echo "Wait up to 5 min till VM is up and running. " + vboxmanage guestproperty wait $NODE SysprepArgs --timeout 300000 + ''' + } + } + stage ('Change Node to JNLP') { + steps{ + sh '''#!/bin/bash + echo "Change Node to JNLP" + ''' + script { + res = build(job: "Check_Node_Status", propagate: false, + parameters:[ + string(name: 'NODE_NAME', value: "${NODE}"), + string(name: 'CONFIG', value: "jnlp.xml"), + booleanParam(name: 'USE_CONFIG', value: "true"), + ]).result + if (res != 'SUCCESS') { + currentBuild.result = 'FAILED' + error "Failed to change node status. Exiting pipeline" + } + } + } + } + stage ('Restart Jenkins Slave on VM'){ + steps{ + sh '''#!/bin/bash + echo "Stop Jenkins Slave on VM" + VBoxManage --nologo guestcontrol $NODE run --exe "c:\\Users\\jenkins_user\\Documents\\elevate.exe" --timeout 30000 --username Jenkins_user --password "ramshorn42" -- elevate /c /w net stop jenkinsslave-C__Jk + ''' + sh '''#!/bin/bash + echo "Start Jenkins Slave on VM" + VBoxManage --nologo guestcontrol $NODE run --exe "c:\\Users\\jenkins_user\\Documents\\elevate.exe" --timeout 30000 --username Jenkins_user --password "ramshorn42" -- elevate /c /w net start jenkinsslave-C__Jk + ''' + } + } + stage ('Check Node status') { + steps{ + sh '''#!/bin/bash + echo "Check Node status" + ''' + script { + res = build(job: "Check_Node_Status", propagate: false, + parameters:[ + string(name: 'NODE_NAME', value: "${NODE}"), + ]).result + if (res != 'SUCCESS') { + currentBuild.result = 'FAILED' + error "${NODE} is offline for Jenkins. Exiting pipeline" + } + } + } + } + stage ('Install GIS software') { + steps{ + script { + FreshInstallJob = build(job: "${FRESHINSTALL_TEST_JOB}", propagate: false, + parameters:[ + string(name: 'AGENT_LABEL', value: "${NODE}"), + string(name: 'ATLAS_INSTALLER_JOB', value: "${ATLAS_INSTALLER_JOB}"), + string(name: 'MCS_INSTALLER_JOB', value: "${MCS_INSTALLER_JOB}"), + string(name: 'ATLAS_PROJECT', value: "${ATLAS_PROJECT}"), + string(name: 'TESTLIST', value: "${TESTLIST}"), + string(name: 'TEST_COMPLETE_EXECUTE', value: "TE"), + string(name: 'ATLAS_REGRESSION_TEST_REVISION', value: "${ATLAS_REGRESSION_TEST_REVISION}"), + string(name: 'LOG_FOLDER', value: "Test_Output"), + ]) + if (FreshInstallJob.result != 'SUCCESS') { + currentBuild.result = 'FAILED' + } + currentBuild.description = "
" + "FreshInstallTest" + } + } + } + } + post { + always { + sh '''#!/bin/bash + echo "PowerOff VM" + VBoxManage controlvm $NODE poweroff + ''' +} + failure { + sh '''#!/bin/bash + echo "Check VM state" + runningVMs="$(vboxmanage list runningvms | grep $NODE)" + if [ -z "$runningVMs" ]; then exit 0; else exit 0;fi + ''' + sh '''#!/bin/bash + echo "Disconnecting $NODE" + curl -X POST http://surtsey/computer/$NODE/doDisconnect --basic -u test_user:ramshorn42 + ''' +} + unstable { + sh '''#!/bin/bash + echo "Post unstable" + ''' +} + success { + sh '''#!/bin/bash + echo "Post success" + echo "Disconnecting $NODE" + curl -X POST http://surtsey/computer/$NODE/doDisconnect --basic -u test_user:ramshorn42 + ''' +} +} +} \ No newline at end of file diff --git a/test/fresh_install_test.groovy b/test/fresh_install_test.groovy new file mode 100644 index 0000000..ccc6398 --- /dev/null +++ b/test/fresh_install_test.groovy @@ -0,0 +1,203 @@ +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() + + RESULT_SOURCE_URL = "git@hydra:gistestresults/test_results.git" + RESULT_SOURCE_REVISION = "origin/master" + RESULT_SOURCE_DIR = "${WORKSPACE}/${HISTORY_FOLDER}" + configurationhelper.gitCheckoutAndRegister(meta, "TestResults", RESULT_SOURCE_URL, RESULT_SOURCE_REVISION, RESULT_SOURCE_DIR, "", 0, false) + + CORE_SOURCE_URL = "git@hydra:gistest/giscorelite.git" + CORE_SOURCE_REVISION = "${GISCORE}" + CORE_SOURCE_DIR = "${WORKSPACE}/GisCore" + configurationhelper.gitCheckoutAndRegister(meta, "TestCore", CORE_SOURCE_URL, CORE_SOURCE_REVISION, CORE_SOURCE_DIR, "", 0, false) + + CORE_SOURCE_URL = "git@hydra:gistest/Utilities.git" + CORE_SOURCE_REVISION = "origin/master" + CORE_SOURCE_DIR = "${WORKSPACE}/Utilities" + configurationhelper.gitCheckoutAndRegister(meta, "TestCore", CORE_SOURCE_URL, CORE_SOURCE_REVISION, CORE_SOURCE_DIR, "", 0, false) + + 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" + } + } + } + stage('Set Description'){ + steps{ + script{ + currentBuild.displayName = ATLAS_INSTALLER_JOB.split("_")[1] + currentBuild.description = TESTLIST + "
node: ${env.NODE_NAME}" + } + } + } + stage('Checkout test scripts') { + steps { + script { + TEST_SOURCE_URL = "git@hydra:gis/atlaskiosksdk_test.git" + TEST_SOURCE_REVISION = "${ATLAS_REGRESSION_TEST_REVISION}" + TEST_SOURCE_DIR = "${WORKSPACE}/testscripts" + configurationhelper.gitCheckoutAndRegister(meta, "TestScripts", TEST_SOURCE_URL, TEST_SOURCE_REVISION, TEST_SOURCE_DIR, "", 0, false) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, TEST_SOURCE_REVISION, TEST_SOURCE_DIR ) + } + } + } + stage ("Force clean artifacts"){ + steps { + script{ + bat """ + call GisCore/jobscripts/reset_imports_and_exports.bat + call GisCore/jobscripts/create_hwtest_shortpath_output.bat + if errorlevel 1 exit /b 1 + """ + } + } + } + stage("Copy artifacts") { + steps { + script { + + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + echo "Take the Atlas Server installer from the selected build job." + ATLAS_SERVER_ARTIFACT_PROJECT = "${MCS_INSTALLER_JOB}" + ATLAS_SERVER_ARTIFACT_FOLDER = "${WORKSPACE}/imports/mcs" + ATLAS_SERVER_ARTIFACT_FILTER = "core_installer/installers/*.exe ,meta/**" + ATLAS_SERVER_ARTIFACT_SELECTOR = "${MCS_INSTALLER_SELECTOR}" + ATLAS_SERVER_APPLICATION = importer.artifactimport(meta, ATLAS_SERVER_ARTIFACT_PROJECT, ATLAS_SERVER_ARTIFACT_SELECTOR, ATLAS_SERVER_ARTIFACT_FOLDER, true, ATLAS_SERVER_ARTIFACT_FILTER) + echo "Copied Atlas Server installer" + + echo "Take the Print Server installer from the selected build job." + PRINT_SERVER_ARTIFACT_PROJECT = "${PRINTSERVER_INSTALLER_JOB}" + PRINT_SERVER_ARTIFACT_FOLDER = "${WORKSPACE}/imports/printserver" + PRINT_SERVER_ARTIFACT_FILTER = "installers/installers/ALL/*.exe ,meta/**" + PRINT_SERVER_ARTIFACT_SELECTOR = "${PRINTSERVER_INSTALLER_SELECTOR}" + PRINT_SERVER_APPLICATION = importer.artifactimport(meta, PRINT_SERVER_ARTIFACT_PROJECT, PRINT_SERVER_ARTIFACT_SELECTOR, PRINT_SERVER_ARTIFACT_FOLDER, true, PRINT_SERVER_ARTIFACT_FILTER) + echo "Copied Print Server installer" + + + echo "Take the Atlas UI installer from the selected build job." + ATLAS_UI_ARTIFACT_PROJECT = "${ATLAS_INSTALLER_JOB}" + ATLAS_UI_ARTIFACT_FOLDER = "${WORKSPACE}/imports/atlas" + ATLAS_UI_ARTIFACT_FILTER = "atlas_pro_installers/installers/**/*.exe, ink_ui_installers/installers/**/*.exe ,meta/**" + ATLAS_UI_ARTIFACT_SELECTOR = "${ATLAS_INSTALLER_SELECTOR}" + ATLAS_UI_APPLICATION = importer.artifactimport(meta, ATLAS_UI_ARTIFACT_PROJECT, ATLAS_UI_ARTIFACT_SELECTOR, ATLAS_UI_ARTIFACT_FOLDER, true, ATLAS_UI_ARTIFACT_FILTER) + echo "Copied Atlas UI installer" + } + } + } + stage('Save environment variable(s) to file for TestExecute bug') { + steps { + script { + bat ''' + set WORKSPACE > "%SystemRoot%/Temp/environment-variables-from-jenkins.txt" + ''' + } + } + } + stage('Check available TE Licences'){ + steps{ + script { + res = build(job: "Check_TE_Licence", propagate: false).result + if (res != 'SUCCESS') { + currentBuild.result = 'FAILED' + error "No more available Test Execute licences. Stopping pipeline." + + } + } + } + } + stage('Test loop') { + steps { + script { + failureCount = 0 + String[] tests + tests = "${TESTLIST}".split(",") + tests.each { + testcompletetest generateMHT: true, launchType: 'lcItem', project: "${ATLAS_PROJECT}", suite: "testscripts/UITests/FreshInstallSuite/FreshInstallSuite.pjs", test: "${it}", useTCService: true, userName: 'jenkins_user', userPassword: 'ramshorn42', useActiveSession: true, executorType: "TE", useTimeout: true, timeout: '3600', actionOnErrors: 'MAKE_UNSTABLE' + } + } + } + } + stage("Create test results in JSON"){ + steps{ + script{ + rc =bat (script:""" + %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\testscripts\\UITests\\Utils\\HistoryStructure.py --url ${env.BUILD_URL} --ws_path ${env.WORKSPACE} --mcs_path "%WORKSPACE%\\imports\\mcs\\core_installer\\installers" --ps2_path "%WORKSPACE%\\imports\\printserver\\installers\\installers\\ALL" --aui_pro_path "%WORKSPACE%\\imports\\atlas\\atlas_pro_installers\\installers\\GIS Atlas Professional" --aui_pro4ps_path "%WORKSPACE%\\imports\\atlas\\atlas_pro_installers\\installers\\GIS Atlas Professional for Print Server" --ink_path "%WORKSPACE%\\imports\\atlas\\ink_ui_installers\\installers\\GIS Atlas Ink System Configuration UI" + """, + returnStatus: true + ) + if (rc == 1){ + unstable('FAILED to process results') + } + } + } + } + stage("Archive Test History"){ + steps{ + script{ + rc =bat (script:""" + set HistoryFail=0 + pushd %HISTORY_FOLDER% + ${env.PYTHON} GitCyclicPush.py + if %errorlevel% neq 0 (set HistoryFail=1) + popd + if %HistoryFail% neq 0 ( + exit /b 1 + ) + """, + returnStatus: true + ) + if (rc == 1){ + unstable('FAILED to process history') + } + } + } + } + stage("Archive test artifacts"){ + steps{ + script{ + def artifactlist = meta.generateartifacts(["TestSuite/**","${ATLAS_SERVER_ARTIFACT_FOLDER}/meta/**","${LOG_FOLDER}/**","GisCore/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + failure { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED" +} + success { + + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s SUCCESS" + } + unstable { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED" + +} + } +} \ No newline at end of file diff --git a/test/test_all.groovy b/test/test_all.groovy new file mode 100644 index 0000000..f9186f7 --- /dev/null +++ b/test/test_all.groovy @@ -0,0 +1,204 @@ +def CheckForTestFailures (TestObject) { + if (TestObject.result == 'UNSTABLE'){ + //currentBuild.result = 'UNSTABLE' + unstable("Tests Failed") + } + else if (TestObject.result == 'SUCCESS'){ + echo("Tests Passed") + } + else{ + //currentBuild.result = 'FAILURE' + unstable("Tests Job Failure! Investigate Job/Slave Setup") + } +} + +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + OPERATOR = 'and not' + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + subJobs = [] + } + } + } + stage ("Checkout test results history dependencies") { + steps { + script{ + configurationhelper = autobuilder.configurationhelper() + + RESULT_SOURCE_URL = "git@hydra:gistestresults/test_results.git" + RESULT_SOURCE_REVISION = "origin/master" + RESULT_SOURCE_DIR = "${WORKSPACE}/test_results" + configurationhelper.gitCheckoutAndRegister(meta, "TestResults", RESULT_SOURCE_URL, RESULT_SOURCE_REVISION, RESULT_SOURCE_DIR, "", 0, false) + + 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" + + } + } + } + stage('Check if AtlasEngineer'){ + steps{ + script{ + if ("${ATLAS_ENGINEER}" == "true") { + OPERATOR = 'and' + } + else { + OPERATOR = 'and not' + } + } + } + } + stage('Atlas Operator tests') { + parallel { + stage('Perform Rename tests.') { + steps { + script { + if ("${RUN_RENAME_TESTS}" == "true"){ + RenameTestJob = build ( + job: ATLAS_UI_META_JOB, + parameters: [ + string(name: 'MCS_BINARIES_JOB', value: MCS_BINARIES_JOB), + string(name: 'PRINT_SERVER_RENDER_FILES', value: PRINT_SERVER_RENDER_FILES), + string(name: 'ATLAS_BINARIES_JOB', value: ATLAS_BINARIES_JOB), + string(name: 'ATLAS_REGRESSION_TEST_REVISION', value: ATLAS_REGRESSION_TEST_REVISION), + string(name: 'TAG', value: '@RenameTests ' + OPERATOR + ' @AtlasEngineer'), + ], + propagate: false + ) + CheckForTestFailures(RenameTestJob) + RenameTestJob_URL = "
" + "RenameTest" + subJobs<<[ RenameTestJob, "RenameTestsResults", false, ] + } + else{ + RenameTestJob_URL = "
"} + } + } + } + stage('Perform All tests.') { + steps { + script { + if ("${RUN_ALL_TESTS}" == "true"){ + AllTestJob = build ( + job: ATLAS_UI_META_JOB, + parameters: [ + string(name: 'MCS_BINARIES_JOB', value: MCS_BINARIES_JOB), + string(name: 'PRINT_SERVER_RENDER_FILES', value: PRINT_SERVER_RENDER_FILES), + string(name: 'ATLAS_BINARIES_JOB', value: ATLAS_BINARIES_JOB), + string(name: 'ATLAS_REGRESSION_TEST_REVISION', value: ATLAS_REGRESSION_TEST_REVISION), + string(name: 'TAG', value: '@AllTests ' + OPERATOR + ' @AtlasEngineer'), + ], + propagate: false + ) + CheckForTestFailures(AllTestJob) + AllTestJob_URL = "
" + "AllTest" + subJobs<<[ AllTestJob, "AllTestsResults", false, ] + } + else{ + AllTestJob_URL = "
"} + } + } + } + stage('Perform Save and Discard tests.') { + steps { + script { + if ("${RUN_SAVEANDDISCARD_TESTS}" == "true"){ + SaveAndDiscardTestJob = build ( + job: ATLAS_UI_META_JOB, + parameters: [ + string(name: 'MCS_BINARIES_JOB', value: MCS_BINARIES_JOB), + string(name: 'PRINT_SERVER_RENDER_FILES', value: PRINT_SERVER_RENDER_FILES), + string(name: 'ATLAS_BINARIES_JOB', value: ATLAS_BINARIES_JOB), + string(name: 'ATLAS_REGRESSION_TEST_REVISION', value: ATLAS_REGRESSION_TEST_REVISION), + string(name: 'TAG', value: '@SaveAndDiscard ' + OPERATOR + ' @AtlasEngineer'), + ], + propagate: false + ) + CheckForTestFailures(SaveAndDiscardTestJob) + SaveAndDiscardTestJob_URL = "
" + "SaveAndDiscardTest" + subJobs<<[ SaveAndDiscardTestJob, "SaveAndDiscardTestsResults", false, ] + } + else{ + SaveAndDiscardTestJob_URL = "
"} + } + } + } + stage('Perform Sanity tests') { + steps { + script { + if ("${RUN_SANITY_TESTS}" == "true"){ + SanityTestJob = build ( + job: ATLAS_UI_META_JOB, + parameters: [ + string(name: 'MCS_BINARIES_JOB', value: MCS_BINARIES_JOB), + string(name: 'PRINT_SERVER_RENDER_FILES', value: PRINT_SERVER_RENDER_FILES), + string(name: 'ATLAS_BINARIES_JOB', value: ATLAS_BINARIES_JOB), + string(name: 'ATLAS_REGRESSION_TEST_REVISION', value: ATLAS_REGRESSION_TEST_REVISION), + string(name: 'TAG', value: '@SanityTests ' + OPERATOR + ' @AtlasEngineer'), + ], + propagate: false + ) + CheckForTestFailures(SanityTestJob) + SanityTestJob_URL = "
" + "SanityTest" + subJobs<<[ SanityTestJob, "CoreTestsResults", false, ] + } + else{ + SanityTestJob_URL = "
"} + } + } + } + } + } + stage('Set Description'){ + steps{ + script{ + currentBuild.description = SanityTestJob_URL + SaveAndDiscardTestJob_URL + RenameTestJob_URL + AllTestJob_URL + } + } + } + stage('Accumulate artifacts') { + steps { + script { + artifacthelper = load("${autobuilder.commonscripts()}/artifacts/metaexport.groovy") + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + artifactFolders = artifacthelper.combineSubjobArtifacts(meta, importer, subJobs) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(artifactFolders) + archiveArtifacts "${artifactlist}" + } + } + } + + } + + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + diff --git a/test/ui_mcs_tools_testing_dev.groovy b/test/ui_mcs_tools_testing_dev.groovy new file mode 100644 index 0000000..e1e476c --- /dev/null +++ b/test/ui_mcs_tools_testing_dev.groovy @@ -0,0 +1,172 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage ('Cleaning Test_Output') { + steps{ + bat'''if exist %WORKSPACE%\\Test_Output rmdir /s /q %WORKSPACE%\\Test_Output''' + } + } + stage ('Cleaning imports') { + steps{ + bat'''if exist %WORKSPACE%\\imports rmdir /s /q %WORKSPACE%\\imports''' + } + } + stage('Clean workspace') { + when { + expression { + "${CLEAN_WORKSPACE}" == "true" + } + } + steps { + cleanWs() + } + } + stage("checkout python"){ + steps{ + checkout([$class: 'GitSCM', + branches: [[name: 'origin/3.6.3_windows']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'python']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:tools/python.git']]]) + script{ + env.PYTHON = "${WORKSPACE}/python/ver/python.exe" + } + } + } + stage('Checkout source') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/${TEST_BRANCH}']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'testscripts']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gis/atlaskiosksdk_test.git']]]) + } + } + stage('Checkout GisCore') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/${GISCORE_BRANCH}']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'GisCore']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/giscorelite.git']]]) + } + } + stage('Checkout test utilites') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/master']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'Utilities']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/Utilities.git']]]) + } + } + stage("Clean imports") { + steps { + script { + env.IMPORTSPATH = "${WORKSPACE}/imports" + } + dir("${IMPORTSPATH}") { + deleteDir() + } + } + } + stage("Clean exports") { + steps { + dir("${WORKSPACE}/uilogs") { + deleteDir() + } + dir("${WORKSPACE}/version") { + deleteDir() + } + dir("${WORKSPACE}/pipeline") { + deleteDir() + } + } + } + stage('Import artifacts') { + steps { + script { + MCS = "${IMPORTSPATH}/mcs" + echo "Obtaining MCS artifacts from ${MCS_BINARIES_JOB} job and placing at folder: ${MCS}" + copyArtifacts filter: 'build/publish/**', projectName: "${MCS_BINARIES_JOB}", selector: lastSuccessful(), target: "${MCS}" + copyArtifacts filter: 'bin/x64/Release/Engine - Render.dll,bin/x64/Release/TBarCode11_x64.dll,bin/x64/Release/GIS Utility - Toolbox.dll,bin/x64/Release/zlib1.dll,bin/x64/Release/TECIT.TBarCode.dll', flatten: true, projectName: "${PRINT_SERVER_RENDER_FILES}", selector: lastSuccessful(), target: "${MCS}/build/publish/" + + ATLAS = "${IMPORTSPATH}/atlas" + echo "Obtaining Atlas artifacts from ${ATLAS_BINARIES_JOB} job and placing at folder: ${ATLAS}" + copyArtifacts filter: 'bin/**,LocalisationSDK/**,version/**', projectName: "${ATLAS_BINARIES_JOB}", selector: lastSuccessful(), target: "${ATLAS}" + + KIOSK = "${IMPORTSPATH}/kiosk" + echo "Obtaining Atlas KIOSK artifacts from ${ATLAS_BINARIES_JOB} job and placing at folder: ${KIOSK}" + copyArtifacts filter: 'binKiosk/**,LocalisationSDK/**,version/**', projectName: "${ATLAS_BINARIES_JOB}", selector: lastSuccessful(), target: "${KIOSK}" + } + } + + } + stage ('Copy the kiosk tool files for Atlas Production') { + steps { + script { + bat ''' + "%WORKSPACE%/testscripts/UITests/SetupScripts/copy_atlas_production.bat" + ''' + } + } + } + stage('Save environment variable(s) to file for TestExecute bug') { + steps { + script { + bat ''' + set WORKSPACE > "%SystemRoot%/Temp/environment-variables-from-jenkins.txt" + ''' + } + } + } + stage('Create a VPIRender.Server.bat') { + steps { + script { + bat ''' + echo "C:/Program Files/dotnet/dotnet.exe" "%WORKSPACE%/imports/mcs/build/publish/VpiRender.Server.dll" --owner localhost:5000 > "%WORKSPACE%/imports/mcs/build/publish/VpiRender.Server.bat" + ''' + } + } + } + stage('Check available TE Licences'){ + steps{ + script { + res = build(job: "Check_TE_Licence", propagate: false).result + if (res != 'SUCCESS') { + currentBuild.result = 'FAILED' + error "No more available Test Execute licences. Stopping pipeline." + + } + } + } + } + stage('Test loop') { + steps { + script { + failureCount = 0 + String[] tests + powershell(returnStdout: true, script: '$names = @("dotnet", "Atlas Professional for Print Server", "Atlas Professional", "GIS Print Server 2", "AtlasKioskSDK", "pythonw"); foreach ($item in $names) {Get-Process -Name $item | Stop-Process}') + testcompletetest generateMHT: true, launchType: 'lcTags', project: "AtlasMCSProject", suite: "testscripts/UITests/AtlasTestSuite/AtlasTestSuite.pjs", tags: "${TAG}", useTCService: true, userName: 'jenkins_user', userPassword: 'ramshorn42', useActiveSession: true, executorType: "TE", timeout: '14400', useTimeout: true, actionOnErrors: 'MAKE_FAILED' + + } + } + } + } + post { + always { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\testscripts\\UITests\\Utils\\HistoryStructure.py --url ${env.BUILD_URL} --ws_path ${env.WORKSPACE}" + } + failure { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED" +} + success { + + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s SUCCESS" + } + unstable { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED" + +} + } +} \ No newline at end of file diff --git a/test/ui_meta_test.groovy b/test/ui_meta_test.groovy new file mode 100644 index 0000000..9c454d5 --- /dev/null +++ b/test/ui_meta_test.groovy @@ -0,0 +1,240 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage ("Initial Setup") { + steps{ + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + } + } + } + stage ("Checkout dependencies") { + steps { + script{ + configurationhelper = autobuilder.configurationhelper() + + RESULT_SOURCE_URL = "git@hydra:gistestresults/test_results.git" + RESULT_SOURCE_REVISION = "origin/master" + RESULT_SOURCE_DIR = "${WORKSPACE}/${HISTORY_FOLDER}" + configurationhelper.gitCheckoutAndRegister(meta, "TestResults", RESULT_SOURCE_URL, RESULT_SOURCE_REVISION, RESULT_SOURCE_DIR, "", 0, false) + + CORE_SOURCE_URL = "git@hydra:gistest/giscorelite.git" + CORE_SOURCE_REVISION = "${GISCORE}" + CORE_SOURCE_DIR = "${WORKSPACE}/GisCore" + configurationhelper.gitCheckoutAndRegister(meta, "TestCore", CORE_SOURCE_URL, CORE_SOURCE_REVISION, CORE_SOURCE_DIR, "", 0, false) + + CORE_SOURCE_URL = "git@hydra:gistest/Utilities.git" + CORE_SOURCE_REVISION = "origin/master" + CORE_SOURCE_DIR = "${WORKSPACE}/Utilities" + configurationhelper.gitCheckoutAndRegister(meta, "TestCore", CORE_SOURCE_URL, CORE_SOURCE_REVISION, CORE_SOURCE_DIR, "", 0, false) + + 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" + } + } + } + stage('Set Description'){ + steps{ + script{ + if (TAG.endsWith("and @AtlasEngineer")) { + currentBuild.displayName = "KIOSK: " + ATLAS_BINARIES_JOB.split("_")[1] + " " + TAG.minus("and @AtlasEngineer") + } + else{ + currentBuild.displayName = ATLAS_BINARIES_JOB.split("_")[1] + " " + TAG.minus("and not @AtlasEngineer") + } + currentBuild.description = "node: ${env.NODE_NAME}" + } + } + } + stage('Checkout test scripts') { + steps { + script { + TEST_SOURCE_URL = "git@hydra:gis/atlaskiosksdk_test.git" + TEST_SOURCE_REVISION = "${ATLAS_REGRESSION_TEST_REVISION}" + TEST_SOURCE_DIR = "${WORKSPACE}/testscripts" + configurationhelper.gitCheckoutAndRegister(meta, "TestScripts", TEST_SOURCE_URL, TEST_SOURCE_REVISION, TEST_SOURCE_DIR, "", 0, false) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, TEST_SOURCE_REVISION, TEST_SOURCE_DIR ) + } + } + } + stage ("Force clean artifacts"){ + steps { + script{ + bat """ + call GisCore/jobscripts/reset_imports_and_exports.bat + call GisCore/jobscripts/create_hwtest_shortpath_output.bat + if errorlevel 1 exit /b 1 + """ + } + } + } + stage("Copy artifacts") { + steps { + script { + + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + echo "Take the Atlas Server artifacts from the selected build job." + ATLAS_SERVER_ARTIFACT_PROJECT = "${MCS_BINARIES_JOB}" + ATLAS_SERVER_ARTIFACT_FOLDER = "${WORKSPACE}/imports/mcs" + ATLAS_SERVER_ARTIFACT_SELECTOR = "${ATLAS_SERVER_ARTIFACT_SELECTOR}" + ATLAS_SERVER_ARTIFACT_FILTER = "build/publish/**,meta/**" + ATLAS_SERVER_ARTIFACT_EXCLUDES = "**/*.pdb,**/*.lib,**/*.html,**/*.aspx,**/*.php" + ATLAS_SERVER_APPLICATION = importer.artifactimport(meta, ATLAS_SERVER_ARTIFACT_PROJECT, ATLAS_SERVER_ARTIFACT_SELECTOR, ATLAS_SERVER_ARTIFACT_FOLDER, true, ATLAS_SERVER_ARTIFACT_FILTER,ATLAS_SERVER_ARTIFACT_EXCLUDES) + echo "Copied Atlas Server Artifacts" + + echo "Take the Print Server artifacts from the selected build job." + PRINT_SERVER_ARTIFACT_PROJECT = "${PRINT_SERVER_RENDER_FILES}" + PRINT_SERVER_ARTIFACT_FOLDER = "${WORKSPACE}/imports/mcs/build/publish/" + PRINT_SERVER_ARTIFACT_SELECTOR = "${PRINT_SERVER_ARTIFACT_SELECTOR}" + PRINT_SERVER_ARTIFACT_FILTER = "bin/x64/Release/Engine - Render.dll,bin/x64/Release/TBarCode11_x64.dll,bin/x64/Release/GIS Utility - Toolbox.dll,bin/x64/Release/zlib1.dll,bin/x64/Release/TECIT.TBarCode.dll,meta/**" + PRINT_SERVER_ARTIFACT_EXCLUDES = "**/*.pdb,**/*.lib,**/*.html,**/*.aspx,**/*.php" + PRINT_SERVER_APPLICATION = importer.artifactimport(meta, PRINT_SERVER_ARTIFACT_PROJECT, PRINT_SERVER_ARTIFACT_SELECTOR, PRINT_SERVER_ARTIFACT_FOLDER, true, PRINT_SERVER_ARTIFACT_FILTER, PRINT_SERVER_ARTIFACT_EXCLUDES) + echo "Copied Print Server Render Artifacts" + + + echo "Take the Atlas UI artifacts from the selected build job." + ATLAS_UI_ARTIFACT_PROJECT = "${ATLAS_BINARIES_JOB}" + ATLAS_UI_ARTIFACT_FOLDER = "${WORKSPACE}/imports/atlas" + ATLAS_UI_ARTIFACT_SELECTOR = "${ATLAS_UI_ARTIFACT_SELECTOR}" + ATLAS_UI_ARTIFACT_FILTER = "bin/**,LocalisationSDK/**,,meta/**" + ATLAS_UI_ARTIFACT_EXCLUDES = "**/*.pdb,**/*.lib,**/*.html,**/*.aspx,**/*.php" + ATLAS_UI_APPLICATION = importer.artifactimport(meta, ATLAS_UI_ARTIFACT_PROJECT, ATLAS_UI_ARTIFACT_SELECTOR, ATLAS_UI_ARTIFACT_FOLDER, true, ATLAS_UI_ARTIFACT_FILTER,ATLAS_UI_ARTIFACT_EXCLUDES) + echo "Copied Atlas UI Artifacts" + + echo "Take the Atlas KIOS artifacts from the selected build job." + ATLAS_KIOSK_ARTIFACT_PROJECT = "${ATLAS_BINARIES_JOB}" + ATLAS_KIOSK_ARTIFACT_FOLDER = "${WORKSPACE}/imports/kiosk" + ATLAS_KIOSK_ARTIFACT_SELECTOR = "${ATLAS_UI_ARTIFACT_SELECTOR}" + ATLAS_KIOSK_ARTIFACT_FILTER = "binKiosk/**,LocalisationSDK/**,,meta/**" + ATLAS_KIOSK_ARTIFACT_EXCLUDES = "**/*.pdb,**/*.lib,**/*.html,**/*.aspx,**/*.php" + ATLAS_KIOSK_APPLICATION = importer.artifactimport(meta, ATLAS_KIOSK_ARTIFACT_PROJECT, ATLAS_KIOSK_ARTIFACT_SELECTOR, ATLAS_KIOSK_ARTIFACT_FOLDER, true, ATLAS_KIOSK_ARTIFACT_FILTER,ATLAS_KIOSK_ARTIFACT_EXCLUDES) + echo "Copied Atlas KIOS Artifacts" + + } + } + } + stage ('Copy the kiosk tool files for Atlas Production') { + steps { + script { + bat ''' + "%WORKSPACE%/testscripts/UITests/SetupScripts/copy_atlas_production.bat" + ''' + } + } + } + stage('Save environment variable(s) to file for TestExecute bug') { + steps { + script { + bat ''' + set WORKSPACE > "%SystemRoot%/Temp/environment-variables-from-jenkins.txt" + ''' + } + } + } + stage('Create a VPIRender.Server.bat') { + steps { + script { + bat ''' + echo "C:/Program Files/dotnet/dotnet.exe" "%WORKSPACE%/imports/mcs/build/publish/VpiRender.Server.dll" --owner localhost:5000 > "%WORKSPACE%/imports/mcs/build/publish/VpiRender.Server.bat" + ''' + } + } + } + stage('Check available TE Licences'){ + steps{ + script { + res = build(job: "Check_TE_Licence", propagate: false).result + if (res != 'SUCCESS') { + currentBuild.result = 'FAILED' + error "No more available Test Execute licences. Stopping pipeline." + + } + } + } + } + stage('Test loop') { + steps { + script { + failureCount = 0 + String[] tests + powershell(returnStdout: true, script: '$names = @("dotnet", "Atlas Professional for Print Server", "Atlas Professional", "GIS Print Server 2", "AtlasKioskSDK", "pythonw"); foreach ($item in $names) {Get-Process -Name $item | Stop-Process}') + testcompletetest generateMHT: true, launchType: 'lcTags', project: "${ATLAS_PROJECT}", suite: "testscripts/UITests/${ATLAS_SUITE}/${ATLAS_SUITE}.pjs", tags: "${TAG}", useTCService: true, userName: 'jenkins_user', userPassword: 'ramshorn42', useActiveSession: true, executorType: "${TEST_COMPLETE_EXECUTE}", timeout: '14400', useTimeout: true, actionOnErrors: 'MAKE_FAILED' + } + } + } + stage("Create test results in JSON"){ + steps{ + script{ + rc =bat (script:""" + %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\testscripts\\UITests\\Utils\\HistoryStructure.py --url ${env.BUILD_URL} --ws_path ${env.WORKSPACE} + """, + returnStatus: true + ) + if (rc == 1){ + unstable('FAILED to process results') + } + } + } + } + stage("Archive Test History"){ + steps{ + script{ + rc =bat (script:""" + set HistoryFail=0 + pushd %HISTORY_FOLDER% + ${env.PYTHON} GitCyclicPush.py + if %errorlevel% neq 0 (set HistoryFail=1) + popd + if %HistoryFail% neq 0 ( + exit /b 1 + ) + """, + returnStatus: true + ) + if (rc == 1){ + unstable('FAILED to process history') + } + } + } + } + stage("Archive test artifacts"){ + steps{ + script{ + def artifactlist = meta.generateartifacts(["TestSuite/**","${ATLAS_SERVER_ARTIFACT_FOLDER}/meta/**","${LOG_FOLDER}/**","GisCore/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + powershell(returnStdout: true, script: '$names = @("dotnet", "Atlas Professional for Print Server", "Atlas Professional", "GIS Print Server 2", "AtlasKioskSDK", "pythonw"); foreach ($item in $names) {Get-Process -Name $item | Stop-Process}') + } + failure { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED" +} + success { + + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s SUCCESS" + } + unstable { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED" + +} + } +} diff --git a/test/ui_printserver_testing_dev.groovy b/test/ui_printserver_testing_dev.groovy new file mode 100644 index 0000000..ea17acc --- /dev/null +++ b/test/ui_printserver_testing_dev.groovy @@ -0,0 +1,149 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage ('Cleaning Test_Output') { + steps{ + bat'''if exist %WORKSPACE%\\Test_Output rmdir /s /q %WORKSPACE%\\Test_Output''' + } + } + stage ('Cleaning imports') { + steps{ + bat'''if exist %WORKSPACE%\\imports rmdir /s /q %WORKSPACE%\\imports''' + } + } + stage('Clean workspace') { + when { + expression { + "${CLEAN_WORKSPACE}" == "true" + } + } + steps { + cleanWs() + } + } + stage("checkout python"){ + steps{ + checkout([$class: 'GitSCM', + branches: [[name: 'origin/3.6.3_windows']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'python']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:tools/python.git']]]) + script{ + env.PYTHON = "${WORKSPACE}/python/ver/python.exe" + } + } + } + stage('Checkout source') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/${TEST_BRANCH}']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'testscripts']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gis/atlaskiosksdk_test.git']]]) + } + } + stage('Checkout GisCore') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/MCSRepo']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'GisCore']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/giscorelite.git']]]) + } + } + stage('Checkout test utilites') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'origin/master']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'CleanBeforeCheckout'], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'Utilities']], + submoduleCfg: [], userRemoteConfigs: [[url: 'git@hydra:gistest/Utilities.git']]]) + } + } + stage("Clean imports") { + steps { + script { + env.IMPORTSPATH = "${WORKSPACE}/imports" + } + dir("${IMPORTSPATH}") { + deleteDir() + } + } + } + stage("Clean exports") { + steps { + dir("${WORKSPACE}/uilogs") { + deleteDir() + } + dir("${WORKSPACE}/version") { + deleteDir() + } + dir("${WORKSPACE}/pipeline") { + deleteDir() + } + } + } + stage('Import artifacts') { + steps { + script { + env.PRINTSERVER = "${IMPORTSPATH}/printserver" + echo "Obtaining Print server artifacts from ${PRINT_SERVER_BINARIES_JOB} job and placing at folder: ${PRINTSERVER}" + copyArtifacts filter: 'bin/x64/Release/*.exe, bin/x64/Release/*.dll', projectName: "${PRINT_SERVER_BINARIES_JOB}", selector: lastSuccessful(), target: "${PRINTSERVER}" + + ATLAS = "${IMPORTSPATH}/atlas" + echo "Obtaining Atlas artifacts from ${ATLAS_BINARIES_JOB} job and placing at folder: ${ATLAS}" + copyArtifacts filter: 'bin/**,LocalisationSDK/**,version/**', projectName: "${ATLAS_BINARIES_JOB}", selector: lastSuccessful(), target: "${ATLAS}" + } + } + + } + stage('Save environment variable(s) to file for TestExecute bug') { + steps { + script { + bat ''' + set WORKSPACE > "%SystemRoot%/Temp/environment-variables-from-jenkins.txt" + ''' + } + } + } + stage('Check available TE Licences'){ + steps{ + script { + res = build(job: "Check_TE_Licence", propagate: false).result + if (res != 'SUCCESS') { + currentBuild.result = 'FAILED' + error "No more available Test Execute licences. Stopping pipeline." + + } + } + } + } + stage('Test loop') { + steps { + script { + failureCount = 0 + String[] tests + tests = "${TESTLIST}".split(",") + tests.each { + powershell(returnStdout: true, script: '$names = @("dotnet", "Atlas Professional for Print Server", "Atlas Professional", "GIS Print Server 2", "AtlasKioskSDK", "pythonw"); foreach ($item in $names) {Get-Process -Name $item | Stop-Process}') + testcompletetest generateMHT: true, launchType: 'lcItem', project: "AtlasPrintServerProject", suite: "testscripts/UITests/AtlasTestSuite/AtlasTestSuite.pjs", test: "${it}", useTCService: true, userName: 'jenkins_user', userPassword: 'ramshorn42', useActiveSession: true, executorType: "TE", useTimeout: true, timeout: '10800', actionOnErrors: 'MAKE_FAILED' + } + + } + } + } + } + post { + failure { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED" +} + success { + + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s SUCCESS" + } + unstable { + bat " %WORKSPACE%\\python\\ver\\python.exe %WORKSPACE%\\Utilities\\sendEmail\\emailnotification.py -t TC -j ${env.BUILD_URL} -n ${env.JOB_NAME} -s FAILED" + +} + } +} \ No newline at end of file From 48b7e564b35cbed190dd22f5623fea9b013e3639 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Oct 2020 12:14:56 +0100 Subject: [PATCH 059/115] The compile script is based on the original ink_ui compile script --- compile/compile.groovy | 97 +++++---------- compile/compile_ink_ui.groovy | 216 ---------------------------------- 2 files changed, 29 insertions(+), 284 deletions(-) delete mode 100644 compile/compile_ink_ui.groovy diff --git a/compile/compile.groovy b/compile/compile.groovy index 05da1af..e1f9894 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -36,7 +36,7 @@ pipeline { SOURCEDIR = "${WORKSPACE}\\atlas_ui" configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) env.SOURCE_PATH = SOURCEDIR - env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_Atlas" + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_inksystem_ui" env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" env.SRC = SOURCE_PATH } @@ -48,19 +48,17 @@ pipeline { env.BUILDOUTPUT = "${WORKSPACE}/build" env.PSBIN = "${WORKSPACE}/ps_bin" env.ASBIN = "${WORKSPACE}/as_bin" + env.AULIB = "${WORKSPACE}/atlaslibraries" + env.TESTRESULTS = "${WORKSPACE}/testresults" env.PSSOURCE = "${WORKSPACE}/newsw" cleanfolders = [ BUILDOUTPUT, "${WORKSPACE}/SharedPackages", PSBIN, ASBIN, - "${WORKSPACE}/bin", - "${WORKSPACE}/binKiosk", - "${WORKSPACE}/documentation", - "${WORKSPACE}/ildasm", - "${WORKSPACE}/Libraries", - "${WORKSPACE}/Atlas Release", - "${WORKSPACE}/LocalisationSDK", + AULIB, + "${WORKSPACE}/binInk", + TESTRESULTS, ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -75,12 +73,25 @@ pipeline { } } } - stage('Import Print server to adjust version number') { + stage('Import Atlas UI libraries') { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - def psartifactfiles = "meta/**,bin/x64/Release/Engine - Render.dll,bin/x64/Release/Engine - Render.lib,bin/x64/Release/Engine - Render.pdb,bin/x64/Release/TBarCode11_x64.dll,bin/x64/Release/GIS Utility - Toolbox.dll,bin/x64/Release/GIS Utility - Toolbox.lib,bin/x64/Release/GIS Utility - Toolbox.pdb,bin/x64/Release/zlib1.dll,bin/x64/Release/zlib1.lib,bin/x64/Release/zlib1.pdb,bin/x64/Release/GIS Utility - TCP-IP Comms.dll,bin/x64/Release/GIS Utility - TCP-IP Comms.lib,bin/x64/Release/GIS Utility - TCP-IP Comms.pdb,bin/x64/Release/Dialog - Tree Node Editor.dll,bin/x64/Release/Dialog - Tree Node Editor.lib,bin/x64/Release/Dialog - Tree Node Editor.pdb" + libmeta = importer.artifactimport(meta, + ATLAS_UI_ARTIFACT_LOCATION, + ATLAS_UI_COMPILE_JOB, + ATLAS_UI_BUILD_SELECTOR, + ATLAS_UI_RELEASE_REPO, + ATLAS_UI_RELEASE_REVISION, + AULIB, + false) + } + } + } + stage('Import Print server to adjust version number') { + steps { + script { + def psartifactfiles = "meta/**" psmeta = importer.artifactimport(meta, PRINT_SERVER_ARTIFACT_LOCATION, PRINT_SERVER_COMPILE_JOB, @@ -93,21 +104,10 @@ pipeline { } } } - stage('Checkout relevant Print server source') { - steps { - script { - def pssourceartifacts = "src/Engine Common" - def pssourceurl = psmeta.gitinfo.remoteurl - def pscommit = psmeta.gitinfo.gitrevision - - configurationhelper.gitCheckoutAndRegister(meta, 'print_server_source', pssourceurl, pscommit, PSSOURCE, '', 0, false, pssourceartifacts) - } - } - } stage('Import Atlas services to adjust version number') { steps { script { - def asartifactfiles = "meta/**,SharedPackages/**" + def asartifactfiles = "meta/**" asmeta = importer.artifactimport(meta, ATLAS_SERVICES_ARTIFACT_LOCATION, ATLAS_SERVICES_COMPILE_JOB, @@ -124,14 +124,10 @@ pipeline { steps { script { env.BUILD_STAMP=meta.buildstampinfo.buildstamp - env.BUILD_DATE=meta.jenkinsbuildinfo.builddate - env.PS_VERSION="1.0.${psmeta.buildstampinfo.revision}.0" - env.PS_PACKAGE_VERSION=psmeta.buildstampinfo.buildstampprefix + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp bat """ - call "${JOBSCRIPTS_COMMON}\\create_ps_nuget.bat" - if errorlevel 1 exit /b 1 - call "${JOBSCRIPTS_COMMON}\\version_atlas_ui_files.bat" + call "${JOBSCRIPTS_COMMON}\\version_ink_ui_files.bat" if errorlevel 1 exit /b 1 """ } @@ -147,50 +143,15 @@ pipeline { """ } } - } - stage('Update localisation files') { - steps { - script { - bat """ - call "${JOBSCRIPTS}\\UpdateLocalisationFiles.bat" - if errorlevel 1 exit /b 1 - """ - } - } - } - stage('Build documentation for installer') { - steps { - script { - bat """ - call "${JOBSCRIPTS}\\documentation_build_for_installers.bat" - if errorlevel 1 exit /b 1 - """ - } - } - } + } stage('Prepare exports') { steps { script { bat """ - move "${SRC}\\bin" . + move "${SRC}\\binInk" . if errorlevel 1 exit /b 1 - move "${SRC}\\binKiosk" . - if errorlevel 1 exit /b 1 - - move "${SRC}\\Atlas Release" . - if errorlevel 1 exit /b 1 - - move "${SRC}\\AtlasSDK\\LocalisationSDK" . - if errorlevel 1 exit /b 1 - - move "${SRC}\\documentation" . - if errorlevel 1 exit /b 1 - - move "${SRC}\\ildasm" . - if errorlevel 1 exit /b 1 - - move "${SRC}\\Libraries" . + move "${SRC}\\testresults" . if errorlevel 1 exit /b 1 """ } @@ -232,7 +193,7 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(["bin/**","binKiosk/**","documentation/**","ildasm/**","Libraries/**","Atlas Release/**","LocalisationSDK/**"]) + def artifactlist = meta.generateartifacts(["binInk/**","testresults/**"]) archiveArtifacts "${artifactlist}" } } diff --git a/compile/compile_ink_ui.groovy b/compile/compile_ink_ui.groovy deleted file mode 100644 index e1f9894..0000000 --- a/compile/compile_ink_ui.groovy +++ /dev/null @@ -1,216 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) - } - } - } - stage('Checkout dependencies') { - steps { - script { - configurationhelper = autobuilder.configurationhelper() - - PYTHONURL = 'git@hydra:tools/python.git' - PYTHONBRANCH = 'origin/3.6.3_windows' - PYTHONDIR = "${WORKSPACE}/python" - PYTHONROOTDIR = 'python' - configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) - env.PYTHON = "${PYTHONDIR}/ver/python.exe" - - VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' - VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" - VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" - VERSTAMPINGROOTDIR = 'ver_stamping_releases' - configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) - } - } - } - stage('Checkout source') { - steps { - script { - SOURCEURL = 'git@hydra:gis/atlas_ui.git' - SOURCEREVISION = SOURCE_REVISION - SOURCEDIR = "${WORKSPACE}\\atlas_ui" - configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) - env.SOURCE_PATH = SOURCEDIR - env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_inksystem_ui" - env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" - env.SRC = SOURCE_PATH - } - } - } - stage('Clean exports') { - steps { - script { - env.BUILDOUTPUT = "${WORKSPACE}/build" - env.PSBIN = "${WORKSPACE}/ps_bin" - env.ASBIN = "${WORKSPACE}/as_bin" - env.AULIB = "${WORKSPACE}/atlaslibraries" - env.TESTRESULTS = "${WORKSPACE}/testresults" - env.PSSOURCE = "${WORKSPACE}/newsw" - cleanfolders = [ - BUILDOUTPUT, - "${WORKSPACE}/SharedPackages", - PSBIN, - ASBIN, - AULIB, - "${WORKSPACE}/binInk", - TESTRESULTS, - ] - 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('Import Atlas UI libraries') { - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - libmeta = importer.artifactimport(meta, - ATLAS_UI_ARTIFACT_LOCATION, - ATLAS_UI_COMPILE_JOB, - ATLAS_UI_BUILD_SELECTOR, - ATLAS_UI_RELEASE_REPO, - ATLAS_UI_RELEASE_REVISION, - AULIB, - false) - } - } - } - stage('Import Print server to adjust version number') { - steps { - script { - def psartifactfiles = "meta/**" - psmeta = importer.artifactimport(meta, - PRINT_SERVER_ARTIFACT_LOCATION, - PRINT_SERVER_COMPILE_JOB, - PRINT_SERVER_BUILD_SELECTOR, - PRINT_SERVER_RELEASE_REPO, - PRINT_SERVER_RELEASE_REVISION, - PSBIN, - true, - psartifactfiles) // This should increment the version number - } - } - } - stage('Import Atlas services to adjust version number') { - steps { - script { - def asartifactfiles = "meta/**" - asmeta = importer.artifactimport(meta, - ATLAS_SERVICES_ARTIFACT_LOCATION, - ATLAS_SERVICES_COMPILE_JOB, - ATLAS_SERVICES_BUILD_SELECTOR, - ATLAS_SERVICES_RELEASE_REPO, - ATLAS_SERVICES_RELEASE_REVISION, - ASBIN, - true, - asartifactfiles) - } - } - } - stage('Version stamp files') { - steps { - script { - env.BUILD_STAMP=meta.buildstampinfo.buildstamp - env.BUILD_DATE=meta.jenkinsbuildinfo.builddate - env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp - bat """ - call "${JOBSCRIPTS_COMMON}\\version_ink_ui_files.bat" - if errorlevel 1 exit /b 1 - """ - } - } - } - stage('Compile application') { - steps { - script { - env.SRC_REVISION=SOURCE_REVISION - bat """ - call "${JOBSCRIPTS}\\autobuild.bat" - if errorlevel 1 exit /b 1 - """ - } - } - } - stage('Prepare exports') { - steps { - script { - bat """ - move "${SRC}\\binInk" . - if errorlevel 1 exit /b 1 - - move "${SRC}\\testresults" . - if errorlevel 1 exit /b 1 - """ - } - } - } - stage('Static analysis') { - steps { - script { - recordIssues(tools: [ - msBuild(enabledForFailure: true, reportEncoding: 'UTF-8'), - ]) - } - } - } - stage('Checksum artifacts') { - steps { - script { - def checksummable = [ -/* Binaries are signed - 'build/**', - 'SharedPackages/**', -*/ - ] - checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") - checksumutils.generatelist(meta, checksummable) - } - } - } - stage('Classifying publishable artifacts') { - steps { - script { - def publishable = [ - ] - publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") - publishutils.generatelist(meta, publishable) - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts(["binInk/**","testresults/**"]) - archiveArtifacts "${artifactlist}" - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} From 06fea48a0b84bc3a0cd9d022e06fd80fa37fed52 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Oct 2020 12:20:52 +0100 Subject: [PATCH 060/115] Use custom modules repo as source --- compile/compile.groovy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index e1f9894..b711e09 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -31,12 +31,12 @@ pipeline { stage('Checkout source') { steps { script { - SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEURL = 'git@hydra:atlas-ui-modules/custom-modules.git' SOURCEREVISION = SOURCE_REVISION - SOURCEDIR = "${WORKSPACE}\\atlas_ui" - configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCEDIR = "${WORKSPACE}\\custom_modules" + configurationhelper.gitCheckoutAndRegister(meta, 'custom_modules', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) env.SOURCE_PATH = SOURCEDIR - env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_inksystem_ui" + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build" env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" env.SRC = SOURCE_PATH } @@ -57,7 +57,7 @@ pipeline { PSBIN, ASBIN, AULIB, - "${WORKSPACE}/binInk", + "${WORKSPACE}/bin", TESTRESULTS, ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") @@ -148,7 +148,7 @@ pipeline { steps { script { bat """ - move "${SRC}\\binInk" . + move "${SRC}\\bin" . if errorlevel 1 exit /b 1 move "${SRC}\\testresults" . @@ -193,7 +193,7 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(["binInk/**","testresults/**"]) + def artifactlist = meta.generateartifacts(["bin/**","testresults/**"]) archiveArtifacts "${artifactlist}" } } From cdb8d1e2c32ac047fdd0dfdc7d8c1a449d468dc3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Oct 2020 20:09:15 +0100 Subject: [PATCH 061/115] Import Atlas UI libraries to appropriate location --- compile/compile.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index b711e09..b6bdab6 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -39,6 +39,7 @@ pipeline { env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build" env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" env.SRC = SOURCE_PATH + env.AULIB = "${SRC}/Libraries/Imports/atlas-ui" } } } @@ -48,7 +49,6 @@ pipeline { env.BUILDOUTPUT = "${WORKSPACE}/build" env.PSBIN = "${WORKSPACE}/ps_bin" env.ASBIN = "${WORKSPACE}/as_bin" - env.AULIB = "${WORKSPACE}/atlaslibraries" env.TESTRESULTS = "${WORKSPACE}/testresults" env.PSSOURCE = "${WORKSPACE}/newsw" cleanfolders = [ @@ -56,7 +56,6 @@ pipeline { "${WORKSPACE}/SharedPackages", PSBIN, ASBIN, - AULIB, "${WORKSPACE}/bin", TESTRESULTS, ] @@ -127,7 +126,7 @@ pipeline { env.BUILD_DATE=meta.jenkinsbuildinfo.builddate env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp bat """ - call "${JOBSCRIPTS_COMMON}\\version_ink_ui_files.bat" + call "${JOBSCRIPTS_COMMON}\\version_files.bat" if errorlevel 1 exit /b 1 """ } From 6f73422660a907bad636c5ff8defdce262d355f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Oct 2020 11:13:32 +0100 Subject: [PATCH 062/115] Move binaries to bin folder --- compile/compile.groovy | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index b6bdab6..67c477d 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -147,10 +147,7 @@ pipeline { steps { script { bat """ - move "${SRC}\\bin" . - if errorlevel 1 exit /b 1 - - move "${SRC}\\testresults" . + move "${SRC}\\Atlas Release\\Modules" bin if errorlevel 1 exit /b 1 """ } @@ -192,7 +189,7 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(["bin/**","testresults/**"]) + def artifactlist = meta.generateartifacts(["bin/**""]) archiveArtifacts "${artifactlist}" } } From d48431be0665ffb5a49d5355a1096dca94a7bead Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Oct 2020 11:14:54 +0100 Subject: [PATCH 063/115] Move binaries to bin folder --- compile/compile.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index 67c477d..3aa0743 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -189,7 +189,7 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(["bin/**""]) + def artifactlist = meta.generateartifacts(["bin/**"]) archiveArtifacts "${artifactlist}" } } From bce4dfcee9dedc8ef0b1336deade94da8cb32813 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Oct 2020 12:08:20 +0100 Subject: [PATCH 064/115] Remove reference to BASEBUILDNUMBER --- compile/compile.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index 3aa0743..e25773d 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -68,7 +68,7 @@ pipeline { steps { script { version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + version.generate(meta, SOURCE_REVISION, SOURCE_PATH) } } } From d4fab93c67c2193e0a812975103e0c824bf88792 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Oct 2020 15:34:09 +0100 Subject: [PATCH 065/115] Remove redundant installer scripts --- ...all_atlas_ink_ui.groovy => install.groovy} | 0 install/install_atlas_professional.groovy | 333 ------------------ install/install_atlas_sdk.groovy | 330 ----------------- 3 files changed, 663 deletions(-) rename install/{install_atlas_ink_ui.groovy => install.groovy} (100%) delete mode 100644 install/install_atlas_professional.groovy delete mode 100644 install/install_atlas_sdk.groovy diff --git a/install/install_atlas_ink_ui.groovy b/install/install.groovy similarity index 100% rename from install/install_atlas_ink_ui.groovy rename to install/install.groovy diff --git a/install/install_atlas_professional.groovy b/install/install_atlas_professional.groovy deleted file mode 100644 index fb86e6b..0000000 --- a/install/install_atlas_professional.groovy +++ /dev/null @@ -1,333 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) - - if (INSTALLSHIELD2015_CMD == "" || INSTALLSHIELD2018_CMD == "" || INSTALLSHIELD2019_CMD == "" || DOTNET_FRAMEWORK64_PATH == "" || WINDOWS_DRIVER_KIT_8_1 == "") { - echo "Either INSTALLSHIELD2015_CMD, INSTALLSHIELD2018_CMD, INSTALLSHIELD2019_CMD, DOTNET_FRAMEWORK64_PATH or WINDOWS_DRIVER_KIT_8_1 environment variables have not been defined" - currentBuild.result = 'FAILED' - exit(1) - } - installerlist = env.INSTALLERS_TO_BUILD - if (installerlist != null) { - installerlist = installerlist.trim() - } else { - installerlist = '' - } - toBuild = [] - if (installerlist) { - toBuildUntrimmed = installerlist.split(',') - toBuildUntrimmed.each { - toBuild.add(it.trim()) - } - } - } - echo "Installer list: ${installerlist}" - } - } - stage('Nothing to build check') { - when { - expression { - !toBuild - } - } - steps { - echo 'No installers to build' - script { - currentBuild.result = 'UNSTABLE' - } - } - } - stage('Checkout dependencies') { - when { - expression { - toBuild - } - } - 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" - - SUPPORTURL = 'git@hydra:gis/gissupport.git' - SUPPORTBRANCH = 'origin/master' - SUPPORTDIR = "${WORKSPACE}\\gissupport" - configurationhelper.gitCheckoutAndRegister(meta, 'gissupport', SUPPORTURL, SUPPORTBRANCH, SUPPORTDIR) - env.INST_SUPPORT = SUPPORTDIR - - EULAURL = 'git@hydra:gis/giseula.git' - EULABRANCH = 'origin/master' - EULADIR = "${WORKSPACE}\\giseula" - configurationhelper.gitCheckoutAndRegister(meta, 'giseula', EULAURL, EULABRANCH, EULADIR) - env.INST_EULA = EULADIR - - PREREQURL = 'git@hydra:gis/installerprerequisites.git' - PREREQBRANCH = 'origin/master' - PREREQDIR = "${WORKSPACE}\\prereq" - configurationhelper.gitCheckoutAndRegister(meta, 'installerprerequisites', PREREQURL, PREREQBRANCH, PREREQDIR) - env.INST_PREQ = PREREQDIR - - DIGSIGURL = 'git@hydra:gis/digitalsignature.git' - DIGSIGBRANCH = 'origin/master' - DIGSIGDIR = "${WORKSPACE}\\certificates" - configurationhelper.gitCheckoutAndRegister(meta, 'digitalsignature', DIGSIGURL, DIGSIGBRANCH, DIGSIGDIR) - env.PATH_TO_CERTIFICATE_PFX = "${DIGSIGDIR}\\GIS" - } - } - } - stage('Checkout source') { - steps { - script { - SOURCEURL = 'git@hydra:gis/atlas_ui.git' - SOURCEREVISION = SOURCE_REVISION - SOURCEDIR = "${WORKSPACE}\\atlas_ui" - configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) - env.SOURCE_PATH = SOURCEDIR - env.INST_RELEASE_NOTES = "${SOURCE_PATH}\\releasenotes" - env.INST_SRC = "${SOURCE_PATH}\\src" - env.ATLAS_SOURCE_PATH = SOURCE_PATH - } - } - } - stage("Clean exports") { - steps { - script { - env.IMPORTSPATH = "${WORKSPACE}\\imports" - env.INTERMEDIATEEXPORTSPATH = "${WORKSPACE}\\info" - env.EXPORTSPATH = "installers" - env.PS_ARTIFACTS_ROOT = "${IMPORTSPATH}\\ps_bin" - env.PSBIN = "${WORKSPACE}/ps_bin" - env.ASBIN = "${WORKSPACE}/as_bin" - env.VERSIONINFO = "${WORKSPACE}\\versioninfo" - cleanfolders = [ - "${IMPORTSPATH}", - "${INTERMEDIATEEXPORTSPATH}", - "${EXPORTSPATH}", - "${WORKSPACE}/mcs_bin", - "${VERSIONINFO}", - PSBIN, - ASBIN, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Generating version info') { - when { - expression { - toBuild - } - } - steps { - script { - version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) - } - } - } - stage('Import Print server to adjust version number') { - when { - expression { - toBuild - } - } - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - def importoptions = importer.getNewImportOptions() - importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, - PRINT_SERVER_COMPILE_JOB, - PRINT_SERVER_BUILD_SELECTOR, - PRINT_SERVER_RELEASE_REPO, - PRINT_SERVER_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, PSBIN) - } - } - } - stage('Import Atlas services to adjust version number') { - when { - expression { - toBuild - } - } - steps { - script { - def importoptions = importer.getNewImportOptions() - importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, - ATLAS_SERVICES_COMPILE_JOB, - ATLAS_SERVICES_BUILD_SELECTOR, - ATLAS_SERVICES_RELEASE_REPO, - ATLAS_SERVICES_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, ASBIN) - } - } - } - stage("Import binaries") { - when { - expression { - toBuild - } - } - steps { - script { - env.BUILD_STAMP=meta.buildstampinfo.buildstamp - artifactDetails = [ - // Key, Artifacts Source project Artifacts source selector, Destination folder Increment Version Number Artifacts to copy Artifacts to not copy Binaries Folders - AtlasSet: [ATLAS_COMPILE_JOB, ATLAS_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\atlasset", false, 'meta/**, bin/**, binKiosk/**', '**/*.lib', [ 'bin' ], ], - - ] - installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - ATLAS_PRO_PRINT_SERVER: [INSTALLSHIELD2019_CMD, 'AtlasSet', 'install_atlas', "${ATLAS_SOURCE_PATH}\\installer\\build\\atlas", 'AtlasProfessionalPrintServer.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_atlas/x64/GIS Atlas Professional for Print Server/DiskImages/DISK1/GIS Atlas Professional for Print Server.exe", "${EXPORTSPATH}/GIS Atlas Professional for Print Server", "GIS Atlas Professional for Print Server ${BUILD_STAMP}.exe" ], - ATLAS_PRO: [INSTALLSHIELD2019_CMD, 'AtlasSet', 'install_atlas', "${ATLAS_SOURCE_PATH}\\installer\\build\\atlas", 'AtlasProfessional.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_atlas/x64/GIS Atlas Professional/DiskImages/DISK1/GIS Atlas Professional.exe", "${EXPORTSPATH}/GIS Atlas Professional", "GIS Atlas Professional ${BUILD_STAMP}.exe" ], - ATLAS_PRODUCTION: [INSTALLSHIELD2019_CMD, 'AtlasSet', 'install_atlas', "${ATLAS_SOURCE_PATH}\\installer\\build\\atlas", 'AtlasProduction.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_atlas/x64/GIS Atlas Production/DiskImages/DISK1/GIS Atlas Production.exe", "${EXPORTSPATH}/GIS Atlas Production", "GIS Atlas Production ${BUILD_STAMP}.exe" ], - ] - installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") - artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) - } - } - } - stage("Generate version info folder for installer") { - steps { - script { - def metamap = [ - ["${VERSIONINFO}", meta], // Incomplete until this job ends - ] - for (metaitem in metamap) { - (destfolder, componentmeta) = metaitem - dir(destfolder) { - componentmeta.saveJsonSerialised("meta.json") - } - } - } - } - } - stage("Build installers") { - when { - expression { - toBuild - } - } - steps { - script { - fileOperations([folderCreateOperation(INTERMEDIATEEXPORTSPATH)]) - installerpublishlist = [] - for (installer in toBuild) { - (installcmd, artifactKey, processingFolder, EXECUTIONPATH, ISMPROJECT, VARIANT, pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) = installerDetails.get(installer) - - def importmeta = artifactFetched.get(artifactKey) - - echo "For: ${installer} build stamp is: ${importmeta.buildstampinfo.buildstamp}" - def INST_ISVERSION = importmeta.buildstampinfo.buildstamp - - (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) - def COMPILE_IMPORTS = destFolder - - def INST_VERBOSE = '' - if (VERBOSE == "true") { - INST_VERBOSE = '-v' - } - - def INST_OUT = "${INTERMEDIATEEXPORTSPATH}\\${processingFolder}" - fileOperations([folderCreateOperation(INST_OUT)]) - - def INST_VARIANT = '' - if (VARIANT != "" ) { - INST_VARIANT = '-r ' + VARIANT - } - installerhelper.checkISMfile("${EXECUTIONPATH}\\${ISMPROJECT}") - installerhelper.selectSigningCertificate(NODE_NAME, "${EXECUTIONPATH}\\${ISMPROJECT}") - - dir(EXECUTIONPATH) { - // INSTALLSHIELD201X_CMD and DOTNET_FRAMEWORK64_PATH must be externally defined - bat """ - set INST_COMMON_PARAMETERS=-y "${INST_ISVERSION}" -l "WORKSPACE=${WORKSPACE}" -l "PATH_TO_CERTIFICATE_PFX=${PATH_TO_CERTIFICATE_PFX}" -l "COMPILE_IMPORTS=${COMPILE_IMPORTS}" -l "IMPORTS_ROOT=${IMPORTSPATH}" -l "PS_ARTIFACTS_ROOT=${PS_ARTIFACTS_ROOT}" -l "INST_RELEASE_NOTES=${INST_RELEASE_NOTES}" -l "INST_SRC=${INST_SRC}" -l "INST_OUT=${INST_OUT}" -l "INST_EULA=${INST_EULA}" -l "INST_SUPPORT=${INST_SUPPORT}" -prqpath "${INST_PREQ}" ${INST_VERBOSE} - "${installcmd}" -t "${DOTNET_FRAMEWORK64_PATH}" -p "${ISMPROJECT}" %INST_COMMON_PARAMETERS% ${INST_VARIANT} -a x64" - """ - } - - installerhelper.copyToFinalPosition(pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) - - def EXPORT_OUT_GLOB = "${FINALBASEFOLDER}/**" - echo "Adding ${EXPORT_OUT_GLOB} to installer publish list" - installerpublishlist.add(EXPORT_OUT_GLOB) - } - } - } - } - stage('Classifying publishable artifacts') { - when { - expression { - toBuild - } - } - steps { - script { - def publishable = installerpublishlist - publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") - publishutils.generatelist(meta, publishable) - } - } - } - stage('Archiving artifacts') { - when { - expression { - toBuild - } - } - steps { - script { - ArrayList itemsForRelease = ["info/**", "installers/**"] - def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" - } - } - } - stage('Check for unstable build') { - when { - expression { - toBuild - } - } - steps { - script { - def installersToBuild = installerDetails.size() - if (installersToBuild != toBuild.size()) { - echo "Not building the complete set of installers (${installersToBuild}) therefore marking building unstable" - currentBuild.result = 'UNSTABLE' - } - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} diff --git a/install/install_atlas_sdk.groovy b/install/install_atlas_sdk.groovy deleted file mode 100644 index 68afa85..0000000 --- a/install/install_atlas_sdk.groovy +++ /dev/null @@ -1,330 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) - - if (INSTALLSHIELD2015_CMD == "" || INSTALLSHIELD2018_CMD == "" || INSTALLSHIELD2019_CMD == "" || DOTNET_FRAMEWORK64_PATH == "" || WINDOWS_DRIVER_KIT_8_1 == "") { - echo "Either INSTALLSHIELD2015_CMD, INSTALLSHIELD2018_CMD, INSTALLSHIELD2019_CMD, DOTNET_FRAMEWORK64_PATH or WINDOWS_DRIVER_KIT_8_1 environment variables have not been defined" - currentBuild.result = 'FAILED' - exit(1) - } - installerlist = env.INSTALLERS_TO_BUILD - if (installerlist != null) { - installerlist = installerlist.trim() - } else { - installerlist = '' - } - toBuild = [] - if (installerlist) { - toBuildUntrimmed = installerlist.split(',') - toBuildUntrimmed.each { - toBuild.add(it.trim()) - } - } - } - echo "Installer list: ${installerlist}" - } - } - stage('Nothing to build check') { - when { - expression { - !toBuild - } - } - steps { - echo 'No installers to build' - script { - currentBuild.result = 'UNSTABLE' - } - } - } - stage('Checkout dependencies') { - when { - expression { - toBuild - } - } - 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" - - SUPPORTURL = 'git@hydra:gis/gissupport.git' - SUPPORTBRANCH = 'origin/master' - SUPPORTDIR = "${WORKSPACE}\\gissupport" - configurationhelper.gitCheckoutAndRegister(meta, 'gissupport', SUPPORTURL, SUPPORTBRANCH, SUPPORTDIR) - env.INST_SUPPORT = SUPPORTDIR - - EULAURL = 'git@hydra:gis/giseula.git' - EULABRANCH = 'origin/master' - EULADIR = "${WORKSPACE}\\giseula" - configurationhelper.gitCheckoutAndRegister(meta, 'giseula', EULAURL, EULABRANCH, EULADIR) - env.INST_EULA = EULADIR - - PREREQURL = 'git@hydra:gis/installerprerequisites.git' - PREREQBRANCH = 'origin/master' - PREREQDIR = "${WORKSPACE}\\prereq" - configurationhelper.gitCheckoutAndRegister(meta, 'installerprerequisites', PREREQURL, PREREQBRANCH, PREREQDIR) - env.INST_PREQ = PREREQDIR - - DIGSIGURL = 'git@hydra:gis/digitalsignature.git' - DIGSIGBRANCH = 'origin/master' - DIGSIGDIR = "${WORKSPACE}\\certificates" - configurationhelper.gitCheckoutAndRegister(meta, 'digitalsignature', DIGSIGURL, DIGSIGBRANCH, DIGSIGDIR) - env.PATH_TO_CERTIFICATE_PFX = "${DIGSIGDIR}\\GIS" - } - } - } - stage('Checkout source') { - steps { - script { - SOURCEURL = 'git@hydra:gis/atlas_ui.git' - SOURCEREVISION = SOURCE_REVISION - SOURCEDIR = "${WORKSPACE}\\atlas_ui" - configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) - env.SOURCE_PATH = SOURCEDIR - env.INST_RELEASE_NOTES = "${SOURCE_PATH}\\releasenotes" - env.INST_SRC = "${SOURCE_PATH}\\src" - env.ATLAS_SOURCE_PATH = SOURCE_PATH - } - } - } - stage("Clean exports") { - steps { - script { - env.IMPORTSPATH = "${WORKSPACE}\\imports" - env.INTERMEDIATEEXPORTSPATH = "${WORKSPACE}\\info" - env.EXPORTSPATH = "installers" - env.PS_ARTIFACTS_ROOT = "${IMPORTSPATH}\\ps_bin" - env.VERSIONINFO = "${WORKSPACE}\\versioninfo" - env.PSBIN = "${WORKSPACE}/ps_bin" - env.ASBIN = "${WORKSPACE}/as_bin" - cleanfolders = [ - "${IMPORTSPATH}", - "${INTERMEDIATEEXPORTSPATH}", - "${EXPORTSPATH}", - "${WORKSPACE}/mcs_bin", - "${VERSIONINFO}", - PSBIN, - ASBIN, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Generating version info') { - when { - expression { - toBuild - } - } - steps { - script { - version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) - } - } - } - stage('Import Print server to adjust version number') { - when { - expression { - toBuild - } - } - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - def importoptions = importer.getNewImportOptions() - importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, - PRINT_SERVER_COMPILE_JOB, - PRINT_SERVER_BUILD_SELECTOR, - PRINT_SERVER_RELEASE_REPO, - PRINT_SERVER_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, PSBIN) - } - } - } - stage('Import Atlas services to adjust version number') { - when { - expression { - toBuild - } - } - steps { - script { - def importoptions = importer.getNewImportOptions() - importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, - ATLAS_SERVICES_COMPILE_JOB, - ATLAS_SERVICES_BUILD_SELECTOR, - ATLAS_SERVICES_RELEASE_REPO, - ATLAS_SERVICES_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, ASBIN) - } - } - } - stage("Import binaries") { - when { - expression { - toBuild - } - } - steps { - script { - env.BUILD_STAMP=meta.buildstampinfo.buildstamp - artifactDetails = [ - // Key, Artifacts Source project Artifacts source selector, Destination folder Increment Version Number Artifacts to copy Artifacts to not copy Binaries Folders - AtlasSDKSet: [ATLAS_COMPILE_JOB, ATLAS_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\atlassdkset", false, 'meta/**, bin/**, binKiosk/**, Libraries/**, documentation/**, LocalisationSDK/**', '**/*.lib', [ 'bin', 'binKiosk' ], ], - ] - installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - ATLAS_SDK: [INSTALLSHIELD2019_CMD, 'AtlasSDKSet', 'install_atlas_sdk', "${ATLAS_SOURCE_PATH}\\installer\\build\\atlas_sdk", 'AtlasSDK.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_atlas_sdk/x64/GIS Atlas SDK/DiskImages/DISK1/GIS Atlas SDK.exe", "${EXPORTSPATH}/GIS Atlas SDK", "GIS Atlas SDK ${BUILD_STAMP}.exe" ], - ] - installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") - artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) - } - } - } - stage("Generate version info folder for installer") { - steps { - script { - def metamap = [ - ["${VERSIONINFO}", meta], // Incomplete until this job ends - ] - for (metaitem in metamap) { - (destfolder, componentmeta) = metaitem - dir(destfolder) { - componentmeta.saveJsonSerialised("meta.json") - } - } - } - } - } - stage("Build installers") { - when { - expression { - toBuild - } - } - steps { - script { - fileOperations([folderCreateOperation(INTERMEDIATEEXPORTSPATH)]) - installerpublishlist = [] - for (installer in toBuild) { - (installcmd, artifactKey, processingFolder, EXECUTIONPATH, ISMPROJECT, VARIANT, pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) = installerDetails.get(installer) - - def importmeta = artifactFetched.get(artifactKey) - - echo "For: ${installer} build stamp is: ${importmeta.buildstampinfo.buildstamp}" - def INST_ISVERSION = importmeta.buildstampinfo.buildstamp - - (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) - def COMPILE_IMPORTS = destFolder - - def INST_VERBOSE = '' - if (VERBOSE == "true") { - INST_VERBOSE = '-v' - } - - def INST_OUT = "${INTERMEDIATEEXPORTSPATH}\\${processingFolder}" - fileOperations([folderCreateOperation(INST_OUT)]) - - def INST_VARIANT = '' - if (VARIANT != "" ) { - INST_VARIANT = '-r ' + VARIANT - } - installerhelper.checkISMfile("${EXECUTIONPATH}\\${ISMPROJECT}") - installerhelper.selectSigningCertificate(NODE_NAME, "${EXECUTIONPATH}\\${ISMPROJECT}") - - dir(EXECUTIONPATH) { - // INSTALLSHIELD201X_CMD and DOTNET_FRAMEWORK64_PATH must be externally defined - bat """ - set INST_COMMON_PARAMETERS=-y "${INST_ISVERSION}" -l "WORKSPACE=${WORKSPACE}" -l "PATH_TO_CERTIFICATE_PFX=${PATH_TO_CERTIFICATE_PFX}" -l "COMPILE_IMPORTS=${COMPILE_IMPORTS}" -l "IMPORTS_ROOT=${IMPORTSPATH}" -l "PS_ARTIFACTS_ROOT=${PS_ARTIFACTS_ROOT}" -l "INST_RELEASE_NOTES=${INST_RELEASE_NOTES}" -l "INST_SRC=${INST_SRC}" -l "INST_OUT=${INST_OUT}" -l "INST_EULA=${INST_EULA}" -l "INST_SUPPORT=${INST_SUPPORT}" -prqpath "${INST_PREQ}" ${INST_VERBOSE} - "${installcmd}" -t "${DOTNET_FRAMEWORK64_PATH}" -p "${ISMPROJECT}" %INST_COMMON_PARAMETERS% ${INST_VARIANT} -a x64" - """ - } - - installerhelper.copyToFinalPosition(pathToIntermediate, FINALBASEFOLDER, FINALFILENAME) - - def EXPORT_OUT_GLOB = "${FINALBASEFOLDER}/**" - echo "Adding ${EXPORT_OUT_GLOB} to installer publish list" - installerpublishlist.add(EXPORT_OUT_GLOB) - } - } - } - } - stage('Classifying publishable artifacts') { - when { - expression { - toBuild - } - } - steps { - script { - def publishable = installerpublishlist - publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") - publishutils.generatelist(meta, publishable) - } - } - } - stage('Archiving artifacts') { - when { - expression { - toBuild - } - } - steps { - script { - ArrayList itemsForRelease = ["info/**", "installers/**"] - def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" - } - } - } - stage('Check for unstable build') { - when { - expression { - toBuild - } - } - steps { - script { - def installersToBuild = installerDetails.size() - if (installersToBuild != toBuild.size()) { - echo "Not building the complete set of installers (${installersToBuild}) therefore marking building unstable" - currentBuild.result = 'UNSTABLE' - } - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} From 114cc57876eac3400f9b1be43d007d1b9d1ee3fc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Oct 2020 17:30:53 +0100 Subject: [PATCH 066/115] Customise script for custom modules --- install/install.groovy | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 0ba4502..4dfd178 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -86,10 +86,10 @@ pipeline { stage('Checkout source') { steps { script { - SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEURL = 'git@hydra:atlas-ui-modules/custom-modules.git' SOURCEREVISION = SOURCE_REVISION - SOURCEDIR = "${WORKSPACE}\\atlas_ui" - configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCEDIR = "${WORKSPACE}\\custom_modules" + configurationhelper.gitCheckoutAndRegister(meta, 'custom_modules', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) env.SOURCE_PATH = SOURCEDIR env.INST_RELEASE_NOTES = "${SOURCE_PATH}\\releasenotes" env.INST_SRC = "${SOURCE_PATH}\\src" @@ -130,7 +130,7 @@ pipeline { steps { script { version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + version.generate(meta, SOURCE_REVISION, SOURCE_PATH) } } } @@ -188,15 +188,12 @@ pipeline { script { env.BUILD_STAMP=meta.buildstampinfo.buildstamp artifactDetails = [ - // Key, Artifacts Source project Artifacts source selector, Destination folder Increment Version Number Artifacts to copy Artifacts to not copy Binaries Folders - AtlasSet: [ATLAS_COMPILE_JOB, ATLAS_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\atlasset", false, 'meta/**, bin/**, binKiosk/**', '**/*.lib', [ 'bin' ], ], - InkUISet: [INK_UI_COMPILE_JOB, INK_UI_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\inkuiset", false, 'meta/**, binInk/**', '**/*.lib', [ 'binInk' ], ], + // Key, Artifacts Source project Artifacts source selector, Destination folder Increment Version Number Artifacts to copy Artifacts to not copy Binaries Folders + ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - INK_CONFIG_UI: [INSTALLSHIELD2019_CMD, ['InkUISet','AtlasSet'], 'install_ink_ui', "${ATLAS_SOURCE_PATH}\\installer\\build\\ink_system_ui", 'InkSystemConfigurationUI.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_ink_ui/x64/GIS Atlas Ink System Configuration UI/DiskImages/DISK1/GIS Atlas Ink System Configuration UI.exe", "${EXPORTSPATH}/GIS Atlas Ink System Configuration UI", "GIS Atlas Ink System Configuration UI ${BUILD_STAMP}.exe" ], - INK_OPERATOR_UI: [INSTALLSHIELD2019_CMD, ['InkUISet','AtlasSet'], 'install_ink_ui', "${ATLAS_SOURCE_PATH}\\installer\\build\\ink_system_ui", 'InkSystemOperatorUI.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_ink_ui/x64/GIS Atlas Ink System Operator UI/DiskImages/DISK1/GIS Atlas Ink System Operator UI.exe", "${EXPORTSPATH}/GIS Atlas Ink System Operator UI", "GIS Atlas Ink System Operator UI ${BUILD_STAMP}.exe" ], - INK_UI_MODULES: [INSTALLSHIELD2019_CMD, ['InkUISet','AtlasSet'], 'install_ink_ui', "${ATLAS_SOURCE_PATH}\\installer\\build\\ink_system_ui", 'InkSystemToolModules.ism', '', "${INTERMEDIATEEXPORTSPATH}/install_ink_ui/x64/GIS Atlas Ink System Tool Modules/DiskImages/DISK1/GIS Atlas Ink System Tool Modules.exe", "${EXPORTSPATH}/GIS Atlas Ink System Tool Modules", "GIS Atlas Ink System Tool Modules ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\enc_and_pd", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/enc_and_pd/x64/GIS Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas Ink System Configuration UI.exe", "${EXPORTSPATH}/GIS Custom Module - Enc and PD", "GIS Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], ] installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) From 44c911cae8dfaaa1393beb5993d0bd6d73d9cfab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Oct 2020 18:09:58 +0100 Subject: [PATCH 067/115] Customise script for custom modules --- install/install.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/install.groovy b/install/install.groovy index 4dfd178..bbcbcba 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -193,7 +193,7 @@ pipeline { ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\enc_and_pd", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/enc_and_pd/x64/GIS Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas Ink System Configuration UI.exe", "${EXPORTSPATH}/GIS Custom Module - Enc and PD", "GIS Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/enc_and_pd/x64/GIS Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas Ink System Configuration UI.exe", "${EXPORTSPATH}/GIS Custom Module - Enc and PD", "GIS Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], ] installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) From d9b6b1e4a49eda146463b6f443046c55fe6d1ca8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 12:02:31 +0100 Subject: [PATCH 068/115] Correct names of installer files and folders --- install/install.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/install.groovy b/install/install.groovy index bbcbcba..f07c1ee 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -193,7 +193,7 @@ pipeline { ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/enc_and_pd/x64/GIS Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas Ink System Configuration UI.exe", "${EXPORTSPATH}/GIS Custom Module - Enc and PD", "GIS Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], ] installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) From 692d73699492954cb9d1d0161c8410bb8b44e00f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 17:50:58 +0100 Subject: [PATCH 069/115] Stop using deprecated script api --- compile/compile.groovy | 58 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index e25773d..e13b76c 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -76,46 +76,46 @@ pipeline { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - libmeta = importer.artifactimport(meta, - ATLAS_UI_ARTIFACT_LOCATION, - ATLAS_UI_COMPILE_JOB, - ATLAS_UI_BUILD_SELECTOR, - ATLAS_UI_RELEASE_REPO, - ATLAS_UI_RELEASE_REVISION, - AULIB, - false) + def importoptions = importer.getNewImportOptions() + importoptions.source(ATLAS_UI_ARTIFACT_LOCATION, + ATLAS_UI_COMPILE_JOB, + ATLAS_UI_BUILD_SELECTOR, + ATLAS_UI_RELEASE_REPO, + ATLAS_UI_RELEASE_REVISION) + importoptions.setincrementversionnumber(false) + libmeta = importer.artifactimport(meta, importoptions, AULIB) } } } stage('Import Print server to adjust version number') { steps { script { - def psartifactfiles = "meta/**" - psmeta = importer.artifactimport(meta, - PRINT_SERVER_ARTIFACT_LOCATION, - PRINT_SERVER_COMPILE_JOB, - PRINT_SERVER_BUILD_SELECTOR, - PRINT_SERVER_RELEASE_REPO, - PRINT_SERVER_RELEASE_REVISION, - PSBIN, - true, - psartifactfiles) // This should increment the version number + def importoptions = importer.getNewImportOptions() + importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, + PRINT_SERVER_COMPILE_JOB, + PRINT_SERVER_BUILD_SELECTOR, + PRINT_SERVER_RELEASE_REPO, + PRINT_SERVER_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + importer.artifactimport(meta, importoptions, PSBIN) } } } stage('Import Atlas services to adjust version number') { steps { script { - def asartifactfiles = "meta/**" - asmeta = importer.artifactimport(meta, - ATLAS_SERVICES_ARTIFACT_LOCATION, - ATLAS_SERVICES_COMPILE_JOB, - ATLAS_SERVICES_BUILD_SELECTOR, - ATLAS_SERVICES_RELEASE_REPO, - ATLAS_SERVICES_RELEASE_REVISION, - ASBIN, - true, - asartifactfiles) + def importoptions = importer.getNewImportOptions() + importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, + ATLAS_SERVICES_COMPILE_JOB, + ATLAS_SERVICES_BUILD_SELECTOR, + ATLAS_SERVICES_RELEASE_REPO, + ATLAS_SERVICES_RELEASE_REVISION) + importoptions.setincrementversionnumber(true) + importoptions.setfilter('meta/**'); + importoptions.setappendtoparentmeta(false) + asmeta = importer.artifactimport(meta, importoptions, ASBIN) } } } @@ -123,7 +123,7 @@ pipeline { steps { script { env.BUILD_STAMP=meta.buildstampinfo.buildstamp - env.BUILD_DATE=meta.jenkinsbuildinfo.builddate + env.BUILD_DATE=meta.jenkinsbuildinfo.builddate env.AS_PACKAGE_VERSION=asmeta.buildstampinfo.buildstamp bat """ call "${JOBSCRIPTS_COMMON}\\version_files.bat" From 597b9a8f0d5748968f23bb1c880493e542681bd6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 17:53:10 +0100 Subject: [PATCH 070/115] Don't import print server binaries to alter version number --- compile/compile.groovy | 16 ---------------- install/install.groovy | 23 ----------------------- 2 files changed, 39 deletions(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index e13b76c..e133071 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -87,22 +87,6 @@ pipeline { } } } - stage('Import Print server to adjust version number') { - steps { - script { - def importoptions = importer.getNewImportOptions() - importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, - PRINT_SERVER_COMPILE_JOB, - PRINT_SERVER_BUILD_SELECTOR, - PRINT_SERVER_RELEASE_REPO, - PRINT_SERVER_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, PSBIN) - } - } - } stage('Import Atlas services to adjust version number') { steps { script { diff --git a/install/install.groovy b/install/install.groovy index f07c1ee..9e4aa09 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -134,29 +134,6 @@ pipeline { } } } - stage('Import Print server to adjust version number') { - when { - expression { - toBuild - } - } - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - def importoptions = importer.getNewImportOptions() - importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, - PRINT_SERVER_COMPILE_JOB, - PRINT_SERVER_BUILD_SELECTOR, - PRINT_SERVER_RELEASE_REPO, - PRINT_SERVER_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, PSBIN) - } - } - } stage('Import Atlas services to adjust version number') { when { expression { From da8a36be0fca09795bd88c6d7ca3f9b3fdf47566 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 18:02:28 +0100 Subject: [PATCH 071/115] Don't import print server binaries to alter version number --- install/install.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/install.groovy b/install/install.groovy index 9e4aa09..66daafb 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -142,6 +142,8 @@ pipeline { } steps { script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + def importoptions = importer.getNewImportOptions() importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, ATLAS_SERVICES_COMPILE_JOB, From 1a4e9f38d79ce5580f9967030eddbf6ad3e3aaed Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 20:15:54 +0100 Subject: [PATCH 072/115] Customise script for custom modules --- install/install.groovy | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 66daafb..66f3fce 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -134,29 +134,6 @@ pipeline { } } } - stage('Import Atlas services to adjust version number') { - when { - expression { - toBuild - } - } - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - def importoptions = importer.getNewImportOptions() - importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, - ATLAS_SERVICES_COMPILE_JOB, - ATLAS_SERVICES_BUILD_SELECTOR, - ATLAS_SERVICES_RELEASE_REPO, - ATLAS_SERVICES_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, ASBIN) - } - } - } stage("Import binaries") { when { expression { From fe719a0eab324f82a0252ecdd88364895544a22d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 20:20:28 +0100 Subject: [PATCH 073/115] Customise script for custom modules --- install/install.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/install/install.groovy b/install/install.groovy index 66f3fce..25ebf21 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -151,6 +151,7 @@ pipeline { // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], ] + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) } From 1b0b5b278b226a4eeee64a82db3a5b89ff88ecf8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 21:12:50 +0100 Subject: [PATCH 074/115] Start using the build all script --- build/build_all.groovy | 229 +++-------------------------------------- compile/compile.groovy | 14 +-- 2 files changed, 17 insertions(+), 226 deletions(-) diff --git a/build/build_all.groovy b/build/build_all.groovy index 0792b1d..27a39d4 100644 --- a/build/build_all.groovy +++ b/build/build_all.groovy @@ -13,11 +13,10 @@ pipeline { script { configurationhelper = autobuilder.configurationhelper() - SOURCEURL = 'git@hydra:gis/atlas_ui.git' - SOURCEREVISION = "${SOURCE_REVISION}".trim() - SOURCEROOTDIR = 'atlas_ui' - SOURCEDIR = "${WORKSPACE}/atlas_ui" - configurationhelper.gitCheckoutAndRegister(meta, SOURCEROOTDIR, SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + SOURCEURL = 'git@hydra:atlas-ui-modules/custom-modules.git' + SOURCEREVISION = SOURCE_REVISION + SOURCEDIR = "${WORKSPACE}\\custom_modules" + configurationhelper.gitCheckoutAndRegister(meta, 'custom_modules', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) } } } @@ -25,78 +24,21 @@ pipeline { steps { script { version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCEREVISION, SOURCEDIR, BASEBUILDNUMBER) - } - } - } - stage('Import Print server to adjust version number') { - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - def importoptions = importer.getNewImportOptions() - importoptions.source(PRINT_SERVER_ARTIFACT_LOCATION, - PRINT_SERVER_COMPILE_JOB, - PRINT_SERVER_BUILD_SELECTOR, - PRINT_SERVER_RELEASE_REPO, - PRINT_SERVER_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, 'ps_bin') - } - } - } - stage('Import Atlas services to adjust version number') { - steps { - script { - def importoptions = importer.getNewImportOptions() - importoptions.source(ATLAS_SERVICES_ARTIFACT_LOCATION, - ATLAS_SERVICES_COMPILE_JOB, - ATLAS_SERVICES_BUILD_SELECTOR, - ATLAS_SERVICES_RELEASE_REPO, - ATLAS_SERVICES_RELEASE_REVISION) - importoptions.setincrementversionnumber(true) - importoptions.setfilter('meta/**'); - importoptions.setappendtoparentmeta(false) - importer.artifactimport(meta, importoptions, 'as_bin') + version.generate(meta, SOURCEREVISION, SOURCEDIR) } } } stage('Compile') { steps { script { - atlas_compile_job = build job: ATLAS_COMPILE_JOB, + modules_compile_job = build job: INK_UI_COMPILE_JOB, parameters: [ string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), - string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), - string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), - string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), - string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), - string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), - string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), - string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), - string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), - string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), - booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), - ] - } - } - } - stage('Compile Atlas Ink UI') { - steps { - script { - ink_ui_compile_job = build job: INK_UI_COMPILE_JOB, - parameters: [ - string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), - string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), - string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), - string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), - string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), - string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), - string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), + string(name: 'ATLAS_UI_ARTIFACT_LOCATION', value: ATLAS_UI_ARTIFACT_LOCATION, + string(name: 'ATLAS_UI_COMPILE_JOB', value: ATLAS_UI_COMPILE_JOB, + string(name: 'ATLAS_UI_BUILD_SELECTOR', value: ATLAS_UI_BUILD_SELECTOR), + string(name: 'ATLAS_UI_RELEASE_REPO', value: ATLAS_UI_RELEASE_REPO), + string(name: 'ATLAS_UI_RELEASE_REVISION', value: ATLAS_UI_RELEASE_REVISION), string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), @@ -110,102 +52,16 @@ pipeline { stage('Second stage') { failFast true parallel { - stage('Check localisations') { - steps { - script { - localisation_check_job = build job: ATLAS_LOCALISATION_CHECK_JOB, - parameters: [ - string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), - string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), - booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), - ] - } - } - } - stage('Build Atlas Professional installers') { - steps { - script { - atlas_pro_installer_job = build job: ATLAS_PROFESSIONAL_INSTALLER_BUILD_JOB - parameters: [ - string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), - string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), - string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), - string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), - string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), - string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), - string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), - string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), - string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), - string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), - string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), - string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), - booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), - ] - - if(atlas_pro_installer_job.result.equals("UNSTABLE") || atlas_pro_installer_job.result.equals("FAILURE")) - { - currentBuild.result = atlas_pro_installer_job.result - } - } - } - } - stage('Build Atlas SDK installers') { - steps { - script { - atlas_sdk_installer_job = build job: ATLAS_SDK_INSTALLER_BUILD_JOB - parameters: [ - string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), - string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), - string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), - string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), - string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), - string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), - string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), - string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), - string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), - string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), - string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), - string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), - booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), - ] - - if(atlas_sdk_installer_job.result.equals("UNSTABLE") || atlas_sdk_installer_job.result.equals("FAILURE")) - { - currentBuild.result = atlas_sdk_installer_job.result - } - } - } - } stage('Build Ink UI installers') { steps { script { - ink_ui_installer_job = build job: INK_UI_INSTALLER_BUILD_JOB + modules_installer_job = build job: INK_UI_INSTALLER_BUILD_JOB parameters: [ string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'ATLAS_UI_COMPILE_JOB', value: atlas_compile_job.getProjectName()), - string(name: 'ATLAS_UI_COMPILE_BUILD_SELECTOR', value: " ${atlas_compile_job.getNumber()}"), - string(name: 'INK_UI_COMPILE_JOB', value: ink_ui_compile_job.getProjectName()), - string(name: 'INK_UI_COMPILE_BUILD_SELECTOR', value: " ${ink_ui_compile_job.getNumber()}"), - string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), - string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), - string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), - string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), - string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), - string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), - string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), - string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), - string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), - string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), + string(name: 'ATLAS_CUSTOM_MODULES_COMPILE_JOB', value: modules_compile_job.getProjectName()), + string(name: 'ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR', value: " ${modules_compile_job.getNumber()}"), booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), ] - - if(ink_ui_installer_job.result.equals("UNSTABLE") || ink_ui_installer_job.result.equals("FAILURE")) - { - currentBuild.result = ink_ui_installer_job.result - } } } } @@ -215,16 +71,6 @@ pipeline { release_notes_job = build job: RELEASE_NOTES_JOB, parameters: [ string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'PRINT_SERVER_ARTIFACT_LOCATION', value: PRINT_SERVER_ARTIFACT_LOCATION), - string(name: 'PRINT_SERVER_COMPILE_JOB', value: PRINT_SERVER_COMPILE_JOB), - string(name: 'PRINT_SERVER_BUILD_SELECTOR', value: PRINT_SERVER_BUILD_SELECTOR), - string(name: 'PRINT_SERVER_RELEASE_REPO', value: PRINT_SERVER_RELEASE_REPO), - string(name: 'PRINT_SERVER_RELEASE_REVISION', value: PRINT_SERVER_RELEASE_REVISION), - string(name: 'ATLAS_SERVICES_ARTIFACT_LOCATION', value: ATLAS_SERVICES_ARTIFACT_LOCATION), - string(name: 'ATLAS_SERVICES_COMPILE_JOB', value: ATLAS_SERVICES_COMPILE_JOB), - string(name: 'ATLAS_SERVICES_BUILD_SELECTOR', value: ATLAS_SERVICES_BUILD_SELECTOR), - string(name: 'ATLAS_SERVICES_RELEASE_REPO', value: ATLAS_SERVICES_RELEASE_REPO), - string(name: 'ATLAS_SERVICES_RELEASE_REVISION', value: ATLAS_SERVICES_RELEASE_REVISION), booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), ] } @@ -238,57 +84,14 @@ pipeline { artifacthelper = load("${autobuilder.commonscripts()}/artifacts/metaexport.groovy") subJobs = [ // Sub-job variable, Artifact folder Increment Version Number - [ atlas_compile_job, "atlas_binaries", false, ], - [ ink_ui_compile_job, "ink_ui_binaries", false, ], - [ atlas_pro_installer_job, "atlas_pro_installers", false, ], - [ atlas_sdk_installer_job, "atlas_sdk_installer", false, ], - [ ink_ui_installer_job, "ink_ui_installers", false, ], + [ modules_compile_job, "module_binaries", false, ], + [ modules_installer_job, "module_installers", false, ], [ release_notes_job, "release_notes", false, ], ] artifactFolders = artifacthelper.combineSubjobArtifacts(meta, importer, subJobs) } } } - stage('Check installers for consistency') { - steps { - script { - def mfs = autobuilder.getmetafolderscript() - - echo "Checking meta data for version consistency." - - def atlasmeta = mfs.metafromfolder("atlas_binaries") - def atlasrevision = atlasmeta.buildstampinfo.revision - echo "Atlas meta has revision ${atlasrevision}." - - def proinstallmeta = mfs.metafromfolder("atlas_pro_installers") - def proinstallrevision = proinstallmeta.buildstampinfo.revision - echo "Pro installer meta has revision ${proinstallrevision}." - - def sdkinstallmeta = mfs.metafromfolder("atlas_sdk_installer") - def sdkinstallrevision = sdkinstallmeta.buildstampinfo.revision - echo "SDK installer meta has revision ${sdkinstallrevision}." - - def inkinstallmeta = mfs.metafromfolder("ink_ui_installers") - def inkinstallrevision = inkinstallmeta.buildstampinfo.revision - echo "Ink installer meta has revision ${inkinstallrevision}." - - if(atlasrevision != proinstallrevision) { - echo "A git check-in has been made during the pipeline (Atlas compile revision: ${atlasrevision} does not equal Professional Installer revison: ${proinstallrevision}) so marking build UNSTABLE" - currentBuild.result = 'UNSTABLE' - } - - if(atlasrevision != sdkinstallrevision) { - echo "A git check-in has been made during the pipeline (Atlas compile revision: ${atlasrevision} does not equal SDK Installer revison: ${sdkinstallrevision}) so marking build UNSTABLE" - currentBuild.result = 'UNSTABLE' - } - - if(atlasrevision != inkinstallrevision) { - echo "A git check-in has been made during the pipeline (Atlas compile revision: ${atlasrevision} does not equal Ink Installer revison: ${inkinstallrevision}) so marking build UNSTABLE" - currentBuild.result = 'UNSTABLE' - } - } - } - } stage('Classifying publishable artifacts') { steps { script { diff --git a/compile/compile.groovy b/compile/compile.groovy index e133071..1f380c4 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -12,19 +12,6 @@ pipeline { steps { script { configurationhelper = autobuilder.configurationhelper() - - PYTHONURL = 'git@hydra:tools/python.git' - PYTHONBRANCH = 'origin/3.6.3_windows' - PYTHONDIR = "${WORKSPACE}/python" - PYTHONROOTDIR = 'python' - configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) - env.PYTHON = "${PYTHONDIR}/ver/python.exe" - - VERSTAMPINGURL = 'git@hydra:releases/ver_stamping_releases.git' - VERSTAMPINGREVISION = "refs/tags/${VERSION_STAMPING_VERSION}" - VERSTAMPINGDIR = "${WORKSPACE}/ver_stamping" - VERSTAMPINGROOTDIR = 'ver_stamping_releases' - configurationhelper.gitCheckoutAndRegister(meta, 'Version stamping', VERSTAMPINGURL, VERSTAMPINGREVISION, VERSTAMPINGDIR, VERSTAMPINGROOTDIR) } } } @@ -76,6 +63,7 @@ pipeline { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + def importoptions = importer.getNewImportOptions() importoptions.source(ATLAS_UI_ARTIFACT_LOCATION, ATLAS_UI_COMPILE_JOB, From 9e1831c6b22f1627714796d93c0e53b26ece5e0a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 21:30:13 +0100 Subject: [PATCH 075/115] Correct build all script; Correct release note script --- build/build_all.groovy | 8 ++--- documentation/release_note.groovy | 49 ++++--------------------------- 2 files changed, 9 insertions(+), 48 deletions(-) diff --git a/build/build_all.groovy b/build/build_all.groovy index 27a39d4..cc4a31e 100644 --- a/build/build_all.groovy +++ b/build/build_all.groovy @@ -31,11 +31,11 @@ pipeline { stage('Compile') { steps { script { - modules_compile_job = build job: INK_UI_COMPILE_JOB, + modules_compile_job = build job: CUSTOM_MODULES_COMPILE_JOB, parameters: [ string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'ATLAS_UI_ARTIFACT_LOCATION', value: ATLAS_UI_ARTIFACT_LOCATION, - string(name: 'ATLAS_UI_COMPILE_JOB', value: ATLAS_UI_COMPILE_JOB, + string(name: 'ATLAS_UI_ARTIFACT_LOCATION', value: ATLAS_UI_ARTIFACT_LOCATION), + string(name: 'ATLAS_UI_COMPILE_JOB', value: ATLAS_UI_COMPILE_JOB), string(name: 'ATLAS_UI_BUILD_SELECTOR', value: ATLAS_UI_BUILD_SELECTOR), string(name: 'ATLAS_UI_RELEASE_REPO', value: ATLAS_UI_RELEASE_REPO), string(name: 'ATLAS_UI_RELEASE_REVISION', value: ATLAS_UI_RELEASE_REVISION), @@ -55,7 +55,7 @@ pipeline { stage('Build Ink UI installers') { steps { script { - modules_installer_job = build job: INK_UI_INSTALLER_BUILD_JOB + modules_installer_job = build job: CUSTOM_MODULES_INSTALLER_BUILD_JOB parameters: [ string(name: 'SOURCE_REVISION', value: SOURCEREVISION), string(name: 'ATLAS_CUSTOM_MODULES_COMPILE_JOB', value: modules_compile_job.getProjectName()), diff --git a/documentation/release_note.groovy b/documentation/release_note.groovy index 4060098..75e7a34 100644 --- a/documentation/release_note.groovy +++ b/documentation/release_note.groovy @@ -35,13 +35,12 @@ pipeline { stage('Checkout source') { steps { script { - SOURCEURL = 'git@hydra:gis/atlas_ui.git' + SOURCEURL = 'git@hydra:atlas-ui-modules/custom-modules.git' SOURCEREVISION = SOURCE_REVISION - SOURCEDIR = "${WORKSPACE}\\atlas_ui" - SOURCEROOTDIR = 'atlas_ui' - configurationhelper.gitCheckoutAndRegister(meta, 'atlas_ui', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + SOURCEDIR = "${WORKSPACE}\\custom_modules" + configurationhelper.gitCheckoutAndRegister(meta, 'custom_modules', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) env.SOURCE_PATH = SOURCEDIR - env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build_Atlas" + env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build" env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" env.SRC = SOURCE_PATH } @@ -51,12 +50,8 @@ pipeline { steps { script { env.RELEASE_NOTES = "release_notes" - env.PSBIN = "${WORKSPACE}/ps_bin" - env.ASBIN = "${WORKSPACE}/as_bin" cleanfolders = [ RELEASE_NOTES, - PSBIN, - ASBIN, ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -67,41 +62,7 @@ pipeline { steps { script { version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) - } - } - } - stage('Import Print server to adjust version number') { - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - def psartifactfiles = "meta/**" - psmeta = importer.artifactimport(meta, - PRINT_SERVER_ARTIFACT_LOCATION, - PRINT_SERVER_COMPILE_JOB, - PRINT_SERVER_BUILD_SELECTOR, - PRINT_SERVER_RELEASE_REPO, - PRINT_SERVER_RELEASE_REVISION, - PSBIN, - true, - psartifactfiles) - } - } - } - stage('Import Atlas services to adjust version number') { - steps { - script { - def asartifactfiles = "meta/**" - asmeta = importer.artifactimport(meta, - ATLAS_SERVICES_ARTIFACT_LOCATION, - ATLAS_SERVICES_COMPILE_JOB, - ATLAS_SERVICES_BUILD_SELECTOR, - ATLAS_SERVICES_RELEASE_REPO, - ATLAS_SERVICES_RELEASE_REVISION, - ASBIN, - true, - asartifactfiles) + version.generate(meta, SOURCE_REVISION, SOURCE_PATH) } } } From 5434de857e3490bc6d4bb626af155ae847565f0c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 21:38:56 +0100 Subject: [PATCH 076/115] Correct build all script; Correct release note script --- compile/compile.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compile/compile.groovy b/compile/compile.groovy index 1f380c4..2175248 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -12,6 +12,13 @@ pipeline { steps { script { configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" } } } From 91666f8e799770f9e1c9d713de8b1208cec6ef63 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Oct 2020 23:33:33 +0100 Subject: [PATCH 077/115] Correct build all script; Correct release note script --- build/build_all.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/build/build_all.groovy b/build/build_all.groovy index cc4a31e..d83237e 100644 --- a/build/build_all.groovy +++ b/build/build_all.groovy @@ -82,6 +82,7 @@ pipeline { steps { script { artifacthelper = load("${autobuilder.commonscripts()}/artifacts/metaexport.groovy") + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") subJobs = [ // Sub-job variable, Artifact folder Increment Version Number [ modules_compile_job, "module_binaries", false, ], From 092279614090c76687458f17eeee2ee5ed0061ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 25 Oct 2020 11:09:43 +0000 Subject: [PATCH 078/115] Move compiled binaries from a bin folder --- compile/compile.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index 2175248..c34906d 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -126,7 +126,7 @@ pipeline { steps { script { bat """ - move "${SRC}\\Atlas Release\\Modules" bin + move "${SRC}\\bin" . if errorlevel 1 exit /b 1 """ } From f26c58900dd5202b8666295e649926a90450b6ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 25 Oct 2020 20:43:44 +0000 Subject: [PATCH 079/115] Do another installer --- install/install.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 25ebf21..1f1f128 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,8 +148,9 @@ pipeline { ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Libraries/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Libraries.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], ] importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") From df3e9c6239d290a1f1125c492e1bb03fbfc8b130 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 25 Oct 2020 20:54:15 +0000 Subject: [PATCH 080/115] Do another installer --- install/install.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 1f1f128..b68964f 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,9 +148,9 @@ pipeline { ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Libraries/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Libraries.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Libraries/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Libraries.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Libraries", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], ] importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") From 874943b5de13306b6a10ff78009118722d92811e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 25 Oct 2020 21:00:26 +0000 Subject: [PATCH 081/115] Do another installer --- install/install.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index b68964f..5f599a0 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,9 +148,9 @@ pipeline { ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Libraries/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Libraries.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Libraries", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], ] importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") From e4dea6afb65b8aa786e6b69c430f545ed0af4e67 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Oct 2020 13:06:52 +0000 Subject: [PATCH 082/115] Alter where atlas ui binaries are imported --- compile/compile.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/compile.groovy b/compile/compile.groovy index c34906d..3fc4e25 100644 --- a/compile/compile.groovy +++ b/compile/compile.groovy @@ -33,7 +33,7 @@ pipeline { env.JOBSCRIPTS = "${SOURCE_PATH}\\autobuild\\build" env.JOBSCRIPTS_COMMON = "${SOURCE_PATH}\\autobuild\\common" env.SRC = SOURCE_PATH - env.AULIB = "${SRC}/Libraries/Imports/atlas-ui" + env.AULIB = "${SRC}/imports/atlas-ui" } } } From a5563743ba3aa847328f53abaf184a36572f3b6b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Oct 2020 14:05:15 +0000 Subject: [PATCH 083/115] More installers --- install/install.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 5f599a0..4ab7a60 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,9 +148,11 @@ pipeline { ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], + COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], ] importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") From fa01017b78ae3da93f46c894a1b5859a4e5693a7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Oct 2020 14:16:09 +0000 Subject: [PATCH 084/115] More installers --- install/install.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 4ab7a60..1f89fb6 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,11 +148,11 @@ pipeline { ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], - LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], - COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], + COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Component Monitor/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], ] importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") From 41073440123754c02585852e11fe119fcf025ae3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Oct 2020 15:27:29 +0000 Subject: [PATCH 085/115] Add printhead profiler installer --- install/install.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/install/install.groovy b/install/install.groovy index 1f89fb6..40606a1 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -149,6 +149,7 @@ pipeline { ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], From 22217b28799bf630106158557d835d46b30a9f08 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Oct 2020 14:42:23 +0000 Subject: [PATCH 086/115] Add direct to shape --- install/install.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/install/install.groovy b/install/install.groovy index 40606a1..99864f4 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -149,6 +149,7 @@ pipeline { ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape ", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], From 1e49926358d487a5d20b3d7255d51d98fc812b36 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Oct 2020 14:53:10 +0000 Subject: [PATCH 087/115] Add direct to shape --- install/install.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/install.groovy b/install/install.groovy index 99864f4..e7fa9c2 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -149,7 +149,7 @@ pipeline { ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape ", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], + DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], From 296f2bcff5ddd44693b498130d73f35fa252cf61 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 31 Oct 2020 11:46:59 +0000 Subject: [PATCH 088/115] Add linearisation importer installer --- install/install.groovy | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index e7fa9c2..26fb5b2 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,13 +148,14 @@ pipeline { ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], - PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], - COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], - LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], - COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Component Monitor/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + LINEARISATION_IMPORTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_linear_import.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Linearisation Importer/DiskImages/DISK1/GIS Atlas UI Custom Module - Linearisation Importer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Linearisation Importer", "GIS Atlas UI Custom Module - Linearisation Importer ${BUILD_STAMP}.exe" ], + DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], + PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], + COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], + COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Component Monitor/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], ] importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") From 5dbcfe279949c3102c0efd2e8e1af71d74018888 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 2 Nov 2020 12:02:11 +0000 Subject: [PATCH 089/115] Add image conversion module --- install/install.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/install/install.groovy b/install/install.groovy index 26fb5b2..ab4fb87 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -149,6 +149,7 @@ pipeline { ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + IMAGE_CONVERSION: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_image_convert.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Image Conversion/DiskImages/DISK1/GIS Atlas UI Custom Module - Image Conversion.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Image Conversion", "GIS Atlas UI Custom Module - Image Conversion ${BUILD_STAMP}.exe" ], LINEARISATION_IMPORTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_linear_import.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Linearisation Importer/DiskImages/DISK1/GIS Atlas UI Custom Module - Linearisation Importer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Linearisation Importer", "GIS Atlas UI Custom Module - Linearisation Importer ${BUILD_STAMP}.exe" ], DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], From b47ba768d9ce92e03b95bcab3701f8779f91c9b4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 2 Nov 2020 12:21:23 +0000 Subject: [PATCH 090/115] Add image conversion module --- install/install.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/install.groovy b/install/install.groovy index ab4fb87..a0a0956 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -149,7 +149,7 @@ pipeline { ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - IMAGE_CONVERSION: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_image_convert.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Image Conversion/DiskImages/DISK1/GIS Atlas UI Custom Module - Image Conversion.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Image Conversion", "GIS Atlas UI Custom Module - Image Conversion ${BUILD_STAMP}.exe" ], + IMAGE_CONVERTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_image_convert.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Image Conversion/DiskImages/DISK1/GIS Atlas UI Custom Module - Image Conversion.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Image Conversion", "GIS Atlas UI Custom Module - Image Conversion ${BUILD_STAMP}.exe" ], LINEARISATION_IMPORTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_linear_import.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Linearisation Importer/DiskImages/DISK1/GIS Atlas UI Custom Module - Linearisation Importer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Linearisation Importer", "GIS Atlas UI Custom Module - Linearisation Importer ${BUILD_STAMP}.exe" ], DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], From d3ec3150c2e8cc00943bc9f75304be9b6290f8df Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 3 Nov 2020 10:43:15 +0000 Subject: [PATCH 091/115] Add installers for output simulator and scanning xy camera align --- install/install.groovy | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index a0a0956..4683371 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,15 +148,17 @@ pipeline { ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ - // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - IMAGE_CONVERTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_image_convert.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Image Conversion/DiskImages/DISK1/GIS Atlas UI Custom Module - Image Conversion.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Image Conversion", "GIS Atlas UI Custom Module - Image Conversion ${BUILD_STAMP}.exe" ], - LINEARISATION_IMPORTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_linear_import.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Linearisation Importer/DiskImages/DISK1/GIS Atlas UI Custom Module - Linearisation Importer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Linearisation Importer", "GIS Atlas UI Custom Module - Linearisation Importer ${BUILD_STAMP}.exe" ], - DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], - PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], - COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], - LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], - COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Component Monitor/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], + // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename + OUTPUT_SIMULATOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_output_simulate.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Output Simulator/DiskImages/DISK1/GIS Atlas UI Custom Module - Output Simulator.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Output Simulator", "GIS Atlas UI Custom Module - Output Simulator ${BUILD_STAMP}.exe" ], + SCANNING_XY_CAMERA_ALIGN: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_scanning_xy_camera_align.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Scanning XY Camera Align/DiskImages/DISK1/GIS Atlas UI Custom Module - Scanning XY Camera Align.exe","${EXPORTSPATH}/GIS Atlas UI Custom Module - Scanning XY Camera Align", "GIS Atlas UI Custom Module - Scanning XY Camera Align ${BUILD_STAMP}.exe" ], + IMAGE_CONVERTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_image_convert.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Image Conversion/DiskImages/DISK1/GIS Atlas UI Custom Module - Image Conversion.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Image Conversion", "GIS Atlas UI Custom Module - Image Conversion ${BUILD_STAMP}.exe" ], + LINEARISATION_IMPORTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_linear_import.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Linearisation Importer/DiskImages/DISK1/GIS Atlas UI Custom Module - Linearisation Importer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Linearisation Importer", "GIS Atlas UI Custom Module - Linearisation Importer ${BUILD_STAMP}.exe" ], + DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], + PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], + COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], + LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], + COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Component Monitor/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], ] importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") From 80d9106f41cfe94aad1bed732f38292e209541db Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 8 Nov 2020 21:44:53 +0000 Subject: [PATCH 092/115] Correction after subtree pull --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 531b3eb..6f3a33f 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -63,7 +63,7 @@ pipeline { stage("Clean exports") { steps { script { - STATICANALYSIS = "${WORKSPACE}/staticanalysis" + STATICANALYSIS = 'staticanalysis' cleanfolders = [ STATICANALYSIS, ] From 45f443de4901f669d318b9cf7111fe1cac8cfea4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 24 Nov 2020 23:21:48 +0000 Subject: [PATCH 093/115] Handle an optional release repo variant suffix --- autobuilder.groovy | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 71d9b6a..60ab1f6 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -34,8 +34,22 @@ def getmetafolderscript() { return metafolderscript } +def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { + def String altered = releaserepo.trim() + def String dotgit = '.git' + + if (releaserepovariantsuffix?.trim()) { + if altered.endsWith(dotgit) { + altered = altered.dropRight(dotgit.length()) '_' + releaserepovariantsuffix + dotgit + } else { + altered = altered + '_' + releaserepovariantsuffix + } + } + return altered +} + // Start up boilderplate -def startbuild(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String releaserepo = RELEASE_REPO, String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) { +def startbuild(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String releaserepo = RELEASE_REPO, String releaserepovariantsuffix = '', String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -52,8 +66,10 @@ def startbuild(script, String productname = PRODUCT_NAME, String subcomponentnam meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) def rr = load("${commonscripts()}/release/registerrepo.groovy") - echo "Release repo: ${releaserepo}" - rr.registerrepo(meta, releaserepo) + def String alteredreleaserepo = alterreleaserepo(releaserepo, releaserepovariantsuffix) + + echo "Release repo: ${alteredreleaserepo}" + rr.registerrepo(meta, alteredreleaserepo) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From 38e5e8b4b0525c9432c2b47335675ea53e1cbea2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 24 Nov 2020 23:22:46 +0000 Subject: [PATCH 094/115] Handle an optional release repo variant suffix --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 60ab1f6..655e0fb 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -39,7 +39,7 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { def String dotgit = '.git' if (releaserepovariantsuffix?.trim()) { - if altered.endsWith(dotgit) { + if (altered.endsWith(dotgit)) { altered = altered.dropRight(dotgit.length()) '_' + releaserepovariantsuffix + dotgit } else { altered = altered + '_' + releaserepovariantsuffix From da1ba65dd5e0a1c15a637e32b62a8226b4d53280 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 24 Nov 2020 23:28:12 +0000 Subject: [PATCH 095/115] Handle an optional release repo variant suffix --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 655e0fb..72005d2 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -40,7 +40,7 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { if (releaserepovariantsuffix?.trim()) { if (altered.endsWith(dotgit)) { - altered = altered.dropRight(dotgit.length()) '_' + releaserepovariantsuffix + dotgit + altered = altered.dropRight(dotgit.length().toInteger()) '_' + releaserepovariantsuffix + dotgit } else { altered = altered + '_' + releaserepovariantsuffix } From 44bd53c2bd7526dbc6678b1161e6d5ce5a57f15a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 24 Nov 2020 23:40:40 +0000 Subject: [PATCH 096/115] Handle an optional release repo variant suffix --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 72005d2..b7f732d 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -40,7 +40,7 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { if (releaserepovariantsuffix?.trim()) { if (altered.endsWith(dotgit)) { - altered = altered.dropRight(dotgit.length().toInteger()) '_' + releaserepovariantsuffix + dotgit + altered = altered.substring(0, altered.length() - dotgit.length() + '_' + releaserepovariantsuffix + dotgit } else { altered = altered + '_' + releaserepovariantsuffix } From 9c0f6459f7152adfa8fc1b695c9e0dd02581a6b7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 24 Nov 2020 23:42:04 +0000 Subject: [PATCH 097/115] Handle an optional release repo variant suffix --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index b7f732d..b89dd97 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -40,7 +40,7 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { if (releaserepovariantsuffix?.trim()) { if (altered.endsWith(dotgit)) { - altered = altered.substring(0, altered.length() - dotgit.length() + '_' + releaserepovariantsuffix + dotgit + altered = altered.substring(0, altered.length() - dotgit.length()) + '_' + releaserepovariantsuffix + dotgit } else { altered = altered + '_' + releaserepovariantsuffix } From 510787952a01d5b41a66569fa0d24a5bb5de4d7e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 26 Nov 2020 09:16:07 +0000 Subject: [PATCH 098/115] HMBFDHV-529 - Change English --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 441ad06..9243aa4 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -17,7 +17,7 @@ def main(argv): pattern = args.pattern substitute = args.substitute - print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert)) + print("Converting instances of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert)) with open(filetoconvert,'r') as c: fileread = c.read() From 7800a1de4c56171084e67885ef9c8c3e04d24ec6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 29 Nov 2020 19:22:49 +0000 Subject: [PATCH 099/115] HMBFDHV-529 - Do string substitution on release repo uri so that variants can be accommodated and support the use of gitlab groups --- autobuilder.groovy | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index b89dd97..20dee5b 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -36,14 +36,9 @@ def getmetafolderscript() { def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { def String altered = releaserepo.trim() - def String dotgit = '.git' if (releaserepovariantsuffix?.trim()) { - if (altered.endsWith(dotgit)) { - altered = altered.substring(0, altered.length() - dotgit.length()) + '_' + releaserepovariantsuffix + dotgit - } else { - altered = altered + '_' + releaserepovariantsuffix - } + altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", buildreleaserepovariantsuffix_variant) } return altered } From b6b899ab7b2b62d160f8b0ec84c45ef62cd3243b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 29 Nov 2020 19:26:08 +0000 Subject: [PATCH 100/115] HMBFDHV-529 - Do string substitution on release repo uri so that variants can be accommodated and support the use of gitlab groups --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 20dee5b..4e04695 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -38,7 +38,7 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { def String altered = releaserepo.trim() if (releaserepovariantsuffix?.trim()) { - altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", buildreleaserepovariantsuffix_variant) + altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", releaserepovariantsuffix) } return altered } From 92f7f3ceaab835abd9f152b40cc2b7fd573cfaa7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Dec 2020 09:37:14 +0000 Subject: [PATCH 101/115] Try to print out related components --- install/install.groovy | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 4683371..2040470 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -129,12 +129,36 @@ pipeline { } steps { script { - version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCE_PATH) + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def importoptions = importer.getNewImportOptions() + importoptions.jenkinsjob(ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR) + importoptions.setincrementversionnumber(false) + def compilemeta = importer.artifactimport(meta, importoptions, "${IMPORTSPATH}\\build\\moduleset" ) + def relatedcomponents = compilemeta.metareleasewalkerversionunique(1) + relatedcomponents.each { + relatedcomponent -> echo "relatedcomponent string: ${relatedcomponent.key}" + } } } } - stage("Import binaries") { + stage('Import binaries 1') { + when { + expression { + toBuild + } + } + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH) + + metareleasewalkerversionunique(int maxdepth, String startpath = "") { + + } + } + } + stage("Import binaries 2") { when { expression { toBuild @@ -160,7 +184,6 @@ pipeline { LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Component Monitor/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], ] - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) } From 4da3126e5f49e7423f1c6752be0b7ea9032ffa19 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Dec 2020 09:42:12 +0000 Subject: [PATCH 102/115] Try to print out related components --- install/install.groovy | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 2040470..62f51e1 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -129,16 +129,8 @@ pipeline { } steps { script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - def importoptions = importer.getNewImportOptions() - importoptions.jenkinsjob(ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR) - importoptions.setincrementversionnumber(false) - def compilemeta = importer.artifactimport(meta, importoptions, "${IMPORTSPATH}\\build\\moduleset" ) - def relatedcomponents = compilemeta.metareleasewalkerversionunique(1) - relatedcomponents.each { - relatedcomponent -> echo "relatedcomponent string: ${relatedcomponent.key}" - } + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH) } } } @@ -150,11 +142,16 @@ pipeline { } steps { script { - version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCE_PATH) - - metareleasewalkerversionunique(int maxdepth, String startpath = "") { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + def importoptions = importer.getNewImportOptions() + importoptions.jenkinsjob(ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR) + importoptions.setincrementversionnumber(false) + def compilemeta = importer.artifactimport(meta, importoptions, "${IMPORTSPATH}\\build\\moduleset") + def relatedcomponents = compilemeta.metareleasewalkerversionunique(1) + relatedcomponents.each { + relatedcomponent -> echo "relatedcomponent string: ${relatedcomponent.key}" + } } } } From 1dcbf2b2a258e0bcec9b7a2dfc942c9f28c69add Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Dec 2020 09:47:51 +0000 Subject: [PATCH 103/115] Try to print out related components --- install/install.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/install.groovy b/install/install.groovy index 62f51e1..4873163 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,7 +148,8 @@ pipeline { importoptions.jenkinsjob(ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR) importoptions.setincrementversionnumber(false) def compilemeta = importer.artifactimport(meta, importoptions, "${IMPORTSPATH}\\build\\moduleset") - def relatedcomponents = compilemeta.metareleasewalkerversionunique(1) + def maxdepth = 1 + def relatedcomponents = compilemeta.metareleasewalkerversionunique(maxdepth.toInteger()) relatedcomponents.each { relatedcomponent -> echo "relatedcomponent string: ${relatedcomponent.key}" } From 75abd31a909f8a1c9642f2adbc7338be1134f022 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Dec 2020 11:28:04 +0000 Subject: [PATCH 104/115] Try to print out related components --- install/install.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/install.groovy b/install/install.groovy index 4873163..46e475d 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -149,7 +149,7 @@ pipeline { importoptions.setincrementversionnumber(false) def compilemeta = importer.artifactimport(meta, importoptions, "${IMPORTSPATH}\\build\\moduleset") def maxdepth = 1 - def relatedcomponents = compilemeta.metareleasewalkerversionunique(maxdepth.toInteger()) + def relatedcomponents = compilemeta.releasewalkerversionunique(maxdepth.toInteger()) relatedcomponents.each { relatedcomponent -> echo "relatedcomponent string: ${relatedcomponent.key}" } From 271b2ea1474289a2ef5a96352282747b3c5019de Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Dec 2020 11:30:04 +0000 Subject: [PATCH 105/115] Try to print out related components --- install/install.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/install.groovy b/install/install.groovy index 46e475d..5dc75bc 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -148,7 +148,7 @@ pipeline { importoptions.jenkinsjob(ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR) importoptions.setincrementversionnumber(false) def compilemeta = importer.artifactimport(meta, importoptions, "${IMPORTSPATH}\\build\\moduleset") - def maxdepth = 1 + def maxdepth = 2 def relatedcomponents = compilemeta.releasewalkerversionunique(maxdepth.toInteger()) relatedcomponents.each { relatedcomponent -> echo "relatedcomponent string: ${relatedcomponent.key}" From e82037145fb31ec2452d3c49543de64dbb603995 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Dec 2020 12:17:01 +0000 Subject: [PATCH 106/115] Set version number to that of Atlas UI Binaries --- install/install.groovy | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/install/install.groovy b/install/install.groovy index 5dc75bc..1195584 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -134,7 +134,7 @@ pipeline { } } } - stage('Import binaries 1') { + stage('Get Atlas UI buildstamp') { when { expression { toBuild @@ -149,10 +149,10 @@ pipeline { importoptions.setincrementversionnumber(false) def compilemeta = importer.artifactimport(meta, importoptions, "${IMPORTSPATH}\\build\\moduleset") def maxdepth = 2 - def relatedcomponents = compilemeta.releasewalkerversionunique(maxdepth.toInteger()) - relatedcomponents.each { - relatedcomponent -> echo "relatedcomponent string: ${relatedcomponent.key}" - } + def relatedcomponents = compilemeta.releasewalkerunique(maxdepth.toInteger()) + atlasuibinariesmeta = relatedcomponents['ATLAS_UI_CORE_BINARIES'] + env.ATLAS_UI_BUILD_STAMP = atlasuibinariesmeta.buildstampinfo.buildstamp + } } } @@ -164,23 +164,22 @@ pipeline { } steps { script { - env.BUILD_STAMP=meta.buildstampinfo.buildstamp artifactDetails = [ // Key, Artifacts Source project Artifacts source selector, Destination folder Increment Version Number Artifacts to copy Artifacts to not copy Binaries Folders ModuleSet: [ATLAS_CUSTOM_MODULES_COMPILE_JOB, ATLAS_CUSTOM_MODULES_COMPILE_JOB_SELECTOR, "${IMPORTSPATH}\\build\\moduleset", false, 'meta/**, bin/**', '**/*.lib', [ 'bin' ], ], ] installerDetails = [ // Key, Installer command artifactSet Target folder Execution path ISM project file Variant Intermediate output path Component base folder Final filename - OUTPUT_SIMULATOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_output_simulate.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Output Simulator/DiskImages/DISK1/GIS Atlas UI Custom Module - Output Simulator.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Output Simulator", "GIS Atlas UI Custom Module - Output Simulator ${BUILD_STAMP}.exe" ], - SCANNING_XY_CAMERA_ALIGN: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_scanning_xy_camera_align.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Scanning XY Camera Align/DiskImages/DISK1/GIS Atlas UI Custom Module - Scanning XY Camera Align.exe","${EXPORTSPATH}/GIS Atlas UI Custom Module - Scanning XY Camera Align", "GIS Atlas UI Custom Module - Scanning XY Camera Align ${BUILD_STAMP}.exe" ], - IMAGE_CONVERTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_image_convert.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Image Conversion/DiskImages/DISK1/GIS Atlas UI Custom Module - Image Conversion.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Image Conversion", "GIS Atlas UI Custom Module - Image Conversion ${BUILD_STAMP}.exe" ], - LINEARISATION_IMPORTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_linear_import.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Linearisation Importer/DiskImages/DISK1/GIS Atlas UI Custom Module - Linearisation Importer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Linearisation Importer", "GIS Atlas UI Custom Module - Linearisation Importer ${BUILD_STAMP}.exe" ], - DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${BUILD_STAMP}.exe" ], - PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${BUILD_STAMP}.exe" ], - COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${BUILD_STAMP}.exe" ], - ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${BUILD_STAMP}.exe" ], - LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${BUILD_STAMP}.exe" ], - COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Component Monitor/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${BUILD_STAMP}.exe" ], + OUTPUT_SIMULATOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_output_simulate.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Output Simulator/DiskImages/DISK1/GIS Atlas UI Custom Module - Output Simulator.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Output Simulator", "GIS Atlas UI Custom Module - Output Simulator ${ATLAS_UI_BUILD_STAMP}.exe" ], + SCANNING_XY_CAMERA_ALIGN: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_scanning_xy_camera_align.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Scanning XY Camera Align/DiskImages/DISK1/GIS Atlas UI Custom Module - Scanning XY Camera Align.exe","${EXPORTSPATH}/GIS Atlas UI Custom Module - Scanning XY Camera Align", "GIS Atlas UI Custom Module - Scanning XY Camera Align ${ATLAS_UI_BUILD_STAMP}.exe" ], + IMAGE_CONVERTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_image_convert.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Image Conversion/DiskImages/DISK1/GIS Atlas UI Custom Module - Image Conversion.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Image Conversion", "GIS Atlas UI Custom Module - Image Conversion ${ATLAS_UI_BUILD_STAMP}.exe" ], + LINEARISATION_IMPORTER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_linear_import.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Linearisation Importer/DiskImages/DISK1/GIS Atlas UI Custom Module - Linearisation Importer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Linearisation Importer", "GIS Atlas UI Custom Module - Linearisation Importer ${ATLAS_UI_BUILD_STAMP}.exe" ], + DIRECT_TO_SHAPE: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_direct_to_shape.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Direct To Shape/DiskImages/DISK1/GIS Atlas UI Custom Module - Direct To Shape.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Direct To Shape", "GIS Atlas UI Custom Module - Direct To Shape ${ATLAS_UI_BUILD_STAMP}.exe" ], + PRINTHEAD_PROFILER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_printhead_profiler.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Printhead Profiler/DiskImages/DISK1/GIS Atlas UI Custom Module - Printhead Profiler.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Printhead Profiler", "GIS Atlas UI Custom Module - Printhead Profiler ${ATLAS_UI_BUILD_STAMP}.exe" ], + COMMON_LIBRARIES: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_common.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Common Lib/DiskImages/DISK1/GIS Atlas UI Custom Module - Common Lib.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Common Lib", "GIS Atlas UI Custom Module - Common Lib ${ATLAS_UI_BUILD_STAMP}.exe" ], + ENC_AND_PD: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_enc_and_pd.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Enc and PD/DiskImages/DISK1/GIS Atlas UI Custom Module - Enc and PD.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Enc and PD", "GIS Atlas UI Custom Module - Enc and PD ${ATLAS_UI_BUILD_STAMP}.exe" ], + LOG_VIEWER: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_log_viewer.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Log Viewer/DiskImages/DISK1/GIS Atlas UI Custom Module - Log Viewer.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Log Viewer", "GIS Atlas UI Custom Module - Log Viewer ${ATLAS_UI_BUILD_STAMP}.exe" ], + COMPONENT_MONITOR: [INSTALLSHIELD2019_CMD, ['ModuleSet'], 'module', "${SOURCE_PATH}\\installer\\build\\moduleset", 'CM_component_monitor.ism', '', "${INTERMEDIATEEXPORTSPATH}/module/x64/GIS Atlas UI Custom Module - Component Monitor/DiskImages/DISK1/GIS Atlas UI Custom Module - Component Monitor.exe", "${EXPORTSPATH}/GIS Atlas UI Custom Module - Component Monitor", "GIS Atlas UI Custom Module - Component Monitor ${ATLAS_UI_BUILD_STAMP}.exe" ], ] installerhelper = load("${autobuilder.commonscripts()}/install/installhelper.groovy") artifactFetched = installerhelper.artifactsImporter(meta, importer, artifactDetails, installerDetails) @@ -191,7 +190,7 @@ pipeline { steps { script { def metamap = [ - ["${VERSIONINFO}", meta], // Incomplete until this job ends + [VERSIONINFO, meta], // Incomplete until this job ends ] for (metaitem in metamap) { (destfolder, componentmeta) = metaitem @@ -220,8 +219,8 @@ pipeline { def importmeta = artifactFetched.get(artifactKey) - echo "For: ${installer} build stamp is: ${importmeta.buildstampinfo.buildstamp}" - def INST_ISVERSION = importmeta.buildstampinfo.buildstamp + echo "For: ${installer} build stamp is: ${ATLAS_UI_BUILD_STAMP}" + def INST_ISVERSION = ATLAS_UI_BUILD_STAMP (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) def COMPILE_IMPORTS = destFolder From f3e5a859acce788f1671b93f6cbcff0e3498c77c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Dec 2020 12:20:33 +0000 Subject: [PATCH 107/115] Set version number to that of Atlas UI Binaries --- install/install.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/install.groovy b/install/install.groovy index 1195584..7f66af9 100644 --- a/install/install.groovy +++ b/install/install.groovy @@ -152,7 +152,7 @@ pipeline { def relatedcomponents = compilemeta.releasewalkerunique(maxdepth.toInteger()) atlasuibinariesmeta = relatedcomponents['ATLAS_UI_CORE_BINARIES'] env.ATLAS_UI_BUILD_STAMP = atlasuibinariesmeta.buildstampinfo.buildstamp - + echo "Build stamp of associated Atlas UI: ${ATLAS_UI_BUILD_STAMP}" } } } From 0ba2590cf130332feae9c89e3d8ca9aafb60dbd9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 17 Dec 2020 13:13:50 +0000 Subject: [PATCH 108/115] Subtree removed - as git indicates it was not added --- Common_scripts/.project | 17 - Common_scripts/.pydevproject | 8 - .../org.eclipse.core.resources.prefs | 2 - Common_scripts/artifacts/metaexport.groovy | 22 - Common_scripts/autobuilder.groovy | 98 -- Common_scripts/check/build_meta.groovy | 86 -- Common_scripts/check/do_meta.groovy | 77 -- Common_scripts/checksum/utils.groovy | 14 - Common_scripts/clean/clean.groovy | 10 - Common_scripts/commandline/commandline.groovy | 13 - .../eclipsebuild/disableparallelbuilds.groovy | 12 - .../eclipsebuild/eclipseSTM8build.groovy | 172 ---- .../eclipsebuild/eclipseds5build.groovy | 252 ------ .../eclipsebuild/eclipseniosbuild.groovy | 116 --- .../configuration/configuration.groovy | 18 - Common_scripts/copy/all.groovy | 86 -- Common_scripts/copy/esw.groovy | 63 -- Common_scripts/copy/filtered.groovy | 70 -- Common_scripts/copy/logic.groovy | 62 -- Common_scripts/differences/.project | 17 - Common_scripts/differences/.pydevproject | 8 - .../differences/dometahierarchy.groovy | 836 ------------------ Common_scripts/differences/file.groovy | 16 - Common_scripts/differences/json.groovy | 15 - .../differences/metahierarchy.groovy | 91 -- .../documentation/doxygen_deploy.groovy | 80 -- Common_scripts/import/importer.groovy | 333 ------- Common_scripts/install/installhelper.groovy | 117 --- Common_scripts/meta/folder.groovy | 772 ---------------- Common_scripts/packaging/debian.groovy | 106 --- Common_scripts/platform/lineendings.groovy | 5 - Common_scripts/publish/.classpath | 9 - Common_scripts/publish/.gitignore | 7 - Common_scripts/publish/.project | 18 - .../org.eclipse.jdt.groovy.core.prefs | 3 - Common_scripts/publish/do.groovy | 174 ---- Common_scripts/publish/package.groovy | 176 ---- .../publish/promptingpublish.groovy | 179 ---- Common_scripts/publish/publish.groovy | 91 -- Common_scripts/publish/publishitems.groovy | 127 --- Common_scripts/publishing/utils.groovy | 27 - Common_scripts/release/do.groovy | 439 --------- Common_scripts/release/registerrepo.groovy | 12 - Common_scripts/release/release.groovy | 88 -- Common_scripts/remoteaccess/ftp.groovy | 32 - Common_scripts/remoteaccess/hostedftp.groovy | 28 - Common_scripts/staticanalysis/ccm.groovy | 119 --- Common_scripts/staticanalysis/cpd.groovy | 151 ---- Common_scripts/staticanalysis/cppcheck.groovy | 113 --- Common_scripts/textutils/subst.groovy | 8 - .../vs2017install/buildmachines.vsconfig | 25 - Common_scripts/versioncontrol/git.groovy | 376 -------- Common_scripts/versionnumbering/do.groovy | 23 - .../versionnumbering/generate.groovy | 169 ---- Common_scripts/versionstamping/.project | 17 - Common_scripts/versionstamping/.pydevproject | 8 - .../versionstamping/versionstamper.py | 38 - 57 files changed, 6051 deletions(-) delete mode 100644 Common_scripts/.project delete mode 100644 Common_scripts/.pydevproject delete mode 100644 Common_scripts/.settings/org.eclipse.core.resources.prefs delete mode 100644 Common_scripts/artifacts/metaexport.groovy delete mode 100644 Common_scripts/autobuilder.groovy delete mode 100644 Common_scripts/check/build_meta.groovy delete mode 100644 Common_scripts/check/do_meta.groovy delete mode 100644 Common_scripts/checksum/utils.groovy delete mode 100644 Common_scripts/clean/clean.groovy delete mode 100644 Common_scripts/commandline/commandline.groovy delete mode 100644 Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy delete mode 100644 Common_scripts/compile/eclipsebuild/eclipseSTM8build.groovy delete mode 100644 Common_scripts/compile/eclipsebuild/eclipseds5build.groovy delete mode 100644 Common_scripts/compile/eclipsebuild/eclipseniosbuild.groovy delete mode 100644 Common_scripts/configuration/configuration.groovy delete mode 100644 Common_scripts/copy/all.groovy delete mode 100644 Common_scripts/copy/esw.groovy delete mode 100644 Common_scripts/copy/filtered.groovy delete mode 100644 Common_scripts/copy/logic.groovy delete mode 100644 Common_scripts/differences/.project delete mode 100644 Common_scripts/differences/.pydevproject delete mode 100644 Common_scripts/differences/dometahierarchy.groovy delete mode 100644 Common_scripts/differences/file.groovy delete mode 100644 Common_scripts/differences/json.groovy delete mode 100644 Common_scripts/differences/metahierarchy.groovy delete mode 100644 Common_scripts/documentation/doxygen_deploy.groovy delete mode 100644 Common_scripts/import/importer.groovy delete mode 100644 Common_scripts/install/installhelper.groovy delete mode 100644 Common_scripts/meta/folder.groovy delete mode 100644 Common_scripts/packaging/debian.groovy delete mode 100644 Common_scripts/platform/lineendings.groovy delete mode 100644 Common_scripts/publish/.classpath delete mode 100644 Common_scripts/publish/.gitignore delete mode 100644 Common_scripts/publish/.project delete mode 100644 Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs delete mode 100644 Common_scripts/publish/do.groovy delete mode 100644 Common_scripts/publish/package.groovy delete mode 100644 Common_scripts/publish/promptingpublish.groovy delete mode 100644 Common_scripts/publish/publish.groovy delete mode 100644 Common_scripts/publish/publishitems.groovy delete mode 100644 Common_scripts/publishing/utils.groovy delete mode 100644 Common_scripts/release/do.groovy delete mode 100644 Common_scripts/release/registerrepo.groovy delete mode 100644 Common_scripts/release/release.groovy delete mode 100644 Common_scripts/remoteaccess/ftp.groovy delete mode 100644 Common_scripts/remoteaccess/hostedftp.groovy delete mode 100644 Common_scripts/staticanalysis/ccm.groovy delete mode 100644 Common_scripts/staticanalysis/cpd.groovy delete mode 100644 Common_scripts/staticanalysis/cppcheck.groovy delete mode 100644 Common_scripts/textutils/subst.groovy delete mode 100644 Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig delete mode 100644 Common_scripts/versioncontrol/git.groovy delete mode 100644 Common_scripts/versionnumbering/do.groovy delete mode 100644 Common_scripts/versionnumbering/generate.groovy delete mode 100644 Common_scripts/versionstamping/.project delete mode 100644 Common_scripts/versionstamping/.pydevproject delete mode 100644 Common_scripts/versionstamping/versionstamper.py diff --git a/Common_scripts/.project b/Common_scripts/.project deleted file mode 100644 index e329c3f..0000000 --- a/Common_scripts/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Common Build Scripts - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/Common_scripts/.pydevproject b/Common_scripts/.pydevproject deleted file mode 100644 index 1ce5929..0000000 --- a/Common_scripts/.pydevproject +++ /dev/null @@ -1,8 +0,0 @@ - - - -/${PROJECT_DIR_NAME} - -python 2.7 -python35 - diff --git a/Common_scripts/.settings/org.eclipse.core.resources.prefs b/Common_scripts/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 1174a06..0000000 --- a/Common_scripts/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding//versionnumbering/versioninfo.py=utf-8 diff --git a/Common_scripts/artifacts/metaexport.groovy b/Common_scripts/artifacts/metaexport.groovy deleted file mode 100644 index 67d13c3..0000000 --- a/Common_scripts/artifacts/metaexport.groovy +++ /dev/null @@ -1,22 +0,0 @@ - -// Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders -def combineSubjobArtifacts(meta, importer, subJobs) { - def ArrayList artifactFolders = new ArrayList() - for (subJob in subJobs) { - def subJobObject = subJob[0] - if (subJobObject != null) { - def subJobName = subJobObject.getProjectName() - def subJobNumber = subJobObject.getNumber() - def destFolder = subJob[1] - def boolean incrementversionnumber = subJob[2] - dir(destFolder) { - deleteDir() - } - importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) - artifactFolders.add("${destFolder}/**") - } - } - return artifactFolders -} - -return this; diff --git a/Common_scripts/autobuilder.groovy b/Common_scripts/autobuilder.groovy deleted file mode 100644 index 71d9b6a..0000000 --- a/Common_scripts/autobuilder.groovy +++ /dev/null @@ -1,98 +0,0 @@ -// Assume that WORKSPACE environment variable is set - -autobuildroot = 'autobuild' -commonscriptsroot = "${autobuildroot}/Common_scripts" -metafolderscript = null - -def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { - if (doclean) { - echo "Cleaning workspace" - // Save any script files that were loaded into the workspace at first and are required after cleaning the workspace - def stashname = 'Clean workspace stash' - stash(allowEmpty: true, - includes: "${autobuildroot}/**,${autobuildroot}/.git/**", - name: stashname, - useDefaultExcludes: false - ) - cleanWs() - unstash name: stashname - } - else { - echo "Not cleaning workspace" - } -} - -def commonscripts() { - return commonscriptsroot -} - -def getautobuildpath() { - return autobuildroot -} - -def getmetafolderscript() { - return metafolderscript -} - -// Start up boilderplate -def startbuild(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String releaserepo = RELEASE_REPO, String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) { - echo "Starting...." - - autobuildroot = autobuildpath - commonscriptsroot = commonscriptspath - metafolderscript = load("${commonscripts()}/meta/folder.groovy") - - conditionalclean() - - def meta = getmetafolderscript().metareset(script) - echo "Product name: ${productname} Subcomponent name: ${subcomponentname}" - meta.productinfo.set(productname, subcomponentname) - def now = new Date() - now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) - meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) - - def rr = load("${commonscripts()}/release/registerrepo.groovy") - echo "Release repo: ${releaserepo}" - rr.registerrepo(meta, releaserepo) - - def ch = load("${commonscripts()}/configuration/configuration.groovy") - ch.registerPipelineScriptConfiguration(meta) - - return meta -} - -def start(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String jirakey = JIRA_KEY, String releaserepo = RELEASE_REPO, String repoRootSuffix = "", String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) { - echo "DEPRECATED method: start(script, String productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, ...)" - return startbuild(script, productname, subcomponentname, releaserepo, autobuildpath, commonscriptspath) -} - -// Start up boilderplate -def startnonbuild(script, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { - echo "Starting non-build job...." - - autobuildroot = autobuildpath - commonscriptsroot = commonscriptspath - metafolderscript = load("${commonscripts()}/meta/folder.groovy") - - conditionalclean() - - def meta = getmetafolderscript().metareset(script) - meta.productinfo.set("Non-build-product", "Non-build-subcomponent") - def now = new Date() - now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) - meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) - - def ch = load("${commonscripts()}/configuration/configuration.groovy") - ch.registerPipelineScriptConfiguration(meta) - - return meta -} - -def configurationhelper() { - return load("${commonscripts()}/configuration/configuration.groovy") -} - -// Everyone wants to know this -autobuilder = this - -return this; diff --git a/Common_scripts/check/build_meta.groovy b/Common_scripts/check/build_meta.groovy deleted file mode 100644 index 34eed98..0000000 --- a/Common_scripts/check/build_meta.groovy +++ /dev/null @@ -1,86 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.startnonbuild(this) - } - } - } - stage('Clean exports') { - steps { - script { - cleanfolders = [ - "${WORKSPACE}/build_artifacts", - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Get build artifact meta') { - steps { - script { - BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts" - copyArtifacts( - projectName: BUILD_JOB, - selector: [ - $class: 'ParameterizedBuildSelector', - parameterName: BUILD_JOB_SELECTOR - ], - target: BUILD_ARTIFACTS - ) - def mfs = autobuilderscript.getmetafolderscript() - buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS) - } - } - } - stage('Check components') { - steps { - script { - def checker = load("${autobuilder.commonscripts()}/check/do_meta.groovy") - (summarystring, markunstable, unstablereason) = checker.checkhierarchy(buildmeta, MAX_META_DEPTH, BUILD_ARTIFACTS) - 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/Common_scripts/check/do_meta.groovy b/Common_scripts/check/do_meta.groovy deleted file mode 100644 index 7bfe2d1..0000000 --- a/Common_scripts/check/do_meta.groovy +++ /dev/null @@ -1,77 +0,0 @@ -markunstable = false -unstablereason = "" - -summaryfolder = "${WORKSPACE}/summary" -summaryfile = "${summaryfolder}/summary.txt" -summarystring = "" -releaserepofolder = "${WORKSPACE}/releaserepos" -sourcerepofolder = "${WORKSPACE}/sourcerepos" -tempfolder = "${WORKSPACE}/temp" -gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" - -metascript = autobuilder.getmetafolderscript() - -def resetfolders() { - dir(summaryfolder) { - deleteDir() - } - dir(releaserepofolder) { - deleteDir() - } - dir(tempfolder) { - deleteDir() - } -} - -def preconditions() { - markunstable = false - unstablereason = "" - summarystring = "" - writeFile(file: summaryfile, text: "Release summary: \n") -} - -def setunstable(String reason) { - markunstable = true - unstablereason += reason + "\n" - echo "Marked build as unstable: Reason: ${reason}" -} - -def summaryappend(String summary) { - def String currentsummarycontents = readFile(file: summaryfile) - writeFile(file: summaryfile, text: currentsummarycontents + summary) - summarystring += summary -} - -def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { - int md = maxdepth.toInteger() - resetfolders() - preconditions() - - // Walk the meta information to a max depth - def buildinfo = buildmeta.releasewalker(md) - echo "All components:" - def String componentinfo = "" - for (entry in buildinfo) { - def name = entry.meta.componentversionuniqueidentifier() - def offsetpath = entry.offsetpath - def abspath = "${buildpathroot}/${offsetpath}" - componentinfo += "Name: ${name} \t\t\t\tPath: ${offsetpath} \t\t\t\tFile exists in import: ${fileExists(abspath)}\n" - } - echo componentinfo - - // Walk the meta information to a max depth - def componentReleaseInfo = buildmeta.releasewalkerunique(md) - echo "Unique components:" - def String versioncomponent = "" - for (key in componentReleaseInfo.keySet()) { - def buildinfo2 = componentReleaseInfo[key] - def offsetpath = buildinfo2.offsetpath - def abspath = "${buildpathroot}/${offsetpath}" - versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n" - } - echo versioncomponent - - return [summarystring, markunstable, unstablereason] -} - -return this; diff --git a/Common_scripts/checksum/utils.groovy b/Common_scripts/checksum/utils.groovy deleted file mode 100644 index c2503cd..0000000 --- a/Common_scripts/checksum/utils.groovy +++ /dev/null @@ -1,14 +0,0 @@ - -// Generate a checksum file of from a list of files/directories relative to workspace -def generatelist(meta, checksummable) { - for (filepath in checksummable) { - def checksumset = meta.checksuminfo.addChecksumSet(filepath) - def files = findFiles(glob: filepath) - for (file in files) { - def sum = sha1(file: file.path).trim() - checksumset.addChecksumPair(file.path, sum) - } - } -} - -return this; \ No newline at end of file diff --git a/Common_scripts/clean/clean.groovy b/Common_scripts/clean/clean.groovy deleted file mode 100644 index 4707ba0..0000000 --- a/Common_scripts/clean/clean.groovy +++ /dev/null @@ -1,10 +0,0 @@ - -def clean(folderlist) { - for (folder in folderlist) { - dir(folder) { - deleteDir() - } - } -} - -return this; \ No newline at end of file diff --git a/Common_scripts/commandline/commandline.groovy b/Common_scripts/commandline/commandline.groovy deleted file mode 100644 index df99a75..0000000 --- a/Common_scripts/commandline/commandline.groovy +++ /dev/null @@ -1,13 +0,0 @@ -String getCommandOutput(String cmd) { - if (isUnix()) { - return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim() - } else { - return bat(returnStdout: true, script: """ - @echo off - ${cmd} - """ - ).trim() - } -} - -return this \ No newline at end of file diff --git a/Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy b/Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy deleted file mode 100644 index 03e4c8f..0000000 --- a/Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy +++ /dev/null @@ -1,12 +0,0 @@ - -// Disable parallel make builds - which may be causing autobuild issues -def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { - if (isUnix()) { - sh """ - # Looks for " sparseitemlist = gh.convertSparseItemsString(filter) - gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) - - registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) -} - -return this diff --git a/Common_scripts/copy/all.groovy b/Common_scripts/copy/all.groovy deleted file mode 100644 index b7c4607..0000000 --- a/Common_scripts/copy/all.groovy +++ /dev/null @@ -1,86 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - } - } - } - stage('Clean exports') { - steps { - script { - IMPORTS = 'imports' - cleanfolders = [ - IMPORTS, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Import source artifacts') { - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def copyoptions = importer.getNewImportOptions() - copyoptions.source( - SOURCE_ARTIFACT_LOCATION, - SOURCE_ARTIFACT_BUILD_JOB, - SOURCE_ARTIFACT_BUILD_SELECTOR, - SOURCE_ARTIFACT_RELEASE_REPO, - SOURCE_ARTIFACT_RELEASE_REVISION) - echo "Nested: ${NESTED_COPY}" - copyoptions.setnested(NESTED_COPY == 'true') - importer.artifactimport(meta, copyoptions, IMPORTS) - } - } - } - stage('Copy source artifacts') { - steps { - script { - dir(IMPORTS) { - fileOperations([ - fileCopyOperation(excludes: '', - flattenFiles: false, - includes: '**/*', - targetLocation: WORKSPACE) - ]) - } - } - } - } - stage('Archiving artifacts') { - steps { - script { - def includes = '**/*' - def excludes = "${IMPORTS}/*" - echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" - // This does not work: archiveArtifacts artifacts: includes, excludes: excludes - // so - cleanfolders = [ - IMPORTS, - 'autobuild', - ] - cleaner.clean(cleanfolders) - archiveArtifacts artifacts: includes - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} \ No newline at end of file diff --git a/Common_scripts/copy/esw.groovy b/Common_scripts/copy/esw.groovy deleted file mode 100644 index 2a63171..0000000 --- a/Common_scripts/copy/esw.groovy +++ /dev/null @@ -1,63 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - } - } - } - stage('Clean exports') { - steps { - script { - env.ESW = 'esw' - env.ESWDEST = "${WORKSPACE}/${ESW}" - env.ESWEXPORT = 'embedded_software' - cleanfolders = [ - ESWDEST, - ESWEXPORT, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Copying embedded software artifacts') { - steps { - script { - importer.artifactimport(meta, ESW_ARTIFACT_LOCATION, ESW_ARTIFACT_BUILD_JOB, ESW_ARTIFACT_BUILD_SELECTOR, ESW_ARTIFACT_RELEASE_REPO, ESW_ARTIFACT_RELEASE_REVISION, ESWDEST) - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts(["${ESWEXPORT}/**"]) - sh """ - rm -v -rf diff - rm -v -rf meta - mv -v "${ESW}"/* . - """ - archiveArtifacts "${artifactlist}" - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} \ No newline at end of file diff --git a/Common_scripts/copy/filtered.groovy b/Common_scripts/copy/filtered.groovy deleted file mode 100644 index feaa2ab..0000000 --- a/Common_scripts/copy/filtered.groovy +++ /dev/null @@ -1,70 +0,0 @@ -pipeline { - agent { label AGENT_LABEL } - stages { - stage('Initial setup') { - steps { - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - } - } - } - stage('Clean') { - steps { - script { - env.IMPORT = "${WORKSPACE}/import" - env.FILTEREDDEST = "${WORKSPACE}/filtered" - cleanfolders = [ - FILTEREDDEST, - IMPORT, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Import artifacts') { - steps { - script { - importer.artifactimport(meta, ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION, IMPORT) - } - } - } - stage('Filtered copy') { - steps { - script { - dir(IMPORT) { - fileOperations([ - fileCopyOperation(excludes: EXCLUDES, - flattenFiles: FLATTENOUTPUT, - includes: INCLUDES, - targetLocation: FILTEREDDEST)]) - } - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts(["filtered/**"]) - archiveArtifacts "${artifactlist}" - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} diff --git a/Common_scripts/copy/logic.groovy b/Common_scripts/copy/logic.groovy deleted file mode 100644 index d1ece6d..0000000 --- a/Common_scripts/copy/logic.groovy +++ /dev/null @@ -1,62 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - } - } - } - stage('Clean exports') { - steps { - script { - env.LOGICDEST = "${WORKSPACE}/logic" - cleanfolders = [ - LOGICDEST, - "${WORKSPACE}/embedded_logic", - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Copying logic artifacts') { - steps { - script { - importer.artifactimport(meta, LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_RELEASE_REPO, LOGIC_RELEASE_REVISION, LOGICDEST) - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts(["embedded_logic/**"]) - sh """ - rm -v -rf meta - # The following is removing a deprecated folder - rm -v -rf diff - mv -v "logic"/* . - """ - archiveArtifacts "${artifactlist}" - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} \ No newline at end of file diff --git a/Common_scripts/differences/.project b/Common_scripts/differences/.project deleted file mode 100644 index 75af0fc..0000000 --- a/Common_scripts/differences/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Release_difference - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/Common_scripts/differences/.pydevproject b/Common_scripts/differences/.pydevproject deleted file mode 100644 index c3434da..0000000 --- a/Common_scripts/differences/.pydevproject +++ /dev/null @@ -1,8 +0,0 @@ - - - -/${PROJECT_DIR_NAME} - -python 3.0 -Default - diff --git a/Common_scripts/differences/dometahierarchy.groovy b/Common_scripts/differences/dometahierarchy.groovy deleted file mode 100644 index 6280960..0000000 --- a/Common_scripts/differences/dometahierarchy.groovy +++ /dev/null @@ -1,836 +0,0 @@ -import groovy.json.JsonSlurper - -markunstable = false -unstablereason = "" - -summaryfolder = "${WORKSPACE}/summary" -summaryfile = "${summaryfolder}/summary.txt" -summarystring = "" - -sourcerepofolder = "${WORKSPACE}/sourcerepos" -tempfolder = "${WORKSPACE}/temp" - -reportfolder = "${WORKSPACE}/reports" - -class JiraTicketInfo { - String jiranumber - String uri - - JiraTicketInfo() { - jiranumber = '' - uri = '' - } - - def String dump() { - return "jiranumber: ${jiranumber} uri: ${uri}" - } -} - -class DifferenceRecord { - String productname - String subcomponentname - - String rawdifferencetext - String sha - String type - String mergeinfo - String squashinfo - List jiraticketinfo - String comment - - DifferenceRecord() { - productname = "" - subcomponentname = "" - - rawdifferencetext = "" - sha = "" - type = "" - mergeinfo = "" - squashinfo = "" - jiraticketinfo = [] - comment = "" - } - - def String dump() { - String jiraticketstring = '' - for (j in jiraticketinfo) { - jiraticketstring += j.dump() + " " - } - return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketstring}\ncomment: ${comment}" - } -} - -def resetfolders() { - dir(summaryfolder) { - deleteDir() - } - dir(tempfolder) { - deleteDir() - } - dir(reportfolder) { - deleteDir() - } -} - -def preconditions() { - markunstable = false - unstablereason = "" - summarystring = "" - writeFile(file: summaryfile, text: "Release summary: \n") -} - -def setunstable(String reason) { - markunstable = true - unstablereason += reason + "\n" - echo "Marked build as unstable: Reason: ${reason}" -} - -def summaryappend(String summary) { - def String currentsummarycontents = readFile(file: summaryfile) - writeFile(file: summaryfile, text: currentsummarycontents + summary) - summarystring += summary -} - -def showmetaitems(metaitems) { - String info = '' - for (key in metaitems.keySet()) { - def relatedmetainfo = metaitems[key] - def offsetpath = relatedmetainfo.offsetpath - info += "Name: ${key}\t\t\t\tPath: ${offsetpath}\n" - } - echo info -} - -def boolean checkoutsourcerepo(buildmeta, String checkoutfolder) { - boolean checkedout = false - def String sourcerepo = buildmeta.gitinfo.remoteurl - if (sourcerepo?.trim()) { - echo "Updating source repo: ${sourcerepo} in folder: ${checkoutfolder}" - if (sourcerepo) { - // Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component - if (fileExists(checkoutfolder)) { - dir(checkoutfolder) { - sh(""" - git reset --hard - git clean -fdx - git pull - """ - ) - } - } - else { - dir(sourcerepofolder) { - sh("git clone ${sourcerepo} ${checkoutfolder}") - } - } - } - checkedout = true - } - return checkedout -} - -def String getcomponent(meta) { - def String uniquefolder = "${meta.productinfo.productname}_${meta.productinfo.subcomponentname}" - def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" - def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" - - boolean checkedout = checkoutsourcerepo(meta, uniquefolderforsourcerepo) - - return [checkedout, uniquefolderforsourcerepo] -} - -def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { - def String releaseexpression - if (tripledot) { - releaseexpression = earlyrevision + "..." + laterrevision - } else { - releaseexpression = earlyrevision + ".." + laterrevision - } - def String differencetext - dir(gitrootfolder) { - differencetext = sh(returnStdout: true, script: "git --no-pager log --oneline ${releaseexpression}").trim() - } - return differencetext -} - -def extractsha(String line) { - def pattern = ~"^(\\p{XDigit}*) (.*)" - def match = (line =~ pattern) - match.find() - - def sha = match.group(1) - def restofline = match.group(2) - - //echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}" - - return [sha.trim(), restofline.trim()] -} - -def extractsquashes(String line) { - def pattern1 = "^(.*)(Squashed .*)" - def match1 = (line =~ pattern1) - if (match1.find()) { - return [true, match1.group(2)] - } - - return [false, line] -} - -def extractmerges(String line) { - def pattern1 = "^(.*)(Merge branch .*)" - def match1 = (line =~ pattern1) - if (match1.find()) { - return [true, match1.group(2)] - } - - def pattern2 = "^(.*)(Merge remote-tracking branch .*)" - def match2 = (line =~ pattern2) - if (match2.find()) { - return [true, match2.group(2)] - } - - def pattern3 = "^(.*)(Merge commit .*)" - def match3 = (line =~ pattern3) - if (match3.find()) { - return [true, match3.group(2)] - } - - def pattern4 = "^(.*)(Add .* from commit .*)" - def match4 = (line =~ pattern4) - if (match4.find()) { - return [true, match4.group(2)] - } - - return [false, line] -} - -def jiraticketexists(String jiraticket) { - def String URI = "${JIRA_URI}/browse/${jiraticket}" - def String RestfulURI = "${JIRA_URI}/rest/api/latest/issue/${jiraticket}?fields=summary" - def get = new URL(RestfulURI).openConnection(); - get.setRequestProperty( 'X-AUSERNAME', "${JIRA_USERNAME}" ) - get.setRequestProperty( 'Authorization', "Basic ${JIRA_ENCODED_PASSWORD}" ) - get.setRequestProperty( 'User-Agent', 'groovy-2.4.4' ) - get.setRequestProperty( 'Accept', 'application/json' ) - def getRC = get.getResponseCode(); - - def String redirectedjiraticket = jiraticket - if(!getRC.equals(200)) { - return [false, '', jiraticket] - } else { - def jsonresponse = new JsonSlurper().parseText(get.inputStream.getText('UTF-8')) - redirectedjiraticket = jsonresponse['key'] - } - return [true, URI, redirectedjiraticket] -} - -def extractjiraticketinfo(String line) { - def List jiratickets = [] - boolean exists = false - String URI = '' - - while (true) { - line = line.trim() - def commapattern = '^\\s*,(.*)' // Consume separating commas at the beginning of the line - def commamatch = (line =~ commapattern) - if (commamatch.find()) { - line = commamatch.group(1).trim() - } - def pattern1 = '^(\\w+-\\d+)(.*)' //GIS-1234 hmbxr5601-1234 - def match1 = (line =~ pattern1) - if (match1.find()) { - jiraticket = match1.group(1) - (exists, URI, jiraticket) = jiraticketexists(jiraticket) - if (exists) { - def JiraTicketInfo j = new JiraTicketInfo() - j.jiranumber = jiraticket - j.uri = URI - jiratickets.add(j) - line = match1.group(2) - } else { - break - } - } else { - def pattern2 = '^(\\w+)(\\d+)(.*)' //GIS1234 smb1234 - def match2 = (line =~ pattern2) - if (match2.find()) { - jiraticket = match2.group(1) + "-" + match2.group(2) - (exists, URI, jiraticket) = jiraticketexists(jiraticket) - if (exists) { - def JiraTicketInfo j = new JiraTicketInfo() - j.jiranumber = jiraticket - j.uri = URI - jiratickets.add(j) - line = match2.group(3) - } else { - break - } - } else { - def pattern3 = '^(\\w+)\\s(\\d+)(.*)' //GIS 1234 smb 1234 - def match3 = (line =~ pattern3) - if (match3.find()) { - jiraticket = match3.group(1) + "-" + match3.group(2) - (exists, URI, jiraticket) = jiraticketexists(jiraticket) - if (exists) { - def JiraTicketInfo j = new JiraTicketInfo() - j.jiranumber = jiraticket - j.uri = URI - jiratickets.add(j) - line = match3.group(3) - } else { - break - } - } else { - break - } - } - } - } - boolean result = jiratickets.size() > 0 - return [result, jiratickets, line] -} - -def extractreverts(String line) { - boolean result = true - - def pattern1 = '^(.*)Revert \"(.*)\"' - def match1 = (line =~ pattern1) - if (match1.find()) { - def line2 = match1.group(2) - (result, originaljiraticketinfo, originalcomment) = extractjiraticketinfo(line2) - return [true, originaljiraticketinfo, originalcomment] - } - - def pattern2 = '^(.*)Partial Revert \"(.*)\"' - def match2 = (line =~ pattern2) - if (match2.find()) { - def line2 = match2.group(2) - (result, originaljiraticketinfo, originalcomment) = extractjiraticketinfo(line2) - return [true, originaljiraticketinfo, originalcomment] - } - - return [false, [], line] -} - -def getgitlogdifferencesfromsquash(String gitrootfolder, String squashedrevision) { - def String differencetext - dir(gitrootfolder) { - differencetext = sh(returnStdout: true, script: "git --no-pager log --oneline ${squashedrevision}").trim() - } - return differencetext -} - -def List fillsquashrecords(String sourcepath, String sha) { - def List differencerecords = [] - - String squashloglines = getgitlogdifferencesfromsquash(sourcepath, sha) - int count = 0 - squashloglines.split('\n').each { - if (count > 0) { // Ignore first line - def line = it - if (line?.trim()) { - def List drs = fillrecord(meta, line.trim(), sourcepath) - differencerecords.addAll(drs) - //echo "${dr.dump()}" - } - } - count += 1 - } - return differencerecords -} - -def List fillrecord(meta, line, String sourcepath) { - def List differencerecords = [] - def DifferenceRecord dr = new DifferenceRecord() - - dr.productname = meta.productinfo.productname - dr.subcomponentname = meta.productinfo.subcomponentname - - dr.rawdifferencetext = line - - // Example of raw text to process: - // 76056562e4 GIS-1621 - Removing redundant lines and effects of this - Restore nuget_version_edit.py - - (sha, line2) = extractsha(line) - dr.sha = sha - - (result, squashinfo) = extractsquashes(line2) - if (result) { - dr.type = "Squash" - dr.squashinfo = squashinfo - squashrecords = fillsquashrecords(sourcepath, sha) - differencerecords.addAll(squashrecords) - } else { - (result, mergeinfo) = extractmerges(line2) - if (result) { - dr.type = "Merge" - dr.mergeinfo = mergeinfo - } else { - (result, jiraticketinfo, comment) = extractreverts(line2) - if (result) { - dr.type = "Revert" - dr.jiraticketinfo = jiraticketinfo - dr.comment = comment - } else { - (result, jiraticketinfo, comment) = extractjiraticketinfo(line2) - if (result) { - dr.type = "Ticketed" - dr.jiraticketinfo = jiraticketinfo - dr.comment = comment - } else { - dr.type = "Unticketed" - dr.comment = line2 - } - } - } - } - differencerecords.add(dr) - return differencerecords -} - -def List processtext(meta, String text, String sourcepath) { - def List differencerecords = [] - - text.split('\n').each { - def line = it - if (line?.trim()) { - def List drs = fillrecord(meta, line.trim(), sourcepath) - differencerecords.addAll(drs) - //echo "${dr.dump()}" - } - } - return differencerecords -} - -def getdifferencerecords(earlymeta, latermeta, String sourcepath) { - boolean result = true; - def List differencerecords = [] - - def earlygitinfo = earlymeta.gitinfo - def latergitinfo = latermeta.gitinfo - - if (earlygitinfo.remoteurl == latergitinfo.remoteurl) { - def earlyrevision = earlygitinfo.gitrevision - def laterrevision = latergitinfo.gitrevision - echo "Comparing early revision: ${earlyrevision} with: ${laterrevision} Working copy path: ${sourcepath}" - summaryappend("Early revision: ${earlyrevision} Later revision: ${laterrevision}") - def String differencetext = getgitlogdifferences(sourcepath, earlyrevision, laterrevision) - differencerecords = processtext(earlymeta, differencetext, sourcepath) - if (earlyrevision == laterrevision) { - summaryappend(" No change") - } - } else { - summaryappend("The early and later git urls don't match") - echo "The early and later git urls don't match" - result = false; - setunstable("The early and later git urls don't match in: ${earlymeta.componentidentifier()}") - } - - return [result, differencerecords] -} - -def deletedcomponent(earlymetaitems, key) { - echo "Component ${key} has been deleted in later version" - summaryappend("Deleted ") -} - -def addedcomponent(latermetaitems, key) { - echo "Component ${key} has been added in later version" - summaryappend("Added ") -} - -class SquashReportRecord { - String comment - int duplicates - - SquashReportRecord() { - comment = '' - duplicates = 0 - } -} - -def squashreport(String reportsubfolder, String title, LinkedHashMap squashes, boolean iscomponent = true) { - dir(reportsubfolder) { - def String squashlist = "${title}\nSquash list:\n" - def squashessorted = squashes.sort() - for (asquash in squashessorted) { - def SquashReportRecord s = asquash.value - squashlist += "${s.comment} (${s.duplicates})\n" - } - writeFile(file: "squashlist.txt", text: squashlist) - } -} - -class MergeReportRecord { - String comment - int duplicates - - MergeReportRecord() { - comment = '' - duplicates = 0 - } -} - -def mergereport(String reportsubfolder, String title, LinkedHashMap merges, boolean iscomponent = true) { - dir(reportsubfolder) { - def String mergelist = "${title}\nMerge list:\n" - def mergessorted = merges.sort() - for (amerge in mergessorted) { - def MergeReportRecord m = amerge.value - mergelist += "${m.comment} (${m.duplicates})\n" - } - writeFile(file: "mergelist.txt", text: mergelist) - } -} - -class CommentsRecord { - String comment - int duplicates - - CommentsRecord() { - comment = '' - duplicates = 0 - } -} - -class RevertsReportRecord { - String jiraticket - String ticketURI - LinkedHashMap commentscollection - - RevertsReportRecord() { - jiraticket = '' - ticketURI = '' - commentscollection = new LinkedHashMap() - } -} - -def revertsreport(String reportsubfolder, String title, LinkedHashMap reverts, boolean iscomponent = true) { - dir(reportsubfolder) { - def String revertlist = "${title}\nRevert list:\n" - def revertssorted = reverts.sort() - for (arevert in revertssorted) { - def RevertsReportRecord r = arevert.value - revertlist += "${r.jiraticket} (${r.ticketURI}):\n" - def commentscollection = r.commentscollection - def sortedcommentscollection = commentscollection.sort() - for (commentrecord in sortedcommentscollection) { - def CommentsRecord c = commentrecord.value - revertlist += "${c.comment} (${c.duplicates})\n" - } - revertlist += "\n" - } - writeFile(file: "revertlist.txt", text: revertlist) - } -} - -class TicketedReportRecord { - String jiraticket - String ticketURI - LinkedHashMap commentscollection - - TicketedReportRecord() { - jiraticket = '' - ticketURI = '' - commentscollection = new LinkedHashMap() - } -} - -def ticketedreport(String reportsubfolder, String title, LinkedHashMap ticketed, boolean iscomponent = true) { - dir(reportsubfolder) { - def String ticketedlist = "${title}\nTicketed list:\n" - def ticketedsorted = ticketed.sort() - for (aticketed in ticketedsorted) { - def TicketedReportRecord r = aticketed.value - ticketedlist += "${r.jiraticket} (${r.ticketURI}):\n" - def commentscollection = r.commentscollection - def sortedcommentscollection = commentscollection.sort() - for (commentrecord in sortedcommentscollection) { - def CommentsRecord c = commentrecord.value - ticketedlist += "${c.comment} (${c.duplicates})\n" - } - ticketedlist += "\n" - } - writeFile(file: "ticketedlist.txt", text: ticketedlist) - } -} - -class UnticketedReportRecord { - String comment - int duplicates - - UnticketedReportRecord() { - comment = '' - duplicates = 0 - } -} - -def unticketedreport(String reportsubfolder, String title, LinkedHashMap unticketed, boolean iscomponent = true) { - dir(reportsubfolder) { - def String unticketedlist = "${title}\nUnticketed list:\n" - def unticketedsorted = unticketed.sort() - for (anunticketed in unticketedsorted) { - UnticketedReportRecord u = anunticketed.value - unticketedlist += "${u.comment} (${u.duplicates})\n" - } - writeFile(file: "unticketedlist.txt", text: unticketedlist) - } -} - -class TicketsReportRecord { - String jiraticket - String ticketURI - int duplicates - - TicketsReportRecord() { - jiraticket = '' - ticketURI = '' - duplicates = 0 - } -} - -def ticketsreport(String reportsubfolder, String title, tickets, boolean iscomponent = true) { - dir(reportsubfolder) { - String ticketlist = "${title}\nTicket list:\n" - ticketssorted = tickets.sort() - for (ticketnumber in ticketssorted) { - TicketsReportRecord t = ticketnumber.value - ticketlist += "${t.jiraticket} (${t.ticketURI}) (${t.duplicates})\n" - } - writeFile(file: "ticketlist.txt", text: ticketlist) - } -} - -def differencerecordsreport(String reportsubfolder, String title, differencerecords, boolean iscomponent = true) { - dir(reportsubfolder) { - String recordlist = "${title}\n" - for (dr in differencerecords) { - recordlist += dr.dump() + "\n\n" - } - writeFile(file: "recordlist.txt", text: recordlist) - } -} - -def boolean report(meta, title, differencerecords, boolean iscomponent = true) { - def Map ticketed = [:] - def Map squashes = [:] - def Map merges = [:] - def Map reverts = [:] - def Map unticketed = [:] - def Map tickets = [:] - - for (dr in differencerecords) { - if (dr.type == "Squash") { - def SquashReportRecord s - if (!squashes.containsKey(dr.mergeinfo)) { - s = new SquashReportRecord() - s.comment = dr.squashinfo - s.duplicates = 1 - } else { - s = squashes[dr.squashinfo] - s.duplicates += 1 - } - squashes[dr.squashinfo] = s - } - if (dr.type == "Merge") { - def MergeReportRecord m - if (!merges.containsKey(dr.mergeinfo)) { - m = new MergeReportRecord() - m.comment = dr.mergeinfo - m.duplicates = 1 - } else { - m = merges[dr.mergeinfo] - m.duplicates += 1 - } - merges[dr.mergeinfo] = m - } - if (dr.type == "Revert") { - def RevertsReportRecord r - for (ticket in dr.jiraticketinfo) { - JiraTicketInfo j = ticket - if (!reverts.containsKey(j.jiranumber)) { - r = new RevertsReportRecord() - r.jiraticket = j.jiranumber - r.ticketURI = j.uri - CommentsRecord c = new CommentsRecord() - c.comment = dr.comment - c.duplicates = 1 - r.commentscollection[dr.comment] = c - } else { - r = reverts[j.jiranumber] - def CommentsRecord c - if (!r.commentscollection.containsKey(dr.comment)) { - c = new CommentsRecord() - c.comment = dr.comment - c.duplicates = 1 - r.commentscollection[dr.comment] = c - } else { - c = r.commentscollection[dr.comment] - c.duplicates += 1 - } - r.commentscollection[dr.comment] = c - } - reverts[j.jiranumber] = r - def TicketsReportRecord t - if (!tickets.containsKey(j.jiranumber)) { - t = new TicketsReportRecord() - t.jiraticket = j.jiranumber - t.ticketURI = j.uri - t.duplicates = 1 - } else { - t = tickets[j.jiranumber] - t.duplicates += 1 - } - tickets[j.jiranumber] = t - } - } - if (dr.type == "Ticketed") { - def TicketedReportRecord t - for (ticket in dr.jiraticketinfo) { - JiraTicketInfo j = ticket - if (!ticketed.containsKey(j.jiranumber)) { - t = new TicketedReportRecord() - t.jiraticket = j.jiranumber - t.ticketURI = j.uri - CommentsRecord c = new CommentsRecord() - c.comment = dr.comment - c.duplicates = 1 - t.commentscollection[dr.comment] = c - } else { - t = ticketed[j.jiranumber] - def CommentsRecord c - if (!t.commentscollection.containsKey(dr.comment)) { - c = new CommentsRecord() - c.comment = dr.comment - c.duplicates = 1 - t.commentscollection[dr.comment] = c - } else { - c = t.commentscollection[dr.comment] - c.duplicates += 1 - } - t.commentscollection[dr.comment] = c - } - ticketed[j.jiranumber] = t - def TicketsReportRecord ti - if (!tickets.containsKey(j.jiranumber)) { - ti = new TicketsReportRecord() - ti.jiraticket = j.jiranumber - ti.ticketURI = j.uri - ti.duplicates = 1 - } else { - ti = tickets[j.jiranumber] - ti.duplicates += 1 - } - tickets[j.jiranumber] = ti - } - } - if (dr.type == "Unticketed") { - UnticketedReportRecord u - if (!unticketed.containsKey(dr.comment)) { - u = new UnticketedReportRecord() - u.comment = dr.comment - u.duplicates = 1 - } else { - u = unticketed[dr.comment] - u.duplicates += 1 - } - unticketed[dr.comment] = u - } - } - String reportsubfolder = "" - if (iscomponent) { - reportsubfolder = "${reportfolder}/${meta.componentidentifier()}" - } else { - reportsubfolder = "${reportfolder}/Combined" - } - mergereport(reportsubfolder, title, merges, iscomponent) - squashreport(reportsubfolder, title, squashes, iscomponent) - revertsreport(reportsubfolder, title, reverts, iscomponent) - ticketedreport(reportsubfolder, title, ticketed, iscomponent) - unticketedreport(reportsubfolder, title, unticketed, iscomponent) - ticketsreport(reportsubfolder, title, tickets, iscomponent) - differencerecordsreport(reportsubfolder, title, differencerecords, iscomponent) -} - -def title(earlymeta, latermeta) { - return """ - Differences in: - Product: ${earlymeta.productinfo.productname} Subcomponent: ${earlymeta.productinfo.subcomponentname} - between: - then: - Build date: ${earlymeta.jenkinsbuildinfo.builddate} Build stamp: ${earlymeta.buildstampinfo.buildstamp} Git revision: ${earlymeta.gitinfo.gitrevision} - now: - Build date: ${latermeta.jenkinsbuildinfo.builddate} Build stamp: ${latermeta.buildstampinfo.buildstamp} Git revision: ${latermeta.gitinfo.gitrevision} - """ -} - -def compare(earlymetaitems, latermetaitems, key) { - boolean result = true; - echo "Collecting changes between early and later versions of component: ${key}" - - def earlymeta = earlymetaitems[key].meta - def latermeta = latermetaitems[key].meta - - summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ") - - def boolean repoavailable - def String uniquefolderforsourcerepo - (repoavailable, uniquefolderforsourcerepo) = getcomponent(earlymeta) - - List differencerecords = [] - if (repoavailable) { - (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) - - summaryappend(" Items: ${differencerecords.size()} ") - report(earlymeta, title(earlymeta, latermeta), differencerecords) - } else { - summaryappend(" No source repo ") - } - summaryappend("\n") - - return [result, differencerecords]; -} - -def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { - def List differencerecords = [] - - def int md = maxdepth.toInteger() - resetfolders() - preconditions() - - echo "Comparing product meta hierarchy from folders: ${earlymetafolder} and ${latermetafolder} to a depth of ${md}. Exporting summary to ${summaryfolder}" - - def earlymeta = meta.importrelated(true, earlymetafolder) - def latermeta = meta.importrelated(true, latermetafolder) - - def earlymetaitems = earlymeta.releasewalkerunique(md) - def latermetaitems = latermeta.releasewalkerunique(md) - - echo "Early items:" - showmetaitems(earlymetaitems) - - echo "Later items:" - showmetaitems(latermetaitems) - - for (key in earlymetaitems.keySet()) { - if (latermetaitems.containsKey(key)) { - (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) - differencerecords = differencerecords + componentdifferencerecords - } else { - summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") - deletedcomponent(earlymetaitems, key) - summaryappend("\n") - } - } - for (key in latermetaitems.keySet()) { - if (!earlymetaitems.containsKey(key)) { - summaryappend("${latermeta.productinfo.productname} ${latermeta.productinfo.subcomponentname}: ") - addedcomponent(latermetaitems, key) - summaryappend("\n") - } - } - report(meta, title(earlymeta, latermeta), differencerecords, false) - return [summarystring, markunstable, unstablereason] -} - -return this; diff --git a/Common_scripts/differences/file.groovy b/Common_scripts/differences/file.groovy deleted file mode 100644 index ab4102f..0000000 --- a/Common_scripts/differences/file.groovy +++ /dev/null @@ -1,16 +0,0 @@ -def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { - if (isUnix()) { - def wsparameter = "-w" - if (!ignorewhitespace) { - wsparameter = "" - } - sh """ - diff -c ${wsparameter} "${importedfile}" "${currentfile}" - """ - } - else { - error "Windows not currently supporting file comparison" - } -} - -return this; diff --git a/Common_scripts/differences/json.groovy b/Common_scripts/differences/json.groovy deleted file mode 100644 index 5ac37f2..0000000 --- a/Common_scripts/differences/json.groovy +++ /dev/null @@ -1,15 +0,0 @@ -def comparefiles(importedjsonfile, currentjsonfile) { - if (isUnix()) { - sh """ - which jq - if [ \$? -ne 0 ]; then exit 1; fi - # jq -S sorts json output - diff -c <(jq -S . "${importedjsonfile}") <(jq -S . "${currentjsonfile}") - """ - } - else { - error "Windows not currently supporting json file comparison" - } -} - -return this; diff --git a/Common_scripts/differences/metahierarchy.groovy b/Common_scripts/differences/metahierarchy.groovy deleted file mode 100644 index 4bcdcdc..0000000 --- a/Common_scripts/differences/metahierarchy.groovy +++ /dev/null @@ -1,91 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.startnonbuild(this) - } - } - } - stage('Clean exports') { - steps { - script { - SUMMARYDIR = "${WORKSPACE}/summary" - REPORTDIR = "${WORKSPACE}/reports" - EARLYROOTDIR = 'early' - EARLYDIR = "${WORKSPACE}/${EARLYROOTDIR}" - LATERROOTDIR = 'later' - LATERDIR = "${WORKSPACE}/${LATERROOTDIR}" - - cleanfolders = [ - "${WORKSPACE}/build_artifacts", - "${EARLYDIR}", - "${LATERDIR}", - "${SUMMARYDIR}", - "${REPORTDIR}", - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Obtain top level meta') { - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - SOURCEURL = TOP_LEVEL_META_REPOSITORY.trim() - importer.artifactimport(meta, EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION, EARLYROOTDIR, false, 'meta/**') - importer.artifactimport(meta, LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION, LATERROOTDIR, false, 'meta/**') - } - } - } - stage('Diff components') { - steps { - script { - def comparator = load("${autobuilder.commonscripts()}/differences/dometahierarchy.groovy") - (summarystring, markunstable, unstablereason) = comparator.comparehierarchy(meta, EARLYDIR, LATERDIR, MAX_META_DEPTH, SUMMARYDIR) - if (markunstable) { - env.unstablereason = unstablereason - currentBuild.result = 'UNSTABLE' - } - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts() - archiveArtifacts "summary/**,reports/**,${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/Common_scripts/documentation/doxygen_deploy.groovy b/Common_scripts/documentation/doxygen_deploy.groovy deleted file mode 100644 index 6642256..0000000 --- a/Common_scripts/documentation/doxygen_deploy.groovy +++ /dev/null @@ -1,80 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - } - } - } - stage('Clean imports') { - steps { - script { - env.DOXYGEN = "doxygen" - cleanfolders = [ - DOXYGEN, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Import doxygen artifacts') { - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def importoptions = importer.getNewImportOptions() - - importoptions.jenkinsjob(BUILD_JOB_WITH_DOXYGEN_ARTIFACTS, BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR) - importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**') - doxygenmeta = importer.artifactimportfrombuildjob(meta, importoptions, DOXYGEN) - - productname = doxygenmeta.productinfo.productname - buildstampprefix = doxygenmeta.buildstampinfo.buildstampprefix - - echo "Doyxgen imported for product: ${productname} and build stamp prefix: ${buildstampprefix}" - } - } - } - stage('Copy doxygen to server') { - steps { - script { - doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}" - pathonserver = "${ROOT_PATH_ON_SERVER.trim()}/${productname}/${buildstampprefix}" - echo "Copying from ${doxygensource} to ${pathonserver}" - if (isUnix()) { - sh """#!/bin/bash - rm -rfv "${pathonserver}" - if [ \$? -ne 0 ]; then exit 1; fi - - mkdir -pv "${pathonserver}" - if [ \$? -ne 0 ]; then exit 1; fi - - echo mv -v "${doxygensource}"/ "${pathonserver}" - mv -v "${doxygensource}"/ "${pathonserver}" - if [ \$? -ne 0 ]; then exit 1; fi - """ - } else { - error("This job does not run on Windows at the moment") - } - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} - diff --git a/Common_scripts/import/importer.groovy b/Common_scripts/import/importer.groovy deleted file mode 100644 index 8624421..0000000 --- a/Common_scripts/import/importer.groovy +++ /dev/null @@ -1,333 +0,0 @@ -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - -class ImportOptions { - def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) - - boolean m_incrementversionnumber // If true, increment the parent's (4th) version number with the (4th) version number of this object being imported - String m_filter // Only import files/paths/folders that match the filter - String m_excludes // Exclude files/paths/folders that match the exclude filter - boolean m_fingerprint // Do Jenkins fingerprinting on imported artifacts - boolean m_nested // Import all child artifacts too (identified in the related meta info - boolean m_flatten // Flatten files and folders imported - boolean m_includemetainfilter // Make sure meta is also included in filter - boolean m_clean // Clean import folder before obtaining artifacts - boolean m_appendtoparentmeta // Append to parent meta - String m_sourceselect // Where are the artifacts coming from - - String m_jobname - def m_buildnumberorselector - - String m_repo - String m_revision - - ImportOptions(script, - String sourceselect = 'Jenkins job artifact', - boolean incrementversionnumber = true, - String filter = '', - String excludes = '', - boolean fingerprint = false, - boolean nested = false, - boolean flatten = false, - boolean includemetainfilter = true, - boolean clean = true, - appendtoparentmeta = true) { - m_script = script - m_sourceselect = sourceselect.trim() - m_incrementversionnumber = incrementversionnumber - m_filter = filter.trim() - m_excludes = excludes.trim() - m_fingerprint = fingerprint - m_nested = nested - m_flatten = flatten - m_includemetainfilter = includemetainfilter - m_clean = clean - m_appendtoparentmeta = appendtoparentmeta - } - - void setsourceselect(String sourceselect) { - sourceselect = sourceselect.trim() - switch (sourceselect) { - case 'Jenkins job artefact': - m_sourceselect = 'Jenkins job artifact' - break - case 'Jenkins job artifact': - case 'Release repository': - m_sourceselect = sourceselect - break - default: - error("Unknown type of artifact source select: ${m_sourceselect}") - } - } - - void setincrementversionnumber(boolean incrementversionnumber = true) { - m_incrementversionnumber = incrementversionnumber - } - - void setfilter(String filter) { - m_filter = filter.trim() - } - - void setexcludes(String excludes) { - m_excludes = excludes.trim() - } - - void setfingerprint(boolean fingerprint = true) { - m_fingerprint = fingerprint - } - - void setnested(boolean nested = true) { - m_nested = nested - } - - void flattenimports(boolean flatten = true) { - m_flatten = flatten - } - - void includemetainfilter(boolean includemetainfilter = true) { - m_includemetainfilter = includemetainfilter - } - - void clean(boolean clean = true) { - m_clean = clean - } - - void setappendtoparentmeta(boolean appendtoparentmeta) { - m_appendtoparentmeta = appendtoparentmeta - } - - void jenkinsjob(String jobname, String buildnumberorselector) { - m_jobname = jobname.trim() - m_buildnumberorselector = buildnumberorselector.trim() - setsourceselect('Jenkins job artifact') - } - - void releaserepo(String repo, String revision) { - m_repo = repo.trim() - m_revision = revision.trim() - setsourceselect('Release repository') - } - - void source(String sourceselect, String jobname, String buildnumberorselector, String repo, String revision) { - jenkinsjob(jobname, buildnumberorselector) - releaserepo(repo, revision) - setsourceselect(sourceselect) - } -} - -ImportOptions getNewImportOptions() { - return new ImportOptions(this) -} - -def formFilter(ImportOptions importoptions) { - def String filter = importoptions.m_filter - if (filter != '') { - if (importoptions.m_includemetainfilter) { - filter = 'meta/**,' + filter - } - } - echo "Import options filter is: ${filter}" - return filter -} - -def conditionalClean(ImportOptions importoptions, String destpath) { - if (importoptions.m_clean) { - echo "Cleaning ${destpath}" - dir(destpath) { - deleteDir() - } - } -} - -def artifactimportfrombuildjob(meta, importoptions, String destpath) { - if (importoptions.m_sourceselect != 'Jenkins job artifact') { - error("Import options settings have not been set for: Jenkins job artifact") - return - } - - conditionalClean(importoptions, destpath) - - copyArtifacts( - filter: formFilter(importoptions), - excludes: importoptions.m_excludes, - fingerprintArtifacts: importoptions.m_fingerprint, - projectName: importoptions.m_jobname, - selector: [ - $class: 'ParameterizedBuildSelector', - parameterName: importoptions.m_buildnumberorselector - ], - flatten: importoptions.m_flatten, - target: destpath - ) - def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath) - if (importoptions.m_incrementversionnumber) { - meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) - } - return importedmeta -} - -def rewritemetafileasreleased(meta, String filepath) { - // Modify the meta info to say that is has already been released - meta.markreleased() - meta.saveJsonSerialised(filepath) -} - -def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { - if (importoptions.m_sourceselect != 'Release repository') { - error("Import options settings have not been set for: Release repository") - return - } - - def rooturl = importoptions.m_repo - def rootrevision = importoptions.m_revision - echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - - conditionalClean(importoptions, destpath) - - def ArrayList sparseitemlist = gh.convertSparseItemsString(formFilter(importoptions)) - gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) - - def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) - - relatedimportinfo = importedmeta.getassociated() - echo "Cloning associated repos" - for(relatedmetainfo in relatedimportinfo) { - def relatedmeta = relatedmetainfo.meta - def relatedoffsetpath = relatedmetainfo.offsetpath - def cloneurl = relatedmeta.releaseinfo.releaserepoURL - def clonerevision = "refs/tags/${relatedmeta.releasetag()}" - def clonepath = "${destpath}/${relatedoffsetpath}" - echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}" - - gh.gitCheckoutAlt(cloneurl, clonerevision, clonepath, "", 1, true, []) - - gh.stripgithistory(clonepath) - - def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}" - echo "Marking related meta as released and rewriting meta file: ${metafilepath}" - rewritemetafileasreleased(relatedmeta, metafilepath) - } - gh.stripgithistory(destpath) - def metafilepath = "${destpath}/${meta.metafilepath()}" - echo "Marking root meta as released and rewriting meta file: ${metafilepath}" - rewritemetafileasreleased(importedmeta, metafilepath) - - if (importoptions.m_incrementversionnumber) { - meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) - } - return importedmeta -} - -def artifactimportfromrepo(meta, importoptions, String destpath) { - if (importoptions.m_sourceselect != 'Release repository') { - error("Import options settings have not been set for: Release repository") - return - } - - conditionalClean(importoptions, destpath) - - def rooturl = importoptions.m_repo - def rootrevision = importoptions.m_revision - echo "Cloning release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - - def ArrayList sparseitemlist = gh.convertSparseItemsString(formFilter(importoptions)) - gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) - - def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) - - gh.stripgithistory(destpath) - def metafilepath = "${destpath}/${meta.metafilepath()}" - echo "Marking meta as released and rewriting meta file: ${metafilepath}" - rewritemetafileasreleased(importedmeta, metafilepath) - - if (importoptions.m_incrementversionnumber) { - meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) - } - return importedmeta -} - -def artifactimport(meta, importoptions, String destpath) { - switch (importoptions.m_sourceselect) { - case 'Jenkins job artifact': - case 'Jenkins job artefact': - return artifactimportfrombuildjob(meta, importoptions, destpath) - case 'Release repository': - if (importoptions.m_nested) { - return hierarchyartifactimportfromrepo(meta, importoptions, destpath) - } - return artifactimportfromrepo(meta, importoptions, destpath) - default: - error("Unknown type of artifact source: ${source}") - } - return meta -} - -// Deprecated (use above) -def artifactimport(meta, - String sourceselect, - String jenkinsjob, - buildnumberorselector, - String repo, - String revision, - String destpath, - boolean incrementversionnumber = true, - String filter = '', - String excludes = '', - boolean fingerprint = false, - boolean nested = false) { - echo "DEPRECATED method: artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath ...)" - def importoptions = getNewImportOptions() - - importoptions.source(sourceselect, jenkinsjob, buildnumberorselector, repo, revision) - importoptions.setincrementversionnumber(incrementversionnumber) - importoptions.setfilter(filter) - importoptions.setexcludes(excludes) - importoptions.setfingerprint(fingerprint) - importoptions.setnested(nested) - - return artifactimport(meta, importoptions, destpath) -} - -// Deprecated (use above) -def artifactimport(meta, - String buildjob, - int buildnumber, - String destpath, - boolean incrementversionnumber = true, - String filter = '**', - String excludes = '', - boolean fingerprint = false) { - echo "DEPRECATED method: artifactimport(meta, String buildjob, int buildnumber, String destpath, ...)" - def importoptions = getNewImportOptions() - - importoptions.jenkinsjob(buildjob, " ${buildnumber}") - importoptions.setincrementversionnumber(incrementversionnumber) - importoptions.setfilter(filter) - importoptions.setexcludes(excludes) - importoptions.setfingerprint(fingerprint) - - return artifactimport(meta, importoptions, destpath) -} - -// Deprecated (use above) -def artifactimport(meta, - String buildjob, - buildnumberorselector, - String destpath, - boolean incrementversionnumber = true, - String filter = '', - String excludes = '', - boolean fingerprint = false) { - echo "DEPRECATED method: artifactimport(meta, String buildjob, buildnumberorselector, String destpath, ...)" - def importoptions = getNewImportOptions() - - importoptions.jenkinsjob(buildjob, buildnumberorselector) - importoptions.setincrementversionnumber(incrementversionnumber) - importoptions.setfilter(filter) - importoptions.setexcludes(excludes) - importoptions.setfingerprint(fingerprint) - - return artifactimport(meta, importoptions, destpath) -} - -return this; diff --git a/Common_scripts/install/installhelper.groovy b/Common_scripts/install/installhelper.groovy deleted file mode 100644 index 96a8b2e..0000000 --- a/Common_scripts/install/installhelper.groovy +++ /dev/null @@ -1,117 +0,0 @@ -import hudson.FilePath - -// Transfer file from intermediate position to final position; -// creating necessary folders on the way; -// deleting intermediate file -def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, String finalFilename) { - def channel = Jenkins.getInstance().getComputer(env['NODE_NAME']).getChannel() - - def String abs_exports_root_path = "${WORKSPACE}/${finalBaseFolder}" - def String abs_export_out = "${abs_exports_root_path}/${finalFilename}" - def export_filepath = new hudson.FilePath(channel, abs_export_out) - def export_out_folder = export_filepath.getParent() - def export_out_folder_string = export_out_folder.toString() - def export_out_file = export_filepath.getName() - - echo "Creating folder ${export_out_folder_string}" - export_out_folder.mkdirs() - - echo "Copying from ${pathToIntermediate} to ${abs_export_out}" - def intermediate_filepath = new hudson.FilePath(channel, pathToIntermediate) - intermediate_filepath.copyTo(export_filepath) - intermediate_filepath.delete() -} - -// Given details about artifacts to import and details of installers to build, import artifacts that are required -def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) { - artifactFetched = [:] - - def importoptions = importer.getNewImportOptions() - for (installer in toBuild) { - def artifactKeys = installerDetails.get(installer)[1] - if (artifactKeys instanceof java.lang.String) { - artifactKeys = [ artifactKeys ] - } - for (artifactKey in artifactKeys) { - (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) - if (artifactFetched.get(artifactKey) == null) { - importoptions.jenkinsjob(sourceProject, sourceselector) - importoptions.setincrementversionnumber(incrementversionnumber) - importoptions.setfilter(toCopy) - importoptions.setexcludes(notToCopy) - - def importmeta = importer.artifactimport(meta, importoptions, destFolder) - artifactFetched.put(artifactKey, importmeta) - } - } - } - return artifactFetched -} - -@NonCPS -def checkISMfilebackend(String xml) { - def String message = "" - - def parsedxml = new XmlParser(true, true, true).parseText(xml) - def pathvariableinfo = [:] - def exitcode = 0 - // Load up a map of path variable and path pairs - // Ignore blank path definitions - // Ignore the workspace definition which should have the only absolute path - parsedxml.each{ table -> - if (table.@name == "ISPathVariable") { - table['row'].each{ row -> - def pathname = row['td'][0].value()[0] - def path = row['td'][1].value()[0] - if (path && pathname != 'WORKSPACE') { - pathvariableinfo[pathname] = path - } - } - } - } - // Check that each path variable is defined beginning with a path variable or the WORKSPACE one - pathvariableinfo.each{ pair -> - message += "pair key: ${pair.key} value: ${pair.value}\n" - def path = pair.value - def pathvarmatcher = path =~ /<(.*)>.*/ - if (pathvarmatcher.matches()) { - def pathvarfound = pathvarmatcher.group(1) - if (pathvarfound != 'WORKSPACE') { - if (!pathvariableinfo.containsKey(pathvarfound)) { - message += "Undefined path variable ${pathvarfound} found\n" - exitcode = 1 - } - } - } else { - message += "Path: ${path} does not begin with a path variable\n" - exitcode = 1 - } - } - return [exitcode, message] -} - -def checkISMfile(String ISMfile) { - echo "Checking ISM file: ${ISMfile}" - def xml = readFile(ISMfile) - (exitcode, message) = checkISMfilebackend(xml) - echo message - if (exitcode > 0) { - error "ISM file errors found" - } else { - echo "Checked ISM file - ok" - } -} - -certificatethumbprints = [:] -certificatethumbprints['floreana'] = '0FDEB0A227982C877146CA595091173AC9655479' // Authoring takes place on this machine - so this is what should be in the ISM file already -certificatethumbprints['hawaii'] = '49FD1B361CFF35014B81940C5B046543045DD34B' - -def selectSigningCertificate(String nodeName, String ISMfile) { - def masterpattern = '0FDEB0A227982C877146CA595091173AC9655479' - echo "Substituting occurrences of ${masterpattern} with ${certificatethumbprints[nodeName]} in ISM file: ${ISMfile}" - - textutils_subst = load("${autobuilder.commonscripts()}/textutils/subst.groovy") - textutils_subst.substitute(ISMfile, masterpattern, certificatethumbprints[nodeName]) -} - -return this; diff --git a/Common_scripts/meta/folder.groovy b/Common_scripts/meta/folder.groovy deleted file mode 100644 index aac8b6c..0000000 --- a/Common_scripts/meta/folder.groovy +++ /dev/null @@ -1,772 +0,0 @@ -import java.nio.file.Paths -import java.nio.file.Path -import groovy.json.JsonSlurperClassic - -abstract class GISJsonSerialised implements Serializable { - def script - - GISJsonSerialised(script) { - this.script = script - } - - abstract LinkedHashMap serialisationdata() - - abstract void deserialiseJson(rawmeta) - - def saveJsonSerialised(String outputfile, int prettylevel = 4) { - def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) - script.writeJSON(file: outputfile, json: outJson, pretty: prettylevel) - } -} - -class ProductInfo extends GISJsonSerialised { - String productname - String subcomponentname - - ProductInfo(script, productname = "", subcomponentname = "") { - super(script) - this.productname = productname - this.subcomponentname = subcomponentname - } - - void set(String productname, String subcomponentname) { - // Make sure the fields can be used in git tags - def int pstatus = 0 - if (script.isUnix()) { - pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) - } - else { - pstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true) - } - if (pstatus > 0) { - script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name") - } - def int sstatus = 0 - if (script.isUnix()) { - sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true) - } - else { - sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true) - } - if (sstatus > 0) { - script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name") - } - this.productname = productname - this.subcomponentname = subcomponentname - } - - void deserialiseJson(rawmeta) { - productname = rawmeta['productname'] - subcomponentname = rawmeta['subcomponentname'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'productname' : productname, - 'subcomponentname' : subcomponentname, - ] - return data - } -} - -class GitInfo extends GISJsonSerialised { - private String sourcepath - private String sourcerevision - private String gitrevision - private String remoteurl - private String remoteinfo - - GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") { - super(script) - this.sourcepath = sourcepath - this.sourcerevision = sourcerevision - this.gitrevision = gitrevision - this.remoteurl = remoteurl - this.remoteinfo = remoteinfo - } - - void set(String sourcepath, String sourcerevision, String gitrevision, String remoteurl, String remoteinfo) { - this.sourcepath = sourcepath - this.sourcerevision = sourcerevision - this.gitrevision = gitrevision - this.remoteurl = remoteurl - this.remoteinfo = remoteinfo - } - - void deserialiseJson(rawmeta) { - sourcepath = rawmeta['sourcepath'] - sourcerevision = rawmeta['sourcerevision'] - gitrevision = rawmeta['gitrevision'] - remoteurl = rawmeta['remoteurl'] - remoteinfo = rawmeta['remoteinfo'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'sourcepath' : sourcepath, - 'sourcerevision' : sourcerevision, - 'gitrevision' : gitrevision, - 'remoteurl' : remoteurl, - 'remoteinfo' : remoteinfo, - ] - return data - } -} - -class JenkinsBuildInfo extends GISJsonSerialised { - String buildjobname - int buildnumber - private String buildmachine - private String builddate - - JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "") { - super(script) - this.buildjobname = buildjobname - this.buildnumber = buildnumber - this.buildmachine = buildmachine - this.builddate = builddate - } - - void set(String buildjobname, int buildnumber, String buildmachine, String builddate) { - this.buildjobname = buildjobname - this.buildnumber = buildnumber - this.buildmachine = buildmachine - this.builddate = builddate - } - - void deserialiseJson(rawmeta) { - buildjobname = rawmeta['buildjobname'] - buildnumber = rawmeta['buildnumber'] - buildmachine = rawmeta['buildmachine'] - builddate = rawmeta['builddate'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'buildjobname' : buildjobname, - 'buildnumber' : buildnumber, - 'buildmachine' : buildmachine, - 'builddate' : builddate, - ] - return data - } -} - -class BuildStampInfo extends GISJsonSerialised { - String buildstampprefix - int revision - String buildstamp - - BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { - super(script) - this.buildstampprefix = buildstampprefix - this.revision = revision - this.buildstamp = buildstamp - } - - void set(String buildstampprefix, int revision, String buildstamp) { - this.buildstampprefix = buildstampprefix - this.revision = revision - this.buildstamp = buildstamp - } - - String buildstampcommasep() { - def String buildstampcommasep = buildstamp.replace(".", ",") - return buildstampcommasep - } - - void changerevision(int newrevision) { - script.echo("Build stamp currently ${buildstamp}") - revision = newrevision - def List buildstampsplit = buildstamp.split('\\.') - buildstampsplit[-1] = newrevision.toString() - buildstamp = buildstampsplit.join('.') - script.echo("Build stamp now ${buildstamp}") - } - - void set(String buildstampprefix, int revision) { - buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.' - this.buildstampprefix = buildstampprefix - this.buildstamp = buildstampprefix + "0" - changerevision(revision) - } - - void set(String buildstampprefix, String revision = '0') { - set(buildstampprefix, revision.toInteger()) - } - - void deserialiseJson(rawmeta) { - buildstampprefix = rawmeta['buildstampprefix'] - revision = rawmeta['revision'] - buildstamp = rawmeta['buildstamp'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'buildstampprefix' : buildstampprefix, - 'revision' : revision, - 'buildstamp' : buildstamp, - ] - return data - } -} - -class ReleaseInfo extends GISJsonSerialised { - String releaserepoURL - ArrayList releaseitems - boolean released - - ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { - super(script) - this.releaserepoURL = releaserepoURL - this.releaseitems = new ArrayList() - this.released = released - } - - void set(String releaserepoURL = "") { - this.releaserepoURL = releaserepoURL - } - - void addReleaseItem(String releaseitem) { - script.echo("Adding release item: ${releaseitem} to release items") - releaseitems.add(releaseitem) - } - - void markreleased() { - this.released = true - } - - List releaseitemssserialised() { - def items = [] - for (ri in releaseitems) { - items.add(ri) - } - return items - } - - void deserialiseJson(rawmeta) { - releaserepoURL = rawmeta['releaserepoURL'] - releaseitems = new ArrayList() - for (rawreleaseitem in rawmeta['releaseitems']) { - releaseitems.add(rawreleaseitem) - } - released = rawmeta['released'] ?: false - } - - LinkedHashMap serialisationdata() { - def data = [ - 'releaserepoURL' : releaserepoURL, - 'releaseitems' : releaseitemssserialised(), - 'released' : released - ] - return data - } -} - -class ConfigurationInfo extends GISJsonSerialised { - private String configurationname - private String configurationURL - private String configurationversion - private String configurationSHA - - ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") { - super(script) - this.configurationname = configurationname - this.configurationURL = configurationURL - this.configurationversion = configurationversion - this.configurationSHA = configurationSHA - } - - void deserialiseJson(rawmeta) { - configurationname = rawmeta['configurationname'] - configurationURL = rawmeta['configurationURL'] - configurationversion = rawmeta['configurationversion'] - configurationSHA = rawmeta['configurationSHA'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'configurationname' : configurationname, - 'configurationURL' : configurationURL, - 'configurationversion' : configurationversion, - 'configurationSHA' : configurationSHA, - ] - return data - } -} - -class ChecksumPair extends GISJsonSerialised { - private String filepath - private String sum - - ChecksumPair(script, String filepath = "", String sum = "") { - super(script) - this.filepath = filepath - this.sum = sum - } - - void deserialiseJson(rawmeta) { - filepath = rawmeta['filepath'] - sum = rawmeta['sum'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'filepath' : filepath, - 'sum' : sum, - ] - return data - } -} - -class ChecksumSet extends GISJsonSerialised { - private String artifactpath - private ArrayList checksumpairs - - ChecksumSet(script, artifactpath = "") { - super(script) - this.artifactpath = artifactpath - checksumpairs = new ArrayList() - } - - ChecksumPair addChecksumPair(String filepath, String sum) { - def cp = new ChecksumPair(script, filepath, sum) - checksumpairs.add(cp) - return cp - } - - List checksumpairsserialised() { - def associated = [] - for (cp in checksumpairs) { - associated.add(cp.serialisationdata()) - } - return associated - } - - void deserialiseJson(rawmeta) { - artifactpath = rawmeta['artifactpath'] - checksumpairs = new ArrayList() - for (rawchecksumpair in rawmeta['checksumpairs']) { - def csp = new ChecksumPair(script) - csp.deserialiseJson(rawchecksumpair) - checksumpairs.add(csp) - } - } - - LinkedHashMap serialisationdata() { - def data = [ - 'artifactpath' : artifactpath, - 'checksumpairs' : checksumpairsserialised(), - ] - return data - } -} - -class ChecksumInfo extends GISJsonSerialised { - private ArrayList checksumsets - - ChecksumInfo(script) { - super(script) - checksumsets = new ArrayList() - } - - ChecksumSet addChecksumSet(String artifactpath) { - def cs = new ChecksumSet(script, artifactpath) - checksumsets.add(cs) - return cs - } - - List checksumsetsserialised() { - def associated = [] - for (cs in checksumsets) { - associated.add(cs.serialisationdata()) - } - return associated - } - - void deserialiseJson(rawmeta) { - checksumsets = new ArrayList() - for (rawchecksumset in rawmeta['checksumsets']) { - def cs = new ChecksumSet(script) - cs.deserialiseJson(rawchecksumset) - checksumsets.add(cs) - } - } - - LinkedHashMap serialisationdata() { - def data = [ - 'checksumsets' : checksumsetsserialised(), - ] - return data - } -} - -class PublishableInfo extends GISJsonSerialised { - private String filepath - - PublishableInfo(script, String filepath = "") { - super(script) - this.filepath = filepath - } - - void deserialiseJson(rawmeta) { - filepath = rawmeta['filepath'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'filepath' : filepath, - ] - return data - } -} - -class MetaInfo extends GISJsonSerialised { - private static String FORMAT = "0.1" - private static String METAFOLDERNAME = "meta" - private static String METAFILENAME = "info.json" - private static String METAARTIFACTS = "${METAFOLDERNAME}/**" - - class RelatedMetaInfo extends GISJsonSerialised { - String offsetpath - MetaInfo meta - - RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) { - super(script) - this.offsetpath = offsetpath - this.meta = meta - } - - void deserialiseJson(rawmeta) { - offsetpath = rawmeta['offsetpath'] - meta = new MetaInfo(script) - meta.deserialiseJson(rawmeta['meta']) - } - - LinkedHashMap serialisationdata() { - def data = [ - 'offsetpath' : offsetpath, - 'meta' : meta.serialisationdata(), - ] - return data - } - } - - private String format = FORMAT - ProductInfo productinfo - GitInfo gitinfo - JenkinsBuildInfo jenkinsbuildinfo - BuildStampInfo buildstampinfo - ReleaseInfo releaseinfo - ChecksumInfo checksuminfo - private ArrayList configurationinfo - private ArrayList publishableinfo - private LinkedHashMap custominfo - private ArrayList associatedmeta - - MetaInfo(script) { - super(script) - productinfo = new ProductInfo(script) - gitinfo = new GitInfo(script) - jenkinsbuildinfo = new JenkinsBuildInfo(script) - buildstampinfo = new BuildStampInfo(script) - releaseinfo = new ReleaseInfo(script) - checksuminfo = new ChecksumInfo(script) - configurationinfo = new ArrayList() - publishableinfo = new ArrayList() - custominfo = new LinkedHashMap() - associatedmeta = new ArrayList() - } - - List getassociated() { - return associatedmeta - } - - void markreleased() { - script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") - releaseinfo.markreleased() - for (associated in associatedmeta) { - associated.meta.releaseinfo.markreleased() - } - } - - List configurationinfoserialised() { - def configuration = [] - for (configurationitem in configurationinfo) { - configuration.add(configurationitem.serialisationdata()) - } - return configuration - } - - void addPublishable(String filepath) { - def PublishableInfo pi = new PublishableInfo(script, filepath) - script.echo("Adding ${filepath} to publishable list") - publishableinfo.add(pi) - } - - void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { - def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) - script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}") - configurationinfo.add(ci) - } - - void addCustomInfo(String customId, String customValue) { - custominfo.put(customId.trim(), customValue) - } - - String getCustomInfo(String customId) { - return custominfo.getAt(customId.trim()) - } - - List publishableinfoserialised() { - def publishable = [] - for (publishableitem in publishableinfo) { - publishable.add(publishableitem.serialisationdata()) - } - return publishable - } - - List associatedmetaserialised() { - def associated = [] - for (metaitem in associatedmeta) { - associated.add(metaitem.serialisationdata()) - } - return associated - } - - void deserialiseJson(rawmeta) { - if (rawmeta['format'] != FORMAT) { - script.error("Unsupported meta format found at ${filepath}") - return - } - productinfo.deserialiseJson(rawmeta['productinfo']) - gitinfo.deserialiseJson(rawmeta['gitinfo']) - jenkinsbuildinfo.deserialiseJson(rawmeta['jenkinsbuildinfo']) - buildstampinfo.deserialiseJson(rawmeta['buildstampinfo']) - releaseinfo.deserialiseJson(rawmeta['releaseinfo']) - checksuminfo.deserialiseJson(rawmeta['checksuminfo']) - for (rawconfig in rawmeta['configuration']) { - def cf = new ConfigurationInfo(script) - cf.deserialiseJson(rawconfig) - configurationinfo.add(cf) - } - for (rawpublishable in rawmeta['publishableinfo']) { - def pb = new PublishableInfo(script) - pb.deserialiseJson(rawpublishable) - publishableinfo.add(pb) - } - custominfo = rawmeta['custominfo'] - for (rawrelatedmeta in rawmeta['associatedmeta']) { - def rm = new RelatedMetaInfo(script) - rm.deserialiseJson(rawrelatedmeta) - associatedmeta.add(rm) - } - } - - def deserialiseJson(String filepath) { - script.echo("Deserialising JSON at file: ${filepath}") - def rawmeta = script.readJSON(file: filepath) - deserialiseJson(rawmeta) - } - - def deserialiseJsonSlurper(String filepath) { - File jsonfile = new File(filepath) - def jsonfiletext = jsonfile.getText() - def rawmeta = new JsonSlurperClassic().parseText(jsonfiletext) - deserialiseJson(rawmeta) - } - - String relativize(String mypath) { - String pathRelative - script.echo("Seeing if ${mypath} begins with ${script.WORKSPACE}") - if (mypath.startsWith(script.WORKSPACE)) { - pathRelative = mypath.minus(script.WORKSPACE) - script.echo("Extracted ${pathRelative} from ${script.WORKSPACE} and ${mypath}") - } else { - pathRelative = mypath - script.echo("Path relative is unchanged: ${pathRelative}") - } - // Convert \ with / - pathRelative = pathRelative.tokenize('\\').join('/') - // Strip leading / if any - pathRelative = pathRelative.replaceAll('^/+', '') - - script.echo("Path relative is ${pathRelative}") - - return pathRelative - } - - static String metafilepath() { - return METAFOLDERNAME + "/" + METAFILENAME - } - - MetaInfo importrelated(boolean appendtoparentmeta, String destpath, String givenRepo = 'Unknown', String givenRevision = 'Unknown', String givenSHA = 'Unknown') { - MetaInfo mi = new MetaInfo(script) - - def String adjustedpath = relativize(destpath) - def importedmetafile = adjustedpath + "/" + metafilepath() - if (script.fileExists(importedmetafile)) { - mi.deserialiseJson(importedmetafile) - } else { - script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist") - mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA) - } - - RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) - if (appendtoparentmeta) { - associatedmeta.add(rmi) - } - - return mi - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - 'productinfo' : productinfo.serialisationdata(), - 'gitinfo' : gitinfo.serialisationdata(), - 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), - 'buildstampinfo' : buildstampinfo.serialisationdata(), - 'releaseinfo' : releaseinfo.serialisationdata(), - 'configuration' : configurationinfoserialised(), - 'checksuminfo' : checksuminfo.serialisationdata(), - 'publishableinfo' : publishableinfoserialised(), - 'custominfo' : custominfo, - 'associatedmeta' : associatedmetaserialised(), - ] - return data - } - - static String folder() { - return METAFOLDERNAME - } - - String generateartifacts(ArrayList releasedfromhere = new ArrayList(), // These items are recorded in meta as released from here - ArrayList releasedfromsubmeta = new ArrayList(), // These items are not recorded in meta as released from here - String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}" - ) { - def String artifactlist = METAARTIFACTS - releaseinfo.addReleaseItem(METAARTIFACTS) - for (releaseitem in releasedfromhere) { - artifactlist += "," + releaseitem - releaseinfo.addReleaseItem(releaseitem) - } - for (releaseitem in releasedfromsubmeta) { - artifactlist += "," + releaseitem - } - saveJsonSerialised(metafilepath) - return artifactlist - } - - // Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java - private ArrayList releasewalkerp(int maxdepth, ArrayList releasemetacollection, String pathsofar) { - if (maxdepth > 0) { - if (releaseinfo.releaserepoURL) { - RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) - releasemetacollection.add(rmi) - } - if (pathsofar) { - pathsofar += "/" - } - for (relatedmetainfo in associatedmeta) { - MetaInfo othermeta = relatedmetainfo.meta - String newpathsofar = pathsofar + relatedmetainfo.offsetpath - releasemetacollection = othermeta.releasewalkerp(maxdepth - 1, releasemetacollection, newpathsofar) - } - } - return releasemetacollection - } - - ArrayList releasewalker(int maxdepth, String startpath = "") { - ArrayList releasemetacollection = new ArrayList() - releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) - return releasemetacollection - } - - String componentidentifier() { - return productinfo.productname + "_" + productinfo.subcomponentname - } - - String componentversionuniqueidentifier() { - return componentidentifier() + "_" + buildstampinfo.buildstamp - } - - String globalreleasetag() { - return componentversionuniqueidentifier() + "_" + jenkinsbuildinfo.buildnumber - } - - String releasetag() { - 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] - if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) { - releasemetacollection.put(uniquestring, relatedmetainfo) - } - } else { - releasemetacollection.put(uniquestring, relatedmetainfo) - } - return releasemetacollection - } - - Map releasewalkerunique(int maxdepth, String startpath = "") { - def ArrayList releasemetacollection = new ArrayList() - releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) - - def Map releasemetauniquecollection = new LinkedHashMap() - for (relatedmetainfo in releasemetacollection) { - def String uniquestring = relatedmetainfo.meta.componentidentifier() - releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo) - } - - return releasemetauniquecollection - } - - Map releasewalkerversionunique(int maxdepth, String startpath = "") { - ArrayList releasemetacollection = new ArrayList() - releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) - - def Map releasemetaversionuniquecollection = new LinkedHashMap() - for (relatedmetainfo in releasemetacollection) { - def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier() - releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo) - } - - return releasemetaversionuniquecollection - } - - MetaInfo getNewMetaObject(script) { - return new MetaInfo(script) - } -} - -MetaInfo metareset(script) { - echo "Resetting meta folder" - def mi = new MetaInfo(script) - - dir(mi.folder()) { - deleteDir() - } - - return mi -} - -MetaInfo metafromfolder(String folder = "") { - MetaInfo buildmeta = new MetaInfo(this) - buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") - return buildmeta -} - -MetaInfo metafromfolderSlurper(String folder = "") { - MetaInfo buildmeta = new MetaInfo(this) - buildmeta.deserialiseJsonSlurper("${folder}/${MetaInfo.metafilepath()}") - return buildmeta -} - -return this; diff --git a/Common_scripts/packaging/debian.groovy b/Common_scripts/packaging/debian.groovy deleted file mode 100644 index 2ef1ba8..0000000 --- a/Common_scripts/packaging/debian.groovy +++ /dev/null @@ -1,106 +0,0 @@ -class DebRootDefinition { - String ROOTPATH - String PACKAGE_PREFIX - String PACKAGE_FOLDER_NAME - String PACKAGE_NAME - String UNIQUE_PACKAGE_NAME - - String PACKAGE_SOURCE_ROOT - String PACKAGE_SOURCE_FOLDER_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_SCRIPTS_CONTROL - 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 - - 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}" - - 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_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" - 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" - } -} - -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) { - try { - sh """#!/bin/bash - # Exit if any command fails - set -xe - - echo "${password}" | sudo -S echo - - 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}" - - mkdir -v -p "${packageout}" - 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:" - 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}" - """ - } - catch (Exception e) { - echo "Exception occurred" - sh """#!/bin/bash -v - echo "${password}" | sudo -S echo - - sudo chown -R ${USER}: "${packagedefs.DEBPATH}" - - exit 1 - """ - } -} - -return this; \ No newline at end of file diff --git a/Common_scripts/platform/lineendings.groovy b/Common_scripts/platform/lineendings.groovy deleted file mode 100644 index 9657b0d..0000000 --- a/Common_scripts/platform/lineendings.groovy +++ /dev/null @@ -1,5 +0,0 @@ - -// Put ${nl} into strings when wanting a newline -nl = System.properties['line.separator'] - -return this; diff --git a/Common_scripts/publish/.classpath b/Common_scripts/publish/.classpath deleted file mode 100644 index 287c1ab..0000000 --- a/Common_scripts/publish/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Common_scripts/publish/.gitignore b/Common_scripts/publish/.gitignore deleted file mode 100644 index abed335..0000000 --- a/Common_scripts/publish/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/do$_publish_closure4.class -/do$_resetfolders_closure1.class -/do$_resetfolders_closure2.class -/do$_resetfolders_closure3.class -/do$_stripgithistory_closure5.class -/do.class -/publish_item_select.class diff --git a/Common_scripts/publish/.project b/Common_scripts/publish/.project deleted file mode 100644 index 5c60328..0000000 --- a/Common_scripts/publish/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - publish_item_select - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.groovy.core.groovyNature - org.eclipse.jdt.core.javanature - - diff --git a/Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs b/Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs deleted file mode 100644 index 1e68ed6..0000000 --- a/Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -groovy.compiler.level=25 -groovy.script.filters=**/*.dsld,y,**/*.gradle,n diff --git a/Common_scripts/publish/do.groovy b/Common_scripts/publish/do.groovy deleted file mode 100644 index 1b227f4..0000000 --- a/Common_scripts/publish/do.groovy +++ /dev/null @@ -1,174 +0,0 @@ -import groovy.io.FileType - -markunstable = false -unstablereason = "" - -summaryfolder = "${WORKSPACE}/summary" -summaryfile = "${summaryfolder}/summary.txt" -summarystring = "" -releaserepofolder = "${WORKSPACE}/releaserepos" -filteredreleaserepofolder = "${WORKSPACE}/filteredreleaserepos" - -def resetfolders() { - dir(summaryfolder) { - deleteDir() - } - dir(releaserepofolder) { - deleteDir() - } - dir(filteredreleaserepofolder) { - deleteDir() - } -} - -def productuniquefolder(releasemeta) { - return "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" -} - -def uniquereleasefolder(String productline, String softwarerelease, releasemeta) { - return "Software/${productline} ${softwarerelease}/${productuniquefolder(releasemeta)}" -} - -def uniqueabsoluterreleasefolder(String productline, String releaserepofolder, String softwarerelease, releasemeta) { - return "${releaserepofolder}/${uniquereleasefolder(productline, softwarerelease, releasemeta)}" -} - -def preconditions() { - markunstable = false - unstablereason = "" - summarystring = "" - writeFile(file: summaryfile, text: "Publish summary: \n") -} - -def setunstable(String reason) { - markunstable = true - unstablereason = reason -} - -def summaryappend(String summary) { - def String currentsummarycontents = readFile(file: summaryfile) - writeFile(file: summaryfile, text: currentsummarycontents + summary) - summarystring += summary -} - -def guessreporootsuffix(componentURL) { - def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') - return guess -} - -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { - summaryappend("Artifacts: ") - - def releasemeta = releaseinfo.meta - def String componentURL = releasemeta.releaseinfo.releaserepoURL - def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}" - def publishableitems = releasemeta.publishableinfo - - def ArrayList publishablepaths = new ArrayList() - if (publishableitems.size() > 0) { - for (publishableitem in publishableitems) { - def String productuniquepublishableitem = "${productuniquefolder(releasemeta)}/${publishableitem.filepath}" - echo "publishableitem: ${productuniquepublishableitem}" - if (itempathstopublish.size() == 0 || productuniquepublishableitem in itempathstopublish) { - publishablepaths.add(publishableitem.filepath) - summaryappend("${publishableitem.filepath},") - } - } - } - if (publishablepaths.size() > 0) { - def reporootsuffix = guessreporootsuffix(componentURL) - gh.gitCheckoutAlt(componentURL, revision, repofolder, reporootsuffix, 1, true, publishablepaths) // Shallow clone - } - else { - summaryappend("None ") - } -} - -def publish(hostedftpsiteinfo, String customer, String finalreleaserepofolder = releaserepofolder) { - summaryappend(" FTP operations: ") - - def String ftproot = "${hostedftpsiteinfo.workingdirectory}${customer}" - dir(finalreleaserepofolder) { - summaryappend("FTP operations: Transferring to ${ftproot}") - sh """#!/bin/bash - ncftpput -u ${hostedftpsiteinfo.username} -p ${hostedftpsiteinfo.password} -R ${hostedftpsiteinfo.url} "${ftproot}" . - """ - summaryappend(", Transferred ") - } -} - -def copydirectory(File dirFrom, File dirTo) { - if (!dirTo.exists()) { - dirTo.mkdirs(); - } - dirFrom.eachFile(FileType.FILES) { File source -> - File target = new File(dirTo, source.getName()) - target.bytes = source.bytes - } - dirFrom.eachFile(FileType.DIRECTORIES) { File source -> - File target = new File(dirTo, source.getName()) - copyLargeDir(source, target) - } -} - -def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) { - def releasemeta = releaseinfo.meta - def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta) - - summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") - - getcomponentartifacts(releaseinfo, uniquefolderforrepo, itempathstopublish) - - summaryappend("\n") -} - -def convertitemstopublish(String itemstopublishstring) { - def List paths = [] - - def String[] items = itemstopublishstring.split(',') - def String allpaths = "" - for(String item : items) { - def String[] pathitems = item.split('#') - def String path = "${pathitems[0]}_${pathitems[1]}/${pathitems[2]}" - paths.add(path) - allpaths += "${path}\n" - } - echo "Selected item to publish:\n${allpaths}" - return paths -} - -// 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(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { - int md = maxdepth.toInteger() - 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) - - echo "Version unique components:" - def String versionuniquecomponent = "" - for (key in componentReleaseInfoVersionUnique.keySet()) { - versionuniquecomponent += "${key}\n" - } - echo versionuniquecomponent - - def itempathstopublish = convertitemstopublish(itemstopublishstring) - for (key in componentReleaseInfoVersionUnique.keySet()) { - def releaseinfo = componentReleaseInfoVersionUnique[key] - recallcomponent(productline, releaseinfo, softwarerelease, itempathstopublish) - } - gh.stripgithistory(releaserepofolder) - publish(hostedftpsiteinfo, customer) - - return [summarystring, markunstable, unstablereason] -} - -def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) { - return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth) -} - -return this; diff --git a/Common_scripts/publish/package.groovy b/Common_scripts/publish/package.groovy deleted file mode 100644 index 3bd9565..0000000 --- a/Common_scripts/publish/package.groovy +++ /dev/null @@ -1,176 +0,0 @@ -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 { - 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" - } - } - } - stage('Aptly environment') { - steps { - script { - echo "Aptly config file is ${APTLY_CONFIG_FILE}" - sh """#!/bin/bash -v - 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 -v - 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 - """ - } - } - } - 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}" "${PUBLISH_PATH_PREFIX}" - aptly publish -config="${APTLY_CONFIG_FILE}" list - if [ \$? -ne 0 ]; then exit 1; fi - """ - } - } - } - - stage('Add/update package in repo') { - steps { - script { - echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}" - sh """#!/bin/bash -v - 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 - """ - } - } - } - stage('Create snapshot') { - steps { - script { - echo "Snapshot name is ${SNAPSHOT_NAME}" - FULL_SNAPSHOT_NAME = "${REPO_NAME}_${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}" - // Convert prefix to regular expression - PACKAGE_VERSION_PREFIX_SPLIT = PACKAGE_VERSION_PREFIX.split("[.]") - PACKAGE_VERSION_REGEX = '' - i = 0 - while(true) { - if (i == PACKAGE_VERSION_PREFIX_SPLIT.size() - 1) { - PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] - break; - } - PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i] - PACKAGE_VERSION_REGEX += '\\.' - i++ - } - 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}" 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 filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_REGEX}.*)' - 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 - """ - } - } - } - stage('Publish snapshot') { - 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}" "${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}" "${PUBLISH_PATH_PREFIX}" - if [ \$? -ne 0 ]; then exit 1; fi - """ - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} - diff --git a/Common_scripts/publish/promptingpublish.groovy b/Common_scripts/publish/promptingpublish.groovy deleted file mode 100644 index 4af0d62..0000000 --- a/Common_scripts/publish/promptingpublish.groovy +++ /dev/null @@ -1,179 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.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() - 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}" - } - } - } - } - stage('Identify software release to publish') { - steps { - script { - gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - def allreleases = gh.gettaglist(SOURCEDIR) - def releases = new ArrayList() - if (FILTER_REDUNDANT_RELEASES == 'false') { - echo("Showing all releases") - releases = allreleases - } else { - echo("Showing filtered releases") - for (release in allreleases) { - if (!release.toLowerCase().startsWith("superceded") && - !release.toLowerCase().startsWith("erroneous") && - !release.toLowerCase().startsWith("faulty") && - !release.toLowerCase().startsWith("ignore") && - !release.toLowerCase().startsWith("inmainline")) { - echo("Showing release: ${release}") - releases.add(release) - } else { - echo("Not showing release: ${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}" - } - } - } - } - 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 info') { - steps { - script { - def mfs = autobuilderscript.getmetafolderscript() - releasemeta = mfs.metafromfolder(SOURCEDIR) - } - } - } - stage('Select which items from software release to publish') { - steps { - script { - publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - timeout(time: 10, unit: 'MINUTES') { - def itemsobject = publishitems.createItemSelector( - 'Select software items', - 'Software items', - releasemeta, - ITEMSDEFAULTLIST, - MAX_META_DEPTH, - '20', - 'PT_MULTI_SELECT') - selecteditems = input( - message: 'Select which items from the release are to be published', - ok: 'Ok', - parameters: [ - itemsobject.multiSelect() - ] - ) - echo "Chosen items are: ${selecteditems}" - } - } - } - } - stage('Publish components') { - steps { - script { - def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - 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' - } - } - } - } - 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/Common_scripts/publish/publish.groovy b/Common_scripts/publish/publish.groovy deleted file mode 100644 index 7beb134..0000000 --- a/Common_scripts/publish/publish.groovy +++ /dev/null @@ -1,91 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) - } - } - } - 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 = "refs/tags/${SOFTWARE_RELEASE}" - SOURCEDIR = "${WORKSPACE}/whole" - SOURCEROOTDIR = 'whole' - configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 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") - 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' - } - } - } - } - 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/Common_scripts/publish/publishitems.groovy b/Common_scripts/publish/publishitems.groovy deleted file mode 100644 index 677970e..0000000 --- a/Common_scripts/publish/publishitems.groovy +++ /dev/null @@ -1,127 +0,0 @@ -import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition - -class PublishableItemsSelection { - def script - def ArrayList preselectedmenuitems - def ArrayList menuitemdescriptions - def ArrayList menuitemsfull - def ExtendedChoiceParameterDefinition multiselect - - PublishableItemsSelection(script) { - this.script = script - preselectedmenuitems = new ArrayList() - menuitemdescriptions = new ArrayList() - menuitemsfull = new ArrayList() - } - - def init( - String name, - String description, - releasemeta, - String preselectedext, - String metalevelsstringext, - String visibleItemCountExt, - String controltype) { - 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] - outputDescription(menuitemdescriptions, releaseinfo) - 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 = Math.min(visibleItemCount, menuitemsfull.size()) - script.echo("visibleItemCount is now: ${visibleItemCount}") - - multiselect = new ExtendedChoiceParameterDefinition( - name, // String name - controltype, // String type - menuitemsfull.join(seperator), // String value - "project name", // String projectName - "", // String propertyFile - "", // String groovyScript - "", // String groovyScriptFile - "", // String bindings - "", // String groovyClasspath - "", // String propertyKey - preselectedmenuitems.join(seperator),// String defaultValue - "", // String defaultPropertyFile - "", // String defaultGroovyScript - "", // String defaultGroovyScriptFile - "", // String defaultBindings - "", // String defaultGroovyClasspath - "", // String defaultPropertyKey - menuitemdescriptions.join(seperator),// String descriptionPropertyValue - "", // String descriptionPropertyFile - "", // String descriptionGroovyScript - "", // String descriptionGroovyScriptFile - "", // String descriptionBindings - "", // String descriptionGroovyClasspath - "", // String descriptionPropertyKey - "", // String javascriptFile - "", // String javascript - false, // boolean saveJSONParameterToFile - false, // boolean quoteValue - visibleItemCount, // int visibleItemCount - description, // String description - seperator) // 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 outputDescription(menuitems, releaseinfo) { - def meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") - } - } - - def outputSelection(menuitems, releaseinfo) { - def meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") - } - } - - def multiSelect() { - return multiselect - } -} - -PublishableItemsSelection createItemSelector( - String name, - String description, - releasemeta, - String preselectedext, - String metalevelsstringext, - String visibleItemCountExt = '20', - String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT" - PublishableItemsSelection pis = new PublishableItemsSelection(this) - - pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type) - - return pis -} - -return this; diff --git a/Common_scripts/publishing/utils.groovy b/Common_scripts/publishing/utils.groovy deleted file mode 100644 index 2daf6f6..0000000 --- a/Common_scripts/publishing/utils.groovy +++ /dev/null @@ -1,27 +0,0 @@ - - -// The filepath must end in "/**" or "/" - Glob wildcard - as a git sparse checkout -def allowed(String filepath) { - if (filepath.endsWith('/**') || filepath.endsWith('/')) { - def files = findFiles glob: filepath - if (files.length > 0) { - return - } else { - error "There are no files/folders under the publishable item: ${filepath}" - } - } - error "The publishable item: ${filepath} does not end in /** or / (for git sparse checkouts)" -} - -// Generate a list of artifact files that are publishable to outside parties -def generatelist(meta, publishable) { - filelist = [] - for (filepath in publishable) { - if (filepath != meta.METAARTIFACTS) { - allowed(filepath) - } - meta.addPublishable(filepath) - } -} - -return this; diff --git a/Common_scripts/release/do.groovy b/Common_scripts/release/do.groovy deleted file mode 100644 index 3221d25..0000000 --- a/Common_scripts/release/do.groovy +++ /dev/null @@ -1,439 +0,0 @@ -markunstable = false -unstablereason = "" - -summaryfolder = "${WORKSPACE}/summary" -summaryfile = "${summaryfolder}/summary.txt" -summarystring = "" -repoandtagsfile = "${summaryfolder}/repoandtags.txt" -repoandtagsstring = "" -releaserepofolder = "${WORKSPACE}/releaserepos" -sourcerepofolder = "${WORKSPACE}/sourcerepos" -tempfolder = "${WORKSPACE}/temp" -gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" - -metascript = autobuilder.getmetafolderscript() - -def resetfolders() { - dir(summaryfolder) { - deleteDir() - } - dir(releaserepofolder) { - deleteDir() - } - dir(tempfolder) { - deleteDir() - } -} - -def preconditions() { - markunstable = false - unstablereason = "" - summarystring = "" - writeFile(file: summaryfile, text: "Release summary: \n") - repoandtagsstring = "" - writeFile(file: repoandtagsfile, text: "Repository summary: \n") -} - -def setunstable(String reason) { - markunstable = true - unstablereason += reason + "\n" - echo "Marked build as unstable: Reason: ${reason}" -} - -def summaryappend(String summary) { - def String currentsummarycontents = readFile(file: summaryfile) - writeFile(file: summaryfile, text: currentsummarycontents + summary) - summarystring += summary -} - -def repoandtagsappend(String summary) { - def String repoandtagscontents = readFile(file: repoandtagsfile) - writeFile(file: repoandtagsfile, text: repoandtagscontents + summary) - repoandtagsstring += summary -} - -def getpreviousreleasemeta(buildmeta, String checkoutfolder) { - def previousreleasemeta = buildmeta.getNewMetaObject(this) - // See if there is meta data file from the current release - def String releasemetafolderpath = "${checkoutfolder}/${buildmeta.folder()}" - if (fileExists(releasemetafolderpath)) { - previousreleasemeta = metascript.metafromfolder(checkoutfolder) - } - return previousreleasemeta -} - -def checkoutreleaserepo(buildmeta, String checkoutfolder) { - def String releaserepo = buildmeta.releaseinfo.releaserepoURL - // Get the latest head revision of the release repo without checking out working copy; Check out to a folder unique to component; Extract any meta - repoandtagsappend(" Release repo: ${releaserepo}") - def previousreleasemeta = buildmeta.getNewMetaObject(this) - dir(releaserepofolder) { - sh("git clone ${releaserepo} ${checkoutfolder}") - } - previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) - dir(checkoutfolder) { - // Clear all existing files - Note that this does not remove .git* - sh("git rm -r *") - } - return previousreleasemeta -} - -def checkoutsourcerepo(buildmeta, String checkoutfolder) { - def String sourcerepo = buildmeta.gitinfo.remoteurl - if (sourcerepo) { - repoandtagsappend(" Source repo: ${sourcerepo}") - // Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component - if (fileExists(checkoutfolder)) { - dir(checkoutfolder) { - sh(""" - git reset --hard - git clean -fdx - git pull - # Remove all tags that are not already on the remote - git tag -l | xargs git tag -d >/dev/null - git fetch -t >/dev/null - """ - ) - } - } - else { - dir(sourcerepofolder) { - sh("git clone ${sourcerepo} ${checkoutfolder}") - } - } - } else { - repoandtagsappend(" Source repo: None") - } -} - -def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { - // Copy relevant artifacts to temp folder - summaryappend("Artifacts: ") - def boolean result = true - for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { - def filterpath = artifactfilter - if (buildinfo.offsetpath) { - filterpath = buildinfo.offsetpath + '/' + artifactfilter - } - // Copy relevant artifacts to temp folder - echo "Copying artifacts: ${filterpath} to ${tempfolder}" - try { - copyArtifacts( - filter: filterpath, - projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname, - selector: [ - $class: 'ParameterizedBuildSelector', - parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" - ], - target: tempfolder - ) - } catch (Exception e) { - echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" - result = false - summaryappend("Does not exist:") - } - if (result) { - // Move relevant artifacts from temp folder to release position - def originalrootdir = tempfolder + "/" + buildinfo.offsetpath - dir(originalrootdir) { - sh("mv * ${repofolder}") - } - } - summaryappend("${artifactfilter},") - } - return result -} - -def releasegitadd() { - // Add anything new - sh("git add .") - summaryappend("Add,") -} - -def releasegitreset() { - // Add anything new - sh("git reset --hard") - sh("git clean -fdx") - summaryappend("Reset,") -} - -def releasegitcommit(String buildstamp) { - sh("git commit -a -m ${buildstamp}") - summaryappend("Commit,") -} - -// Determine if there has been a change by comparing the sha code in previous release meta and the build meta -def boolean checkforchange(buildmeta, previousreleasemeta) { - String buildsha = buildmeta.gitinfo.gitrevision - String previoussha = previousreleasemeta.gitinfo.gitrevision - - def boolean shachanged = (buildsha != previoussha) - echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${shachanged}" - - String buildstamp = buildmeta.buildstampinfo.buildstamp - String previousbuildstamp = previousreleasemeta.buildstampinfo.buildstamp - - def boolean buildstampchanged = (buildstamp != previousbuildstamp) - echo "buildstamp: ${buildstamp} previousbuildstamp: ${previousbuildstamp} changed: ${buildstampchanged}" - - def boolean changed = (shachanged | buildstampchanged) - echo "changed: ${changed}" - - return changed -} - -def ArrayList maketaglist(buildmeta, String buildstamp, String otherreleasetags) { - def ArrayList taglist = new ArrayList() - taglist.add(buildstamp) - - def ArrayList othertaglist = otherreleasetags.split(',') - for (othertagitem in othertaglist) { - if (othertagitem?.trim()) { - def componentothertagitem = "${othertagitem.trim()}_${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" - taglist.add(componentothertagitem) - } - } - return taglist -} - -def String releasegitgetshacode(String tag) { - def existingshacode = "" - // Check if tag exists already - def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" >\"${gitrevparseoutputfile}\" 2>/dev/null", returnStatus: true) - if (gitrevparsestatus == 0) { // Tag exists - existingshacode = readFile(file: gitrevparseoutputfile).trim() - } - return existingshacode -} - -def boolean releasegittag(String postcommitshacode, String tag) { - def boolean tagadded = false - // Check if tag exists already - def String existingshacode = releasegitgetshacode(tag) - if (existingshacode) { // Tag exists - if (existingshacode != postcommitshacode) { // If the existing tag is not associated with the one expected - // This is a problem - The tag is already at another position in git repo - setunstable("The release tag ${tag} has been used at another commit other than one expected - You must decide what to do with it - Not good practice to delete it or move it (Existing sha code: ${existingshacode} Post commit sha code: ${postcommitshacode})") - summaryappend("(${tag} - Could not add!)") - } else { - summaryappend("(${tag} - Already added)") - } - } else { // If tag does not exist already - // Tag - sh("git tag \"${tag}\"") - summaryappend("(${tag})") - tagadded = true - } - return tagadded -} - -def boolean releasegittags(String postcommitshacode, ArrayList taglist) { - boolean tagadded = false - - summaryappend("Rel Tag ") - for (tag in taglist) { - if (releasegittag(postcommitshacode, tag)) { - tagadded = true - } - } - return tagadded -} - -def boolean sourcegittag(String shacode, String tag) { - def boolean tagadded = false - // Check if tag exists already - def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" >\"${gitrevparseoutputfile}\" 2>/dev/null", returnStatus: true) - if (gitrevparsestatus == 0) { // Tag exists - def existingshacode = readFile(file: gitrevparseoutputfile).trim() - if (existingshacode != shacode) { // If the existing tag is not associated with HEAD - // This is a problem - The tag is already at another position in git repo - setunstable("The source tag ${tag} has been used at another commit (${existingshacode}) - You must decide what to do with it - Not good practice to delete it or move it (Existing sha code: ${existingshacode} Post commit sha code: ${shacode})") - summaryappend("(${tag} - Could not add!)") - } - else { - summaryappend("(${tag} - Already added)") - } - } - else { // If tag does not exist already - // Tag - sh("git tag \"${tag}\" ${shacode}") - summaryappend("(${tag})") - tagadded = true - } - return tagadded -} - -def sourcegittags(String buildsha, List taglist) { - boolean tagadded = false - - summaryappend(",Src Tag ") - for (tag in taglist) { - if (sourcegittag(buildsha, tag)) { - tagadded = true - } - } - return tagadded -} - -def releasegitpush(String dryrunpush ) { - sh("git remote -v") - if (dryrunpush == "true") { - sh("git push -n --tags origin master") - summaryappend(",Dry-Run-Push") - setunstable("The artifact(s) have not been pushed/saved (\"Dry run push\" parameter/option is selected)") - } - else { - sh("git push --tags origin master") - summaryappend(",Push") - } -} - -def sourcegitpush(String dryrunpush ) { - sh("git remote -v") - if (dryrunpush == "true") { - sh("git push -n --tags") - summaryappend(",Src-Dry-Run-Push") - setunstable("The source tag(s) have not been pushed/saved (\"Dry run push\" parameter/option is selected)") - } - else { - sh("git push --tags") - summaryappend(",Src Push") - } -} - -def boolean isalreadyreleased(buildmeta, tag) { - def boolean alreadyreleased = buildmeta.releaseinfo.released - if (alreadyreleased) { - echo "Component is already marked as released: ${alreadyreleased}" - } else { - String commitshacode = releasegitgetshacode(tag) - if (commitshacode) { - echo "Tag: ${tag} already exists in this repo therefore marking as already released" - alreadyreleased = true - } else { - alreadyreleased = false - } - } - return alreadyreleased -} - -def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String sourcerepo, String otherreleasetags, String dryrunpush) { - summaryappend(" Git operations: ") - def String buildstamptag = buildmeta.releasetag() - - dir(releaserepo) { - def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Pre commit sha code: ${precommitshacode}" - - def boolean alreadyreleased = isalreadyreleased(buildmeta, buildstamptag) - - def String postcommitshacode - def boolean changed = false - if (alreadyreleased) { - summaryappend("Already-released,") - postcommitshacode = releasegitgetshacode(buildstamptag) - echo "Previous release sha code: ${postcommitshacode}" - } else { - releasegitadd() - - changed = checkforchange(buildmeta, previousreleasemeta) - if (changed) { - releasegitcommit(buildstamptag) - } else { - releasegitreset() - summaryappend("No-commit,") - } - - postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Post commit sha code: ${postcommitshacode}" - } - - ArrayList taglist = maketaglist(buildmeta, buildstamptag, otherreleasetags) - def tagadded = releasegittags(postcommitshacode, taglist) - - if (changed || tagadded) { - releasegitpush(dryrunpush) - } - } - dir(sourcerepo) { - def String srcbuildstamptag = buildmeta.globalreleasetag() - def String buildsha = buildmeta.gitinfo.gitrevision - - if (buildsha) { - def ArrayList srctaglist = maketaglist(buildmeta, srcbuildstamptag, otherreleasetags) - def tagadded = sourcegittags(buildsha, srctaglist) - if (tagadded) { - sourcegitpush(dryrunpush) - } - } else { - summaryappend(",No Src ") - } - } -} - -def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) { - def buildmeta = buildinfo.meta - def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" - def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" - def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" - def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" - - summaryappend("${buildmeta.productinfo.productname} ${buildmeta.productinfo.subcomponentname}: ") - repoandtagsappend("${buildmeta.productinfo.productname} ${buildmeta.productinfo.subcomponentname}: ") - def previousreleasemeta = checkoutreleaserepo(buildmeta, uniquefolderforrepo) - - checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo) - - if (getcomponentartifacts(toplevelbuildmeta, buildinfo, uniquefolderforrepo, uniquefoldertemp)) { - gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) - } - - summaryappend("\n") - repoandtagsappend("\n") -} - -def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) { - def int md = maxdepth.toInteger() - resetfolders() - preconditions() - - // Walk the meta information to a max depth, looking for components to release - def componentReleaseInfo = buildmeta.releasewalkerunique(md) - echo "Unique components:" - def String versioncomponent = "" - for (key in componentReleaseInfo.keySet()) { - versioncomponent += "${key}\n" - } - echo versioncomponent - - // Walk the meta information to a max depth, looking for components to release - def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md) - echo "Version unique components:" - def String versionuniquecomponent = "" - for (key in componentReleaseInfoVersionUnique.keySet()) { - versionuniquecomponent += "${key}\n" - } - echo versionuniquecomponent - - if (DO_INTEGRITY_CHECK == "true") { - if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) { - error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct?" - } - } - - def toplevelid = buildmeta.componentidentifier() - // For each component - for (key in componentReleaseInfo.keySet()) { - def buildinfo = componentReleaseInfo[key] - if (toplevelid != key) { - releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) - } - } - // Do the top level last - def toplevelbuildinfo = componentReleaseInfo[toplevelid] - releasecomponent(buildmeta, toplevelbuildinfo, otherreleasetags, dryrunpush) - - return [summarystring, markunstable, unstablereason] -} - -return this; diff --git a/Common_scripts/release/registerrepo.groovy b/Common_scripts/release/registerrepo.groovy deleted file mode 100644 index f565706..0000000 --- a/Common_scripts/release/registerrepo.groovy +++ /dev/null @@ -1,12 +0,0 @@ - -vc = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - -// Prove the existence of the release repo - otherwise there is a large wait to cycle the build to correct the meta data -def registerrepo(meta, String releaserepo) { - if (releaserepo?.trim()) { - vc.checkRepoExists(releaserepo) - } - meta.releaseinfo.set(releaserepo) -} - -return this; diff --git a/Common_scripts/release/release.groovy b/Common_scripts/release/release.groovy deleted file mode 100644 index e51a174..0000000 --- a/Common_scripts/release/release.groovy +++ /dev/null @@ -1,88 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}" } - stages { - stage('Initial setup') { - steps { - script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) - } - } - } - stage('Clean exports') { - steps { - script { - cleanfolders = [ - "${WORKSPACE}/build_artifacts", - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Get build artifact meta') { - steps { - script { - BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts" - copyArtifacts( - filter: 'meta/**', - projectName: BUILD_JOB, - selector: [ - $class: 'ParameterizedBuildSelector', - parameterName: BUILD_JOB_SELECTOR - ], - target: BUILD_ARTIFACTS - ) - def mfs = autobuilderscript.getmetafolderscript() - buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS) - } - } - } - stage('Release components') { - steps { - script { - def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") - // Place the top level build stamp on all - OTHER_RELEASE_TAGS = "${buildmeta.globalreleasetag()},${OTHER_RELEASE_TAGS}" - (summarystring, markunstable, unstablereason) = releaser.releasehierarchy(buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH) - 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/Common_scripts/remoteaccess/ftp.groovy b/Common_scripts/remoteaccess/ftp.groovy deleted file mode 100644 index 25b9143..0000000 --- a/Common_scripts/remoteaccess/ftp.groovy +++ /dev/null @@ -1,32 +0,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() - ftpclient.connect(ftpsiteinfo.url) - ftpclient.enterLocalPassiveMode() - ftpclient.login(ftpsiteinfo.username, ftpsiteinfo.password) - ftpclient.changeWorkingDirectory(ftpsiteinfo.workingdirectory) - - return ftpclient -} - -return this; diff --git a/Common_scripts/remoteaccess/hostedftp.groovy b/Common_scripts/remoteaccess/hostedftp.groovy deleted file mode 100644 index cf62d32..0000000 --- a/Common_scripts/remoteaccess/hostedftp.groovy +++ /dev/null @@ -1,28 +0,0 @@ -ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") - -def getHostedFTPSiteInfo() { - 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() - - def ftpsiteinfo = getHostedFTPSiteInfo() - def 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/Common_scripts/staticanalysis/ccm.groovy b/Common_scripts/staticanalysis/ccm.groovy deleted file mode 100644 index f0e5b80..0000000 --- a/Common_scripts/staticanalysis/ccm.groovy +++ /dev/null @@ -1,119 +0,0 @@ -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) - } - } - } - stage('Static analysis') { - steps { - script { - def CCMOLDER = "${STATICANALYSIS}/ccm" - dir(CCMOLDER) { - echo "Executing: ${CCM} ${SRC} /xml /nummetrics=100 > ccm.xml" - if (isUnix()) { - sh """#!/bin/bash - find "${SRC}" -type f ! -name "*.cpp" -a ! -name "*.h" -a ! -name "*.hpp" -a ! -name "*.c" -exec rm -r {} \\; - # Uses mono - "${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml - """ - } else { - 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/Common_scripts/staticanalysis/cpd.groovy b/Common_scripts/staticanalysis/cpd.groovy deleted file mode 100644 index 6f3a33f..0000000 --- a/Common_scripts/staticanalysis/cpd.groovy +++ /dev/null @@ -1,151 +0,0 @@ -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}" - SRC = "${SOURCE_PATH}" - if (SOURCE_OFFSET_PATH) { - SRC += "/${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) - } - } - } - stage('Static analysis') { - steps { - script { - def PPDFOLDER = "${STATICANALYSIS}/ppd" - def EXCLUDE_PARAM = '' - if (EXCLUDE_PATHS) { - EXCLUDE_PARAM = '--exclude "' - def exclude_path_list = EXCLUDE_PATHS.split(',') - for (exclude_path in exclude_path_list) { - EXCLUDE_PARAM += "${SRC}/${exclude_path.trim()}," - } - EXCLUDE_PARAM += '"' - } - if (isUnix()) { - sh """#!/bin/bash - set -ev - - mkdir -p "${PPDFOLDER}" - export PMD_JAVA_OPTS=-Xmx65536m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/cpd.xml" - """ - } else { - bat """ - mkdir -p "${PPDFOLDER}" - set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/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/Common_scripts/staticanalysis/cppcheck.groovy b/Common_scripts/staticanalysis/cppcheck.groovy deleted file mode 100644 index bdc6a2a..0000000 --- a/Common_scripts/staticanalysis/cppcheck.groovy +++ /dev/null @@ -1,113 +0,0 @@ -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) - } - } - } - stage('Static analysis') { - steps { - script { - def CPPCHECKFOLDER = "${STATICANALYSIS}/cppcheck" - dir(CPPCHECKFOLDER) { - echo "Executing: ${CPPCHECK} --xml --xml-version=2 ${SRC} 2> cppcheck.xml" - if (isUnix()) { - sh """#!/bin/bash - set -e - - "${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml - """ - } else { - 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' - } - } -} diff --git a/Common_scripts/textutils/subst.groovy b/Common_scripts/textutils/subst.groovy deleted file mode 100644 index c0207a3..0000000 --- a/Common_scripts/textutils/subst.groovy +++ /dev/null @@ -1,8 +0,0 @@ - -def substitute(String filepath, pattern, String subst) { - fileText = readFile(file: filepath, encoding: 'UTF-8') - def converted = fileText.replaceAll(pattern, subst) - writeFile(file: filepath, text: converted, encoding: 'UTF-8') -} - -return this; \ No newline at end of file diff --git a/Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig b/Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig deleted file mode 100644 index ea618a3..0000000 --- a/Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig +++ /dev/null @@ -1,25 +0,0 @@ -{ - "version": "1.0", - "components": [ - "Microsoft.VisualStudio.Workload.ManagedDesktop", - "Microsoft.VisualStudio.Workload.NativeDesktop", - "Microsoft.VisualStudio.Workload.NetWeb", - "Microsoft.VisualStudio.Workload.NetCoreTools", - "microsoft.net.componentgroup.targetingpacks.common", - "microsoft.componentgroup.blend", - "microsoft.visualstudio.component.entityframework", - "microsoft.visualstudio.component.debugger.justintime", - "microsoft.visualstudio.component.wcf.tooling", - "microsoft.visualstudio.component.vc.diagnostictools", - "microsoft.visualstudio.component.vc.cmake.project", - "microsoft.visualstudio.component.vc.testadapterforboosttest", - "microsoft.visualstudio.component.vc.testadapterforgoogletest", - "microsoft.visualstudio.component.vc.atlmfc", - "microsoft.visualstudio.component.appinsights.tools", - "microsoft.visualstudio.component.diagnostictools", - "microsoft.visualstudio.componentgroup.web.cloudtools", - "microsoft.visualstudio.component.aspnet45", - "microsoft.visualstudio.component.webdeploy", - "microsoft.visualstudio.component.nuget.buildtools" - ] -} \ No newline at end of file diff --git a/Common_scripts/versioncontrol/git.groovy b/Common_scripts/versioncontrol/git.groovy deleted file mode 100644 index f5b2ebd..0000000 --- a/Common_scripts/versioncontrol/git.groovy +++ /dev/null @@ -1,376 +0,0 @@ -import hudson.plugins.git.* -import hudson.plugins.git.extensions.* -import hudson.plugins.git.extensions.impl.* - -clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") - -def boolean isShallowClonedRepo(String gitrootpath) { - def boolean isshallowclone = true - - dir( gitrootpath) { - if (isUnix()) { - isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() - } - else { - isshallowclone = bat(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() - } - echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" - } - return isshallowclone -} - -String getGitInfo(String workingSetRootPath) { - dir(workingSetRootPath) { - return clh.getCommandOutput('git rev-parse HEAD') - } -} - -ArrayList gettaglist(String workingSetRootPath) { - ArrayList taglist = new ArrayList() - dir(workingSetRootPath) { - def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') - taglist = tagliststring.split('\\n') - } - return taglist -} - -@NonCPS -def ArrayList sparsecheckoutconfig(ArrayList paths) { - ArrayList sparsecheckoutpaths = new ArrayList() - for (path in paths) { - sparsecheckoutpaths.add(new SparseCheckoutPath(path)) - } - return sparsecheckoutpaths -} - -def String uniquereporootname(String gitURL) { - def uniquename = gitURL.replaceAll("[^A-Za-z0-9]", "_") - echo "Unique reporoot name for URL: ${gitURL} is: ${uniquename}" - return uniquename -} - -// The REPO_ROOT is a folder where a cache of git checkouts can be kept - each subfolder name is unique to a particular git repo -def String checkouttoreporoot(String gitURL) { - def String reporootsubfolder - def String reporootenv = env.REPO_ROOT - if (!reporootenv) { - reporootsubfolder = "" - echo "To improve Git performance: Define the REPO_ROOT enviroment to a path where a cache of git repositories can be placed on this slave" - } else { - def reporootname = uniquereporootname(gitURL) - reporootsubfolder = "${reporootenv}/${reporootname}" - - if (!fileExists(reporootsubfolder)) { - echo "Checking out ${gitURL} to ${reporootsubfolder}" - checkout([ - $class: 'GitSCM', - userRemoteConfigs: [ - [url: gitURL] - ], - branches: [ - [name: 'origin/master'] - ], - doGenerateSubmoduleConfigurations: false, - extensions: [ - [$class: 'GitLFSPull'], - [$class: 'CleanBeforeCheckout'], - [$class: 'CheckoutOption', timeout: 180], - [$class: 'RelativeTargetDirectory', relativeTargetDir: reporootsubfolder], - ], - submoduleCfg: [], - ]) - } else { - echo "Found ${gitURL} checked out at ${reporootsubfolder}" -/* - dir(reporootsubfolder) { - if (isUnix()) { - sh """ - git status - if [ \$? -ne 0 ]; then exit 1; fi - """ - } else { - bat """ - git status - if errorlevel 1 EXIT /b 1 - """ - } - } -*/ - } - } - return reporootsubfolder -} - -def checkgitlfsinstall() { - if (isUnix()) { - sh """ - git lfs install - if [ \$? -ne 0 ]; then exit 1; fi - """ - - } else { - bat """ - git lfs install - if errorlevel 1 EXIT /b 1 - """ - } -} - -//No credentials specified -//Cloning the remote Git repository -//Cloning repository git@hydra:print-server-releases/print_server_whole.git -//> git init /home/jenkins_user/jenkins/jobs/Print_Server_publish_to_customer/ws/whole # timeout=10 -//Using reference repository: /home/jenkins_user/reporoot/git_hydra_print_server_releases_print_server_whole_git -//Fetching upstream changes from git@hydra:print-server-releases/print_server_whole.git -// > git --version # timeout=10 -// > git fetch --tags --progress git@hydra:print-server-releases/print_server_whole.git +refs/heads/*:refs/remotes/origin/* # timeout=120 -// > git config remote.origin.url git@hydra:print-server-releases/print_server_whole.git # timeout=10 -// > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 -// > git config remote.origin.url git@hydra:print-server-releases/print_server_whole.git # timeout=10 -// Cleaning workspace -// > git rev-parse --verify HEAD # timeout=10 -// No valid HEAD. Skipping the resetting -// > git clean -fdx # timeout=10 -// Fetching upstream changes from git@hydra:print-server-releases/print_server_whole.git -// > git fetch --tags --progress git@hydra:print-server-releases/print_server_whole.git +refs/heads/*:refs/remotes/origin/* # timeout=120 -// > git rev-parse refs/tags/2.10180.7389.21125_7^{commit} # timeout=10 -// > git rev-parse refs/remotes/origin/refs/tags/2.10180.7389.21125_7^{commit} # timeout=10 -// Checking out Revision 64cac35e9a7603c060135f61f91b3f809bbdf160 (refs/tags/2.10180.7389.21125_7) -// Enabling Git LFS pull -// > git config core.sparsecheckout # timeout=10 -// > git checkout -f 64cac35e9a7603c060135f61f91b3f809bbdf160 # timeout=120 -// > git config --get remote.origin.url # timeout=10 -// > git lfs pull origin # timeout=120 -// Commit message: "2.10180.7389.21125_7" -// > git rev-list --no-walk 64cac35e9a7603c060135f61f91b3f809bbdf160 # timeout=10 - - -// > git rev-parse --is-inside-work-tree # timeout=10 -// Fetching changes from the remote Git repository -// > git config remote.origin.url git@hydra:releases/print-server-installer.git # timeout=10 -// Cleaning workspace -// > git rev-parse --verify HEAD # timeout=10 -// Resetting working tree -// > git reset --hard # timeout=10 -// > git clean -fdx # timeout=10 -// Using shallow fetch with depth 1 -// Fetching upstream changes from git@hydra:releases/print-server-installer.git -// > git --version # timeout=10 -// > git fetch --tags --progress git@hydra:releases/print-server-installer.git +refs/heads/*:refs/remotes/origin/* --depth=1 # timeout=120 -// > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 -// > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 -// Checking out Revision d0788d22622862e441c5995a22629846573c39f3 (refs/remotes/origin/master) -// Enabling Git LFS pull -// > git config core.sparsecheckout # timeout=10 -// > git read-tree -mu HEAD # timeout=10 -// > git checkout -f d0788d22622862e441c5995a22629846573c39f3 # timeout=120 -// > git config --get remote.origin.url # timeout=10 -// > git lfs pull origin # timeout=120 -// Commit message: "2.10180.7389.21125_3" -// > git rev-list --no-walk d0788d22622862e441c5995a22629846573c39f3 # timeout=10 - -def String lfsinstallandreporoot(String gitURL) { - checkgitlfsinstall() - return checkouttoreporoot(gitURL) -} - -def showsparseitemlist(ArrayList sparseitemlist = new ArrayList()) { - if (!sparseitemlist.isEmpty()) { - def itemstring = "Items in sparse item list:\n" - for (item in sparseitemlist) { - itemstring += item + "\n" - } - echo itemstring - } -} - -def docheckout(String gitURL, String revision, int cloneDepth, String reporootpath, boolean shallowClone, String targetDir, sparseitemlist) { - checkout([ - $class: 'GitSCM', - userRemoteConfigs: [ - [url: gitURL] - ], - branches: [ - [name: revision] - ], - doGenerateSubmoduleConfigurations: false, - extensions: [ - [$class: 'GitLFSPull'], - [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], - [$class: 'CheckoutOption', timeout: 120], - [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], - [$class: 'SparseCheckoutPaths', sparseCheckoutPaths: sparsecheckoutconfig(sparseitemlist)], - ], - submoduleCfg: [], - ]) -} - -// gitCheckout (below) cannot handle sparse checkout and lfs at the moment - see https://issues.jenkins-ci.org/browse/JENKINS-43427 - see gitCheckoutAlt() -def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { - def String reporootpath = lfsinstallandreporoot(gitURL) - showsparseitemlist(sparseitemlist) - docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist) -} - -def gitinit(String targetDir, String reporootpath) { - if (!fileExists("${targetDir}/.git")) { // Git folder does not already exist - echo "git init ${targetDir}" - if (isUnix()) { - sh """ - git init "${targetDir}" - """ - } else { - bat """ - git init "${targetDir}" - """ - } - } - echo "Writing ${reporootpath}/.git/objects to ${targetDir}/.git/objects/info/alternates" - dir("${targetDir}/.git/objects/info") { - writeFile(file: 'alternates', text: "${reporootpath}/.git/objects") - } -} - -def setlfsfetchinclude(String targetDir, ArrayList sparseitemlist) { - def String sparseitemliststring = "" - if (!sparseitemlist.isEmpty()) { - for (item in sparseitemlist) { - sparseitemliststring += "${item}," - } - echo "git config lfs.fetchinclude ${sparseitemliststring}" - dir(targetDir) { - if (isUnix()) { - sh """ - git config lfs.fetchinclude "${sparseitemliststring}" - """ - } else { - bat """ - git config lfs.fetchinclude "${sparseitemliststring}" - """ - } - } - } -} - -def gitsparserestore(String targetDir) { - echo "Clean out full fetch; Force a sparse fetch" - dir(targetDir) { - if (isUnix()) { - sh """ - git rm -rf . > /dev/null - git clean -fxd > /dev/null - git reset --hard > /dev/null - """ - } else { - bat """ - git rm -rf . 2> nul - git clean -fxd 2> nul - git reset --hard 2> nul - """ - } - } - } - -def List convertSparseItemsString(String itemstopublish) { - def List sparsepaths = [] - - boolean nonempty = itemstopublish?.trim() - if (nonempty) { - def String[] items = itemstopublish.trim().split(',') - def String allpaths = "" - for(String item : items) { - sparsepaths.add(item) - allpaths += "${item}\n" - } - echo "Selected item to publish:\n${allpaths}" - } - return sparsepaths -} - -def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { - echo "Performing alternative checkout" - def String reporootpath = lfsinstallandreporoot(gitURL) - showsparseitemlist(sparseitemlist) - if (!sparseitemlist.isEmpty()) { - gitinit(targetDir, reporootpath) - setlfsfetchinclude(targetDir, sparseitemlist) - } - docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist) - if (!sparseitemlist.isEmpty()) { - gitsparserestore(targetDir) - } -} - -def checkRepoExists(String gitURL) { - def int result = 0 - if (isUnix()) { - result = sh( script: """ - git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY - """, - returnStatus: true - ) - } else { - result = bat( script: """ - @git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY - """, - returnStatus: true - ) - } - echo "git ls-remote return result: ${result}" - if (result > 0) { - error("The release repo: ${gitURL} cannot be found. Please ensure this exists before building") - } else { - echo "The release repo: ${gitURL} exists" - } -} - -String getSHAFromVersion(String versionFolder) { - dir (versionFolder) { - srcRevision = readFile("gitrevision.txt").trim() - } - return srcRevision -} - -boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { - def keys = versions.keySet() - if (keys.size() < 1) { - return false - } - if (keys.size() == 1) { - return true - } - else { - version = "" - for (key in keys) { - nextversion = versions.get(key) - if (version == "") { - version = nextversion - } - if (nextversion != version) { - return false - } - } - } - return true -} - -def stripgithistory(String rootfolder) { - echo "Stripping git history out of ${rootfolder}" - dir(rootfolder) { - if (isUnix()) { - sh """#!/bin/bash - pwd - find . -type d -name ".git" | xargs -iXX rm -rf XX - find . -name ".gitignore" | xargs -iXX rm -rf XX - find . -name ".gitmodules" | xargs -iXX rm -rf XX - find . -iname ".gitattributes" | xargs -iXX rm -rf XX - find . -iname "*@tmp" | xargs -iXX rm -rf XX - """ - } else { - echo "Not supporting git stripping in Windows at the moment" - } - } -} - -return this diff --git a/Common_scripts/versionnumbering/do.groovy b/Common_scripts/versionnumbering/do.groovy deleted file mode 100644 index 666aee3..0000000 --- a/Common_scripts/versionnumbering/do.groovy +++ /dev/null @@ -1,23 +0,0 @@ - -def stamp(convertdetails) { - for (convertdetail in convertdetails) { - def filetoconvert = convertdetail[0] - def pattern = convertdetail[1] - def replacement = convertdetail[2] - //echo "Converting any instances of pattern: ${pattern} with replacement: ${replacement} in file: ${filetoconvert}" - def stampscript = "${autobuilder.commonscripts()}/versionstamping/versionstamper.py" - //echo "Using python: ${PYTHON} and script: ${stampscript}" - if (isUnix()) { - sh """ - "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" - """ - } - else { - bat """ - "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" - """ - } - } -} - -return this; diff --git a/Common_scripts/versionnumbering/generate.groovy b/Common_scripts/versionnumbering/generate.groovy deleted file mode 100644 index 71d7bf6..0000000 --- a/Common_scripts/versionnumbering/generate.groovy +++ /dev/null @@ -1,169 +0,0 @@ -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - -def int maxversionnumber() { - def int MAXVERSIONNUMBER = 65535 - return MAXVERSIONNUMBER -} - -int incrementrevision(int current, int increment) { - def int newrevision = (current + increment) % (maxversionnumber() + 1) - echo "Current revision: ${current} Increment: ${increment} New revision: ${newrevision}" - return newrevision -} - -def getGitRevision(String gitrootpath, int basebuildnumber) { - def int adjustedchangecount - def String gitrevision - def String remoteinfo - def String remoteurl - - def boolean isShallowCloned = gh.isShallowClonedRepo(gitrootpath) - if (isShallowCloned) { - error("Cannot generate a version number from a shallow cloned repo at ${gitrootpath}") - } - - dir( gitrootpath) { - def int changecount = 0 - if (isUnix()) { - changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger() - } - else { - changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger() - } - echo "Change count: ${changecount}" - def int mvnp1 = maxversionnumber() + 1 - basebuildnumber = (basebuildnumber < 0) ? mvnp1 - (basebuildnumber.abs() % mvnp1) : basebuildnumber - adjustedchangecount = incrementrevision(changecount, basebuildnumber) - echo "Adjusted change count: ${adjustedchangecount}" - if (isUnix()) { - gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() - } - else { - gitrevision = bat(returnStdout: true, script: "@git rev-parse HEAD").trim() - } - echo "Revision: ${gitrevision}" - if (isUnix()) { - remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() - } - else { - remoteinfo = bat(returnStdout: true, script: "@git remote show origin").trim() - } - echo "Remote info: ${remoteinfo}" - if (isUnix()) { - remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() - } - else { - remoteurl = bat(returnStdout: true, script: "@git config --get remote.origin.url").trim() - } - echo "Remote URL: ${remoteurl}" - } - return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] -} - -// Handle: -// origin/master -// origin/2.0.x -def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) { - echo "Determining version number prefix from source branch name: ${sourcebranch}" - sourcebranch = sourcebranch.toLowerCase() - - def defaultversionprefix = "0.30000.0." - def splits = sourcebranch.split('/') - if (splits.size() < 1) { - echo "Source branch name is invalid. Defaulting to: ${defaultversionprefix}" - return defaultversionprefix - } - - def mastertypeversionprefix = "0.20000.0." - sourcebranch = splits.last() - if (sourcebranch.toLowerCase().find("master") != null) { - echo "Source branch name has 'master' in it. Defaulting to: ${mastertypeversionprefix}" - return mastertypeversionprefix - } - - def splits2 = sourcebranch.split('\\.') - if (splits2.size() < 1) { - def thirdpartyversionprefix = "0.25000.0." - echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" - return thirdpartyversionprefix - } - - for (split in splits2) { - if (split == "x") { - echo "Source branch name has '.x' or 'x.' in it. Defaulting to: ${mastertypeversionprefix}" - return mastertypeversionprefix - } - } - - def integerstrings = sourcebranch.findAll(/\d+/) - def integers = [] - for (integerstring in integerstrings) { - int integer = integerstring.toInteger() - integer = integer % (maxversionnumber() + 1) - integers.add(integer) - } - - def versionprefix = "" - if (integers.size() < 1) { - echo "This source branch name has no numbers in its name so defaulting to: ${defaultversionprefix}" - versionprefix = defaultversionprefix - } - else { - def int integernumbercount = 0 - for (integer in integers) { - versionprefix += integer + "." - integernumbercount += 1 - if (integernumbercount > 2) { - break - } - } - if (integernumbercount == 0) { - echo "No leading numbers were found in source branch name so defaulting to: ${defaultversionprefix}" - versionprefix = defaultversionprefix - } - else if (integernumbercount == 1) { - versionprefix += "0.0." - } - else if (integernumbercount == 2) { - versionprefix += "0." - } - } - if (droptrailingdot == true) { - versionprefix = versionprefix.substring(0, versionprefix.length() - 1); - } - echo "Determined version prefix to be: ${versionprefix}" - return versionprefix -} - -String generate(meta, String sourcerevision, String sourcepath, int basebuildnumber = 1000) { - def int gitrevisioncount - def String gitrevision - def String remoteinfo - def String remoteurl - - (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) - - def versionprefix = getVersionPrefix(sourcerevision) - - def buildstamp = versionprefix + gitrevisioncount.toString() - echo "Build stamp is: ${buildstamp}" - - meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) - meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp) - - return buildstamp -} - -String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) { - def int bbn = basebuildnumber.trim().toInteger() - return generate(meta, sourcerevision, sourcepath, bbn) -} - -String copyfrom(meta, othermeta) { - meta.gitinfo = othermeta.gitinfo - meta.buildstampinfo = othermeta.buildstampinfo - - return meta.buildstampinfo.buildstamp -} - -return this; \ No newline at end of file diff --git a/Common_scripts/versionstamping/.project b/Common_scripts/versionstamping/.project deleted file mode 100644 index 74928d6..0000000 --- a/Common_scripts/versionstamping/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - versionstamping - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/Common_scripts/versionstamping/.pydevproject b/Common_scripts/versionstamping/.pydevproject deleted file mode 100644 index 746d0f0..0000000 --- a/Common_scripts/versionstamping/.pydevproject +++ /dev/null @@ -1,8 +0,0 @@ - - - -/${PROJECT_DIR_NAME} - -python 3.0 -python35 - diff --git a/Common_scripts/versionstamping/versionstamper.py b/Common_scripts/versionstamping/versionstamper.py deleted file mode 100644 index 441ad06..0000000 --- a/Common_scripts/versionstamping/versionstamper.py +++ /dev/null @@ -1,38 +0,0 @@ -import argparse -import sys -import shutil -from builtins import FileNotFoundError - -def main(argv): - parser = argparse.ArgumentParser(description="Look for version number pattern in file and replace with autobuild version number") - - # Call once arguments to allow or disallow something - parser.add_argument('-f', '--filetoconvert', help='The file to convert') - parser.add_argument('-p', '--pattern', default='0.30000.0.0', help='The pattern to search for and replace') - parser.add_argument('-s', '--substitute', help='The new version number that will substitute the pattern') - - args = parser.parse_args(argv) - - filetoconvert = args.filetoconvert - pattern = args.pattern - substitute = args.substitute - - print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert)) - - with open(filetoconvert,'r') as c: - fileread = c.read() - - count = 0 - 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) - print("Confirmed %s instances of %s post-conversion"%(count,substitute)) - f.write(converted) - - if count == 0: - return 1 - return 0 - -if __name__ == "__main__": - sys.exit(main(sys.argv[1:])) From f9faac44e4669c17b3234d923715312faf565916 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 17 Dec 2020 13:21:49 +0000 Subject: [PATCH 109/115] Use startnonbuild instead of startbuild --- release/release.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.groovy b/release/release.groovy index e51a174..4220f3b 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -5,7 +5,7 @@ pipeline { steps { script { autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + meta = autobuilderscript.startnonbuild(this) } } } From 96cb3fa5e9cc32d098b7f4570a26f20cbf31be19 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 27 Dec 2020 21:50:58 +0000 Subject: [PATCH 110/115] CORE-239 - Be more selective about which files are executable --- packaging/debian.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index a5fc773..ead24fa 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -72,7 +72,6 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p 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}" mkdir -v -p "${packageout}" From d8cb596e22371b05e57ece000c22be23c62e316d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Feb 2021 17:47:38 +0000 Subject: [PATCH 111/115] HMBFDHV-560 - Update autobuild scripts so that they can handle past releases of logic --- copy/logic.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index d1ece6d..7ae0fe1 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -26,7 +26,9 @@ pipeline { stage('Copying logic artifacts') { steps { script { - importer.artifactimport(meta, LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_RELEASE_REPO, LOGIC_RELEASE_REVISION, LOGICDEST) + def logicoptions = importer.getNewImportOptions() + logicoptions.source(LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_ARTIFACT_RELEASE_REPO, LOGIC_ARTIFACT_RELEASE_REVISION) + importer.artifactimport(meta, logicoptions, LOGICDEST) } } } From 0b360fcd9299e6d2e609e5f99567a79c7750bc99 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Feb 2021 18:03:55 +0000 Subject: [PATCH 112/115] HMBFDHV-560 - Store product variant in meta productinfo --- autobuilder.groovy | 6 +++--- meta/folder.groovy | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 4e04695..2879f11 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -44,7 +44,7 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { } // Start up boilderplate -def startbuild(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String releaserepo = RELEASE_REPO, String releaserepovariantsuffix = '', String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) { +def startbuild(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String releaserepo = RELEASE_REPO, String productvariant = '', String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -55,13 +55,13 @@ def startbuild(script, String productname = PRODUCT_NAME, String subcomponentnam def meta = getmetafolderscript().metareset(script) echo "Product name: ${productname} Subcomponent name: ${subcomponentname}" - meta.productinfo.set(productname, subcomponentname) + meta.productinfo.set(productname, subcomponentname, productvariant) def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) def rr = load("${commonscripts()}/release/registerrepo.groovy") - def String alteredreleaserepo = alterreleaserepo(releaserepo, releaserepovariantsuffix) + def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant) echo "Release repo: ${alteredreleaserepo}" rr.registerrepo(meta, alteredreleaserepo) diff --git a/meta/folder.groovy b/meta/folder.groovy index aac8b6c..dcce18d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -23,13 +23,14 @@ class ProductInfo extends GISJsonSerialised { String productname String subcomponentname - ProductInfo(script, productname = "", subcomponentname = "") { + ProductInfo(script, productname = "", subcomponentname = "", variant = "") { super(script) this.productname = productname this.subcomponentname = subcomponentname + this.variant = variant } - void set(String productname, String subcomponentname) { + void set(String productname, String subcomponentname, String variant = '') { // Make sure the fields can be used in git tags def int pstatus = 0 if (script.isUnix()) { @@ -51,19 +52,34 @@ class ProductInfo extends GISJsonSerialised { if (sstatus > 0) { script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name") } + if (variant) { + def int sstatus = 0 + if (script.isUnix()) { + sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) + } + else { + sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) + } + if (sstatus > 0) { + script.error("The subcomponent name: ${variant} needs to be renamed as it cannot be used in a git tag name") + } + } this.productname = productname this.subcomponentname = subcomponentname + this.variant = variant } void deserialiseJson(rawmeta) { productname = rawmeta['productname'] subcomponentname = rawmeta['subcomponentname'] + variant = rawmeta['variant'] ?: "" } LinkedHashMap serialisationdata() { def data = [ 'productname' : productname, 'subcomponentname' : subcomponentname, + 'variant' : variant, ] return data } From ca6f895b924e449e8864aba744416982f602af95 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Feb 2021 18:07:30 +0000 Subject: [PATCH 113/115] HMBFDHV-560 - Store product variant in meta productinfo --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index dcce18d..e5adb7e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -53,14 +53,14 @@ class ProductInfo extends GISJsonSerialised { script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name") } if (variant) { - def int sstatus = 0 + def int vstatus = 0 if (script.isUnix()) { - sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) + vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) + vstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) } - if (sstatus > 0) { + if (vstatus > 0) { script.error("The subcomponent name: ${variant} needs to be renamed as it cannot be used in a git tag name") } } From 2a0f347019991651b3a990e74fa8aa15c2fec423 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Feb 2021 18:10:11 +0000 Subject: [PATCH 114/115] HMBFDHV-560 - Store product variant in meta productinfo --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index e5adb7e..90c8e27 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -22,6 +22,7 @@ abstract class GISJsonSerialised implements Serializable { class ProductInfo extends GISJsonSerialised { String productname String subcomponentname + String variant ProductInfo(script, productname = "", subcomponentname = "", variant = "") { super(script) From 900e051136affdc19c6aeebd1f124c860c16e9d5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 11 Mar 2021 19:10:43 +0000 Subject: [PATCH 115/115] AUI-2735 - Add new script --- meta/folder.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index aac8b6c..90253d7 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -170,6 +170,10 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstamp = buildstamp } + void set(BuildStampInfo other) { + set(other.buildstampprefix, other.revision, other.buildstamp) + } + String buildstampcommasep() { def String buildstampcommasep = buildstamp.replace(".", ",") return buildstampcommasep