From 8073420970773a084f2277544dd80114df854da9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Nov 2017 10:39:37 +0000 Subject: [PATCH 0001/1971] add README --- README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 From 744ee5f3d0d0fb0b9e873fba5c3e72105c962266 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Nov 2017 10:50:17 +0000 Subject: [PATCH 0002/1971] GIS-1621 - Add first jenkins groovy script --- ScriptTest/script_test_1.gsh | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 ScriptTest/script_test_1.gsh diff --git a/ScriptTest/script_test_1.gsh b/ScriptTest/script_test_1.gsh new file mode 100644 index 0000000..6b3e988 --- /dev/null +++ b/ScriptTest/script_test_1.gsh @@ -0,0 +1,75 @@ +pipeline { + // agent { label 'Pemba' } + // agent { label 'floreana' } + agent { label 'tiger' } + // agent any + + stages { + stage('Checkout') { + steps { + checkout([$class: 'GitSCM', + branches: [[name: 'refs/heads/master']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'RelativeTargetDirectory', + relativeTargetDir: 'arepo'], + [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false, timeout: 60], + [$class: 'CleanBeforeCheckout'], + [$class: 'CheckoutOption', timeout: 60]], + submoduleCfg: [], + userRemoteConfigs: [[url: 'git@hydra:danhawkins/testproject.git']]]) + script { + if (isUnix()) { + sh 'echo $WORKSPACE' + sh 'ls -lsR $WORKSPACE' + } + else { + bat 'echo %WORKSPACE%' + bat 'dir "%WORKSPACE%"' + } + } + } + } + stage('Build') { + steps { + script { + if (isUnix()) { + sh 'echo make $APARAMETER' + sh 'echo $WORKSPACE' + sh 'cat $WORKSPACE/arepo/README2.md' + } + else { + bat 'echo make "%APARAMETER%"' + bat 'echo %WORKSPACE%' + bat 'type "%WORKSPACE%\\arepo\\README2.md"' + } + } + } + } + stage('Test'){ + steps { + script { + if (isUnix()) { + sh 'echo make check' + sh 'echo do test' + } + else { + bat 'echo make check' + bat 'echo do test' + } + } + } + } + stage('Deploy') { + steps { + script { + if (isUnix()) { + sh 'echo make publish' + } + else { + bat 'echo make publish' + } + } + } + } + } +} From 8d0a7bbd170fef8f97021fa24b6ee7c307effa49 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Nov 2017 17:22:37 +0000 Subject: [PATCH 0003/1971] GIS-1621 - Now working --- ScriptTest/script_test_1.gsh | 75 ------------ build/build.gsh | 222 +++++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+), 75 deletions(-) delete mode 100644 ScriptTest/script_test_1.gsh create mode 100644 build/build.gsh diff --git a/ScriptTest/script_test_1.gsh b/ScriptTest/script_test_1.gsh deleted file mode 100644 index 6b3e988..0000000 --- a/ScriptTest/script_test_1.gsh +++ /dev/null @@ -1,75 +0,0 @@ -pipeline { - // agent { label 'Pemba' } - // agent { label 'floreana' } - agent { label 'tiger' } - // agent any - - stages { - stage('Checkout') { - steps { - checkout([$class: 'GitSCM', - branches: [[name: 'refs/heads/master']], - doGenerateSubmoduleConfigurations: false, - extensions: [[$class: 'RelativeTargetDirectory', - relativeTargetDir: 'arepo'], - [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false, timeout: 60], - [$class: 'CleanBeforeCheckout'], - [$class: 'CheckoutOption', timeout: 60]], - submoduleCfg: [], - userRemoteConfigs: [[url: 'git@hydra:danhawkins/testproject.git']]]) - script { - if (isUnix()) { - sh 'echo $WORKSPACE' - sh 'ls -lsR $WORKSPACE' - } - else { - bat 'echo %WORKSPACE%' - bat 'dir "%WORKSPACE%"' - } - } - } - } - stage('Build') { - steps { - script { - if (isUnix()) { - sh 'echo make $APARAMETER' - sh 'echo $WORKSPACE' - sh 'cat $WORKSPACE/arepo/README2.md' - } - else { - bat 'echo make "%APARAMETER%"' - bat 'echo %WORKSPACE%' - bat 'type "%WORKSPACE%\\arepo\\README2.md"' - } - } - } - } - stage('Test'){ - steps { - script { - if (isUnix()) { - sh 'echo make check' - sh 'echo do test' - } - else { - bat 'echo make check' - bat 'echo do test' - } - } - } - } - stage('Deploy') { - steps { - script { - if (isUnix()) { - sh 'echo make publish' - } - else { - bat 'echo make publish' - } - } - } - } - } -} diff --git a/build/build.gsh b/build/build.gsh new file mode 100644 index 0000000..500f20b --- /dev/null +++ b/build/build.gsh @@ -0,0 +1,222 @@ +pipeline { + // agent { label 'Pemba' } + // agent { label 'floreana' } + agent { label 'build' } + // agent any + stages { + stage('Checkout source') { + steps { + checkout([$class: 'GitSCM', + branches: [ + [name: 'origin/${BRANCH_NAME}'] + ], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'CleanBeforeCheckout'], + [$class: 'CloneOption', depth: 0, noTags: false, reference: '${REPO_ROOT}/newsw', shallow: false, timeout: 60], + [$class: 'CheckoutOption', timeout: 60], + [$class: 'RelativeTargetDirectory', relativeTargetDir: 'GitRepository'], + [$class: 'PathRestriction', excludedRegions: '', includedRegions: '''src/.* autobuild/.*'''] + ], + submoduleCfg: [ + ], + userRemoteConfigs: [ + [url: 'git@hydra:gis/newsw.git'] + ] + ]) + } + } + stage('Checkout dependencies') { + steps { + checkout([$class: 'GitSCM', + branches: [ + [name: 'refs/tags/${FD1200_FIRMWARE_RELEASE_VERSION}'] + ], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'CleanBeforeCheckout'], + [$class: 'CloneOption', depth: 0, noTags: false, reference: '${REPO_ROOT}/samba_fw_releases', shallow: true, timeout: 60], + [$class: 'CheckoutOption', timeout: 60], + [$class: 'RelativeTargetDirectory', relativeTargetDir: 'samba_fw'] + ], + submoduleCfg: [ + ], + userRemoteConfigs: [ + [url: 'git@hydra:gis/samba_fw_releases.git'] + ] + ]) + checkout([$class: 'GitSCM', + branches: [ + [name: 'refs/tags/${XR_1003_EMBEDDED_LOGIC_RELEASE_VERSION}'] + ], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'CleanBeforeCheckout'], + [$class: 'CloneOption', depth: 0, noTags: false, reference: '${REPO_ROOT}/HMB_XR_1003_Embeddded_Logic.git', shallow: true, timeout: 60], + [$class: 'CheckoutOption', timeout: 60], + [$class: 'RelativeTargetDirectory', relativeTargetDir: 'xr1003_el'] + ], + submoduleCfg: [ + ], + userRemoteConfigs: [ + [url: 'git@hydra:releases/HMB_XR_1003_Embeddded_Logic.git'] + ] + ]) + checkout([$class: 'GitSCM', + branches: [ + [name: 'refs/tags/${VERSION_STAMPING_VERSION}'] + ], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'CleanBeforeCheckout'], + [$class: 'CloneOption', noTags: false, reference: '${REPO_ROOT}\\ver_stamping_releases', shallow: true, timeout: 60], + [$class: 'CheckoutOption', timeout: 60], + [$class: 'RelativeTargetDirectory', relativeTargetDir: 'ver_stamping'] + ], + submoduleCfg: [], + userRemoteConfigs: [ + [url: 'git@hydra:releases/ver_stamping_releases.git'] + ] + ]) + checkout([$class: 'GitSCM', + branches: [ + [name: 'origin/master'] + ], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'CleanBeforeCheckout'], + [$class: 'CloneOption', noTags: false, reference: '${REPO_ROOT}\\print_release_difference', shallow: true, timeout: 60], + [$class: 'CheckoutOption', timeout: 60], + [$class: 'RelativeTargetDirectory', relativeTargetDir: 'print_release_difference'] + ], + submoduleCfg: [ + ], + userRemoteConfigs: [ + [url: 'git@hydra:gis/print_release_difference.git'] + ] + ]) + + } + } + stage('Setup links') { + steps { + bat ''' + @echo on' + rmdir jobscripts + mklink /J jobscripts GitRepository\\autobuild\\build + rmdir jobscripts_common + mklink /J jobscripts_common "GitRepository\\autobuild\\common" + rmdir security + mklink /J security "GitRepository\\autobuild\\security" + rmdir src + mklink /J src GitRepository\\src + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Imports and exports') { + steps { + bat ''' + call jobscripts\\reset_imports_and_exports.bat + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Clean') { + steps { + bat ''' + call jobscripts\\clean.bat + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Generating version number') { + steps { + bat ''' + call jobscripts\\versioning.bat + if errorlevel 1 exit /b 1 + ''' + script { + env.BUILD_STAMP = readFile('version/buildstamp.txt').trim() + env.SRC_REVISION = readFile('version/revision.txt').trim() + } + } + } + stage('Generating version differences lists') { + steps { + bat ''' + set CURRENT_RELEASE=origin/%BRANCH_NAME% + set PREVIOUS_RELEASE=%PREVIOUS_RELEASE_BRANCH_NAME% + set WORKING_PATH=%WORKSPACE%/GitRepository + set DIFFERENCE_OPTIONS="opposite notcommon" + "%PYTHON34%" "%WORKSPACE%/print_release_difference/show_release_differences.py" > "%WORKSPACE%\\version\\differences.txt" + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Inherit version imports') { + steps { + bat ''' + call jobscripts\\version_imports.bat + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Version stamp files') { + steps { + bat ''' + call jobscripts\\versionrcfiles.bat + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Compile') { + steps { + bat ''' + call jobscripts\\autobuild.bat + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Make SDK source') { + steps { + bat ''' + call jobscripts\\make_src_sdk.bat + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Build SDK source') { + steps { + bat ''' + call jobscripts\\build_sdk.bat + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Prepare exports') { + steps { + bat ''' + call jobscripts\\export.bat + if errorlevel 1 exit /b 1 + ''' + } + } + stage('Scan for warnings') { + steps { + warnings canComputeNew: false, canResolveRelativePaths: false, categoriesPattern: '', consoleParsers: [[parserName: 'MSBuild']], defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', unHealthy: '' + } + } + stage('Archiving artifacts') { + steps { + archiveArtifacts 'bin/**,scripts/**,version/**,pipeline/**,sdk_source/**,sdk_source_tree_built.txt,ildasm/**' + } + } + } + post { + success { + echo 'Succeeded build' + } + } +} + From 43beb78946205895782c057a1fb3ca7cb02d05a1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Nov 2017 17:42:40 +0000 Subject: [PATCH 0004/1971] GIS-1621 - Try to parse output --- build/build.gsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/build.gsh b/build/build.gsh index 500f20b..ffc9773 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -217,6 +217,9 @@ pipeline { success { echo 'Succeeded build' } + always { + step([$class: 'LogParserPublisher', parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', useProjectRule: true]) + } } } From 9814e14fb56a609bccaeaa3ee7e4b078153af419 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 12 Nov 2017 09:54:04 +0000 Subject: [PATCH 0005/1971] GIS-1621 - Try to parse output --- build/build.gsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build/build.gsh b/build/build.gsh index ffc9773..8e49430 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -214,12 +214,13 @@ pipeline { } } post { - success { + always { + echo 'Post-build' + //step([$class: 'LogParserPublisher', parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', useProjectRule: true]) + } + success { echo 'Succeeded build' } - always { - step([$class: 'LogParserPublisher', parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', useProjectRule: true]) - } - } + } } From 4b7d20c01db5e2d5af7607d5cf7535c34e30a0bd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 12 Nov 2017 10:17:37 +0000 Subject: [PATCH 0006/1971] GIS-1621 - Try to parse output --- build/build.gsh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build/build.gsh b/build/build.gsh index 8e49430..499af4c 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -218,8 +218,19 @@ pipeline { echo 'Post-build' //step([$class: 'LogParserPublisher', parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', useProjectRule: true]) } - success { - echo 'Succeeded build' + success { + echo 'Succeeded build' + build job: '2.0.x_test', + parameters: [ + string(name: 'TEST_PORT', value: '2016'), + booleanParam(name: 'PIPELINE_NO_TEST', value: false), + booleanParam(name: 'USING_GIT', value: true), + string(name: 'REPEAT_COUNT', value: '0'), + booleanParam(name: 'QUICK_TEST', value: true), + booleanParam(name: 'LIST_TESTS', value: false), + string(name: 'BRANCH', value: 'master') + ], + propagate: false } } } From e84879a84501c56ed7c3e8acbfc5ad0efb5af4e3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 12 Nov 2017 15:09:03 +0000 Subject: [PATCH 0007/1971] GIS-1621 - Try to parse output --- build/build.gsh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/build/build.gsh b/build/build.gsh index 499af4c..3781d3c 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -204,7 +204,18 @@ pipeline { } stage('Scan for warnings') { steps { - warnings canComputeNew: false, canResolveRelativePaths: false, categoriesPattern: '', consoleParsers: [[parserName: 'MSBuild']], defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', unHealthy: '' + warnings canComputeNew: false, + canResolveRelativePaths: false, + categoriesPattern: '', + consoleParsers: [ + [parserName: 'MSBuild'] + ], + defaultEncoding: '', + excludePattern: '', + healthy: '', + includePattern: '', + messagesPattern: '', + unHealthy: '' } } stage('Archiving artifacts') { @@ -216,11 +227,13 @@ pipeline { post { always { echo 'Post-build' - //step([$class: 'LogParserPublisher', parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', useProjectRule: true]) + } + failure { + step([$class: 'LogParserPublisher', parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', useProjectRule: true]) } success { echo 'Succeeded build' - build job: '2.0.x_test', + build job: '${BRANCH_NAME}_test', parameters: [ string(name: 'TEST_PORT', value: '2016'), booleanParam(name: 'PIPELINE_NO_TEST', value: false), From 60127bfce18e7379930e07fa686996b77c8c1a76 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 12 Nov 2017 15:10:54 +0000 Subject: [PATCH 0008/1971] GIS-1621 - Try to parse output --- build/build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.gsh b/build/build.gsh index 3781d3c..8065b13 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -243,7 +243,7 @@ pipeline { booleanParam(name: 'LIST_TESTS', value: false), string(name: 'BRANCH', value: 'master') ], - propagate: false + propagate: true } } } From dafdaa9a08e43a9d5368fbd13faa22f4ff32c987 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 12 Nov 2017 15:44:17 +0000 Subject: [PATCH 0009/1971] GIS-1621 - Expand variables properly; Format script --- build/build.gsh | 99 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 23 deletions(-) diff --git a/build/build.gsh b/build/build.gsh index 8065b13..922899c 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -8,15 +8,28 @@ pipeline { steps { checkout([$class: 'GitSCM', branches: [ - [name: 'origin/${BRANCH_NAME}'] + [name: "origin/${BRANCH_NAME}"] ], doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', depth: 0, noTags: false, reference: '${REPO_ROOT}/newsw', shallow: false, timeout: 60], - [$class: 'CheckoutOption', timeout: 60], - [$class: 'RelativeTargetDirectory', relativeTargetDir: 'GitRepository'], - [$class: 'PathRestriction', excludedRegions: '', includedRegions: '''src/.* autobuild/.*'''] + [$class: 'CloneOption', + depth: 0, + noTags: false, + reference: "${REPO_ROOT}/newsw", + shallow: false, + timeout: 60 + ], + [$class: 'CheckoutOption', + timeout: 60 + ], + [$class: 'RelativeTargetDirectory', + relativeTargetDir: 'GitRepository' + ], + [$class: 'PathRestriction', + excludedRegions: '', + includedRegions: '''src/.* autobuild/.*''' + ] ], submoduleCfg: [ ], @@ -30,14 +43,24 @@ pipeline { steps { checkout([$class: 'GitSCM', branches: [ - [name: 'refs/tags/${FD1200_FIRMWARE_RELEASE_VERSION}'] + [name: "refs/tags/${FD1200_FIRMWARE_RELEASE_VERSION}"] ], doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', depth: 0, noTags: false, reference: '${REPO_ROOT}/samba_fw_releases', shallow: true, timeout: 60], - [$class: 'CheckoutOption', timeout: 60], - [$class: 'RelativeTargetDirectory', relativeTargetDir: 'samba_fw'] + [$class: 'CloneOption', + depth: 0, + noTags: false, + reference: "${REPO_ROOT}/samba_fw_releases", + shallow: true, + timeout: 60 + ], + [$class: 'CheckoutOption', + timeout: 60 + ], + [$class: 'RelativeTargetDirectory', + relativeTargetDir: 'samba_fw' + ] ], submoduleCfg: [ ], @@ -47,14 +70,24 @@ pipeline { ]) checkout([$class: 'GitSCM', branches: [ - [name: 'refs/tags/${XR_1003_EMBEDDED_LOGIC_RELEASE_VERSION}'] + [name: "refs/tags/${XR_1003_EMBEDDED_LOGIC_RELEASE_VERSION}"] ], doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', depth: 0, noTags: false, reference: '${REPO_ROOT}/HMB_XR_1003_Embeddded_Logic.git', shallow: true, timeout: 60], - [$class: 'CheckoutOption', timeout: 60], - [$class: 'RelativeTargetDirectory', relativeTargetDir: 'xr1003_el'] + [$class: 'CloneOption', + depth: 0, + noTags: false, + reference: "${REPO_ROOT}/HMB_XR_1003_Embeddded_Logic.git", + shallow: true, + timeout: 60 + ], + [$class: 'CheckoutOption', + timeout: 60 + ], + [$class: 'RelativeTargetDirectory', + relativeTargetDir: 'xr1003_el' + ] ], submoduleCfg: [ ], @@ -64,14 +97,23 @@ pipeline { ]) checkout([$class: 'GitSCM', branches: [ - [name: 'refs/tags/${VERSION_STAMPING_VERSION}'] + [name: "refs/tags/${VERSION_STAMPING_VERSION}"] ], doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', noTags: false, reference: '${REPO_ROOT}\\ver_stamping_releases', shallow: true, timeout: 60], - [$class: 'CheckoutOption', timeout: 60], - [$class: 'RelativeTargetDirectory', relativeTargetDir: 'ver_stamping'] + [$class: 'CloneOption', + noTags: false, + reference: "${REPO_ROOT}/ver_stamping_releases", + shallow: true, + timeout: 60 + ], + [$class: 'CheckoutOption', + timeout: 60 + ], + [$class: 'RelativeTargetDirectory', + relativeTargetDir: 'ver_stamping' + ] ], submoduleCfg: [], userRemoteConfigs: [ @@ -85,9 +127,18 @@ pipeline { doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', noTags: false, reference: '${REPO_ROOT}\\print_release_difference', shallow: true, timeout: 60], - [$class: 'CheckoutOption', timeout: 60], - [$class: 'RelativeTargetDirectory', relativeTargetDir: 'print_release_difference'] + [$class: 'CloneOption', + noTags: false, + reference: "${REPO_ROOT}/print_release_difference", + shallow: true, + timeout: 60 + ], + [$class: 'CheckoutOption', + timeout: 60 + ], + [$class: 'RelativeTargetDirectory', + relativeTargetDir: 'print_release_difference' + ] ], submoduleCfg: [ ], @@ -229,11 +280,14 @@ pipeline { echo 'Post-build' } failure { - step([$class: 'LogParserPublisher', parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', useProjectRule: true]) + step([$class: 'LogParserPublisher', + parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', + useProjectRule: true + ]) } success { echo 'Succeeded build' - build job: '${BRANCH_NAME}_test', + build job: "${BRANCH_NAME}_test", parameters: [ string(name: 'TEST_PORT', value: '2016'), booleanParam(name: 'PIPELINE_NO_TEST', value: false), @@ -247,4 +301,3 @@ pipeline { } } } - From b86e13a3690e13d90d451a683d1ed8ef5ca42d8d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 12 Nov 2017 16:06:51 +0000 Subject: [PATCH 0010/1971] GIS-1621 - Don't trigger subsequent builds; Let them trigger of this build --- build/build.gsh | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/build/build.gsh b/build/build.gsh index 922899c..e284106 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -280,6 +280,7 @@ pipeline { echo 'Post-build' } failure { + echo 'Failed build' step([$class: 'LogParserPublisher', parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', useProjectRule: true @@ -287,17 +288,6 @@ pipeline { } success { echo 'Succeeded build' - build job: "${BRANCH_NAME}_test", - parameters: [ - string(name: 'TEST_PORT', value: '2016'), - booleanParam(name: 'PIPELINE_NO_TEST', value: false), - booleanParam(name: 'USING_GIT', value: true), - string(name: 'REPEAT_COUNT', value: '0'), - booleanParam(name: 'QUICK_TEST', value: true), - booleanParam(name: 'LIST_TESTS', value: false), - string(name: 'BRANCH', value: 'master') - ], - propagate: true } } } From 8f30453ca6903922f740b404039a1632c59eb8e4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 11:42:56 +0000 Subject: [PATCH 0011/1971] add README --- README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 From c62d2d3096fe786680a89f3f0d92b0689bb48515 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 16:51:58 +0000 Subject: [PATCH 0012/1971] Put a newline in the git included regions filter --- build/build.gsh | 141 ++++++++++++++++++++++++------------------------ 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/build/build.gsh b/build/build.gsh index e284106..a398a96 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -14,22 +14,23 @@ pipeline { extensions: [ [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', - depth: 0, - noTags: false, - reference: "${REPO_ROOT}/newsw", - shallow: false, - timeout: 60 - ], + depth: 0, + noTags: false, + reference: "${REPO_ROOT}/newsw", + shallow: false, + timeout: 60 + ], [$class: 'CheckoutOption', - timeout: 60 - ], + timeout: 60 + ], [$class: 'RelativeTargetDirectory', - relativeTargetDir: 'GitRepository' - ], + relativeTargetDir: 'GitRepository' + ], [$class: 'PathRestriction', - excludedRegions: '', - includedRegions: '''src/.* autobuild/.*''' - ] + excludedRegions: '', + includedRegions: '''src/.* + autobuild/.*''' + ] ], submoduleCfg: [ ], @@ -49,18 +50,18 @@ pipeline { extensions: [ [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', - depth: 0, - noTags: false, - reference: "${REPO_ROOT}/samba_fw_releases", - shallow: true, - timeout: 60 - ], + depth: 0, + noTags: false, + reference: "${REPO_ROOT}/samba_fw_releases", + shallow: true, + timeout: 60 + ], [$class: 'CheckoutOption', - timeout: 60 - ], + timeout: 60 + ], [$class: 'RelativeTargetDirectory', - relativeTargetDir: 'samba_fw' - ] + relativeTargetDir: 'samba_fw' + ] ], submoduleCfg: [ ], @@ -76,18 +77,18 @@ pipeline { extensions: [ [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', - depth: 0, - noTags: false, - reference: "${REPO_ROOT}/HMB_XR_1003_Embeddded_Logic.git", - shallow: true, - timeout: 60 - ], + depth: 0, + noTags: false, + reference: "${REPO_ROOT}/HMB_XR_1003_Embeddded_Logic.git", + shallow: true, + timeout: 60 + ], [$class: 'CheckoutOption', - timeout: 60 - ], + timeout: 60 + ], [$class: 'RelativeTargetDirectory', - relativeTargetDir: 'xr1003_el' - ] + relativeTargetDir: 'xr1003_el' + ] ], submoduleCfg: [ ], @@ -103,17 +104,17 @@ pipeline { extensions: [ [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', - noTags: false, - reference: "${REPO_ROOT}/ver_stamping_releases", - shallow: true, - timeout: 60 - ], + noTags: false, + reference: "${REPO_ROOT}/ver_stamping_releases", + shallow: true, + timeout: 60 + ], [$class: 'CheckoutOption', - timeout: 60 - ], + timeout: 60 + ], [$class: 'RelativeTargetDirectory', - relativeTargetDir: 'ver_stamping' - ] + relativeTargetDir: 'ver_stamping' + ] ], submoduleCfg: [], userRemoteConfigs: [ @@ -128,17 +129,17 @@ pipeline { extensions: [ [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', - noTags: false, - reference: "${REPO_ROOT}/print_release_difference", - shallow: true, - timeout: 60 - ], + noTags: false, + reference: "${REPO_ROOT}/print_release_difference", + shallow: true, + timeout: 60 + ], [$class: 'CheckoutOption', - timeout: 60 - ], + timeout: 60 + ], [$class: 'RelativeTargetDirectory', - relativeTargetDir: 'print_release_difference' - ] + relativeTargetDir: 'print_release_difference' + ] ], submoduleCfg: [ ], @@ -256,17 +257,17 @@ pipeline { stage('Scan for warnings') { steps { warnings canComputeNew: false, - canResolveRelativePaths: false, - categoriesPattern: '', - consoleParsers: [ - [parserName: 'MSBuild'] - ], - defaultEncoding: '', - excludePattern: '', - healthy: '', - includePattern: '', - messagesPattern: '', - unHealthy: '' + canResolveRelativePaths: false, + categoriesPattern: '', + consoleParsers: [ + [parserName: 'MSBuild'] + ], + defaultEncoding: '', + excludePattern: '', + healthy: '', + includePattern: '', + messagesPattern: '', + unHealthy: '' } } stage('Archiving artifacts') { @@ -276,16 +277,16 @@ pipeline { } } post { - always { + always { echo 'Post-build' - } - failure { + } + failure { echo 'Failed build' - step([$class: 'LogParserPublisher', - parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', - useProjectRule: true - ]) - } + step([$class: 'LogParserPublisher', + parsingRulesPath: 'GitRepository/autobuild/build/log parsing rules/vs.txt', + useProjectRule: true + ]) + } success { echo 'Succeeded build' } From 3f2f2851681b8aa77c4cac08e1dd5593ec6e4ab7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 17:04:43 +0000 Subject: [PATCH 0013/1971] Directory filtering doesn't seem to be working - resulting in no build triggers - so removing it --- build/build.gsh | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/build/build.gsh b/build/build.gsh index a398a96..1051f40 100644 --- a/build/build.gsh +++ b/build/build.gsh @@ -14,23 +14,18 @@ pipeline { extensions: [ [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', - depth: 0, - noTags: false, - reference: "${REPO_ROOT}/newsw", - shallow: false, - timeout: 60 - ], + depth: 0, + noTags: false, + reference: "${REPO_ROOT}/newsw", + shallow: false, + timeout: 60 + ], [$class: 'CheckoutOption', - timeout: 60 - ], + timeout: 60 + ], [$class: 'RelativeTargetDirectory', - relativeTargetDir: 'GitRepository' - ], - [$class: 'PathRestriction', - excludedRegions: '', - includedRegions: '''src/.* - autobuild/.*''' - ] + relativeTargetDir: 'GitRepository' + ], ], submoduleCfg: [ ], From 20dd451bc8bc4f36957147469141f0c50d5fb7ed Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 20:59:01 +0000 Subject: [PATCH 0014/1971] Add a second test file --- README2.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README2.md diff --git a/README2.md b/README2.md new file mode 100644 index 0000000..e69de29 From f671337ae8d333c94ee648d85d53ab91e64be610 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 21:00:04 +0000 Subject: [PATCH 0015/1971] Merge commit '20dd451bc8bc4f36957147469141f0c50d5fb7ed' --- README2.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README2.md diff --git a/README2.md b/README2.md new file mode 100644 index 0000000..e69de29 From 18be423194cddea3e9f72ae71dccca2d817f316e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 21:35:34 +0000 Subject: [PATCH 0016/1971] Add a test groovy script --- test.gsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 test.gsh diff --git a/test.gsh b/test.gsh new file mode 100644 index 0000000..a38bfaf --- /dev/null +++ b/test.gsh @@ -0,0 +1,6 @@ +// Methods in this file will end up as object methods on the object that load returns. +def lookAtThis(String whoAreYou) { + echo "Look at this, ${whoAreYou}! You loaded this from another file!" +} + +return this; From a9b77d0d121b0c27ea7e50458b040df820c15fd0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 21:35:34 +0000 Subject: [PATCH 0017/1971] Add a test groovy script --- test.gsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 test.gsh diff --git a/test.gsh b/test.gsh new file mode 100644 index 0000000..a38bfaf --- /dev/null +++ b/test.gsh @@ -0,0 +1,6 @@ +// Methods in this file will end up as object methods on the object that load returns. +def lookAtThis(String whoAreYou) { + echo "Look at this, ${whoAreYou}! You loaded this from another file!" +} + +return this; From 51b4b03be8bc3eb71be393c527a34e7819766023 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 21:57:56 +0000 Subject: [PATCH 0018/1971] Add a test groovy script --- test.gsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test.gsh diff --git a/test.gsh b/test.gsh new file mode 100644 index 0000000..23fcfc0 --- /dev/null +++ b/test.gsh @@ -0,0 +1,7 @@ +// Methods in this file will end up as object methods on the object that load returns. +def lookAtThis(String whoAreYou) { + echo "Look at this, ${whoAreYou}! You loaded this from another file!" +} + +return this; + From 61a6840f7c6de1def6be97283bd131c934af4a8b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 23:58:55 +0000 Subject: [PATCH 0019/1971] Start of versioning script --- versionnumbering/versioninfo.gsh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 versionnumbering/versioninfo.gsh diff --git a/versionnumbering/versioninfo.gsh b/versionnumbering/versioninfo.gsh new file mode 100644 index 0000000..579b976 --- /dev/null +++ b/versionnumbering/versioninfo.gsh @@ -0,0 +1,29 @@ +// Methods in this file will end up as object methods on the object that load returns. + +def makeVersionFolder(String versionFolder) { + dir("${versionFolder}") { + + + + + + + +def generateVersionFiles(String versionFolder, + Integer BaseGitNumber, + String SrcFolder, + String SrcBranch) { + echo """Building version folder at: ${versionFolder} + base git number: ${BaseGitNumber} + source folder: ${SrcFolder} + source branch: ${SrcBranch}""" + + dir + + + +def lookAtThis(String whoAreYou) { + echo "Look at this, ${whoAreYou}! You loaded this from another file!" +} + +return this; From 76339b9b91f4bc895e05dd134f5234c389456a4f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 28 Nov 2017 23:58:55 +0000 Subject: [PATCH 0020/1971] Start of versioning script --- versionnumbering/versioninfo.gsh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 versionnumbering/versioninfo.gsh diff --git a/versionnumbering/versioninfo.gsh b/versionnumbering/versioninfo.gsh new file mode 100644 index 0000000..579b976 --- /dev/null +++ b/versionnumbering/versioninfo.gsh @@ -0,0 +1,29 @@ +// Methods in this file will end up as object methods on the object that load returns. + +def makeVersionFolder(String versionFolder) { + dir("${versionFolder}") { + + + + + + + +def generateVersionFiles(String versionFolder, + Integer BaseGitNumber, + String SrcFolder, + String SrcBranch) { + echo """Building version folder at: ${versionFolder} + base git number: ${BaseGitNumber} + source folder: ${SrcFolder} + source branch: ${SrcBranch}""" + + dir + + + +def lookAtThis(String whoAreYou) { + echo "Look at this, ${whoAreYou}! You loaded this from another file!" +} + +return this; From 9f307dd502323554587e129f7235eccfe2ea8970 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 30 Nov 2017 18:25:01 +0000 Subject: [PATCH 0021/1971] Add python script and eclipse project files for version numbering --- .project | 17 +++ .pydevproject | 8 ++ versionnumbering/versioninfo.py | 192 ++++++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 .project create mode 100644 .pydevproject create mode 100644 versionnumbering/versioninfo.py diff --git a/.project b/.project new file mode 100644 index 0000000..e329c3f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Common Build Scripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..d111c07 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python interpreter +python35 + diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py new file mode 100644 index 0000000..0567097 --- /dev/null +++ b/versionnumbering/versioninfo.py @@ -0,0 +1,192 @@ +# encoding: utf-8 +''' +versionnumbering -- shortdesc + +versionnumbering generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. +''' +import os +import sys +import shutil +import subprocess + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' + +def resetFolder(versionfolder): + print("Removing folders and contents of: {0}".format(versionfolder)) + try: + shutil.rmtree(versionfolder) + except FileNotFoundError: + pass + + print("Creating folder: {0}".format(versionfolder)) + os.makedirs(versionfolder) + +def getGitRevision(gitrootpath, basenumber): + cwd = os.getcwd() + + path = os.path.expanduser(gitrootpath) + print("Changing current working directory to: {0}".format(path)) + os.chdir(path) + + gitvar = "GIT_EXECUTABLE" + if gitvar in os.environ and os.environ[gitvar]: + gitexecutable = os.environ[gitvar] + else: + print("Expecting GIT_EXECUTABLE environment variable to have path to git. Defaulting to 'git'") + gitexecutable = "git" + + print("Determining revision info using git command: {0}".format(gitexecutable)) + completed = subprocess.run([gitexecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + changecount = completed.stdout.decode("utf-8").strip() + print("Change count: {0}".format(changecount)) + adjustedchangecount = int(changecount) + int(basenumber) + print("Adjusted change count: {0}".format(adjustedchangecount)) + + print("Determining current revision info using git command: {0}".format(gitexecutable)) + completed = subprocess.run([gitexecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + revision = completed.stdout.decode("utf-8").strip() + print("Revision: {0}".format(revision)) + + os.chdir(cwd) + print("Restored current working directory to: {0}".format(cwd)) + + return (adjustedchangecount, revision) + +def getVersionPrefix(sourcebranch): + print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) + + defaultversionprefix = "1.30000.0" + splits = sourcebranch.split('/') + if len(splits) < 1: + print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) + return defaultversionprefix + + sourcebranch = splits[-1] + + if sourcebranch.lower().endswith("master"): # Special case + return "1.20000.0." + + splits = sourcebranch.split('.') + versionprefix = "" + if len(splits) < 1: + print("This source branch name has no decimal points in its name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + splitnumbercount = 0 + for split in splits: + if split.isdigit(): + versionprefix += split + "." + splitnumbercount += 1 + else: + break + if splitnumbercount > 2: + break + if splitnumbercount == 0: + print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + elif splitnumbercount == 1: + versionprefix += "0.0." + elif splitnumbercount == 2: + versionprefix += "0." + + print("Determined version prefix to be: {0}".format(versionprefix)) + return versionprefix + +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, buildnumber, buildstamp): + with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: + f.write(buildjobname) + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: + f.write(buildnumber) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-s", "--sourcebranch", dest="sourcebranch", action="store", default="origin/master", help="source branch name to discover version number [default: %(default)s]") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") + parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") + parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + sourcebranch = args.sourcebranch + versionfolder = args.versionfolder + gitrootfolder = args.gitrootfolder + baseversionnumber = args.baseversionnumber + buildjobname = args.buildjobname + buildnumber = args.buildnumber + + print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) + print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) + + resetFolder(versionfolder) + + (gitrevisioncount, gitrevision) = getGitRevision(gitrootfolder, baseversionnumber) + + versionprefix = getVersionPrefix(sourcebranch) + + buildstamp = versionprefix + str(gitrevisioncount) + print("Build stamp is: {0}".format(buildstamp)) + + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, buildnumber, buildstamp) + + return 0 + except Exception as e: + print("Error while creating version info:", e.__repr__()) + return 1 + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) From a63889509d3e7ba0961051d2618bba51840deb8f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 30 Nov 2017 18:25:01 +0000 Subject: [PATCH 0022/1971] Add python script and eclipse project files for version numbering --- .project | 17 +++ .pydevproject | 8 ++ versionnumbering/versioninfo.py | 192 ++++++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 .project create mode 100644 .pydevproject create mode 100644 versionnumbering/versioninfo.py diff --git a/.project b/.project new file mode 100644 index 0000000..e329c3f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Common Build Scripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..d111c07 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python interpreter +python35 + diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py new file mode 100644 index 0000000..0567097 --- /dev/null +++ b/versionnumbering/versioninfo.py @@ -0,0 +1,192 @@ +# encoding: utf-8 +''' +versionnumbering -- shortdesc + +versionnumbering generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. +''' +import os +import sys +import shutil +import subprocess + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' + +def resetFolder(versionfolder): + print("Removing folders and contents of: {0}".format(versionfolder)) + try: + shutil.rmtree(versionfolder) + except FileNotFoundError: + pass + + print("Creating folder: {0}".format(versionfolder)) + os.makedirs(versionfolder) + +def getGitRevision(gitrootpath, basenumber): + cwd = os.getcwd() + + path = os.path.expanduser(gitrootpath) + print("Changing current working directory to: {0}".format(path)) + os.chdir(path) + + gitvar = "GIT_EXECUTABLE" + if gitvar in os.environ and os.environ[gitvar]: + gitexecutable = os.environ[gitvar] + else: + print("Expecting GIT_EXECUTABLE environment variable to have path to git. Defaulting to 'git'") + gitexecutable = "git" + + print("Determining revision info using git command: {0}".format(gitexecutable)) + completed = subprocess.run([gitexecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + changecount = completed.stdout.decode("utf-8").strip() + print("Change count: {0}".format(changecount)) + adjustedchangecount = int(changecount) + int(basenumber) + print("Adjusted change count: {0}".format(adjustedchangecount)) + + print("Determining current revision info using git command: {0}".format(gitexecutable)) + completed = subprocess.run([gitexecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + revision = completed.stdout.decode("utf-8").strip() + print("Revision: {0}".format(revision)) + + os.chdir(cwd) + print("Restored current working directory to: {0}".format(cwd)) + + return (adjustedchangecount, revision) + +def getVersionPrefix(sourcebranch): + print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) + + defaultversionprefix = "1.30000.0" + splits = sourcebranch.split('/') + if len(splits) < 1: + print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) + return defaultversionprefix + + sourcebranch = splits[-1] + + if sourcebranch.lower().endswith("master"): # Special case + return "1.20000.0." + + splits = sourcebranch.split('.') + versionprefix = "" + if len(splits) < 1: + print("This source branch name has no decimal points in its name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + splitnumbercount = 0 + for split in splits: + if split.isdigit(): + versionprefix += split + "." + splitnumbercount += 1 + else: + break + if splitnumbercount > 2: + break + if splitnumbercount == 0: + print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + elif splitnumbercount == 1: + versionprefix += "0.0." + elif splitnumbercount == 2: + versionprefix += "0." + + print("Determined version prefix to be: {0}".format(versionprefix)) + return versionprefix + +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, buildnumber, buildstamp): + with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: + f.write(buildjobname) + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: + f.write(buildnumber) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-s", "--sourcebranch", dest="sourcebranch", action="store", default="origin/master", help="source branch name to discover version number [default: %(default)s]") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") + parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") + parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + sourcebranch = args.sourcebranch + versionfolder = args.versionfolder + gitrootfolder = args.gitrootfolder + baseversionnumber = args.baseversionnumber + buildjobname = args.buildjobname + buildnumber = args.buildnumber + + print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) + print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) + + resetFolder(versionfolder) + + (gitrevisioncount, gitrevision) = getGitRevision(gitrootfolder, baseversionnumber) + + versionprefix = getVersionPrefix(sourcebranch) + + buildstamp = versionprefix + str(gitrevisioncount) + print("Build stamp is: {0}".format(buildstamp)) + + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, buildnumber, buildstamp) + + return 0 + except Exception as e: + print("Error while creating version info:", e.__repr__()) + return 1 + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) From 93caaec49afb99a61b6f324212cb24f557eb5c48 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 30 Nov 2017 18:39:49 +0000 Subject: [PATCH 0023/1971] Remove redundant file --- versionnumbering/versioninfo.gsh | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 versionnumbering/versioninfo.gsh diff --git a/versionnumbering/versioninfo.gsh b/versionnumbering/versioninfo.gsh deleted file mode 100644 index 579b976..0000000 --- a/versionnumbering/versioninfo.gsh +++ /dev/null @@ -1,29 +0,0 @@ -// Methods in this file will end up as object methods on the object that load returns. - -def makeVersionFolder(String versionFolder) { - dir("${versionFolder}") { - - - - - - - -def generateVersionFiles(String versionFolder, - Integer BaseGitNumber, - String SrcFolder, - String SrcBranch) { - echo """Building version folder at: ${versionFolder} - base git number: ${BaseGitNumber} - source folder: ${SrcFolder} - source branch: ${SrcBranch}""" - - dir - - - -def lookAtThis(String whoAreYou) { - echo "Look at this, ${whoAreYou}! You loaded this from another file!" -} - -return this; From 7a553a6f9e8c038fbe15120191b0969216e2aee4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 30 Nov 2017 18:39:49 +0000 Subject: [PATCH 0024/1971] Remove redundant file --- versionnumbering/versioninfo.gsh | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 versionnumbering/versioninfo.gsh diff --git a/versionnumbering/versioninfo.gsh b/versionnumbering/versioninfo.gsh deleted file mode 100644 index 579b976..0000000 --- a/versionnumbering/versioninfo.gsh +++ /dev/null @@ -1,29 +0,0 @@ -// Methods in this file will end up as object methods on the object that load returns. - -def makeVersionFolder(String versionFolder) { - dir("${versionFolder}") { - - - - - - - -def generateVersionFiles(String versionFolder, - Integer BaseGitNumber, - String SrcFolder, - String SrcBranch) { - echo """Building version folder at: ${versionFolder} - base git number: ${BaseGitNumber} - source folder: ${SrcFolder} - source branch: ${SrcBranch}""" - - dir - - - -def lookAtThis(String whoAreYou) { - echo "Look at this, ${whoAreYou}! You loaded this from another file!" -} - -return this; From d347fd921fc36354143f48b49434f89090d500ad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 1 Dec 2017 17:03:09 +0000 Subject: [PATCH 0025/1971] Output git remote info into version folder --- versionnumbering/versioninfo.py | 51 ++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 0567097..35e91cd 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -59,10 +59,16 @@ def getGitRevision(gitrootpath, basenumber): revision = completed.stdout.decode("utf-8").strip() print("Revision: {0}".format(revision)) + print("Determining remote info using git command: {0}".format(gitexecutable)) + completed = subprocess.run([gitexecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + remoteinfo = completed.stdout.decode("utf-8") + print("Remote info: {0}".format(remoteinfo)) + os.chdir(cwd) print("Restored current working directory to: {0}".format(cwd)) - return (adjustedchangecount, revision) + return (adjustedchangecount, revision, remoteinfo) def getVersionPrefix(sourcebranch): print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) @@ -104,7 +110,7 @@ def getVersionPrefix(sourcebranch): print("Determined version prefix to be: {0}".format(versionprefix)) return versionprefix -def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, buildnumber, buildstamp): +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, remoteinfo, buildnumber, buildstamp): with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: f.write(buildjobname) @@ -114,6 +120,9 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, b with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: f.write(gitrevision) + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: f.write(buildnumber) @@ -157,31 +166,33 @@ USAGE # Process arguments args = parser.parse_args() - sourcebranch = args.sourcebranch - versionfolder = args.versionfolder - gitrootfolder = args.gitrootfolder - baseversionnumber = args.baseversionnumber - buildjobname = args.buildjobname - buildnumber = args.buildnumber + try: + sourcebranch = args.sourcebranch + versionfolder = args.versionfolder + gitrootfolder = args.gitrootfolder + baseversionnumber = args.baseversionnumber + buildjobname = args.buildjobname + buildnumber = args.buildnumber - print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) - print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) + print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) + print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) - resetFolder(versionfolder) + resetFolder(versionfolder) - (gitrevisioncount, gitrevision) = getGitRevision(gitrootfolder, baseversionnumber) + (gitrevisioncount, gitrevision, remoteinfo) = getGitRevision(gitrootfolder, baseversionnumber) - versionprefix = getVersionPrefix(sourcebranch) + versionprefix = getVersionPrefix(sourcebranch) - buildstamp = versionprefix + str(gitrevisioncount) - print("Build stamp is: {0}".format(buildstamp)) + buildstamp = versionprefix + str(gitrevisioncount) + print("Build stamp is: {0}".format(buildstamp)) - writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, buildnumber, buildstamp) + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, remoteinfo, buildnumber, buildstamp) + + return 0 + except Exception as e: + print("Error while creating version info:", e.__repr__()) + return 1 - return 0 - except Exception as e: - print("Error while creating version info:", e.__repr__()) - return 1 except Exception as e: indent = len(program_name) * " " print(program_name + ": " + repr(e) + "\n") From d33f6828a4e6a95abcaf4884b0d14ea9b1fad018 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 2 Dec 2017 10:43:53 +0000 Subject: [PATCH 0026/1971] Add differences folder --- differences/.project | 17 +++ differences/.pydevproject | 8 ++ differences/show_release_differences.py | 151 ++++++++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 differences/.project create mode 100644 differences/.pydevproject create mode 100644 differences/show_release_differences.py diff --git a/differences/.project b/differences/.project new file mode 100644 index 0000000..75af0fc --- /dev/null +++ b/differences/.project @@ -0,0 +1,17 @@ + + + Release_difference + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/differences/.pydevproject b/differences/.pydevproject new file mode 100644 index 0000000..c3434da --- /dev/null +++ b/differences/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Default + diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py new file mode 100644 index 0000000..1d525b9 --- /dev/null +++ b/differences/show_release_differences.py @@ -0,0 +1,151 @@ +''' +Created on 2 Mar 2017 + +@author: Dan +''' +import subprocess +import os +import sys +import re + +GIT_EXECUTABLE = os.getenv("GIT_EXECUTABLE") +if GIT_EXECUTABLE == None: + print("Please define the GIT_EXECUTABLE environment variable to the git executable path") + sys.exit(1) + +WORKING_PATH = os.getenv("WORKING_PATH") +if WORKING_PATH == None: + print("Please define the WORKING_PATH environment variable to the git repository path to use") + sys.exit(1) + +CURRENT_RELEASE = os.getenv("CURRENT_RELEASE") +if CURRENT_RELEASE == None: + print("Please define the CURRENT_RELEASE version") + sys.exit(1) + +PREVIOUS_RELEASE = os.getenv("PREVIOUS_RELEASE") +if PREVIOUS_RELEASE == None: + print("Please define the PREVIOUS_RELEASE version") + sys.exit(1) + +DIFFERENCE_OPTIONS = os.getenv("DIFFERENCE_OPTIONS") +if DIFFERENCE_OPTIONS == None: + DIFFERENCE_OPTIONS = "" + +class GitException(Exception): + def __init__(self, message): + self.message = message + + def __repr__(self): + return self.message + +def printDivider(times = 1, length = 100): + for _ in range(times): + print("*" * length) + +TABSIZE = 4 +def printTabbed(string, tabs = 0): + print("{0}{1}".format(" " * (TABSIZE * tabs), string)) + +def getGitLogDifferences(workingPath, previousRelease, currentRelease, tripledot = False): + gitExecutable = GIT_EXECUTABLE + if tripledot: + releaseExpression = previousRelease + "..." + currentRelease + else: + releaseExpression = previousRelease + ".." + currentRelease + currentdir = os.getcwd() + os.chdir(workingPath) + gitlog = [] + printTabbed("Executing: {0} {1} {2} {3}".format(gitExecutable, "log", "--oneline", releaseExpression)) + proc = subprocess.Popen([gitExecutable, "log", "--oneline", releaseExpression], stdout=subprocess.PIPE) + while True: + line = proc.stdout.readline() + if line: + linestring = line.decode('utf-8').rstrip() + gitlog.append(linestring) + #printTabbed(linestring, 1) + else: + break + proc.wait() + if proc.returncode > 0: + raise GitException("Git executable returned an error") + os.chdir(currentdir) + return gitlog + +expectedpattern = re.compile("^.* +(?:[gG][iI][sS][ _-]*|[tT]rac \#*|\#\s*)(\d+):*(.*)$") +revertpattern = re.compile('^(\S*) Revert " *GIS-(\d+):* (.*)"$') +mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") + +def processLog(gitlog): + reverts = [] + merges = {} + other = [] + numbered = {} + for line in gitlog: + expectedmatch = expectedpattern.match(line) + revertmatch = revertpattern.match(line) + mergematch = mergepattern.match(line) + if expectedmatch == None and revertmatch == None and mergematch == None: + other.append(line) + if revertmatch: + gisnumber = "GIS-" + revertmatch.group(2) + description = revertmatch.group(3) + reverts.append("Revert: {0} {1}".format(gisnumber, description)) + if mergematch: + merge = mergematch.group(2) + if not merge in merges: + merges[merge] = 1 + else: + merges[merge] += 1 + if expectedmatch: + gisnumber = "GIS-" + expectedmatch.group(1) + description = expectedmatch.group(2) + if not gisnumber in numbered: + numbered[gisnumber] = [] + numbered[gisnumber].append(description) + return (reverts, merges, other, numbered) + +def showDifferences(differences): + (revertslog, mergeslog, otherlog, numberedlog) = differences + printDivider() + printTabbed("GIS-Numbers Log:") + for (gisnumber, descriptions) in sorted(numberedlog.items()): + printTabbed(gisnumber, 1) + descriptions = numberedlog[gisnumber]; + for description in descriptions: + printTabbed(description, 2) + printDivider() + printTabbed("Revert log:") + for reversion in sorted(revertslog): + printTabbed(reversion, 1) + printDivider() + printTabbed("Merges log:") + for merge in sorted(mergeslog): + printTabbed(merge, 1) + printDivider() + printTabbed("Other log:") + for other in sorted(otherlog): + printTabbed(other, 1) + +def main(): + workingPath = WORKING_PATH + previous = PREVIOUS_RELEASE + now = CURRENT_RELEASE + printDivider(times = 4) + printTabbed("Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(workingPath, previous, now)) + gitlog = getGitLogDifferences(workingPath, previous, now) + showDifferences(processLog(gitlog)) + if 'opposite' in DIFFERENCE_OPTIONS.lower(): + printDivider(times = 4) + printTabbed("Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(workingPath, now, previous)) + gitlog = getGitLogDifferences(workingPath, now, previous) + showDifferences(processLog(gitlog)) + if 'notcommon' in DIFFERENCE_OPTIONS.lower(): + printDivider(times = 4) + printTabbed("Looking for changes that are not common to {1} or {2} at path: {0}".format(workingPath, now, previous)) + gitlog = getGitLogDifferences(workingPath, now, previous, tripledot = True) + showDifferences(processLog(gitlog)) + sys.exit(0) + +if __name__ == '__main__': + main() \ No newline at end of file From e58acae19d89d804ca1bfc9b9426fe91d7f9f010 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 2 Dec 2017 21:46:11 +0000 Subject: [PATCH 0027/1971] Tested version of differences generation --- .settings/org.eclipse.core.resources.prefs | 2 + differences/show_release_differences.py | 207 ++++++++++++------- version/differences.txt | 230 +++++++++++++++++++++ versionnumbering/versioninfo.py | 21 +- 4 files changed, 375 insertions(+), 85 deletions(-) create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 version/differences.txt diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..1174a06 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//versionnumbering/versioninfo.py=utf-8 diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 1d525b9..a778892 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -1,36 +1,26 @@ ''' -Created on 2 Mar 2017 +showreleasedifferences -- shortdesc -@author: Dan +showreleasedifferences generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. ''' import subprocess import os import sys import re -GIT_EXECUTABLE = os.getenv("GIT_EXECUTABLE") -if GIT_EXECUTABLE == None: - print("Please define the GIT_EXECUTABLE environment variable to the git executable path") - sys.exit(1) +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter -WORKING_PATH = os.getenv("WORKING_PATH") -if WORKING_PATH == None: - print("Please define the WORKING_PATH environment variable to the git repository path to use") - sys.exit(1) +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' -CURRENT_RELEASE = os.getenv("CURRENT_RELEASE") -if CURRENT_RELEASE == None: - print("Please define the CURRENT_RELEASE version") - sys.exit(1) - -PREVIOUS_RELEASE = os.getenv("PREVIOUS_RELEASE") -if PREVIOUS_RELEASE == None: - print("Please define the PREVIOUS_RELEASE version") - sys.exit(1) - -DIFFERENCE_OPTIONS = os.getenv("DIFFERENCE_OPTIONS") -if DIFFERENCE_OPTIONS == None: - DIFFERENCE_OPTIONS = "" +gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") class GitException(Exception): def __init__(self, message): @@ -39,31 +29,34 @@ class GitException(Exception): def __repr__(self): return self.message -def printDivider(times = 1, length = 100): +def makeFolder(versionfolder): + print("Creating folder (if not already there): {0}".format(versionfolder)) + os.makedirs(versionfolder, exist_ok = True) + +def printDivider(outfh, times = 1, length = 100): for _ in range(times): - print("*" * length) + outfh.write("{0}\n".format("*" * length)) TABSIZE = 4 -def printTabbed(string, tabs = 0): - print("{0}{1}".format(" " * (TABSIZE * tabs), string)) +def printTabbed(outfh, string, tabs = 0): + outfh.write("{0}{1}\n".format(" " * (TABSIZE * tabs), string)) -def getGitLogDifferences(workingPath, previousRelease, currentRelease, tripledot = False): - gitExecutable = GIT_EXECUTABLE +def getGitLogDifferences(outfh, gitrootfolder, previousRelease, currentRelease, tripledot = False): if tripledot: releaseExpression = previousRelease + "..." + currentRelease else: releaseExpression = previousRelease + ".." + currentRelease currentdir = os.getcwd() - os.chdir(workingPath) + os.chdir(gitrootfolder) gitlog = [] - printTabbed("Executing: {0} {1} {2} {3}".format(gitExecutable, "log", "--oneline", releaseExpression)) + printTabbed(outfh, "Executing: {0} {1} {2} {3}".format(gitExecutable, "log", "--oneline", releaseExpression)) proc = subprocess.Popen([gitExecutable, "log", "--oneline", releaseExpression], stdout=subprocess.PIPE) while True: line = proc.stdout.readline() if line: linestring = line.decode('utf-8').rstrip() gitlog.append(linestring) - #printTabbed(linestring, 1) + #printTabbed(outfh, linestring, 1) else: break proc.wait() @@ -72,15 +65,23 @@ def getGitLogDifferences(workingPath, previousRelease, currentRelease, tripledot os.chdir(currentdir) return gitlog -expectedpattern = re.compile("^.* +(?:[gG][iI][sS][ _-]*|[tT]rac \#*|\#\s*)(\d+):*(.*)$") -revertpattern = re.compile('^(\S*) Revert " *GIS-(\d+):* (.*)"$') +jiraprojectpattern = { + 'GIS' : ( re.compile("^.* +(?:[gG][iI][sS][ _-]*|[tT]rac \#*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *GIS-(\d+):* (.*)"$'), + ), + 'IMB': ( re.compile("^.* +(?:[Ii][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *IMB-(\d+):* (.*)"$'), + ), + } + mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") -def processLog(gitlog): +def processLog(gitlog, jirakeyprefix): reverts = [] merges = {} other = [] numbered = {} + (expectedpattern, revertpattern) = jiraprojectpattern[jirakeyprefix] for line in gitlog: expectedmatch = expectedpattern.match(line) revertmatch = revertpattern.match(line) @@ -88,7 +89,7 @@ def processLog(gitlog): if expectedmatch == None and revertmatch == None and mergematch == None: other.append(line) if revertmatch: - gisnumber = "GIS-" + revertmatch.group(2) + gisnumber = jirakeyprefix + "-" + revertmatch.group(2) description = revertmatch.group(3) reverts.append("Revert: {0} {1}".format(gisnumber, description)) if mergematch: @@ -98,54 +99,116 @@ def processLog(gitlog): else: merges[merge] += 1 if expectedmatch: - gisnumber = "GIS-" + expectedmatch.group(1) + gisnumber = jirakeyprefix + "-" + expectedmatch.group(1) description = expectedmatch.group(2) if not gisnumber in numbered: numbered[gisnumber] = [] numbered[gisnumber].append(description) return (reverts, merges, other, numbered) -def showDifferences(differences): +def showDifferences(differences, jirakeyprefix, outfh): (revertslog, mergeslog, otherlog, numberedlog) = differences - printDivider() - printTabbed("GIS-Numbers Log:") + printDivider(outfh) + printTabbed(outfh, jirakeyprefix + "-Numbers Log:") for (gisnumber, descriptions) in sorted(numberedlog.items()): - printTabbed(gisnumber, 1) + printTabbed(outfh, gisnumber, 1) descriptions = numberedlog[gisnumber]; for description in descriptions: - printTabbed(description, 2) - printDivider() - printTabbed("Revert log:") + printTabbed(outfh, description, 2) + printDivider(outfh) + printTabbed(outfh, "Revert log:") for reversion in sorted(revertslog): - printTabbed(reversion, 1) - printDivider() - printTabbed("Merges log:") + printTabbed(outfh, reversion, 1) + printDivider(outfh) + printTabbed(outfh, "Merges log:") for merge in sorted(mergeslog): - printTabbed(merge, 1) - printDivider() - printTabbed("Other log:") + printTabbed(outfh, merge, 1) + printDivider(outfh) + printTabbed(outfh, "Other log:") for other in sorted(otherlog): - printTabbed(other, 1) + printTabbed(outfh, other, 1) -def main(): - workingPath = WORKING_PATH - previous = PREVIOUS_RELEASE - now = CURRENT_RELEASE - printDivider(times = 4) - printTabbed("Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(workingPath, previous, now)) - gitlog = getGitLogDifferences(workingPath, previous, now) - showDifferences(processLog(gitlog)) - if 'opposite' in DIFFERENCE_OPTIONS.lower(): - printDivider(times = 4) - printTabbed("Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(workingPath, now, previous)) - gitlog = getGitLogDifferences(workingPath, now, previous) - showDifferences(processLog(gitlog)) - if 'notcommon' in DIFFERENCE_OPTIONS.lower(): - printDivider(times = 4) - printTabbed("Looking for changes that are not common to {1} or {2} at path: {0}".format(workingPath, now, previous)) - gitlog = getGitLogDifferences(workingPath, now, previous, tripledot = True) - showDifferences(processLog(gitlog)) - sys.exit(0) +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' -if __name__ == '__main__': - main() \ No newline at end of file + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-s", "--sourceversion", dest="sourceversion", action="store", default="origin/master", help="source version branch or tag to discover compare against [default: %(default)s]") + parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") + parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") + parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="", help="version folder where differences file stored [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + try: + gitrootfolder = args.gitrootfolder + sourceversion = args.sourceversion + previousversion = args.previousversion + jirakeyprefix = args.jirakeyprefix + outputoptions = args.outputoptions + versionfolder = args.versionfolder + + print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", versionfolder) + + if versionfolder: + makeFolder(versionfolder) + outfh = open(os.path.join(versionfolder, "differences.txt"), 'w') + else: + outfh = sys.stdout + + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, previousversion, sourceversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, previousversion, sourceversion) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + if 'opposite' in outputoptions.lower(): + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, sourceversion, previousversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + if 'notcommon' in outputoptions.lower(): + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes that are not common to {1} or {2} at path: {0}".format(gitrootfolder, sourceversion, previousversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + + if versionfolder: + outfh.close() + return 0 + except Exception as e: + print("Error while determining differences:", e.__repr__()) + return 1 + + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/version/differences.txt b/version/differences.txt new file mode 100644 index 0000000..7ec3ad6 --- /dev/null +++ b/version/differences.txt @@ -0,0 +1,230 @@ +**************************************************************************************************** +**************************************************************************************************** +**************************************************************************************************** +**************************************************************************************************** +Looking for changes in origin/master that are not in origin/1.5.4 of the repository at path: /home/dan/home2/Development/inksystem +Executing: git log --oneline origin/1.5.4..origin/master +**************************************************************************************************** +IMB-Numbers Log: + IMB-11 + Further minor change to tooltip + Changed tooltip for PWN Frequency on ink pumps + Changed the Tooltips for PWM frequency and duty cycle + IMB-12 + Changed the order the events are generated in to prevent master from resetting slave + When a vent command is sent to a slave, it will demand a vent from its master + IMB-14 + Fixed state transition in Controlled Flow Master where it could get stuck in pre-flow + IMB-4 + - Add more logging + IMB-42 + Master sets the slaves to dormant when pre-idling + IMB-43 + Added purge abort for HP Type 2 + Fixed shared controlled flow transition for purge all slaves + Added Idle transitions from Purge + Added missing definition + Added explicit transitions for standby for all states for flowmode 1-3 + IMB-47 + - Tidied up checkStateR to be consistent with setValueR + - The thermistor will only generate an event if a threshold has been crossed, or when "timeToSendAnotherEvent" is true. + - The thermistor will only generate an event if a threshold has been crossed, or when "timeToSendAnotherEvent" is true. + IMB-50 + Temperature setpoint set when entering flow configuration to ensure correct heater operation + IMB-6 + Removed a white-space in the output + IMB-7 + Changed the formatting of the output + IMB-8 + When returning from a purge it now calls the same code as when going into idle, as they effectively were identical. + Added pre-flow to post-flow transitions and vice-versa + In gravity mode: removed the activation of the vacuum pump which speeds up ramps. This caused vent and pump to "fight" each other +**************************************************************************************************** +Revert log: +**************************************************************************************************** +Merges log: + Merge branch '1.10023.j6221-Type2_Pneumatic' of hydra:gis/inksystem into 1.10023.j6221-Type2_Pneumatic + Merge branch 'master' of hydra:gis/inksystem + Merge remote-tracking branch 'remotes/origin/1.10025.j6416-EthernetCongestion' into 1.10023.j6221-Type2_Pneumatic + Merge remote-tracking branch 'remotes/origin/1.5.2' into 1.10023.j6221-Type2_Pneumatic + Merge remote-tracking branch 'remotes/origin/1.5.5' + Merge remote-tracking branch 'remotes/origin/master' into 1.10023.j6221-Type2_Pneumatic +**************************************************************************************************** +Other log: + 095290c GIS-1621 - Make compilation work in case-sensitive linux + 0a8505d GIS-1621 - Remove test code + 0e8ccce GIS-6380 Removed ambiguous "absolute pressure" terminology + 149e0bf GIS 6221: Added logging for gravity mode + 169125b GIS-6221: Corrected Typo + 23c37d0 GIS 43: System will abort purge in a safe manner if standby command is issued + 37dd24b GIS 6479: Controlled flow master now goes through pre-flow. Fixed ordering in controlevent.c and .h + 41ac373 GIS-6253: Fixed bugs + 45cdfbe GIS 6591: Fixed if statement which outputs ITPD and OTPD + 468798e Update release notes whitespace + 4c2badc GIS-1621 - 16 bit integer is not printing correctly + 4c9a1aa GIS-6221 Vent the outlet bottle when purging to prevent "kick" on return from idle + 541c3bb GIS-6253: Added gravity flowmode + 5562461 GIS-6570 - Handle 0 length buffers being sent for TCP transmission; Add some logging for diagnosis + 577444e Update release notes for 1.5.5 + 5c6416b GIS-6416 - Instrument number of buffers on socket transmit queue and grapher empty buffer queue + 603de5a GIS-6221: Fixed more typos + 628b57d GIS 6221: Fixed typo + 6526df4 GIS-6221 Corrected behaviour at idle. When idling, the pressure is now only vacuum pump driven in one direction. + 6da6243 GIS-6221 Changed purge configuration, return from purge still to do + 7d263d0 GIS 6591: Change the output of the settings command on Telnet for clarity + 83f5517 Update 1.5.5 release notes with known issues + 85fc901 GIS-6570 - Handle condition when no bytes are consumed by sck_send (because the connection has died) for TCP transmission; Add some logging for diagnosis + 8a2db28 GIS-6221 Corrected behaviour at idle. When idling, the pressure is now only vacuum pump driven in one direction. + 8df4c1b GIS-1621 - Settings BSP files have changed unexpectedly from 1.5.4 - maybe causing a slow down + 92c135e GIS 6462 Fixed typo + 9400923 GIS-6516: Slave resets from vent when master is reset + 9964521 GIS 6253: Added methods for gravity mode logging in inkchannelinterface.cpp/h + a1f0025 GIS 43: Added PreIdle with slaves in controlled flow master + a900a24 GIS-6221: Changed Idle to be driven from Inlet Side + b2f4383 GIS-1620 - Correct string print + b42ea46 GIS-1621 - Handle version prefix + b498cd5 GIS 6462 Added on the fly idle pressure change in shared pressure controlled flow + b4e1b8c GIS 6221: Resolved merge conflicts and applied fixes from 1.5.3 to the Type 2 High Pressure mode + bbc5e45 GIS 6221 - Changed High Pressure Type 2 to flowmode 6 + bd69b60 GIS-6253: Fixed typos + c568789 GIS 6221 - Bug fixes High Pressure Type 2 Flow mode + c666970 GIS-6570 - Add some logging for diagnosis + c7bbf29 Fixed shared controlled flow transition for purge all slaves to standby + c962c65 GIS-6221 Added Purge Return via Idle + ca1e7b5 GIS-6253: Added the files for gravity flowmode + ca4473b GIS-1621 - Only send pressure updates if there is a 4 point difference in value + cb06440 GIS 6221: Changed descriptions of Flowmodes. Changed output of settings to show purge pressure for flowmode 5 and 6 + d4dd54d GIS 6462: Added on-the-fly pressure change for Shared Pressure Controlled Flow systems + da69186 GIS 6492: Dumpconfig now outputs the software version + df64abd Revert "GIS-1621 - Only send pressure updates if there is a 4 point difference in value" + e51971f GIS 6379: The purge pressure is only shown on High Pressure systems (flowmode 4 and 5) + e6b0227 GIS-6221 Corrected vent operation for outlet bottle + ec13b60 GIS-6416 - Handle multiple writes to a TCP stream until it becomes busy + f018a86 GIS 6479: Added an applysettings command to allow on the fly pressure and temperature changes + f7109ff GIS 43: Added purge to idle transitions for Gravity Mode + f87280b GIS 43: Fixed transition in cfm + f999765 GIS-6253: Removed redundant function + ff37df8 GIS-6253: Fixed typos + ff92b79 GIS 6591: Added statement on Master settings +**************************************************************************************************** +**************************************************************************************************** +**************************************************************************************************** +**************************************************************************************************** +Looking for changes in origin/1.5.4 that are not in origin/master of the repository at path: /home/dan/home2/Development/inksystem +Executing: git log --oneline origin/master..origin/1.5.4 +**************************************************************************************************** +IMB-Numbers Log: +**************************************************************************************************** +Revert log: +**************************************************************************************************** +Merges log: +**************************************************************************************************** +Other log: +**************************************************************************************************** +**************************************************************************************************** +**************************************************************************************************** +**************************************************************************************************** +Looking for changes that are not common to origin/master or origin/1.5.4 at path: /home/dan/home2/Development/inksystem +Executing: git log --oneline origin/master...origin/1.5.4 +**************************************************************************************************** +IMB-Numbers Log: + IMB-11 + Further minor change to tooltip + Changed tooltip for PWN Frequency on ink pumps + Changed the Tooltips for PWM frequency and duty cycle + IMB-12 + Changed the order the events are generated in to prevent master from resetting slave + When a vent command is sent to a slave, it will demand a vent from its master + IMB-14 + Fixed state transition in Controlled Flow Master where it could get stuck in pre-flow + IMB-4 + - Add more logging + IMB-42 + Master sets the slaves to dormant when pre-idling + IMB-43 + Added purge abort for HP Type 2 + Fixed shared controlled flow transition for purge all slaves + Added Idle transitions from Purge + Added missing definition + Added explicit transitions for standby for all states for flowmode 1-3 + IMB-47 + - Tidied up checkStateR to be consistent with setValueR + - The thermistor will only generate an event if a threshold has been crossed, or when "timeToSendAnotherEvent" is true. + - The thermistor will only generate an event if a threshold has been crossed, or when "timeToSendAnotherEvent" is true. + IMB-50 + Temperature setpoint set when entering flow configuration to ensure correct heater operation + IMB-6 + Removed a white-space in the output + IMB-7 + Changed the formatting of the output + IMB-8 + When returning from a purge it now calls the same code as when going into idle, as they effectively were identical. + Added pre-flow to post-flow transitions and vice-versa + In gravity mode: removed the activation of the vacuum pump which speeds up ramps. This caused vent and pump to "fight" each other +**************************************************************************************************** +Revert log: +**************************************************************************************************** +Merges log: + Merge branch '1.10023.j6221-Type2_Pneumatic' of hydra:gis/inksystem into 1.10023.j6221-Type2_Pneumatic + Merge branch 'master' of hydra:gis/inksystem + Merge remote-tracking branch 'remotes/origin/1.10025.j6416-EthernetCongestion' into 1.10023.j6221-Type2_Pneumatic + Merge remote-tracking branch 'remotes/origin/1.5.2' into 1.10023.j6221-Type2_Pneumatic + Merge remote-tracking branch 'remotes/origin/1.5.5' + Merge remote-tracking branch 'remotes/origin/master' into 1.10023.j6221-Type2_Pneumatic +**************************************************************************************************** +Other log: + 095290c GIS-1621 - Make compilation work in case-sensitive linux + 0a8505d GIS-1621 - Remove test code + 0e8ccce GIS-6380 Removed ambiguous "absolute pressure" terminology + 149e0bf GIS 6221: Added logging for gravity mode + 169125b GIS-6221: Corrected Typo + 23c37d0 GIS 43: System will abort purge in a safe manner if standby command is issued + 37dd24b GIS 6479: Controlled flow master now goes through pre-flow. Fixed ordering in controlevent.c and .h + 41ac373 GIS-6253: Fixed bugs + 45cdfbe GIS 6591: Fixed if statement which outputs ITPD and OTPD + 468798e Update release notes whitespace + 4c2badc GIS-1621 - 16 bit integer is not printing correctly + 4c9a1aa GIS-6221 Vent the outlet bottle when purging to prevent "kick" on return from idle + 541c3bb GIS-6253: Added gravity flowmode + 5562461 GIS-6570 - Handle 0 length buffers being sent for TCP transmission; Add some logging for diagnosis + 577444e Update release notes for 1.5.5 + 5c6416b GIS-6416 - Instrument number of buffers on socket transmit queue and grapher empty buffer queue + 603de5a GIS-6221: Fixed more typos + 628b57d GIS 6221: Fixed typo + 6526df4 GIS-6221 Corrected behaviour at idle. When idling, the pressure is now only vacuum pump driven in one direction. + 6da6243 GIS-6221 Changed purge configuration, return from purge still to do + 7d263d0 GIS 6591: Change the output of the settings command on Telnet for clarity + 83f5517 Update 1.5.5 release notes with known issues + 85fc901 GIS-6570 - Handle condition when no bytes are consumed by sck_send (because the connection has died) for TCP transmission; Add some logging for diagnosis + 8a2db28 GIS-6221 Corrected behaviour at idle. When idling, the pressure is now only vacuum pump driven in one direction. + 8df4c1b GIS-1621 - Settings BSP files have changed unexpectedly from 1.5.4 - maybe causing a slow down + 92c135e GIS 6462 Fixed typo + 9400923 GIS-6516: Slave resets from vent when master is reset + 9964521 GIS 6253: Added methods for gravity mode logging in inkchannelinterface.cpp/h + a1f0025 GIS 43: Added PreIdle with slaves in controlled flow master + a900a24 GIS-6221: Changed Idle to be driven from Inlet Side + b2f4383 GIS-1620 - Correct string print + b42ea46 GIS-1621 - Handle version prefix + b498cd5 GIS 6462 Added on the fly idle pressure change in shared pressure controlled flow + b4e1b8c GIS 6221: Resolved merge conflicts and applied fixes from 1.5.3 to the Type 2 High Pressure mode + bbc5e45 GIS 6221 - Changed High Pressure Type 2 to flowmode 6 + bd69b60 GIS-6253: Fixed typos + c568789 GIS 6221 - Bug fixes High Pressure Type 2 Flow mode + c666970 GIS-6570 - Add some logging for diagnosis + c7bbf29 Fixed shared controlled flow transition for purge all slaves to standby + c962c65 GIS-6221 Added Purge Return via Idle + ca1e7b5 GIS-6253: Added the files for gravity flowmode + ca4473b GIS-1621 - Only send pressure updates if there is a 4 point difference in value + cb06440 GIS 6221: Changed descriptions of Flowmodes. Changed output of settings to show purge pressure for flowmode 5 and 6 + d4dd54d GIS 6462: Added on-the-fly pressure change for Shared Pressure Controlled Flow systems + da69186 GIS 6492: Dumpconfig now outputs the software version + df64abd Revert "GIS-1621 - Only send pressure updates if there is a 4 point difference in value" + e51971f GIS 6379: The purge pressure is only shown on High Pressure systems (flowmode 4 and 5) + e6b0227 GIS-6221 Corrected vent operation for outlet bottle + ec13b60 GIS-6416 - Handle multiple writes to a TCP stream until it becomes busy + f018a86 GIS 6479: Added an applysettings command to allow on the fly pressure and temperature changes + f7109ff GIS 43: Added purge to idle transitions for Gravity Mode + f87280b GIS 43: Fixed transition in cfm + f999765 GIS-6253: Removed redundant function + ff37df8 GIS-6253: Fixed typos + ff92b79 GIS 6591: Added statement on Master settings diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 35e91cd..c8c79fe 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -21,6 +21,8 @@ __version__ = 0.1 __date__ = '2017-11-29' __updated__ = '2017-11-29' +gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") + def resetFolder(versionfolder): print("Removing folders and contents of: {0}".format(versionfolder)) try: @@ -38,29 +40,22 @@ def getGitRevision(gitrootpath, basenumber): print("Changing current working directory to: {0}".format(path)) os.chdir(path) - gitvar = "GIT_EXECUTABLE" - if gitvar in os.environ and os.environ[gitvar]: - gitexecutable = os.environ[gitvar] - else: - print("Expecting GIT_EXECUTABLE environment variable to have path to git. Defaulting to 'git'") - gitexecutable = "git" - - print("Determining revision info using git command: {0}".format(gitexecutable)) - completed = subprocess.run([gitexecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) + print("Determining revision info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) print("Command {0} returned: {1}".format(completed.args, completed.returncode)) changecount = completed.stdout.decode("utf-8").strip() print("Change count: {0}".format(changecount)) adjustedchangecount = int(changecount) + int(basenumber) print("Adjusted change count: {0}".format(adjustedchangecount)) - print("Determining current revision info using git command: {0}".format(gitexecutable)) - completed = subprocess.run([gitexecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) + print("Determining current revision info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) print("Command {0} returned: {1}".format(completed.args, completed.returncode)) revision = completed.stdout.decode("utf-8").strip() print("Revision: {0}".format(revision)) - print("Determining remote info using git command: {0}".format(gitexecutable)) - completed = subprocess.run([gitexecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) + print("Determining remote info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) print("Command {0} returned: {1}".format(completed.args, completed.returncode)) remoteinfo = completed.stdout.decode("utf-8") print("Remote info: {0}".format(remoteinfo)) From 2fab1a566ec16460835b4aefda492ad56b435490 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 2 Dec 2017 21:48:37 +0000 Subject: [PATCH 0028/1971] Remove redundant files --- README.md | 0 README2.md | 0 version/differences.txt | 230 ---------------------------------------- 3 files changed, 230 deletions(-) delete mode 100644 README.md delete mode 100644 README2.md delete mode 100644 version/differences.txt diff --git a/README.md b/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/README2.md b/README2.md deleted file mode 100644 index e69de29..0000000 diff --git a/version/differences.txt b/version/differences.txt deleted file mode 100644 index 7ec3ad6..0000000 --- a/version/differences.txt +++ /dev/null @@ -1,230 +0,0 @@ -**************************************************************************************************** -**************************************************************************************************** -**************************************************************************************************** -**************************************************************************************************** -Looking for changes in origin/master that are not in origin/1.5.4 of the repository at path: /home/dan/home2/Development/inksystem -Executing: git log --oneline origin/1.5.4..origin/master -**************************************************************************************************** -IMB-Numbers Log: - IMB-11 - Further minor change to tooltip - Changed tooltip for PWN Frequency on ink pumps - Changed the Tooltips for PWM frequency and duty cycle - IMB-12 - Changed the order the events are generated in to prevent master from resetting slave - When a vent command is sent to a slave, it will demand a vent from its master - IMB-14 - Fixed state transition in Controlled Flow Master where it could get stuck in pre-flow - IMB-4 - - Add more logging - IMB-42 - Master sets the slaves to dormant when pre-idling - IMB-43 - Added purge abort for HP Type 2 - Fixed shared controlled flow transition for purge all slaves - Added Idle transitions from Purge - Added missing definition - Added explicit transitions for standby for all states for flowmode 1-3 - IMB-47 - - Tidied up checkStateR to be consistent with setValueR - - The thermistor will only generate an event if a threshold has been crossed, or when "timeToSendAnotherEvent" is true. - - The thermistor will only generate an event if a threshold has been crossed, or when "timeToSendAnotherEvent" is true. - IMB-50 - Temperature setpoint set when entering flow configuration to ensure correct heater operation - IMB-6 - Removed a white-space in the output - IMB-7 - Changed the formatting of the output - IMB-8 - When returning from a purge it now calls the same code as when going into idle, as they effectively were identical. - Added pre-flow to post-flow transitions and vice-versa - In gravity mode: removed the activation of the vacuum pump which speeds up ramps. This caused vent and pump to "fight" each other -**************************************************************************************************** -Revert log: -**************************************************************************************************** -Merges log: - Merge branch '1.10023.j6221-Type2_Pneumatic' of hydra:gis/inksystem into 1.10023.j6221-Type2_Pneumatic - Merge branch 'master' of hydra:gis/inksystem - Merge remote-tracking branch 'remotes/origin/1.10025.j6416-EthernetCongestion' into 1.10023.j6221-Type2_Pneumatic - Merge remote-tracking branch 'remotes/origin/1.5.2' into 1.10023.j6221-Type2_Pneumatic - Merge remote-tracking branch 'remotes/origin/1.5.5' - Merge remote-tracking branch 'remotes/origin/master' into 1.10023.j6221-Type2_Pneumatic -**************************************************************************************************** -Other log: - 095290c GIS-1621 - Make compilation work in case-sensitive linux - 0a8505d GIS-1621 - Remove test code - 0e8ccce GIS-6380 Removed ambiguous "absolute pressure" terminology - 149e0bf GIS 6221: Added logging for gravity mode - 169125b GIS-6221: Corrected Typo - 23c37d0 GIS 43: System will abort purge in a safe manner if standby command is issued - 37dd24b GIS 6479: Controlled flow master now goes through pre-flow. Fixed ordering in controlevent.c and .h - 41ac373 GIS-6253: Fixed bugs - 45cdfbe GIS 6591: Fixed if statement which outputs ITPD and OTPD - 468798e Update release notes whitespace - 4c2badc GIS-1621 - 16 bit integer is not printing correctly - 4c9a1aa GIS-6221 Vent the outlet bottle when purging to prevent "kick" on return from idle - 541c3bb GIS-6253: Added gravity flowmode - 5562461 GIS-6570 - Handle 0 length buffers being sent for TCP transmission; Add some logging for diagnosis - 577444e Update release notes for 1.5.5 - 5c6416b GIS-6416 - Instrument number of buffers on socket transmit queue and grapher empty buffer queue - 603de5a GIS-6221: Fixed more typos - 628b57d GIS 6221: Fixed typo - 6526df4 GIS-6221 Corrected behaviour at idle. When idling, the pressure is now only vacuum pump driven in one direction. - 6da6243 GIS-6221 Changed purge configuration, return from purge still to do - 7d263d0 GIS 6591: Change the output of the settings command on Telnet for clarity - 83f5517 Update 1.5.5 release notes with known issues - 85fc901 GIS-6570 - Handle condition when no bytes are consumed by sck_send (because the connection has died) for TCP transmission; Add some logging for diagnosis - 8a2db28 GIS-6221 Corrected behaviour at idle. When idling, the pressure is now only vacuum pump driven in one direction. - 8df4c1b GIS-1621 - Settings BSP files have changed unexpectedly from 1.5.4 - maybe causing a slow down - 92c135e GIS 6462 Fixed typo - 9400923 GIS-6516: Slave resets from vent when master is reset - 9964521 GIS 6253: Added methods for gravity mode logging in inkchannelinterface.cpp/h - a1f0025 GIS 43: Added PreIdle with slaves in controlled flow master - a900a24 GIS-6221: Changed Idle to be driven from Inlet Side - b2f4383 GIS-1620 - Correct string print - b42ea46 GIS-1621 - Handle version prefix - b498cd5 GIS 6462 Added on the fly idle pressure change in shared pressure controlled flow - b4e1b8c GIS 6221: Resolved merge conflicts and applied fixes from 1.5.3 to the Type 2 High Pressure mode - bbc5e45 GIS 6221 - Changed High Pressure Type 2 to flowmode 6 - bd69b60 GIS-6253: Fixed typos - c568789 GIS 6221 - Bug fixes High Pressure Type 2 Flow mode - c666970 GIS-6570 - Add some logging for diagnosis - c7bbf29 Fixed shared controlled flow transition for purge all slaves to standby - c962c65 GIS-6221 Added Purge Return via Idle - ca1e7b5 GIS-6253: Added the files for gravity flowmode - ca4473b GIS-1621 - Only send pressure updates if there is a 4 point difference in value - cb06440 GIS 6221: Changed descriptions of Flowmodes. Changed output of settings to show purge pressure for flowmode 5 and 6 - d4dd54d GIS 6462: Added on-the-fly pressure change for Shared Pressure Controlled Flow systems - da69186 GIS 6492: Dumpconfig now outputs the software version - df64abd Revert "GIS-1621 - Only send pressure updates if there is a 4 point difference in value" - e51971f GIS 6379: The purge pressure is only shown on High Pressure systems (flowmode 4 and 5) - e6b0227 GIS-6221 Corrected vent operation for outlet bottle - ec13b60 GIS-6416 - Handle multiple writes to a TCP stream until it becomes busy - f018a86 GIS 6479: Added an applysettings command to allow on the fly pressure and temperature changes - f7109ff GIS 43: Added purge to idle transitions for Gravity Mode - f87280b GIS 43: Fixed transition in cfm - f999765 GIS-6253: Removed redundant function - ff37df8 GIS-6253: Fixed typos - ff92b79 GIS 6591: Added statement on Master settings -**************************************************************************************************** -**************************************************************************************************** -**************************************************************************************************** -**************************************************************************************************** -Looking for changes in origin/1.5.4 that are not in origin/master of the repository at path: /home/dan/home2/Development/inksystem -Executing: git log --oneline origin/master..origin/1.5.4 -**************************************************************************************************** -IMB-Numbers Log: -**************************************************************************************************** -Revert log: -**************************************************************************************************** -Merges log: -**************************************************************************************************** -Other log: -**************************************************************************************************** -**************************************************************************************************** -**************************************************************************************************** -**************************************************************************************************** -Looking for changes that are not common to origin/master or origin/1.5.4 at path: /home/dan/home2/Development/inksystem -Executing: git log --oneline origin/master...origin/1.5.4 -**************************************************************************************************** -IMB-Numbers Log: - IMB-11 - Further minor change to tooltip - Changed tooltip for PWN Frequency on ink pumps - Changed the Tooltips for PWM frequency and duty cycle - IMB-12 - Changed the order the events are generated in to prevent master from resetting slave - When a vent command is sent to a slave, it will demand a vent from its master - IMB-14 - Fixed state transition in Controlled Flow Master where it could get stuck in pre-flow - IMB-4 - - Add more logging - IMB-42 - Master sets the slaves to dormant when pre-idling - IMB-43 - Added purge abort for HP Type 2 - Fixed shared controlled flow transition for purge all slaves - Added Idle transitions from Purge - Added missing definition - Added explicit transitions for standby for all states for flowmode 1-3 - IMB-47 - - Tidied up checkStateR to be consistent with setValueR - - The thermistor will only generate an event if a threshold has been crossed, or when "timeToSendAnotherEvent" is true. - - The thermistor will only generate an event if a threshold has been crossed, or when "timeToSendAnotherEvent" is true. - IMB-50 - Temperature setpoint set when entering flow configuration to ensure correct heater operation - IMB-6 - Removed a white-space in the output - IMB-7 - Changed the formatting of the output - IMB-8 - When returning from a purge it now calls the same code as when going into idle, as they effectively were identical. - Added pre-flow to post-flow transitions and vice-versa - In gravity mode: removed the activation of the vacuum pump which speeds up ramps. This caused vent and pump to "fight" each other -**************************************************************************************************** -Revert log: -**************************************************************************************************** -Merges log: - Merge branch '1.10023.j6221-Type2_Pneumatic' of hydra:gis/inksystem into 1.10023.j6221-Type2_Pneumatic - Merge branch 'master' of hydra:gis/inksystem - Merge remote-tracking branch 'remotes/origin/1.10025.j6416-EthernetCongestion' into 1.10023.j6221-Type2_Pneumatic - Merge remote-tracking branch 'remotes/origin/1.5.2' into 1.10023.j6221-Type2_Pneumatic - Merge remote-tracking branch 'remotes/origin/1.5.5' - Merge remote-tracking branch 'remotes/origin/master' into 1.10023.j6221-Type2_Pneumatic -**************************************************************************************************** -Other log: - 095290c GIS-1621 - Make compilation work in case-sensitive linux - 0a8505d GIS-1621 - Remove test code - 0e8ccce GIS-6380 Removed ambiguous "absolute pressure" terminology - 149e0bf GIS 6221: Added logging for gravity mode - 169125b GIS-6221: Corrected Typo - 23c37d0 GIS 43: System will abort purge in a safe manner if standby command is issued - 37dd24b GIS 6479: Controlled flow master now goes through pre-flow. Fixed ordering in controlevent.c and .h - 41ac373 GIS-6253: Fixed bugs - 45cdfbe GIS 6591: Fixed if statement which outputs ITPD and OTPD - 468798e Update release notes whitespace - 4c2badc GIS-1621 - 16 bit integer is not printing correctly - 4c9a1aa GIS-6221 Vent the outlet bottle when purging to prevent "kick" on return from idle - 541c3bb GIS-6253: Added gravity flowmode - 5562461 GIS-6570 - Handle 0 length buffers being sent for TCP transmission; Add some logging for diagnosis - 577444e Update release notes for 1.5.5 - 5c6416b GIS-6416 - Instrument number of buffers on socket transmit queue and grapher empty buffer queue - 603de5a GIS-6221: Fixed more typos - 628b57d GIS 6221: Fixed typo - 6526df4 GIS-6221 Corrected behaviour at idle. When idling, the pressure is now only vacuum pump driven in one direction. - 6da6243 GIS-6221 Changed purge configuration, return from purge still to do - 7d263d0 GIS 6591: Change the output of the settings command on Telnet for clarity - 83f5517 Update 1.5.5 release notes with known issues - 85fc901 GIS-6570 - Handle condition when no bytes are consumed by sck_send (because the connection has died) for TCP transmission; Add some logging for diagnosis - 8a2db28 GIS-6221 Corrected behaviour at idle. When idling, the pressure is now only vacuum pump driven in one direction. - 8df4c1b GIS-1621 - Settings BSP files have changed unexpectedly from 1.5.4 - maybe causing a slow down - 92c135e GIS 6462 Fixed typo - 9400923 GIS-6516: Slave resets from vent when master is reset - 9964521 GIS 6253: Added methods for gravity mode logging in inkchannelinterface.cpp/h - a1f0025 GIS 43: Added PreIdle with slaves in controlled flow master - a900a24 GIS-6221: Changed Idle to be driven from Inlet Side - b2f4383 GIS-1620 - Correct string print - b42ea46 GIS-1621 - Handle version prefix - b498cd5 GIS 6462 Added on the fly idle pressure change in shared pressure controlled flow - b4e1b8c GIS 6221: Resolved merge conflicts and applied fixes from 1.5.3 to the Type 2 High Pressure mode - bbc5e45 GIS 6221 - Changed High Pressure Type 2 to flowmode 6 - bd69b60 GIS-6253: Fixed typos - c568789 GIS 6221 - Bug fixes High Pressure Type 2 Flow mode - c666970 GIS-6570 - Add some logging for diagnosis - c7bbf29 Fixed shared controlled flow transition for purge all slaves to standby - c962c65 GIS-6221 Added Purge Return via Idle - ca1e7b5 GIS-6253: Added the files for gravity flowmode - ca4473b GIS-1621 - Only send pressure updates if there is a 4 point difference in value - cb06440 GIS 6221: Changed descriptions of Flowmodes. Changed output of settings to show purge pressure for flowmode 5 and 6 - d4dd54d GIS 6462: Added on-the-fly pressure change for Shared Pressure Controlled Flow systems - da69186 GIS 6492: Dumpconfig now outputs the software version - df64abd Revert "GIS-1621 - Only send pressure updates if there is a 4 point difference in value" - e51971f GIS 6379: The purge pressure is only shown on High Pressure systems (flowmode 4 and 5) - e6b0227 GIS-6221 Corrected vent operation for outlet bottle - ec13b60 GIS-6416 - Handle multiple writes to a TCP stream until it becomes busy - f018a86 GIS 6479: Added an applysettings command to allow on the fly pressure and temperature changes - f7109ff GIS 43: Added purge to idle transitions for Gravity Mode - f87280b GIS 43: Fixed transition in cfm - f999765 GIS-6253: Removed redundant function - ff37df8 GIS-6253: Fixed typos - ff92b79 GIS 6591: Added statement on Master settings From 4dbbbf2b4247eb39770d2c9f4d4498ed1f4a8c0d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Dec 2017 13:13:23 +0000 Subject: [PATCH 0029/1971] Provide a comma seperated build stamp --- versionnumbering/versioninfo.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index c8c79fe..a4162e0 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -124,6 +124,10 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, r with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: f.write(buildstamp) + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) + def main(argv=None): # IGNORE:C0111 '''Command line options.''' From 584a016c493000ae456182f37b4c50bdf739f9c9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Dec 2017 13:33:27 +0000 Subject: [PATCH 0030/1971] Move code to common position --- build/eclipsebuild/eclipsebuild.gsh | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 build/eclipsebuild/eclipsebuild.gsh diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh new file mode 100644 index 0000000..e7dcd09 --- /dev/null +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -0,0 +1,34 @@ +// Build and export files +def doBuild(apps) { + for (appInfo in apps ) { + if (appInfo[0]) + { + retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) + if (isUnix()) { + sh "${BUILD_COMMAND} -build ${appInfo[1]}/${BUILD_VARIANT}" + } + else { + bat "%BUILD_COMMAND% -build ${appInfo[1]}/${BUILD_VARIANT}" + } + } + echo "Looking at: ${appInfo[2]}" + script { + env.destFolder = "${WORKSPACE}/export/${appInfo[1]}" + env.srcFile = "${WORKSPACE}/${appInfo[2]}" + } + dir (env.destFolder) { + if (appInfo[2]) { + echo "Copy ${srcFile} to ${destFolder}" + if (isUnix()) { + sh 'cp \"${srcFile}\" ${destFolder}' + } + else { + bat 'copy \"%srcFile%\" %destFolder%' + } + } + } + } + } +} + +return this; \ No newline at end of file From aeb712f07339a59e87b47703c71e9e4444313871 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Dec 2017 13:24:11 +0000 Subject: [PATCH 0031/1971] Make variants of build all in one run --- build/eclipsebuild/eclipsebuild.gsh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index e7dcd09..579a413 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -1,23 +1,28 @@ // Build and export files def doBuild(apps) { for (appInfo in apps ) { - if (appInfo[0]) + env.build = appInfo[0] + env.project = appInfo[1] + env.variants = appInfo[2] + env.exportpath = appInfo[3] + if (build) { - retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) + for (build_variant in variants) { + retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh "${BUILD_COMMAND} -build ${appInfo[1]}/${BUILD_VARIANT}" + sh "${BUILD_COMMAND} -build ${project}/${build_variant}" } else { - bat "%BUILD_COMMAND% -build ${appInfo[1]}/${BUILD_VARIANT}" + bat "%BUILD_COMMAND% -build ${project}/${build_variant}" } } - echo "Looking at: ${appInfo[2]}" + echo "Export path at: ${exportpath}" script { - env.destFolder = "${WORKSPACE}/export/${appInfo[1]}" - env.srcFile = "${WORKSPACE}/${appInfo[2]}" + env.destFolder = "${WORKSPACE}/export/${project}" + env.srcFile = "${WORKSPACE}/${exportpath}" } dir (env.destFolder) { - if (appInfo[2]) { + if (exportpath) { echo "Copy ${srcFile} to ${destFolder}" if (isUnix()) { sh 'cp \"${srcFile}\" ${destFolder}' From 12a002f5a5dbe22a22255019d5ea27364005c179 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Dec 2017 15:35:20 +0000 Subject: [PATCH 0032/1971] Make variants of build all in one run --- build/eclipsebuild/eclipsebuild.gsh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 579a413..c7876d2 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -20,6 +20,7 @@ def doBuild(apps) { script { env.destFolder = "${WORKSPACE}/export/${project}" env.srcFile = "${WORKSPACE}/${exportpath}" + env.srcFileExpanded = "${srcFile}" } dir (env.destFolder) { if (exportpath) { From ff5b8f515e7514a31e5aecbb7022c8344b81f9a5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Dec 2017 15:43:11 +0000 Subject: [PATCH 0033/1971] Make variants of build all in one run --- build/eclipsebuild/eclipsebuild.gsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index c7876d2..a4ee79a 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -20,16 +20,16 @@ def doBuild(apps) { script { env.destFolder = "${WORKSPACE}/export/${project}" env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = "${srcFile}" + env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } dir (env.destFolder) { if (exportpath) { - echo "Copy ${srcFile} to ${destFolder}" + echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh 'cp \"${srcFile}\" ${destFolder}' + sh 'cp \"${srcFileExpanded}\" ${destFolder}' } else { - bat 'copy \"%srcFile%\" %destFolder%' + bat 'copy \"%srcFileExpanded%\" %destFolder%' } } } From c21c6348a423654bb9a9d863863877b2bf4ba371 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Dec 2017 16:16:09 +0000 Subject: [PATCH 0034/1971] Make variants of build all in one run --- build/eclipsebuild/eclipsebuild.gsh | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index a4ee79a..6e24393 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -1,38 +1,38 @@ // Build and export files def doBuild(apps) { for (appInfo in apps ) { - env.build = appInfo[0] - env.project = appInfo[1] - env.variants = appInfo[2] - env.exportpath = appInfo[3] - if (build) - { + build = appInfo[0] + project = appInfo[1] + variants = appInfo[2] + exportpath = appInfo[3] + if (build) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) - if (isUnix()) { - sh "${BUILD_COMMAND} -build ${project}/${build_variant}" - } - else { - bat "%BUILD_COMMAND% -build ${project}/${build_variant}" - } - } - echo "Export path at: ${exportpath}" - script { - env.destFolder = "${WORKSPACE}/export/${project}" - env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") - } - dir (env.destFolder) { - if (exportpath) { - echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh 'cp \"${srcFileExpanded}\" ${destFolder}' + sh "${BUILD_COMMAND} -build ${project}/${build_variant}" } else { - bat 'copy \"%srcFileExpanded%\" %destFolder%' + bat "%BUILD_COMMAND% -build ${project}/${build_variant}" } } - } + echo "Export path at: ${exportpath}" + script { + env.destFolder = "${WORKSPACE}/export/${project}" + env.srcFile = "${WORKSPACE}/${exportpath}" + env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + } + dir (env.destFolder) { + if (exportpath) { + echo "Copy ${srcFileExpanded} to ${destFolder}" + if (isUnix()) { + sh 'cp \"${srcFileExpanded}\" ${destFolder}' + } + else { + bat 'copy \"%srcFileExpanded%\" %destFolder%' + } + } + } + } } } } From e76809830b161294c1c832747423df3728ac033e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Dec 2017 16:26:19 +0000 Subject: [PATCH 0035/1971] Make variants of build all in one run --- build/eclipsebuild/eclipsebuild.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 6e24393..351f9d5 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -17,7 +17,7 @@ def doBuild(apps) { } echo "Export path at: ${exportpath}" script { - env.destFolder = "${WORKSPACE}/export/${project}" + env.destFolder = "${WORKSPACE}/export/${build_variant}/${project}" env.srcFile = "${WORKSPACE}/${exportpath}" env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } From 75d8716a0a6ceb1e53a64984fd9765b5323cb8f8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Dec 2017 16:30:18 +0000 Subject: [PATCH 0036/1971] Make variants of build all in one run --- build/eclipsebuild/eclipsebuild.gsh | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 351f9d5..26ed411 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -15,20 +15,22 @@ def doBuild(apps) { bat "%BUILD_COMMAND% -build ${project}/${build_variant}" } } - echo "Export path at: ${exportpath}" - script { - env.destFolder = "${WORKSPACE}/export/${build_variant}/${project}" - env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") - } - dir (env.destFolder) { - if (exportpath) { - echo "Copy ${srcFileExpanded} to ${destFolder}" - if (isUnix()) { - sh 'cp \"${srcFileExpanded}\" ${destFolder}' - } - else { - bat 'copy \"%srcFileExpanded%\" %destFolder%' + if (exportpath) { + echo "Export path at: ${exportpath}" + script { + env.destFolder = "${WORKSPACE}/export/${build_variant}/${project}" + env.srcFile = "${WORKSPACE}/${exportpath}" + env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + } + dir (env.destFolder) { + if (exportpath) { + echo "Copy ${srcFileExpanded} to ${destFolder}" + if (isUnix()) { + sh 'cp \"${srcFileExpanded}\" ${destFolder}' + } + else { + bat 'copy \"%srcFileExpanded%\" %destFolder%' + } } } } From cfbc3e70c58f182d0eefd7e70f58cbc2ec5a9186 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Dec 2017 18:17:15 +0000 Subject: [PATCH 0037/1971] Add version stamping --- versionstamping/.project | 17 ++++++++++++++ versionstamping/.pydevproject | 8 +++++++ versionstamping/versionstamper.py | 37 +++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 versionstamping/.project create mode 100644 versionstamping/.pydevproject create mode 100644 versionstamping/versionstamper.py diff --git a/versionstamping/.project b/versionstamping/.project new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/versionstamping/.project @@ -0,0 +1,17 @@ + + + versionstamping + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/versionstamping/.pydevproject b/versionstamping/.pydevproject new file mode 100644 index 0000000..746d0f0 --- /dev/null +++ b/versionstamping/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +python35 + diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py new file mode 100644 index 0000000..45c94e2 --- /dev/null +++ b/versionstamping/versionstamper.py @@ -0,0 +1,37 @@ +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='1.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)) + + filecopy = filetoconvert + ".orig" + try: + shutil.move(filetoconvert, filecopy) + except FileNotFoundError: + print("Could not find file: {0}\n".format(filetoconvert)) + return 1 + + with open(filetoconvert, 'x') as f: + with open(filecopy) as c: + converted = c.read().replace(pattern, substitute) + f.write(converted) + + return 0 + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) From 64926607ca790789319e01f03ab5595f546b6eb7 Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 15:09:34 +0000 Subject: [PATCH 0038/1971] REVIEW ME: Changing the versionstamp target from 1.30000.0.0 to 1.3000.0.0 so that it stamps over what the ESW is currently outputting by default. This may need to be reverted and the version of the ESW output changed. --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 45c94e2..8e445d2 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -8,7 +8,7 @@ def main(argv): # Call once arguments to allow or disallow something parser.add_argument('-f', '--filetoconvert', help='The file to convert') - parser.add_argument('-p', '--pattern', default='1.30000.0.0', help='The pattern to search for and replace') + parser.add_argument('-p', '--pattern', default='1.3000.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) From 3c1b453b21ee7bb07b8e93f31ca7a4bf118b206c Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 15:16:24 +0000 Subject: [PATCH 0039/1971] Reverting change as i have realized the blunder --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 8e445d2..45c94e2 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -8,7 +8,7 @@ def main(argv): # Call once arguments to allow or disallow something parser.add_argument('-f', '--filetoconvert', help='The file to convert') - parser.add_argument('-p', '--pattern', default='1.3000.0.0', help='The pattern to search for and replace') + parser.add_argument('-p', '--pattern', default='1.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) From f3107d5dcfc9cee65a8ac3be876611cea2b417dd Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 15:35:58 +0000 Subject: [PATCH 0040/1971] Adding Debugging for conversion script, Reverting the conversion values for build.gsh --- versionstamping/versionstamper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 45c94e2..ff5eb0d 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -28,7 +28,9 @@ def main(argv): with open(filetoconvert, 'x') as f: with open(filecopy) as c: + print("Detected %s instances of %s pre-conversion"%(c.count(pattern),pattern)) converted = c.read().replace(pattern, substitute) + print("Confirmed %s instances of %s post-conversion"%s(converted.count(substitute),substitute)) f.write(converted) return 0 From 35cbc075a36d1a0ed8f83e8a7ef4651f23c5ef79 Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 15:37:44 +0000 Subject: [PATCH 0041/1971] Read the file before attempting to count instances within it. --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index ff5eb0d..8b43e48 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -28,7 +28,7 @@ def main(argv): with open(filetoconvert, 'x') as f: with open(filecopy) as c: - print("Detected %s instances of %s pre-conversion"%(c.count(pattern),pattern)) + print("Detected %s instances of %s pre-conversion"%(c.read().count(pattern),pattern)) converted = c.read().replace(pattern, substitute) print("Confirmed %s instances of %s post-conversion"%s(converted.count(substitute),substitute)) f.write(converted) From 58feb9612024208857ecc670294a931876d55949 Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 15:38:48 +0000 Subject: [PATCH 0042/1971] silly 's' --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 8b43e48..48d9f45 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -30,7 +30,7 @@ def main(argv): with open(filecopy) as c: print("Detected %s instances of %s pre-conversion"%(c.read().count(pattern),pattern)) converted = c.read().replace(pattern, substitute) - print("Confirmed %s instances of %s post-conversion"%s(converted.count(substitute),substitute)) + print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) f.write(converted) return 0 From 1124ca5cd683fa690db227c97d7b9e458c1f0e55 Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 15:51:45 +0000 Subject: [PATCH 0043/1971] close the files after we have read/written them. explicily open copy file for reading --- versionstamping/versionstamper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 48d9f45..f42e54d 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -27,11 +27,13 @@ def main(argv): return 1 with open(filetoconvert, 'x') as f: - with open(filecopy) as c: + with open(filecopy,'r') as c: print("Detected %s instances of %s pre-conversion"%(c.read().count(pattern),pattern)) converted = c.read().replace(pattern, substitute) print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) f.write(converted) + c.close() + f.close() return 0 From 9b75cd07247ae0d7908a709611a795709593928e Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 15:52:52 +0000 Subject: [PATCH 0044/1971] Print Converted as debug info. --- versionstamping/versionstamper.py | 1 + 1 file changed, 1 insertion(+) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index f42e54d..d953aa4 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -30,6 +30,7 @@ def main(argv): with open(filecopy,'r') as c: print("Detected %s instances of %s pre-conversion"%(c.read().count(pattern),pattern)) converted = c.read().replace(pattern, substitute) + print ("DEBUG: %s "%converted) print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) f.write(converted) c.close() From 42bdcc82e2e35fa367d2e7cf66ed6490cc07fc43 Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 15:58:54 +0000 Subject: [PATCH 0045/1971] Read to local variable rather than double reading from file. --- versionstamping/versionstamper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index d953aa4..da01aa2 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -28,12 +28,13 @@ def main(argv): with open(filetoconvert, 'x') as f: with open(filecopy,'r') as c: - print("Detected %s instances of %s pre-conversion"%(c.read().count(pattern),pattern)) - converted = c.read().replace(pattern, substitute) + fileread = c.read() + c.close() + print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) + converted = fileread.replace(pattern, substitute) print ("DEBUG: %s "%converted) print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) f.write(converted) - c.close() f.close() return 0 From ae37de4bc32d1ca82b254d7a9cda94319b541e41 Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 16:00:08 +0000 Subject: [PATCH 0046/1971] Comment Debug Print --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index da01aa2..ebfad73 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -32,7 +32,7 @@ def main(argv): c.close() print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) converted = fileread.replace(pattern, substitute) - print ("DEBUG: %s "%converted) + #print ("DEBUG: %s "%converted) print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) f.write(converted) f.close() From 3c0896f1ee63e63d11c065e8836c9725fbf5b8d2 Mon Sep 17 00:00:00 2001 From: georgelinsdell Date: Wed, 20 Dec 2017 16:32:16 +0000 Subject: [PATCH 0047/1971] Remove File.close() calls as they are not neccessary --- versionstamping/versionstamper.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index ebfad73..3e59c6f 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -29,13 +29,11 @@ def main(argv): with open(filetoconvert, 'x') as f: with open(filecopy,'r') as c: fileread = c.read() - c.close() print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) converted = fileread.replace(pattern, substitute) #print ("DEBUG: %s "%converted) print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) f.write(converted) - f.close() return 0 From 82b7ef85bd50d57db1b3bdfe458430ca2c5ab8a8 Mon Sep 17 00:00:00 2001 From: Damian Smith Date: Fri, 12 Jan 2018 15:57:39 +0000 Subject: [PATCH 0048/1971] Update versioninfo.py so that default prefix ends with a period (1.30000.0.) --- versionnumbering/versioninfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index a4162e0..59b5225 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -68,7 +68,7 @@ def getGitRevision(gitrootpath, basenumber): def getVersionPrefix(sourcebranch): print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) - defaultversionprefix = "1.30000.0" + defaultversionprefix = "1.30000.0." splits = sourcebranch.split('/') if len(splits) < 1: print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) From 5b6835d1174b29d909eab8f2b8d0d92d649a3db8 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 09:56:48 +0000 Subject: [PATCH 0049/1971] Accounting for project names containing spaces. --- build/eclipsebuild/eclipsebuild.gsh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 26ed411..5d55fe5 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -1,18 +1,19 @@ // Build and export files def doBuild(apps) { for (appInfo in apps ) { - build = appInfo[0] - project = appInfo[1] - variants = appInfo[2] - exportpath = appInfo[3] + (build, project, variants, exportpath) = appInfo if (build) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh "${BUILD_COMMAND} -build ${project}/${build_variant}" + sh """ + "${BUILD_COMMAND}" -build "${project}/${build_variant}" + """ } else { - bat "%BUILD_COMMAND% -build ${project}/${build_variant}" + bat """ + "%BUILD_COMMAND%" -build "${project}\\${build_variant}" + """ } } if (exportpath) { @@ -39,4 +40,4 @@ def doBuild(apps) { } } -return this; \ No newline at end of file +return this; From 22d283a9985c4ea16ce1ea0af4235f04bb7b25dd Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 09:56:48 +0000 Subject: [PATCH 0050/1971] Accounting for project names containing spaces. --- build/eclipsebuild/eclipsebuild.gsh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 26ed411..5d55fe5 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -1,18 +1,19 @@ // Build and export files def doBuild(apps) { for (appInfo in apps ) { - build = appInfo[0] - project = appInfo[1] - variants = appInfo[2] - exportpath = appInfo[3] + (build, project, variants, exportpath) = appInfo if (build) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh "${BUILD_COMMAND} -build ${project}/${build_variant}" + sh """ + "${BUILD_COMMAND}" -build "${project}/${build_variant}" + """ } else { - bat "%BUILD_COMMAND% -build ${project}/${build_variant}" + bat """ + "%BUILD_COMMAND%" -build "${project}\\${build_variant}" + """ } } if (exportpath) { @@ -39,4 +40,4 @@ def doBuild(apps) { } } -return this; \ No newline at end of file +return this; From 2a3ad3e0051d0357cd51b38cf5e647481d8f9a9b Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 10:39:40 +0000 Subject: [PATCH 0051/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 5d55fe5..da349c6 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -7,7 +7,7 @@ def doBuild(apps) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { sh """ - "${BUILD_COMMAND}" -build "${project}/${build_variant}" + \"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\" """ } else { From 74e7696ef6dc4f748e810de6300b8ad1d737164f Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 10:39:40 +0000 Subject: [PATCH 0052/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 5d55fe5..da349c6 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -7,7 +7,7 @@ def doBuild(apps) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { sh """ - "${BUILD_COMMAND}" -build "${project}/${build_variant}" + \"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\" """ } else { From ede80e31d3833bead3b20fa86437e129df4d5e01 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 10:53:00 +0000 Subject: [PATCH 0053/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index da349c6..b4bbc34 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,10 +6,8 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh """ - \"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\" - """ - } + sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + } else { bat """ "%BUILD_COMMAND%" -build "${project}\\${build_variant}" From 7d8891e227f95361fdc0a2b80b3c1cb114053525 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 10:53:00 +0000 Subject: [PATCH 0054/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index da349c6..b4bbc34 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,10 +6,8 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh """ - \"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\" - """ - } + sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + } else { bat """ "%BUILD_COMMAND%" -build "${project}\\${build_variant}" From 65c3bdf95cd8bfd30e28cf42aa365fc08418e871 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 10:56:32 +0000 Subject: [PATCH 0055/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index b4bbc34..0ba188d 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,7 +6,7 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + sh '${BUILD_COMMAND} -build "${project}/${build_variant}"' } else { bat """ From ec0055e572f26eedfbd33134a2da4a1d403e04eb Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 10:56:32 +0000 Subject: [PATCH 0056/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index b4bbc34..0ba188d 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,7 +6,7 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + sh '${BUILD_COMMAND} -build "${project}/${build_variant}"' } else { bat """ From 60a33d6a8a7407773767de17eac872bf205edb53 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 11:02:51 +0000 Subject: [PATCH 0057/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 0ba188d..b4bbc34 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,7 +6,7 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh '${BUILD_COMMAND} -build "${project}/${build_variant}"' + sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" } else { bat """ From 61d581de84a5cef38c55e2e345f20f9b447b9130 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 11:02:51 +0000 Subject: [PATCH 0058/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 0ba188d..b4bbc34 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,7 +6,7 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - sh '${BUILD_COMMAND} -build "${project}/${build_variant}"' + sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" } else { bat """ From 69904f1efd05096fda2f22d83fad2f1f912ff4a0 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 11:08:10 +0000 Subject: [PATCH 0059/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index b4bbc34..367b454 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,6 +6,7 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { + echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" } else { From 4400c698df7a556eca83fe1d474c0d066486f6d6 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 11:08:10 +0000 Subject: [PATCH 0060/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index b4bbc34..367b454 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,6 +6,7 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { + echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" } else { From 3f61ee3e423a0a7680260ca578e73d345d0cd818 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 11:29:10 +0000 Subject: [PATCH 0061/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 367b454..5384341 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,13 +6,11 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + echo "Build command: \"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\"" + sh "\"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\"" } else { - bat """ - "%BUILD_COMMAND%" -build "${project}\\${build_variant}" - """ + bat "\"%BUILD_COMMAND%\" -build \"${project}/${build_variant}\"" } } if (exportpath) { From c55ffd413675729698bcf1467d25ba05306bc3b6 Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 11:29:10 +0000 Subject: [PATCH 0062/1971] Auto build fix. --- build/eclipsebuild/eclipsebuild.gsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 367b454..5384341 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,13 +6,11 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + echo "Build command: \"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\"" + sh "\"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\"" } else { - bat """ - "%BUILD_COMMAND%" -build "${project}\\${build_variant}" - """ + bat "\"%BUILD_COMMAND%\" -build \"${project}/${build_variant}\"" } } if (exportpath) { From c3008ea17db8df74dde9aea8d33bfc648e902e9f Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 11:40:39 +0000 Subject: [PATCH 0063/1971] Revert "Auto build fix." This reverts commit 29e58eead620367c9beccb69b35c6715a5c2ef33. --- build/eclipsebuild/eclipsebuild.gsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 5384341..367b454 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,11 +6,13 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - echo "Build command: \"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\"" - sh "\"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\"" + echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" } else { - bat "\"%BUILD_COMMAND%\" -build \"${project}/${build_variant}\"" + bat """ + "%BUILD_COMMAND%" -build "${project}\\${build_variant}" + """ } } if (exportpath) { From a21ec9aace7535a45026110a1fd008fdadd4060a Mon Sep 17 00:00:00 2001 From: danielbujnik Date: Tue, 13 Feb 2018 11:40:39 +0000 Subject: [PATCH 0064/1971] Revert "Auto build fix." This reverts commit 29e58eead620367c9beccb69b35c6715a5c2ef33. --- build/eclipsebuild/eclipsebuild.gsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 5384341..367b454 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -6,11 +6,13 @@ def doBuild(apps) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - echo "Build command: \"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\"" - sh "\"${BUILD_COMMAND}\" -build \"${project}/${build_variant}\"" + echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" } else { - bat "\"%BUILD_COMMAND%\" -build \"${project}/${build_variant}\"" + bat """ + "%BUILD_COMMAND%" -build "${project}\\${build_variant}" + """ } } if (exportpath) { From 70b23d7049b5a986935164e72e506d17c7de1903 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Feb 2018 17:03:14 +0000 Subject: [PATCH 0065/1971] Move commonly used methods out to Common_scripts --- commandline/commandline.gsh | 12 ++++++++ configuration/configuration.gsh | 34 +++++++++++++++++++++ versioncontrol/git.gsh | 53 +++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 commandline/commandline.gsh create mode 100644 configuration/configuration.gsh create mode 100644 versioncontrol/git.gsh diff --git a/commandline/commandline.gsh b/commandline/commandline.gsh new file mode 100644 index 0000000..c03add7 --- /dev/null +++ b/commandline/commandline.gsh @@ -0,0 +1,12 @@ +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() + } +} + diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh new file mode 100644 index 0000000..424765e --- /dev/null +++ b/configuration/configuration.gsh @@ -0,0 +1,34 @@ +def githelper = load("Common_scripts/versioncontrol/git.gsh") + +configurationCollection = [:] + +def registerConfigurationInfo(String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { + def ConfigurationInfo = [configurationURL, configurationVersion, configurationSHA] + configurationCollection.put(configurationName, ConfigurationInfo) +} + +def registerPipelineScriptConfiguration() { + registerConfigurationInfo('pipeline script', '-', '-', getGitInfo("${WORKSPACE}")) +} + +def saveConfigurationInVersionInfo() { + dir("${WORKSPACE}\\version") { + writeFile file: 'configuration.txt', text: getFormattedConfiguration() + } +} + +String getFormattedConfiguration() { + String formattedInfo = "" + def keys = configurationCollection.keySet().sort() + for (key in keys) { + (configurationURL, configurationVersion, configurationSHA) = configurationCollection.get(key) + formattedLine = String.format("%s:%s,%s,%s%n", key, configurationURL, configurationVersion, configurationSHA) + formattedInfo += formattedLine + } + return formattedInfo +} + +def gitCheckoutAndRegister(String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { + githelper.gitCheckout(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) + registerConfigurationInfo(tool, gitURL, revision, getGitInfo(targetDir)) +} diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh new file mode 100644 index 0000000..1f6d88e --- /dev/null +++ b/versioncontrol/git.gsh @@ -0,0 +1,53 @@ +def commandlinehelper = load("Common_scripts/commandline/commandline.gsh") + +String getGitInfo(String workingSetRootPath) { + dir(workingSetRootPath) { + return commandlinehelper.getCommandOutput('git log -1 --format=oneline') + } +} + +def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { + checkout([ + $class: 'GitSCM', + userRemoteConfigs: [ + [url: gitURL] + ], + branches: [ + [name: revision] + ], + doGenerateSubmoduleConfigurations: false, + extensions: [ + [$class: 'CleanBeforeCheckout'], + [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: "${REPO_ROOT}/${repoRoot}", shallow: shallowClone, timeout: 120], + [$class: 'CheckoutOption', timeout: 60], + [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir] + ], + submoduleCfg: [], + ]) +} + +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 + } else { + version = "" + for (key in keys) { + nextversion = versions.get(key) + if (version == "") { + version = nextversion + } + if (nextversion != version) { + return false + } + } + } + return true +} From ca2db55d2bb2a292e1bc070eceff75f6c4721174 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Feb 2018 17:16:02 +0000 Subject: [PATCH 0066/1971] Move commonly used methods out to Common_scripts --- configuration/configuration.gsh | 4 ++-- versioncontrol/git.gsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index 424765e..1f86c42 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -1,4 +1,4 @@ -def githelper = load("Common_scripts/versioncontrol/git.gsh") +def gh = load("${WORKSPACE}/Common_scripts/versioncontrol/git.gsh") configurationCollection = [:] @@ -29,6 +29,6 @@ String getFormattedConfiguration() { } def gitCheckoutAndRegister(String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { - githelper.gitCheckout(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) + gh.gitCheckout(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) registerConfigurationInfo(tool, gitURL, revision, getGitInfo(targetDir)) } diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 1f6d88e..90dc7ee 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -1,8 +1,8 @@ -def commandlinehelper = load("Common_scripts/commandline/commandline.gsh") +def clh = load("${WORKSPACE}/Common_scripts/commandline/commandline.gsh") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { - return commandlinehelper.getCommandOutput('git log -1 --format=oneline') + return clh.getCommandOutput('git log -1 --format=oneline') } } From 1e0f22ed5e86d8e0765b764c7cedea1522280c98 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Feb 2018 17:19:29 +0000 Subject: [PATCH 0067/1971] Move commonly used methods out to Common_scripts --- commandline/commandline.gsh | 1 + 1 file changed, 1 insertion(+) diff --git a/commandline/commandline.gsh b/commandline/commandline.gsh index c03add7..df99a75 100644 --- a/commandline/commandline.gsh +++ b/commandline/commandline.gsh @@ -10,3 +10,4 @@ String getCommandOutput(String cmd) { } } +return this \ No newline at end of file From 4c6372bb8c06143a4a017e02368a40cfd53eb03c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Feb 2018 17:22:49 +0000 Subject: [PATCH 0068/1971] Move commonly used methods out to Common_scripts --- configuration/configuration.gsh | 2 ++ versioncontrol/git.gsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index 1f86c42..aa732e6 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -32,3 +32,5 @@ def gitCheckoutAndRegister(String tool, String gitURL, String revision, String t gh.gitCheckout(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) registerConfigurationInfo(tool, gitURL, revision, getGitInfo(targetDir)) } + +return this diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 90dc7ee..06e5b50 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -51,3 +51,5 @@ boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { } return true } + +return this \ No newline at end of file From a1448ac8509c0b512092295700f1f0a6f61bba27 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Feb 2018 17:27:26 +0000 Subject: [PATCH 0069/1971] Move commonly used methods out to Common_scripts --- configuration/configuration.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index aa732e6..976ebf8 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -8,7 +8,7 @@ def registerConfigurationInfo(String configurationName, String configurationURL, } def registerPipelineScriptConfiguration() { - registerConfigurationInfo('pipeline script', '-', '-', getGitInfo("${WORKSPACE}")) + registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${WORKSPACE}")) } def saveConfigurationInVersionInfo() { @@ -30,7 +30,7 @@ String getFormattedConfiguration() { def gitCheckoutAndRegister(String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { gh.gitCheckout(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) - registerConfigurationInfo(tool, gitURL, revision, getGitInfo(targetDir)) + registerConfigurationInfo(tool, gitURL, revision, gh.getGitInfo(targetDir)) } return this From d09d20c7b663d7a62cad3130ee91a05a96ab5f4a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Feb 2018 17:30:21 +0000 Subject: [PATCH 0070/1971] Move commonly used methods out to Common_scripts --- configuration/configuration.gsh | 2 +- versioncontrol/git.gsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index 976ebf8..29cd7e3 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -1,4 +1,4 @@ -def gh = load("${WORKSPACE}/Common_scripts/versioncontrol/git.gsh") +gh = load("${WORKSPACE}/Common_scripts/versioncontrol/git.gsh") configurationCollection = [:] diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 06e5b50..fd633eb 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -1,4 +1,4 @@ -def clh = load("${WORKSPACE}/Common_scripts/commandline/commandline.gsh") +clh = load("${WORKSPACE}/Common_scripts/commandline/commandline.gsh") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { From 9d32414fca002f779a7d924953dcf4cd7b7778a6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Feb 2018 18:16:20 +0000 Subject: [PATCH 0071/1971] Check for undefined REPO_ROOT environment variable --- versioncontrol/git.gsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index fd633eb..145045c 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -7,6 +7,13 @@ String getGitInfo(String workingSetRootPath) { } def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { + reporootenv = env.REPO_ROOT + if (reporootenv != mull && repoRoot != "") { + reporootpath = "${reporootenv.trim()}/${repoRoot}" + } else { + reporootpath = "" + 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" + } checkout([ $class: 'GitSCM', userRemoteConfigs: [ @@ -18,7 +25,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: "${REPO_ROOT}/${repoRoot}", shallow: shallowClone, timeout: 120], + [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 60], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir] ], From 69be84aac0e12da69f55d2c5b01f7ad22f775922 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Feb 2018 18:17:26 +0000 Subject: [PATCH 0072/1971] Check for undefined REPO_ROOT environment variable --- versioncontrol/git.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 145045c..70fe6bc 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -8,7 +8,7 @@ String getGitInfo(String workingSetRootPath) { def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { reporootenv = env.REPO_ROOT - if (reporootenv != mull && repoRoot != "") { + if (reporootenv != null && repoRoot != "") { reporootpath = "${reporootenv.trim()}/${repoRoot}" } else { reporootpath = "" From d1a8c098a6ba03fe5461f82db036de2f48aa2c62 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Feb 2018 17:50:05 +0000 Subject: [PATCH 0073/1971] Make the version number 1.20000.x if the branch name is .x or ..x --- versionnumbering/versioninfo.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 59b5225..45fd1ca 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -65,10 +65,14 @@ def getGitRevision(gitrootpath, basenumber): return (adjustedchangecount, revision, remoteinfo) -def getVersionPrefix(sourcebranch): +# Handle: +# origin/master +# origin/2.0.x + def getVersionPrefix(sourcebranch): print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) defaultversionprefix = "1.30000.0." + mastertypeversionprefix = "1.20000.0." splits = sourcebranch.split('/') if len(splits) < 1: print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) @@ -77,7 +81,7 @@ def getVersionPrefix(sourcebranch): sourcebranch = splits[-1] if sourcebranch.lower().endswith("master"): # Special case - return "1.20000.0." + return mastertypeversionprefix splits = sourcebranch.split('.') versionprefix = "" @@ -86,21 +90,27 @@ def getVersionPrefix(sourcebranch): versionprefix = defaultversionprefix else: splitnumbercount = 0 + isIntermediateReleaseBranch = false for split in splits: if split.isdigit(): versionprefix += split + "." splitnumbercount += 1 else: + if split == "x": + isIntermediateReleaseBranch = true break if splitnumbercount > 2: break if splitnumbercount == 0: print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) versionprefix = defaultversionprefix - elif splitnumbercount == 1: - versionprefix += "0.0." - elif splitnumbercount == 2: - versionprefix += "0." + else: + if isIntermediateReleaseBranch: + versionprefix = mastertypeversionprefix + elif splitnumbercount == 1: + versionprefix += "0.0." + elif splitnumbercount == 2: + versionprefix += "0." print("Determined version prefix to be: {0}".format(versionprefix)) return versionprefix From 061b3d4fcfb9fe3f0a853b63cf6ea48ea8f1ce0b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Feb 2018 18:14:49 +0000 Subject: [PATCH 0074/1971] Make the version number 1.20000.x if the branch name is .x or ..x --- .pydevproject | 2 +- versionnumbering/versioninfo.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pydevproject b/.pydevproject index d111c07..1ce5929 100644 --- a/.pydevproject +++ b/.pydevproject @@ -3,6 +3,6 @@ /${PROJECT_DIR_NAME} -python interpreter +python 2.7 python35 diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 45fd1ca..d9e6681 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -68,7 +68,7 @@ def getGitRevision(gitrootpath, basenumber): # Handle: # origin/master # origin/2.0.x - def getVersionPrefix(sourcebranch): +def getVersionPrefix(sourcebranch): print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) defaultversionprefix = "1.30000.0." @@ -90,14 +90,14 @@ def getGitRevision(gitrootpath, basenumber): versionprefix = defaultversionprefix else: splitnumbercount = 0 - isIntermediateReleaseBranch = false + isIntermediateReleaseBranch = False for split in splits: if split.isdigit(): versionprefix += split + "." splitnumbercount += 1 else: if split == "x": - isIntermediateReleaseBranch = true + isIntermediateReleaseBranch = True break if splitnumbercount > 2: break From 9af8da5da65ee4420ce6394e5c34c3fedf9fef8f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Feb 2018 11:13:49 +0000 Subject: [PATCH 0075/1971] gitrevision.txt and revision.txt file content were mixed up with previous way of generating version folder --- versionnumbering/versioninfo.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index d9e6681..25644a6 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -115,7 +115,7 @@ def getVersionPrefix(sourcebranch): print("Determined version prefix to be: {0}".format(versionprefix)) return versionprefix -def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, remoteinfo, buildnumber, buildstamp): +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp): with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: f.write(buildjobname) @@ -123,6 +123,9 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, r f.write(versionprefix) with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(gitrevisioncount) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: f.write(gitrevision) with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: @@ -195,7 +198,7 @@ USAGE buildstamp = versionprefix + str(gitrevisioncount) print("Build stamp is: {0}".format(buildstamp)) - writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevision, remoteinfo, buildnumber, buildstamp) + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp) return 0 except Exception as e: From d3ba4321ae5b3e3bedf77ec23d232a66b927c7f8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Feb 2018 11:38:11 +0000 Subject: [PATCH 0076/1971] The print server base revision number is 5000 --- versionnumbering/versioninfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 25644a6..9a7cd6a 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -123,7 +123,7 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou f.write(versionprefix) with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: - f.write(gitrevisioncount) + f.write(str(gitrevisioncount)) with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: f.write(gitrevision) From 96bba5d019bd9ee913af8abc5a930ba086f3d513 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 21 Feb 2018 13:28:27 +0000 Subject: [PATCH 0077/1971] Provide a parameter for deciding where files are exported --- build/eclipsebuild/eclipsebuild.gsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 367b454..30fe4d5 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -1,24 +1,24 @@ // Build and export files -def doBuild(apps) { +def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { (build, project, variants, exportpath) = appInfo if (build) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - } + } else { bat """ - "%BUILD_COMMAND%" -build "${project}\\${build_variant}" - """ + "%BUILD_COMMAND%" -build "${project}\\${build_variant}" + """ } } if (exportpath) { echo "Export path at: ${exportpath}" script { - env.destFolder = "${WORKSPACE}/export/${build_variant}/${project}" + env.destFolder = "${exportfolder}/${build_variant}/${project}" env.srcFile = "${WORKSPACE}/${exportpath}" env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } From 99bb2d6465220a29e7a3dfd7031dd49454f5013f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 21 Feb 2018 13:28:27 +0000 Subject: [PATCH 0078/1971] Provide a parameter for deciding where files are exported --- build/eclipsebuild/eclipsebuild.gsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/build/eclipsebuild/eclipsebuild.gsh index 367b454..30fe4d5 100644 --- a/build/eclipsebuild/eclipsebuild.gsh +++ b/build/eclipsebuild/eclipsebuild.gsh @@ -1,24 +1,24 @@ // Build and export files -def doBuild(apps) { +def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { (build, project, variants, exportpath) = appInfo if (build) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { - echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - } + } else { bat """ - "%BUILD_COMMAND%" -build "${project}\\${build_variant}" - """ + "%BUILD_COMMAND%" -build "${project}\\${build_variant}" + """ } } if (exportpath) { echo "Export path at: ${exportpath}" script { - env.destFolder = "${WORKSPACE}/export/${build_variant}/${project}" + env.destFolder = "${exportfolder}/${build_variant}/${project}" env.srcFile = "${WORKSPACE}/${exportpath}" env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } From 1f266505b15e668a63d58fd67b1a6b1d01e42f05 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 21 Feb 2018 16:47:21 +0000 Subject: [PATCH 0079/1971] Configuration information was not being written into version folder on linux machine --- configuration/configuration.gsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index 29cd7e3..b91e0a3 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -12,7 +12,8 @@ def registerPipelineScriptConfiguration() { } def saveConfigurationInVersionInfo() { - dir("${WORKSPACE}\\version") { + dir("${WORKSPACE}/version") { + echo "Writing configuration info to ${WORKSPACE}/version/configuration.txt" writeFile file: 'configuration.txt', text: getFormattedConfiguration() } } From 96ac5a636249e5ccb392cc2c78755de22afd4044 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 21 Feb 2018 16:47:21 +0000 Subject: [PATCH 0080/1971] Configuration information was not being written into version folder on linux machine --- configuration/configuration.gsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index 29cd7e3..b91e0a3 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -12,7 +12,8 @@ def registerPipelineScriptConfiguration() { } def saveConfigurationInVersionInfo() { - dir("${WORKSPACE}\\version") { + dir("${WORKSPACE}/version") { + echo "Writing configuration info to ${WORKSPACE}/version/configuration.txt" writeFile file: 'configuration.txt', text: getFormattedConfiguration() } } From 049b242a2a93c3e8efb4037ca6b82c3759b1baf6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Feb 2018 13:00:31 +0000 Subject: [PATCH 0081/1971] Change folders and files to match convention --- .../eclipsebuild.gsh => compile/eclipsebuild/eclipseds5build.gsh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build/eclipsebuild/eclipsebuild.gsh => compile/eclipsebuild/eclipseds5build.gsh (100%) diff --git a/build/eclipsebuild/eclipsebuild.gsh b/compile/eclipsebuild/eclipseds5build.gsh similarity index 100% rename from build/eclipsebuild/eclipsebuild.gsh rename to compile/eclipsebuild/eclipseds5build.gsh From 17eae1e1357f6e7d3361639dc3bf184bd308f9bc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Feb 2018 09:17:05 +0000 Subject: [PATCH 0082/1971] Save the slave machine name in the version folder --- versionnumbering/versioninfo.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 9a7cd6a..a9d8738 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -22,6 +22,7 @@ __date__ = '2017-11-29' __updated__ = '2017-11-29' gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") +slaveMachine = os.getenv("NODE_NAME", default="-") def resetFolder(versionfolder): print("Removing folders and contents of: {0}".format(versionfolder)) @@ -141,6 +142,9 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: f.write(buildstampcommasep) + with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: + f.write(slaveMachine) + def main(argv=None): # IGNORE:C0111 '''Command line options.''' From 0fd3b357a5c46a2146adb90dab356b4767a959f0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 15:22:13 +0100 Subject: [PATCH 0083/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 52 +++++++++++++++--------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 30fe4d5..e17f4b9 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,7 +1,34 @@ + +def doExport(exportpathlist, build_variant = "") { + for (exportpath in exportpathlist) { + echo "Export path at: ${exportpath}" + script { + if (build_variant) { + env.destFolder = "${exportfolder}/${build_variant}/${project}" + env.srcFile = "${WORKSPACE}/${exportpath}" + env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + } + else { + env.destFolder = "${exportfolder}/${project}" + env.srcFileExpanded = "${WORKSPACE}/${exportpath}" + } + } + dir (env.destFolder) { + echo "Copy ${srcFileExpanded} to ${destFolder}" + if (isUnix()) { + sh 'cp \"${srcFileExpanded}\" ${destFolder}' + } + else { + bat 'copy \"%srcFileExpanded%\" %destFolder%' + } + } + } +} + // Build and export files def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, project, variants, exportpath) = appInfo + (build, project, variants, exportpathlist) = appInfo if (build) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -15,27 +42,12 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { """ } } - if (exportpath) { - echo "Export path at: ${exportpath}" - script { - env.destFolder = "${exportfolder}/${build_variant}/${project}" - env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") - } - dir (env.destFolder) { - if (exportpath) { - echo "Copy ${srcFileExpanded} to ${destFolder}" - if (isUnix()) { - sh 'cp \"${srcFileExpanded}\" ${destFolder}' - } - else { - bat 'copy \"%srcFileExpanded%\" %destFolder%' - } - } - } - } + doExport(exportpathlist, build_variant) } } + else { + doExport(exportpathlist, build_variant) + } } } From 423e88d3221238b488c2c1b9eeaa6bfe77d4f383 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 15:22:13 +0100 Subject: [PATCH 0084/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 52 +++++++++++++++--------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 30fe4d5..e17f4b9 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,7 +1,34 @@ + +def doExport(exportpathlist, build_variant = "") { + for (exportpath in exportpathlist) { + echo "Export path at: ${exportpath}" + script { + if (build_variant) { + env.destFolder = "${exportfolder}/${build_variant}/${project}" + env.srcFile = "${WORKSPACE}/${exportpath}" + env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + } + else { + env.destFolder = "${exportfolder}/${project}" + env.srcFileExpanded = "${WORKSPACE}/${exportpath}" + } + } + dir (env.destFolder) { + echo "Copy ${srcFileExpanded} to ${destFolder}" + if (isUnix()) { + sh 'cp \"${srcFileExpanded}\" ${destFolder}' + } + else { + bat 'copy \"%srcFileExpanded%\" %destFolder%' + } + } + } +} + // Build and export files def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, project, variants, exportpath) = appInfo + (build, project, variants, exportpathlist) = appInfo if (build) { for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -15,27 +42,12 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { """ } } - if (exportpath) { - echo "Export path at: ${exportpath}" - script { - env.destFolder = "${exportfolder}/${build_variant}/${project}" - env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") - } - dir (env.destFolder) { - if (exportpath) { - echo "Copy ${srcFileExpanded} to ${destFolder}" - if (isUnix()) { - sh 'cp \"${srcFileExpanded}\" ${destFolder}' - } - else { - bat 'copy \"%srcFileExpanded%\" %destFolder%' - } - } - } - } + doExport(exportpathlist, build_variant) } } + else { + doExport(exportpathlist, build_variant) + } } } From 3065c8d9b9e9a9972f3152c9c7ce745d2fcb74de Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 15:34:48 +0100 Subject: [PATCH 0085/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index e17f4b9..065e64a 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -34,8 +34,8 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - } + sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + } else { bat """ "%BUILD_COMMAND%" -build "${project}\\${build_variant}" @@ -46,7 +46,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } else { - doExport(exportpathlist, build_variant) + doExport(exportpathlist) } } } From a34f8ee1e896397e4e1eb7a7ca5331c07b748878 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 15:34:48 +0100 Subject: [PATCH 0086/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index e17f4b9..065e64a 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -34,8 +34,8 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) if (isUnix()) { echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - } + sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + } else { bat """ "%BUILD_COMMAND%" -build "${project}\\${build_variant}" @@ -46,7 +46,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } else { - doExport(exportpathlist, build_variant) + doExport(exportpathlist) } } } From 4d3c9f6bc61833e67a5dee4d662056bb4d8c5278 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 15:47:21 +0100 Subject: [PATCH 0087/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 065e64a..f0700b4 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,5 +1,5 @@ -def doExport(exportpathlist, build_variant = "") { +def doExport(exportfolder, exportpathlist, build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { @@ -42,11 +42,11 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { """ } } - doExport(exportpathlist, build_variant) + doExport(exportfolder, exportpathlist, build_variant) } } else { - doExport(exportpathlist) + doExport(exportfolder, exportpathlist) } } } From 07a0a49d06993d2423a87e5c9bbef438e1cce3ff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 15:47:21 +0100 Subject: [PATCH 0088/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 065e64a..f0700b4 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,5 +1,5 @@ -def doExport(exportpathlist, build_variant = "") { +def doExport(exportfolder, exportpathlist, build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { @@ -42,11 +42,11 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { """ } } - doExport(exportpathlist, build_variant) + doExport(exportfolder, exportpathlist, build_variant) } } else { - doExport(exportpathlist) + doExport(exportfolder, exportpathlist) } } } From cf844016bcc19a9d7420f908247f0590464541cc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 16:06:33 +0100 Subject: [PATCH 0089/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index f0700b4..ca4fd2c 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -16,7 +16,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh 'cp \"${srcFileExpanded}\" ${destFolder}' + sh 'cp -v \"${srcFileExpanded}\" ${destFolder}' } else { bat 'copy \"%srcFileExpanded%\" %destFolder%' From 783c61598d02d01722eb6f50812693a6b4683431 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 16:06:33 +0100 Subject: [PATCH 0090/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index f0700b4..ca4fd2c 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -16,7 +16,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh 'cp \"${srcFileExpanded}\" ${destFolder}' + sh 'cp -v \"${srcFileExpanded}\" ${destFolder}' } else { bat 'copy \"%srcFileExpanded%\" %destFolder%' From 6e55704be9cf8e88dfca50564712c00df65894d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 16:26:27 +0100 Subject: [PATCH 0091/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index ca4fd2c..0801386 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -16,10 +16,13 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh 'cp -v \"${srcFileExpanded}\" ${destFolder}' + sh """ + echo cp -v -\"${srcFileExpanded}\"- -\"${destFolder}\"- + cp -v \"${srcFileExpanded}\" \"${destFolder}\" + """ } else { - bat 'copy \"%srcFileExpanded%\" %destFolder%' + bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' } } } From e77d9f03a1da9ae10211c8120f1947e916413e73 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 16:26:27 +0100 Subject: [PATCH 0092/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index ca4fd2c..0801386 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -16,10 +16,13 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh 'cp -v \"${srcFileExpanded}\" ${destFolder}' + sh """ + echo cp -v -\"${srcFileExpanded}\"- -\"${destFolder}\"- + cp -v \"${srcFileExpanded}\" \"${destFolder}\" + """ } else { - bat 'copy \"%srcFileExpanded%\" %destFolder%' + bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' } } } From 50af99352789d1c257d5177f6338af7cb9ac87ff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 16:43:32 +0100 Subject: [PATCH 0093/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 0801386..357e64a 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -16,10 +16,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh """ - echo cp -v -\"${srcFileExpanded}\"- -\"${destFolder}\"- - cp -v \"${srcFileExpanded}\" \"${destFolder}\" - """ + sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From c937856bfd2d3a5ca3258ecf43717d522315e247 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 16:43:32 +0100 Subject: [PATCH 0094/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 0801386..357e64a 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -16,10 +16,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh """ - echo cp -v -\"${srcFileExpanded}\"- -\"${destFolder}\"- - cp -v \"${srcFileExpanded}\" \"${destFolder}\" - """ + sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From f5cecd05c51dfafe9f3d624f652d976b57a37c22 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 16:55:28 +0100 Subject: [PATCH 0095/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 357e64a..477d68d 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -16,7 +16,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\" + sh 'cp -v \"${srcFileExpanded}\" \"${destFolder}\"' } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From 142e5955443a97e25d2410689e0f9356a76219b0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 16:55:28 +0100 Subject: [PATCH 0096/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 357e64a..477d68d 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -16,7 +16,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy ${srcFileExpanded} to ${destFolder}" if (isUnix()) { - sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\" + sh 'cp -v \"${srcFileExpanded}\" \"${destFolder}\"' } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From c2aa61e21b64e877572bac9cfba4a7b7011f67c1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 17:22:08 +0100 Subject: [PATCH 0097/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 477d68d..fc8ecd0 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -14,9 +14,9 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { } } dir (env.destFolder) { - echo "Copy ${srcFileExpanded} to ${destFolder}" + echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh 'cp -v \"${srcFileExpanded}\" \"${destFolder}\"' + bash 'cp -v \"${srcFileExpanded}\" \"${destFolder}\"' } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From 8c63eee9697553883202fb26e1cc9ef97a4ff469 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 17:22:08 +0100 Subject: [PATCH 0098/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 477d68d..fc8ecd0 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -14,9 +14,9 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { } } dir (env.destFolder) { - echo "Copy ${srcFileExpanded} to ${destFolder}" + echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh 'cp -v \"${srcFileExpanded}\" \"${destFolder}\"' + bash 'cp -v \"${srcFileExpanded}\" \"${destFolder}\"' } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From c0f941f390ce39af39052fd7aed9e28c713ca1e4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 17:25:12 +0100 Subject: [PATCH 0099/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index fc8ecd0..b91e487 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -14,9 +14,11 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { } } dir (env.destFolder) { + echo 'Copy \"${srcFileExpanded}\" to \"${destFolder}\"' echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - bash 'cp -v \"${srcFileExpanded}\" \"${destFolder}\"' + echo "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From 585ddabcf5570d1f1c7133d74fce7524596283e4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 17:25:12 +0100 Subject: [PATCH 0100/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index fc8ecd0..b91e487 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -14,9 +14,11 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { } } dir (env.destFolder) { + echo 'Copy \"${srcFileExpanded}\" to \"${destFolder}\"' echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - bash 'cp -v \"${srcFileExpanded}\" \"${destFolder}\"' + echo "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From 9a8a5d5be9df6bcadc61006c012a2718d10aebb8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 17:50:08 +0100 Subject: [PATCH 0101/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index b91e487..9544faf 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -15,10 +15,8 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { } dir (env.destFolder) { echo 'Copy \"${srcFileExpanded}\" to \"${destFolder}\"' - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - echo "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" - sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh "cp -v ${srcFileExpanded} \"${destFolder}\"" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From ec69c45d90ce01745dd5c828e0292471f0f4054b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 17:50:08 +0100 Subject: [PATCH 0102/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index b91e487..9544faf 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -15,10 +15,8 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { } dir (env.destFolder) { echo 'Copy \"${srcFileExpanded}\" to \"${destFolder}\"' - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - echo "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" - sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh "cp -v ${srcFileExpanded} \"${destFolder}\"" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From 9f58f571b3a0c1d61b31d7898577ce65c71c14ba Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 18:30:39 +0100 Subject: [PATCH 0103/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9544faf..5b113d3 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -3,20 +3,23 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { + echo "Build variant is ${build_variant}" if (build_variant) { + echo "Build variant is ${build_variant}" env.destFolder = "${exportfolder}/${build_variant}/${project}" env.srcFile = "${WORKSPACE}/${exportpath}" env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { + echo "No build variant" env.destFolder = "${exportfolder}/${project}" env.srcFileExpanded = "${WORKSPACE}/${exportpath}" } } dir (env.destFolder) { - echo 'Copy \"${srcFileExpanded}\" to \"${destFolder}\"' + echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -v ${srcFileExpanded} \"${destFolder}\"" + sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From 20a392db61328799b2357b2b38dff56ed95566b8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 18:30:39 +0100 Subject: [PATCH 0104/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9544faf..5b113d3 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -3,20 +3,23 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { + echo "Build variant is ${build_variant}" if (build_variant) { + echo "Build variant is ${build_variant}" env.destFolder = "${exportfolder}/${build_variant}/${project}" env.srcFile = "${WORKSPACE}/${exportpath}" env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { + echo "No build variant" env.destFolder = "${exportfolder}/${project}" env.srcFileExpanded = "${WORKSPACE}/${exportpath}" } } dir (env.destFolder) { - echo 'Copy \"${srcFileExpanded}\" to \"${destFolder}\"' + echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -v ${srcFileExpanded} \"${destFolder}\"" + sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From f91450c701b9362f96af554203bcace59f5190f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 18:56:17 +0100 Subject: [PATCH 0105/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5b113d3..d9b2a92 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -49,7 +49,10 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } else { - doExport(exportfolder, exportpathlist) + // Only export if the project has no variants - signifying that there are files to export which have been prebuilt + if (!variants) { + doExport(exportfolder, exportpathlist) + } } } } From 93443e340ddb102379ccb8dc25168d6f3a8e7bc9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 12 Jun 2018 18:56:17 +0100 Subject: [PATCH 0106/1971] HMBXR5601-143 - Handle projects that aren't built but do provide binaries --- compile/eclipsebuild/eclipseds5build.gsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5b113d3..d9b2a92 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -49,7 +49,10 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } else { - doExport(exportfolder, exportpathlist) + // Only export if the project has no variants - signifying that there are files to export which have been prebuilt + if (!variants) { + doExport(exportfolder, exportpathlist) + } } } } From 1c16f4b5a0cca936bc2466e2451a7ef89ad5e6e0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 25 Jun 2018 13:50:09 +0100 Subject: [PATCH 0107/1971] HMBXR5601-233 - Extend checkout timeout to 2 hours --- versioncontrol/git.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 70fe6bc..9d96232 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -26,7 +26,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo extensions: [ [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], - [$class: 'CheckoutOption', timeout: 60], + [$class: 'CheckoutOption', timeout: 120], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir] ], submoduleCfg: [], From 305ae709aacbf8cf203263211ac376f8eea2114f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 25 Jun 2018 13:50:09 +0100 Subject: [PATCH 0108/1971] HMBXR5601-233 - Extend checkout timeout to 2 hours --- versioncontrol/git.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 70fe6bc..9d96232 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -26,7 +26,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo extensions: [ [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], - [$class: 'CheckoutOption', timeout: 60], + [$class: 'CheckoutOption', timeout: 120], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir] ], submoduleCfg: [], From b41f1885a0dcb61754d2a5003051c54197cb0b90 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 6 Jul 2018 11:47:15 +0100 Subject: [PATCH 0109/1971] Add build switch to perform clean builds --- compile/eclipsebuild/eclipseds5build.gsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index d9b2a92..5acc0ae 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -31,17 +31,23 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { // Build and export files def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, project, variants, exportpathlist) = appInfo + (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { + if (cleanbuild) { + buildtype = "-cleanBuild" + } + else { + buildtype = "-build" + } for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) + echo "Build command: ${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" if (isUnix()) { - echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + sh "${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" } else { bat """ - "%BUILD_COMMAND%" -build "${project}\\${build_variant}" + "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" """ } } From 8f69abb656f35569c21f193d5620057302fcd90d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 6 Jul 2018 11:47:15 +0100 Subject: [PATCH 0110/1971] Add build switch to perform clean builds --- compile/eclipsebuild/eclipseds5build.gsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index d9b2a92..5acc0ae 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -31,17 +31,23 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { // Build and export files def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, project, variants, exportpathlist) = appInfo + (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { + if (cleanbuild) { + buildtype = "-cleanBuild" + } + else { + buildtype = "-build" + } for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) + echo "Build command: ${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" if (isUnix()) { - echo "Build command: ${BUILD_COMMAND} -build \"${project}/${build_variant}\"" - sh "${BUILD_COMMAND} -build \"${project}/${build_variant}\"" + sh "${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" } else { bat """ - "%BUILD_COMMAND%" -build "${project}\\${build_variant}" + "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" """ } } From ef5bcc9ffe7ade78c0eee7271e9e9dbe9eb671f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 7 Jul 2018 19:25:33 +0100 Subject: [PATCH 0111/1971] Use LFS for all checkouts --- versioncontrol/git.gsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 9d96232..dbc09ff 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -24,6 +24,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo ], doGenerateSubmoduleConfigurations: false, extensions: [ + [$class: 'GitLFSPull'], [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], @@ -59,4 +60,4 @@ boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { return true } -return this \ No newline at end of file +return this From 746ff1edf90bd64747cc4abeb394870a3302245c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Jul 2018 19:08:38 +0100 Subject: [PATCH 0112/1971] HMBXR5601-328 - Use make instead of eclipsebuild --- compile/eclipsebuild/eclipseds5build.gsh | 55 ++++++++++++++++++++---- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5acc0ae..16854b7 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,37 +1,44 @@ -def doExport(exportfolder, exportpathlist, build_variant = "") { +def doExport(exportfolder, exportpathlist, build_variant = "", project_root = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" + env.srcFile = "${WORKSPACE}/${exportpath}" script { echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" env.destFolder = "${exportfolder}/${build_variant}/${project}" - env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + env.srcFile = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" env.destFolder = "${exportfolder}/${project}" - env.srcFileExpanded = "${WORKSPACE}/${exportpath}" + } + echo "Project root is ${project_root}" + if (project_root) { + echo "Project root is ${project_root}" + env.srcFile = srcFile.replace("-PROJECTROOT-", "${project_root}") + } + else { + echo "No project root" } } dir (env.destFolder) { - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" + echo "Copy \"${srcFile}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh "cp -v \"${srcFile}\" \"${destFolder}\"" } else { - bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' + bat 'copy \"%srcFile%\" \"%destFolder%\"' } } } } -// Build and export files +// Build and export files using Eclipse project files (unreliable) def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo + (build, cleanbuild, project, projectroot, variants, exportpathlist) = appInfo if (build) { if (cleanbuild) { buildtype = "-cleanBuild" @@ -63,4 +70,34 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } +// Build and export files using make files generated by Eclipse +def doMake(apps, exportfolder = "${WORKSPACE}/bin") { + for (appInfo in apps ) { + (build, cleanbuild, project, projectroot, variants, exportpathlist) = appInfo + if (build) { + for (build_variant in variants) { + echo "Changing directory to: ${WORKSPACE}/${projectroot}/${build_variant}" + dir("${WORKSPACE}/${projectroot}/${build_variant}") { + echo "Build command: ${BUILD_COMMAND}" + if (isUnix()) { + sh "${BUILD_COMMAND}" + } + else { + bat """ + "%BUILD_COMMAND%" + """ + } + } + doExport(exportfolder, exportpathlist, build_variant, projectroot) + } + } + else { + // Only export if the project has no variants - signifying that there are files to export which have been prebuilt + if (!variants) { + doExport(exportfolder, exportpathlist) + } + } + } +} + return this; From beaf754ea2eb644061322886d629740856492517 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Jul 2018 19:08:38 +0100 Subject: [PATCH 0113/1971] HMBXR5601-328 - Use make instead of eclipsebuild --- compile/eclipsebuild/eclipseds5build.gsh | 55 ++++++++++++++++++++---- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5acc0ae..16854b7 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,37 +1,44 @@ -def doExport(exportfolder, exportpathlist, build_variant = "") { +def doExport(exportfolder, exportpathlist, build_variant = "", project_root = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" + env.srcFile = "${WORKSPACE}/${exportpath}" script { echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" env.destFolder = "${exportfolder}/${build_variant}/${project}" - env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + env.srcFile = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" env.destFolder = "${exportfolder}/${project}" - env.srcFileExpanded = "${WORKSPACE}/${exportpath}" + } + echo "Project root is ${project_root}" + if (project_root) { + echo "Project root is ${project_root}" + env.srcFile = srcFile.replace("-PROJECTROOT-", "${project_root}") + } + else { + echo "No project root" } } dir (env.destFolder) { - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" + echo "Copy \"${srcFile}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh "cp -v \"${srcFile}\" \"${destFolder}\"" } else { - bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' + bat 'copy \"%srcFile%\" \"%destFolder%\"' } } } } -// Build and export files +// Build and export files using Eclipse project files (unreliable) def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo + (build, cleanbuild, project, projectroot, variants, exportpathlist) = appInfo if (build) { if (cleanbuild) { buildtype = "-cleanBuild" @@ -63,4 +70,34 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } +// Build and export files using make files generated by Eclipse +def doMake(apps, exportfolder = "${WORKSPACE}/bin") { + for (appInfo in apps ) { + (build, cleanbuild, project, projectroot, variants, exportpathlist) = appInfo + if (build) { + for (build_variant in variants) { + echo "Changing directory to: ${WORKSPACE}/${projectroot}/${build_variant}" + dir("${WORKSPACE}/${projectroot}/${build_variant}") { + echo "Build command: ${BUILD_COMMAND}" + if (isUnix()) { + sh "${BUILD_COMMAND}" + } + else { + bat """ + "%BUILD_COMMAND%" + """ + } + } + doExport(exportfolder, exportpathlist, build_variant, projectroot) + } + } + else { + // Only export if the project has no variants - signifying that there are files to export which have been prebuilt + if (!variants) { + doExport(exportfolder, exportpathlist) + } + } + } +} + return this; From f8da7ad8735351777617d24bd92d5caf47af28ad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Jul 2018 19:17:33 +0100 Subject: [PATCH 0114/1971] HMBXR5601-328 - Use make instead of eclipsebuild --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 16854b7..73c15a3 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -73,7 +73,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { // Build and export files using make files generated by Eclipse def doMake(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, cleanbuild, project, projectroot, variants, exportpathlist) = appInfo + (build, cleanbuild, project, variants, projectroot, exportpathlist) = appInfo if (build) { for (build_variant in variants) { echo "Changing directory to: ${WORKSPACE}/${projectroot}/${build_variant}" From c902757cc8becc57849a537b6d0e5e3216d98e4e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Jul 2018 19:17:33 +0100 Subject: [PATCH 0115/1971] HMBXR5601-328 - Use make instead of eclipsebuild --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 16854b7..73c15a3 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -73,7 +73,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { // Build and export files using make files generated by Eclipse def doMake(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, cleanbuild, project, projectroot, variants, exportpathlist) = appInfo + (build, cleanbuild, project, variants, projectroot, exportpathlist) = appInfo if (build) { for (build_variant in variants) { echo "Changing directory to: ${WORKSPACE}/${projectroot}/${build_variant}" From 3931e9b6d98671a295786267eb3ea470ca325b30 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 12:53:34 +0100 Subject: [PATCH 0116/1971] Revert "HMBXR5601-328 - Use make instead of eclipsebuild" This reverts commit 5e1e0c9d47cfaa4c366b84da4f8a583c93ae9693. --- compile/eclipsebuild/eclipseds5build.gsh | 55 ++++-------------------- 1 file changed, 9 insertions(+), 46 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 73c15a3..5acc0ae 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,44 +1,37 @@ -def doExport(exportfolder, exportpathlist, build_variant = "", project_root = "") { +def doExport(exportfolder, exportpathlist, build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" - env.srcFile = "${WORKSPACE}/${exportpath}" script { echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" env.destFolder = "${exportfolder}/${build_variant}/${project}" - env.srcFile = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + env.srcFile = "${WORKSPACE}/${exportpath}" + env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" env.destFolder = "${exportfolder}/${project}" - } - echo "Project root is ${project_root}" - if (project_root) { - echo "Project root is ${project_root}" - env.srcFile = srcFile.replace("-PROJECTROOT-", "${project_root}") - } - else { - echo "No project root" + env.srcFileExpanded = "${WORKSPACE}/${exportpath}" } } dir (env.destFolder) { - echo "Copy \"${srcFile}\" to \"${destFolder}\"" + echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -v \"${srcFile}\" \"${destFolder}\"" + sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" } else { - bat 'copy \"%srcFile%\" \"%destFolder%\"' + bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' } } } } -// Build and export files using Eclipse project files (unreliable) +// Build and export files def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, cleanbuild, project, projectroot, variants, exportpathlist) = appInfo + (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { if (cleanbuild) { buildtype = "-cleanBuild" @@ -70,34 +63,4 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } -// Build and export files using make files generated by Eclipse -def doMake(apps, exportfolder = "${WORKSPACE}/bin") { - for (appInfo in apps ) { - (build, cleanbuild, project, variants, projectroot, exportpathlist) = appInfo - if (build) { - for (build_variant in variants) { - echo "Changing directory to: ${WORKSPACE}/${projectroot}/${build_variant}" - dir("${WORKSPACE}/${projectroot}/${build_variant}") { - echo "Build command: ${BUILD_COMMAND}" - if (isUnix()) { - sh "${BUILD_COMMAND}" - } - else { - bat """ - "%BUILD_COMMAND%" - """ - } - } - doExport(exportfolder, exportpathlist, build_variant, projectroot) - } - } - else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt - if (!variants) { - doExport(exportfolder, exportpathlist) - } - } - } -} - return this; From 1869a40da9c9211225b68cc372e835149d588dad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 12:53:34 +0100 Subject: [PATCH 0117/1971] Revert "HMBXR5601-328 - Use make instead of eclipsebuild" This reverts commit 5e1e0c9d47cfaa4c366b84da4f8a583c93ae9693. --- compile/eclipsebuild/eclipseds5build.gsh | 55 ++++-------------------- 1 file changed, 9 insertions(+), 46 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 73c15a3..5acc0ae 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,44 +1,37 @@ -def doExport(exportfolder, exportpathlist, build_variant = "", project_root = "") { +def doExport(exportfolder, exportpathlist, build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" - env.srcFile = "${WORKSPACE}/${exportpath}" script { echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" env.destFolder = "${exportfolder}/${build_variant}/${project}" - env.srcFile = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + env.srcFile = "${WORKSPACE}/${exportpath}" + env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" env.destFolder = "${exportfolder}/${project}" - } - echo "Project root is ${project_root}" - if (project_root) { - echo "Project root is ${project_root}" - env.srcFile = srcFile.replace("-PROJECTROOT-", "${project_root}") - } - else { - echo "No project root" + env.srcFileExpanded = "${WORKSPACE}/${exportpath}" } } dir (env.destFolder) { - echo "Copy \"${srcFile}\" to \"${destFolder}\"" + echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -v \"${srcFile}\" \"${destFolder}\"" + sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" } else { - bat 'copy \"%srcFile%\" \"%destFolder%\"' + bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' } } } } -// Build and export files using Eclipse project files (unreliable) +// Build and export files def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (appInfo in apps ) { - (build, cleanbuild, project, projectroot, variants, exportpathlist) = appInfo + (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { if (cleanbuild) { buildtype = "-cleanBuild" @@ -70,34 +63,4 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } -// Build and export files using make files generated by Eclipse -def doMake(apps, exportfolder = "${WORKSPACE}/bin") { - for (appInfo in apps ) { - (build, cleanbuild, project, variants, projectroot, exportpathlist) = appInfo - if (build) { - for (build_variant in variants) { - echo "Changing directory to: ${WORKSPACE}/${projectroot}/${build_variant}" - dir("${WORKSPACE}/${projectroot}/${build_variant}") { - echo "Build command: ${BUILD_COMMAND}" - if (isUnix()) { - sh "${BUILD_COMMAND}" - } - else { - bat """ - "%BUILD_COMMAND%" - """ - } - } - doExport(exportfolder, exportpathlist, build_variant, projectroot) - } - } - else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt - if (!variants) { - doExport(exportfolder, exportpathlist) - } - } - } -} - return this; From 2517f7bdc0a793b8a1a9c5671a2008725ee1e029 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 18:25:03 +0100 Subject: [PATCH 0118/1971] Seperate DS5 shell command from build command --- compile/eclipsebuild/eclipseds5build.gsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5acc0ae..347f723 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -43,11 +43,14 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) echo "Build command: ${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" if (isUnix()) { - sh "${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" + ${DS5SHELL} \'${BUILD_COMMAND} -no-indexer -importAll "${SOURCE_PATH}"\' + sh """ + ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + """ } else { bat """ - "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" + "%DS5SHELL%" "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" """ } } From aff5898578ed7fe931d7ca03a9c000630551f136 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 18:25:03 +0100 Subject: [PATCH 0119/1971] Seperate DS5 shell command from build command --- compile/eclipsebuild/eclipseds5build.gsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5acc0ae..347f723 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -43,11 +43,14 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) echo "Build command: ${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" if (isUnix()) { - sh "${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" + ${DS5SHELL} \'${BUILD_COMMAND} -no-indexer -importAll "${SOURCE_PATH}"\' + sh """ + ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + """ } else { bat """ - "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" + "%DS5SHELL%" "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" """ } } From 345a0ed28c75e9c6e9ee9e75d5b2242226a3d3d6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 18:26:56 +0100 Subject: [PATCH 0120/1971] Seperate DS5 shell command from build command --- compile/eclipsebuild/eclipseds5build.gsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 347f723..35ea90c 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -43,9 +43,8 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) echo "Build command: ${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" if (isUnix()) { - ${DS5SHELL} \'${BUILD_COMMAND} -no-indexer -importAll "${SOURCE_PATH}"\' sh """ - ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' """ } else { From fbb99a88e76ff545e81e5957e6d9f7f507de7bb7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 18:26:56 +0100 Subject: [PATCH 0121/1971] Seperate DS5 shell command from build command --- compile/eclipsebuild/eclipseds5build.gsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 347f723..35ea90c 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -43,9 +43,8 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) echo "Build command: ${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" if (isUnix()) { - ${DS5SHELL} \'${BUILD_COMMAND} -no-indexer -importAll "${SOURCE_PATH}"\' sh """ - ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' """ } else { From 9836cd869023d4f65097ce6958ac6f919277bff6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 18:37:18 +0100 Subject: [PATCH 0122/1971] Seperate DS5 shell command from build command --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 35ea90c..bbd17af 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -41,7 +41,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) - echo "Build command: ${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" + echo "Build command: \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' From 8005e0d3c6709b67499fd4c43bb41f1a25ac837a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 18:37:18 +0100 Subject: [PATCH 0123/1971] Seperate DS5 shell command from build command --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 35ea90c..bbd17af 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -41,7 +41,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) - echo "Build command: ${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"" + echo "Build command: \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' From 8141c493b1d44f92035cb4b8a420e5c37f918593 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 19:24:34 +0100 Subject: [PATCH 0124/1971] Seperate DS5 shell command from build command --- compile/eclipsebuild/eclipseds5build.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index bbd17af..6c121e3 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -41,10 +41,10 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) - echo "Build command: \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ - \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' """ } else { From 804a86aeaababbacdab5cbab7484f40891404ec4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 19:24:34 +0100 Subject: [PATCH 0125/1971] Seperate DS5 shell command from build command --- compile/eclipsebuild/eclipseds5build.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index bbd17af..6c121e3 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -41,10 +41,10 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } for (build_variant in variants) { retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) - echo "Build command: \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ - \"${DS5SHELL}\" \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' """ } else { From a4a3c387c9695e268999da04157d60394212759e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 23:27:58 +0100 Subject: [PATCH 0126/1971] Parameterise eclipse project build retries --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 6c121e3..b5f4e16 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -40,7 +40,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { buildtype = "-build" } for (build_variant in variants) { - retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ From fd7b0486cf076532cf5fec95b326c321d2ea2ce0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Jul 2018 23:27:58 +0100 Subject: [PATCH 0127/1971] Parameterise eclipse project build retries --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 6c121e3..b5f4e16 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -40,7 +40,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { buildtype = "-build" } for (build_variant in variants) { - retry(3) { // Eclipse occasionally raises exceptions (rather than the builds failing) + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ From 628f750659481bea49d5fcc88981da30add31b68 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 22 Aug 2018 13:50:34 +0100 Subject: [PATCH 0128/1971] HMBXR5601-390 - Copy folders recursively --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index b5f4e16..38cbb40 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -19,7 +19,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh "cp -r -v \"${srcFileExpanded}\" \"${destFolder}\"" } else { bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' From 39e8844bde13d31f1310a62f6223a26bef0cc34b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 8 Sep 2018 16:14:04 +0100 Subject: [PATCH 0129/1971] Cause a project build retry if the final binary was not produced --- compile/eclipsebuild/eclipseds5build.gsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 38cbb40..0ff36da 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -19,10 +19,16 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -r -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh """ + cp -r -v "${srcFileExpanded}" "${destFolder}" + if [ \$? -ne 0 ]; then exit 1; fi + """ } else { - bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' + bat ''' + copy \"%srcFileExpanded%\" \"%destFolder%\" + if errorlevel 1 exit /b 1 + ''' } } } From f9e2359888cfa2acec7097a4ccbbba3574e788a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 8 Sep 2018 16:14:04 +0100 Subject: [PATCH 0130/1971] Cause a project build retry if the final binary was not produced --- compile/eclipsebuild/eclipseds5build.gsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 38cbb40..0ff36da 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -19,10 +19,16 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { dir (env.destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { - sh "cp -r -v \"${srcFileExpanded}\" \"${destFolder}\"" + sh """ + cp -r -v "${srcFileExpanded}" "${destFolder}" + if [ \$? -ne 0 ]; then exit 1; fi + """ } else { - bat 'copy \"%srcFileExpanded%\" \"%destFolder%\"' + bat ''' + copy \"%srcFileExpanded%\" \"%destFolder%\" + if errorlevel 1 exit /b 1 + ''' } } } From aec43dde0a08b9237e0abc6cc5f4f6597cb7c96a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 8 Sep 2018 16:58:30 +0100 Subject: [PATCH 0131/1971] Look out for HMB tickets when comparing revision differences --- differences/show_release_differences.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index a778892..93d540b 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -72,6 +72,12 @@ jiraprojectpattern = { 'IMB': ( re.compile("^.* +(?:[Ii][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *IMB-(\d+):* (.*)"$'), ), + 'HMBXR5601': ( re.compile("^.* +(?:[Hh][Mm][Bb][Xx][Rr]5601[ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBXR5601-(\d+):* (.*)"$'), + ), + 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), + ), } mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") From d77a2dbcc8c215680d71470606981a69b46068f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 8 Sep 2018 16:58:30 +0100 Subject: [PATCH 0132/1971] Look out for HMB tickets when comparing revision differences --- differences/show_release_differences.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index a778892..93d540b 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -72,6 +72,12 @@ jiraprojectpattern = { 'IMB': ( re.compile("^.* +(?:[Ii][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *IMB-(\d+):* (.*)"$'), ), + 'HMBXR5601': ( re.compile("^.* +(?:[Hh][Mm][Bb][Xx][Rr]5601[ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBXR5601-(\d+):* (.*)"$'), + ), + 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), + ), } mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") From 3043d69d993bd00381300502efbe7d9cef62a197 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 8 Sep 2018 18:48:54 +0100 Subject: [PATCH 0133/1971] Disable parallel builds; Retry build if copy fails --- .../eclipsebuild/disableparallelbuilds.gsh | 12 ++++++++++ compile/eclipsebuild/eclipseds5build.gsh | 24 +++++++++++++------ 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 compile/eclipsebuild/disableparallelbuilds.gsh diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh new file mode 100644 index 0000000..77f5eb5 --- /dev/null +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -0,0 +1,12 @@ + +// Disable parallel make builds - which may be causing autobuild issues +def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { + if (isUnix()) { + sh """ + # Looks for " Date: Sat, 8 Sep 2018 18:48:54 +0100 Subject: [PATCH 0134/1971] Disable parallel builds; Retry build if copy fails --- .../eclipsebuild/disableparallelbuilds.gsh | 12 ++++++++++ compile/eclipsebuild/eclipseds5build.gsh | 24 +++++++++++++------ 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 compile/eclipsebuild/disableparallelbuilds.gsh diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh new file mode 100644 index 0000000..77f5eb5 --- /dev/null +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -0,0 +1,12 @@ + +// Disable parallel make builds - which may be causing autobuild issues +def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { + if (isUnix()) { + sh """ + # Looks for " Date: Sat, 8 Sep 2018 18:53:43 +0100 Subject: [PATCH 0135/1971] Disable parallel builds; Retry build if copy fails --- compile/eclipsebuild/disableparallelbuilds.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh index 77f5eb5..aeca69a 100644 --- a/compile/eclipsebuild/disableparallelbuilds.gsh +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -4,7 +4,7 @@ def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { if (isUnix()) { sh """ # Looks for " Date: Sat, 8 Sep 2018 18:53:43 +0100 Subject: [PATCH 0136/1971] Disable parallel builds; Retry build if copy fails --- compile/eclipsebuild/disableparallelbuilds.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh index 77f5eb5..aeca69a 100644 --- a/compile/eclipsebuild/disableparallelbuilds.gsh +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -4,7 +4,7 @@ def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { if (isUnix()) { sh """ # Looks for " Date: Sat, 8 Sep 2018 18:57:09 +0100 Subject: [PATCH 0137/1971] Disable parallel builds; Retry build if copy fails --- compile/eclipsebuild/disableparallelbuilds.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh index aeca69a..c4322cd 100644 --- a/compile/eclipsebuild/disableparallelbuilds.gsh +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -4,7 +4,7 @@ def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { if (isUnix()) { sh """ # Looks for " Date: Sat, 8 Sep 2018 18:57:09 +0100 Subject: [PATCH 0138/1971] Disable parallel builds; Retry build if copy fails --- compile/eclipsebuild/disableparallelbuilds.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh index aeca69a..c4322cd 100644 --- a/compile/eclipsebuild/disableparallelbuilds.gsh +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -4,7 +4,7 @@ def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { if (isUnix()) { sh """ # Looks for " Date: Sat, 8 Sep 2018 18:59:30 +0100 Subject: [PATCH 0139/1971] Disable parallel builds; Retry build if copy fails --- compile/eclipsebuild/disableparallelbuilds.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh index c4322cd..03e4c8f 100644 --- a/compile/eclipsebuild/disableparallelbuilds.gsh +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -4,7 +4,7 @@ def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { if (isUnix()) { sh """ # Looks for " Date: Sat, 8 Sep 2018 18:59:30 +0100 Subject: [PATCH 0140/1971] Disable parallel builds; Retry build if copy fails --- compile/eclipsebuild/disableparallelbuilds.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh index c4322cd..03e4c8f 100644 --- a/compile/eclipsebuild/disableparallelbuilds.gsh +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -4,7 +4,7 @@ def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { if (isUnix()) { sh """ # Looks for " Date: Sat, 8 Sep 2018 19:53:12 +0100 Subject: [PATCH 0141/1971] Put all compiled binaries in one variant specific folder on the target - making it easier to find all shared objects --- compile/eclipsebuild/eclipseds5build.gsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5d8c5a3..9f702fe 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,5 +1,5 @@ -def doExport(exportfolder, exportpathlist, build_variant = "") { +def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { def result = 0 for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" @@ -7,7 +7,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - env.destFolder = "${exportfolder}/${build_variant}/${project}" + env.destFolder = "${exportfolder}/${build_variant}" env.srcFile = "${WORKSPACE}/${exportpath}" env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } @@ -68,14 +68,14 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { "%DS5SHELL%" "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" """ } - doExport(exportfolder, exportpathlist, build_variant) + doExport(exportfolder, exportpathlist, "", build_variant) } } } else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - doExport(exportfolder, exportpathlist) + doExport(exportfolder, exportpathlist, project) } } } From 128f4b117a93dda82105d35be16f3de9b8dbfbb4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 8 Sep 2018 19:53:12 +0100 Subject: [PATCH 0142/1971] Put all compiled binaries in one variant specific folder on the target - making it easier to find all shared objects --- compile/eclipsebuild/eclipseds5build.gsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5d8c5a3..9f702fe 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,5 +1,5 @@ -def doExport(exportfolder, exportpathlist, build_variant = "") { +def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { def result = 0 for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" @@ -7,7 +7,7 @@ def doExport(exportfolder, exportpathlist, build_variant = "") { echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - env.destFolder = "${exportfolder}/${build_variant}/${project}" + env.destFolder = "${exportfolder}/${build_variant}" env.srcFile = "${WORKSPACE}/${exportpath}" env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } @@ -68,14 +68,14 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { "%DS5SHELL%" "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" """ } - doExport(exportfolder, exportpathlist, build_variant) + doExport(exportfolder, exportpathlist, "", build_variant) } } } else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - doExport(exportfolder, exportpathlist) + doExport(exportfolder, exportpathlist, project) } } } From 509367c0574d64ed3d8cb2a8a698a40eff8b1284 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 10 Sep 2018 14:17:42 +0100 Subject: [PATCH 0143/1971] Record time to build a project --- compile/eclipsebuild/eclipseds5build.gsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9f702fe..dfefd02 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -60,7 +60,9 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ + echo Start time: `date` ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` """ } else { From b6f9a430bcd61cf537265bf94f996a864dfc91ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 10 Sep 2018 14:17:42 +0100 Subject: [PATCH 0144/1971] Record time to build a project --- compile/eclipsebuild/eclipseds5build.gsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9f702fe..dfefd02 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -60,7 +60,9 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ + echo Start time: `date` ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` """ } else { From e9e01af18712ab524f711455811d1cc588d0cbd5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 16:34:03 +0100 Subject: [PATCH 0145/1971] Kill any left overs from previous builds before proceeding --- compile/eclipsebuild/eclipseds5build.gsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index dfefd02..1c213d5 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,4 +1,19 @@ +def doKillLeftovers() { + if (isUnix()) { + sh """ + # Killing any processes that may interfere with the next build + # The build system must be setup to do more than one eclipse build concurrently + ps aux | grep "eclipsews" + ps aux | grep "make" + ps aux | grep "arm-linux" + pkill -9 eclipsews + pkill -9 make + pkill -9 "*arm-linux*" + """ + } +} + def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { def result = 0 for (exportpath in exportpathlist) { @@ -60,6 +75,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ + doKillLeftovers() echo Start time: `date` ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` From e466892cde2edb19297f14075f45ba960e9122e2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 16:34:03 +0100 Subject: [PATCH 0146/1971] Kill any left overs from previous builds before proceeding --- compile/eclipsebuild/eclipseds5build.gsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index dfefd02..1c213d5 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,4 +1,19 @@ +def doKillLeftovers() { + if (isUnix()) { + sh """ + # Killing any processes that may interfere with the next build + # The build system must be setup to do more than one eclipse build concurrently + ps aux | grep "eclipsews" + ps aux | grep "make" + ps aux | grep "arm-linux" + pkill -9 eclipsews + pkill -9 make + pkill -9 "*arm-linux*" + """ + } +} + def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { def result = 0 for (exportpath in exportpathlist) { @@ -60,6 +75,7 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ + doKillLeftovers() echo Start time: `date` ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` From aa25d4d5614f56e3b2055aee3d1ddaf2c18ebe5c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 16:44:21 +0100 Subject: [PATCH 0147/1971] Kill any left overs from previous builds before proceeding --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 1c213d5..68bb64a 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -73,9 +73,9 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" + doKillLeftovers() if (isUnix()) { sh """ - doKillLeftovers() echo Start time: `date` ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` From bffdde6145cce055cf05916eefec16d92bf32c5e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 16:44:21 +0100 Subject: [PATCH 0148/1971] Kill any left overs from previous builds before proceeding --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 1c213d5..68bb64a 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -73,9 +73,9 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" + doKillLeftovers() if (isUnix()) { sh """ - doKillLeftovers() echo Start time: `date` ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` From 0bb2733aae93427abbdc8c05027ad7592b67fbbd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 17:10:57 +0100 Subject: [PATCH 0149/1971] Kill any left overs from previous builds before proceeding --- compile/eclipsebuild/eclipseds5build.gsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 68bb64a..6cc4c31 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -7,9 +7,10 @@ def doKillLeftovers() { ps aux | grep "eclipsews" ps aux | grep "make" ps aux | grep "arm-linux" - pkill -9 eclipsews - pkill -9 make - pkill -9 "*arm-linux*" + # Don't return an error if the processes don't exist + pkill -9 eclipsews || true + pkill -9 make || true + pkill -9 "*arm-linux*" || true """ } } From a7eb5454e75ed47b3b8e52a353f180a136840555 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 17:10:57 +0100 Subject: [PATCH 0150/1971] Kill any left overs from previous builds before proceeding --- compile/eclipsebuild/eclipseds5build.gsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 68bb64a..6cc4c31 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -7,9 +7,10 @@ def doKillLeftovers() { ps aux | grep "eclipsews" ps aux | grep "make" ps aux | grep "arm-linux" - pkill -9 eclipsews - pkill -9 make - pkill -9 "*arm-linux*" + # Don't return an error if the processes don't exist + pkill -9 eclipsews || true + pkill -9 make || true + pkill -9 "*arm-linux*" || true """ } } From 22605b6677af1c8bb227222d0ffd19905b9e7bcc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 17:16:19 +0100 Subject: [PATCH 0151/1971] Kill any left overs from previous builds before proceeding --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 6cc4c31..c7804fa 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -10,7 +10,7 @@ def doKillLeftovers() { # Don't return an error if the processes don't exist pkill -9 eclipsews || true pkill -9 make || true - pkill -9 "*arm-linux*" || true + pkill -9 ".*arm-linux.*" || true """ } } From 77202e4488e592b1bce6ae134902235e1cb8e917 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 17:16:19 +0100 Subject: [PATCH 0152/1971] Kill any left overs from previous builds before proceeding --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 6cc4c31..c7804fa 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -10,7 +10,7 @@ def doKillLeftovers() { # Don't return an error if the processes don't exist pkill -9 eclipsews || true pkill -9 make || true - pkill -9 "*arm-linux*" || true + pkill -9 ".*arm-linux.*" || true """ } } From 5d45c483cc479f331d6edf16e52d7f01dba425e9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 19:31:17 +0100 Subject: [PATCH 0153/1971] Register toolchain multiple times --- compile/eclipsebuild/eclipseds5build.gsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index c7804fa..2be3d95 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -77,6 +77,8 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() if (isUnix()) { sh """ + # Register toolchain (if it is not already) + "${DS5_FOLDER}/bin/add_toolchain" --non-interactive "${TOOLCHAIN_FOLDER}" echo Start time: `date` ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` From 99d341a1b0fe9ee803594b0c622f7bc3cd5452e3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Sep 2018 19:31:17 +0100 Subject: [PATCH 0154/1971] Register toolchain multiple times --- compile/eclipsebuild/eclipseds5build.gsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index c7804fa..2be3d95 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -77,6 +77,8 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() if (isUnix()) { sh """ + # Register toolchain (if it is not already) + "${DS5_FOLDER}/bin/add_toolchain" --non-interactive "${TOOLCHAIN_FOLDER}" echo Start time: `date` ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` From e5aa2bc6407133590cc4ee57e254b943288a2452 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 12:52:17 +0100 Subject: [PATCH 0155/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 33 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index c0e28c0..1095d32 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -61,7 +61,27 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } // Build and export files -def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { +def doRegisterToolchain(ds5folder, toolchainfolder) { + # Register toolchain (if it is not already) + if (isUnix()) { + sh """ + "${ds5folder}/bin/add_toolchain" --non-interactive "${toolchainfolder}" + """ + env.PATH = env.TOOLCHAIN_FOLDER + ":" + env.PATH + } + else { + bat """ + "%ds5folder%\\bin\\add_toolchain" --non-interactive "%toolchainfolder%" + """ + env.PATH = env.TOOLCHAIN_FOLDER + ";" + env.PATH + } + echo "Path is: ${PATH}" +} + +// Build and export files +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { + doKillLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { @@ -73,20 +93,17 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" - doKillLeftovers() + echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ - # Register toolchain (if it is not already) - "${DS5_FOLDER}/bin/add_toolchain" --non-interactive "${TOOLCHAIN_FOLDER}" echo Start time: `date` - ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%DS5SHELL%" "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" """ } doExport(exportfolder, exportpathlist, "", build_variant) @@ -102,4 +119,4 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } -return this; \ No newline at end of file +return this; From 05c18c11a45d9765fb616956f278ac69e5a7ab97 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 12:52:17 +0100 Subject: [PATCH 0156/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 33 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index c0e28c0..1095d32 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -61,7 +61,27 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } // Build and export files -def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { +def doRegisterToolchain(ds5folder, toolchainfolder) { + # Register toolchain (if it is not already) + if (isUnix()) { + sh """ + "${ds5folder}/bin/add_toolchain" --non-interactive "${toolchainfolder}" + """ + env.PATH = env.TOOLCHAIN_FOLDER + ":" + env.PATH + } + else { + bat """ + "%ds5folder%\\bin\\add_toolchain" --non-interactive "%toolchainfolder%" + """ + env.PATH = env.TOOLCHAIN_FOLDER + ";" + env.PATH + } + echo "Path is: ${PATH}" +} + +// Build and export files +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { + doKillLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { @@ -73,20 +93,17 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" - doKillLeftovers() + echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ - # Register toolchain (if it is not already) - "${DS5_FOLDER}/bin/add_toolchain" --non-interactive "${TOOLCHAIN_FOLDER}" echo Start time: `date` - ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%DS5SHELL%" "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" """ } doExport(exportfolder, exportpathlist, "", build_variant) @@ -102,4 +119,4 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } -return this; \ No newline at end of file +return this; From d2067da0546976829b1eb73e4e0d4d6274b02352 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 13:10:12 +0100 Subject: [PATCH 0157/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 1095d32..8d781a4 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -62,7 +62,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { // Build and export files def doRegisterToolchain(ds5folder, toolchainfolder) { - # Register toolchain (if it is not already) + // Register toolchain (if it is not already) if (isUnix()) { sh """ "${ds5folder}/bin/add_toolchain" --non-interactive "${toolchainfolder}" From 8783c9a9c3b960488de81a67fdcbb8e37157665b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 13:10:12 +0100 Subject: [PATCH 0158/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 1095d32..8d781a4 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -62,7 +62,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { // Build and export files def doRegisterToolchain(ds5folder, toolchainfolder) { - # Register toolchain (if it is not already) + // Register toolchain (if it is not already) if (isUnix()) { sh """ "${ds5folder}/bin/add_toolchain" --non-interactive "${toolchainfolder}" From cfa2b57ec79b6a111ba84b94f95f9e1c2eaf8710 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 13:15:17 +0100 Subject: [PATCH 0159/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 8d781a4..7409d96 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -81,7 +81,7 @@ def doRegisterToolchain(ds5folder, toolchainfolder) { // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder + doRegisterToolchain(ds5folder, toolchainfolder) for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { From c72196569f5c5d563095137f4724d0bdf6ddcc0d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 13:15:17 +0100 Subject: [PATCH 0160/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 8d781a4..7409d96 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -81,7 +81,7 @@ def doRegisterToolchain(ds5folder, toolchainfolder) { // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder + doRegisterToolchain(ds5folder, toolchainfolder) for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { From 78fbf0a9a7ad8699794816af84e745f4190bf62e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 13:42:44 +0100 Subject: [PATCH 0161/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 7409d96..69e9884 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -60,20 +60,30 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { return result } -// Build and export files +// Register toolchain def doRegisterToolchain(ds5folder, toolchainfolder) { // Register toolchain (if it is not already) if (isUnix()) { sh """ "${ds5folder}/bin/add_toolchain" --non-interactive "${toolchainfolder}" """ - env.PATH = env.TOOLCHAIN_FOLDER + ":" + env.PATH } else { bat """ "%ds5folder%\\bin\\add_toolchain" --non-interactive "%toolchainfolder%" """ - env.PATH = env.TOOLCHAIN_FOLDER + ";" + env.PATH + } + echo "Path is: ${PATH}" +} + +// Add toolchain to path +def addToolchainPath(toolchainfolder) { + // Register toolchain (if it is not already) + if (isUnix()) { + env.PATH = toolchainfolder + ":" + env.PATH + } + else { + env.PATH = toolchainfolder + ";" + env.PATH } echo "Path is: ${PATH}" } @@ -81,7 +91,7 @@ def doRegisterToolchain(ds5folder, toolchainfolder) { // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) + addToolchainPath(toolchainfolder) for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { @@ -93,6 +103,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exp } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ From cd889893dd577a529f1f64e927815b888f1c3ec7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 13:42:44 +0100 Subject: [PATCH 0162/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 7409d96..69e9884 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -60,20 +60,30 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { return result } -// Build and export files +// Register toolchain def doRegisterToolchain(ds5folder, toolchainfolder) { // Register toolchain (if it is not already) if (isUnix()) { sh """ "${ds5folder}/bin/add_toolchain" --non-interactive "${toolchainfolder}" """ - env.PATH = env.TOOLCHAIN_FOLDER + ":" + env.PATH } else { bat """ "%ds5folder%\\bin\\add_toolchain" --non-interactive "%toolchainfolder%" """ - env.PATH = env.TOOLCHAIN_FOLDER + ";" + env.PATH + } + echo "Path is: ${PATH}" +} + +// Add toolchain to path +def addToolchainPath(toolchainfolder) { + // Register toolchain (if it is not already) + if (isUnix()) { + env.PATH = toolchainfolder + ":" + env.PATH + } + else { + env.PATH = toolchainfolder + ";" + env.PATH } echo "Path is: ${PATH}" } @@ -81,7 +91,7 @@ def doRegisterToolchain(ds5folder, toolchainfolder) { // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) + addToolchainPath(toolchainfolder) for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { @@ -93,6 +103,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exp } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ From 1eced1a5a4947f65436104da2ac7a1c56c43f4c7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 14:19:21 +0100 Subject: [PATCH 0163/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 69e9884..430cfca 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -88,10 +88,24 @@ def addToolchainPath(toolchainfolder) { echo "Path is: ${PATH}" } +// Import all eclipse projects in a given folder +def doImportProjects(ds5shellcommand, buildcommand, sourcefolder) { + doRegisterToolchain(ds5folder, toolchainfolder) + if (isUnix()) { + sh """ + ${ds5shellcommand} \'${buildcommand} -no-indexer -importAll "${sourcefolder}"\' + """ + } + else { + bat '%ds5shellcommand% %buildcommand% -no-indexer -importAll "%sourcefolder%"' + } +} + // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() addToolchainPath(toolchainfolder) + doImportProjects(ds5shellcommand, buildcommand, sourcefolder) for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { From c2425b61656405cc4f585d67ca301b642b068ccc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 14:19:21 +0100 Subject: [PATCH 0164/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 69e9884..430cfca 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -88,10 +88,24 @@ def addToolchainPath(toolchainfolder) { echo "Path is: ${PATH}" } +// Import all eclipse projects in a given folder +def doImportProjects(ds5shellcommand, buildcommand, sourcefolder) { + doRegisterToolchain(ds5folder, toolchainfolder) + if (isUnix()) { + sh """ + ${ds5shellcommand} \'${buildcommand} -no-indexer -importAll "${sourcefolder}"\' + """ + } + else { + bat '%ds5shellcommand% %buildcommand% -no-indexer -importAll "%sourcefolder%"' + } +} + // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() addToolchainPath(toolchainfolder) + doImportProjects(ds5shellcommand, buildcommand, sourcefolder) for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { From fc72420338ce08944b6b7493b1ea7a9c27057c1e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 14:28:30 +0100 Subject: [PATCH 0165/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 430cfca..f05603a 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -89,7 +89,7 @@ def addToolchainPath(toolchainfolder) { } // Import all eclipse projects in a given folder -def doImportProjects(ds5shellcommand, buildcommand, sourcefolder) { +def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) { doRegisterToolchain(ds5folder, toolchainfolder) if (isUnix()) { sh """ @@ -105,7 +105,7 @@ def doImportProjects(ds5shellcommand, buildcommand, sourcefolder) { def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() addToolchainPath(toolchainfolder) - doImportProjects(ds5shellcommand, buildcommand, sourcefolder) + doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { From 749a7baa710f01866fb1b8f6189be0223c2a3e9e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 14:28:30 +0100 Subject: [PATCH 0166/1971] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 430cfca..f05603a 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -89,7 +89,7 @@ def addToolchainPath(toolchainfolder) { } // Import all eclipse projects in a given folder -def doImportProjects(ds5shellcommand, buildcommand, sourcefolder) { +def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) { doRegisterToolchain(ds5folder, toolchainfolder) if (isUnix()) { sh """ @@ -105,7 +105,7 @@ def doImportProjects(ds5shellcommand, buildcommand, sourcefolder) { def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { doKillLeftovers() addToolchainPath(toolchainfolder) - doImportProjects(ds5shellcommand, buildcommand, sourcefolder) + doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { From 2a48022f4638065fc7c813890d19f15f858495cd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Sep 2018 23:24:25 +0100 Subject: [PATCH 0167/1971] Add ability to build device tree from source as opposed to deriving from sopcinfo file --- compile/eclipsebuild/eclipseds5build.gsh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index f05603a..2a6fce3 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -4,13 +4,16 @@ def doKillLeftovers() { sh """ # Killing any processes that may interfere with the next build # The build system must be setup to do more than one eclipse build concurrently - ps aux | grep "eclipsews" - ps aux | grep "make" - ps aux | grep "arm-linux" + USER=`whoami` + pgrep -U "${USER}" "eclipse" + pgrep -U "${USER}" "eclipsews" + pgrep -U "${USER}" "make" + pgrep -U "${USER}" "arm-linux" # Don't return an error if the processes don't exist - pkill -9 eclipsews || true - pkill -9 make || true - pkill -9 ".*arm-linux.*" || true + pkill -U "${USER}" -9 eclipse || true + pkill -U "${USER}" -9 eclipsews || true + pkill -U "${USER}" -9 make || true + pkill -U "${USER}" -9 ".*arm-linux.*" || true """ } } From 460081435558725db1144a407142865bf237fa23 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Sep 2018 23:24:25 +0100 Subject: [PATCH 0168/1971] Add ability to build device tree from source as opposed to deriving from sopcinfo file --- compile/eclipsebuild/eclipseds5build.gsh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index f05603a..2a6fce3 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -4,13 +4,16 @@ def doKillLeftovers() { sh """ # Killing any processes that may interfere with the next build # The build system must be setup to do more than one eclipse build concurrently - ps aux | grep "eclipsews" - ps aux | grep "make" - ps aux | grep "arm-linux" + USER=`whoami` + pgrep -U "${USER}" "eclipse" + pgrep -U "${USER}" "eclipsews" + pgrep -U "${USER}" "make" + pgrep -U "${USER}" "arm-linux" # Don't return an error if the processes don't exist - pkill -9 eclipsews || true - pkill -9 make || true - pkill -9 ".*arm-linux.*" || true + pkill -U "${USER}" -9 eclipse || true + pkill -U "${USER}" -9 eclipsews || true + pkill -U "${USER}" -9 make || true + pkill -U "${USER}" -9 ".*arm-linux.*" || true """ } } From 7c682da874bd8ac0f50256e04cbb7e6763f98e9f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 00:22:21 +0100 Subject: [PATCH 0169/1971] Correct pkill call --- compile/eclipsebuild/eclipseds5build.gsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 2a6fce3..731c6b4 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -5,10 +5,10 @@ def doKillLeftovers() { # Killing any processes that may interfere with the next build # The build system must be setup to do more than one eclipse build concurrently USER=`whoami` - pgrep -U "${USER}" "eclipse" - pgrep -U "${USER}" "eclipsews" - pgrep -U "${USER}" "make" - pgrep -U "${USER}" "arm-linux" + pgrep -U "${USER}" "eclipse" || true + pgrep -U "${USER}" "eclipsews" || true + pgrep -U "${USER}" "make" || true + pgrep -U "${USER}" "arm-linux" || true # Don't return an error if the processes don't exist pkill -U "${USER}" -9 eclipse || true pkill -U "${USER}" -9 eclipsews || true From 36dffd80e636a43d25eb0ab7c2a76111a9f0d3c1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 00:22:21 +0100 Subject: [PATCH 0170/1971] Correct pkill call --- compile/eclipsebuild/eclipseds5build.gsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 2a6fce3..731c6b4 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -5,10 +5,10 @@ def doKillLeftovers() { # Killing any processes that may interfere with the next build # The build system must be setup to do more than one eclipse build concurrently USER=`whoami` - pgrep -U "${USER}" "eclipse" - pgrep -U "${USER}" "eclipsews" - pgrep -U "${USER}" "make" - pgrep -U "${USER}" "arm-linux" + pgrep -U "${USER}" "eclipse" || true + pgrep -U "${USER}" "eclipsews" || true + pgrep -U "${USER}" "make" || true + pgrep -U "${USER}" "arm-linux" || true # Don't return an error if the processes don't exist pkill -U "${USER}" -9 eclipse || true pkill -U "${USER}" -9 eclipsews || true From 953e3dfc0051dcdb800e4b5c3249629ca92f1fd3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 09:08:28 +0100 Subject: [PATCH 0171/1971] Stop builds killing each other on the same slave --- compile/eclipsebuild/eclipseds5build.gsh | 79 ++++++++++++------------ 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 731c6b4..4638179 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -4,15 +4,13 @@ def doKillLeftovers() { sh """ # Killing any processes that may interfere with the next build # The build system must be setup to do more than one eclipse build concurrently - USER=`whoami` - pgrep -U "${USER}" "eclipse" || true - pgrep -U "${USER}" "eclipsews" || true - pgrep -U "${USER}" "make" || true - pgrep -U "${USER}" "arm-linux" || true # Don't return an error if the processes don't exist + USER=`whoami` + ps aux | grep "eclipse" pkill -U "${USER}" -9 eclipse || true - pkill -U "${USER}" -9 eclipsews || true + ps aux | grep "make" pkill -U "${USER}" -9 make || true + ps aux | grep "arm-linux" pkill -U "${USER}" -9 ".*arm-linux.*" || true """ } @@ -106,42 +104,45 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { - doKillLeftovers() - addToolchainPath(toolchainfolder) - doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) - for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo - if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" - } - else { - buildtype = "-build" - } - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + // The lock is being used because it was being found that the doKillLeftovers was affecting other builds + lock(resource: "eclipsebuild_${env.NODE_NAME}") { + doKillLeftovers() + addToolchainPath(toolchainfolder) + doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) + for (appInfo in apps ) { + (build, cleanbuild, project, variants, exportpathlist) = appInfo + if (build) { + if (cleanbuild) { + buildtype = "-cleanBuild" + } + else { + buildtype = "-build" + } + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" + """ + } + doExport(exportfolder, exportpathlist, "", build_variant) } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" - """ - } - doExport(exportfolder, exportpathlist, "", build_variant) } } - } - else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt - if (!variants) { - doExport(exportfolder, exportpathlist, project) + else { + // Only export if the project has no variants - signifying that there are files to export which have been prebuilt + if (!variants) { + doExport(exportfolder, exportpathlist, project) + } } } } From dc977fe2558012f89c56fa46aa66935ad68d1814 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 09:08:28 +0100 Subject: [PATCH 0172/1971] Stop builds killing each other on the same slave --- compile/eclipsebuild/eclipseds5build.gsh | 79 ++++++++++++------------ 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 731c6b4..4638179 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -4,15 +4,13 @@ def doKillLeftovers() { sh """ # Killing any processes that may interfere with the next build # The build system must be setup to do more than one eclipse build concurrently - USER=`whoami` - pgrep -U "${USER}" "eclipse" || true - pgrep -U "${USER}" "eclipsews" || true - pgrep -U "${USER}" "make" || true - pgrep -U "${USER}" "arm-linux" || true # Don't return an error if the processes don't exist + USER=`whoami` + ps aux | grep "eclipse" pkill -U "${USER}" -9 eclipse || true - pkill -U "${USER}" -9 eclipsews || true + ps aux | grep "make" pkill -U "${USER}" -9 make || true + ps aux | grep "arm-linux" pkill -U "${USER}" -9 ".*arm-linux.*" || true """ } @@ -106,42 +104,45 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { - doKillLeftovers() - addToolchainPath(toolchainfolder) - doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) - for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo - if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" - } - else { - buildtype = "-build" - } - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + // The lock is being used because it was being found that the doKillLeftovers was affecting other builds + lock(resource: "eclipsebuild_${env.NODE_NAME}") { + doKillLeftovers() + addToolchainPath(toolchainfolder) + doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) + for (appInfo in apps ) { + (build, cleanbuild, project, variants, exportpathlist) = appInfo + if (build) { + if (cleanbuild) { + buildtype = "-cleanBuild" + } + else { + buildtype = "-build" + } + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" + """ + } + doExport(exportfolder, exportpathlist, "", build_variant) } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" - """ - } - doExport(exportfolder, exportpathlist, "", build_variant) } } - } - else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt - if (!variants) { - doExport(exportfolder, exportpathlist, project) + else { + // Only export if the project has no variants - signifying that there are files to export which have been prebuilt + if (!variants) { + doExport(exportfolder, exportpathlist, project) + } } } } From a2b0e937055c4ed1b10c11d3047c9fba3d87e0f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 09:21:27 +0100 Subject: [PATCH 0173/1971] Stop builds killing each other on the same slave --- compile/eclipsebuild/eclipseds5build.gsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 4638179..9cf1c57 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -7,11 +7,11 @@ def doKillLeftovers() { # Don't return an error if the processes don't exist USER=`whoami` ps aux | grep "eclipse" - pkill -U "${USER}" -9 eclipse || true + # pkill -U "${USER}" -9 eclipse || true ps aux | grep "make" - pkill -U "${USER}" -9 make || true + # pkill -U "${USER}" -9 make || true ps aux | grep "arm-linux" - pkill -U "${USER}" -9 ".*arm-linux.*" || true + # pkill -U "${USER}" -9 ".*arm-linux.*" || true """ } } From fc8bf281ae04c7888a7fbaa25f7fed9c5a83aa5c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 09:21:27 +0100 Subject: [PATCH 0174/1971] Stop builds killing each other on the same slave --- compile/eclipsebuild/eclipseds5build.gsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 4638179..9cf1c57 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -7,11 +7,11 @@ def doKillLeftovers() { # Don't return an error if the processes don't exist USER=`whoami` ps aux | grep "eclipse" - pkill -U "${USER}" -9 eclipse || true + # pkill -U "${USER}" -9 eclipse || true ps aux | grep "make" - pkill -U "${USER}" -9 make || true + # pkill -U "${USER}" -9 make || true ps aux | grep "arm-linux" - pkill -U "${USER}" -9 ".*arm-linux.*" || true + # pkill -U "${USER}" -9 ".*arm-linux.*" || true """ } } From 6b10e598777e98f6521ae7c57ebcbf9674ddb895 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 13:35:39 +0100 Subject: [PATCH 0175/1971] Move -no-indexer parameter into a consistent position --- compile/eclipsebuild/eclipseds5build.gsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9cf1c57..7de42dd 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -121,17 +121,17 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" """ } doExport(exportfolder, exportpathlist, "", build_variant) From 35cab07aff5d1e5a99acd4b715ef4e7db6e6392d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 13:35:39 +0100 Subject: [PATCH 0176/1971] Move -no-indexer parameter into a consistent position --- compile/eclipsebuild/eclipseds5build.gsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9cf1c57..7de42dd 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -121,17 +121,17 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" """ } doExport(exportfolder, exportpathlist, "", build_variant) From acc8281b25da88d2ba942ce16bf425bc5fe63573 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 13:45:37 +0100 Subject: [PATCH 0177/1971] Kill leftovers after a successful or failed build --- compile/eclipsebuild/eclipseds5build.gsh | 93 ++++++++++++++---------- 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 7de42dd..3444d25 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,5 +1,4 @@ - -def doKillLeftovers() { +def doDisplayLeftovers() { if (isUnix()) { sh """ # Killing any processes that may interfere with the next build @@ -7,11 +6,23 @@ def doKillLeftovers() { # Don't return an error if the processes don't exist USER=`whoami` ps aux | grep "eclipse" - # pkill -U "${USER}" -9 eclipse || true ps aux | grep "make" - # pkill -U "${USER}" -9 make || true ps aux | grep "arm-linux" - # pkill -U "${USER}" -9 ".*arm-linux.*" || true + """ + } +} + +def doKillLeftovers() { + if (isUnix()) { + doDisplayLeftovers() + sh """ + # Killing any processes that may interfere with the next build + # The build system must be setup to do more than one eclipse build concurrently + # Don't return an error if the processes don't exist + USER=`whoami` + pkill -U "${USER}" -9 eclipse || true + pkill -U "${USER}" -9 make || true + pkill -U "${USER}" -9 ".*arm-linux.*" || true """ } } @@ -106,45 +117,51 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - doKillLeftovers() - addToolchainPath(toolchainfolder) - doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) - for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo - if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" + doDisplayLeftovers() + try { + addToolchainPath(toolchainfolder) + doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) + for (appInfo in apps ) { + (build, cleanbuild, project, variants, exportpathlist) = appInfo + if (build) { + if (cleanbuild) { + buildtype = "-cleanBuild" + } + else { + buildtype = "-build" + } + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ + } + doExport(exportfolder, exportpathlist, "", build_variant) + } + } } else { - buildtype = "-build" - } - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ - } - doExport(exportfolder, exportpathlist, "", build_variant) + // Only export if the project has no variants - signifying that there are files to export which have been prebuilt + if (!variants) { + doExport(exportfolder, exportpathlist, project) } } } - else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt - if (!variants) { - doExport(exportfolder, exportpathlist, project) - } - } + } catch (Exception e) { + error "Build failed - Killing leftovers" + doKillLeftovers() } + doKillLeftovers() } } From c3b1af3b93893dc7cc1e110ccd7cf371830cae56 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 13:45:37 +0100 Subject: [PATCH 0178/1971] Kill leftovers after a successful or failed build --- compile/eclipsebuild/eclipseds5build.gsh | 93 ++++++++++++++---------- 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 7de42dd..3444d25 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -1,5 +1,4 @@ - -def doKillLeftovers() { +def doDisplayLeftovers() { if (isUnix()) { sh """ # Killing any processes that may interfere with the next build @@ -7,11 +6,23 @@ def doKillLeftovers() { # Don't return an error if the processes don't exist USER=`whoami` ps aux | grep "eclipse" - # pkill -U "${USER}" -9 eclipse || true ps aux | grep "make" - # pkill -U "${USER}" -9 make || true ps aux | grep "arm-linux" - # pkill -U "${USER}" -9 ".*arm-linux.*" || true + """ + } +} + +def doKillLeftovers() { + if (isUnix()) { + doDisplayLeftovers() + sh """ + # Killing any processes that may interfere with the next build + # The build system must be setup to do more than one eclipse build concurrently + # Don't return an error if the processes don't exist + USER=`whoami` + pkill -U "${USER}" -9 eclipse || true + pkill -U "${USER}" -9 make || true + pkill -U "${USER}" -9 ".*arm-linux.*" || true """ } } @@ -106,45 +117,51 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - doKillLeftovers() - addToolchainPath(toolchainfolder) - doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) - for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo - if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" + doDisplayLeftovers() + try { + addToolchainPath(toolchainfolder) + doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) + for (appInfo in apps ) { + (build, cleanbuild, project, variants, exportpathlist) = appInfo + if (build) { + if (cleanbuild) { + buildtype = "-cleanBuild" + } + else { + buildtype = "-build" + } + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ + } + doExport(exportfolder, exportpathlist, "", build_variant) + } + } } else { - buildtype = "-build" - } - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ - } - doExport(exportfolder, exportpathlist, "", build_variant) + // Only export if the project has no variants - signifying that there are files to export which have been prebuilt + if (!variants) { + doExport(exportfolder, exportpathlist, project) } } } - else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt - if (!variants) { - doExport(exportfolder, exportpathlist, project) - } - } + } catch (Exception e) { + error "Build failed - Killing leftovers" + doKillLeftovers() } + doKillLeftovers() } } From 4013a0221269e1f41d38863ebb053448e8ae1f76 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 22:15:22 +0100 Subject: [PATCH 0179/1971] Display leftovers at the beginning of each build --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 3444d25..c81e200 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -117,7 +117,6 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - doDisplayLeftovers() try { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -132,6 +131,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { From 488454ae61eb46aefdff2d570a599b982808790b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 22:15:22 +0100 Subject: [PATCH 0180/1971] Display leftovers at the beginning of each build --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 3444d25..c81e200 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -117,7 +117,6 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - doDisplayLeftovers() try { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -132,6 +131,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { From 885d98e8946707b899605e043ede504f4f26fb87 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 22:28:42 +0100 Subject: [PATCH 0181/1971] Timeout builds --- compile/eclipsebuild/eclipseds5build.gsh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index c81e200..cd31301 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -8,6 +8,7 @@ def doDisplayLeftovers() { ps aux | grep "eclipse" ps aux | grep "make" ps aux | grep "arm-linux" + ps aux | grep "sh" """ } } @@ -135,11 +136,14 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + timeout(time: 5, unit: MINUTES) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + sleep(time: 4, unit: SECONDS) } else { bat """ From efdae69ce827bb37e602759eee6aa03b35597a31 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 22:28:42 +0100 Subject: [PATCH 0182/1971] Timeout builds --- compile/eclipsebuild/eclipseds5build.gsh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index c81e200..cd31301 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -8,6 +8,7 @@ def doDisplayLeftovers() { ps aux | grep "eclipse" ps aux | grep "make" ps aux | grep "arm-linux" + ps aux | grep "sh" """ } } @@ -135,11 +136,14 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + timeout(time: 5, unit: MINUTES) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + sleep(time: 4, unit: SECONDS) } else { bat """ From 3d5af70b41278ae9e07d8f3b99624229aa2221fb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 22:40:33 +0100 Subject: [PATCH 0183/1971] Timeout builds --- compile/eclipsebuild/eclipseds5build.gsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index cd31301..5e1c0de 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -51,6 +51,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { if (isUnix()) { result = sh( script: """ cp -r -v "${srcFileExpanded}" "${destFolder}" + if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true ) @@ -61,6 +62,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { else { result = bat( script: ''' copy \"%srcFileExpanded%\" \"%destFolder%\" + if errorlevel 1 EXIT /b 1 ''', returnStatus: true ) @@ -136,14 +138,14 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { - timeout(time: 5, unit: MINUTES) { + timeout(time: 5, unit: 'MINUTES') { sh """ echo Start time: `date` ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` """ } - sleep(time: 4, unit: SECONDS) + sleep(time: 4, unit: 'SECONDS') } else { bat """ From 3f92a1a0b65cd9cac8a97c61ad39d61180c858f5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 17 Sep 2018 22:40:33 +0100 Subject: [PATCH 0184/1971] Timeout builds --- compile/eclipsebuild/eclipseds5build.gsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index cd31301..5e1c0de 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -51,6 +51,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { if (isUnix()) { result = sh( script: """ cp -r -v "${srcFileExpanded}" "${destFolder}" + if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true ) @@ -61,6 +62,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { else { result = bat( script: ''' copy \"%srcFileExpanded%\" \"%destFolder%\" + if errorlevel 1 EXIT /b 1 ''', returnStatus: true ) @@ -136,14 +138,14 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { - timeout(time: 5, unit: MINUTES) { + timeout(time: 5, unit: 'MINUTES') { sh """ echo Start time: `date` ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` """ } - sleep(time: 4, unit: SECONDS) + sleep(time: 4, unit: 'SECONDS') } else { bat """ From bff5c0a833fb03181736610da871a3498a6e80a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 18 Sep 2018 00:25:06 +0100 Subject: [PATCH 0185/1971] Jobs are being killed unexpectedly so remove potential source; Add more timeouts; Extend timeouts --- compile/eclipsebuild/eclipseds5build.gsh | 48 +++++++++++++----------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5e1c0de..9fd5293 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -8,7 +8,7 @@ def doDisplayLeftovers() { ps aux | grep "eclipse" ps aux | grep "make" ps aux | grep "arm-linux" - ps aux | grep "sh" + # ps aux | grep "sh" """ } } @@ -121,8 +121,10 @@ 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 { - addToolchainPath(toolchainfolder) - doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) + timeout(time: 2, unit: 'MINUTES') { + addToolchainPath(toolchainfolder) + doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) + } for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { @@ -134,25 +136,30 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - if (isUnix()) { - timeout(time: 5, unit: 'MINUTES') { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + try { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ + } } + doExport(exportfolder, exportpathlist, "", build_variant) + } catch (Exception e) { + echo "Build failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') + error "Build failed..." } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ - } - doExport(exportfolder, exportpathlist, "", build_variant) } } } @@ -164,10 +171,9 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } } catch (Exception e) { + // doKillLeftovers() error "Build failed - Killing leftovers" - doKillLeftovers() } - doKillLeftovers() } } From 9c52e610af9667d69015cf5adcd69fef9a426807 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 18 Sep 2018 00:25:06 +0100 Subject: [PATCH 0186/1971] Jobs are being killed unexpectedly so remove potential source; Add more timeouts; Extend timeouts --- compile/eclipsebuild/eclipseds5build.gsh | 48 +++++++++++++----------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 5e1c0de..9fd5293 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -8,7 +8,7 @@ def doDisplayLeftovers() { ps aux | grep "eclipse" ps aux | grep "make" ps aux | grep "arm-linux" - ps aux | grep "sh" + # ps aux | grep "sh" """ } } @@ -121,8 +121,10 @@ 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 { - addToolchainPath(toolchainfolder) - doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) + timeout(time: 2, unit: 'MINUTES') { + addToolchainPath(toolchainfolder) + doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) + } for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { @@ -134,25 +136,30 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - if (isUnix()) { - timeout(time: 5, unit: 'MINUTES') { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + try { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ + } } + doExport(exportfolder, exportpathlist, "", build_variant) + } catch (Exception e) { + echo "Build failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') + error "Build failed..." } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ - } - doExport(exportfolder, exportpathlist, "", build_variant) } } } @@ -164,10 +171,9 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } } catch (Exception e) { + // doKillLeftovers() error "Build failed - Killing leftovers" - doKillLeftovers() } - doKillLeftovers() } } From 8d73541b51b48be36b26edc337bbf7b52538d76f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Oct 2018 14:53:02 +0100 Subject: [PATCH 0187/1971] Using SM200 master (714fd686bf5ea07f83346342362eca45c6ffc9df) as a starting point for HMB-FD-HV autobuild scripts --- .project | 17 ++ .pydevproject | 8 + .settings/org.eclipse.core.resources.prefs | 2 + commandline/commandline.gsh | 13 ++ .../eclipsebuild/disableparallelbuilds.gsh | 12 + compile/eclipsebuild/eclipseds5build.gsh | 180 ++++++++++++++ configuration/configuration.gsh | 37 +++ differences/.project | 17 ++ differences/.pydevproject | 8 + differences/show_release_differences.py | 220 ++++++++++++++++++ test.gsh | 7 + versioncontrol/git.gsh | 63 +++++ versionnumbering/versioninfo.py | 219 +++++++++++++++++ versionstamping/.project | 17 ++ versionstamping/.pydevproject | 8 + versionstamping/versionstamper.py | 41 ++++ 16 files changed, 869 insertions(+) create mode 100644 .project create mode 100644 .pydevproject create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 commandline/commandline.gsh create mode 100644 compile/eclipsebuild/disableparallelbuilds.gsh create mode 100644 compile/eclipsebuild/eclipseds5build.gsh create mode 100644 configuration/configuration.gsh create mode 100644 differences/.project create mode 100644 differences/.pydevproject create mode 100644 differences/show_release_differences.py create mode 100644 test.gsh create mode 100644 versioncontrol/git.gsh create mode 100644 versionnumbering/versioninfo.py create mode 100644 versionstamping/.project create mode 100644 versionstamping/.pydevproject create mode 100644 versionstamping/versionstamper.py diff --git a/.project b/.project new file mode 100644 index 0000000..e329c3f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Common Build Scripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..1ce5929 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 2.7 +python35 + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..1174a06 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//versionnumbering/versioninfo.py=utf-8 diff --git a/commandline/commandline.gsh b/commandline/commandline.gsh new file mode 100644 index 0000000..df99a75 --- /dev/null +++ b/commandline/commandline.gsh @@ -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/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh new file mode 100644 index 0000000..03e4c8f --- /dev/null +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -0,0 +1,12 @@ + +// Disable parallel make builds - which may be causing autobuild issues +def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { + if (isUnix()) { + sh """ + # Looks for " + + Release_difference + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/differences/.pydevproject b/differences/.pydevproject new file mode 100644 index 0000000..c3434da --- /dev/null +++ b/differences/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Default + diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py new file mode 100644 index 0000000..93d540b --- /dev/null +++ b/differences/show_release_differences.py @@ -0,0 +1,220 @@ +''' +showreleasedifferences -- shortdesc + +showreleasedifferences generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. +''' +import subprocess +import os +import sys +import re + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' + +gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") + +class GitException(Exception): + def __init__(self, message): + self.message = message + + def __repr__(self): + return self.message + +def makeFolder(versionfolder): + print("Creating folder (if not already there): {0}".format(versionfolder)) + os.makedirs(versionfolder, exist_ok = True) + +def printDivider(outfh, times = 1, length = 100): + for _ in range(times): + outfh.write("{0}\n".format("*" * length)) + +TABSIZE = 4 +def printTabbed(outfh, string, tabs = 0): + outfh.write("{0}{1}\n".format(" " * (TABSIZE * tabs), string)) + +def getGitLogDifferences(outfh, gitrootfolder, previousRelease, currentRelease, tripledot = False): + if tripledot: + releaseExpression = previousRelease + "..." + currentRelease + else: + releaseExpression = previousRelease + ".." + currentRelease + currentdir = os.getcwd() + os.chdir(gitrootfolder) + gitlog = [] + printTabbed(outfh, "Executing: {0} {1} {2} {3}".format(gitExecutable, "log", "--oneline", releaseExpression)) + proc = subprocess.Popen([gitExecutable, "log", "--oneline", releaseExpression], stdout=subprocess.PIPE) + while True: + line = proc.stdout.readline() + if line: + linestring = line.decode('utf-8').rstrip() + gitlog.append(linestring) + #printTabbed(outfh, linestring, 1) + else: + break + proc.wait() + if proc.returncode > 0: + raise GitException("Git executable returned an error") + os.chdir(currentdir) + return gitlog + +jiraprojectpattern = { + 'GIS' : ( re.compile("^.* +(?:[gG][iI][sS][ _-]*|[tT]rac \#*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *GIS-(\d+):* (.*)"$'), + ), + 'IMB': ( re.compile("^.* +(?:[Ii][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *IMB-(\d+):* (.*)"$'), + ), + 'HMBXR5601': ( re.compile("^.* +(?:[Hh][Mm][Bb][Xx][Rr]5601[ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBXR5601-(\d+):* (.*)"$'), + ), + 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), + ), + } + +mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") + +def processLog(gitlog, jirakeyprefix): + reverts = [] + merges = {} + other = [] + numbered = {} + (expectedpattern, revertpattern) = jiraprojectpattern[jirakeyprefix] + for line in gitlog: + expectedmatch = expectedpattern.match(line) + revertmatch = revertpattern.match(line) + mergematch = mergepattern.match(line) + if expectedmatch == None and revertmatch == None and mergematch == None: + other.append(line) + if revertmatch: + gisnumber = jirakeyprefix + "-" + revertmatch.group(2) + description = revertmatch.group(3) + reverts.append("Revert: {0} {1}".format(gisnumber, description)) + if mergematch: + merge = mergematch.group(2) + if not merge in merges: + merges[merge] = 1 + else: + merges[merge] += 1 + if expectedmatch: + gisnumber = jirakeyprefix + "-" + expectedmatch.group(1) + description = expectedmatch.group(2) + if not gisnumber in numbered: + numbered[gisnumber] = [] + numbered[gisnumber].append(description) + return (reverts, merges, other, numbered) + +def showDifferences(differences, jirakeyprefix, outfh): + (revertslog, mergeslog, otherlog, numberedlog) = differences + printDivider(outfh) + printTabbed(outfh, jirakeyprefix + "-Numbers Log:") + for (gisnumber, descriptions) in sorted(numberedlog.items()): + printTabbed(outfh, gisnumber, 1) + descriptions = numberedlog[gisnumber]; + for description in descriptions: + printTabbed(outfh, description, 2) + printDivider(outfh) + printTabbed(outfh, "Revert log:") + for reversion in sorted(revertslog): + printTabbed(outfh, reversion, 1) + printDivider(outfh) + printTabbed(outfh, "Merges log:") + for merge in sorted(mergeslog): + printTabbed(outfh, merge, 1) + printDivider(outfh) + printTabbed(outfh, "Other log:") + for other in sorted(otherlog): + printTabbed(outfh, other, 1) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-s", "--sourceversion", dest="sourceversion", action="store", default="origin/master", help="source version branch or tag to discover compare against [default: %(default)s]") + parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") + parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") + parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="", help="version folder where differences file stored [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + try: + gitrootfolder = args.gitrootfolder + sourceversion = args.sourceversion + previousversion = args.previousversion + jirakeyprefix = args.jirakeyprefix + outputoptions = args.outputoptions + versionfolder = args.versionfolder + + print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", versionfolder) + + if versionfolder: + makeFolder(versionfolder) + outfh = open(os.path.join(versionfolder, "differences.txt"), 'w') + else: + outfh = sys.stdout + + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, previousversion, sourceversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, previousversion, sourceversion) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + if 'opposite' in outputoptions.lower(): + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, sourceversion, previousversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + if 'notcommon' in outputoptions.lower(): + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes that are not common to {1} or {2} at path: {0}".format(gitrootfolder, sourceversion, previousversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + + if versionfolder: + outfh.close() + return 0 + except Exception as e: + print("Error while determining differences:", e.__repr__()) + return 1 + + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/test.gsh b/test.gsh new file mode 100644 index 0000000..23fcfc0 --- /dev/null +++ b/test.gsh @@ -0,0 +1,7 @@ +// Methods in this file will end up as object methods on the object that load returns. +def lookAtThis(String whoAreYou) { + echo "Look at this, ${whoAreYou}! You loaded this from another file!" +} + +return this; + diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh new file mode 100644 index 0000000..dbc09ff --- /dev/null +++ b/versioncontrol/git.gsh @@ -0,0 +1,63 @@ +clh = load("${WORKSPACE}/Common_scripts/commandline/commandline.gsh") + +String getGitInfo(String workingSetRootPath) { + dir(workingSetRootPath) { + return clh.getCommandOutput('git log -1 --format=oneline') + } +} + +def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { + reporootenv = env.REPO_ROOT + if (reporootenv != null && repoRoot != "") { + reporootpath = "${reporootenv.trim()}/${repoRoot}" + } else { + reporootpath = "" + 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" + } + 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] + ], + submoduleCfg: [], + ]) +} + +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 + } else { + version = "" + for (key in keys) { + nextversion = versions.get(key) + if (version == "") { + version = nextversion + } + if (nextversion != version) { + return false + } + } + } + return true +} + +return this diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py new file mode 100644 index 0000000..a9d8738 --- /dev/null +++ b/versionnumbering/versioninfo.py @@ -0,0 +1,219 @@ +# encoding: utf-8 +''' +versionnumbering -- shortdesc + +versionnumbering generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. +''' +import os +import sys +import shutil +import subprocess + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' + +gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") +slaveMachine = os.getenv("NODE_NAME", default="-") + +def resetFolder(versionfolder): + print("Removing folders and contents of: {0}".format(versionfolder)) + try: + shutil.rmtree(versionfolder) + except FileNotFoundError: + pass + + print("Creating folder: {0}".format(versionfolder)) + os.makedirs(versionfolder) + +def getGitRevision(gitrootpath, basenumber): + cwd = os.getcwd() + + path = os.path.expanduser(gitrootpath) + print("Changing current working directory to: {0}".format(path)) + os.chdir(path) + + print("Determining revision info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + changecount = completed.stdout.decode("utf-8").strip() + print("Change count: {0}".format(changecount)) + adjustedchangecount = int(changecount) + int(basenumber) + print("Adjusted change count: {0}".format(adjustedchangecount)) + + print("Determining current revision info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + revision = completed.stdout.decode("utf-8").strip() + print("Revision: {0}".format(revision)) + + print("Determining remote info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + remoteinfo = completed.stdout.decode("utf-8") + print("Remote info: {0}".format(remoteinfo)) + + os.chdir(cwd) + print("Restored current working directory to: {0}".format(cwd)) + + return (adjustedchangecount, revision, remoteinfo) + +# Handle: +# origin/master +# origin/2.0.x +def getVersionPrefix(sourcebranch): + print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) + + defaultversionprefix = "1.30000.0." + mastertypeversionprefix = "1.20000.0." + splits = sourcebranch.split('/') + if len(splits) < 1: + print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) + return defaultversionprefix + + sourcebranch = splits[-1] + + if sourcebranch.lower().endswith("master"): # Special case + return mastertypeversionprefix + + splits = sourcebranch.split('.') + versionprefix = "" + if len(splits) < 1: + print("This source branch name has no decimal points in its name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + splitnumbercount = 0 + isIntermediateReleaseBranch = False + for split in splits: + if split.isdigit(): + versionprefix += split + "." + splitnumbercount += 1 + else: + if split == "x": + isIntermediateReleaseBranch = True + break + if splitnumbercount > 2: + break + if splitnumbercount == 0: + print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + if isIntermediateReleaseBranch: + versionprefix = mastertypeversionprefix + elif splitnumbercount == 1: + versionprefix += "0.0." + elif splitnumbercount == 2: + versionprefix += "0." + + print("Determined version prefix to be: {0}".format(versionprefix)) + return versionprefix + +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp): + with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: + f.write(buildjobname) + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(str(gitrevisioncount)) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: + f.write(buildnumber) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) + + with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: + f.write(slaveMachine) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-s", "--sourcebranch", dest="sourcebranch", action="store", default="origin/master", help="source branch name to discover version number [default: %(default)s]") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") + parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") + parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + try: + sourcebranch = args.sourcebranch + versionfolder = args.versionfolder + gitrootfolder = args.gitrootfolder + baseversionnumber = args.baseversionnumber + buildjobname = args.buildjobname + buildnumber = args.buildnumber + + print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) + print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) + + resetFolder(versionfolder) + + (gitrevisioncount, gitrevision, remoteinfo) = getGitRevision(gitrootfolder, baseversionnumber) + + versionprefix = getVersionPrefix(sourcebranch) + + buildstamp = versionprefix + str(gitrevisioncount) + print("Build stamp is: {0}".format(buildstamp)) + + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp) + + return 0 + except Exception as e: + print("Error while creating version info:", e.__repr__()) + return 1 + + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/versionstamping/.project b/versionstamping/.project new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/versionstamping/.project @@ -0,0 +1,17 @@ + + + versionstamping + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/versionstamping/.pydevproject b/versionstamping/.pydevproject new file mode 100644 index 0000000..746d0f0 --- /dev/null +++ b/versionstamping/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +python35 + diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py new file mode 100644 index 0000000..3e59c6f --- /dev/null +++ b/versionstamping/versionstamper.py @@ -0,0 +1,41 @@ +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='1.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)) + + filecopy = filetoconvert + ".orig" + try: + shutil.move(filetoconvert, filecopy) + except FileNotFoundError: + print("Could not find file: {0}\n".format(filetoconvert)) + return 1 + + with open(filetoconvert, 'x') as f: + with open(filecopy,'r') as c: + fileread = c.read() + print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) + converted = fileread.replace(pattern, substitute) + #print ("DEBUG: %s "%converted) + print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) + f.write(converted) + + return 0 + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) From 0512a83425de4e8a056b14fb8a5b2dc610201328 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 11 Oct 2018 20:11:30 +0100 Subject: [PATCH 0188/1971] HMBFDHV-12 - Add HMBFDHV differences search --- differences/show_release_differences.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 93d540b..4937134 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -78,6 +78,9 @@ jiraprojectpattern = { 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), ), + 'HMBFDHV': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Hh][Vv][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBFDHV-(\d+):* (.*)"$'), + ), } mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") From fadf5e954325f20d50142038be5aa428ad5d31af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 11 Oct 2018 20:48:16 +0100 Subject: [PATCH 0189/1971] Fail build if a copy fails --- compile/eclipsebuild/eclipseds5build.gsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9fd5293..3061fea 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -154,7 +154,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou """ } } - doExport(exportfolder, exportpathlist, "", build_variant) + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." + } } catch (Exception e) { echo "Build failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') @@ -166,7 +169,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - doExport(exportfolder, exportpathlist, project) + result = doExport(exportfolder, exportpathlist, project) + if (result != 0) { + error "Failed to copy...." + } } } } From df638458def8228976552ac48bc44e6770b57335 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 11 Oct 2018 20:48:16 +0100 Subject: [PATCH 0190/1971] Fail build if a copy fails --- compile/eclipsebuild/eclipseds5build.gsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9fd5293..3061fea 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -154,7 +154,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou """ } } - doExport(exportfolder, exportpathlist, "", build_variant) + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." + } } catch (Exception e) { echo "Build failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') @@ -166,7 +169,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - doExport(exportfolder, exportpathlist, project) + result = doExport(exportfolder, exportpathlist, project) + if (result != 0) { + error "Failed to copy...." + } } } } From 35cd5c63c6a3dc3074552324c4c387a36d5534f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 15 Oct 2018 15:54:16 +0100 Subject: [PATCH 0191/1971] Merge commit 'fadf5e954325f20d50142038be5aa428ad5d31af' into production --- .project | 17 ++ .pydevproject | 8 + .settings/org.eclipse.core.resources.prefs | 2 + commandline/commandline.gsh | 13 ++ .../eclipsebuild/disableparallelbuilds.gsh | 12 + compile/eclipsebuild/eclipseds5build.gsh | 186 +++++++++++++++ configuration/configuration.gsh | 37 +++ differences/.project | 17 ++ differences/.pydevproject | 8 + differences/show_release_differences.py | 220 ++++++++++++++++++ test.gsh | 7 + versioncontrol/git.gsh | 63 +++++ versionnumbering/versioninfo.py | 219 +++++++++++++++++ versionstamping/.project | 17 ++ versionstamping/.pydevproject | 8 + versionstamping/versionstamper.py | 41 ++++ 16 files changed, 875 insertions(+) create mode 100644 .project create mode 100644 .pydevproject create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 commandline/commandline.gsh create mode 100644 compile/eclipsebuild/disableparallelbuilds.gsh create mode 100644 compile/eclipsebuild/eclipseds5build.gsh create mode 100644 configuration/configuration.gsh create mode 100644 differences/.project create mode 100644 differences/.pydevproject create mode 100644 differences/show_release_differences.py create mode 100644 test.gsh create mode 100644 versioncontrol/git.gsh create mode 100644 versionnumbering/versioninfo.py create mode 100644 versionstamping/.project create mode 100644 versionstamping/.pydevproject create mode 100644 versionstamping/versionstamper.py diff --git a/.project b/.project new file mode 100644 index 0000000..e329c3f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Common Build Scripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..1ce5929 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 2.7 +python35 + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..1174a06 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//versionnumbering/versioninfo.py=utf-8 diff --git a/commandline/commandline.gsh b/commandline/commandline.gsh new file mode 100644 index 0000000..df99a75 --- /dev/null +++ b/commandline/commandline.gsh @@ -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/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.gsh new file mode 100644 index 0000000..03e4c8f --- /dev/null +++ b/compile/eclipsebuild/disableparallelbuilds.gsh @@ -0,0 +1,12 @@ + +// Disable parallel make builds - which may be causing autobuild issues +def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { + if (isUnix()) { + sh """ + # Looks for " + + Release_difference + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/differences/.pydevproject b/differences/.pydevproject new file mode 100644 index 0000000..c3434da --- /dev/null +++ b/differences/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Default + diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py new file mode 100644 index 0000000..93d540b --- /dev/null +++ b/differences/show_release_differences.py @@ -0,0 +1,220 @@ +''' +showreleasedifferences -- shortdesc + +showreleasedifferences generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. +''' +import subprocess +import os +import sys +import re + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' + +gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") + +class GitException(Exception): + def __init__(self, message): + self.message = message + + def __repr__(self): + return self.message + +def makeFolder(versionfolder): + print("Creating folder (if not already there): {0}".format(versionfolder)) + os.makedirs(versionfolder, exist_ok = True) + +def printDivider(outfh, times = 1, length = 100): + for _ in range(times): + outfh.write("{0}\n".format("*" * length)) + +TABSIZE = 4 +def printTabbed(outfh, string, tabs = 0): + outfh.write("{0}{1}\n".format(" " * (TABSIZE * tabs), string)) + +def getGitLogDifferences(outfh, gitrootfolder, previousRelease, currentRelease, tripledot = False): + if tripledot: + releaseExpression = previousRelease + "..." + currentRelease + else: + releaseExpression = previousRelease + ".." + currentRelease + currentdir = os.getcwd() + os.chdir(gitrootfolder) + gitlog = [] + printTabbed(outfh, "Executing: {0} {1} {2} {3}".format(gitExecutable, "log", "--oneline", releaseExpression)) + proc = subprocess.Popen([gitExecutable, "log", "--oneline", releaseExpression], stdout=subprocess.PIPE) + while True: + line = proc.stdout.readline() + if line: + linestring = line.decode('utf-8').rstrip() + gitlog.append(linestring) + #printTabbed(outfh, linestring, 1) + else: + break + proc.wait() + if proc.returncode > 0: + raise GitException("Git executable returned an error") + os.chdir(currentdir) + return gitlog + +jiraprojectpattern = { + 'GIS' : ( re.compile("^.* +(?:[gG][iI][sS][ _-]*|[tT]rac \#*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *GIS-(\d+):* (.*)"$'), + ), + 'IMB': ( re.compile("^.* +(?:[Ii][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *IMB-(\d+):* (.*)"$'), + ), + 'HMBXR5601': ( re.compile("^.* +(?:[Hh][Mm][Bb][Xx][Rr]5601[ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBXR5601-(\d+):* (.*)"$'), + ), + 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), + ), + } + +mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") + +def processLog(gitlog, jirakeyprefix): + reverts = [] + merges = {} + other = [] + numbered = {} + (expectedpattern, revertpattern) = jiraprojectpattern[jirakeyprefix] + for line in gitlog: + expectedmatch = expectedpattern.match(line) + revertmatch = revertpattern.match(line) + mergematch = mergepattern.match(line) + if expectedmatch == None and revertmatch == None and mergematch == None: + other.append(line) + if revertmatch: + gisnumber = jirakeyprefix + "-" + revertmatch.group(2) + description = revertmatch.group(3) + reverts.append("Revert: {0} {1}".format(gisnumber, description)) + if mergematch: + merge = mergematch.group(2) + if not merge in merges: + merges[merge] = 1 + else: + merges[merge] += 1 + if expectedmatch: + gisnumber = jirakeyprefix + "-" + expectedmatch.group(1) + description = expectedmatch.group(2) + if not gisnumber in numbered: + numbered[gisnumber] = [] + numbered[gisnumber].append(description) + return (reverts, merges, other, numbered) + +def showDifferences(differences, jirakeyprefix, outfh): + (revertslog, mergeslog, otherlog, numberedlog) = differences + printDivider(outfh) + printTabbed(outfh, jirakeyprefix + "-Numbers Log:") + for (gisnumber, descriptions) in sorted(numberedlog.items()): + printTabbed(outfh, gisnumber, 1) + descriptions = numberedlog[gisnumber]; + for description in descriptions: + printTabbed(outfh, description, 2) + printDivider(outfh) + printTabbed(outfh, "Revert log:") + for reversion in sorted(revertslog): + printTabbed(outfh, reversion, 1) + printDivider(outfh) + printTabbed(outfh, "Merges log:") + for merge in sorted(mergeslog): + printTabbed(outfh, merge, 1) + printDivider(outfh) + printTabbed(outfh, "Other log:") + for other in sorted(otherlog): + printTabbed(outfh, other, 1) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-s", "--sourceversion", dest="sourceversion", action="store", default="origin/master", help="source version branch or tag to discover compare against [default: %(default)s]") + parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") + parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") + parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="", help="version folder where differences file stored [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + try: + gitrootfolder = args.gitrootfolder + sourceversion = args.sourceversion + previousversion = args.previousversion + jirakeyprefix = args.jirakeyprefix + outputoptions = args.outputoptions + versionfolder = args.versionfolder + + print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", versionfolder) + + if versionfolder: + makeFolder(versionfolder) + outfh = open(os.path.join(versionfolder, "differences.txt"), 'w') + else: + outfh = sys.stdout + + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, previousversion, sourceversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, previousversion, sourceversion) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + if 'opposite' in outputoptions.lower(): + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, sourceversion, previousversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + if 'notcommon' in outputoptions.lower(): + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes that are not common to {1} or {2} at path: {0}".format(gitrootfolder, sourceversion, previousversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + + if versionfolder: + outfh.close() + return 0 + except Exception as e: + print("Error while determining differences:", e.__repr__()) + return 1 + + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/test.gsh b/test.gsh new file mode 100644 index 0000000..23fcfc0 --- /dev/null +++ b/test.gsh @@ -0,0 +1,7 @@ +// Methods in this file will end up as object methods on the object that load returns. +def lookAtThis(String whoAreYou) { + echo "Look at this, ${whoAreYou}! You loaded this from another file!" +} + +return this; + diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh new file mode 100644 index 0000000..dbc09ff --- /dev/null +++ b/versioncontrol/git.gsh @@ -0,0 +1,63 @@ +clh = load("${WORKSPACE}/Common_scripts/commandline/commandline.gsh") + +String getGitInfo(String workingSetRootPath) { + dir(workingSetRootPath) { + return clh.getCommandOutput('git log -1 --format=oneline') + } +} + +def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { + reporootenv = env.REPO_ROOT + if (reporootenv != null && repoRoot != "") { + reporootpath = "${reporootenv.trim()}/${repoRoot}" + } else { + reporootpath = "" + 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" + } + 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] + ], + submoduleCfg: [], + ]) +} + +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 + } else { + version = "" + for (key in keys) { + nextversion = versions.get(key) + if (version == "") { + version = nextversion + } + if (nextversion != version) { + return false + } + } + } + return true +} + +return this diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py new file mode 100644 index 0000000..a9d8738 --- /dev/null +++ b/versionnumbering/versioninfo.py @@ -0,0 +1,219 @@ +# encoding: utf-8 +''' +versionnumbering -- shortdesc + +versionnumbering generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. +''' +import os +import sys +import shutil +import subprocess + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' + +gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") +slaveMachine = os.getenv("NODE_NAME", default="-") + +def resetFolder(versionfolder): + print("Removing folders and contents of: {0}".format(versionfolder)) + try: + shutil.rmtree(versionfolder) + except FileNotFoundError: + pass + + print("Creating folder: {0}".format(versionfolder)) + os.makedirs(versionfolder) + +def getGitRevision(gitrootpath, basenumber): + cwd = os.getcwd() + + path = os.path.expanduser(gitrootpath) + print("Changing current working directory to: {0}".format(path)) + os.chdir(path) + + print("Determining revision info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + changecount = completed.stdout.decode("utf-8").strip() + print("Change count: {0}".format(changecount)) + adjustedchangecount = int(changecount) + int(basenumber) + print("Adjusted change count: {0}".format(adjustedchangecount)) + + print("Determining current revision info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + revision = completed.stdout.decode("utf-8").strip() + print("Revision: {0}".format(revision)) + + print("Determining remote info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + remoteinfo = completed.stdout.decode("utf-8") + print("Remote info: {0}".format(remoteinfo)) + + os.chdir(cwd) + print("Restored current working directory to: {0}".format(cwd)) + + return (adjustedchangecount, revision, remoteinfo) + +# Handle: +# origin/master +# origin/2.0.x +def getVersionPrefix(sourcebranch): + print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) + + defaultversionprefix = "1.30000.0." + mastertypeversionprefix = "1.20000.0." + splits = sourcebranch.split('/') + if len(splits) < 1: + print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) + return defaultversionprefix + + sourcebranch = splits[-1] + + if sourcebranch.lower().endswith("master"): # Special case + return mastertypeversionprefix + + splits = sourcebranch.split('.') + versionprefix = "" + if len(splits) < 1: + print("This source branch name has no decimal points in its name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + splitnumbercount = 0 + isIntermediateReleaseBranch = False + for split in splits: + if split.isdigit(): + versionprefix += split + "." + splitnumbercount += 1 + else: + if split == "x": + isIntermediateReleaseBranch = True + break + if splitnumbercount > 2: + break + if splitnumbercount == 0: + print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + if isIntermediateReleaseBranch: + versionprefix = mastertypeversionprefix + elif splitnumbercount == 1: + versionprefix += "0.0." + elif splitnumbercount == 2: + versionprefix += "0." + + print("Determined version prefix to be: {0}".format(versionprefix)) + return versionprefix + +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp): + with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: + f.write(buildjobname) + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(str(gitrevisioncount)) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: + f.write(buildnumber) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) + + with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: + f.write(slaveMachine) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-s", "--sourcebranch", dest="sourcebranch", action="store", default="origin/master", help="source branch name to discover version number [default: %(default)s]") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") + parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") + parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + try: + sourcebranch = args.sourcebranch + versionfolder = args.versionfolder + gitrootfolder = args.gitrootfolder + baseversionnumber = args.baseversionnumber + buildjobname = args.buildjobname + buildnumber = args.buildnumber + + print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) + print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) + + resetFolder(versionfolder) + + (gitrevisioncount, gitrevision, remoteinfo) = getGitRevision(gitrootfolder, baseversionnumber) + + versionprefix = getVersionPrefix(sourcebranch) + + buildstamp = versionprefix + str(gitrevisioncount) + print("Build stamp is: {0}".format(buildstamp)) + + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp) + + return 0 + except Exception as e: + print("Error while creating version info:", e.__repr__()) + return 1 + + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/versionstamping/.project b/versionstamping/.project new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/versionstamping/.project @@ -0,0 +1,17 @@ + + + versionstamping + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/versionstamping/.pydevproject b/versionstamping/.pydevproject new file mode 100644 index 0000000..746d0f0 --- /dev/null +++ b/versionstamping/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +python35 + diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py new file mode 100644 index 0000000..3e59c6f --- /dev/null +++ b/versionstamping/versionstamper.py @@ -0,0 +1,41 @@ +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='1.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)) + + filecopy = filetoconvert + ".orig" + try: + shutil.move(filetoconvert, filecopy) + except FileNotFoundError: + print("Could not find file: {0}\n".format(filetoconvert)) + return 1 + + with open(filetoconvert, 'x') as f: + with open(filecopy,'r') as c: + fileread = c.read() + print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) + converted = fileread.replace(pattern, substitute) + #print ("DEBUG: %s "%converted) + print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) + f.write(converted) + + return 0 + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) From 1d9684363a4cc0efe5dadc3b18269c11a1f76a3b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 16 Oct 2018 08:50:30 +0100 Subject: [PATCH 0192/1971] Merge commit 'fadf5e954325f20d50142038be5aa428ad5d31af' --- compile/eclipsebuild/eclipseds5build.gsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 9fd5293..3061fea 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -154,7 +154,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou """ } } - doExport(exportfolder, exportpathlist, "", build_variant) + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." + } } catch (Exception e) { echo "Build failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') @@ -166,7 +169,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - doExport(exportfolder, exportpathlist, project) + result = doExport(exportfolder, exportpathlist, project) + if (result != 0) { + error "Failed to copy...." + } } } } From d202c89bfa3fc0e2ce83bf65cd7e0872246c53eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 24 Oct 2018 10:07:49 +0100 Subject: [PATCH 0193/1971] Move json file comparison to subtree area --- differences/json.gsh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 differences/json.gsh diff --git a/differences/json.gsh b/differences/json.gsh new file mode 100644 index 0000000..47d9cc5 --- /dev/null +++ b/differences/json.gsh @@ -0,0 +1,15 @@ +def comparefiles(importedjsonfile, currentjsonfile) { + env.IMPORTED_JSON="${importedjsonfile}" + env.CURRENT_JSON="${currentjsonfile}" + if (isUnix()) { + sh """ + # jq -S sorts json output + diff -c <(jq -S . "${IMPORTED_JSON}") <(jq -S . "${CURRENT_JSON}") + """ + } + else { + error "Windows not currently supporting json file comparison" + } +} + +return this; From 2dfbe7b4c33a2313ab78fc562686d9d3c5dbed1a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 24 Oct 2018 13:32:04 +0100 Subject: [PATCH 0194/1971] Move meta artifact builder to common scripts subtree area --- artifacts/metaexport.gsh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 artifacts/metaexport.gsh diff --git a/artifacts/metaexport.gsh b/artifacts/metaexport.gsh new file mode 100644 index 0000000..368871e --- /dev/null +++ b/artifacts/metaexport.gsh @@ -0,0 +1,24 @@ + +// Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders +def combineSubjobArtifacts(subJobs, artifactFolders, exportRootFolder = "${WORKSPACE}") { + artifactFolders = "" + for (subJob in subJobs) { + subJobObject = subJob[0] + artifactFolder = subJob[1] + if (subJobObject != null) { + subJobName = subJobObject.getProjectName() + subJobNumber = subJobObject.getNumber() + destFolder = "${exportRootFolder}/${artifactFolder}" + + dir("${destFolder}") { + deleteDir() + } + + echo "Copying artifacts from: Job: ${subJobName} Number: ${subJobNumber} to folder: ${destFolder}" + copyArtifacts fingerprintArtifacts: true, projectName: "${subJobName}", selector: specific("${subJobNumber}"), target: "${destFolder}" + artifactFolders += "${destFolder}/**," + } + } +} + +return this; From 2393df8cb20b15b5a60ed6a6989263189df86005 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 24 Oct 2018 13:32:04 +0100 Subject: [PATCH 0195/1971] Move meta artifact builder to common scripts subtree area --- artifacts/metaexport.gsh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 artifacts/metaexport.gsh diff --git a/artifacts/metaexport.gsh b/artifacts/metaexport.gsh new file mode 100644 index 0000000..368871e --- /dev/null +++ b/artifacts/metaexport.gsh @@ -0,0 +1,24 @@ + +// Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders +def combineSubjobArtifacts(subJobs, artifactFolders, exportRootFolder = "${WORKSPACE}") { + artifactFolders = "" + for (subJob in subJobs) { + subJobObject = subJob[0] + artifactFolder = subJob[1] + if (subJobObject != null) { + subJobName = subJobObject.getProjectName() + subJobNumber = subJobObject.getNumber() + destFolder = "${exportRootFolder}/${artifactFolder}" + + dir("${destFolder}") { + deleteDir() + } + + echo "Copying artifacts from: Job: ${subJobName} Number: ${subJobNumber} to folder: ${destFolder}" + copyArtifacts fingerprintArtifacts: true, projectName: "${subJobName}", selector: specific("${subJobNumber}"), target: "${destFolder}" + artifactFolders += "${destFolder}/**," + } + } +} + +return this; From 36e3212d79afc20d29b2eed2266e2f0216cfaddf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 24 Oct 2018 14:24:17 +0100 Subject: [PATCH 0196/1971] Move meta artifact builder to common scripts subtree area --- artifacts/metaexport.gsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/artifacts/metaexport.gsh b/artifacts/metaexport.gsh index 368871e..66a8153 100644 --- a/artifacts/metaexport.gsh +++ b/artifacts/metaexport.gsh @@ -1,6 +1,6 @@ // Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders -def combineSubjobArtifacts(subJobs, artifactFolders, exportRootFolder = "${WORKSPACE}") { +def combineSubjobArtifacts(subJobs) { artifactFolders = "" for (subJob in subJobs) { subJobObject = subJob[0] @@ -8,7 +8,7 @@ def combineSubjobArtifacts(subJobs, artifactFolders, exportRootFolder = "${WORKS if (subJobObject != null) { subJobName = subJobObject.getProjectName() subJobNumber = subJobObject.getNumber() - destFolder = "${exportRootFolder}/${artifactFolder}" + destFolder = "${artifactFolder}" dir("${destFolder}") { deleteDir() @@ -19,6 +19,7 @@ def combineSubjobArtifacts(subJobs, artifactFolders, exportRootFolder = "${WORKS artifactFolders += "${destFolder}/**," } } + return artifactFolders; } return this; From 18c1343663e761a9733f739c2bb6de4b3c783eea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 24 Oct 2018 14:24:17 +0100 Subject: [PATCH 0197/1971] Move meta artifact builder to common scripts subtree area --- artifacts/metaexport.gsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/artifacts/metaexport.gsh b/artifacts/metaexport.gsh index 368871e..66a8153 100644 --- a/artifacts/metaexport.gsh +++ b/artifacts/metaexport.gsh @@ -1,6 +1,6 @@ // Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders -def combineSubjobArtifacts(subJobs, artifactFolders, exportRootFolder = "${WORKSPACE}") { +def combineSubjobArtifacts(subJobs) { artifactFolders = "" for (subJob in subJobs) { subJobObject = subJob[0] @@ -8,7 +8,7 @@ def combineSubjobArtifacts(subJobs, artifactFolders, exportRootFolder = "${WORKS if (subJobObject != null) { subJobName = subJobObject.getProjectName() subJobNumber = subJobObject.getNumber() - destFolder = "${exportRootFolder}/${artifactFolder}" + destFolder = "${artifactFolder}" dir("${destFolder}") { deleteDir() @@ -19,6 +19,7 @@ def combineSubjobArtifacts(subJobs, artifactFolders, exportRootFolder = "${WORKS artifactFolders += "${destFolder}/**," } } + return artifactFolders; } return this; From e7c44d4fd43da49cf3468a18a511757e61f3f650 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 25 Oct 2018 00:09:04 +0100 Subject: [PATCH 0198/1971] Add utility to make build stamp representing a set of components --- versionnumbering/complexversioninfo.py | 220 +++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 versionnumbering/complexversioninfo.py diff --git a/versionnumbering/complexversioninfo.py b/versionnumbering/complexversioninfo.py new file mode 100644 index 0000000..be6ada4 --- /dev/null +++ b/versionnumbering/complexversioninfo.py @@ -0,0 +1,220 @@ +# encoding: utf-8 +''' +complexversionnumbering -- shortdesc + +complexversionnumbering generates a version folder with a common set of version information files in it for a complex component (consisting of many subcomponents) + +@author: dan + +@copyright: 2018 Global Inkjet Systems Ltd. All rights reserved. +''' +import os +import sys +import shutil +import subprocess + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2018-10-24' +__updated__ = '2018-10-24' + +gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") +slaveMachine = os.getenv("NODE_NAME", default="-") + +def resetFolder(versionfolder): + print("Removing folders and contents of: {0}".format(versionfolder)) + try: + shutil.rmtree(versionfolder) + except FileNotFoundError: + pass + + print("Creating folder: {0}".format(versionfolder)) + os.makedirs(versionfolder) + +def getGitRevision(gitrootpath, basenumber): + cwd = os.getcwd() + + path = os.path.expanduser(gitrootpath) + print("Changing current working directory to: {0}".format(path)) + os.chdir(path) + + print("Determining revision info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + changecount = completed.stdout.decode("utf-8").strip() + print("Change count: {0}".format(changecount)) + adjustedchangecount = int(changecount) + int(basenumber) + print("Adjusted change count: {0}".format(adjustedchangecount)) + + print("Determining current revision info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + revision = completed.stdout.decode("utf-8").strip() + print("Revision: {0}".format(revision)) + + print("Determining remote info using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + remoteinfo = completed.stdout.decode("utf-8") + print("Remote info: {0}".format(remoteinfo)) + + os.chdir(cwd) + print("Restored current working directory to: {0}".format(cwd)) + + return (adjustedchangecount, revision, remoteinfo) + +# Handle: +# origin/master +# origin/2.0.x +def getVersionPrefix(sourcebranch): + print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) + + defaultversionprefix = "1.30000.0." + mastertypeversionprefix = "1.20000.0." + splits = sourcebranch.split('/') + if len(splits) < 1: + print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) + return defaultversionprefix + + sourcebranch = splits[-1] + + if sourcebranch.lower().endswith("master"): # Special case + return mastertypeversionprefix + + splits = sourcebranch.split('.') + versionprefix = "" + if len(splits) < 1: + print("This source branch name has no decimal points in its name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + splitnumbercount = 0 + isIntermediateReleaseBranch = False + for split in splits: + if split.isdigit(): + versionprefix += split + "." + splitnumbercount += 1 + else: + if split == "x": + isIntermediateReleaseBranch = True + break + if splitnumbercount > 2: + break + if splitnumbercount == 0: + print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + if isIntermediateReleaseBranch: + versionprefix = mastertypeversionprefix + elif splitnumbercount == 1: + versionprefix += "0.0." + elif splitnumbercount == 2: + versionprefix += "0." + + print("Determined version prefix to be: {0}".format(versionprefix)) + return versionprefix + +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp): + with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: + f.write(buildjobname) + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(str(gitrevisioncount)) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: + f.write(buildnumber) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) + + with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: + f.write(slaveMachine) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-p", "--stampprefix", dest="stampprefix", action="store", default="1.30000.0", help="A prefix to help identify this build [default: %(default)s]") + parser.add_argument("-s", "--subbuildstamp", dest="subbuildstamp", nargs='+', action="store", help="A subcomponent build stamp - there must be 1 or more") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") + parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") + parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") + parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + try: + stampprefix = args.stampprefix + subbuildstamp = args.subbuildstamp + versionfolder = args.versionfolder + gitrootfolder = args.gitrootfolder + baseversionnumber = args.baseversionnumber + buildjobname = args.buildjobname + buildnumber = args.buildnumber + + print("Stamp prefix:", stampprefix, "sub build stamp:", subbuildstamp, "version folder:", versionfolder, "Git root:", gitrootfolder) + print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) + + resetFolder(versionfolder) + + (gitrevisioncount, gitrevision, remoteinfo) = getGitRevision(gitrootfolder, baseversionnumber) + + versionprefix = getVersionPrefix(sourcebranch) + + buildstamp = versionprefix + str(gitrevisioncount) + print("Build stamp is: {0}".format(buildstamp)) + + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp) + + return 0 + except Exception as e: + print("Error while creating version info:", e.__repr__()) + return 1 + + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) From 1d959d0a85015f21525ec5ebaf656d5c118c8e11 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 25 Oct 2018 23:04:31 +0100 Subject: [PATCH 0199/1971] Detect branches with 'master' string better; Split numbers better in branch names --- versionnumbering/versioninfo.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index a9d8738..7e6043f 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -12,6 +12,7 @@ import os import sys import shutil import subprocess +import re from argparse import ArgumentParser from argparse import RawDescriptionHelpFormatter @@ -81,13 +82,18 @@ def getVersionPrefix(sourcebranch): sourcebranch = splits[-1] - if sourcebranch.lower().endswith("master"): # Special case + if sourcebranch.lower().find("master") != -1: # Special case return mastertypeversionprefix - splits = sourcebranch.split('.') + splits2 = re.sourcebranch(r'(\d+)', v) + splits = [] + for split in splits2: + if split.isdigit(): + splits.append(split) + versionprefix = "" if len(splits) < 1: - print("This source branch name has no decimal points in its name so defaulting to: {0}".format(defaultversionprefix)) + print("This source branch name has no numbers in its name so defaulting to: {0}".format(defaultversionprefix)) versionprefix = defaultversionprefix else: splitnumbercount = 0 From 9a4601e41e9fe627df818126f6c241a91bf01b5e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 25 Oct 2018 23:12:00 +0100 Subject: [PATCH 0200/1971] Detect branches with 'master' string better; Split numbers better in branch names --- versionnumbering/versioninfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 7e6043f..b0d8ba1 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -85,7 +85,7 @@ def getVersionPrefix(sourcebranch): if sourcebranch.lower().find("master") != -1: # Special case return mastertypeversionprefix - splits2 = re.sourcebranch(r'(\d+)', v) + splits2 = re.split(r'(\d+)', sourcebranch) splits = [] for split in splits2: if split.isdigit(): From 883ea65599072260c7d13e61c1cf792115e51d83 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Oct 2018 00:19:26 +0100 Subject: [PATCH 0201/1971] Add metaversion generation --- versionnumbering/complexversioninfo.py | 220 ------------------------- versionnumbering/metaversion.gsh | 41 +++++ 2 files changed, 41 insertions(+), 220 deletions(-) delete mode 100644 versionnumbering/complexversioninfo.py create mode 100644 versionnumbering/metaversion.gsh diff --git a/versionnumbering/complexversioninfo.py b/versionnumbering/complexversioninfo.py deleted file mode 100644 index be6ada4..0000000 --- a/versionnumbering/complexversioninfo.py +++ /dev/null @@ -1,220 +0,0 @@ -# encoding: utf-8 -''' -complexversionnumbering -- shortdesc - -complexversionnumbering generates a version folder with a common set of version information files in it for a complex component (consisting of many subcomponents) - -@author: dan - -@copyright: 2018 Global Inkjet Systems Ltd. All rights reserved. -''' -import os -import sys -import shutil -import subprocess - -from argparse import ArgumentParser -from argparse import RawDescriptionHelpFormatter - -__all__ = [] -__version__ = 0.1 -__date__ = '2018-10-24' -__updated__ = '2018-10-24' - -gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") -slaveMachine = os.getenv("NODE_NAME", default="-") - -def resetFolder(versionfolder): - print("Removing folders and contents of: {0}".format(versionfolder)) - try: - shutil.rmtree(versionfolder) - except FileNotFoundError: - pass - - print("Creating folder: {0}".format(versionfolder)) - os.makedirs(versionfolder) - -def getGitRevision(gitrootpath, basenumber): - cwd = os.getcwd() - - path = os.path.expanduser(gitrootpath) - print("Changing current working directory to: {0}".format(path)) - os.chdir(path) - - print("Determining revision info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - changecount = completed.stdout.decode("utf-8").strip() - print("Change count: {0}".format(changecount)) - adjustedchangecount = int(changecount) + int(basenumber) - print("Adjusted change count: {0}".format(adjustedchangecount)) - - print("Determining current revision info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - revision = completed.stdout.decode("utf-8").strip() - print("Revision: {0}".format(revision)) - - print("Determining remote info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - remoteinfo = completed.stdout.decode("utf-8") - print("Remote info: {0}".format(remoteinfo)) - - os.chdir(cwd) - print("Restored current working directory to: {0}".format(cwd)) - - return (adjustedchangecount, revision, remoteinfo) - -# Handle: -# origin/master -# origin/2.0.x -def getVersionPrefix(sourcebranch): - print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) - - defaultversionprefix = "1.30000.0." - mastertypeversionprefix = "1.20000.0." - splits = sourcebranch.split('/') - if len(splits) < 1: - print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) - return defaultversionprefix - - sourcebranch = splits[-1] - - if sourcebranch.lower().endswith("master"): # Special case - return mastertypeversionprefix - - splits = sourcebranch.split('.') - versionprefix = "" - if len(splits) < 1: - print("This source branch name has no decimal points in its name so defaulting to: {0}".format(defaultversionprefix)) - versionprefix = defaultversionprefix - else: - splitnumbercount = 0 - isIntermediateReleaseBranch = False - for split in splits: - if split.isdigit(): - versionprefix += split + "." - splitnumbercount += 1 - else: - if split == "x": - isIntermediateReleaseBranch = True - break - if splitnumbercount > 2: - break - if splitnumbercount == 0: - print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) - versionprefix = defaultversionprefix - else: - if isIntermediateReleaseBranch: - versionprefix = mastertypeversionprefix - elif splitnumbercount == 1: - versionprefix += "0.0." - elif splitnumbercount == 2: - versionprefix += "0." - - print("Determined version prefix to be: {0}".format(versionprefix)) - return versionprefix - -def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp): - with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: - f.write(buildjobname) - - with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: - f.write(versionprefix) - - with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: - f.write(str(gitrevisioncount)) - - with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: - f.write(gitrevision) - - with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: - f.write(remoteinfo) - - with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: - f.write(buildnumber) - - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: - f.write(buildstamp) - - buildstampcommasep = buildstamp.replace(".", ",") - with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: - f.write(buildstampcommasep) - - with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: - f.write(slaveMachine) - -def main(argv=None): # IGNORE:C0111 - '''Command line options.''' - - if argv is None: - argv = sys.argv - else: - sys.argv.extend(argv) - - program_name = os.path.basename(sys.argv[0]) - program_version = "v%s" % __version__ - program_build_date = str(__updated__) - program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) - program_shortdesc = __import__('__main__').__doc__.split("\n")[1] - program_license = '''%s - - Created by dan on %s. - Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. - - Distributed on an "AS IS" basis without warranties - or conditions of any kind, either express or implied. - -USAGE -''' % (program_shortdesc, str(__date__)) - - try: - # Setup argument parser - parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) - parser.add_argument("-p", "--stampprefix", dest="stampprefix", action="store", default="1.30000.0", help="A prefix to help identify this build [default: %(default)s]") - parser.add_argument("-s", "--subbuildstamp", dest="subbuildstamp", nargs='+', action="store", help="A subcomponent build stamp - there must be 1 or more") - parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") - parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") - parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") - parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") - - # Process arguments - args = parser.parse_args() - - try: - stampprefix = args.stampprefix - subbuildstamp = args.subbuildstamp - versionfolder = args.versionfolder - gitrootfolder = args.gitrootfolder - baseversionnumber = args.baseversionnumber - buildjobname = args.buildjobname - buildnumber = args.buildnumber - - print("Stamp prefix:", stampprefix, "sub build stamp:", subbuildstamp, "version folder:", versionfolder, "Git root:", gitrootfolder) - print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) - - resetFolder(versionfolder) - - (gitrevisioncount, gitrevision, remoteinfo) = getGitRevision(gitrootfolder, baseversionnumber) - - versionprefix = getVersionPrefix(sourcebranch) - - buildstamp = versionprefix + str(gitrevisioncount) - print("Build stamp is: {0}".format(buildstamp)) - - writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp) - - return 0 - except Exception as e: - print("Error while creating version info:", e.__repr__()) - return 1 - - except Exception as e: - indent = len(program_name) * " " - print(program_name + ": " + repr(e) + "\n") - print(indent + " for help use --help") - return 2 - -if __name__ == "__main__": - sys.exit(main()) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh new file mode 100644 index 0000000..b4b1ad7 --- /dev/null +++ b/versionnumbering/metaversion.gsh @@ -0,0 +1,41 @@ + +// Each version folder should have been created using version creation scripts in this Common_scripts folder +// as their are well-known files in each folder +def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = "${WORKSPACE}/metaversion") { + env.VLP = versionLabelPrefix + env.OF = outputFolder + totalrevision = 0 + if (isUnix()) { + sh """#!/bin/bash + + rm -rf "${OF}" + mkdir -p "${OF}" + if [ \$? -ne 0 ]; then exit 1; fi + + touch "${OF}/differences.txt" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + error "combineSubjobVersions script is not supported in Windows yet" + } + for (versionFolder in versionFolderList) { + env.differemcesFile = "${versionFolder}/differences.txt" + sh """#!/bin/bash + + echo ${differencesFile} >> "${OF}/differences.txt" + if [ \$? -ne 0 ]; then exit 1; fi + + cat "${differencesFile}" >> "${OF}/differences.txt" + if [ \$? -ne 0 ]; then exit 1; fi + """ + revision = readFile("${versionFolder}/revision.txt").trim() + intrevision = revision.toInteger() + echo "Revision read in: ${intrevision}" + totalrevision += intrevision + echo "Accumulated revision is: ${totalrevision}" + } + writeFile file: "${OF}/metaversion.txt" text: versionLabelPrefix + "." + totalrevision +} + +return this; \ No newline at end of file From 55ef090a86d3f317b7a85189dc6cfca2808a7870 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Oct 2018 08:37:10 +0100 Subject: [PATCH 0202/1971] Add metaversion generation --- versionnumbering/metaversion.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index b4b1ad7..c6eee74 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -35,7 +35,7 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = totalrevision += intrevision echo "Accumulated revision is: ${totalrevision}" } - writeFile file: "${OF}/metaversion.txt" text: versionLabelPrefix + "." + totalrevision + writeFile file: "${OF}/metaversion.txt", text: versionLabelPrefix + "." + totalrevision } return this; \ No newline at end of file From bca6d804dd82173d1e1bacc54ff0dee8ed7f62ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Oct 2018 09:13:34 +0100 Subject: [PATCH 0203/1971] Add metaversion generation --- versionnumbering/metaversion.gsh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index c6eee74..e1cdaf6 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -14,28 +14,46 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = touch "${OF}/differences.txt" if [ \$? -ne 0 ]; then exit 1; fi + + touch "${OF}/buildstamps.txt" + if [ \$? -ne 0 ]; then exit 1; fi + """ } else { error "combineSubjobVersions script is not supported in Windows yet" } for (versionFolder in versionFolderList) { - env.differemcesFile = "${versionFolder}/differences.txt" + env.differencesFile = "${versionFolder}/differences.txt" sh """#!/bin/bash - echo ${differencesFile} >> "${OF}/differences.txt" + echo ${differencesFile}: >> "${OF}/differences.txt" if [ \$? -ne 0 ]; then exit 1; fi cat "${differencesFile}" >> "${OF}/differences.txt" if [ \$? -ne 0 ]; then exit 1; fi """ + env.buildStampFile = "${versionFolder}/buildstamp.txt" + sh """#!/bin/bash + + echo ${versionFolder}: >> "${OF}/buildstamps.txt" + if [ \$? -ne 0 ]; then exit 1; fi + + cat "${buildStampFile}" >> "${OF}/buildstamps.txt" + if [ \$? -ne 0 ]; then exit 1; fi + """ revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" totalrevision += intrevision echo "Accumulated revision is: ${totalrevision}" } - writeFile file: "${OF}/metaversion.txt", text: versionLabelPrefix + "." + totalrevision + if (versionLabelPrefix.endsWith(".")) { + writeFile file: "${OF}/metaversion.txt", text: versionLabelPrefix + totalrevision + } + else { + writeFile file: "${OF}/metaversion.txt", text: versionLabelPrefix + "." + totalrevision + } } return this; \ No newline at end of file From 614a4b1e6b47f71c967780af75faa9090fe0fa1a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Oct 2018 13:37:17 +0100 Subject: [PATCH 0204/1971] Add metaversion generation --- test.gsh | 7 ------- versionnumbering/metaversion.gsh | 13 +++++-------- 2 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 test.gsh diff --git a/test.gsh b/test.gsh deleted file mode 100644 index 23fcfc0..0000000 --- a/test.gsh +++ /dev/null @@ -1,7 +0,0 @@ -// Methods in this file will end up as object methods on the object that load returns. -def lookAtThis(String whoAreYou) { - echo "Look at this, ${whoAreYou}! You loaded this from another file!" -} - -return this; - diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index e1cdaf6..aab7319 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -33,15 +33,12 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = cat "${differencesFile}" >> "${OF}/differences.txt" if [ \$? -ne 0 ]; then exit 1; fi """ - env.buildStampFile = "${versionFolder}/buildstamp.txt" - sh """#!/bin/bash + buildStampFile = "${versionFolder}/buildstamp.txt" + buildStampFileContents = readFile "${buildStampFile}" + metabuildStampFile = "${OF}/buildstamps.txt" + metabuildStampFileContents = readFile "${metabuildStampFile}" + writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ": " + buildStampFileContents - echo ${versionFolder}: >> "${OF}/buildstamps.txt" - if [ \$? -ne 0 ]; then exit 1; fi - - cat "${buildStampFile}" >> "${OF}/buildstamps.txt" - if [ \$? -ne 0 ]; then exit 1; fi - """ revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" From 4d9723e6155fb264bcebfcd44e5ba79740c58f07 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 27 Oct 2018 10:25:22 +0100 Subject: [PATCH 0205/1971] MCS compile should use build stamp generated by Common_scripts --- versionnumbering/versioninfo.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index b0d8ba1..62af192 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -13,6 +13,7 @@ import sys import shutil import subprocess import re +import datetime from argparse import ArgumentParser from argparse import RawDescriptionHelpFormatter @@ -151,6 +152,9 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: f.write(slaveMachine) + with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: + f.write(str(datetime.datetime.now)) + def main(argv=None): # IGNORE:C0111 '''Command line options.''' From 34e273f84a839d485344e24a372defea78d50054 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 27 Oct 2018 10:45:59 +0100 Subject: [PATCH 0206/1971] Add MCS jira key search --- differences/show_release_differences.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 4937134..2d3ee0d 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -78,6 +78,9 @@ jiraprojectpattern = { 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), ), + 'MCS': ( re.compile("^.* +(?:[Mm][Cc][Ss][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *MCS-(\d+):* (.*)"$'), + ), 'HMBFDHV': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Hh][Vv][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *HMBFDHV-(\d+):* (.*)"$'), ), From 476b4a59489df06cc15a6c29b7bf4ef514ef4d41 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 27 Oct 2018 10:56:49 +0100 Subject: [PATCH 0207/1971] Change base build number to match previous build system --- versionnumbering/versioninfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 62af192..1a6a72b 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -153,7 +153,7 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou f.write(slaveMachine) with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: - f.write(str(datetime.datetime.now)) + f.write(str(datetime.datetime.now())) def main(argv=None): # IGNORE:C0111 '''Command line options.''' From a441a0ba43586b6ff9db5c90d146e59f4e135f3a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 28 Oct 2018 00:24:11 +0100 Subject: [PATCH 0208/1971] Handle case where there only one version folder --- versioncontrol/git.gsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index dbc09ff..904394d 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -43,9 +43,13 @@ String getSHAFromVersion(String versionFolder) { boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { def keys = versions.keySet() - if (keys.size() <= 1) { + if (keys.size() < 1) { return false - } else { + } + if (keys.size() == 1) { + return true + } + else { version = "" for (key in keys) { nextversion = versions.get(key) From eaa8de01d5169f93d19b98699bd066e1650b4aea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 11:43:56 +0000 Subject: [PATCH 0209/1971] Move autobuild scripts into their own folder --- configuration/configuration.gsh | 2 +- versioncontrol/git.gsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index b91e0a3..9f60c0a 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -1,4 +1,4 @@ -gh = load("${WORKSPACE}/Common_scripts/versioncontrol/git.gsh") +gh = load("${COMMON_SCRIPTS}/versioncontrol/git.gsh") configurationCollection = [:] diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 904394d..51dbd5d 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -1,4 +1,4 @@ -clh = load("${WORKSPACE}/Common_scripts/commandline/commandline.gsh") +clh = load("${COMMON_SCRIPTS}/commandline/commandline.gsh") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { From 29d0f5e2ad63ff325ff9d5b2972b5d4b7b59f640 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 11:52:23 +0000 Subject: [PATCH 0210/1971] Move autobuild scripts into their own folder --- configuration/configuration.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index 9f60c0a..5688482 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -8,7 +8,7 @@ def registerConfigurationInfo(String configurationName, String configurationURL, } def registerPipelineScriptConfiguration() { - registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${WORKSPACE}")) + registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${AUTOBUILD_SCRIPTS}")) } def saveConfigurationInVersionInfo() { From 34d5e771d77e356073a4e98857073b508b8ccaee Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 16:24:16 +0000 Subject: [PATCH 0211/1971] When working out what version prefix to use from a revision - if there are no dots (but there are numbers) default to 1.25000.0. --- versionnumbering/versioninfo.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 1a6a72b..ae2b0ee 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -76,6 +76,7 @@ def getVersionPrefix(sourcebranch): defaultversionprefix = "1.30000.0." mastertypeversionprefix = "1.20000.0." + thirdpartyversionprefix = "1.25000.0." splits = sourcebranch.split('/') if len(splits) < 1: print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) @@ -88,9 +89,16 @@ def getVersionPrefix(sourcebranch): splits2 = re.split(r'(\d+)', sourcebranch) splits = [] + hasdot = False for split in splits2: if split.isdigit(): splits.append(split) + if split == ".": + hasdot = True + + if not hasdot: + print("Source branch name has not dots in it (eg. 1.9.2). Defaulting to: {0}".format(thirdpartyversionprefix)) + return thirdpartyversionprefix versionprefix = "" if len(splits) < 1: From 8f9f29cad5badfa19290a59e3d7e13a9a197214a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 16:24:16 +0000 Subject: [PATCH 0212/1971] When working out what version prefix to use from a revision - if there are no dots (but there are numbers) default to 1.25000.0. --- versionnumbering/versioninfo.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 1a6a72b..ae2b0ee 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -76,6 +76,7 @@ def getVersionPrefix(sourcebranch): defaultversionprefix = "1.30000.0." mastertypeversionprefix = "1.20000.0." + thirdpartyversionprefix = "1.25000.0." splits = sourcebranch.split('/') if len(splits) < 1: print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) @@ -88,9 +89,16 @@ def getVersionPrefix(sourcebranch): splits2 = re.split(r'(\d+)', sourcebranch) splits = [] + hasdot = False for split in splits2: if split.isdigit(): splits.append(split) + if split == ".": + hasdot = True + + if not hasdot: + print("Source branch name has not dots in it (eg. 1.9.2). Defaulting to: {0}".format(thirdpartyversionprefix)) + return thirdpartyversionprefix versionprefix = "" if len(splits) < 1: From 40d3111dabc57771442bc02d72a11299231b405f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 16:52:36 +0000 Subject: [PATCH 0213/1971] Prevent revision number going above 16 bits worth of integer --- versionnumbering/versioninfo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index ae2b0ee..7122dba 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -25,6 +25,7 @@ __updated__ = '2017-11-29' gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") slaveMachine = os.getenv("NODE_NAME", default="-") +MAXVERSIONNUMBER = 65535 def resetFolder(versionfolder): print("Removing folders and contents of: {0}".format(versionfolder)) @@ -48,7 +49,7 @@ def getGitRevision(gitrootpath, basenumber): print("Command {0} returned: {1}".format(completed.args, completed.returncode)) changecount = completed.stdout.decode("utf-8").strip() print("Change count: {0}".format(changecount)) - adjustedchangecount = int(changecount) + int(basenumber) + adjustedchangecount = (int(changecount) + int(basenumber) % (MAXVERSIONNUMBER + 1)) print("Adjusted change count: {0}".format(adjustedchangecount)) print("Determining current revision info using git command: {0}".format(gitExecutable)) From bc79cbfbee40fd48d6857947ee657067e05b68b3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 16:52:36 +0000 Subject: [PATCH 0214/1971] Prevent revision number going above 16 bits worth of integer --- versionnumbering/versioninfo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index ae2b0ee..7122dba 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -25,6 +25,7 @@ __updated__ = '2017-11-29' gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") slaveMachine = os.getenv("NODE_NAME", default="-") +MAXVERSIONNUMBER = 65535 def resetFolder(versionfolder): print("Removing folders and contents of: {0}".format(versionfolder)) @@ -48,7 +49,7 @@ def getGitRevision(gitrootpath, basenumber): print("Command {0} returned: {1}".format(completed.args, completed.returncode)) changecount = completed.stdout.decode("utf-8").strip() print("Change count: {0}".format(changecount)) - adjustedchangecount = int(changecount) + int(basenumber) + adjustedchangecount = (int(changecount) + int(basenumber) % (MAXVERSIONNUMBER + 1)) print("Adjusted change count: {0}".format(adjustedchangecount)) print("Determining current revision info using git command: {0}".format(gitExecutable)) From 73f0cb98163fbd7a82e4a35cf47b89bedca88db4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 17:05:52 +0000 Subject: [PATCH 0215/1971] Prevent revision number going above 16 bits worth of integer --- versionnumbering/versioninfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 7122dba..ceae653 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -49,7 +49,7 @@ def getGitRevision(gitrootpath, basenumber): print("Command {0} returned: {1}".format(completed.args, completed.returncode)) changecount = completed.stdout.decode("utf-8").strip() print("Change count: {0}".format(changecount)) - adjustedchangecount = (int(changecount) + int(basenumber) % (MAXVERSIONNUMBER + 1)) + adjustedchangecount = int((int(changecount) + int(basenumber)) % (MAXVERSIONNUMBER + 1)) print("Adjusted change count: {0}".format(adjustedchangecount)) print("Determining current revision info using git command: {0}".format(gitExecutable)) From 2376df47584eeb5da65593a09c30758a0cd5c4cc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 17:05:52 +0000 Subject: [PATCH 0216/1971] Prevent revision number going above 16 bits worth of integer --- versionnumbering/versioninfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 7122dba..ceae653 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -49,7 +49,7 @@ def getGitRevision(gitrootpath, basenumber): print("Command {0} returned: {1}".format(completed.args, completed.returncode)) changecount = completed.stdout.decode("utf-8").strip() print("Change count: {0}".format(changecount)) - adjustedchangecount = (int(changecount) + int(basenumber) % (MAXVERSIONNUMBER + 1)) + adjustedchangecount = int((int(changecount) + int(basenumber)) % (MAXVERSIONNUMBER + 1)) print("Adjusted change count: {0}".format(adjustedchangecount)) print("Determining current revision info using git command: {0}".format(gitExecutable)) From b38a59a7dc77c58fff619112425a299498e0ee7a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Oct 2018 18:40:28 +0000 Subject: [PATCH 0217/1971] Move some installer helper functionality to Common_scripts --- install/installhelper.gsh | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 install/installhelper.gsh diff --git a/install/installhelper.gsh b/install/installhelper.gsh new file mode 100644 index 0000000..a55292d --- /dev/null +++ b/install/installhelper.gsh @@ -0,0 +1,41 @@ +// Given details about artifacts to import and details of installers to build, import artifacts that are required +def artifactsImporter(artifactDetails, installerDetails) { + artifactFetched = [:] + + for (installer in toBuild) { + def artifactKey = installerDetails.get(installer)[0] + //echo "To build: ${installer} use artifactKey: ${artifactKey}" + (sourceProject, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + env.importDest = destFolder + if (artifactFetched.get(artifactKey) == null) { + //echo "Artifact info: ${artifactInfo}" + copyArtifacts excludes: notToCopy, filter: toCopy, fingerprintArtifacts: true, projectName: "${sourceProject}", selector: lastSuccessful(), target: "${destFolder}" + def componentVersionFolder = "${WORKSPACE}\\version\\version_${artifactKey}" + def folderToCopy = "${destFolder}\\version" + echo "Copying from: ${folderToCopy} to: ${componentVersionFolder}" + fileOperations([folderCopyOperation(destinationFolderPath: componentVersionFolder, sourceFolderPath: folderToCopy)]) + //fileOperations([fileCopyOperation(excludes: '', flattenFiles: false, includes: filesToCopy, targetLocation: componentVersionFolder )]) + artifactVersion = githelper.getSHAFromVersion("${destFolder}/version") + artifactFetched.put(artifactKey, artifactVersion) + } + } + return artifactFetched +} + +// Export any required binaries to the /bin folder +def exportBinaries(artifactDetails, installerDetails) { + for (installer in toBuild) { + (artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer) + if (exportBinaries) { + (artifactsSourceProject, destinationFolder, artifactsToCopy, artifactsToNotCopy, binariesFolders) = artifactDetails.get(artifactSet) + for (binaryFolder in binariesFolders) { + binariesSourceFolder = "${destinationFolder}/${binaryFolder}" + binariesDestFolder = "${WORKSPACE}/bin/${artifactSet}/${binaryFolder}" + echo "Copying from: ${binariesSourceFolder} to: ${binariesDestFolder}" + fileOperations([folderCopyOperation(destinationFolderPath: binariesDestFolder, sourceFolderPath: binariesSourceFolder)]) + } + } + } +} + +return this; \ No newline at end of file From 28384f6ec3e8016f796f1e4fcbde28dce6d989ac Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Oct 2018 08:30:57 +0000 Subject: [PATCH 0218/1971] Only append differences to the metadifferences file if they exist --- versionnumbering/metaversion.gsh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index aab7319..9e09b34 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -24,15 +24,13 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = error "combineSubjobVersions script is not supported in Windows yet" } for (versionFolder in versionFolderList) { - env.differencesFile = "${versionFolder}/differences.txt" - sh """#!/bin/bash + differencesFile = "${versionFolder}/differences.txt" + if (fileExists("${differencesFile}")) { + currentContents = readFile file: "${OF}/differences.txt" + newContents = readFile file: "${differencesFile}" + writeFile file: "${OF}/differences.txt", text: currentContents + "${differencesFile}: \n" + newContents + } - echo ${differencesFile}: >> "${OF}/differences.txt" - if [ \$? -ne 0 ]; then exit 1; fi - - cat "${differencesFile}" >> "${OF}/differences.txt" - if [ \$? -ne 0 ]; then exit 1; fi - """ buildStampFile = "${versionFolder}/buildstamp.txt" buildStampFileContents = readFile "${buildStampFile}" metabuildStampFile = "${OF}/buildstamps.txt" From 53fd4d61ce4a19124c115aa017f984b0aa00cb0d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Oct 2018 08:56:17 +0000 Subject: [PATCH 0219/1971] Add remote url to version information --- versionnumbering/versioninfo.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index ceae653..607ce96 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -64,10 +64,16 @@ def getGitRevision(gitrootpath, basenumber): remoteinfo = completed.stdout.decode("utf-8") print("Remote info: {0}".format(remoteinfo)) + print("Determining remote url using git command: {0}".format(gitExecutable)) + completed = subprocess.run([gitExecutable, "remote", "get-url", "--push", "origin"], stdout=subprocess.PIPE) + print("Command {0} returned: {1}".format(completed.args, completed.returncode)) + remoteurl = completed.stdout.decode("utf-8") + print("Remote info: {0}".format(remoteurl)) + os.chdir(cwd) print("Restored current working directory to: {0}".format(cwd)) - return (adjustedchangecount, revision, remoteinfo) + return (adjustedchangecount, revision, remoteinfo, remoteurl) # Handle: # origin/master @@ -132,7 +138,7 @@ def getVersionPrefix(sourcebranch): print("Determined version prefix to be: {0}".format(versionprefix)) return versionprefix -def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp): +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp): with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: f.write(buildjobname) @@ -148,6 +154,9 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: f.write(remoteinfo) + with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: + f.write(remoteurl) + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: f.write(buildnumber) @@ -214,14 +223,14 @@ USAGE resetFolder(versionfolder) - (gitrevisioncount, gitrevision, remoteinfo) = getGitRevision(gitrootfolder, baseversionnumber) + (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(gitrootfolder, baseversionnumber) versionprefix = getVersionPrefix(sourcebranch) buildstamp = versionprefix + str(gitrevisioncount) print("Build stamp is: {0}".format(buildstamp)) - writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, buildnumber, buildstamp) + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp) return 0 except Exception as e: From 7c2c9b22a1a0c43c1c67dcefc683ddb113fd0312 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Oct 2018 12:25:04 +0000 Subject: [PATCH 0220/1971] Output more git information in the meta version output --- versionnumbering/metaversion.gsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 9e09b34..634da16 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -33,9 +33,13 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = buildStampFile = "${versionFolder}/buildstamp.txt" buildStampFileContents = readFile "${buildStampFile}" + remoteurlFile = "${versionFolder}/remoteurl.txt" + remoteurlFileContents = readFile "${remoteurlFile}" + gitRevisionFile = "${versionFolder}/gitrevision.txt" + gitRevisionFileContents = readFile "${gitRevisionFile}" metabuildStampFile = "${OF}/buildstamps.txt" metabuildStampFileContents = readFile "${metabuildStampFile}" - writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ": " + buildStampFileContents + writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() From d842f1a87b9b3b2dd04002e1b0c9705a6d91c6ad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Oct 2018 12:25:04 +0000 Subject: [PATCH 0221/1971] Output more git information in the meta version output --- versionnumbering/metaversion.gsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 9e09b34..634da16 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -33,9 +33,13 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = buildStampFile = "${versionFolder}/buildstamp.txt" buildStampFileContents = readFile "${buildStampFile}" + remoteurlFile = "${versionFolder}/remoteurl.txt" + remoteurlFileContents = readFile "${remoteurlFile}" + gitRevisionFile = "${versionFolder}/gitrevision.txt" + gitRevisionFileContents = readFile "${gitRevisionFile}" metabuildStampFile = "${OF}/buildstamps.txt" metabuildStampFileContents = readFile "${metabuildStampFile}" - writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ": " + buildStampFileContents + writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() From 97e0d040efcf6802194126cb9b6623a3236bf186 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Oct 2018 16:28:37 +0000 Subject: [PATCH 0222/1971] Handle the situation where a build does not provide a remoteurl.txt file --- versionnumbering/metaversion.gsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 634da16..911e094 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -33,10 +33,18 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = buildStampFile = "${versionFolder}/buildstamp.txt" buildStampFileContents = readFile "${buildStampFile}" + remoteurlFile = "${versionFolder}/remoteurl.txt" - remoteurlFileContents = readFile "${remoteurlFile}" + if (fileExists("${remoteurlFile}")) { + remoteurlFileContents = readFile "${remoteurlFile}" + } + else { + remoteurlFileContents = 'Unknown' + } + gitRevisionFile = "${versionFolder}/gitrevision.txt" gitRevisionFileContents = readFile "${gitRevisionFile}" + metabuildStampFile = "${OF}/buildstamps.txt" metabuildStampFileContents = readFile "${metabuildStampFile}" writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents From 469bf47a8cbbf070576bb2abf8e5d75ff4ee374c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Oct 2018 16:28:37 +0000 Subject: [PATCH 0223/1971] Handle the situation where a build does not provide a remoteurl.txt file --- versionnumbering/metaversion.gsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 634da16..911e094 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -33,10 +33,18 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = buildStampFile = "${versionFolder}/buildstamp.txt" buildStampFileContents = readFile "${buildStampFile}" + remoteurlFile = "${versionFolder}/remoteurl.txt" - remoteurlFileContents = readFile "${remoteurlFile}" + if (fileExists("${remoteurlFile}")) { + remoteurlFileContents = readFile "${remoteurlFile}" + } + else { + remoteurlFileContents = 'Unknown' + } + gitRevisionFile = "${versionFolder}/gitrevision.txt" gitRevisionFileContents = readFile "${gitRevisionFile}" + metabuildStampFile = "${OF}/buildstamps.txt" metabuildStampFileContents = readFile "${metabuildStampFile}" writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents From 75c7e069cccc27681245dfe06428a507cb9675be Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Oct 2018 20:28:30 +0000 Subject: [PATCH 0224/1971] Format metaversion output --- versionnumbering/metaversion.gsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 911e094..d296fca 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -28,27 +28,27 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = if (fileExists("${differencesFile}")) { currentContents = readFile file: "${OF}/differences.txt" newContents = readFile file: "${differencesFile}" - writeFile file: "${OF}/differences.txt", text: currentContents + "${differencesFile}: \n" + newContents + breakline = "***********************************************************************\n" + writeFile file: "${OF}/differences.txt", text: currentContents + breakline + "${differencesFile}: \n" + newContents } buildStampFile = "${versionFolder}/buildstamp.txt" - buildStampFileContents = readFile "${buildStampFile}" + buildStampFileContents = readFile("${buildStampFile}").trim() remoteurlFile = "${versionFolder}/remoteurl.txt" if (fileExists("${remoteurlFile}")) { - remoteurlFileContents = readFile "${remoteurlFile}" + remoteurlFileContents = readFile("${remoteurlFile}").trim() } else { remoteurlFileContents = 'Unknown' } gitRevisionFile = "${versionFolder}/gitrevision.txt" - gitRevisionFileContents = readFile "${gitRevisionFile}" + gitRevisionFileContents = readFile("${gitRevisionFile}").trim() metabuildStampFile = "${OF}/buildstamps.txt" - metabuildStampFileContents = readFile "${metabuildStampFile}" + metabuildStampFileContents = readFile("${metabuildStampFile}") writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents - revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" From f6379b95dfd35b11455b6dd8b4432a58f68b1959 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 2 Nov 2018 17:36:15 +0000 Subject: [PATCH 0225/1971] Make up revision information from sub meta jobs --- versionnumbering/metaversion.gsh | 123 +++++++++++++++++++------------ 1 file changed, 75 insertions(+), 48 deletions(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index d296fca..cac6faf 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -1,66 +1,93 @@ +def mergemeta(versionFolder, outputFolder) { + differencesFile = "${versionFolder}/differences.txt" + currentContents = readFile file: "${outputFolder}/differences.txt" + newContents = readFile file: "${differencesFile}" + writeFile file: "${outputFolder}/differences.txt", text: currentContents + "\n" + newContents + + buildStampFile = "${versionFolder}/buildstamps.txt" + buildStampFileContents = readFile("${buildStampFile}").trim() + + metabuildStampFile = "${outputFolder}/buildstamps.txt" + metabuildStampFileContents = readFile("${metabuildStampFile}") + "\r\n" + writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\n" + "${buildStampFileContents}" + + if (fileExists("${versionFolder}/revision.txt")) { + revision = readFile("${versionFolder}/revision.txt").trim() + intrevision = revision.toInteger() + echo "Revision read in: ${intrevision}" + } + else { + intrevision = 1 + } + + return intrevision +} + +def appendcomponentinfo(versionFolder, outputFolder) { + differencesFile = "${versionFolder}/differences.txt" + if (fileExists("${differencesFile}")) { + currentContents = readFile file: "${outputFolder}/differences.txt" + newContents = readFile file: "${differencesFile}" + writeFile file: "${outputFolder}/differences.txt", text: currentContents + "${differencesFile}: \n" + newContents + } + + buildStampFile = "${versionFolder}/buildstamp.txt" + buildStampFileContents = readFile("${buildStampFile}").trim() + + remoteurlFile = "${versionFolder}/remoteurl.txt" + if (fileExists("${remoteurlFile}")) { + remoteurlFileContents = readFile("${remoteurlFile}").trim() + } + else { + remoteurlFileContents = 'Unknown' + } + + gitRevisionFile = "${versionFolder}/gitrevision.txt" + gitRevisionFileContents = readFile("${gitRevisionFile}").trim() + + metabuildStampFile = "${outputFolder}/buildstamps.txt" + if (fileExists("${differencesFile}")) { + metabuildStampFileContents = readFile("${metabuildStampFile}") + "\r\n" + } + else { + metabuildStampFileContents = "" + } + writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + + revision = readFile("${versionFolder}/revision.txt").trim() + intrevision = revision.toInteger() + echo "Revision read in: ${intrevision}" + + return intrevision +} + // Each version folder should have been created using version creation scripts in this Common_scripts folder // as their are well-known files in each folder def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = "${WORKSPACE}/metaversion") { - env.VLP = versionLabelPrefix - env.OF = outputFolder totalrevision = 0 - if (isUnix()) { - sh """#!/bin/bash - - rm -rf "${OF}" - mkdir -p "${OF}" - if [ \$? -ne 0 ]; then exit 1; fi - - touch "${OF}/differences.txt" - if [ \$? -ne 0 ]; then exit 1; fi - - touch "${OF}/buildstamps.txt" - if [ \$? -ne 0 ]; then exit 1; fi - - """ - } - else { - error "combineSubjobVersions script is not supported in Windows yet" + dir("${outputFolder}") { + deleteDir() } for (versionFolder in versionFolderList) { - differencesFile = "${versionFolder}/differences.txt" - if (fileExists("${differencesFile}")) { - currentContents = readFile file: "${OF}/differences.txt" - newContents = readFile file: "${differencesFile}" - breakline = "***********************************************************************\n" - writeFile file: "${OF}/differences.txt", text: currentContents + breakline + "${differencesFile}: \n" + newContents - } - - buildStampFile = "${versionFolder}/buildstamp.txt" - buildStampFileContents = readFile("${buildStampFile}").trim() - - remoteurlFile = "${versionFolder}/remoteurl.txt" - if (fileExists("${remoteurlFile}")) { - remoteurlFileContents = readFile("${remoteurlFile}").trim() + metaversionsignaturefile = "${versionFolder}/metaversion.txt" + // If the sub project is a meta job + if (fileExists("${metaversionsignaturefile}")) { + intrevision = mergemeta("${versionFolder}", outputFolder) } else { - remoteurlFileContents = 'Unknown' + intrevision = appendcomponentinfo("${versionFolder}", outputFolder) } - - gitRevisionFile = "${versionFolder}/gitrevision.txt" - gitRevisionFileContents = readFile("${gitRevisionFile}").trim() - - metabuildStampFile = "${OF}/buildstamps.txt" - metabuildStampFileContents = readFile("${metabuildStampFile}") - writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\r\n" + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents - revision = readFile("${versionFolder}/revision.txt").trim() - intrevision = revision.toInteger() - echo "Revision read in: ${intrevision}" - totalrevision += intrevision - echo "Accumulated revision is: ${totalrevision}" } + totalrevision += intrevision + echo "Accumulated revision is: ${totalrevision}" if (versionLabelPrefix.endsWith(".")) { - writeFile file: "${OF}/metaversion.txt", text: versionLabelPrefix + totalrevision + writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + totalrevision } else { - writeFile file: "${OF}/metaversion.txt", text: versionLabelPrefix + "." + totalrevision + writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + "." + totalrevision } + writeFile("${outputFolder}/revision.txt").trim(), text: totalrevision) } return this; \ No newline at end of file From 67895110b66406b57385835d80888ecfbd8d9c2a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Nov 2018 17:34:35 +0000 Subject: [PATCH 0226/1971] Make up revision information from sub meta jobs --- versionnumbering/metaversion.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index cac6faf..4a821be 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -87,7 +87,7 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = else { writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + "." + totalrevision } - writeFile("${outputFolder}/revision.txt").trim(), text: totalrevision) + writeFile("${outputFolder}/revision.txt", text: totalrevision) } return this; \ No newline at end of file From dc3abfc7cf5e4823af8e22da5a83b28de8671721 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Nov 2018 20:46:58 +0000 Subject: [PATCH 0227/1971] More debug; Common functions --- versionnumbering/metaversion.gsh | 43 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 4a821be..8849ae3 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -1,16 +1,26 @@ +def currentContents(file, newline = "\n", defaultContents = "") { + if (fileExists("${file}")) { + contents = readFile(file: "${file}").trim() + newline + } + else { + contents = defaultContents + } + return contents +} + def mergemeta(versionFolder, outputFolder) { + echo "Merging meta data from folder: ${versionFolder} to ${outputFolder}" + differencesFile = "${versionFolder}/differences.txt" - currentContents = readFile file: "${outputFolder}/differences.txt" newContents = readFile file: "${differencesFile}" - writeFile file: "${outputFolder}/differences.txt", text: currentContents + "\n" + newContents + metadifferencesFile = ${outputFolder}/differences.txt" + writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + newContents buildStampFile = "${versionFolder}/buildstamps.txt" buildStampFileContents = readFile("${buildStampFile}").trim() - metabuildStampFile = "${outputFolder}/buildstamps.txt" - metabuildStampFileContents = readFile("${metabuildStampFile}") + "\r\n" - writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "\n" + "${buildStampFileContents}" + writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + buildStampFileContents if (fileExists("${versionFolder}/revision.txt")) { revision = readFile("${versionFolder}/revision.txt").trim() @@ -25,36 +35,26 @@ def mergemeta(versionFolder, outputFolder) { } def appendcomponentinfo(versionFolder, outputFolder) { + echo "Appemding component version data from folder: ${versionFolder} to ${outputFolder}" + differencesFile = "${versionFolder}/differences.txt" if (fileExists("${differencesFile}")) { - currentContents = readFile file: "${outputFolder}/differences.txt" newContents = readFile file: "${differencesFile}" - writeFile file: "${outputFolder}/differences.txt", text: currentContents + "${differencesFile}: \n" + newContents + metadifferencesFile = "${outputFolder}/differences.txt" + writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents } buildStampFile = "${versionFolder}/buildstamp.txt" buildStampFileContents = readFile("${buildStampFile}").trim() remoteurlFile = "${versionFolder}/remoteurl.txt" - if (fileExists("${remoteurlFile}")) { - remoteurlFileContents = readFile("${remoteurlFile}").trim() - } - else { - remoteurlFileContents = 'Unknown' - } + remoteurlFileContents = currentContents(remoteurlFile. "", 'Unknown') gitRevisionFile = "${versionFolder}/gitrevision.txt" gitRevisionFileContents = readFile("${gitRevisionFile}").trim() metabuildStampFile = "${outputFolder}/buildstamps.txt" - if (fileExists("${differencesFile}")) { - metabuildStampFileContents = readFile("${metabuildStampFile}") + "\r\n" - } - else { - metabuildStampFileContents = "" - } - writeFile file: "${metabuildStampFile}", text: metabuildStampFileContents + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents - + writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" @@ -70,6 +70,7 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = deleteDir() } for (versionFolder in versionFolderList) { + echo "Inspecting folder: ${versionFolder}" metaversionsignaturefile = "${versionFolder}/metaversion.txt" // If the sub project is a meta job if (fileExists("${metaversionsignaturefile}")) { From 3a5980aa9823dba95537bfd0b3e207266e5bd108 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 4 Nov 2018 23:20:10 +0000 Subject: [PATCH 0228/1971] More debug; Common functions --- versionnumbering/metaversion.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 8849ae3..6e57d4c 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -14,7 +14,7 @@ def mergemeta(versionFolder, outputFolder) { differencesFile = "${versionFolder}/differences.txt" newContents = readFile file: "${differencesFile}" - metadifferencesFile = ${outputFolder}/differences.txt" + metadifferencesFile = "${outputFolder}/differences.txt" writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + newContents buildStampFile = "${versionFolder}/buildstamps.txt" From 6c617020f10ae654e423f54a70790552123501ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 5 Nov 2018 11:55:54 +0000 Subject: [PATCH 0229/1971] Accumulate the total revision --- versionnumbering/metaversion.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 6e57d4c..61f8a3b 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -79,8 +79,8 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = else { intrevision = appendcomponentinfo("${versionFolder}", outputFolder) } + totalrevision += intrevision } - totalrevision += intrevision echo "Accumulated revision is: ${totalrevision}" if (versionLabelPrefix.endsWith(".")) { writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + totalrevision From 2f75cd2d14ef5a9836be3554a04fe20dcc6c16ca Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 5 Nov 2018 14:32:04 +0000 Subject: [PATCH 0230/1971] Handle syntax error --- versionnumbering/metaversion.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 61f8a3b..22168ba 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -35,7 +35,7 @@ def mergemeta(versionFolder, outputFolder) { } def appendcomponentinfo(versionFolder, outputFolder) { - echo "Appemding component version data from folder: ${versionFolder} to ${outputFolder}" + echo "Appending component version data from folder: ${versionFolder} to ${outputFolder}" differencesFile = "${versionFolder}/differences.txt" if (fileExists("${differencesFile}")) { @@ -48,7 +48,7 @@ def appendcomponentinfo(versionFolder, outputFolder) { buildStampFileContents = readFile("${buildStampFile}").trim() remoteurlFile = "${versionFolder}/remoteurl.txt" - remoteurlFileContents = currentContents(remoteurlFile. "", 'Unknown') + remoteurlFileContents = currentContents(remoteurlFile, "", 'Unknown').trim() gitRevisionFile = "${versionFolder}/gitrevision.txt" gitRevisionFileContents = readFile("${gitRevisionFile}").trim() From b6d7567c364668f072789725ef3b84523442f4bd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 5 Nov 2018 15:06:41 +0000 Subject: [PATCH 0231/1971] Handle a release to git job name parameter - to be passed to metabuilder jobs --- versionnumbering/versioninfo.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 607ce96..370d9fc 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -138,7 +138,7 @@ def getVersionPrefix(sourcebranch): print("Determined version prefix to be: {0}".format(versionprefix)) return versionprefix -def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp): +def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname): with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: f.write(buildjobname) @@ -173,6 +173,9 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: f.write(str(datetime.datetime.now())) + with open(os.path.join(versionfolder, "releasejobname.txt"), 'w') as f: + f.write(releasejobname) + def main(argv=None): # IGNORE:C0111 '''Command line options.''' @@ -206,6 +209,7 @@ USAGE parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") + parser.add_argument("-r", "--releasejobname", dest="releasejobname", action="store", default="-", help="release-to-git build job name [default: %(default)s]") # Process arguments args = parser.parse_args() @@ -217,9 +221,10 @@ USAGE baseversionnumber = args.baseversionnumber buildjobname = args.buildjobname buildnumber = args.buildnumber + releasejobname = args.releasejobname print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) - print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber) + print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber, "Release job name:", releasejobname) resetFolder(versionfolder) @@ -230,7 +235,7 @@ USAGE buildstamp = versionprefix + str(gitrevisioncount) print("Build stamp is: {0}".format(buildstamp)) - writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp) + writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname) return 0 except Exception as e: From a6511a91beb44ab82ae292fd67fd9a96ddbfb3a0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 5 Nov 2018 15:47:49 +0000 Subject: [PATCH 0232/1971] Syntax error --- versionnumbering/metaversion.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 22168ba..084b604 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -88,7 +88,7 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = else { writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + "." + totalrevision } - writeFile("${outputFolder}/revision.txt", text: totalrevision) + writeFile(file: "${outputFolder}/revision.txt", text: totalrevision) } return this; \ No newline at end of file From 6fa63d47f3e796b00befcad58e8bdc76497462ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 5 Nov 2018 16:19:52 +0000 Subject: [PATCH 0233/1971] Add release job name to metabuildstamp file --- versionnumbering/metaversion.gsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 084b604..1dc19ca 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -53,8 +53,11 @@ def appendcomponentinfo(versionFolder, outputFolder) { gitRevisionFile = "${versionFolder}/gitrevision.txt" gitRevisionFileContents = readFile("${gitRevisionFile}").trim() + releaseJobNameFile = "${versionFolder}/releasejobname.txt" + releaseJobNameContents = currentContents("${releaseJobNameFile}", "", "-").trim() + metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" From dcdf1d3dc3a866d3cb73f3ce9f577105c6e89d3d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 5 Nov 2018 19:00:51 +0000 Subject: [PATCH 0234/1971] Correct integer printing --- versionnumbering/metaversion.gsh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.gsh index 1dc19ca..9a50e2e 100644 --- a/versionnumbering/metaversion.gsh +++ b/versionnumbering/metaversion.gsh @@ -85,13 +85,8 @@ def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = totalrevision += intrevision } echo "Accumulated revision is: ${totalrevision}" - if (versionLabelPrefix.endsWith(".")) { - writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + totalrevision - } - else { - writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + "." + totalrevision - } - writeFile(file: "${outputFolder}/revision.txt", text: totalrevision) + writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + ((versionLabelPrefix.endsWith(".")) ? "" : ".") + totalrevision.toString() + writeFile(file: "${outputFolder}/revision.txt", text: totalrevision.toString()) } return this; \ No newline at end of file From 0c2b471c3cea162ff6169768e2c9da8eabc4498d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Nov 2018 22:36:03 +0000 Subject: [PATCH 0235/1971] Only build selected variants --- compile/eclipsebuild/eclipseds5build.gsh | 48 +++++++++++++++--------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 3061fea..078845e 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -117,7 +117,14 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild. exportfolder = "${WORKSPACE}/bin") { + 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 { @@ -137,26 +144,31 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) try { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ + } } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." } } - result = doExport(exportfolder, exportpathlist, "", build_variant) - if (result != 0) { - error "Failed to copy...." + else { + echo "Not building ${build_variant} variant of project: ${project}" } } catch (Exception e) { echo "Build failed - Waiting for a while" From f3f97107134ead2f6705c8f2916de36e63725e6d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Nov 2018 22:36:03 +0000 Subject: [PATCH 0236/1971] Only build selected variants --- compile/eclipsebuild/eclipseds5build.gsh | 48 +++++++++++++++--------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 3061fea..078845e 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -117,7 +117,14 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild. exportfolder = "${WORKSPACE}/bin") { + 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 { @@ -137,26 +144,31 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) try { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ + } } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." } } - result = doExport(exportfolder, exportpathlist, "", build_variant) - if (result != 0) { - error "Failed to copy...." + else { + echo "Not building ${build_variant} variant of project: ${project}" } } catch (Exception e) { echo "Build failed - Waiting for a while" From 9f1d3ca026847e066d3fe9921aa68a2b99812a80 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Nov 2018 22:39:15 +0000 Subject: [PATCH 0237/1971] Only build selected variants --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 078845e..93a8064 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -117,7 +117,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild. exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/bin") { toBuild = [] if (variantstobuild) { toBuildUntrimmed = variantstobuild.split(',') From 760bf239a45437585f3b45a7558b617363c941c4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Nov 2018 22:39:15 +0000 Subject: [PATCH 0238/1971] Only build selected variants --- compile/eclipsebuild/eclipseds5build.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index 078845e..93a8064 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -117,7 +117,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild. exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/bin") { toBuild = [] if (variantstobuild) { toBuildUntrimmed = variantstobuild.split(',') From 3d1326836b8da27869d75498f8343ca80dc9cf4f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:04:34 +0000 Subject: [PATCH 0239/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 autobuilder.gsh diff --git a/autobuilder.gsh b/autobuilder.gsh new file mode 100644 index 0000000..06a5123 --- /dev/null +++ b/autobuilder.gsh @@ -0,0 +1,39 @@ +// Assume that WORKSPACE environment variable is set + +def autobuildroot = "${WORKSPACE}/autobuild" +def commonscriptsroot = "${autobuildroot}/Common_scripts" + +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 + stash allowEmpty: true, includes: 'autobuild/**/*', name: 'Clean workspace stash', useDefaultExcludes: false + cleanWs() + unstash name: 'Clean workspace stash' + } + else { + echo "Not cleaning workspace" + } +} + +// Start up boilderplate +def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autobuildroot}/Common_scripts") { + echo "Starting...." + + autobuildroot = autobuildpath + commonscriptsroot = commonscriptspath + + conditionalclean() + + configurationhelper = load("${commonscriptsroot}/configuration/configuration.gsh") + configurationhelper.registerPipelineScriptConfiguration() + +def commonscripts() + return commonscriptsroot +} + +def configurationhelper() { + return load("${commonscripts()}/configuration/configuration.gsh") +} + +return this; \ No newline at end of file From 69de014d49076c0d25a24fe04600fedbc29e110f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:04:34 +0000 Subject: [PATCH 0240/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 autobuilder.gsh diff --git a/autobuilder.gsh b/autobuilder.gsh new file mode 100644 index 0000000..06a5123 --- /dev/null +++ b/autobuilder.gsh @@ -0,0 +1,39 @@ +// Assume that WORKSPACE environment variable is set + +def autobuildroot = "${WORKSPACE}/autobuild" +def commonscriptsroot = "${autobuildroot}/Common_scripts" + +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 + stash allowEmpty: true, includes: 'autobuild/**/*', name: 'Clean workspace stash', useDefaultExcludes: false + cleanWs() + unstash name: 'Clean workspace stash' + } + else { + echo "Not cleaning workspace" + } +} + +// Start up boilderplate +def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autobuildroot}/Common_scripts") { + echo "Starting...." + + autobuildroot = autobuildpath + commonscriptsroot = commonscriptspath + + conditionalclean() + + configurationhelper = load("${commonscriptsroot}/configuration/configuration.gsh") + configurationhelper.registerPipelineScriptConfiguration() + +def commonscripts() + return commonscriptsroot +} + +def configurationhelper() { + return load("${commonscripts()}/configuration/configuration.gsh") +} + +return this; \ No newline at end of file From 0d839a9d5c03486fbf60ba7cff890a74bad63aac Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:08:35 +0000 Subject: [PATCH 0241/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index 06a5123..7a7efa1 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -27,8 +27,9 @@ def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autob configurationhelper = load("${commonscriptsroot}/configuration/configuration.gsh") configurationhelper.registerPipelineScriptConfiguration() +} -def commonscripts() +def commonscripts() { return commonscriptsroot } From 3e7191297956761eead46374cc6cfd7348a97136 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:08:35 +0000 Subject: [PATCH 0242/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index 06a5123..7a7efa1 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -27,8 +27,9 @@ def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autob configurationhelper = load("${commonscriptsroot}/configuration/configuration.gsh") configurationhelper.registerPipelineScriptConfiguration() +} -def commonscripts() +def commonscripts() { return commonscriptsroot } From 11b541691331f40f9b6adba02d0f809d525e98c4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:13:21 +0000 Subject: [PATCH 0243/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index 7a7efa1..1657815 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -1,7 +1,7 @@ // Assume that WORKSPACE environment variable is set -def autobuildroot = "${WORKSPACE}/autobuild" -def commonscriptsroot = "${autobuildroot}/Common_scripts" +String autobuildroot = "${WORKSPACE}/autobuild" +String commonscriptsroot = "${autobuildroot}/Common_scripts" def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { From 12f680285f37934d9dc4ff56b7b961149febbc2f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:13:21 +0000 Subject: [PATCH 0244/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index 7a7efa1..1657815 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -1,7 +1,7 @@ // Assume that WORKSPACE environment variable is set -def autobuildroot = "${WORKSPACE}/autobuild" -def commonscriptsroot = "${autobuildroot}/Common_scripts" +String autobuildroot = "${WORKSPACE}/autobuild" +String commonscriptsroot = "${autobuildroot}/Common_scripts" def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { From f33b4931606117107a07ffe2130e93e447a6a7ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:23:19 +0000 Subject: [PATCH 0245/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index 1657815..88b68a0 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -1,7 +1,10 @@ // Assume that WORKSPACE environment variable is set -String autobuildroot = "${WORKSPACE}/autobuild" -String commonscriptsroot = "${autobuildroot}/Common_scripts" +@Field +def autobuildroot = "${WORKSPACE}/autobuild" + +@Field +def commonscriptsroot = "${autobuildroot}/Common_scripts" def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { From a870eb3e57496a1ff78e182fc9cb543d2f50bfd0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:23:19 +0000 Subject: [PATCH 0246/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index 1657815..88b68a0 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -1,7 +1,10 @@ // Assume that WORKSPACE environment variable is set -String autobuildroot = "${WORKSPACE}/autobuild" -String commonscriptsroot = "${autobuildroot}/Common_scripts" +@Field +def autobuildroot = "${WORKSPACE}/autobuild" + +@Field +def commonscriptsroot = "${autobuildroot}/Common_scripts" def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { From 80d5325cdb6a5e8940d42ba9d091fc4b16ba15af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:25:18 +0000 Subject: [PATCH 0247/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index 88b68a0..bf42e4c 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -1,10 +1,8 @@ // Assume that WORKSPACE environment variable is set -@Field -def autobuildroot = "${WORKSPACE}/autobuild" +autobuildroot = "${WORKSPACE}/autobuild" -@Field -def commonscriptsroot = "${autobuildroot}/Common_scripts" +commonscriptsroot = "${autobuildroot}/Common_scripts" def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { From 16c6e92ac9beaa917a8acde5802a491eba34b27e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:25:18 +0000 Subject: [PATCH 0248/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index 88b68a0..bf42e4c 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -1,10 +1,8 @@ // Assume that WORKSPACE environment variable is set -@Field -def autobuildroot = "${WORKSPACE}/autobuild" +autobuildroot = "${WORKSPACE}/autobuild" -@Field -def commonscriptsroot = "${autobuildroot}/Common_scripts" +commonscriptsroot = "${autobuildroot}/Common_scripts" def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { From cdf5140b4fd74d03bdce6bad0a3d01dd7ceae35b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:31:25 +0000 Subject: [PATCH 0249/1971] Condense autobuild startup boilerplate --- configuration/configuration.gsh | 2 +- versioncontrol/git.gsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index 5688482..dbaf921 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -1,4 +1,4 @@ -gh = load("${COMMON_SCRIPTS}/versioncontrol/git.gsh") +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.gsh") configurationCollection = [:] diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 51dbd5d..1462a8e 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -1,4 +1,4 @@ -clh = load("${COMMON_SCRIPTS}/commandline/commandline.gsh") +clh = load("${autobuilder.commonscripts()}/commandline/commandline.gsh") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { From 9403f706aba7c1147d2ddce2a119edd6bae9b54b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:31:25 +0000 Subject: [PATCH 0250/1971] Condense autobuild startup boilerplate --- configuration/configuration.gsh | 2 +- versioncontrol/git.gsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index 5688482..dbaf921 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -1,4 +1,4 @@ -gh = load("${COMMON_SCRIPTS}/versioncontrol/git.gsh") +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.gsh") configurationCollection = [:] diff --git a/versioncontrol/git.gsh b/versioncontrol/git.gsh index 51dbd5d..1462a8e 100644 --- a/versioncontrol/git.gsh +++ b/versioncontrol/git.gsh @@ -1,4 +1,4 @@ -clh = load("${COMMON_SCRIPTS}/commandline/commandline.gsh") +clh = load("${autobuilder.commonscripts()}/commandline/commandline.gsh") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { From 6116c229d6de51ee7a629ccfb5f30d9a30508dc1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:37:04 +0000 Subject: [PATCH 0251/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 4 ++++ configuration/configuration.gsh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index bf42e4c..6ec0e38 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -34,6 +34,10 @@ def commonscripts() { return commonscriptsroot } +def getautobuildpath() { + return autobuildroot +} + def configurationhelper() { return load("${commonscripts()}/configuration/configuration.gsh") } diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index dbaf921..f131c98 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -8,7 +8,7 @@ def registerConfigurationInfo(String configurationName, String configurationURL, } def registerPipelineScriptConfiguration() { - registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${AUTOBUILD_SCRIPTS}")) + registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) } def saveConfigurationInVersionInfo() { From 3f3ee1c70997abd6693ea0c5224bbb8ec99f57bf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:37:04 +0000 Subject: [PATCH 0252/1971] Condense autobuild startup boilerplate --- autobuilder.gsh | 4 ++++ configuration/configuration.gsh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/autobuilder.gsh b/autobuilder.gsh index bf42e4c..6ec0e38 100644 --- a/autobuilder.gsh +++ b/autobuilder.gsh @@ -34,6 +34,10 @@ def commonscripts() { return commonscriptsroot } +def getautobuildpath() { + return autobuildroot +} + def configurationhelper() { return load("${commonscripts()}/configuration/configuration.gsh") } diff --git a/configuration/configuration.gsh b/configuration/configuration.gsh index dbaf921..f131c98 100644 --- a/configuration/configuration.gsh +++ b/configuration/configuration.gsh @@ -8,7 +8,7 @@ def registerConfigurationInfo(String configurationName, String configurationURL, } def registerPipelineScriptConfiguration() { - registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${AUTOBUILD_SCRIPTS}")) + registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) } def saveConfigurationInVersionInfo() { From 0e611effff6472605ad838c8fc34ef7acdaf243e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:46:24 +0000 Subject: [PATCH 0253/1971] Change .gsh suffix to .groovy --- artifacts/{metaexport.gsh => metaexport.groovy} | 0 autobuilder.gsh => autobuilder.groovy | 0 commandline/{commandline.gsh => commandline.groovy} | 0 .../{disableparallelbuilds.gsh => disableparallelbuilds.groovy} | 0 .../eclipsebuild/{eclipseds5build.gsh => eclipseds5build.groovy} | 0 configuration/{configuration.gsh => configuration.groovy} | 0 differences/{json.gsh => json.groovy} | 0 install/{installhelper.gsh => installhelper.groovy} | 0 versioncontrol/{git.gsh => git.groovy} | 0 versionnumbering/{metaversion.gsh => metaversion.groovy} | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename artifacts/{metaexport.gsh => metaexport.groovy} (100%) rename autobuilder.gsh => autobuilder.groovy (100%) rename commandline/{commandline.gsh => commandline.groovy} (100%) rename compile/eclipsebuild/{disableparallelbuilds.gsh => disableparallelbuilds.groovy} (100%) rename compile/eclipsebuild/{eclipseds5build.gsh => eclipseds5build.groovy} (100%) rename configuration/{configuration.gsh => configuration.groovy} (100%) rename differences/{json.gsh => json.groovy} (100%) rename install/{installhelper.gsh => installhelper.groovy} (100%) rename versioncontrol/{git.gsh => git.groovy} (100%) rename versionnumbering/{metaversion.gsh => metaversion.groovy} (100%) diff --git a/artifacts/metaexport.gsh b/artifacts/metaexport.groovy similarity index 100% rename from artifacts/metaexport.gsh rename to artifacts/metaexport.groovy diff --git a/autobuilder.gsh b/autobuilder.groovy similarity index 100% rename from autobuilder.gsh rename to autobuilder.groovy diff --git a/commandline/commandline.gsh b/commandline/commandline.groovy similarity index 100% rename from commandline/commandline.gsh rename to commandline/commandline.groovy diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.groovy similarity index 100% rename from compile/eclipsebuild/disableparallelbuilds.gsh rename to compile/eclipsebuild/disableparallelbuilds.groovy diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.groovy similarity index 100% rename from compile/eclipsebuild/eclipseds5build.gsh rename to compile/eclipsebuild/eclipseds5build.groovy diff --git a/configuration/configuration.gsh b/configuration/configuration.groovy similarity index 100% rename from configuration/configuration.gsh rename to configuration/configuration.groovy diff --git a/differences/json.gsh b/differences/json.groovy similarity index 100% rename from differences/json.gsh rename to differences/json.groovy diff --git a/install/installhelper.gsh b/install/installhelper.groovy similarity index 100% rename from install/installhelper.gsh rename to install/installhelper.groovy diff --git a/versioncontrol/git.gsh b/versioncontrol/git.groovy similarity index 100% rename from versioncontrol/git.gsh rename to versioncontrol/git.groovy diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.groovy similarity index 100% rename from versionnumbering/metaversion.gsh rename to versionnumbering/metaversion.groovy From 94941c199f983f328906b85c02394fc77fb42326 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:46:24 +0000 Subject: [PATCH 0254/1971] Change .gsh suffix to .groovy --- artifacts/{metaexport.gsh => metaexport.groovy} | 0 autobuilder.gsh => autobuilder.groovy | 0 commandline/{commandline.gsh => commandline.groovy} | 0 .../{disableparallelbuilds.gsh => disableparallelbuilds.groovy} | 0 .../eclipsebuild/{eclipseds5build.gsh => eclipseds5build.groovy} | 0 configuration/{configuration.gsh => configuration.groovy} | 0 differences/{json.gsh => json.groovy} | 0 install/{installhelper.gsh => installhelper.groovy} | 0 versioncontrol/{git.gsh => git.groovy} | 0 versionnumbering/{metaversion.gsh => metaversion.groovy} | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename artifacts/{metaexport.gsh => metaexport.groovy} (100%) rename autobuilder.gsh => autobuilder.groovy (100%) rename commandline/{commandline.gsh => commandline.groovy} (100%) rename compile/eclipsebuild/{disableparallelbuilds.gsh => disableparallelbuilds.groovy} (100%) rename compile/eclipsebuild/{eclipseds5build.gsh => eclipseds5build.groovy} (100%) rename configuration/{configuration.gsh => configuration.groovy} (100%) rename differences/{json.gsh => json.groovy} (100%) rename install/{installhelper.gsh => installhelper.groovy} (100%) rename versioncontrol/{git.gsh => git.groovy} (100%) rename versionnumbering/{metaversion.gsh => metaversion.groovy} (100%) diff --git a/artifacts/metaexport.gsh b/artifacts/metaexport.groovy similarity index 100% rename from artifacts/metaexport.gsh rename to artifacts/metaexport.groovy diff --git a/autobuilder.gsh b/autobuilder.groovy similarity index 100% rename from autobuilder.gsh rename to autobuilder.groovy diff --git a/commandline/commandline.gsh b/commandline/commandline.groovy similarity index 100% rename from commandline/commandline.gsh rename to commandline/commandline.groovy diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.groovy similarity index 100% rename from compile/eclipsebuild/disableparallelbuilds.gsh rename to compile/eclipsebuild/disableparallelbuilds.groovy diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.groovy similarity index 100% rename from compile/eclipsebuild/eclipseds5build.gsh rename to compile/eclipsebuild/eclipseds5build.groovy diff --git a/configuration/configuration.gsh b/configuration/configuration.groovy similarity index 100% rename from configuration/configuration.gsh rename to configuration/configuration.groovy diff --git a/differences/json.gsh b/differences/json.groovy similarity index 100% rename from differences/json.gsh rename to differences/json.groovy diff --git a/install/installhelper.gsh b/install/installhelper.groovy similarity index 100% rename from install/installhelper.gsh rename to install/installhelper.groovy diff --git a/versioncontrol/git.gsh b/versioncontrol/git.groovy similarity index 100% rename from versioncontrol/git.gsh rename to versioncontrol/git.groovy diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.groovy similarity index 100% rename from versionnumbering/metaversion.gsh rename to versionnumbering/metaversion.groovy From d3ef7cc963fdd7e37c339c8b3bdc255214058009 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:54:02 +0000 Subject: [PATCH 0255/1971] Change .gsh suffix to .groovy --- autobuilder.groovy | 4 ++-- configuration/configuration.groovy | 2 +- versioncontrol/git.groovy | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 6ec0e38..54cfb12 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autob conditionalclean() - configurationhelper = load("${commonscriptsroot}/configuration/configuration.gsh") + configurationhelper = load("${commonscriptsroot}/configuration/configuration.groovy") configurationhelper.registerPipelineScriptConfiguration() } @@ -39,7 +39,7 @@ def getautobuildpath() { } def configurationhelper() { - return load("${commonscripts()}/configuration/configuration.gsh") + return load("${commonscripts()}/configuration/configuration.groovy") } return this; \ No newline at end of file diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index f131c98..1f0c095 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,4 +1,4 @@ -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.gsh") +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") configurationCollection = [:] diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 1462a8e..031094b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -1,4 +1,4 @@ -clh = load("${autobuilder.commonscripts()}/commandline/commandline.gsh") +clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { From 76913ba017012d451f6681d6bf44704178515ae9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 21:54:02 +0000 Subject: [PATCH 0256/1971] Change .gsh suffix to .groovy --- autobuilder.groovy | 4 ++-- configuration/configuration.groovy | 2 +- versioncontrol/git.groovy | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 6ec0e38..54cfb12 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autob conditionalclean() - configurationhelper = load("${commonscriptsroot}/configuration/configuration.gsh") + configurationhelper = load("${commonscriptsroot}/configuration/configuration.groovy") configurationhelper.registerPipelineScriptConfiguration() } @@ -39,7 +39,7 @@ def getautobuildpath() { } def configurationhelper() { - return load("${commonscripts()}/configuration/configuration.gsh") + return load("${commonscripts()}/configuration/configuration.groovy") } return this; \ No newline at end of file diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index f131c98..1f0c095 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,4 +1,4 @@ -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.gsh") +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") configurationCollection = [:] diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 1462a8e..031094b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -1,4 +1,4 @@ -clh = load("${autobuilder.commonscripts()}/commandline/commandline.gsh") +clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { From 58e7f0c58d9369a218ef4198e0f29179050cd915 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 22:35:36 +0000 Subject: [PATCH 0257/1971] Remove clean boilerplate --- clean/clean.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 clean/clean.groovy diff --git a/clean/clean.groovy b/clean/clean.groovy new file mode 100644 index 0000000..4707ba0 --- /dev/null +++ b/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 From ad68c4caf5f990cca4a774d46dac162666d1817d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 22:35:36 +0000 Subject: [PATCH 0258/1971] Remove clean boilerplate --- clean/clean.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 clean/clean.groovy diff --git a/clean/clean.groovy b/clean/clean.groovy new file mode 100644 index 0000000..4707ba0 --- /dev/null +++ b/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 From 76279fba9ef0602d15962df9f8810159c76ed4a6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 23:29:30 +0000 Subject: [PATCH 0259/1971] Remove versionnumbering boilerplate --- versionnumbering/generate.groovy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 versionnumbering/generate.groovy diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy new file mode 100644 index 0000000..6e87392 --- /dev/null +++ b/versionnumbering/generate.groovy @@ -0,0 +1,20 @@ + +def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${WORKSPACE}/version", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { + cs = autobuilder.commonscripts() + if (isUnix()) { + sh """ + "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" + """ + } + else { + bat """ + "%${PYTHON}%" -u "%${cs}%\\versionnumbering\\versioninfo.py" -s "%${sourcerevision}%" -v "${versionfolder}" -g "${sourcepath}" -b %${basebuildnumber}% -j "%${jobname}%" -n "%${buildid}%" -r "%${releasejobname}%" + """ + } + env.BUILD_STAMP = readFile("${WORKSPACE}/version/buildstamp.txt").trim() + env.BUILD_STAMP_COMMA_SEP = readFile("${WORKSPACE}/version/buildstampcommasep.txt").trim() + env.SRC_REVISION = readFile("${WORKSPACE}/version/revision.txt").trim() + configurationhelper.saveConfigurationInVersionInfo(); +} + +return this; \ No newline at end of file From e3533bd5f140a1561520b416ef585f366ed9dca4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 23:29:30 +0000 Subject: [PATCH 0260/1971] Remove versionnumbering boilerplate --- versionnumbering/generate.groovy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 versionnumbering/generate.groovy diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy new file mode 100644 index 0000000..6e87392 --- /dev/null +++ b/versionnumbering/generate.groovy @@ -0,0 +1,20 @@ + +def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${WORKSPACE}/version", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { + cs = autobuilder.commonscripts() + if (isUnix()) { + sh """ + "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" + """ + } + else { + bat """ + "%${PYTHON}%" -u "%${cs}%\\versionnumbering\\versioninfo.py" -s "%${sourcerevision}%" -v "${versionfolder}" -g "${sourcepath}" -b %${basebuildnumber}% -j "%${jobname}%" -n "%${buildid}%" -r "%${releasejobname}%" + """ + } + env.BUILD_STAMP = readFile("${WORKSPACE}/version/buildstamp.txt").trim() + env.BUILD_STAMP_COMMA_SEP = readFile("${WORKSPACE}/version/buildstampcommasep.txt").trim() + env.SRC_REVISION = readFile("${WORKSPACE}/version/revision.txt").trim() + configurationhelper.saveConfigurationInVersionInfo(); +} + +return this; \ No newline at end of file From cde5dbabec347a8216e5e83b4288390f39bc94ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 23:49:04 +0000 Subject: [PATCH 0261/1971] Remove differences boilerplate --- differences/do.groovy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 differences/do.groovy diff --git a/differences/do.groovy b/differences/do.groovy new file mode 100644 index 0000000..9dc1807 --- /dev/null +++ b/differences/do.groovy @@ -0,0 +1,17 @@ + +def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") { + cs = autobuilder.commonscripts() + + if (isUnix()) { + sh """ + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" + """ + } + else { + bat """ + "%${PYTHON}%" -u "%${cs}%\\differences\\show_release_differences.py" -g "%${sourcepath}%" -s "%${sourcerevision}%" -p "%${previoussourcerevision}%" -j ${jirakey} -o "opposite notcommon" -v "%${versionfolder}%" + """ + } +} + +return this; From b0077bb1df56c27f18921cd7184d6e939fa43281 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 10 Nov 2018 23:49:04 +0000 Subject: [PATCH 0262/1971] Remove differences boilerplate --- differences/do.groovy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 differences/do.groovy diff --git a/differences/do.groovy b/differences/do.groovy new file mode 100644 index 0000000..9dc1807 --- /dev/null +++ b/differences/do.groovy @@ -0,0 +1,17 @@ + +def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") { + cs = autobuilder.commonscripts() + + if (isUnix()) { + sh """ + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" + """ + } + else { + bat """ + "%${PYTHON}%" -u "%${cs}%\\differences\\show_release_differences.py" -g "%${sourcepath}%" -s "%${sourcerevision}%" -p "%${previoussourcerevision}%" -j ${jirakey} -o "opposite notcommon" -v "%${versionfolder}%" + """ + } +} + +return this; From db8e1ffe8d148b7b5b17fb9bc7492b4e49b4dc09 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 11 Nov 2018 11:43:28 +0000 Subject: [PATCH 0263/1971] Remove boilerplate --- versionnumbering/do.groovy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 versionnumbering/do.groovy diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy new file mode 100644 index 0000000..9b4a42e --- /dev/null +++ b/versionnumbering/do.groovy @@ -0,0 +1,20 @@ + +def stamp(convertdetails) { + for (convertdetail in convertdetails) { + filetoconvert = convertdetail[0] + pattern = convertdetail[1] + replacement = convertdetail[2] + if (isUnix()) { + sh """ + "${PYTHON}" -u "${autobuilder.commonscripts()}/versionstamping/versionstamper.py" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + """ + } + else { + bat """ + "%${PYTHON}%" -u "%${autobuilder.commonscripts()}%\\versionstamping\\versionstamper.py" -f "%${filetoconvert}%" -p "%${pattern}%" -s "%${replacement}%" + """ + } + } +} + +return this; From 1d7346e5a02c0018986e56a47987adf197874731 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 11 Nov 2018 11:43:28 +0000 Subject: [PATCH 0264/1971] Remove boilerplate --- versionnumbering/do.groovy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 versionnumbering/do.groovy diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy new file mode 100644 index 0000000..9b4a42e --- /dev/null +++ b/versionnumbering/do.groovy @@ -0,0 +1,20 @@ + +def stamp(convertdetails) { + for (convertdetail in convertdetails) { + filetoconvert = convertdetail[0] + pattern = convertdetail[1] + replacement = convertdetail[2] + if (isUnix()) { + sh """ + "${PYTHON}" -u "${autobuilder.commonscripts()}/versionstamping/versionstamper.py" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + """ + } + else { + bat """ + "%${PYTHON}%" -u "%${autobuilder.commonscripts()}%\\versionstamping\\versionstamper.py" -f "%${filetoconvert}%" -p "%${pattern}%" -s "%${replacement}%" + """ + } + } +} + +return this; From b92a8261897b30807c06198982d92a5db1cfd805 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 12 Nov 2018 10:50:37 +0000 Subject: [PATCH 0265/1971] Rename .gsh files to .groovy --- artifacts/{metaexport.gsh => metaexport.groovy} | 0 commandline/{commandline.gsh => commandline.groovy} | 0 .../{disableparallelbuilds.gsh => disableparallelbuilds.groovy} | 0 .../eclipsebuild/{eclipseds5build.gsh => eclipseds5build.groovy} | 0 configuration/{configuration.gsh => configuration.groovy} | 0 differences/{json.gsh => json.groovy} | 0 install/{installhelper.gsh => installhelper.groovy} | 0 versioncontrol/{git.gsh => git.groovy} | 0 versionnumbering/{metaversion.gsh => metaversion.groovy} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename artifacts/{metaexport.gsh => metaexport.groovy} (100%) rename commandline/{commandline.gsh => commandline.groovy} (100%) rename compile/eclipsebuild/{disableparallelbuilds.gsh => disableparallelbuilds.groovy} (100%) rename compile/eclipsebuild/{eclipseds5build.gsh => eclipseds5build.groovy} (100%) rename configuration/{configuration.gsh => configuration.groovy} (100%) rename differences/{json.gsh => json.groovy} (100%) rename install/{installhelper.gsh => installhelper.groovy} (100%) rename versioncontrol/{git.gsh => git.groovy} (100%) rename versionnumbering/{metaversion.gsh => metaversion.groovy} (100%) diff --git a/artifacts/metaexport.gsh b/artifacts/metaexport.groovy similarity index 100% rename from artifacts/metaexport.gsh rename to artifacts/metaexport.groovy diff --git a/commandline/commandline.gsh b/commandline/commandline.groovy similarity index 100% rename from commandline/commandline.gsh rename to commandline/commandline.groovy diff --git a/compile/eclipsebuild/disableparallelbuilds.gsh b/compile/eclipsebuild/disableparallelbuilds.groovy similarity index 100% rename from compile/eclipsebuild/disableparallelbuilds.gsh rename to compile/eclipsebuild/disableparallelbuilds.groovy diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.groovy similarity index 100% rename from compile/eclipsebuild/eclipseds5build.gsh rename to compile/eclipsebuild/eclipseds5build.groovy diff --git a/configuration/configuration.gsh b/configuration/configuration.groovy similarity index 100% rename from configuration/configuration.gsh rename to configuration/configuration.groovy diff --git a/differences/json.gsh b/differences/json.groovy similarity index 100% rename from differences/json.gsh rename to differences/json.groovy diff --git a/install/installhelper.gsh b/install/installhelper.groovy similarity index 100% rename from install/installhelper.gsh rename to install/installhelper.groovy diff --git a/versioncontrol/git.gsh b/versioncontrol/git.groovy similarity index 100% rename from versioncontrol/git.gsh rename to versioncontrol/git.groovy diff --git a/versionnumbering/metaversion.gsh b/versionnumbering/metaversion.groovy similarity index 100% rename from versionnumbering/metaversion.gsh rename to versionnumbering/metaversion.groovy From 4f62592e7f7bf0c91cb372f12d10c83fa208d4c8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 13 Nov 2018 09:39:25 +0000 Subject: [PATCH 0266/1971] buildstamp.txt -> buildstamps.txt --- versionnumbering/metaversion.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy index 9a50e2e..e566aa1 100644 --- a/versionnumbering/metaversion.groovy +++ b/versionnumbering/metaversion.groovy @@ -44,7 +44,7 @@ def appendcomponentinfo(versionFolder, outputFolder) { writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents } - buildStampFile = "${versionFolder}/buildstamp.txt" + buildStampFile = "${versionFolder}/buildstamps.txt" buildStampFileContents = readFile("${buildStampFile}").trim() remoteurlFile = "${versionFolder}/remoteurl.txt" From 2b616e5397f88d7acbbdca593db7a7ce9ecae45f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 14 Nov 2018 12:21:52 +0000 Subject: [PATCH 0267/1971] Handle version numbering in windows --- versionnumbering/generate.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 6e87392..cf02860 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -8,7 +8,7 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam } else { bat """ - "%${PYTHON}%" -u "%${cs}%\\versionnumbering\\versioninfo.py" -s "%${sourcerevision}%" -v "${versionfolder}" -g "${sourcepath}" -b %${basebuildnumber}% -j "%${jobname}%" -n "%${buildid}%" -r "%${releasejobname}%" + \"${PYTHON}\" -u \"${cs}\\versionnumbering\\versioninfo.py\" -s \"${sourcerevision}\" -v \"${versionfolder}\" -g \"${sourcepath}\" -b ${basebuildnumber} -j \"${jobname}\" -n \"${buildid}\" -r \"${releasejobname}\" """ } env.BUILD_STAMP = readFile("${WORKSPACE}/version/buildstamp.txt").trim() @@ -17,4 +17,4 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam configurationhelper.saveConfigurationInVersionInfo(); } -return this; \ No newline at end of file +return this; From 8ce03b4e10a7016e46bfd9f1f91c30822fdc89ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 14 Nov 2018 12:28:10 +0000 Subject: [PATCH 0268/1971] Handle version numbering in windows --- differences/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/do.groovy b/differences/do.groovy index 9dc1807..7279c0b 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -9,7 +9,7 @@ def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, ver } else { bat """ - "%${PYTHON}%" -u "%${cs}%\\differences\\show_release_differences.py" -g "%${sourcepath}%" -s "%${sourcerevision}%" -p "%${previoussourcerevision}%" -j ${jirakey} -o "opposite notcommon" -v "%${versionfolder}%" + \"${PYTHON}\" -u \"${cs}\\differences\\show_release_differences.py\" -g \"${sourcepath}\" -s \"${sourcerevision}\" -p \"${previoussourcerevision}\" -j ${jirakey} -o \"opposite notcommon\" -v \"${versionfolder}\" """ } } From 143670fbc6aba03871871b44aae0e7cd6d5b6ffe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 14 Nov 2018 12:44:11 +0000 Subject: [PATCH 0269/1971] Handle version numbering in windows --- differences/do.groovy | 9 +++------ versionnumbering/generate.groovy | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 7279c0b..d0a489b 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -2,15 +2,12 @@ def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") { cs = autobuilder.commonscripts() + diffcmd = '"${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}"' if (isUnix()) { - sh """ - "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" - """ + sh "${diffcmd}" } else { - bat """ - \"${PYTHON}\" -u \"${cs}\\differences\\show_release_differences.py\" -g \"${sourcepath}\" -s \"${sourcerevision}\" -p \"${previoussourcerevision}\" -j ${jirakey} -o \"opposite notcommon\" -v \"${versionfolder}\" - """ + bat "${diffcmd}" } } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index cf02860..2776130 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -8,7 +8,7 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam } else { bat """ - \"${PYTHON}\" -u \"${cs}\\versionnumbering\\versioninfo.py\" -s \"${sourcerevision}\" -v \"${versionfolder}\" -g \"${sourcepath}\" -b ${basebuildnumber} -j \"${jobname}\" -n \"${buildid}\" -r \"${releasejobname}\" + "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" """ } env.BUILD_STAMP = readFile("${WORKSPACE}/version/buildstamp.txt").trim() From 4c737131d55369f5deb9d2919c9632b401bea703 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 14 Nov 2018 12:45:05 +0000 Subject: [PATCH 0270/1971] Handle version numbering in windows --- differences/do.groovy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index d0a489b..b3039a9 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -2,12 +2,15 @@ def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") { cs = autobuilder.commonscripts() - diffcmd = '"${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}"' if (isUnix()) { - sh "${diffcmd}" + sh """ + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" + """ } else { - bat "${diffcmd}" + bat """ + "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" + """ } } From bf1cba0f8baccaa4c5ea3bbe8ee60f870784a4ba Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 15 Nov 2018 23:53:08 +0000 Subject: [PATCH 0271/1971] Prefix each line of a metaversion file with path to relevant artifact --- versionnumbering/metaversion.groovy | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy index e566aa1..00256cc 100644 --- a/versionnumbering/metaversion.groovy +++ b/versionnumbering/metaversion.groovy @@ -9,7 +9,16 @@ def currentContents(file, newline = "\n", defaultContents = "") { return contents } -def mergemeta(versionFolder, outputFolder) { +def prefixline(rootpath, filepath) { + fileContents = readFile("${filepath}").trim() + newFileContents = "" + fileContents.eachline { + newFileContents += "${rootpath}" + "/" + it + } + return newFileContents +} + +def mergemeta(rootpath, versionFolder, outputFolder) { echo "Merging meta data from folder: ${versionFolder} to ${outputFolder}" differencesFile = "${versionFolder}/differences.txt" @@ -18,7 +27,7 @@ def mergemeta(versionFolder, outputFolder) { writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + newContents buildStampFile = "${versionFolder}/buildstamps.txt" - buildStampFileContents = readFile("${buildStampFile}").trim() + buildStampFileContents = prefixline(rootpath, "${buildStampFile}") metabuildStampFile = "${outputFolder}/buildstamps.txt" writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + buildStampFileContents @@ -34,7 +43,7 @@ def mergemeta(versionFolder, outputFolder) { return intrevision } -def appendcomponentinfo(versionFolder, outputFolder) { +def appendcomponentinfo(rootpath, versionFolder, outputFolder) { echo "Appending component version data from folder: ${versionFolder} to ${outputFolder}" differencesFile = "${versionFolder}/differences.txt" @@ -57,7 +66,7 @@ def appendcomponentinfo(versionFolder, outputFolder) { releaseJobNameContents = currentContents("${releaseJobNameFile}", "", "-").trim() metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + "${versionFolder}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents + writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" @@ -67,20 +76,21 @@ def appendcomponentinfo(versionFolder, outputFolder) { // Each version folder should have been created using version creation scripts in this Common_scripts folder // as their are well-known files in each folder -def combineSubjobVersions(versionLabelPrefix, versionFolderList, outputFolder = "${WORKSPACE}/metaversion") { +def combineSubjobVersions(versionLabelPrefix, artifactList, outputFolder = "${WORKSPACE}/metaversion") { totalrevision = 0 dir("${outputFolder}") { deleteDir() } - for (versionFolder in versionFolderList) { + for (artifactItem in artifactList) { + (rootpath, versionFolder) = artifactItem echo "Inspecting folder: ${versionFolder}" metaversionsignaturefile = "${versionFolder}/metaversion.txt" // If the sub project is a meta job if (fileExists("${metaversionsignaturefile}")) { - intrevision = mergemeta("${versionFolder}", outputFolder) + intrevision = mergemeta(rootpath, versionFolder, outputFolder) } else { - intrevision = appendcomponentinfo("${versionFolder}", outputFolder) + intrevision = appendcomponentinfo(rootpath, versionFolder, outputFolder) } totalrevision += intrevision } From 7114a1bf1c98f95d8d51b3c76176585a21d594d6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 16 Nov 2018 13:43:05 +0000 Subject: [PATCH 0272/1971] Remove some scope of variables being created --- autobuilder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 54cfb12..eb32dfc 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -1,8 +1,8 @@ // Assume that WORKSPACE environment variable is set -autobuildroot = "${WORKSPACE}/autobuild" +def autobuildroot = "${WORKSPACE}/autobuild" -commonscriptsroot = "${autobuildroot}/Common_scripts" +def commonscriptsroot = "${autobuildroot}/Common_scripts" def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { @@ -26,8 +26,8 @@ def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autob conditionalclean() - configurationhelper = load("${commonscriptsroot}/configuration/configuration.groovy") - configurationhelper.registerPipelineScriptConfiguration() + def ch = load("${commonscriptsroot}/configuration/configuration.groovy") + ch.registerPipelineScriptConfiguration() } def commonscripts() { From 1552da9e07db5be1e461548d349d6844a81e92dd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 16 Nov 2018 13:50:31 +0000 Subject: [PATCH 0273/1971] Remove some scope of variables being created --- autobuilder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index eb32dfc..f07e945 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -1,8 +1,8 @@ // Assume that WORKSPACE environment variable is set -def autobuildroot = "${WORKSPACE}/autobuild" +autobuildroot = "${WORKSPACE}/autobuild" -def commonscriptsroot = "${autobuildroot}/Common_scripts" +commonscriptsroot = "${autobuildroot}/Common_scripts" def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { From 09a1c4fa507de3b417a2612fe80d5ea9cedc94f8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 16 Nov 2018 14:04:56 +0000 Subject: [PATCH 0274/1971] Locate required githelper script --- install/installhelper.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index a55292d..f523799 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -15,7 +15,8 @@ def artifactsImporter(artifactDetails, installerDetails) { echo "Copying from: ${folderToCopy} to: ${componentVersionFolder}" fileOperations([folderCopyOperation(destinationFolderPath: componentVersionFolder, sourceFolderPath: folderToCopy)]) //fileOperations([fileCopyOperation(excludes: '', flattenFiles: false, includes: filesToCopy, targetLocation: componentVersionFolder )]) - artifactVersion = githelper.getSHAFromVersion("${destFolder}/version") + def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + artifactVersion = gh.getSHAFromVersion("${destFolder}/version") artifactFetched.put(artifactKey, artifactVersion) } } From fdff4d689313b5cf358ca33db588cb2fcbe316c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 16 Nov 2018 23:29:39 +0000 Subject: [PATCH 0275/1971] Correct file line handling --- versionnumbering/metaversion.groovy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy index 00256cc..3b8d7c1 100644 --- a/versionnumbering/metaversion.groovy +++ b/versionnumbering/metaversion.groovy @@ -10,10 +10,13 @@ def currentContents(file, newline = "\n", defaultContents = "") { } def prefixline(rootpath, filepath) { - fileContents = readFile("${filepath}").trim() - newFileContents = "" - fileContents.eachline { - newFileContents += "${rootpath}" + "/" + it + def fileContents = readFile("${filepath}").trim() + def fileContentsNormalized = fileContents.normalize() + + def newFileContents = "" + def lines = fileContentsNormalized.readLines() + for (aline in lines) { + newFileContents += "${rootpath}" + "/" + aline } return newFileContents } From 5ee5219418ae4de60c76db138ac8b912365af0b9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 11:36:47 +0000 Subject: [PATCH 0276/1971] Add platform specific line endings definition --- autobuilder.groovy | 4 +++- platform/lineendings.groovy | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 platform/lineendings.groovy diff --git a/autobuilder.groovy b/autobuilder.groovy index 54cfb12..ef4f938 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -28,6 +28,8 @@ def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autob configurationhelper = load("${commonscriptsroot}/configuration/configuration.groovy") configurationhelper.registerPipelineScriptConfiguration() + + lineendings = load("${commonscriptsroot}/platform/lineendings.groovy") } def commonscripts() { @@ -42,4 +44,4 @@ def configurationhelper() { return load("${commonscripts()}/configuration/configuration.groovy") } -return this; \ No newline at end of file +return this; diff --git a/platform/lineendings.groovy b/platform/lineendings.groovy new file mode 100644 index 0000000..9657b0d --- /dev/null +++ b/platform/lineendings.groovy @@ -0,0 +1,5 @@ + +// Put ${nl} into strings when wanting a newline +nl = System.properties['line.separator'] + +return this; From ce133e9ba9ca4812c0afa08a6c5fb60aef42f3ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 11:55:39 +0000 Subject: [PATCH 0277/1971] Put line endings on metaversion file --- versionnumbering/metaversion.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy index 3b8d7c1..1f6cff6 100644 --- a/versionnumbering/metaversion.groovy +++ b/versionnumbering/metaversion.groovy @@ -1,4 +1,6 @@ +def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") + def currentContents(file, newline = "\n", defaultContents = "") { if (fileExists("${file}")) { contents = readFile(file: "${file}").trim() + newline @@ -16,7 +18,7 @@ def prefixline(rootpath, filepath) { def newFileContents = "" def lines = fileContentsNormalized.readLines() for (aline in lines) { - newFileContents += "${rootpath}" + "/" + aline + newFileContents += "${rootpath}" + "/" + aline + "${nl}" } return newFileContents } From d73622366001b4c5403058beaa17e8263334b93e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 20:25:15 +0000 Subject: [PATCH 0278/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 31 ++++++++++++++++ file/utils.groovy | 16 ++++++++ publishing/utils.groovy | 25 +++++++++++++ versionnumbering/generate.groovy | 11 ++++-- versionnumbering/metaversion.groovy | 57 +++++++++++++++-------------- 5 files changed, 109 insertions(+), 31 deletions(-) create mode 100644 checksum/utils.groovy create mode 100644 file/utils.groovy create mode 100644 publishing/utils.groovy diff --git a/checksum/utils.groovy b/checksum/utils.groovy new file mode 100644 index 0000000..b1a714f --- /dev/null +++ b/checksum/utils.groovy @@ -0,0 +1,31 @@ + +env.CHECKSUMARTIFACTS = "checksums/**" +def CHECKSUMFOLDER = "${WORKSPACE}/checksums" + +// SHA256SUM environment variable must be set to sha256sum utility +// Generate a checksum file of from a list of files/directories relative to workspace +def generatelist(checksummable) { + if !fileExists("${SHA256SUM}") { + error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" + } + sh """ + rm -rf "${CHECKSUMFOLDER}" + mkdir -p "${CHECKSUMFOLDER}" + """ + for (filepath in checksummable) { + def files = findFiles(glob: filepath) + for (file in files) { + if isUnix() { + sh """#!/bin/bash + "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" + """ + } + else { + bat """ + "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" + """ + } + } + } +} + diff --git a/file/utils.groovy b/file/utils.groovy new file mode 100644 index 0000000..0ffa47c --- /dev/null +++ b/file/utils.groovy @@ -0,0 +1,16 @@ + +def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") + +// Get current contents of given file and optionally add a newline string/character; If file doesn't exist, return default contents +def currentContents(file, newline = "${nl}", defaultContents = "") { + def contents = "" + if (fileExists("${file}")) { + contents = readFile(file: "${file}").trim() + newline + } + else { + contents = defaultContents + } + return contents +} + +return this; diff --git a/publishing/utils.groovy b/publishing/utils.groovy new file mode 100644 index 0000000..a10fd76 --- /dev/null +++ b/publishing/utils.groovy @@ -0,0 +1,25 @@ + +def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") + +env.PUBLISHABLEARTIFACTS = "publishable/**" +def PUBLISHABLEFOLDER = "${WORKSPACE}/publishable" +def PUBLISHABLEFILE = "${WORKSPACE}/publishable/list.json" + +// Generate a list of artifact files that are publishable to outside parties +def generatelist(publishable) { + sh """ + rm -rf "${PUBLISHABLEFOLDER}" + mkdir -p "${PUBLISHABLEFOLDER}" + """ + filelist = [] + for (filepath in publishable) { + def files = findFiles(glob: filepath) + for (file in files) { + if (!file.directory) { + filelist.add(file.path) + } + } + } + def outJson = readJSON text: groovy.json.JsonOutput.toJson(filelist) + writeJSON(file: PUBLISHABLEFILE, json: outJson, pretty: 4) +} \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 2776130..6f9f803 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,5 +1,8 @@ -def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${WORKSPACE}/version", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { +env.VERSIONARTIFACTS = "version/**" +def VERSIONFOLDER = "${WORKSPACE}/version" + +def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { cs = autobuilder.commonscripts() if (isUnix()) { sh """ @@ -11,9 +14,9 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" """ } - env.BUILD_STAMP = readFile("${WORKSPACE}/version/buildstamp.txt").trim() - env.BUILD_STAMP_COMMA_SEP = readFile("${WORKSPACE}/version/buildstampcommasep.txt").trim() - env.SRC_REVISION = readFile("${WORKSPACE}/version/revision.txt").trim() + env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() + env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() + env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() configurationhelper.saveConfigurationInVersionInfo(); } diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy index 1f6cff6..ff20a86 100644 --- a/versionnumbering/metaversion.groovy +++ b/versionnumbering/metaversion.groovy @@ -1,5 +1,6 @@ def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") +def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") def currentContents(file, newline = "\n", defaultContents = "") { if (fileExists("${file}")) { @@ -26,18 +27,19 @@ def prefixline(rootpath, filepath) { def mergemeta(rootpath, versionFolder, outputFolder) { echo "Merging meta data from folder: ${versionFolder} to ${outputFolder}" - differencesFile = "${versionFolder}/differences.txt" - newContents = readFile file: "${differencesFile}" - metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + newContents + def differencesFile = "${versionFolder}/differences.txt" + def newContents = readFile file: "${differencesFile}" + def metadifferencesFile = "${outputFolder}/differences.txt" + writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + newContents - buildStampFile = "${versionFolder}/buildstamps.txt" - buildStampFileContents = prefixline(rootpath, "${buildStampFile}") - metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + buildStampFileContents + def buildStampFile = "${versionFolder}/buildstamps.txt" + def buildStampFileContents = prefixline(rootpath, "${buildStampFile}") + def metabuildStampFile = "${outputFolder}/buildstamps.txt" + writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + buildStampFileContents + def intrevision = 0 if (fileExists("${versionFolder}/revision.txt")) { - revision = readFile("${versionFolder}/revision.txt").trim() + def revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" } @@ -51,29 +53,29 @@ def mergemeta(rootpath, versionFolder, outputFolder) { def appendcomponentinfo(rootpath, versionFolder, outputFolder) { echo "Appending component version data from folder: ${versionFolder} to ${outputFolder}" - differencesFile = "${versionFolder}/differences.txt" + def differencesFile = "${versionFolder}/differences.txt" if (fileExists("${differencesFile}")) { - newContents = readFile file: "${differencesFile}" - metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents + def newContents = readFile file: "${differencesFile}" + def metadifferencesFile = "${outputFolder}/differences.txt" + writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents } - buildStampFile = "${versionFolder}/buildstamps.txt" - buildStampFileContents = readFile("${buildStampFile}").trim() + def buildStampFile = "${versionFolder}/buildstamps.txt" + def buildStampFileContents = readFile("${buildStampFile}").trim() - remoteurlFile = "${versionFolder}/remoteurl.txt" - remoteurlFileContents = currentContents(remoteurlFile, "", 'Unknown').trim() + def remoteurlFile = "${versionFolder}/remoteurl.txt" + def remoteurlFileContents = fileutils.currentContents(remoteurlFile, "", 'Unknown').trim() - gitRevisionFile = "${versionFolder}/gitrevision.txt" - gitRevisionFileContents = readFile("${gitRevisionFile}").trim() + def gitRevisionFile = "${versionFolder}/gitrevision.txt" + def gitRevisionFileContents = readFile("${gitRevisionFile}").trim() - releaseJobNameFile = "${versionFolder}/releasejobname.txt" - releaseJobNameContents = currentContents("${releaseJobNameFile}", "", "-").trim() + def releaseJobNameFile = "${versionFolder}/releasejobname.txt" + def releaseJobNameContents = fileutils.currentContents("${releaseJobNameFile}", "", "-").trim() - metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents - revision = readFile("${versionFolder}/revision.txt").trim() - intrevision = revision.toInteger() + def metabuildStampFile = "${outputFolder}/buildstamps.txt" + writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents + def revision = readFile("${versionFolder}/revision.txt").trim() + def intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" return intrevision @@ -82,15 +84,16 @@ def appendcomponentinfo(rootpath, versionFolder, outputFolder) { // Each version folder should have been created using version creation scripts in this Common_scripts folder // as their are well-known files in each folder def combineSubjobVersions(versionLabelPrefix, artifactList, outputFolder = "${WORKSPACE}/metaversion") { - totalrevision = 0 + def totalrevision = 0 dir("${outputFolder}") { deleteDir() } for (artifactItem in artifactList) { (rootpath, versionFolder) = artifactItem echo "Inspecting folder: ${versionFolder}" - metaversionsignaturefile = "${versionFolder}/metaversion.txt" + def metaversionsignaturefile = "${versionFolder}/metaversion.txt" // If the sub project is a meta job + def intrevision = 0 if (fileExists("${metaversionsignaturefile}")) { intrevision = mergemeta(rootpath, versionFolder, outputFolder) } From 18cc8e0609829df0468474e9c2e70285d6ec12d6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 20:25:15 +0000 Subject: [PATCH 0279/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 31 ++++++++++++++++ file/utils.groovy | 16 ++++++++ publishing/utils.groovy | 25 +++++++++++++ versionnumbering/generate.groovy | 11 ++++-- versionnumbering/metaversion.groovy | 57 +++++++++++++++-------------- 5 files changed, 109 insertions(+), 31 deletions(-) create mode 100644 checksum/utils.groovy create mode 100644 file/utils.groovy create mode 100644 publishing/utils.groovy diff --git a/checksum/utils.groovy b/checksum/utils.groovy new file mode 100644 index 0000000..b1a714f --- /dev/null +++ b/checksum/utils.groovy @@ -0,0 +1,31 @@ + +env.CHECKSUMARTIFACTS = "checksums/**" +def CHECKSUMFOLDER = "${WORKSPACE}/checksums" + +// SHA256SUM environment variable must be set to sha256sum utility +// Generate a checksum file of from a list of files/directories relative to workspace +def generatelist(checksummable) { + if !fileExists("${SHA256SUM}") { + error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" + } + sh """ + rm -rf "${CHECKSUMFOLDER}" + mkdir -p "${CHECKSUMFOLDER}" + """ + for (filepath in checksummable) { + def files = findFiles(glob: filepath) + for (file in files) { + if isUnix() { + sh """#!/bin/bash + "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" + """ + } + else { + bat """ + "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" + """ + } + } + } +} + diff --git a/file/utils.groovy b/file/utils.groovy new file mode 100644 index 0000000..0ffa47c --- /dev/null +++ b/file/utils.groovy @@ -0,0 +1,16 @@ + +def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") + +// Get current contents of given file and optionally add a newline string/character; If file doesn't exist, return default contents +def currentContents(file, newline = "${nl}", defaultContents = "") { + def contents = "" + if (fileExists("${file}")) { + contents = readFile(file: "${file}").trim() + newline + } + else { + contents = defaultContents + } + return contents +} + +return this; diff --git a/publishing/utils.groovy b/publishing/utils.groovy new file mode 100644 index 0000000..a10fd76 --- /dev/null +++ b/publishing/utils.groovy @@ -0,0 +1,25 @@ + +def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") + +env.PUBLISHABLEARTIFACTS = "publishable/**" +def PUBLISHABLEFOLDER = "${WORKSPACE}/publishable" +def PUBLISHABLEFILE = "${WORKSPACE}/publishable/list.json" + +// Generate a list of artifact files that are publishable to outside parties +def generatelist(publishable) { + sh """ + rm -rf "${PUBLISHABLEFOLDER}" + mkdir -p "${PUBLISHABLEFOLDER}" + """ + filelist = [] + for (filepath in publishable) { + def files = findFiles(glob: filepath) + for (file in files) { + if (!file.directory) { + filelist.add(file.path) + } + } + } + def outJson = readJSON text: groovy.json.JsonOutput.toJson(filelist) + writeJSON(file: PUBLISHABLEFILE, json: outJson, pretty: 4) +} \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 2776130..6f9f803 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,5 +1,8 @@ -def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${WORKSPACE}/version", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { +env.VERSIONARTIFACTS = "version/**" +def VERSIONFOLDER = "${WORKSPACE}/version" + +def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { cs = autobuilder.commonscripts() if (isUnix()) { sh """ @@ -11,9 +14,9 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" """ } - env.BUILD_STAMP = readFile("${WORKSPACE}/version/buildstamp.txt").trim() - env.BUILD_STAMP_COMMA_SEP = readFile("${WORKSPACE}/version/buildstampcommasep.txt").trim() - env.SRC_REVISION = readFile("${WORKSPACE}/version/revision.txt").trim() + env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() + env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() + env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() configurationhelper.saveConfigurationInVersionInfo(); } diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy index 1f6cff6..ff20a86 100644 --- a/versionnumbering/metaversion.groovy +++ b/versionnumbering/metaversion.groovy @@ -1,5 +1,6 @@ def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") +def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") def currentContents(file, newline = "\n", defaultContents = "") { if (fileExists("${file}")) { @@ -26,18 +27,19 @@ def prefixline(rootpath, filepath) { def mergemeta(rootpath, versionFolder, outputFolder) { echo "Merging meta data from folder: ${versionFolder} to ${outputFolder}" - differencesFile = "${versionFolder}/differences.txt" - newContents = readFile file: "${differencesFile}" - metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + newContents + def differencesFile = "${versionFolder}/differences.txt" + def newContents = readFile file: "${differencesFile}" + def metadifferencesFile = "${outputFolder}/differences.txt" + writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + newContents - buildStampFile = "${versionFolder}/buildstamps.txt" - buildStampFileContents = prefixline(rootpath, "${buildStampFile}") - metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + buildStampFileContents + def buildStampFile = "${versionFolder}/buildstamps.txt" + def buildStampFileContents = prefixline(rootpath, "${buildStampFile}") + def metabuildStampFile = "${outputFolder}/buildstamps.txt" + writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + buildStampFileContents + def intrevision = 0 if (fileExists("${versionFolder}/revision.txt")) { - revision = readFile("${versionFolder}/revision.txt").trim() + def revision = readFile("${versionFolder}/revision.txt").trim() intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" } @@ -51,29 +53,29 @@ def mergemeta(rootpath, versionFolder, outputFolder) { def appendcomponentinfo(rootpath, versionFolder, outputFolder) { echo "Appending component version data from folder: ${versionFolder} to ${outputFolder}" - differencesFile = "${versionFolder}/differences.txt" + def differencesFile = "${versionFolder}/differences.txt" if (fileExists("${differencesFile}")) { - newContents = readFile file: "${differencesFile}" - metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents + def newContents = readFile file: "${differencesFile}" + def metadifferencesFile = "${outputFolder}/differences.txt" + writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents } - buildStampFile = "${versionFolder}/buildstamps.txt" - buildStampFileContents = readFile("${buildStampFile}").trim() + def buildStampFile = "${versionFolder}/buildstamps.txt" + def buildStampFileContents = readFile("${buildStampFile}").trim() - remoteurlFile = "${versionFolder}/remoteurl.txt" - remoteurlFileContents = currentContents(remoteurlFile, "", 'Unknown').trim() + def remoteurlFile = "${versionFolder}/remoteurl.txt" + def remoteurlFileContents = fileutils.currentContents(remoteurlFile, "", 'Unknown').trim() - gitRevisionFile = "${versionFolder}/gitrevision.txt" - gitRevisionFileContents = readFile("${gitRevisionFile}").trim() + def gitRevisionFile = "${versionFolder}/gitrevision.txt" + def gitRevisionFileContents = readFile("${gitRevisionFile}").trim() - releaseJobNameFile = "${versionFolder}/releasejobname.txt" - releaseJobNameContents = currentContents("${releaseJobNameFile}", "", "-").trim() + def releaseJobNameFile = "${versionFolder}/releasejobname.txt" + def releaseJobNameContents = fileutils.currentContents("${releaseJobNameFile}", "", "-").trim() - metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents - revision = readFile("${versionFolder}/revision.txt").trim() - intrevision = revision.toInteger() + def metabuildStampFile = "${outputFolder}/buildstamps.txt" + writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents + def revision = readFile("${versionFolder}/revision.txt").trim() + def intrevision = revision.toInteger() echo "Revision read in: ${intrevision}" return intrevision @@ -82,15 +84,16 @@ def appendcomponentinfo(rootpath, versionFolder, outputFolder) { // Each version folder should have been created using version creation scripts in this Common_scripts folder // as their are well-known files in each folder def combineSubjobVersions(versionLabelPrefix, artifactList, outputFolder = "${WORKSPACE}/metaversion") { - totalrevision = 0 + def totalrevision = 0 dir("${outputFolder}") { deleteDir() } for (artifactItem in artifactList) { (rootpath, versionFolder) = artifactItem echo "Inspecting folder: ${versionFolder}" - metaversionsignaturefile = "${versionFolder}/metaversion.txt" + def metaversionsignaturefile = "${versionFolder}/metaversion.txt" // If the sub project is a meta job + def intrevision = 0 if (fileExists("${metaversionsignaturefile}")) { intrevision = mergemeta(rootpath, versionFolder, outputFolder) } From 22d46575b08ff9115080aa373110142b09621dc3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 20:35:46 +0000 Subject: [PATCH 0280/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 2 +- publishing/utils.groovy | 6 ++---- versionnumbering/generate.groovy | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index b1a714f..a961dc8 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,6 +1,5 @@ env.CHECKSUMARTIFACTS = "checksums/**" -def CHECKSUMFOLDER = "${WORKSPACE}/checksums" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace @@ -8,6 +7,7 @@ def generatelist(checksummable) { if !fileExists("${SHA256SUM}") { error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" } + def CHECKSUMFOLDER = "${WORKSPACE}/checksums" sh """ rm -rf "${CHECKSUMFOLDER}" mkdir -p "${CHECKSUMFOLDER}" diff --git a/publishing/utils.groovy b/publishing/utils.groovy index a10fd76..2fdbb73 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,12 +1,9 @@ -def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") - env.PUBLISHABLEARTIFACTS = "publishable/**" -def PUBLISHABLEFOLDER = "${WORKSPACE}/publishable" -def PUBLISHABLEFILE = "${WORKSPACE}/publishable/list.json" // Generate a list of artifact files that are publishable to outside parties def generatelist(publishable) { + def PUBLISHABLEFOLDER = "${WORKSPACE}/publishable" sh """ rm -rf "${PUBLISHABLEFOLDER}" mkdir -p "${PUBLISHABLEFOLDER}" @@ -21,5 +18,6 @@ def generatelist(publishable) { } } def outJson = readJSON text: groovy.json.JsonOutput.toJson(filelist) + def PUBLISHABLEFILE = "${PUBLISHABLEFOLDER}/list.json" writeJSON(file: PUBLISHABLEFILE, json: outJson, pretty: 4) } \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 6f9f803..cb5e944 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,6 +1,6 @@ env.VERSIONARTIFACTS = "version/**" -def VERSIONFOLDER = "${WORKSPACE}/version" +VERSIONFOLDER = "${WORKSPACE}/version" def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { cs = autobuilder.commonscripts() From 583cffb0969e1b58848d252b55403b7a47e784d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 20:35:46 +0000 Subject: [PATCH 0281/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 2 +- publishing/utils.groovy | 6 ++---- versionnumbering/generate.groovy | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index b1a714f..a961dc8 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,6 +1,5 @@ env.CHECKSUMARTIFACTS = "checksums/**" -def CHECKSUMFOLDER = "${WORKSPACE}/checksums" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace @@ -8,6 +7,7 @@ def generatelist(checksummable) { if !fileExists("${SHA256SUM}") { error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" } + def CHECKSUMFOLDER = "${WORKSPACE}/checksums" sh """ rm -rf "${CHECKSUMFOLDER}" mkdir -p "${CHECKSUMFOLDER}" diff --git a/publishing/utils.groovy b/publishing/utils.groovy index a10fd76..2fdbb73 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,12 +1,9 @@ -def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") - env.PUBLISHABLEARTIFACTS = "publishable/**" -def PUBLISHABLEFOLDER = "${WORKSPACE}/publishable" -def PUBLISHABLEFILE = "${WORKSPACE}/publishable/list.json" // Generate a list of artifact files that are publishable to outside parties def generatelist(publishable) { + def PUBLISHABLEFOLDER = "${WORKSPACE}/publishable" sh """ rm -rf "${PUBLISHABLEFOLDER}" mkdir -p "${PUBLISHABLEFOLDER}" @@ -21,5 +18,6 @@ def generatelist(publishable) { } } def outJson = readJSON text: groovy.json.JsonOutput.toJson(filelist) + def PUBLISHABLEFILE = "${PUBLISHABLEFOLDER}/list.json" writeJSON(file: PUBLISHABLEFILE, json: outJson, pretty: 4) } \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 6f9f803..cb5e944 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,6 +1,6 @@ env.VERSIONARTIFACTS = "version/**" -def VERSIONFOLDER = "${WORKSPACE}/version" +VERSIONFOLDER = "${WORKSPACE}/version" def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { cs = autobuilder.commonscripts() From 578441471580b8d9d3f7656974f08997638e25c3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 21:29:07 +0000 Subject: [PATCH 0282/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index a961dc8..e4c37ca 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -4,8 +4,20 @@ env.CHECKSUMARTIFACTS = "checksums/**" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { - if !fileExists("${SHA256SUM}") { - error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" + def sha256sumfound = true + if (!fileExists("${SHA256SUM}")) { + def sha256sumfound = false + if (isUnix()) { + def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() + if (sha256sumpath) { + echo "Found sha256sum executable here: + env.SHA256SUM = sha256sumpath + sha256sumfound = true + } + } + if (!sha256sumfound) { + error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" + } } def CHECKSUMFOLDER = "${WORKSPACE}/checksums" sh """ From b7433f290fa8a05272a6973fd53b97b5896c584f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 21:29:07 +0000 Subject: [PATCH 0283/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index a961dc8..e4c37ca 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -4,8 +4,20 @@ env.CHECKSUMARTIFACTS = "checksums/**" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { - if !fileExists("${SHA256SUM}") { - error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" + def sha256sumfound = true + if (!fileExists("${SHA256SUM}")) { + def sha256sumfound = false + if (isUnix()) { + def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() + if (sha256sumpath) { + echo "Found sha256sum executable here: + env.SHA256SUM = sha256sumpath + sha256sumfound = true + } + } + if (!sha256sumfound) { + error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" + } } def CHECKSUMFOLDER = "${WORKSPACE}/checksums" sh """ From 757b0c6cb923dcb6c982c23309304d08e09bc35e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 21:50:35 +0000 Subject: [PATCH 0284/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index e4c37ca..63c96eb 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -10,7 +10,7 @@ def generatelist(checksummable) { if (isUnix()) { def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() if (sha256sumpath) { - echo "Found sha256sum executable here: + echo "Found sha256sum executable here: ${sha256sumpath}" env.SHA256SUM = sha256sumpath sha256sumfound = true } From 660003f7b49f43fb3f26a53255aab1382b2cbf42 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 21:50:35 +0000 Subject: [PATCH 0285/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index e4c37ca..63c96eb 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -10,7 +10,7 @@ def generatelist(checksummable) { if (isUnix()) { def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() if (sha256sumpath) { - echo "Found sha256sum executable here: + echo "Found sha256sum executable here: ${sha256sumpath}" env.SHA256SUM = sha256sumpath sha256sumfound = true } From 93233b975b20ad4e364ee613b25cd8a9c25a85cb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 22:20:30 +0000 Subject: [PATCH 0286/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 63c96eb..0d76756 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -27,7 +27,7 @@ def generatelist(checksummable) { for (filepath in checksummable) { def files = findFiles(glob: filepath) for (file in files) { - if isUnix() { + if (isUnix()) { sh """#!/bin/bash "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" """ From 53c2f1110619cf4d49ae0a65f91b4427744de9a0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 22:20:30 +0000 Subject: [PATCH 0287/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 63c96eb..0d76756 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -27,7 +27,7 @@ def generatelist(checksummable) { for (filepath in checksummable) { def files = findFiles(glob: filepath) for (file in files) { - if isUnix() { + if (isUnix()) { sh """#!/bin/bash "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" """ From 6f482426adb732ff969831e44a5eff067fb95f6c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 22:24:30 +0000 Subject: [PATCH 0288/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 0d76756..e358b94 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -6,7 +6,7 @@ env.CHECKSUMARTIFACTS = "checksums/**" def generatelist(checksummable) { def sha256sumfound = true if (!fileExists("${SHA256SUM}")) { - def sha256sumfound = false + sha256sumfound = false if (isUnix()) { def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() if (sha256sumpath) { From 7c55b96a55782302e1fd92b3b10b0532a9d1b04b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 22:24:30 +0000 Subject: [PATCH 0289/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 0d76756..e358b94 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -6,7 +6,7 @@ env.CHECKSUMARTIFACTS = "checksums/**" def generatelist(checksummable) { def sha256sumfound = true if (!fileExists("${SHA256SUM}")) { - def sha256sumfound = false + sha256sumfound = false if (isUnix()) { def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() if (sha256sumpath) { From 62a9479b71eb86f4ccf93cb85c6d1e6905cb6216 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 22:39:48 +0000 Subject: [PATCH 0290/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index e358b94..a46cd43 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -25,16 +25,18 @@ def generatelist(checksummable) { mkdir -p "${CHECKSUMFOLDER}" """ for (filepath in checksummable) { + echo "Checksumming ${filepath}" def files = findFiles(glob: filepath) for (file in files) { + echo "Checksumming ${file.path}" if (isUnix()) { sh """#!/bin/bash - "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" + "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" """ } else { bat """ - "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" + "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" """ } } From dcdf2c5fd171c8c697d06d9dfedc854b33107ad9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 22:39:48 +0000 Subject: [PATCH 0291/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index e358b94..a46cd43 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -25,16 +25,18 @@ def generatelist(checksummable) { mkdir -p "${CHECKSUMFOLDER}" """ for (filepath in checksummable) { + echo "Checksumming ${filepath}" def files = findFiles(glob: filepath) for (file in files) { + echo "Checksumming ${file.path}" if (isUnix()) { sh """#!/bin/bash - "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" + "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" """ } else { bat """ - "${SHA256SUM}" "${file}" >> "${CHECKSUMFOLDER}/sha256sum_list" + "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" """ } } From e4538f4bd4ada4e44661e81abda55211d3c844aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 22:55:21 +0000 Subject: [PATCH 0292/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index a46cd43..8829198 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -43,3 +43,4 @@ def generatelist(checksummable) { } } +return this; From e1e5c40a5470b9be9ada0959699c9718f77ffeb7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 22:55:21 +0000 Subject: [PATCH 0293/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index a46cd43..8829198 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -43,3 +43,4 @@ def generatelist(checksummable) { } } +return this; From 3122037d60b11c0cc635baaaf576e8acd17eb4dd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 23:09:52 +0000 Subject: [PATCH 0294/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 8829198..ef80fdd 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -4,9 +4,14 @@ env.CHECKSUMARTIFACTS = "checksums/**" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { - def sha256sumfound = true - if (!fileExists("${SHA256SUM}")) { - sha256sumfound = false + def sha256sumfound = false + if (env.SHA256SUM) { + if (fileExists("${SHA256SUM}")) { + sha256sumfound = true + } + } + if (!sha256sumfound) + { if (isUnix()) { def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() if (sha256sumpath) { @@ -15,9 +20,9 @@ def generatelist(checksummable) { sha256sumfound = true } } - if (!sha256sumfound) { - error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" - } + } + if (!sha256sumfound) { + error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" } def CHECKSUMFOLDER = "${WORKSPACE}/checksums" sh """ From 419d491da023651aaa654db6c9e9f0e9fec1a5db Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 23:09:52 +0000 Subject: [PATCH 0295/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 8829198..ef80fdd 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -4,9 +4,14 @@ env.CHECKSUMARTIFACTS = "checksums/**" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { - def sha256sumfound = true - if (!fileExists("${SHA256SUM}")) { - sha256sumfound = false + def sha256sumfound = false + if (env.SHA256SUM) { + if (fileExists("${SHA256SUM}")) { + sha256sumfound = true + } + } + if (!sha256sumfound) + { if (isUnix()) { def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() if (sha256sumpath) { @@ -15,9 +20,9 @@ def generatelist(checksummable) { sha256sumfound = true } } - if (!sha256sumfound) { - error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" - } + } + if (!sha256sumfound) { + error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" } def CHECKSUMFOLDER = "${WORKSPACE}/checksums" sh """ From 24dfa23ce752129658fa465870d2554014ec2904 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 23:20:01 +0000 Subject: [PATCH 0296/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 1 - publishing/utils.groovy | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index ef80fdd..ccf74db 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -33,7 +33,6 @@ def generatelist(checksummable) { echo "Checksumming ${filepath}" def files = findFiles(glob: filepath) for (file in files) { - echo "Checksumming ${file.path}" if (isUnix()) { sh """#!/bin/bash "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 2fdbb73..3fcb1f3 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -20,4 +20,6 @@ def generatelist(publishable) { def outJson = readJSON text: groovy.json.JsonOutput.toJson(filelist) def PUBLISHABLEFILE = "${PUBLISHABLEFOLDER}/list.json" writeJSON(file: PUBLISHABLEFILE, json: outJson, pretty: 4) -} \ No newline at end of file +} + +return this; From 29d30dcc7817b2961e4ed97abd67507d73ea97f0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 17 Nov 2018 23:20:01 +0000 Subject: [PATCH 0297/1971] Create a publishable artifact list; Create a checksum list --- checksum/utils.groovy | 1 - publishing/utils.groovy | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index ef80fdd..ccf74db 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -33,7 +33,6 @@ def generatelist(checksummable) { echo "Checksumming ${filepath}" def files = findFiles(glob: filepath) for (file in files) { - echo "Checksumming ${file.path}" if (isUnix()) { sh """#!/bin/bash "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 2fdbb73..3fcb1f3 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -20,4 +20,6 @@ def generatelist(publishable) { def outJson = readJSON text: groovy.json.JsonOutput.toJson(filelist) def PUBLISHABLEFILE = "${PUBLISHABLEFOLDER}/list.json" writeJSON(file: PUBLISHABLEFILE, json: outJson, pretty: 4) -} \ No newline at end of file +} + +return this; From 44bc4006328b423b56cbe70f6615776124d5ed9d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 09:48:30 +0000 Subject: [PATCH 0298/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 3 ++- publishing/utils.groovy | 3 ++- versionnumbering/metaversion.groovy | 10 ---------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index ccf74db..88496b8 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,5 +1,6 @@ -env.CHECKSUMARTIFACTS = "checksums/**" +def metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 3fcb1f3..42ebced 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,5 +1,6 @@ -env.PUBLISHABLEARTIFACTS = "publishable/**" +def metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +env.PUBLISHABLEARTIFACTS = "${metafolder.METAFOLDERNAME}/publishable/**" // Generate a list of artifact files that are publishable to outside parties def generatelist(publishable) { diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy index ff20a86..44bfbde 100644 --- a/versionnumbering/metaversion.groovy +++ b/versionnumbering/metaversion.groovy @@ -2,16 +2,6 @@ def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") -def currentContents(file, newline = "\n", defaultContents = "") { - if (fileExists("${file}")) { - contents = readFile(file: "${file}").trim() + newline - } - else { - contents = defaultContents - } - return contents -} - def prefixline(rootpath, filepath) { def fileContents = readFile("${filepath}").trim() def fileContentsNormalized = fileContents.normalize() From 86c18871e6641998816aecbf3cd3461059f970f7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 09:48:30 +0000 Subject: [PATCH 0299/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 3 ++- publishing/utils.groovy | 3 ++- versionnumbering/metaversion.groovy | 10 ---------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index ccf74db..88496b8 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,5 +1,6 @@ -env.CHECKSUMARTIFACTS = "checksums/**" +def metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 3fcb1f3..42ebced 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,5 +1,6 @@ -env.PUBLISHABLEARTIFACTS = "publishable/**" +def metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +env.PUBLISHABLEARTIFACTS = "${metafolder.METAFOLDERNAME}/publishable/**" // Generate a list of artifact files that are publishable to outside parties def generatelist(publishable) { diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy index ff20a86..44bfbde 100644 --- a/versionnumbering/metaversion.groovy +++ b/versionnumbering/metaversion.groovy @@ -2,16 +2,6 @@ def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") -def currentContents(file, newline = "\n", defaultContents = "") { - if (fileExists("${file}")) { - contents = readFile(file: "${file}").trim() + newline - } - else { - contents = defaultContents - } - return contents -} - def prefixline(rootpath, filepath) { def fileContents = readFile("${filepath}").trim() def fileContentsNormalized = fileContents.normalize() From 18d24d64ab7eb9b99ee29515336232b9bc5d42ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:24:08 +0000 Subject: [PATCH 0300/1971] Create a meta folder seperate from other artifacts --- meta/folder.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 meta/folder.groovy diff --git a/meta/folder.groovy b/meta/folder.groovy new file mode 100644 index 0000000..d7c91ef --- /dev/null +++ b/meta/folder.groovy @@ -0,0 +1,10 @@ + +METAFOLDERNAME = "meta" + +def reset() { + dir("${WORKSPACE}/${METAFOLDERNAME}") { + deleteDir() + } +} + +return this; \ No newline at end of file From 64023d515fc0460ba32cfa5cbb1fead0efa3015a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:24:08 +0000 Subject: [PATCH 0301/1971] Create a meta folder seperate from other artifacts --- meta/folder.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 meta/folder.groovy diff --git a/meta/folder.groovy b/meta/folder.groovy new file mode 100644 index 0000000..d7c91ef --- /dev/null +++ b/meta/folder.groovy @@ -0,0 +1,10 @@ + +METAFOLDERNAME = "meta" + +def reset() { + dir("${WORKSPACE}/${METAFOLDERNAME}") { + deleteDir() + } +} + +return this; \ No newline at end of file From dea2372d54f908dbfc567f0082f40e695d031436 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:33:10 +0000 Subject: [PATCH 0302/1971] Create a meta folder seperate from other artifacts --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index d7c91ef..2f4aaa3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -2,6 +2,7 @@ METAFOLDERNAME = "meta" def reset() { + echo "Resetting meta folder" dir("${WORKSPACE}/${METAFOLDERNAME}") { deleteDir() } From d835cd4a1b02c781eaeee3751c97fc66988f85c9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:33:10 +0000 Subject: [PATCH 0303/1971] Create a meta folder seperate from other artifacts --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index d7c91ef..2f4aaa3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -2,6 +2,7 @@ METAFOLDERNAME = "meta" def reset() { + echo "Resetting meta folder" dir("${WORKSPACE}/${METAFOLDERNAME}") { deleteDir() } From 87d5366db8a7edc18a30812c1d18185e0299c4c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:43:54 +0000 Subject: [PATCH 0304/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 2 +- publishing/utils.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 88496b8..02a11e0 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -25,7 +25,7 @@ def generatelist(checksummable) { if (!sha256sumfound) { error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" } - def CHECKSUMFOLDER = "${WORKSPACE}/checksums" + def CHECKSUMFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/checksums" sh """ rm -rf "${CHECKSUMFOLDER}" mkdir -p "${CHECKSUMFOLDER}" diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 42ebced..df7697c 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -4,7 +4,7 @@ env.PUBLISHABLEARTIFACTS = "${metafolder.METAFOLDERNAME}/publishable/**" // Generate a list of artifact files that are publishable to outside parties def generatelist(publishable) { - def PUBLISHABLEFOLDER = "${WORKSPACE}/publishable" + def PUBLISHABLEFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/publishable" sh """ rm -rf "${PUBLISHABLEFOLDER}" mkdir -p "${PUBLISHABLEFOLDER}" From 20697c05f1b45b686302ef82f2139d99dbe51d92 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:43:54 +0000 Subject: [PATCH 0305/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 2 +- publishing/utils.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 88496b8..02a11e0 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -25,7 +25,7 @@ def generatelist(checksummable) { if (!sha256sumfound) { error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" } - def CHECKSUMFOLDER = "${WORKSPACE}/checksums" + def CHECKSUMFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/checksums" sh """ rm -rf "${CHECKSUMFOLDER}" mkdir -p "${CHECKSUMFOLDER}" diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 42ebced..df7697c 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -4,7 +4,7 @@ env.PUBLISHABLEARTIFACTS = "${metafolder.METAFOLDERNAME}/publishable/**" // Generate a list of artifact files that are publishable to outside parties def generatelist(publishable) { - def PUBLISHABLEFOLDER = "${WORKSPACE}/publishable" + def PUBLISHABLEFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/publishable" sh """ rm -rf "${PUBLISHABLEFOLDER}" mkdir -p "${PUBLISHABLEFOLDER}" From d68d375fd11b7620854757de4e59fa65fadf89a2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:46:49 +0000 Subject: [PATCH 0306/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 2 +- publishing/utils.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 02a11e0..5ec5ba9 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,5 +1,5 @@ -def metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" // SHA256SUM environment variable must be set to sha256sum utility diff --git a/publishing/utils.groovy b/publishing/utils.groovy index df7697c..72c6566 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,5 +1,5 @@ -def metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.PUBLISHABLEARTIFACTS = "${metafolder.METAFOLDERNAME}/publishable/**" // Generate a list of artifact files that are publishable to outside parties From 430fb3349644468bfc03a755894f57556171f627 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:46:49 +0000 Subject: [PATCH 0307/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 2 +- publishing/utils.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 02a11e0..5ec5ba9 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,5 +1,5 @@ -def metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" // SHA256SUM environment variable must be set to sha256sum utility diff --git a/publishing/utils.groovy b/publishing/utils.groovy index df7697c..72c6566 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,5 +1,5 @@ -def metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.PUBLISHABLEARTIFACTS = "${metafolder.METAFOLDERNAME}/publishable/**" // Generate a list of artifact files that are publishable to outside parties From db14e8e7669021e87d477d1afd94357ae453cf90 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:57:47 +0000 Subject: [PATCH 0308/1971] Create a meta folder seperate from other artifacts --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2f4aaa3..ac82af4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,7 +1,7 @@ METAFOLDERNAME = "meta" -def reset() { +def metareset() { echo "Resetting meta folder" dir("${WORKSPACE}/${METAFOLDERNAME}") { deleteDir() From a4d6817925d8094164e4c9f7eb53d5568c68a571 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 13:57:47 +0000 Subject: [PATCH 0309/1971] Create a meta folder seperate from other artifacts --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2f4aaa3..ac82af4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,7 +1,7 @@ METAFOLDERNAME = "meta" -def reset() { +def metareset() { echo "Resetting meta folder" dir("${WORKSPACE}/${METAFOLDERNAME}") { deleteDir() From 9e6e594dfeb185b438bce8ff006bb3082acfd5d6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:09:47 +0000 Subject: [PATCH 0310/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index fd15492..89e2444 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -8,7 +8,7 @@ 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 - stash allowEmpty: true, includes: 'autobuild/**/*', name: 'Clean workspace stash', useDefaultExcludes: false + stash allowEmpty: true, includes: 'autobuild/**', name: 'Clean workspace stash', useDefaultExcludes: false cleanWs() unstash name: 'Clean workspace stash' } @@ -17,21 +17,6 @@ def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { } } -// Start up boilderplate -def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autobuildroot}/Common_scripts") { - echo "Starting...." - - autobuildroot = autobuildpath - commonscriptsroot = commonscriptspath - - conditionalclean() - - lineendings = load("${commonscriptsroot}/platform/lineendings.groovy") - - def ch = load("${commonscriptsroot}/configuration/configuration.groovy") - ch.registerPipelineScriptConfiguration() -} - def commonscripts() { return commonscriptsroot } @@ -40,6 +25,24 @@ def getautobuildpath() { return autobuildroot } +// Start up boilderplate +def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot { + echo "Starting...." + + autobuildroot = autobuildpath + commonscriptsroot = commonscriptspath + + conditionalclean() + + def metafolder = load("${commonscripts()}/meta/folder.groovy") + metafolder.metareset() + + def lineendings = load("${commonscripts()}/platform/lineendings.groovy") + + def ch = load("${commonscripts()}/configuration/configuration.groovy") + ch.registerPipelineScriptConfiguration() +} + def configurationhelper() { return load("${commonscripts()}/configuration/configuration.groovy") } From 4d61150d49a920421d46aef3d661630eae2ddb47 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:09:47 +0000 Subject: [PATCH 0311/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index fd15492..89e2444 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -8,7 +8,7 @@ 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 - stash allowEmpty: true, includes: 'autobuild/**/*', name: 'Clean workspace stash', useDefaultExcludes: false + stash allowEmpty: true, includes: 'autobuild/**', name: 'Clean workspace stash', useDefaultExcludes: false cleanWs() unstash name: 'Clean workspace stash' } @@ -17,21 +17,6 @@ def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { } } -// Start up boilderplate -def start(autobuildpath = "${WORKSPACE}/autobuild", commonscriptspath = "${autobuildroot}/Common_scripts") { - echo "Starting...." - - autobuildroot = autobuildpath - commonscriptsroot = commonscriptspath - - conditionalclean() - - lineendings = load("${commonscriptsroot}/platform/lineendings.groovy") - - def ch = load("${commonscriptsroot}/configuration/configuration.groovy") - ch.registerPipelineScriptConfiguration() -} - def commonscripts() { return commonscriptsroot } @@ -40,6 +25,24 @@ def getautobuildpath() { return autobuildroot } +// Start up boilderplate +def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot { + echo "Starting...." + + autobuildroot = autobuildpath + commonscriptsroot = commonscriptspath + + conditionalclean() + + def metafolder = load("${commonscripts()}/meta/folder.groovy") + metafolder.metareset() + + def lineendings = load("${commonscripts()}/platform/lineendings.groovy") + + def ch = load("${commonscripts()}/configuration/configuration.groovy") + ch.registerPipelineScriptConfiguration() +} + def configurationhelper() { return load("${commonscripts()}/configuration/configuration.groovy") } From 88d92bea7257ca5b0b47ffdff8abbe7b2144f2ff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:11:49 +0000 Subject: [PATCH 0312/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 89e2444..ef5ea7c 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot { +def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath From ec457ffa08b034b2f6baa2db9a2661a57468574e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:11:49 +0000 Subject: [PATCH 0313/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 89e2444..ef5ea7c 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot { +def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath From c318b8448cb6bd98cf5dc79279f8afe1650681c8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:25:55 +0000 Subject: [PATCH 0314/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 2 -- versionnumbering/generate.groovy | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index ef5ea7c..bff3738 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -37,8 +37,6 @@ def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) def metafolder = load("${commonscripts()}/meta/folder.groovy") metafolder.metareset() - def lineendings = load("${commonscripts()}/platform/lineendings.groovy") - def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index cb5e944..935f026 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,9 +1,11 @@ -env.VERSIONARTIFACTS = "version/**" -VERSIONFOLDER = "${WORKSPACE}/version" +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") + +env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" +VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { - cs = autobuilder.commonscripts() + def cs = autobuilder.commonscripts() if (isUnix()) { sh """ "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" @@ -17,7 +19,9 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() - configurationhelper.saveConfigurationInVersionInfo(); + + def ch = load("${commonscripts()}/configuration/configuration.groovy") + ch.saveConfigurationInVersionInfo(); } return this; From de74aae7682505e2c6f1ecbcbb8da7b4c6138cd6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:25:55 +0000 Subject: [PATCH 0315/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 2 -- versionnumbering/generate.groovy | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index ef5ea7c..bff3738 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -37,8 +37,6 @@ def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) def metafolder = load("${commonscripts()}/meta/folder.groovy") metafolder.metareset() - def lineendings = load("${commonscripts()}/platform/lineendings.groovy") - def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index cb5e944..935f026 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,9 +1,11 @@ -env.VERSIONARTIFACTS = "version/**" -VERSIONFOLDER = "${WORKSPACE}/version" +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") + +env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" +VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { - cs = autobuilder.commonscripts() + def cs = autobuilder.commonscripts() if (isUnix()) { sh """ "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" @@ -17,7 +19,9 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() - configurationhelper.saveConfigurationInVersionInfo(); + + def ch = load("${commonscripts()}/configuration/configuration.groovy") + ch.saveConfigurationInVersionInfo(); } return this; From 8a3df96e55362f51550673436f67c8db28becba5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:45:45 +0000 Subject: [PATCH 0316/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 3 +++ differences/do.groovy | 3 +++ 2 files changed, 6 insertions(+) diff --git a/autobuilder.groovy b/autobuilder.groovy index bff3738..090c0f4 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -45,4 +45,7 @@ def configurationhelper() { return load("${commonscripts()}/configuration/configuration.groovy") } +// Everyone wants to know this +autobuilder = this + return this; diff --git a/differences/do.groovy b/differences/do.groovy index b3039a9..7a550a9 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,4 +1,7 @@ +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +env.DIFFERENCEARTIFACTS = "${metafolder.METAFOLDERNAME}/differences/**" + def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") { cs = autobuilder.commonscripts() From a59b2c5a58fd6013aa50facb7551aa36cf88aab8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:45:45 +0000 Subject: [PATCH 0317/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 3 +++ differences/do.groovy | 3 +++ 2 files changed, 6 insertions(+) diff --git a/autobuilder.groovy b/autobuilder.groovy index bff3738..090c0f4 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -45,4 +45,7 @@ def configurationhelper() { return load("${commonscripts()}/configuration/configuration.groovy") } +// Everyone wants to know this +autobuilder = this + return this; diff --git a/differences/do.groovy b/differences/do.groovy index b3039a9..7a550a9 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,4 +1,7 @@ +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +env.DIFFERENCEARTIFACTS = "${metafolder.METAFOLDERNAME}/differences/**" + def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") { cs = autobuilder.commonscripts() From 944325f5279fe9231cbdc86ef3d80bf6816175d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:48:52 +0000 Subject: [PATCH 0318/1971] Create a meta folder seperate from other artifacts --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 935f026..f0f93be 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -20,7 +20,7 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() - def ch = load("${commonscripts()}/configuration/configuration.groovy") + def ch = load("${cs}/configuration/configuration.groovy") ch.saveConfigurationInVersionInfo(); } From 11d9fc7ee7386a495d88ac4f397967ed71dacb71 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 14:48:52 +0000 Subject: [PATCH 0319/1971] Create a meta folder seperate from other artifacts --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 935f026..f0f93be 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -20,7 +20,7 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() - def ch = load("${commonscripts()}/configuration/configuration.groovy") + def ch = load("${cs}/configuration/configuration.groovy") ch.saveConfigurationInVersionInfo(); } From b06a9fd8c1bcfd0e1bd125d149ea8ec1fbad1b75 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 15:16:23 +0000 Subject: [PATCH 0320/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 41 +++---------------------- differences/do.groovy | 6 ++-- differences/show_release_differences.py | 20 ++++++------ meta/folder.groovy | 1 + 4 files changed, 19 insertions(+), 49 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 5ec5ba9..add3a50 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -2,50 +2,19 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" -// SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { - def sha256sumfound = false - if (env.SHA256SUM) { - if (fileExists("${SHA256SUM}")) { - sha256sumfound = true - } - } - if (!sha256sumfound) - { - if (isUnix()) { - def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() - if (sha256sumpath) { - echo "Found sha256sum executable here: ${sha256sumpath}" - env.SHA256SUM = sha256sumpath - sha256sumfound = true - } - } - } - if (!sha256sumfound) { - error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" - } - def CHECKSUMFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/checksums" - sh """ - rm -rf "${CHECKSUMFOLDER}" - mkdir -p "${CHECKSUMFOLDER}" - """ + sums = "" for (filepath in checksummable) { echo "Checksumming ${filepath}" def files = findFiles(glob: filepath) for (file in files) { - if (isUnix()) { - sh """#!/bin/bash - "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" - """ - } - else { - bat """ - "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" - """ - } + def sum = sha1(file: file.path) + echo "Sum from file ${file.path} is ${sum}" + sums += "${sum}${nl}" } } + writeFile(file: "${CHECKSUMFOLDER}/sha1sumlist.txt", text: sums) } return this; diff --git a/differences/do.groovy b/differences/do.groovy index 7a550a9..8866400 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -2,17 +2,17 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.DIFFERENCEARTIFACTS = "${metafolder.METAFOLDERNAME}/differences/**" -def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") { +def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, difffolder = "${DIFFERENCEARTIFACTS}") { cs = autobuilder.commonscripts() if (isUnix()) { sh """ - "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" """ } else { bat """ - "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" + "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" """ } } diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 2d3ee0d..0813356 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -29,9 +29,9 @@ class GitException(Exception): def __repr__(self): return self.message -def makeFolder(versionfolder): - print("Creating folder (if not already there): {0}".format(versionfolder)) - os.makedirs(versionfolder, exist_ok = True) +def makeFolder(difffolder): + print("Creating folder (if not already there): {0}".format(difffolder)) + os.makedirs(difffolder, exist_ok = True) def printDivider(outfh, times = 1, length = 100): for _ in range(times): @@ -172,7 +172,7 @@ USAGE parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") - parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="", help="version folder where differences file stored [default: %(default)s]") + parser.add_argument("-d", "--difffolder", dest="difffolder", action="store", default="", help="folder where differences file stored [default: %(default)s]") # Process arguments args = parser.parse_args() @@ -183,14 +183,14 @@ USAGE previousversion = args.previousversion jirakeyprefix = args.jirakeyprefix outputoptions = args.outputoptions - versionfolder = args.versionfolder + difffolder = args.difffolder print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) - print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", versionfolder) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", difffolder) - if versionfolder: - makeFolder(versionfolder) - outfh = open(os.path.join(versionfolder, "differences.txt"), 'w') + if difffolder: + makeFolder(difffolder) + outfh = open(os.path.join(difffolder, "differences.txt"), 'w') else: outfh = sys.stdout @@ -209,7 +209,7 @@ USAGE gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if versionfolder: + if difffolder: outfh.close() return 0 except Exception as e: diff --git a/meta/folder.groovy b/meta/folder.groovy index ac82af4..6b0b21c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,5 +1,6 @@ METAFOLDERNAME = "meta" +env.METAARTIFACTS = "${METAFOLDERNAME}/**" def metareset() { echo "Resetting meta folder" From 387b799b47c8af15f9c8308b37fe5dfe4b79a797 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 15:16:23 +0000 Subject: [PATCH 0321/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 41 +++---------------------- differences/do.groovy | 6 ++-- differences/show_release_differences.py | 20 ++++++------ meta/folder.groovy | 1 + 4 files changed, 19 insertions(+), 49 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 5ec5ba9..add3a50 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -2,50 +2,19 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" -// SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { - def sha256sumfound = false - if (env.SHA256SUM) { - if (fileExists("${SHA256SUM}")) { - sha256sumfound = true - } - } - if (!sha256sumfound) - { - if (isUnix()) { - def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() - if (sha256sumpath) { - echo "Found sha256sum executable here: ${sha256sumpath}" - env.SHA256SUM = sha256sumpath - sha256sumfound = true - } - } - } - if (!sha256sumfound) { - error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" - } - def CHECKSUMFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/checksums" - sh """ - rm -rf "${CHECKSUMFOLDER}" - mkdir -p "${CHECKSUMFOLDER}" - """ + sums = "" for (filepath in checksummable) { echo "Checksumming ${filepath}" def files = findFiles(glob: filepath) for (file in files) { - if (isUnix()) { - sh """#!/bin/bash - "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" - """ - } - else { - bat """ - "${SHA256SUM}" "${file.path}" >> "${CHECKSUMFOLDER}/sha256sum_list" - """ - } + def sum = sha1(file: file.path) + echo "Sum from file ${file.path} is ${sum}" + sums += "${sum}${nl}" } } + writeFile(file: "${CHECKSUMFOLDER}/sha1sumlist.txt", text: sums) } return this; diff --git a/differences/do.groovy b/differences/do.groovy index 7a550a9..8866400 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -2,17 +2,17 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.DIFFERENCEARTIFACTS = "${metafolder.METAFOLDERNAME}/differences/**" -def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, versionfolder = "${WORKSPACE}/version") { +def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, difffolder = "${DIFFERENCEARTIFACTS}") { cs = autobuilder.commonscripts() if (isUnix()) { sh """ - "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" """ } else { bat """ - "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -v "${versionfolder}" + "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" """ } } diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 2d3ee0d..0813356 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -29,9 +29,9 @@ class GitException(Exception): def __repr__(self): return self.message -def makeFolder(versionfolder): - print("Creating folder (if not already there): {0}".format(versionfolder)) - os.makedirs(versionfolder, exist_ok = True) +def makeFolder(difffolder): + print("Creating folder (if not already there): {0}".format(difffolder)) + os.makedirs(difffolder, exist_ok = True) def printDivider(outfh, times = 1, length = 100): for _ in range(times): @@ -172,7 +172,7 @@ USAGE parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") - parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="", help="version folder where differences file stored [default: %(default)s]") + parser.add_argument("-d", "--difffolder", dest="difffolder", action="store", default="", help="folder where differences file stored [default: %(default)s]") # Process arguments args = parser.parse_args() @@ -183,14 +183,14 @@ USAGE previousversion = args.previousversion jirakeyprefix = args.jirakeyprefix outputoptions = args.outputoptions - versionfolder = args.versionfolder + difffolder = args.difffolder print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) - print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", versionfolder) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", difffolder) - if versionfolder: - makeFolder(versionfolder) - outfh = open(os.path.join(versionfolder, "differences.txt"), 'w') + if difffolder: + makeFolder(difffolder) + outfh = open(os.path.join(difffolder, "differences.txt"), 'w') else: outfh = sys.stdout @@ -209,7 +209,7 @@ USAGE gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if versionfolder: + if difffolder: outfh.close() return 0 except Exception as e: diff --git a/meta/folder.groovy b/meta/folder.groovy index ac82af4..6b0b21c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,5 +1,6 @@ METAFOLDERNAME = "meta" +env.METAARTIFACTS = "${METAFOLDERNAME}/**" def metareset() { echo "Resetting meta folder" From 473edb7ad0953f7510df56dcd69df867b9464dc6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 15:23:39 +0000 Subject: [PATCH 0322/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index add3a50..ec3b10a 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -4,14 +4,14 @@ env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { + load("${autobuilder.commonscripts()}/platform/lineendings.groovy") sums = "" for (filepath in checksummable) { echo "Checksumming ${filepath}" def files = findFiles(glob: filepath) for (file in files) { def sum = sha1(file: file.path) - echo "Sum from file ${file.path} is ${sum}" - sums += "${sum}${nl}" + sums += "${sum} ${file.path}${nl}" // Format suitable for sha1sum utility } } writeFile(file: "${CHECKSUMFOLDER}/sha1sumlist.txt", text: sums) From 552370f9c1126e45b772762b274462ad26bd412b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 15:23:39 +0000 Subject: [PATCH 0323/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index add3a50..ec3b10a 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -4,14 +4,14 @@ env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { + load("${autobuilder.commonscripts()}/platform/lineendings.groovy") sums = "" for (filepath in checksummable) { echo "Checksumming ${filepath}" def files = findFiles(glob: filepath) for (file in files) { def sum = sha1(file: file.path) - echo "Sum from file ${file.path} is ${sum}" - sums += "${sum}${nl}" + sums += "${sum} ${file.path}${nl}" // Format suitable for sha1sum utility } } writeFile(file: "${CHECKSUMFOLDER}/sha1sumlist.txt", text: sums) From 7ee6d66922e60919bd3708b37082f3e09c0f3a03 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 15:27:40 +0000 Subject: [PATCH 0324/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 1 + versionnumbering/generate.groovy | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index ec3b10a..748472f 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,6 +1,7 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" +CHECKSUMFOLDER = "${metafolder.METAFOLDERNAME}/checksums" // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f0f93be..cdcf1c2 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,6 +1,5 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") - env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" From 92e52dac5af83f9d04cec0f8abbe673cea445bf3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 15:27:40 +0000 Subject: [PATCH 0325/1971] Create a meta folder seperate from other artifacts --- checksum/utils.groovy | 1 + versionnumbering/generate.groovy | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index ec3b10a..748472f 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,6 +1,7 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" +CHECKSUMFOLDER = "${metafolder.METAFOLDERNAME}/checksums" // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f0f93be..cdcf1c2 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,6 +1,5 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") - env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" From 818e4995f73c4491ae70a4d554f3d9582d4a3b83 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 15:36:24 +0000 Subject: [PATCH 0326/1971] Create a meta folder seperate from other artifacts --- differences/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 8866400..9e572af 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,10 +1,10 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.DIFFERENCEARTIFACTS = "${metafolder.METAFOLDERNAME}/differences/**" +DIFFERENCEFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/differences" -def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, difffolder = "${DIFFERENCEARTIFACTS}") { +def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, difffolder = "${DIFFERENCEFOLDER}") { cs = autobuilder.commonscripts() - if (isUnix()) { sh """ "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" From 0ad7692aed22ea93a9bd3e9b956c96e23cffbd27 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 15:36:24 +0000 Subject: [PATCH 0327/1971] Create a meta folder seperate from other artifacts --- differences/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 8866400..9e572af 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,10 +1,10 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.DIFFERENCEARTIFACTS = "${metafolder.METAFOLDERNAME}/differences/**" +DIFFERENCEFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/differences" -def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, difffolder = "${DIFFERENCEARTIFACTS}") { +def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, difffolder = "${DIFFERENCEFOLDER}") { cs = autobuilder.commonscripts() - if (isUnix()) { sh """ "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" From c3458cde4f8152cc1dff854173b2af6a40df9cc1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 21:23:41 +0000 Subject: [PATCH 0328/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 5 ++++- product/info.groovy | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 product/info.groovy diff --git a/autobuilder.groovy b/autobuilder.groovy index 090c0f4..fc298ba 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(productname = "", jirakey = "", autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -37,6 +37,9 @@ def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) def metafolder = load("${commonscripts()}/meta/folder.groovy") metafolder.metareset() + def productinfo = load("${commonscripts()}/product/info.groovy") + productinfo.setname(productname, jirakey) + def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() } diff --git a/product/info.groovy b/product/info.groovy new file mode 100644 index 0000000..c41fc80 --- /dev/null +++ b/product/info.groovy @@ -0,0 +1,16 @@ + +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" +env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" + +def setname(productname = "", jirakey = "") { + def productdata = [ + 'name' : productname.trim(), + 'jirakey' : jirakey.trim() + ] + def outJson = readJSON text: groovy.json.JsonOutput.toJson(productdata) + def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" + writeJSON(file: PRODUCTFILE, json: outJson, pretty: 4) +} + +return this; \ No newline at end of file From c04c82be175e05d9cbe7bc8f37f3d22538097a6b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 18 Nov 2018 21:23:41 +0000 Subject: [PATCH 0329/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 5 ++++- product/info.groovy | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 product/info.groovy diff --git a/autobuilder.groovy b/autobuilder.groovy index 090c0f4..fc298ba 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(productname = "", jirakey = "", autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -37,6 +37,9 @@ def start(autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) def metafolder = load("${commonscripts()}/meta/folder.groovy") metafolder.metareset() + def productinfo = load("${commonscripts()}/product/info.groovy") + productinfo.setname(productname, jirakey) + def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() } diff --git a/product/info.groovy b/product/info.groovy new file mode 100644 index 0000000..c41fc80 --- /dev/null +++ b/product/info.groovy @@ -0,0 +1,16 @@ + +metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") +PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" +env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" + +def setname(productname = "", jirakey = "") { + def productdata = [ + 'name' : productname.trim(), + 'jirakey' : jirakey.trim() + ] + def outJson = readJSON text: groovy.json.JsonOutput.toJson(productdata) + def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" + writeJSON(file: PRODUCTFILE, json: outJson, pretty: 4) +} + +return this; \ No newline at end of file From 9b95e26e3cca1498f1e35e48615697df70899b67 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 10:52:04 +0000 Subject: [PATCH 0330/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 4 ++-- product/info.groovy | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index fc298ba..ae3af20 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(productname = "", jirakey = "", autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -38,7 +38,7 @@ def start(productname = "", jirakey = "", autobuildpath = autobuildroot, commons metafolder.metareset() def productinfo = load("${commonscripts()}/product/info.groovy") - productinfo.setname(productname, jirakey) + productinfo.setname(productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() diff --git a/product/info.groovy b/product/info.groovy index c41fc80..05ed92a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -3,9 +3,10 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" -def setname(productname = "", jirakey = "") { +def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { def productdata = [ 'name' : productname.trim(), + 'subcomponent' : subcomponentname.trim() 'jirakey' : jirakey.trim() ] def outJson = readJSON text: groovy.json.JsonOutput.toJson(productdata) From 0b491063dcd3de67fbe2c5e3543314ceb0d3f818 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 10:52:04 +0000 Subject: [PATCH 0331/1971] Create a meta folder seperate from other artifacts --- autobuilder.groovy | 4 ++-- product/info.groovy | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index fc298ba..ae3af20 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(productname = "", jirakey = "", autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -38,7 +38,7 @@ def start(productname = "", jirakey = "", autobuildpath = autobuildroot, commons metafolder.metareset() def productinfo = load("${commonscripts()}/product/info.groovy") - productinfo.setname(productname, jirakey) + productinfo.setname(productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() diff --git a/product/info.groovy b/product/info.groovy index c41fc80..05ed92a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -3,9 +3,10 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" -def setname(productname = "", jirakey = "") { +def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { def productdata = [ 'name' : productname.trim(), + 'subcomponent' : subcomponentname.trim() 'jirakey' : jirakey.trim() ] def outJson = readJSON text: groovy.json.JsonOutput.toJson(productdata) From e4c616c22bead7d34c1df20435a8348898fbca35 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 10:53:23 +0000 Subject: [PATCH 0332/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 05ed92a..a908e7e 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -6,8 +6,8 @@ env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { def productdata = [ 'name' : productname.trim(), - 'subcomponent' : subcomponentname.trim() - 'jirakey' : jirakey.trim() + 'subcomponent' : subcomponentname.trim(), + 'jirakey' : jirakey.trim(), ] def outJson = readJSON text: groovy.json.JsonOutput.toJson(productdata) def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" From f8bfaca3f08583a03dd077920637ef6b912b1a44 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 10:53:23 +0000 Subject: [PATCH 0333/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 05ed92a..a908e7e 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -6,8 +6,8 @@ env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { def productdata = [ 'name' : productname.trim(), - 'subcomponent' : subcomponentname.trim() - 'jirakey' : jirakey.trim() + 'subcomponent' : subcomponentname.trim(), + 'jirakey' : jirakey.trim(), ] def outJson = readJSON text: groovy.json.JsonOutput.toJson(productdata) def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" From 04a1f3e243fa3f6d2691a76927c11bdb434f869f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 14:32:14 +0000 Subject: [PATCH 0334/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 40 ++++++++++++--- versionnumbering/generate.groovy | 83 ++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 7 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index a908e7e..71cf6fa 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -1,17 +1,43 @@ +load("${autobuilder.commonscripts()}/json/interface.groovy") + metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" +class ProductInfo extends JsonSerialised { + private String productname + private String subcomponentname + private String jirakey + + ProductInfo(productName = "", subcomponentName = "", jiraKey = "") { + productname = productName + subcomponentname = subcomponentName + jirakey = jiraKey + } + + def serialisationdata() { + def data = [ + 'productname' : productname, + 'subcomponentname' : subcomponentname, + 'jirakey' : jirakey, + ] + return data + } + + def saveJsonSerialised(String outputfile, int prettylevel = 4) { + def outJson = readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) + writeJSON(file: outputfile, json: outJson, pretty: prettylevel) + } +} + +theProductInfo = new ProductInfo() + def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { - def productdata = [ - 'name' : productname.trim(), - 'subcomponent' : subcomponentname.trim(), - 'jirakey' : jirakey.trim(), - ] - def outJson = readJSON text: groovy.json.JsonOutput.toJson(productdata) + theProductInfo = new ProductInfo(productname, subcomponentname, jirakey) + def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" - writeJSON(file: PRODUCTFILE, json: outJson, pretty: 4) + theProductInfo.saveJsonSerialised(PRODUCTFILE) } return this; \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index cdcf1c2..ad6214d 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -3,6 +3,89 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" +class GitInfo { + private String sourcepath + private String sourcerevision + private String gitrevision + private String remoteurl + private String remoteinfo +} + +class JenkinsBuildInfo { + private String buildjobname + private int buildnumber + private String buildmachine + private String builddate +} + +class BuildStampInfo { + private String buildstampprefix + private int revision + private String buildstamp + private String buildstampcommasep +} + +class ReleaseInfo { + private String releasejobname +} + +class VersionInfo { + private ComponentInfo componentinfo + private GitInfo gitinfo + private JenkinsBuildInfo jenkinsbuildinfo + private BuildStampInfo buildstampinfo + private ReleaseInfo releaseinfo + + private VersionInfo[] associatedversions +} + + def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { + + + version.generate("${SOURCE_REVISION}", "${SOURCE_PATH}", "${BASEBUILDNUMBER}", "${RELEASE_JOB_NAME}") + + VersionInfo() { + } + def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname): + with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: + f.write(buildjobname) + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(str(gitrevisioncount)) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + + with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: + f.write(remoteurl) + + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: + f.write(buildnumber) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) + + with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: + f.write(slaveMachine) + + with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: + f.write(str(datetime.datetime.now())) + + with open(os.path.join(versionfolder, "releasejobname.txt"), 'w') as f: + f.write(releasejobname) + +} + def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { def cs = autobuilder.commonscripts() if (isUnix()) { From d1b409b2d49953164cd5f30524832285c8dfd521 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 14:32:14 +0000 Subject: [PATCH 0335/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 40 ++++++++++++--- versionnumbering/generate.groovy | 83 ++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 7 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index a908e7e..71cf6fa 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -1,17 +1,43 @@ +load("${autobuilder.commonscripts()}/json/interface.groovy") + metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" +class ProductInfo extends JsonSerialised { + private String productname + private String subcomponentname + private String jirakey + + ProductInfo(productName = "", subcomponentName = "", jiraKey = "") { + productname = productName + subcomponentname = subcomponentName + jirakey = jiraKey + } + + def serialisationdata() { + def data = [ + 'productname' : productname, + 'subcomponentname' : subcomponentname, + 'jirakey' : jirakey, + ] + return data + } + + def saveJsonSerialised(String outputfile, int prettylevel = 4) { + def outJson = readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) + writeJSON(file: outputfile, json: outJson, pretty: prettylevel) + } +} + +theProductInfo = new ProductInfo() + def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { - def productdata = [ - 'name' : productname.trim(), - 'subcomponent' : subcomponentname.trim(), - 'jirakey' : jirakey.trim(), - ] - def outJson = readJSON text: groovy.json.JsonOutput.toJson(productdata) + theProductInfo = new ProductInfo(productname, subcomponentname, jirakey) + def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" - writeJSON(file: PRODUCTFILE, json: outJson, pretty: 4) + theProductInfo.saveJsonSerialised(PRODUCTFILE) } return this; \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index cdcf1c2..ad6214d 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -3,6 +3,89 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" +class GitInfo { + private String sourcepath + private String sourcerevision + private String gitrevision + private String remoteurl + private String remoteinfo +} + +class JenkinsBuildInfo { + private String buildjobname + private int buildnumber + private String buildmachine + private String builddate +} + +class BuildStampInfo { + private String buildstampprefix + private int revision + private String buildstamp + private String buildstampcommasep +} + +class ReleaseInfo { + private String releasejobname +} + +class VersionInfo { + private ComponentInfo componentinfo + private GitInfo gitinfo + private JenkinsBuildInfo jenkinsbuildinfo + private BuildStampInfo buildstampinfo + private ReleaseInfo releaseinfo + + private VersionInfo[] associatedversions +} + + def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { + + + version.generate("${SOURCE_REVISION}", "${SOURCE_PATH}", "${BASEBUILDNUMBER}", "${RELEASE_JOB_NAME}") + + VersionInfo() { + } + def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname): + with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: + f.write(buildjobname) + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(str(gitrevisioncount)) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + + with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: + f.write(remoteurl) + + with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: + f.write(buildnumber) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) + + with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: + f.write(slaveMachine) + + with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: + f.write(str(datetime.datetime.now())) + + with open(os.path.join(versionfolder, "releasejobname.txt"), 'w') as f: + f.write(releasejobname) + +} + def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { def cs = autobuilder.commonscripts() if (isUnix()) { From 6d14319d823ee8856103cf83864b28e0d6513b60 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 14:34:36 +0000 Subject: [PATCH 0336/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 json/interface.groovy diff --git a/json/interface.groovy b/json/interface.groovy new file mode 100644 index 0000000..8962578 --- /dev/null +++ b/json/interface.groovy @@ -0,0 +1,7 @@ + +abstract class JsonSerialised { + def serialisationdata() + def saveJsonSerialised(String outputfile, int prettylevel = 4) +} + +return this; From ae3ad5f31d3b6a57c261b18345069a9f0fa17520 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 14:34:36 +0000 Subject: [PATCH 0337/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 json/interface.groovy diff --git a/json/interface.groovy b/json/interface.groovy new file mode 100644 index 0000000..8962578 --- /dev/null +++ b/json/interface.groovy @@ -0,0 +1,7 @@ + +abstract class JsonSerialised { + def serialisationdata() + def saveJsonSerialised(String outputfile, int prettylevel = 4) +} + +return this; From cf49dbc254fac6f6fefa021fb5cd6648c27339a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 14:39:03 +0000 Subject: [PATCH 0338/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 71cf6fa..979d0b5 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -1,5 +1,5 @@ -load("${autobuilder.commonscripts()}/json/interface.groovy") +def ji = load("${autobuilder.commonscripts()}/json/interface.groovy") metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" From bba686364164d7f8e781837ee06aa068e842d175 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 14:39:03 +0000 Subject: [PATCH 0339/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 71cf6fa..979d0b5 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -1,5 +1,5 @@ -load("${autobuilder.commonscripts()}/json/interface.groovy") +def ji = load("${autobuilder.commonscripts()}/json/interface.groovy") metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" From e8bf65688350e5838ab13a81514b5fed8d88bde7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:22:46 +0000 Subject: [PATCH 0340/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 4 ++-- product/info.groovy | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/json/interface.groovy b/json/interface.groovy index 8962578..d238707 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -1,7 +1,7 @@ abstract class JsonSerialised { - def serialisationdata() - def saveJsonSerialised(String outputfile, int prettylevel = 4) + def serialisationdata(); + def saveJsonSerialised(String outputfile, int prettylevel = 4); } return this; diff --git a/product/info.groovy b/product/info.groovy index 979d0b5..9b2551c 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -11,6 +11,7 @@ class ProductInfo extends JsonSerialised { private String jirakey ProductInfo(productName = "", subcomponentName = "", jiraKey = "") { + super() productname = productName subcomponentname = subcomponentName jirakey = jiraKey From f8f739e6fdd7b6efad937cc7ea60121541c02fdc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:22:46 +0000 Subject: [PATCH 0341/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 4 ++-- product/info.groovy | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/json/interface.groovy b/json/interface.groovy index 8962578..d238707 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -1,7 +1,7 @@ abstract class JsonSerialised { - def serialisationdata() - def saveJsonSerialised(String outputfile, int prettylevel = 4) + def serialisationdata(); + def saveJsonSerialised(String outputfile, int prettylevel = 4); } return this; diff --git a/product/info.groovy b/product/info.groovy index 979d0b5..9b2551c 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -11,6 +11,7 @@ class ProductInfo extends JsonSerialised { private String jirakey ProductInfo(productName = "", subcomponentName = "", jiraKey = "") { + super() productname = productName subcomponentname = subcomponentName jirakey = jiraKey From d19b4be96d2d36c8bddebaea9fa119667c68af17 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:25:14 +0000 Subject: [PATCH 0342/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 9b2551c..783b84c 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,7 +5,7 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" -class ProductInfo extends JsonSerialised { +class ProductInfo extends ji.JsonSerialised { private String productname private String subcomponentname private String jirakey From babca972e743871e9e1178aafc6d4380a2520691 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:25:14 +0000 Subject: [PATCH 0343/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 9b2551c..783b84c 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,7 +5,7 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" -class ProductInfo extends JsonSerialised { +class ProductInfo extends ji.JsonSerialised { private String productname private String subcomponentname private String jirakey From 8e1175a952781fb3e2501b4e27702e8948d53880 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:26:48 +0000 Subject: [PATCH 0344/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 783b84c..8b8d3e2 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,7 +5,7 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" -class ProductInfo extends ji.JsonSerialised { +class ProductInfo { private String productname private String subcomponentname private String jirakey From 5d05f9baeab64949a471f92cfc315dc72ee7028d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:26:48 +0000 Subject: [PATCH 0345/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 783b84c..8b8d3e2 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,7 +5,7 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" -class ProductInfo extends ji.JsonSerialised { +class ProductInfo { private String productname private String subcomponentname private String jirakey From 729b4f1ef2dbcabb7f2845a8a9dac50a9595208d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:29:20 +0000 Subject: [PATCH 0346/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json/interface.groovy b/json/interface.groovy index d238707..4cd2628 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -1,7 +1,7 @@ abstract class JsonSerialised { - def serialisationdata(); - def saveJsonSerialised(String outputfile, int prettylevel = 4); + abstract void serialisationdata(); + abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); } return this; From 210e17c2e88acc28edc3ec3c2fa63da4c8ce77d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:29:20 +0000 Subject: [PATCH 0347/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json/interface.groovy b/json/interface.groovy index d238707..4cd2628 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -1,7 +1,7 @@ abstract class JsonSerialised { - def serialisationdata(); - def saveJsonSerialised(String outputfile, int prettylevel = 4); + abstract void serialisationdata(); + abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); } return this; From 2c45a39755ddfebf978cff02989f19ca1582c5b7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:37:04 +0000 Subject: [PATCH 0348/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 8b8d3e2..536d336 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -26,9 +26,9 @@ class ProductInfo { return data } - def saveJsonSerialised(String outputfile, int prettylevel = 4) { - def outJson = readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) - writeJSON(file: outputfile, json: outJson, pretty: prettylevel) + def saveJsonSerialised(script, String outputfile, int prettylevel = 4) { + def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) + script.writeJSON(file: outputfile, json: outJson, pretty: prettylevel) } } @@ -38,7 +38,7 @@ def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, ji theProductInfo = new ProductInfo(productname, subcomponentname, jirakey) def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" - theProductInfo.saveJsonSerialised(PRODUCTFILE) + theProductInfo.saveJsonSerialised(this, PRODUCTFILE) } return this; \ No newline at end of file From 6ed97583368d97dd9badd659c8429a86b94de1e7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 15:37:04 +0000 Subject: [PATCH 0349/1971] Create a meta folder seperate from other artifacts --- product/info.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 8b8d3e2..536d336 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -26,9 +26,9 @@ class ProductInfo { return data } - def saveJsonSerialised(String outputfile, int prettylevel = 4) { - def outJson = readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) - writeJSON(file: outputfile, json: outJson, pretty: prettylevel) + def saveJsonSerialised(script, String outputfile, int prettylevel = 4) { + def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) + script.writeJSON(file: outputfile, json: outJson, pretty: prettylevel) } } @@ -38,7 +38,7 @@ def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, ji theProductInfo = new ProductInfo(productname, subcomponentname, jirakey) def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" - theProductInfo.saveJsonSerialised(PRODUCTFILE) + theProductInfo.saveJsonSerialised(this, PRODUCTFILE) } return this; \ No newline at end of file From 284b6aab835ff591c1ea778587d08a8a5794b792 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 16:03:24 +0000 Subject: [PATCH 0350/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 26 +++++++++++ versionnumbering/generate.groovy | 75 +------------------------------- 2 files changed, 28 insertions(+), 73 deletions(-) diff --git a/json/interface.groovy b/json/interface.groovy index 4cd2628..fae1fe3 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -4,4 +4,30 @@ abstract class JsonSerialised { abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); } +class GitInfo { + private String sourcepath + private String sourcerevision + private String gitrevision + private String remoteurl + private String remoteinfo +} + +class JenkinsBuildInfo { + private String buildjobname + private int buildnumber + private String buildmachine + private String builddate +} + +class BuildStampInfo { + private String buildstampprefix + private int revision + private String buildstamp + private String buildstampcommasep +} + +class ReleaseInfo { + private String releasejobname +} + return this; diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index ad6214d..3d498e9 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,34 +1,10 @@ +def ji = load("${autobuilder.commonscripts()}/json/interface.groovy") + metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" -class GitInfo { - private String sourcepath - private String sourcerevision - private String gitrevision - private String remoteurl - private String remoteinfo -} - -class JenkinsBuildInfo { - private String buildjobname - private int buildnumber - private String buildmachine - private String builddate -} - -class BuildStampInfo { - private String buildstampprefix - private int revision - private String buildstamp - private String buildstampcommasep -} - -class ReleaseInfo { - private String releasejobname -} - class VersionInfo { private ComponentInfo componentinfo private GitInfo gitinfo @@ -37,53 +13,6 @@ class VersionInfo { private ReleaseInfo releaseinfo private VersionInfo[] associatedversions -} - - def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { - - - version.generate("${SOURCE_REVISION}", "${SOURCE_PATH}", "${BASEBUILDNUMBER}", "${RELEASE_JOB_NAME}") - - VersionInfo() { - } - def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname): - with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: - f.write(buildjobname) - - with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: - f.write(versionprefix) - - with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: - f.write(str(gitrevisioncount)) - - with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: - f.write(gitrevision) - - with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: - f.write(remoteinfo) - - with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: - f.write(remoteurl) - - with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: - f.write(buildnumber) - - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: - f.write(buildstamp) - - buildstampcommasep = buildstamp.replace(".", ",") - with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: - f.write(buildstampcommasep) - - with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: - f.write(slaveMachine) - - with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: - f.write(str(datetime.datetime.now())) - - with open(os.path.join(versionfolder, "releasejobname.txt"), 'w') as f: - f.write(releasejobname) - } def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { From bf13a8f5a3b35f461e2fca45c5232055154f1aa5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 16:03:24 +0000 Subject: [PATCH 0351/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 26 +++++++++++ versionnumbering/generate.groovy | 75 +------------------------------- 2 files changed, 28 insertions(+), 73 deletions(-) diff --git a/json/interface.groovy b/json/interface.groovy index 4cd2628..fae1fe3 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -4,4 +4,30 @@ abstract class JsonSerialised { abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); } +class GitInfo { + private String sourcepath + private String sourcerevision + private String gitrevision + private String remoteurl + private String remoteinfo +} + +class JenkinsBuildInfo { + private String buildjobname + private int buildnumber + private String buildmachine + private String builddate +} + +class BuildStampInfo { + private String buildstampprefix + private int revision + private String buildstamp + private String buildstampcommasep +} + +class ReleaseInfo { + private String releasejobname +} + return this; diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index ad6214d..3d498e9 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,34 +1,10 @@ +def ji = load("${autobuilder.commonscripts()}/json/interface.groovy") + metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" -class GitInfo { - private String sourcepath - private String sourcerevision - private String gitrevision - private String remoteurl - private String remoteinfo -} - -class JenkinsBuildInfo { - private String buildjobname - private int buildnumber - private String buildmachine - private String builddate -} - -class BuildStampInfo { - private String buildstampprefix - private int revision - private String buildstamp - private String buildstampcommasep -} - -class ReleaseInfo { - private String releasejobname -} - class VersionInfo { private ComponentInfo componentinfo private GitInfo gitinfo @@ -37,53 +13,6 @@ class VersionInfo { private ReleaseInfo releaseinfo private VersionInfo[] associatedversions -} - - def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { - - - version.generate("${SOURCE_REVISION}", "${SOURCE_PATH}", "${BASEBUILDNUMBER}", "${RELEASE_JOB_NAME}") - - VersionInfo() { - } - def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname): - with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: - f.write(buildjobname) - - with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: - f.write(versionprefix) - - with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: - f.write(str(gitrevisioncount)) - - with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: - f.write(gitrevision) - - with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: - f.write(remoteinfo) - - with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: - f.write(remoteurl) - - with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: - f.write(buildnumber) - - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: - f.write(buildstamp) - - buildstampcommasep = buildstamp.replace(".", ",") - with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: - f.write(buildstampcommasep) - - with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: - f.write(slaveMachine) - - with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: - f.write(str(datetime.datetime.now())) - - with open(os.path.join(versionfolder, "releasejobname.txt"), 'w') as f: - f.write(releasejobname) - } def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { From 2d709eb4dc9631e3a93625915fd7de73c3643f28 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 16:17:20 +0000 Subject: [PATCH 0352/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/json/interface.groovy b/json/interface.groovy index fae1fe3..c9cd9f9 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -4,7 +4,7 @@ abstract class JsonSerialised { abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); } -class GitInfo { +public class GitInfo { private String sourcepath private String sourcerevision private String gitrevision @@ -12,21 +12,21 @@ class GitInfo { private String remoteinfo } -class JenkinsBuildInfo { +public class JenkinsBuildInfo { private String buildjobname private int buildnumber private String buildmachine private String builddate } -class BuildStampInfo { +public class BuildStampInfo { private String buildstampprefix private int revision private String buildstamp private String buildstampcommasep } -class ReleaseInfo { +public class ReleaseInfo { private String releasejobname } From efdf4ae8b854e64b0109205347cb03779a1c3ba1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 16:17:20 +0000 Subject: [PATCH 0353/1971] Create a meta folder seperate from other artifacts --- json/interface.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/json/interface.groovy b/json/interface.groovy index fae1fe3..c9cd9f9 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -4,7 +4,7 @@ abstract class JsonSerialised { abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); } -class GitInfo { +public class GitInfo { private String sourcepath private String sourcerevision private String gitrevision @@ -12,21 +12,21 @@ class GitInfo { private String remoteinfo } -class JenkinsBuildInfo { +public class JenkinsBuildInfo { private String buildjobname private int buildnumber private String buildmachine private String builddate } -class BuildStampInfo { +public class BuildStampInfo { private String buildstampprefix private int revision private String buildstamp private String buildstampcommasep } -class ReleaseInfo { +public class ReleaseInfo { private String releasejobname } From 46cd0d3d870c8807db798a5be3de62e2e1ee8966 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 17:30:30 +0000 Subject: [PATCH 0354/1971] Pass script object to custom objects --- autobuilder.groovy | 4 ++-- product/info.groovy | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index ae3af20..ffaaf9f 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -38,7 +38,7 @@ def start(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jira metafolder.metareset() def productinfo = load("${commonscripts()}/product/info.groovy") - productinfo.setname(productname, subcomponentname, jirakey) + productinfo.setname(script, productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() diff --git a/product/info.groovy b/product/info.groovy index 536d336..1e0af6d 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,12 +5,14 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" -class ProductInfo { +class ProductInfo implements Serializable { + private script private String productname private String subcomponentname private String jirakey - ProductInfo(productName = "", subcomponentName = "", jiraKey = "") { + ProductInfo(script, productName = "", subcomponentName = "", jiraKey = "") { + this.script = script super() productname = productName subcomponentname = subcomponentName @@ -26,7 +28,7 @@ class ProductInfo { return data } - def saveJsonSerialised(script, String outputfile, int prettylevel = 4) { + 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) } @@ -34,11 +36,11 @@ class ProductInfo { theProductInfo = new ProductInfo() -def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { - theProductInfo = new ProductInfo(productname, subcomponentname, jirakey) +def setname(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { + theProductInfo = new ProductInfo(script, productname, subcomponentname, jirakey) def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" - theProductInfo.saveJsonSerialised(this, PRODUCTFILE) + theProductInfo.saveJsonSerialised(PRODUCTFILE) } return this; \ No newline at end of file From 7d0b8095a30fde7023129efd378b96a78957e83a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 17:30:30 +0000 Subject: [PATCH 0355/1971] Pass script object to custom objects --- autobuilder.groovy | 4 ++-- product/info.groovy | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index ae3af20..ffaaf9f 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -38,7 +38,7 @@ def start(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jira metafolder.metareset() def productinfo = load("${commonscripts()}/product/info.groovy") - productinfo.setname(productname, subcomponentname, jirakey) + productinfo.setname(script, productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() diff --git a/product/info.groovy b/product/info.groovy index 536d336..1e0af6d 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,12 +5,14 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" -class ProductInfo { +class ProductInfo implements Serializable { + private script private String productname private String subcomponentname private String jirakey - ProductInfo(productName = "", subcomponentName = "", jiraKey = "") { + ProductInfo(script, productName = "", subcomponentName = "", jiraKey = "") { + this.script = script super() productname = productName subcomponentname = subcomponentName @@ -26,7 +28,7 @@ class ProductInfo { return data } - def saveJsonSerialised(script, String outputfile, int prettylevel = 4) { + 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) } @@ -34,11 +36,11 @@ class ProductInfo { theProductInfo = new ProductInfo() -def setname(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { - theProductInfo = new ProductInfo(productname, subcomponentname, jirakey) +def setname(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { + theProductInfo = new ProductInfo(script, productname, subcomponentname, jirakey) def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" - theProductInfo.saveJsonSerialised(this, PRODUCTFILE) + theProductInfo.saveJsonSerialised(PRODUCTFILE) } return this; \ No newline at end of file From 0ee5068c158c3d5f7dbc08c2e4a44921e432e297 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 17:32:24 +0000 Subject: [PATCH 0356/1971] Pass script object to custom objects --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 1e0af6d..19f5df0 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -12,8 +12,8 @@ class ProductInfo implements Serializable { private String jirakey ProductInfo(script, productName = "", subcomponentName = "", jiraKey = "") { - this.script = script super() + this.script = script productname = productName subcomponentname = subcomponentName jirakey = jiraKey From 518b60a5e8f83136d3168b84c2ec993c467fd1fe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 17:32:24 +0000 Subject: [PATCH 0357/1971] Pass script object to custom objects --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 1e0af6d..19f5df0 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -12,8 +12,8 @@ class ProductInfo implements Serializable { private String jirakey ProductInfo(script, productName = "", subcomponentName = "", jiraKey = "") { - this.script = script super() + this.script = script productname = productName subcomponentname = subcomponentName jirakey = jiraKey From 8b99f633acde702a6efaf28eccb456144fb01d60 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 17:34:40 +0000 Subject: [PATCH 0358/1971] Pass script object to custom objects --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 19f5df0..78e281a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -34,7 +34,7 @@ class ProductInfo implements Serializable { } } -theProductInfo = new ProductInfo() +theProductInfo = null def setname(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { theProductInfo = new ProductInfo(script, productname, subcomponentname, jirakey) From ce0643254bbbd99ef8bc4dbdca6eb34136a585c8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 17:34:40 +0000 Subject: [PATCH 0359/1971] Pass script object to custom objects --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 19f5df0..78e281a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -34,7 +34,7 @@ class ProductInfo implements Serializable { } } -theProductInfo = new ProductInfo() +theProductInfo = null def setname(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { theProductInfo = new ProductInfo(script, productname, subcomponentname, jirakey) From ea8e58d3d1b4d3e6a0667defe83ed295addc6795 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 17:52:07 +0000 Subject: [PATCH 0360/1971] Pass script object to custom objects --- versionnumbering/generate.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 3d498e9..3d35e23 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -5,8 +5,10 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" +def pi = load("${autobuilder.commonscripts()}/product/info.groovy") + class VersionInfo { - private ComponentInfo componentinfo + private ProductInfo productinfo private GitInfo gitinfo private JenkinsBuildInfo jenkinsbuildinfo private BuildStampInfo buildstampinfo From 05284a7607fbf8f3ce9b3b0c560047d576af942d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 17:52:07 +0000 Subject: [PATCH 0361/1971] Pass script object to custom objects --- versionnumbering/generate.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 3d498e9..3d35e23 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -5,8 +5,10 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" +def pi = load("${autobuilder.commonscripts()}/product/info.groovy") + class VersionInfo { - private ComponentInfo componentinfo + private ProductInfo productinfo private GitInfo gitinfo private JenkinsBuildInfo jenkinsbuildinfo private BuildStampInfo buildstampinfo From 94ddf17df7b3d488232ab983c66c98a963ef3568 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 18:25:17 +0000 Subject: [PATCH 0362/1971] Pass script object to custom objects --- json/interface.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/interface.groovy b/json/interface.groovy index c9cd9f9..58f9eb7 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -1,5 +1,5 @@ -abstract class JsonSerialised { +abstract class GISJsonSerialised { abstract void serialisationdata(); abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); } From a1a36f47b7d91313a0d30a61aee7f98af34a1be8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Nov 2018 18:25:17 +0000 Subject: [PATCH 0363/1971] Pass script object to custom objects --- json/interface.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/interface.groovy b/json/interface.groovy index c9cd9f9..58f9eb7 100644 --- a/json/interface.groovy +++ b/json/interface.groovy @@ -1,5 +1,5 @@ -abstract class JsonSerialised { +abstract class GISJsonSerialised { abstract void serialisationdata(); abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); } From bbc3da7e374a9fbf188c3ab7826563214ea94698 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:18:27 +0000 Subject: [PATCH 0364/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- autobuilder.groovy | 6 +- json/interface.groovy | 33 ------ meta/folder.groovy | 180 ++++++++++++++++++++++++++++++- product/info.groovy | 46 -------- versionnumbering/generate.groovy | 13 --- 5 files changed, 181 insertions(+), 97 deletions(-) delete mode 100644 json/interface.groovy delete mode 100644 product/info.groovy diff --git a/autobuilder.groovy b/autobuilder.groovy index ffaaf9f..dfc470b 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -35,10 +35,8 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA conditionalclean() def metafolder = load("${commonscripts()}/meta/folder.groovy") - metafolder.metareset() - - def productinfo = load("${commonscripts()}/product/info.groovy") - productinfo.setname(script, productname, subcomponentname, jirakey) + metafolder.metareset(script) + metafolder.setproductinfo(productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() diff --git a/json/interface.groovy b/json/interface.groovy deleted file mode 100644 index 58f9eb7..0000000 --- a/json/interface.groovy +++ /dev/null @@ -1,33 +0,0 @@ - -abstract class GISJsonSerialised { - abstract void serialisationdata(); - abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); -} - -public class GitInfo { - private String sourcepath - private String sourcerevision - private String gitrevision - private String remoteurl - private String remoteinfo -} - -public class JenkinsBuildInfo { - private String buildjobname - private int buildnumber - private String buildmachine - private String builddate -} - -public class BuildStampInfo { - private String buildstampprefix - private int revision - private String buildstamp - private String buildstampcommasep -} - -public class ReleaseInfo { - private String releasejobname -} - -return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 6b0b21c..a8bc619 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -2,11 +2,189 @@ METAFOLDERNAME = "meta" env.METAARTIFACTS = "${METAFOLDERNAME}/**" -def metareset() { +class GISJsonSerialised implements Serializable { + protected script + + GISJsonSerialied(script) { + this.script = script + } + + abstract void serialisationdata(); + + 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 { + private String productname + private String subcomponentname + private String jirakey + + def set(script, productname, subcomponentname, jirakey) { + this.productname = productname + this.subcomponentname = subcomponentname + this.jirakey = jiraKey + } + + ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { + super(script) + set(productname, subcomponentname, jirakey) + } + + def serialisationdata() { + def data = [ + 'productname' : productname, + 'subcomponentname' : subcomponentname, + 'jirakey' : jirakey, + ] + 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 + } + + def serialisationdata() { + def data = [ + 'sourcepath' : sourcepath, + 'sourcerevision' : sourcerevision, + 'gitrevision' : gitrevision, + 'remoteurl' : remoteurl, + 'remoteinfo' : remoteinfo, + ] + return data + } +} + +class JenkinsBuildInfo extends GISJsonSerialised { + private String buildjobname + private int buildnumber + private String buildmachine + private String builddate + + JenkinsBuildInfo(script, buildjobname = "", buildnumber = 0, buildmachine = "", builddate = "") { + super(script) + this.buildjobname = buildjobname + this.buildnumber = buildnumber + this.buildmachine = buildmachine + this.builddate = builddate + } + + def serialisationdata() { + def data = [ + 'buildjobname' : buildjobname, + 'buildnumber' : buildnumber, + 'buildmachine' : buildmachine, + 'builddate' : builddate, + ] + return data + } +} + +class BuildStampInfo extends GISJsonSerialised { + private String buildstampprefix + private int revision + private String buildstamp + private String buildstampcommasep + + BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "", buildstampcommasep = "") { + super(script) + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + this.buildstampcommasep = buildstampcommasep + } + + def serialisationdata() { + def data = [ + 'buildstampprefix' : buildstampprefix, + 'revision' : revision, + 'buildstamp' : buildstamp, + 'buildstampcommasep' : buildstampcommasep, + ] + return data + } +} + +class ReleaseInfo extends GISJsonSerialised { + private String releasejobname + + BuildStampInfo(script, releasejobname = "") { + super(script) + this.releasejobname = releasejobname + } + + def serialisationdata() { + def data = [ + 'releasejobname' : releasejobname, + ] + return data + } +} + +class MetaInfo extends GISJsonSerialised { + private ProductInfo productinfo + private GitInfo gitinfo + private JenkinsBuildInfo jenkinsbuildinfo + private BuildStampInfo buildstampinfo + private ReleaseInfo releaseinfo + + private MetaInfo[] associatedmeta + + MetaInfo(script) { + super(script) + productinfo(script) + gitinfo(script) + jenkinsbuildinfo(script) + buildstampinfo(script) + releaseinfo(script) + } + + def serialisationdata() { + def data = [ + 'productinfo' : productinfo.serialisationdata(), + 'gitinfo' : gitinfo.serialisationdata(), + 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), + 'buildstampinfo' : buildstampinfo.serialisationdata(), + 'releaseinfo' : releaseinfo.serialisationdata(), + ] + return datasetProductInfo + } + + def setproductinfo(productname, subcomponentname, jirakey) { + productinfo.set(productname, subcomponentname, jirakey) + } + + +MetaInfo theMetaData = new MetaInfo(this) + +def metareset(script) { echo "Resetting meta folder" dir("${WORKSPACE}/${METAFOLDERNAME}") { deleteDir() } + theMetaData = new MetaInfo(this) } +def setproductinfo(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { + theMetaData.setproductinfo(productname, subcomponentname, jirakey) +} + + + return this; \ No newline at end of file diff --git a/product/info.groovy b/product/info.groovy deleted file mode 100644 index 78e281a..0000000 --- a/product/info.groovy +++ /dev/null @@ -1,46 +0,0 @@ - -def ji = load("${autobuilder.commonscripts()}/json/interface.groovy") - -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" -env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" - -class ProductInfo implements Serializable { - private script - private String productname - private String subcomponentname - private String jirakey - - ProductInfo(script, productName = "", subcomponentName = "", jiraKey = "") { - super() - this.script = script - productname = productName - subcomponentname = subcomponentName - jirakey = jiraKey - } - - def serialisationdata() { - def data = [ - 'productname' : productname, - 'subcomponentname' : subcomponentname, - 'jirakey' : jirakey, - ] - return data - } - - 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) - } -} - -theProductInfo = null - -def setname(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { - theProductInfo = new ProductInfo(script, productname, subcomponentname, jirakey) - - def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" - theProductInfo.saveJsonSerialised(PRODUCTFILE) -} - -return this; \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 3d35e23..48f8bb6 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,22 +1,9 @@ -def ji = load("${autobuilder.commonscripts()}/json/interface.groovy") - metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" def pi = load("${autobuilder.commonscripts()}/product/info.groovy") -class VersionInfo { - private ProductInfo productinfo - private GitInfo gitinfo - private JenkinsBuildInfo jenkinsbuildinfo - private BuildStampInfo buildstampinfo - private ReleaseInfo releaseinfo - - private VersionInfo[] associatedversions -} - def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { def cs = autobuilder.commonscripts() if (isUnix()) { From f4753020d9c0e901b0343ac4d7ff195ffc4a40c2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:18:27 +0000 Subject: [PATCH 0365/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- autobuilder.groovy | 6 +- json/interface.groovy | 33 ------ meta/folder.groovy | 180 ++++++++++++++++++++++++++++++- product/info.groovy | 46 -------- versionnumbering/generate.groovy | 13 --- 5 files changed, 181 insertions(+), 97 deletions(-) delete mode 100644 json/interface.groovy delete mode 100644 product/info.groovy diff --git a/autobuilder.groovy b/autobuilder.groovy index ffaaf9f..dfc470b 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -35,10 +35,8 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA conditionalclean() def metafolder = load("${commonscripts()}/meta/folder.groovy") - metafolder.metareset() - - def productinfo = load("${commonscripts()}/product/info.groovy") - productinfo.setname(script, productname, subcomponentname, jirakey) + metafolder.metareset(script) + metafolder.setproductinfo(productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() diff --git a/json/interface.groovy b/json/interface.groovy deleted file mode 100644 index 58f9eb7..0000000 --- a/json/interface.groovy +++ /dev/null @@ -1,33 +0,0 @@ - -abstract class GISJsonSerialised { - abstract void serialisationdata(); - abstract void saveJsonSerialised(String outputfile, int prettylevel = 4); -} - -public class GitInfo { - private String sourcepath - private String sourcerevision - private String gitrevision - private String remoteurl - private String remoteinfo -} - -public class JenkinsBuildInfo { - private String buildjobname - private int buildnumber - private String buildmachine - private String builddate -} - -public class BuildStampInfo { - private String buildstampprefix - private int revision - private String buildstamp - private String buildstampcommasep -} - -public class ReleaseInfo { - private String releasejobname -} - -return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 6b0b21c..a8bc619 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -2,11 +2,189 @@ METAFOLDERNAME = "meta" env.METAARTIFACTS = "${METAFOLDERNAME}/**" -def metareset() { +class GISJsonSerialised implements Serializable { + protected script + + GISJsonSerialied(script) { + this.script = script + } + + abstract void serialisationdata(); + + 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 { + private String productname + private String subcomponentname + private String jirakey + + def set(script, productname, subcomponentname, jirakey) { + this.productname = productname + this.subcomponentname = subcomponentname + this.jirakey = jiraKey + } + + ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { + super(script) + set(productname, subcomponentname, jirakey) + } + + def serialisationdata() { + def data = [ + 'productname' : productname, + 'subcomponentname' : subcomponentname, + 'jirakey' : jirakey, + ] + 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 + } + + def serialisationdata() { + def data = [ + 'sourcepath' : sourcepath, + 'sourcerevision' : sourcerevision, + 'gitrevision' : gitrevision, + 'remoteurl' : remoteurl, + 'remoteinfo' : remoteinfo, + ] + return data + } +} + +class JenkinsBuildInfo extends GISJsonSerialised { + private String buildjobname + private int buildnumber + private String buildmachine + private String builddate + + JenkinsBuildInfo(script, buildjobname = "", buildnumber = 0, buildmachine = "", builddate = "") { + super(script) + this.buildjobname = buildjobname + this.buildnumber = buildnumber + this.buildmachine = buildmachine + this.builddate = builddate + } + + def serialisationdata() { + def data = [ + 'buildjobname' : buildjobname, + 'buildnumber' : buildnumber, + 'buildmachine' : buildmachine, + 'builddate' : builddate, + ] + return data + } +} + +class BuildStampInfo extends GISJsonSerialised { + private String buildstampprefix + private int revision + private String buildstamp + private String buildstampcommasep + + BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "", buildstampcommasep = "") { + super(script) + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + this.buildstampcommasep = buildstampcommasep + } + + def serialisationdata() { + def data = [ + 'buildstampprefix' : buildstampprefix, + 'revision' : revision, + 'buildstamp' : buildstamp, + 'buildstampcommasep' : buildstampcommasep, + ] + return data + } +} + +class ReleaseInfo extends GISJsonSerialised { + private String releasejobname + + BuildStampInfo(script, releasejobname = "") { + super(script) + this.releasejobname = releasejobname + } + + def serialisationdata() { + def data = [ + 'releasejobname' : releasejobname, + ] + return data + } +} + +class MetaInfo extends GISJsonSerialised { + private ProductInfo productinfo + private GitInfo gitinfo + private JenkinsBuildInfo jenkinsbuildinfo + private BuildStampInfo buildstampinfo + private ReleaseInfo releaseinfo + + private MetaInfo[] associatedmeta + + MetaInfo(script) { + super(script) + productinfo(script) + gitinfo(script) + jenkinsbuildinfo(script) + buildstampinfo(script) + releaseinfo(script) + } + + def serialisationdata() { + def data = [ + 'productinfo' : productinfo.serialisationdata(), + 'gitinfo' : gitinfo.serialisationdata(), + 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), + 'buildstampinfo' : buildstampinfo.serialisationdata(), + 'releaseinfo' : releaseinfo.serialisationdata(), + ] + return datasetProductInfo + } + + def setproductinfo(productname, subcomponentname, jirakey) { + productinfo.set(productname, subcomponentname, jirakey) + } + + +MetaInfo theMetaData = new MetaInfo(this) + +def metareset(script) { echo "Resetting meta folder" dir("${WORKSPACE}/${METAFOLDERNAME}") { deleteDir() } + theMetaData = new MetaInfo(this) } +def setproductinfo(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { + theMetaData.setproductinfo(productname, subcomponentname, jirakey) +} + + + return this; \ No newline at end of file diff --git a/product/info.groovy b/product/info.groovy deleted file mode 100644 index 78e281a..0000000 --- a/product/info.groovy +++ /dev/null @@ -1,46 +0,0 @@ - -def ji = load("${autobuilder.commonscripts()}/json/interface.groovy") - -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -PRODUCTFOLDER = "${metafolder.METAFOLDERNAME}/product" -env.PRODUCTARTIFACTS = "${PRODUCTFOLDER}/**" - -class ProductInfo implements Serializable { - private script - private String productname - private String subcomponentname - private String jirakey - - ProductInfo(script, productName = "", subcomponentName = "", jiraKey = "") { - super() - this.script = script - productname = productName - subcomponentname = subcomponentName - jirakey = jiraKey - } - - def serialisationdata() { - def data = [ - 'productname' : productname, - 'subcomponentname' : subcomponentname, - 'jirakey' : jirakey, - ] - return data - } - - 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) - } -} - -theProductInfo = null - -def setname(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { - theProductInfo = new ProductInfo(script, productname, subcomponentname, jirakey) - - def PRODUCTFILE = "${PRODUCTFOLDER}/info.json" - theProductInfo.saveJsonSerialised(PRODUCTFILE) -} - -return this; \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 3d35e23..48f8bb6 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,22 +1,9 @@ -def ji = load("${autobuilder.commonscripts()}/json/interface.groovy") - metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**" VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" def pi = load("${autobuilder.commonscripts()}/product/info.groovy") -class VersionInfo { - private ProductInfo productinfo - private GitInfo gitinfo - private JenkinsBuildInfo jenkinsbuildinfo - private BuildStampInfo buildstampinfo - private ReleaseInfo releaseinfo - - private VersionInfo[] associatedversions -} - def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { def cs = autobuilder.commonscripts() if (isUnix()) { From bda26208b76316b402735615e9b2446ee8690226 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:37:27 +0000 Subject: [PATCH 0366/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- versionnumbering/generate.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 48f8bb6..b576201 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -2,8 +2,6 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" -def pi = load("${autobuilder.commonscripts()}/product/info.groovy") - def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { def cs = autobuilder.commonscripts() if (isUnix()) { From df5d11caa3f562bc5062d58aa50cf78b72a7784e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:37:27 +0000 Subject: [PATCH 0367/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- versionnumbering/generate.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 48f8bb6..b576201 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -2,8 +2,6 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" -def pi = load("${autobuilder.commonscripts()}/product/info.groovy") - def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { def cs = autobuilder.commonscripts() if (isUnix()) { From 4b0fa46e8099d9d780e7a6faffae35c74d476ef1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:45:39 +0000 Subject: [PATCH 0368/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a8bc619..0e800a4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -3,7 +3,7 @@ METAFOLDERNAME = "meta" env.METAARTIFACTS = "${METAFOLDERNAME}/**" class GISJsonSerialised implements Serializable { - protected script + def script GISJsonSerialied(script) { this.script = script From 6323d8f5ebd5d1775da703bd93aadb78a42e31ff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:45:39 +0000 Subject: [PATCH 0369/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a8bc619..0e800a4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -3,7 +3,7 @@ METAFOLDERNAME = "meta" env.METAARTIFACTS = "${METAFOLDERNAME}/**" class GISJsonSerialised implements Serializable { - protected script + def script GISJsonSerialied(script) { this.script = script From c0b24175c608579694d653c92d462856191b533c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:47:17 +0000 Subject: [PATCH 0370/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0e800a4..ca4680f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -5,7 +5,7 @@ env.METAARTIFACTS = "${METAFOLDERNAME}/**" class GISJsonSerialised implements Serializable { def script - GISJsonSerialied(script) { + GISJsonSerialised(script) { this.script = script } From 397727d4f1bec0be03c5d7feaac10cea5f5a116a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:47:17 +0000 Subject: [PATCH 0371/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0e800a4..ca4680f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -5,7 +5,7 @@ env.METAARTIFACTS = "${METAFOLDERNAME}/**" class GISJsonSerialised implements Serializable { def script - GISJsonSerialied(script) { + GISJsonSerialised(script) { this.script = script } From 923c0c69db923ef83dbfb1a28fe6a061312cdc57 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:49:13 +0000 Subject: [PATCH 0372/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ca4680f..65d4708 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -124,7 +124,7 @@ class BuildStampInfo extends GISJsonSerialised { class ReleaseInfo extends GISJsonSerialised { private String releasejobname - BuildStampInfo(script, releasejobname = "") { + ReleaseInfo(script, releasejobname = "") { super(script) this.releasejobname = releasejobname } From 746838240f0296d955740836debf602c820478a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:49:13 +0000 Subject: [PATCH 0373/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ca4680f..65d4708 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -124,7 +124,7 @@ class BuildStampInfo extends GISJsonSerialised { class ReleaseInfo extends GISJsonSerialised { private String releasejobname - BuildStampInfo(script, releasejobname = "") { + ReleaseInfo(script, releasejobname = "") { super(script) this.releasejobname = releasejobname } From fc8c1c130ab8e261c226f96fa3ede556a3520069 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:51:29 +0000 Subject: [PATCH 0374/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 65d4708..46ae4f3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -169,7 +169,7 @@ class MetaInfo extends GISJsonSerialised { def setproductinfo(productname, subcomponentname, jirakey) { productinfo.set(productname, subcomponentname, jirakey) } - +} MetaInfo theMetaData = new MetaInfo(this) @@ -185,6 +185,4 @@ def setproductinfo(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_N theMetaData.setproductinfo(productname, subcomponentname, jirakey) } - - return this; \ No newline at end of file From bba626b4175213c090a813b9560b12bce63630b6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 17:51:29 +0000 Subject: [PATCH 0375/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 65d4708..46ae4f3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -169,7 +169,7 @@ class MetaInfo extends GISJsonSerialised { def setproductinfo(productname, subcomponentname, jirakey) { productinfo.set(productname, subcomponentname, jirakey) } - +} MetaInfo theMetaData = new MetaInfo(this) @@ -185,6 +185,4 @@ def setproductinfo(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_N theMetaData.setproductinfo(productname, subcomponentname, jirakey) } - - return this; \ No newline at end of file From f792738a9aab80f3a2f8d8504d6646742c56f59d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 18:03:51 +0000 Subject: [PATCH 0376/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 46ae4f3..f13cdaa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -2,14 +2,14 @@ METAFOLDERNAME = "meta" env.METAARTIFACTS = "${METAFOLDERNAME}/**" -class GISJsonSerialised implements Serializable { +abstract class GISJsonSerialised implements Serializable { def script GISJsonSerialised(script) { this.script = script } - abstract void serialisationdata(); + abstract Map serialisationdata(); def saveJsonSerialised(String outputfile, int prettylevel = 4) { def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) @@ -33,7 +33,7 @@ class ProductInfo extends GISJsonSerialised { set(productname, subcomponentname, jirakey) } - def serialisationdata() { + Map serialisationdata() { def data = [ 'productname' : productname, 'subcomponentname' : subcomponentname, @@ -59,7 +59,7 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } - def serialisationdata() { + Map serialisationdata() { def data = [ 'sourcepath' : sourcepath, 'sourcerevision' : sourcerevision, @@ -85,7 +85,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } - def serialisationdata() { + Map serialisationdata() { def data = [ 'buildjobname' : buildjobname, 'buildnumber' : buildnumber, @@ -110,7 +110,7 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } - def serialisationdata() { + Map serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, 'revision' : revision, @@ -129,7 +129,7 @@ class ReleaseInfo extends GISJsonSerialised { this.releasejobname = releasejobname } - def serialisationdata() { + Map serialisationdata() { def data = [ 'releasejobname' : releasejobname, ] @@ -153,15 +153,25 @@ class MetaInfo extends GISJsonSerialised { jenkinsbuildinfo(script) buildstampinfo(script) releaseinfo(script) + associatedmeta = [] } - def serialisationdata() { + List associatedmetaserialised() { + def associated = [] + for (metaitem in associatedmeta) { + associated.add(serialisationdata(metaitem)) + } + return associated + } + + Map serialisationdata() { def data = [ 'productinfo' : productinfo.serialisationdata(), 'gitinfo' : gitinfo.serialisationdata(), 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), 'buildstampinfo' : buildstampinfo.serialisationdata(), 'releaseinfo' : releaseinfo.serialisationdata(), + 'associatedmeta' : associatedmetaserialised(), ] return datasetProductInfo } From 326a38f0879ebbae0cd1e7743cabd659c8e5e09a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 18:03:51 +0000 Subject: [PATCH 0377/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 46ae4f3..f13cdaa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -2,14 +2,14 @@ METAFOLDERNAME = "meta" env.METAARTIFACTS = "${METAFOLDERNAME}/**" -class GISJsonSerialised implements Serializable { +abstract class GISJsonSerialised implements Serializable { def script GISJsonSerialised(script) { this.script = script } - abstract void serialisationdata(); + abstract Map serialisationdata(); def saveJsonSerialised(String outputfile, int prettylevel = 4) { def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) @@ -33,7 +33,7 @@ class ProductInfo extends GISJsonSerialised { set(productname, subcomponentname, jirakey) } - def serialisationdata() { + Map serialisationdata() { def data = [ 'productname' : productname, 'subcomponentname' : subcomponentname, @@ -59,7 +59,7 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } - def serialisationdata() { + Map serialisationdata() { def data = [ 'sourcepath' : sourcepath, 'sourcerevision' : sourcerevision, @@ -85,7 +85,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } - def serialisationdata() { + Map serialisationdata() { def data = [ 'buildjobname' : buildjobname, 'buildnumber' : buildnumber, @@ -110,7 +110,7 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } - def serialisationdata() { + Map serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, 'revision' : revision, @@ -129,7 +129,7 @@ class ReleaseInfo extends GISJsonSerialised { this.releasejobname = releasejobname } - def serialisationdata() { + Map serialisationdata() { def data = [ 'releasejobname' : releasejobname, ] @@ -153,15 +153,25 @@ class MetaInfo extends GISJsonSerialised { jenkinsbuildinfo(script) buildstampinfo(script) releaseinfo(script) + associatedmeta = [] } - def serialisationdata() { + List associatedmetaserialised() { + def associated = [] + for (metaitem in associatedmeta) { + associated.add(serialisationdata(metaitem)) + } + return associated + } + + Map serialisationdata() { def data = [ 'productinfo' : productinfo.serialisationdata(), 'gitinfo' : gitinfo.serialisationdata(), 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), 'buildstampinfo' : buildstampinfo.serialisationdata(), 'releaseinfo' : releaseinfo.serialisationdata(), + 'associatedmeta' : associatedmetaserialised(), ] return datasetProductInfo } From c7bb9095ca36afbe68a120d6c71f17422f5235ba Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 18:38:55 +0000 Subject: [PATCH 0378/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f13cdaa..afcd6f7 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -148,11 +148,11 @@ class MetaInfo extends GISJsonSerialised { MetaInfo(script) { super(script) - productinfo(script) - gitinfo(script) - jenkinsbuildinfo(script) - buildstampinfo(script) - releaseinfo(script) + productinfo = new ProductInfo(script) + gitinfo = new GitInfo(script) + jenkinsbuildinfoo = new JenkinsBuildInfo(script) + buildstampinfoo = new BuildStampInfo(script) + releaseinfoo = new ReleaseInfo(script) associatedmeta = [] } From c48b95b3f692ceb39d81c2409ba39eedf19dff64 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 18:38:55 +0000 Subject: [PATCH 0379/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f13cdaa..afcd6f7 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -148,11 +148,11 @@ class MetaInfo extends GISJsonSerialised { MetaInfo(script) { super(script) - productinfo(script) - gitinfo(script) - jenkinsbuildinfo(script) - buildstampinfo(script) - releaseinfo(script) + productinfo = new ProductInfo(script) + gitinfo = new GitInfo(script) + jenkinsbuildinfoo = new JenkinsBuildInfo(script) + buildstampinfoo = new BuildStampInfo(script) + releaseinfoo = new ReleaseInfo(script) associatedmeta = [] } From e59f3b38bc25bbbe424d298bbcb2410b7e1eb5af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 18:41:46 +0000 Subject: [PATCH 0380/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index afcd6f7..ad3636d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -22,7 +22,7 @@ class ProductInfo extends GISJsonSerialised { private String subcomponentname private String jirakey - def set(script, productname, subcomponentname, jirakey) { + def set(productname, subcomponentname, jirakey) { this.productname = productname this.subcomponentname = subcomponentname this.jirakey = jiraKey From b4dd72684c56a7f4d27d652f85e922c28a9b63ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 18:41:46 +0000 Subject: [PATCH 0381/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index afcd6f7..ad3636d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -22,7 +22,7 @@ class ProductInfo extends GISJsonSerialised { private String subcomponentname private String jirakey - def set(script, productname, subcomponentname, jirakey) { + def set(productname, subcomponentname, jirakey) { this.productname = productname this.subcomponentname = subcomponentname this.jirakey = jiraKey From 9f5a473fcf768acec6f62a8d98997a2102da0638 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 19:38:29 +0000 Subject: [PATCH 0382/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- autobuilder.groovy | 2 +- meta/folder.groovy | 62 ++++++++++++++++++++++++---------------------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index dfc470b..fab812a 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -36,7 +36,7 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA def metafolder = load("${commonscripts()}/meta/folder.groovy") metafolder.metareset(script) - metafolder.setproductinfo(productname, subcomponentname, jirakey) + metafolder.theMetaData.productinfo.set(productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() diff --git a/meta/folder.groovy b/meta/folder.groovy index ad3636d..d4caa5d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -9,7 +9,7 @@ abstract class GISJsonSerialised implements Serializable { this.script = script } - abstract Map serialisationdata(); + abstract LinkedHashMap serialisationdata(); def saveJsonSerialised(String outputfile, int prettylevel = 4) { def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) @@ -22,18 +22,20 @@ class ProductInfo extends GISJsonSerialised { private String subcomponentname private String jirakey + ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { + super(script) + this.productname = productname + this.subcomponentname = subcomponentname + this.jirakey = jirakey + } + def set(productname, subcomponentname, jirakey) { this.productname = productname this.subcomponentname = subcomponentname - this.jirakey = jiraKey + this.jirakey = jirakey } - ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { - super(script) - set(productname, subcomponentname, jirakey) - } - - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'productname' : productname, 'subcomponentname' : subcomponentname, @@ -59,7 +61,7 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'sourcepath' : sourcepath, 'sourcerevision' : sourcerevision, @@ -85,7 +87,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'buildjobname' : buildjobname, 'buildnumber' : buildnumber, @@ -110,7 +112,7 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, 'revision' : revision, @@ -129,7 +131,7 @@ class ReleaseInfo extends GISJsonSerialised { this.releasejobname = releasejobname } - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'releasejobname' : releasejobname, ] @@ -138,34 +140,40 @@ class ReleaseInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { - private ProductInfo productinfo - private GitInfo gitinfo - private JenkinsBuildInfo jenkinsbuildinfo - private BuildStampInfo buildstampinfo - private ReleaseInfo releaseinfo + private String format = '0.1' + ProductInfo productinfo + GitInfo gitinfo + JenkinsBuildInfo jenkinsbuildinfo + BuildStampInfo buildstampinfo + ReleaseInfo releaseinfo - private MetaInfo[] associatedmeta + private ArrayList associatedmeta MetaInfo(script) { super(script) productinfo = new ProductInfo(script) gitinfo = new GitInfo(script) - jenkinsbuildinfoo = new JenkinsBuildInfo(script) - buildstampinfoo = new BuildStampInfo(script) - releaseinfoo = new ReleaseInfo(script) - associatedmeta = [] + jenkinsbuildinfo = new JenkinsBuildInfo(script) + buildstampinfo = new BuildStampInfo(script) + releaseinfo = new ReleaseInfo(script) + associatedmeta = new ArrayList() } List associatedmetaserialised() { def associated = [] for (metaitem in associatedmeta) { - associated.add(serialisationdata(metaitem)) + associated.add(metaitem.serialisationdata()) } return associated } - Map serialisationdata() { + void addAssociatedMetaInfo(mi) { + associatedmeta.add(mi) + } + + LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'productinfo' : productinfo.serialisationdata(), 'gitinfo' : gitinfo.serialisationdata(), 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), @@ -173,7 +181,7 @@ class MetaInfo extends GISJsonSerialised { 'releaseinfo' : releaseinfo.serialisationdata(), 'associatedmeta' : associatedmetaserialised(), ] - return datasetProductInfo + return data } def setproductinfo(productname, subcomponentname, jirakey) { @@ -191,8 +199,4 @@ def metareset(script) { theMetaData = new MetaInfo(this) } -def setproductinfo(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { - theMetaData.setproductinfo(productname, subcomponentname, jirakey) -} - return this; \ No newline at end of file From 98311b6e4f2640da54ff0c021867261564e05a94 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 19:38:29 +0000 Subject: [PATCH 0383/1971] Move meta data to one groovy file because of the difficulty of including/importing groovy classes --- autobuilder.groovy | 2 +- meta/folder.groovy | 62 ++++++++++++++++++++++++---------------------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index dfc470b..fab812a 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -36,7 +36,7 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA def metafolder = load("${commonscripts()}/meta/folder.groovy") metafolder.metareset(script) - metafolder.setproductinfo(productname, subcomponentname, jirakey) + metafolder.theMetaData.productinfo.set(productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration() diff --git a/meta/folder.groovy b/meta/folder.groovy index ad3636d..d4caa5d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -9,7 +9,7 @@ abstract class GISJsonSerialised implements Serializable { this.script = script } - abstract Map serialisationdata(); + abstract LinkedHashMap serialisationdata(); def saveJsonSerialised(String outputfile, int prettylevel = 4) { def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) @@ -22,18 +22,20 @@ class ProductInfo extends GISJsonSerialised { private String subcomponentname private String jirakey + ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { + super(script) + this.productname = productname + this.subcomponentname = subcomponentname + this.jirakey = jirakey + } + def set(productname, subcomponentname, jirakey) { this.productname = productname this.subcomponentname = subcomponentname - this.jirakey = jiraKey + this.jirakey = jirakey } - ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { - super(script) - set(productname, subcomponentname, jirakey) - } - - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'productname' : productname, 'subcomponentname' : subcomponentname, @@ -59,7 +61,7 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'sourcepath' : sourcepath, 'sourcerevision' : sourcerevision, @@ -85,7 +87,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'buildjobname' : buildjobname, 'buildnumber' : buildnumber, @@ -110,7 +112,7 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, 'revision' : revision, @@ -129,7 +131,7 @@ class ReleaseInfo extends GISJsonSerialised { this.releasejobname = releasejobname } - Map serialisationdata() { + LinkedHashMap serialisationdata() { def data = [ 'releasejobname' : releasejobname, ] @@ -138,34 +140,40 @@ class ReleaseInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { - private ProductInfo productinfo - private GitInfo gitinfo - private JenkinsBuildInfo jenkinsbuildinfo - private BuildStampInfo buildstampinfo - private ReleaseInfo releaseinfo + private String format = '0.1' + ProductInfo productinfo + GitInfo gitinfo + JenkinsBuildInfo jenkinsbuildinfo + BuildStampInfo buildstampinfo + ReleaseInfo releaseinfo - private MetaInfo[] associatedmeta + private ArrayList associatedmeta MetaInfo(script) { super(script) productinfo = new ProductInfo(script) gitinfo = new GitInfo(script) - jenkinsbuildinfoo = new JenkinsBuildInfo(script) - buildstampinfoo = new BuildStampInfo(script) - releaseinfoo = new ReleaseInfo(script) - associatedmeta = [] + jenkinsbuildinfo = new JenkinsBuildInfo(script) + buildstampinfo = new BuildStampInfo(script) + releaseinfo = new ReleaseInfo(script) + associatedmeta = new ArrayList() } List associatedmetaserialised() { def associated = [] for (metaitem in associatedmeta) { - associated.add(serialisationdata(metaitem)) + associated.add(metaitem.serialisationdata()) } return associated } - Map serialisationdata() { + void addAssociatedMetaInfo(mi) { + associatedmeta.add(mi) + } + + LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'productinfo' : productinfo.serialisationdata(), 'gitinfo' : gitinfo.serialisationdata(), 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), @@ -173,7 +181,7 @@ class MetaInfo extends GISJsonSerialised { 'releaseinfo' : releaseinfo.serialisationdata(), 'associatedmeta' : associatedmetaserialised(), ] - return datasetProductInfo + return data } def setproductinfo(productname, subcomponentname, jirakey) { @@ -191,8 +199,4 @@ def metareset(script) { theMetaData = new MetaInfo(this) } -def setproductinfo(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) { - theMetaData.setproductinfo(productname, subcomponentname, jirakey) -} - return this; \ No newline at end of file From e3942ba1fee975bdbe6989192d258ddf2fa17664 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 20:25:33 +0000 Subject: [PATCH 0384/1971] Start using meta info for storing configuration --- autobuilder.groovy | 13 ++++---- configuration/configuration.groovy | 33 ++++---------------- meta/folder.groovy | 48 ++++++++++++++++++++++++++---- versionnumbering/generate.groovy | 3 -- 4 files changed, 57 insertions(+), 40 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index fab812a..a82e891 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -4,6 +4,8 @@ autobuildroot = "${WORKSPACE}/autobuild" commonscriptsroot = "${autobuildroot}/Common_scripts" +metafolder = load("${commonscripts()}/meta/folder.groovy") + def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { echo "Cleaning workspace" @@ -26,7 +28,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +MetaInfo start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -34,12 +36,13 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA conditionalclean() - def metafolder = load("${commonscripts()}/meta/folder.groovy") - metafolder.metareset(script) - metafolder.theMetaData.productinfo.set(productname, subcomponentname, jirakey) + def meta = metafolder.metareset(script) + meta.productinfo.set(productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") - ch.registerPipelineScriptConfiguration() + ch.registerPipelineScriptConfiguration(meta) + + return meta } def configurationhelper() { diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 1f0c095..30b7086 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,37 +1,16 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -configurationCollection = [:] - -def registerConfigurationInfo(String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { - def ConfigurationInfo = [configurationURL, configurationVersion, configurationSHA] - configurationCollection.put(configurationName, ConfigurationInfo) +def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { + meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) } -def registerPipelineScriptConfiguration() { - registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) +def registerPipelineScriptConfiguration(meta) { + registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) } -def saveConfigurationInVersionInfo() { - dir("${WORKSPACE}/version") { - echo "Writing configuration info to ${WORKSPACE}/version/configuration.txt" - writeFile file: 'configuration.txt', text: getFormattedConfiguration() - } -} - -String getFormattedConfiguration() { - String formattedInfo = "" - def keys = configurationCollection.keySet().sort() - for (key in keys) { - (configurationURL, configurationVersion, configurationSHA) = configurationCollection.get(key) - formattedLine = String.format("%s:%s,%s,%s%n", key, configurationURL, configurationVersion, configurationSHA) - formattedInfo += formattedLine - } - return formattedInfo -} - -def gitCheckoutAndRegister(String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { +def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { gh.gitCheckout(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) - registerConfigurationInfo(tool, gitURL, revision, gh.getGitInfo(targetDir)) + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) } return this diff --git a/meta/folder.groovy b/meta/folder.groovy index d4caa5d..2963e58 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -139,6 +139,31 @@ class ReleaseInfo extends GISJsonSerialised { } } +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 + } + + LinkedHashMap serialisationdata() { + def data = [ + 'configurationname' : configurationname, + 'configurationURL' : configurationURL, + 'configurationversion' : configurationversion, + 'configurationSHA' : configurationSHA, + ] + return data + } +} + class MetaInfo extends GISJsonSerialised { private String format = '0.1' ProductInfo productinfo @@ -146,7 +171,7 @@ class MetaInfo extends GISJsonSerialised { JenkinsBuildInfo jenkinsbuildinfo BuildStampInfo buildstampinfo ReleaseInfo releaseinfo - + private ArrayList configurationinfo private ArrayList associatedmeta MetaInfo(script) { @@ -156,9 +181,23 @@ class MetaInfo extends GISJsonSerialised { jenkinsbuildinfo = new JenkinsBuildInfo(script) buildstampinfo = new BuildStampInfo(script) releaseinfo = new ReleaseInfo(script) + configurationinfo = new ArrayList() associatedmeta = new ArrayList() } + List configurationinfoserialised() { + def configuration = [] + for (configurationitem in configurationinfo) { + configuration.add(configurationitem.serialisationdata()) + } + return associated + } + + void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { + ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) + configurationinfo.add(ci) + } + List associatedmetaserialised() { def associated = [] for (metaitem in associatedmeta) { @@ -179,6 +218,7 @@ class MetaInfo extends GISJsonSerialised { 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), 'buildstampinfo' : buildstampinfo.serialisationdata(), 'releaseinfo' : releaseinfo.serialisationdata(), + 'configuration' : configurationinfoserialised(), 'associatedmeta' : associatedmetaserialised(), ] return data @@ -189,14 +229,12 @@ class MetaInfo extends GISJsonSerialised { } } -MetaInfo theMetaData = new MetaInfo(this) - -def metareset(script) { +MetaInfo metareset(script) { echo "Resetting meta folder" dir("${WORKSPACE}/${METAFOLDERNAME}") { deleteDir() } - theMetaData = new MetaInfo(this) + return new MetaInfo(script) } return this; \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index b576201..b99467e 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -17,9 +17,6 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() - - def ch = load("${cs}/configuration/configuration.groovy") - ch.saveConfigurationInVersionInfo(); } return this; From 59d37c79a58e01bef069a8e8f395677395aa8105 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 20:25:33 +0000 Subject: [PATCH 0385/1971] Start using meta info for storing configuration --- autobuilder.groovy | 13 ++++---- configuration/configuration.groovy | 33 ++++---------------- meta/folder.groovy | 48 ++++++++++++++++++++++++++---- versionnumbering/generate.groovy | 3 -- 4 files changed, 57 insertions(+), 40 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index fab812a..a82e891 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -4,6 +4,8 @@ autobuildroot = "${WORKSPACE}/autobuild" commonscriptsroot = "${autobuildroot}/Common_scripts" +metafolder = load("${commonscripts()}/meta/folder.groovy") + def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { echo "Cleaning workspace" @@ -26,7 +28,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +MetaInfo start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -34,12 +36,13 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA conditionalclean() - def metafolder = load("${commonscripts()}/meta/folder.groovy") - metafolder.metareset(script) - metafolder.theMetaData.productinfo.set(productname, subcomponentname, jirakey) + def meta = metafolder.metareset(script) + meta.productinfo.set(productname, subcomponentname, jirakey) def ch = load("${commonscripts()}/configuration/configuration.groovy") - ch.registerPipelineScriptConfiguration() + ch.registerPipelineScriptConfiguration(meta) + + return meta } def configurationhelper() { diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 1f0c095..30b7086 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,37 +1,16 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -configurationCollection = [:] - -def registerConfigurationInfo(String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { - def ConfigurationInfo = [configurationURL, configurationVersion, configurationSHA] - configurationCollection.put(configurationName, ConfigurationInfo) +def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { + meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) } -def registerPipelineScriptConfiguration() { - registerConfigurationInfo('pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) +def registerPipelineScriptConfiguration(meta) { + registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) } -def saveConfigurationInVersionInfo() { - dir("${WORKSPACE}/version") { - echo "Writing configuration info to ${WORKSPACE}/version/configuration.txt" - writeFile file: 'configuration.txt', text: getFormattedConfiguration() - } -} - -String getFormattedConfiguration() { - String formattedInfo = "" - def keys = configurationCollection.keySet().sort() - for (key in keys) { - (configurationURL, configurationVersion, configurationSHA) = configurationCollection.get(key) - formattedLine = String.format("%s:%s,%s,%s%n", key, configurationURL, configurationVersion, configurationSHA) - formattedInfo += formattedLine - } - return formattedInfo -} - -def gitCheckoutAndRegister(String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { +def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { gh.gitCheckout(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) - registerConfigurationInfo(tool, gitURL, revision, gh.getGitInfo(targetDir)) + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) } return this diff --git a/meta/folder.groovy b/meta/folder.groovy index d4caa5d..2963e58 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -139,6 +139,31 @@ class ReleaseInfo extends GISJsonSerialised { } } +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 + } + + LinkedHashMap serialisationdata() { + def data = [ + 'configurationname' : configurationname, + 'configurationURL' : configurationURL, + 'configurationversion' : configurationversion, + 'configurationSHA' : configurationSHA, + ] + return data + } +} + class MetaInfo extends GISJsonSerialised { private String format = '0.1' ProductInfo productinfo @@ -146,7 +171,7 @@ class MetaInfo extends GISJsonSerialised { JenkinsBuildInfo jenkinsbuildinfo BuildStampInfo buildstampinfo ReleaseInfo releaseinfo - + private ArrayList configurationinfo private ArrayList associatedmeta MetaInfo(script) { @@ -156,9 +181,23 @@ class MetaInfo extends GISJsonSerialised { jenkinsbuildinfo = new JenkinsBuildInfo(script) buildstampinfo = new BuildStampInfo(script) releaseinfo = new ReleaseInfo(script) + configurationinfo = new ArrayList() associatedmeta = new ArrayList() } + List configurationinfoserialised() { + def configuration = [] + for (configurationitem in configurationinfo) { + configuration.add(configurationitem.serialisationdata()) + } + return associated + } + + void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { + ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) + configurationinfo.add(ci) + } + List associatedmetaserialised() { def associated = [] for (metaitem in associatedmeta) { @@ -179,6 +218,7 @@ class MetaInfo extends GISJsonSerialised { 'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(), 'buildstampinfo' : buildstampinfo.serialisationdata(), 'releaseinfo' : releaseinfo.serialisationdata(), + 'configuration' : configurationinfoserialised(), 'associatedmeta' : associatedmetaserialised(), ] return data @@ -189,14 +229,12 @@ class MetaInfo extends GISJsonSerialised { } } -MetaInfo theMetaData = new MetaInfo(this) - -def metareset(script) { +MetaInfo metareset(script) { echo "Resetting meta folder" dir("${WORKSPACE}/${METAFOLDERNAME}") { deleteDir() } - theMetaData = new MetaInfo(this) + return new MetaInfo(script) } return this; \ No newline at end of file diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index b576201..b99467e 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -17,9 +17,6 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() - - def ch = load("${cs}/configuration/configuration.groovy") - ch.saveConfigurationInVersionInfo(); } return this; From 632b08b6e9b7dd4dbf79b36af318428440f5c4ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 20:29:56 +0000 Subject: [PATCH 0386/1971] Start using meta info for storing configuration --- autobuilder.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index a82e891..e7943c6 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -4,8 +4,6 @@ autobuildroot = "${WORKSPACE}/autobuild" commonscriptsroot = "${autobuildroot}/Common_scripts" -metafolder = load("${commonscripts()}/meta/folder.groovy") - def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { echo "Cleaning workspace" @@ -28,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -MetaInfo start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -36,6 +34,7 @@ MetaInfo start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONE conditionalclean() + def metafolder = load("${commonscripts()}/meta/folder.groovy") def meta = metafolder.metareset(script) meta.productinfo.set(productname, subcomponentname, jirakey) From 35ae72bbdbbf7c34bdf47921be41b6b7522c7dd2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 20:29:56 +0000 Subject: [PATCH 0387/1971] Start using meta info for storing configuration --- autobuilder.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index a82e891..e7943c6 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -4,8 +4,6 @@ autobuildroot = "${WORKSPACE}/autobuild" commonscriptsroot = "${autobuildroot}/Common_scripts" -metafolder = load("${commonscripts()}/meta/folder.groovy") - def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { echo "Cleaning workspace" @@ -28,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -MetaInfo start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -36,6 +34,7 @@ MetaInfo start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONE conditionalclean() + def metafolder = load("${commonscripts()}/meta/folder.groovy") def meta = metafolder.metareset(script) meta.productinfo.set(productname, subcomponentname, jirakey) From 97f31cf3137c3db49735435a65175ff250eed030 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 22:52:20 +0000 Subject: [PATCH 0388/1971] Move functionality to meta --- autobuilder.groovy | 5 ++++- meta/folder.groovy | 13 ++++++++++++- versionnumbering/generate.groovy | 32 +++++++++++++++++++++++++++++--- versionnumbering/versioninfo.py | 25 +++---------------------- 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index e7943c6..3a2a408 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -37,7 +37,10 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA def metafolder = load("${commonscripts()}/meta/folder.groovy") def meta = metafolder.metareset(script) meta.productinfo.set(productname, subcomponentname, jirakey) - + def now = new Date() + now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) + meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID, NODE_NAME, now) + def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2963e58..6ae3d3d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -79,7 +79,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { private String buildmachine private String builddate - JenkinsBuildInfo(script, buildjobname = "", buildnumber = 0, buildmachine = "", builddate = "") { + JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "") { super(script) this.buildjobname = buildjobname this.buildnumber = buildnumber @@ -87,6 +87,13 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } + def set(String buildjobname, int buildnumber, String buildmachine, String builddate) { + this.buildjobname = buildjobname + this.buildnumber = buildnumber + this.buildmachine = buildmachine + this.builddate = builddate + } + LinkedHashMap serialisationdata() { def data = [ 'buildjobname' : buildjobname, @@ -131,6 +138,10 @@ class ReleaseInfo extends GISJsonSerialised { this.releasejobname = releasejobname } + def set(releasejobname) { + this.releasejobname = releasejobname + } + LinkedHashMap serialisationdata() { def data = [ 'releasejobname' : releasejobname, diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index b99467e..0019b24 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -2,16 +2,16 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" -def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { +def generate(meta, sourcerevision, sourcepath, basebuildnumber = "1000", versionfolder = "${VERSIONFOLDER}") { def cs = autobuilder.commonscripts() if (isUnix()) { sh """ - "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" + "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" """ } else { bat """ - "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" + "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" """ } env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() @@ -20,3 +20,29 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam } return this; + + +/* + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(str(gitrevisioncount)) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + + with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: + f.write(remoteurl) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) +*/ diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 370d9fc..0fa097a 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -24,7 +24,6 @@ __date__ = '2017-11-29' __updated__ = '2017-11-29' gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") -slaveMachine = os.getenv("NODE_NAME", default="-") MAXVERSIONNUMBER = 65535 def resetFolder(versionfolder): @@ -138,10 +137,7 @@ def getVersionPrefix(sourcebranch): print("Determined version prefix to be: {0}".format(versionprefix)) return versionprefix -def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname): - with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: - f.write(buildjobname) - +def writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp): with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: f.write(versionprefix) @@ -157,9 +153,6 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: f.write(remoteurl) - with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: - f.write(buildnumber) - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: f.write(buildstamp) @@ -167,15 +160,9 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: f.write(buildstampcommasep) - with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: - f.write(slaveMachine) - with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: f.write(str(datetime.datetime.now())) - with open(os.path.join(versionfolder, "releasejobname.txt"), 'w') as f: - f.write(releasejobname) - def main(argv=None): # IGNORE:C0111 '''Command line options.''' @@ -207,9 +194,6 @@ USAGE parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") - parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") - parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") - parser.add_argument("-r", "--releasejobname", dest="releasejobname", action="store", default="-", help="release-to-git build job name [default: %(default)s]") # Process arguments args = parser.parse_args() @@ -219,12 +203,9 @@ USAGE versionfolder = args.versionfolder gitrootfolder = args.gitrootfolder baseversionnumber = args.baseversionnumber - buildjobname = args.buildjobname - buildnumber = args.buildnumber - releasejobname = args.releasejobname print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) - print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber, "Release job name:", releasejobname) + print("Base version number:", baseversionnumber) resetFolder(versionfolder) @@ -235,7 +216,7 @@ USAGE buildstamp = versionprefix + str(gitrevisioncount) print("Build stamp is: {0}".format(buildstamp)) - writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname) + writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp) return 0 except Exception as e: From d9b91dee691a29ae78466b8cbc2fd528d9d9a745 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 20 Nov 2018 22:52:20 +0000 Subject: [PATCH 0389/1971] Move functionality to meta --- autobuilder.groovy | 5 ++++- meta/folder.groovy | 13 ++++++++++++- versionnumbering/generate.groovy | 32 +++++++++++++++++++++++++++++--- versionnumbering/versioninfo.py | 25 +++---------------------- 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index e7943c6..3a2a408 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -37,7 +37,10 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA def metafolder = load("${commonscripts()}/meta/folder.groovy") def meta = metafolder.metareset(script) meta.productinfo.set(productname, subcomponentname, jirakey) - + def now = new Date() + now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) + meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID, NODE_NAME, now) + def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2963e58..6ae3d3d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -79,7 +79,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { private String buildmachine private String builddate - JenkinsBuildInfo(script, buildjobname = "", buildnumber = 0, buildmachine = "", builddate = "") { + JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "") { super(script) this.buildjobname = buildjobname this.buildnumber = buildnumber @@ -87,6 +87,13 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } + def set(String buildjobname, int buildnumber, String buildmachine, String builddate) { + this.buildjobname = buildjobname + this.buildnumber = buildnumber + this.buildmachine = buildmachine + this.builddate = builddate + } + LinkedHashMap serialisationdata() { def data = [ 'buildjobname' : buildjobname, @@ -131,6 +138,10 @@ class ReleaseInfo extends GISJsonSerialised { this.releasejobname = releasejobname } + def set(releasejobname) { + this.releasejobname = releasejobname + } + LinkedHashMap serialisationdata() { def data = [ 'releasejobname' : releasejobname, diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index b99467e..0019b24 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -2,16 +2,16 @@ metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" -def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") { +def generate(meta, sourcerevision, sourcepath, basebuildnumber = "1000", versionfolder = "${VERSIONFOLDER}") { def cs = autobuilder.commonscripts() if (isUnix()) { sh """ - "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" + "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" """ } else { bat """ - "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" -j "${jobname}" -n "${buildid}" -r "${releasejobname}" + "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" """ } env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() @@ -20,3 +20,29 @@ def generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobnam } return this; + + +/* + + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(str(gitrevisioncount)) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + + with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: + f.write(remoteurl) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) +*/ diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 370d9fc..0fa097a 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -24,7 +24,6 @@ __date__ = '2017-11-29' __updated__ = '2017-11-29' gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") -slaveMachine = os.getenv("NODE_NAME", default="-") MAXVERSIONNUMBER = 65535 def resetFolder(versionfolder): @@ -138,10 +137,7 @@ def getVersionPrefix(sourcebranch): print("Determined version prefix to be: {0}".format(versionprefix)) return versionprefix -def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname): - with open(os.path.join(versionfolder, "buildjobname.txt"), 'w') as f: - f.write(buildjobname) - +def writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp): with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: f.write(versionprefix) @@ -157,9 +153,6 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: f.write(remoteurl) - with open(os.path.join(versionfolder, "buildnumber.txt"), 'w') as f: - f.write(buildnumber) - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: f.write(buildstamp) @@ -167,15 +160,9 @@ def writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncou with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: f.write(buildstampcommasep) - with open(os.path.join(versionfolder, "buildmachine.txt"), 'w') as f: - f.write(slaveMachine) - with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: f.write(str(datetime.datetime.now())) - with open(os.path.join(versionfolder, "releasejobname.txt"), 'w') as f: - f.write(releasejobname) - def main(argv=None): # IGNORE:C0111 '''Command line options.''' @@ -207,9 +194,6 @@ USAGE parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") - parser.add_argument("-j", "--buildjobname", dest="buildjobname", action="store", default="-", help="build job name [default: %(default)s]") - parser.add_argument("-n", "--buildnumber", dest="buildnumber", action="store", default="1", help="build number [default: %(default)s]") - parser.add_argument("-r", "--releasejobname", dest="releasejobname", action="store", default="-", help="release-to-git build job name [default: %(default)s]") # Process arguments args = parser.parse_args() @@ -219,12 +203,9 @@ USAGE versionfolder = args.versionfolder gitrootfolder = args.gitrootfolder baseversionnumber = args.baseversionnumber - buildjobname = args.buildjobname - buildnumber = args.buildnumber - releasejobname = args.releasejobname print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) - print("Base version number:", baseversionnumber, "Build job name:", buildjobname, "Build number:", buildnumber, "Release job name:", releasejobname) + print("Base version number:", baseversionnumber) resetFolder(versionfolder) @@ -235,7 +216,7 @@ USAGE buildstamp = versionprefix + str(gitrevisioncount) print("Build stamp is: {0}".format(buildstamp)) - writeversionfiles(versionfolder, buildjobname, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildnumber, buildstamp, releasejobname) + writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp) return 0 except Exception as e: From d766ef7a14138ebc50170579c86cc6a6ccbce1ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:08:11 +0000 Subject: [PATCH 0390/1971] Improve meta gathering --- meta/folder.groovy | 15 ++++ versionnumbering/generate.groovy | 134 +++++++++++++++++++++++-------- versionnumbering/versioninfo.py | 53 ------------ 3 files changed, 114 insertions(+), 88 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 6ae3d3d..8b638a9 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -61,6 +61,14 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } + def set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) { + this.sourcepath = sourcepath + this.sourcerevision = sourcerevision + this.gitrevision = gitrevision + this.remoteurl = remoteurl + this.remoteinfo = remoteinfo + } + LinkedHashMap serialisationdata() { def data = [ 'sourcepath' : sourcepath, @@ -119,6 +127,13 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } + def set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + this.buildstampcommasep = buildstampcommasep + } + LinkedHashMap serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 0019b24..f9683e6 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,48 +1,112 @@ -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" +ddef getGitRevision(String gitrootpath, int basebuildnumber) { + dir( gitrootpath) { + def int MAXVERSIONNUMBER = 65535 -def generate(meta, sourcerevision, sourcepath, basebuildnumber = "1000", versionfolder = "${VERSIONFOLDER}") { - def cs = autobuilder.commonscripts() - if (isUnix()) { - sh """ - "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" - """ + def int changecount = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-list HEAD --count") + echo "Change count: ${changecount}" + def int adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) + echo "Adjusted change count: ${adjustedchangecount}" + + def gitrevision = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-parse HEAD") + echo "Revision: ${gitrevision}" + + def remoteinfo = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote show origin") + echo "Remote info: ${remoteinfo}" + + def remoteurl = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote get-url --push origin") + echo "Remote URL: ${remoteurl}" } - else { - bat """ - "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" - """ - } - env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() - env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() - env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() + return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] } -return this; +// Handle: +// origin/master +// origin/2.0.x +def getVersionPrefix(String sourcebranch) { + echo "Determining version number prefix from source branch name: ${sourcebranch}" + sourcebranch = sourcebranch.toLowerCase() + def defaultversionprefix = "1.30000.0." + def splits = sourcebranch.split('/') + if (splits.size() < 1) { + echo "Source branch name is invalid. Defaulting to: ${defaultversionprefix}" + return defaultversionprefix + } -/* - - with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: - f.write(versionprefix) + def mastertypeversionprefix = "1.20000.0." + sourcebranch = splits.last() + if (sourcebranch.toLowerCase().find("master") != null) { + echo "Source branch name has 'master' in it. Defaulting to: ${mastertypeversionprefix}" + return mastertypeversionprefix + } - with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: - f.write(str(gitrevisioncount)) + echo "sourcebranch is now: ${sourcebranch}" + def splits2 = sourcebranch.split('\\.') + echo "Splits2 is: ${splits2}" + if (splits2.size() < 1) { + def thirdpartyversionprefix = "1.25000.0." + echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" + return thirdpartyversionprefix + } + splits = [] + for (split in splits2) { + echo "Split is: ${split}" + if (split.isInteger()) { + splits.add(split) + } + else if (split == "x") { + return mastertypeversionprefix + } + } + echo "Splits is: ${splits}" - with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: - f.write(gitrevision) + def versionprefix = "" + if (splits.size() < 1) { + echo "This source branch name has no numbers in its name so defaulting to: ${defaultversionprefix}" + versionprefix = defaultversionprefix + } + else { + def int splitnumbercount = 0 + for (split in splits) { + echo "Split is ${split}" + if (split.isInteger()) { + versionprefix += split + "." + splitnumbercount += 1 + } + else if (splitnumbercount > 2) { + break + } + } + if (splitnumbercount == 0) { + echo "No leading numbers were found in source branch name so defaulting to: ${defaultversionprefix}" + versionprefix = defaultversionprefix + } + else { + if (splitnumbercount == 1) { + versionprefix += "0.0." + } + else if (splitnumbercount == 2) { + versionprefix += "0." + } + } + } + echo "Determined version prefix to be: ${versionprefix}" + return versionprefix +} - with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: - f.write(remoteinfo) +String generate(meta, String sourcerevision, String sourcepath, int basebuildnumber = 1000) { + (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) - with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: - f.write(remoteurl) + def versionprefix = getVersionPrefix(sourcerevision) - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: - f.write(buildstamp) + def buildstamp = versionprefix + gitrevisioncount.toString() + echo "Build stamp is: ${buildstamp}" - buildstampcommasep = buildstamp.replace(".", ",") - with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: - f.write(buildstampcommasep) -*/ + meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) + meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp, buildstamp.replace(".", ",")) + + return buildstamp +} + +return this; \ No newline at end of file diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 0fa097a..3d2a80d 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -23,57 +23,6 @@ __version__ = 0.1 __date__ = '2017-11-29' __updated__ = '2017-11-29' -gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") -MAXVERSIONNUMBER = 65535 - -def resetFolder(versionfolder): - print("Removing folders and contents of: {0}".format(versionfolder)) - try: - shutil.rmtree(versionfolder) - except FileNotFoundError: - pass - - print("Creating folder: {0}".format(versionfolder)) - os.makedirs(versionfolder) - -def getGitRevision(gitrootpath, basenumber): - cwd = os.getcwd() - - path = os.path.expanduser(gitrootpath) - print("Changing current working directory to: {0}".format(path)) - os.chdir(path) - - print("Determining revision info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - changecount = completed.stdout.decode("utf-8").strip() - print("Change count: {0}".format(changecount)) - adjustedchangecount = int((int(changecount) + int(basenumber)) % (MAXVERSIONNUMBER + 1)) - print("Adjusted change count: {0}".format(adjustedchangecount)) - - print("Determining current revision info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - revision = completed.stdout.decode("utf-8").strip() - print("Revision: {0}".format(revision)) - - print("Determining remote info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - remoteinfo = completed.stdout.decode("utf-8") - print("Remote info: {0}".format(remoteinfo)) - - print("Determining remote url using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "remote", "get-url", "--push", "origin"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - remoteurl = completed.stdout.decode("utf-8") - print("Remote info: {0}".format(remoteurl)) - - os.chdir(cwd) - print("Restored current working directory to: {0}".format(cwd)) - - return (adjustedchangecount, revision, remoteinfo, remoteurl) - # Handle: # origin/master # origin/2.0.x @@ -207,8 +156,6 @@ USAGE print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) print("Base version number:", baseversionnumber) - resetFolder(versionfolder) - (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(gitrootfolder, baseversionnumber) versionprefix = getVersionPrefix(sourcebranch) From 84c105946be4abdcb35ad85da8b847e81875a511 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:08:11 +0000 Subject: [PATCH 0391/1971] Improve meta gathering --- meta/folder.groovy | 15 ++++ versionnumbering/generate.groovy | 134 +++++++++++++++++++++++-------- versionnumbering/versioninfo.py | 53 ------------ 3 files changed, 114 insertions(+), 88 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 6ae3d3d..8b638a9 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -61,6 +61,14 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } + def set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) { + this.sourcepath = sourcepath + this.sourcerevision = sourcerevision + this.gitrevision = gitrevision + this.remoteurl = remoteurl + this.remoteinfo = remoteinfo + } + LinkedHashMap serialisationdata() { def data = [ 'sourcepath' : sourcepath, @@ -119,6 +127,13 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } + def set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + this.buildstampcommasep = buildstampcommasep + } + LinkedHashMap serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 0019b24..f9683e6 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,48 +1,112 @@ -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version" +ddef getGitRevision(String gitrootpath, int basebuildnumber) { + dir( gitrootpath) { + def int MAXVERSIONNUMBER = 65535 -def generate(meta, sourcerevision, sourcepath, basebuildnumber = "1000", versionfolder = "${VERSIONFOLDER}") { - def cs = autobuilder.commonscripts() - if (isUnix()) { - sh """ - "${PYTHON}" -u "${cs}/versionnumbering/versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" - """ + def int changecount = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-list HEAD --count") + echo "Change count: ${changecount}" + def int adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) + echo "Adjusted change count: ${adjustedchangecount}" + + def gitrevision = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-parse HEAD") + echo "Revision: ${gitrevision}" + + def remoteinfo = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote show origin") + echo "Remote info: ${remoteinfo}" + + def remoteurl = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote get-url --push origin") + echo "Remote URL: ${remoteurl}" } - else { - bat """ - "${PYTHON}" -u "${cs}\\versionnumbering\\versioninfo.py" -s "${sourcerevision}" -v "${versionfolder}" -g "${sourcepath}" -b "${basebuildnumber}" - """ - } - env.BUILD_STAMP = readFile("${VERSIONFOLDER}/buildstamp.txt").trim() - env.BUILD_STAMP_COMMA_SEP = readFile("${VERSIONFOLDER}/buildstampcommasep.txt").trim() - env.SRC_REVISION = readFile("${VERSIONFOLDER}/revision.txt").trim() + return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] } -return this; +// Handle: +// origin/master +// origin/2.0.x +def getVersionPrefix(String sourcebranch) { + echo "Determining version number prefix from source branch name: ${sourcebranch}" + sourcebranch = sourcebranch.toLowerCase() + def defaultversionprefix = "1.30000.0." + def splits = sourcebranch.split('/') + if (splits.size() < 1) { + echo "Source branch name is invalid. Defaulting to: ${defaultversionprefix}" + return defaultversionprefix + } -/* - - with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: - f.write(versionprefix) + def mastertypeversionprefix = "1.20000.0." + sourcebranch = splits.last() + if (sourcebranch.toLowerCase().find("master") != null) { + echo "Source branch name has 'master' in it. Defaulting to: ${mastertypeversionprefix}" + return mastertypeversionprefix + } - with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: - f.write(str(gitrevisioncount)) + echo "sourcebranch is now: ${sourcebranch}" + def splits2 = sourcebranch.split('\\.') + echo "Splits2 is: ${splits2}" + if (splits2.size() < 1) { + def thirdpartyversionprefix = "1.25000.0." + echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" + return thirdpartyversionprefix + } + splits = [] + for (split in splits2) { + echo "Split is: ${split}" + if (split.isInteger()) { + splits.add(split) + } + else if (split == "x") { + return mastertypeversionprefix + } + } + echo "Splits is: ${splits}" - with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: - f.write(gitrevision) + def versionprefix = "" + if (splits.size() < 1) { + echo "This source branch name has no numbers in its name so defaulting to: ${defaultversionprefix}" + versionprefix = defaultversionprefix + } + else { + def int splitnumbercount = 0 + for (split in splits) { + echo "Split is ${split}" + if (split.isInteger()) { + versionprefix += split + "." + splitnumbercount += 1 + } + else if (splitnumbercount > 2) { + break + } + } + if (splitnumbercount == 0) { + echo "No leading numbers were found in source branch name so defaulting to: ${defaultversionprefix}" + versionprefix = defaultversionprefix + } + else { + if (splitnumbercount == 1) { + versionprefix += "0.0." + } + else if (splitnumbercount == 2) { + versionprefix += "0." + } + } + } + echo "Determined version prefix to be: ${versionprefix}" + return versionprefix +} - with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: - f.write(remoteinfo) +String generate(meta, String sourcerevision, String sourcepath, int basebuildnumber = 1000) { + (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) - with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: - f.write(remoteurl) + def versionprefix = getVersionPrefix(sourcerevision) - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: - f.write(buildstamp) + def buildstamp = versionprefix + gitrevisioncount.toString() + echo "Build stamp is: ${buildstamp}" - buildstampcommasep = buildstamp.replace(".", ",") - with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: - f.write(buildstampcommasep) -*/ + meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) + meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp, buildstamp.replace(".", ",")) + + return buildstamp +} + +return this; \ No newline at end of file diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py index 0fa097a..3d2a80d 100644 --- a/versionnumbering/versioninfo.py +++ b/versionnumbering/versioninfo.py @@ -23,57 +23,6 @@ __version__ = 0.1 __date__ = '2017-11-29' __updated__ = '2017-11-29' -gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") -MAXVERSIONNUMBER = 65535 - -def resetFolder(versionfolder): - print("Removing folders and contents of: {0}".format(versionfolder)) - try: - shutil.rmtree(versionfolder) - except FileNotFoundError: - pass - - print("Creating folder: {0}".format(versionfolder)) - os.makedirs(versionfolder) - -def getGitRevision(gitrootpath, basenumber): - cwd = os.getcwd() - - path = os.path.expanduser(gitrootpath) - print("Changing current working directory to: {0}".format(path)) - os.chdir(path) - - print("Determining revision info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "rev-list", "HEAD", "--count"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - changecount = completed.stdout.decode("utf-8").strip() - print("Change count: {0}".format(changecount)) - adjustedchangecount = int((int(changecount) + int(basenumber)) % (MAXVERSIONNUMBER + 1)) - print("Adjusted change count: {0}".format(adjustedchangecount)) - - print("Determining current revision info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "rev-parse", "HEAD"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - revision = completed.stdout.decode("utf-8").strip() - print("Revision: {0}".format(revision)) - - print("Determining remote info using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "remote", "show", "origin"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - remoteinfo = completed.stdout.decode("utf-8") - print("Remote info: {0}".format(remoteinfo)) - - print("Determining remote url using git command: {0}".format(gitExecutable)) - completed = subprocess.run([gitExecutable, "remote", "get-url", "--push", "origin"], stdout=subprocess.PIPE) - print("Command {0} returned: {1}".format(completed.args, completed.returncode)) - remoteurl = completed.stdout.decode("utf-8") - print("Remote info: {0}".format(remoteurl)) - - os.chdir(cwd) - print("Restored current working directory to: {0}".format(cwd)) - - return (adjustedchangecount, revision, remoteinfo, remoteurl) - # Handle: # origin/master # origin/2.0.x @@ -207,8 +156,6 @@ USAGE print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) print("Base version number:", baseversionnumber) - resetFolder(versionfolder) - (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(gitrootfolder, baseversionnumber) versionprefix = getVersionPrefix(sourcebranch) From 2e674ac1f357abc4b03707963747fa8b7004cdcd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:08:43 +0000 Subject: [PATCH 0392/1971] Improve meta gathering --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f9683e6..69bdd4d 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,5 +1,5 @@ -ddef getGitRevision(String gitrootpath, int basebuildnumber) { +def getGitRevision(String gitrootpath, int basebuildnumber) { dir( gitrootpath) { def int MAXVERSIONNUMBER = 65535 From 654b4fa87be1ba9de08f3aefcd5793740f2391bd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:08:43 +0000 Subject: [PATCH 0393/1971] Improve meta gathering --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f9683e6..69bdd4d 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,5 +1,5 @@ -ddef getGitRevision(String gitrootpath, int basebuildnumber) { +def getGitRevision(String gitrootpath, int basebuildnumber) { dir( gitrootpath) { def int MAXVERSIONNUMBER = 65535 From cd12e5f558506e0ca5517440e1bfcc2a6b7dd14b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:13:47 +0000 Subject: [PATCH 0394/1971] Improve meta gathering --- meta/folder.groovy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 8b638a9..690ffaa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -29,7 +29,7 @@ class ProductInfo extends GISJsonSerialised { this.jirakey = jirakey } - def set(productname, subcomponentname, jirakey) { + void set(String productname, String subcomponentname, String jirakey) { this.productname = productname this.subcomponentname = subcomponentname this.jirakey = jirakey @@ -61,7 +61,7 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } - def set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) { + void set(String sourcepath, String sourcerevision, String gitrevision, String remoteurl, String remoteinfo) { this.sourcepath = sourcepath this.sourcerevision = sourcerevision this.gitrevision = gitrevision @@ -95,7 +95,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } - def set(String buildjobname, int buildnumber, String buildmachine, String builddate) { + void set(String buildjobname, int buildnumber, String buildmachine, String builddate) { this.buildjobname = buildjobname this.buildnumber = buildnumber this.buildmachine = buildmachine @@ -127,7 +127,7 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } - def set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { + void set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp @@ -153,7 +153,7 @@ class ReleaseInfo extends GISJsonSerialised { this.releasejobname = releasejobname } - def set(releasejobname) { + void set(String releasejobname) { this.releasejobname = releasejobname } @@ -220,7 +220,7 @@ class MetaInfo extends GISJsonSerialised { } void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { - ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) + def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) configurationinfo.add(ci) } @@ -263,4 +263,4 @@ MetaInfo metareset(script) { return new MetaInfo(script) } -return this; \ No newline at end of file +return this; From 963dabcc6e61dd6a97e76f5243be4786789d1ca9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:13:47 +0000 Subject: [PATCH 0395/1971] Improve meta gathering --- meta/folder.groovy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 8b638a9..690ffaa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -29,7 +29,7 @@ class ProductInfo extends GISJsonSerialised { this.jirakey = jirakey } - def set(productname, subcomponentname, jirakey) { + void set(String productname, String subcomponentname, String jirakey) { this.productname = productname this.subcomponentname = subcomponentname this.jirakey = jirakey @@ -61,7 +61,7 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } - def set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) { + void set(String sourcepath, String sourcerevision, String gitrevision, String remoteurl, String remoteinfo) { this.sourcepath = sourcepath this.sourcerevision = sourcerevision this.gitrevision = gitrevision @@ -95,7 +95,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } - def set(String buildjobname, int buildnumber, String buildmachine, String builddate) { + void set(String buildjobname, int buildnumber, String buildmachine, String builddate) { this.buildjobname = buildjobname this.buildnumber = buildnumber this.buildmachine = buildmachine @@ -127,7 +127,7 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } - def set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { + void set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp @@ -153,7 +153,7 @@ class ReleaseInfo extends GISJsonSerialised { this.releasejobname = releasejobname } - def set(releasejobname) { + void set(String releasejobname) { this.releasejobname = releasejobname } @@ -220,7 +220,7 @@ class MetaInfo extends GISJsonSerialised { } void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { - ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) + def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) configurationinfo.add(ci) } @@ -263,4 +263,4 @@ MetaInfo metareset(script) { return new MetaInfo(script) } -return this; \ No newline at end of file +return this; From 66cbeb949cfefa8c96c186aa967c8ebf23a2128a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:22:00 +0000 Subject: [PATCH 0396/1971] Improve meta gathering --- meta/folder.groovy | 2 +- versionnumbering/generate.groovy | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 690ffaa..045d67d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -216,7 +216,7 @@ class MetaInfo extends GISJsonSerialised { for (configurationitem in configurationinfo) { configuration.add(configurationitem.serialisationdata()) } - return associated + return configuration } void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 69bdd4d..3c475bc 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,20 +1,24 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { + def int adjustedchangecount + def String gitrevision + def String remoteinfo + def String remoteurl dir( gitrootpath) { def int MAXVERSIONNUMBER = 65535 - def int changecount = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-list HEAD --count") + def int changecount = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-list HEAD --count").trim() echo "Change count: ${changecount}" - def int adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) + adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) echo "Adjusted change count: ${adjustedchangecount}" - def gitrevision = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-parse HEAD") + gitrevision = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-parse HEAD").trim() echo "Revision: ${gitrevision}" - def remoteinfo = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote show origin") + remoteinfo = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote show origin").trim() echo "Remote info: ${remoteinfo}" - def remoteurl = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote get-url --push origin") + remoteurl = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote get-url --push origin").trim() echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] @@ -41,9 +45,7 @@ def getVersionPrefix(String sourcebranch) { return mastertypeversionprefix } - echo "sourcebranch is now: ${sourcebranch}" def splits2 = sourcebranch.split('\\.') - echo "Splits2 is: ${splits2}" if (splits2.size() < 1) { def thirdpartyversionprefix = "1.25000.0." echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" @@ -51,7 +53,6 @@ def getVersionPrefix(String sourcebranch) { } splits = [] for (split in splits2) { - echo "Split is: ${split}" if (split.isInteger()) { splits.add(split) } @@ -59,7 +60,6 @@ def getVersionPrefix(String sourcebranch) { return mastertypeversionprefix } } - echo "Splits is: ${splits}" def versionprefix = "" if (splits.size() < 1) { @@ -69,7 +69,6 @@ def getVersionPrefix(String sourcebranch) { else { def int splitnumbercount = 0 for (split in splits) { - echo "Split is ${split}" if (split.isInteger()) { versionprefix += split + "." splitnumbercount += 1 @@ -96,6 +95,11 @@ def getVersionPrefix(String sourcebranch) { } 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) From 0fe07ee41231719f3b8a42b7fd089ac590a09602 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:22:00 +0000 Subject: [PATCH 0397/1971] Improve meta gathering --- meta/folder.groovy | 2 +- versionnumbering/generate.groovy | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 690ffaa..045d67d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -216,7 +216,7 @@ class MetaInfo extends GISJsonSerialised { for (configurationitem in configurationinfo) { configuration.add(configurationitem.serialisationdata()) } - return associated + return configuration } void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 69bdd4d..3c475bc 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,20 +1,24 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { + def int adjustedchangecount + def String gitrevision + def String remoteinfo + def String remoteurl dir( gitrootpath) { def int MAXVERSIONNUMBER = 65535 - def int changecount = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-list HEAD --count") + def int changecount = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-list HEAD --count").trim() echo "Change count: ${changecount}" - def int adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) + adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) echo "Adjusted change count: ${adjustedchangecount}" - def gitrevision = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-parse HEAD") + gitrevision = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-parse HEAD").trim() echo "Revision: ${gitrevision}" - def remoteinfo = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote show origin") + remoteinfo = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote show origin").trim() echo "Remote info: ${remoteinfo}" - def remoteurl = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote get-url --push origin") + remoteurl = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote get-url --push origin").trim() echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] @@ -41,9 +45,7 @@ def getVersionPrefix(String sourcebranch) { return mastertypeversionprefix } - echo "sourcebranch is now: ${sourcebranch}" def splits2 = sourcebranch.split('\\.') - echo "Splits2 is: ${splits2}" if (splits2.size() < 1) { def thirdpartyversionprefix = "1.25000.0." echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" @@ -51,7 +53,6 @@ def getVersionPrefix(String sourcebranch) { } splits = [] for (split in splits2) { - echo "Split is: ${split}" if (split.isInteger()) { splits.add(split) } @@ -59,7 +60,6 @@ def getVersionPrefix(String sourcebranch) { return mastertypeversionprefix } } - echo "Splits is: ${splits}" def versionprefix = "" if (splits.size() < 1) { @@ -69,7 +69,6 @@ def getVersionPrefix(String sourcebranch) { else { def int splitnumbercount = 0 for (split in splits) { - echo "Split is ${split}" if (split.isInteger()) { versionprefix += split + "." splitnumbercount += 1 @@ -96,6 +95,11 @@ def getVersionPrefix(String sourcebranch) { } 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) From 5682c85420b0711b1c1a49c03d535359faf3b5f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:26:40 +0000 Subject: [PATCH 0398/1971] Improve meta gathering --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 3a2a408..50a1655 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -39,7 +39,7 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA meta.productinfo.set(productname, subcomponentname, jirakey) def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) - meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID, NODE_NAME, now) + meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID, NODE_NAME, now.toString()) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From fa26214f9e65cde90568843a5cf683cb935252d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:26:40 +0000 Subject: [PATCH 0399/1971] Improve meta gathering --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 3a2a408..50a1655 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -39,7 +39,7 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA meta.productinfo.set(productname, subcomponentname, jirakey) def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) - meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID, NODE_NAME, now) + meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID, NODE_NAME, now.toString()) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From 1968cf408facba86ee7ab12083953133c54c17cf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:30:56 +0000 Subject: [PATCH 0400/1971] Improve meta gathering --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 50a1655..bbe7bb9 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -39,7 +39,7 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA meta.productinfo.set(productname, subcomponentname, jirakey) def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) - meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID, NODE_NAME, now.toString()) + meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From 838460a826e7ad122a507e641260b736e7149b0b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:30:56 +0000 Subject: [PATCH 0401/1971] Improve meta gathering --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 50a1655..bbe7bb9 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -39,7 +39,7 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA meta.productinfo.set(productname, subcomponentname, jirakey) def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) - meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID, NODE_NAME, now.toString()) + meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From fdea15232d3fdab3e7e29fd7c22348acb5d339be Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:40:37 +0000 Subject: [PATCH 0402/1971] Improve meta gathering --- versionnumbering/generate.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 3c475bc..16fb1a9 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -7,18 +7,18 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { dir( gitrootpath) { def int MAXVERSIONNUMBER = 65535 - def int changecount = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-list HEAD --count").trim() + def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() echo "Change count: ${changecount}" adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) echo "Adjusted change count: ${adjustedchangecount}" - gitrevision = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-parse HEAD").trim() + gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() echo "Revision: ${gitrevision}" - remoteinfo = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote show origin").trim() + remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() echo "Remote info: ${remoteinfo}" - remoteurl = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote get-url --push origin").trim() + remoteurl = sh(returnStdout: true, script: "git remote get-url --push origin").trim() echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] From 6ece33765635a185bd017e2eb1e18797379bbe13 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 10:40:37 +0000 Subject: [PATCH 0403/1971] Improve meta gathering --- versionnumbering/generate.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 3c475bc..16fb1a9 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -7,18 +7,18 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { dir( gitrootpath) { def int MAXVERSIONNUMBER = 65535 - def int changecount = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-list HEAD --count").trim() + def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() echo "Change count: ${changecount}" adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) echo "Adjusted change count: ${adjustedchangecount}" - gitrevision = sh(returnStdout: true, script: "${GIT_EXECUTABLE} rev-parse HEAD").trim() + gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() echo "Revision: ${gitrevision}" - remoteinfo = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote show origin").trim() + remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() echo "Remote info: ${remoteinfo}" - remoteurl = sh(returnStdout: true, script: "${GIT_EXECUTABLE} remote get-url --push origin").trim() + remoteurl = sh(returnStdout: true, script: "git remote get-url --push origin").trim() echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] From 820586ccd2025f28d8b6028c64aa4d6b4bcc6132 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 11:32:04 +0000 Subject: [PATCH 0404/1971] Improve meta gathering --- differences/do.groovy | 10 ++++------ meta/folder.groovy | 26 ++++++++++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 9e572af..35e0980 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,10 +1,8 @@ -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -env.DIFFERENCEARTIFACTS = "${metafolder.METAFOLDERNAME}/differences/**" -DIFFERENCEFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/differences" - -def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, difffolder = "${DIFFERENCEFOLDER}") { - cs = autobuilder.commonscripts() +def differences(meta, String sourcerevision, String previoussourcerevision, String sourcepath) { + def String cs = autobuilder.commonscripts() + def String difffolder = meta.folder() + def String jirakey = meta.productinfo.jirakey if (isUnix()) { sh """ "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" diff --git a/meta/folder.groovy b/meta/folder.groovy index 045d67d..25d5f1f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,7 +1,4 @@ -METAFOLDERNAME = "meta" -env.METAARTIFACTS = "${METAFOLDERNAME}/**" - abstract class GISJsonSerialised implements Serializable { def script @@ -20,7 +17,7 @@ abstract class GISJsonSerialised implements Serializable { class ProductInfo extends GISJsonSerialised { private String productname private String subcomponentname - private String jirakey + String jirakey ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { super(script) @@ -191,6 +188,10 @@ class ConfigurationInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { + private String METAFOLDERNAME = "meta" + private String METAFILENAME = "info.json" + private String METAARTIFACTS = "${METAFOLDERNAME}/**" + private String format = '0.1' ProductInfo productinfo GitInfo gitinfo @@ -250,17 +251,26 @@ class MetaInfo extends GISJsonSerialised { return data } - def setproductinfo(productname, subcomponentname, jirakey) { - productinfo.set(productname, subcomponentname, jirakey) + + String folder() { + return METAFOLDERNAME + } + + String generateartifacts() { + def String metafilepath = "${METAFOLDERNAME}/${METAFILENAME}" + saveJsonSerialised(metafilepath) + return METAARTIFACTS } } MetaInfo metareset(script) { echo "Resetting meta folder" - dir("${WORKSPACE}/${METAFOLDERNAME}") { + def mi = new MetaInfo(script) + + dir(mi.folder()) { deleteDir() } - return new MetaInfo(script) + return mi } return this; From 9e512c2774e23037348c63eca63122313409d110 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 11:32:04 +0000 Subject: [PATCH 0405/1971] Improve meta gathering --- differences/do.groovy | 10 ++++------ meta/folder.groovy | 26 ++++++++++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 9e572af..35e0980 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,10 +1,8 @@ -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -env.DIFFERENCEARTIFACTS = "${metafolder.METAFOLDERNAME}/differences/**" -DIFFERENCEFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/differences" - -def differences(sourcerevision, previoussourcerevision, sourcepath, jirakey, difffolder = "${DIFFERENCEFOLDER}") { - cs = autobuilder.commonscripts() +def differences(meta, String sourcerevision, String previoussourcerevision, String sourcepath) { + def String cs = autobuilder.commonscripts() + def String difffolder = meta.folder() + def String jirakey = meta.productinfo.jirakey if (isUnix()) { sh """ "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" diff --git a/meta/folder.groovy b/meta/folder.groovy index 045d67d..25d5f1f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,7 +1,4 @@ -METAFOLDERNAME = "meta" -env.METAARTIFACTS = "${METAFOLDERNAME}/**" - abstract class GISJsonSerialised implements Serializable { def script @@ -20,7 +17,7 @@ abstract class GISJsonSerialised implements Serializable { class ProductInfo extends GISJsonSerialised { private String productname private String subcomponentname - private String jirakey + String jirakey ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { super(script) @@ -191,6 +188,10 @@ class ConfigurationInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { + private String METAFOLDERNAME = "meta" + private String METAFILENAME = "info.json" + private String METAARTIFACTS = "${METAFOLDERNAME}/**" + private String format = '0.1' ProductInfo productinfo GitInfo gitinfo @@ -250,17 +251,26 @@ class MetaInfo extends GISJsonSerialised { return data } - def setproductinfo(productname, subcomponentname, jirakey) { - productinfo.set(productname, subcomponentname, jirakey) + + String folder() { + return METAFOLDERNAME + } + + String generateartifacts() { + def String metafilepath = "${METAFOLDERNAME}/${METAFILENAME}" + saveJsonSerialised(metafilepath) + return METAARTIFACTS } } MetaInfo metareset(script) { echo "Resetting meta folder" - dir("${WORKSPACE}/${METAFOLDERNAME}") { + def mi = new MetaInfo(script) + + dir(mi.folder()) { deleteDir() } - return new MetaInfo(script) + return mi } return this; From eee94ee26282f8b204e742a5b14c64997cc52c7a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 13:15:10 +0000 Subject: [PATCH 0406/1971] Add checksum info to meta --- checksum/utils.groovy | 15 +++----- meta/folder.groovy | 83 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 11 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 748472f..c090bf3 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,21 +1,14 @@ -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" -CHECKSUMFOLDER = "${metafolder.METAFOLDERNAME}/checksums" - // Generate a checksum file of from a list of files/directories relative to workspace -def generatelist(checksummable) { - load("${autobuilder.commonscripts()}/platform/lineendings.groovy") - sums = "" +def generatelist(meta, checksummable) { for (filepath in checksummable) { - echo "Checksumming ${filepath}" + def checksumset = meta.checksuminfo.addchecksumset(filepath) def files = findFiles(glob: filepath) for (file in files) { - def sum = sha1(file: file.path) - sums += "${sum} ${file.path}${nl}" // Format suitable for sha1sum utility + def sum = sha1(file: file.path).trim() + checksumset.addChecksumPair(file.path, sum) } } - writeFile(file: "${CHECKSUMFOLDER}/sha1sumlist.txt", text: sums) } return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 25d5f1f..152121c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -187,6 +187,86 @@ class ConfigurationInfo extends GISJsonSerialised { } } +class ChecksumPair extends GISJsonSerialised { + private String filepath + private String sum + + ChecksumPair(script, String filepath, String sum) { + super(checksumset.script) + this.filepath = filepath + this.sum = sum + } + + LinkedHashMap serialisationdata() { + def data = [ + 'filepath' : filepath, + 'sum' : sum, + ] + return data + } +} + +class ChecksumSet extends GISJsonSerialised { + private String artifactpath + private ArrayList checksumpairs + + ChecksumInfo(script, artifactpath) { + super(script) + this.artifactpath = artifactpath + } + + 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 + } + + LinkedHashMap serialisationdata() { + def data = [ + 'artifactpath' : artifactpath, + 'checksumpairs' : checksumpairsserialised(), + ] + return data + } + + +class ChecksumInfo extends GISJsonSerialised { + private ArrayList checksumsets + + ChecksumInfo(script) { + super(script) + } + + 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 + } + + LinkedHashMap serialisationdata() { + def data = [ + 'checksumsets' : checksumsetsserialised(), + ] + return data + } +} + class MetaInfo extends GISJsonSerialised { private String METAFOLDERNAME = "meta" private String METAFILENAME = "info.json" @@ -198,6 +278,7 @@ class MetaInfo extends GISJsonSerialised { JenkinsBuildInfo jenkinsbuildinfo BuildStampInfo buildstampinfo ReleaseInfo releaseinfo + ChecksumInfo checksuminfo private ArrayList configurationinfo private ArrayList associatedmeta @@ -208,6 +289,7 @@ class MetaInfo extends GISJsonSerialised { jenkinsbuildinfo = new JenkinsBuildInfo(script) buildstampinfo = new BuildStampInfo(script) releaseinfo = new ReleaseInfo(script) + checksuminfo = new ChecksumInfo(script) configurationinfo = new ArrayList() associatedmeta = new ArrayList() } @@ -246,6 +328,7 @@ class MetaInfo extends GISJsonSerialised { 'buildstampinfo' : buildstampinfo.serialisationdata(), 'releaseinfo' : releaseinfo.serialisationdata(), 'configuration' : configurationinfoserialised(), + 'checksuminfo' : checksuminfo.serialisationdata(), 'associatedmeta' : associatedmetaserialised(), ] return data From bebea3f7f7fd9d520ba415cadb6422bee24d6f5a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 13:15:10 +0000 Subject: [PATCH 0407/1971] Add checksum info to meta --- checksum/utils.groovy | 15 +++----- meta/folder.groovy | 83 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 11 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index 748472f..c090bf3 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -1,21 +1,14 @@ -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**" -CHECKSUMFOLDER = "${metafolder.METAFOLDERNAME}/checksums" - // Generate a checksum file of from a list of files/directories relative to workspace -def generatelist(checksummable) { - load("${autobuilder.commonscripts()}/platform/lineendings.groovy") - sums = "" +def generatelist(meta, checksummable) { for (filepath in checksummable) { - echo "Checksumming ${filepath}" + def checksumset = meta.checksuminfo.addchecksumset(filepath) def files = findFiles(glob: filepath) for (file in files) { - def sum = sha1(file: file.path) - sums += "${sum} ${file.path}${nl}" // Format suitable for sha1sum utility + def sum = sha1(file: file.path).trim() + checksumset.addChecksumPair(file.path, sum) } } - writeFile(file: "${CHECKSUMFOLDER}/sha1sumlist.txt", text: sums) } return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 25d5f1f..152121c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -187,6 +187,86 @@ class ConfigurationInfo extends GISJsonSerialised { } } +class ChecksumPair extends GISJsonSerialised { + private String filepath + private String sum + + ChecksumPair(script, String filepath, String sum) { + super(checksumset.script) + this.filepath = filepath + this.sum = sum + } + + LinkedHashMap serialisationdata() { + def data = [ + 'filepath' : filepath, + 'sum' : sum, + ] + return data + } +} + +class ChecksumSet extends GISJsonSerialised { + private String artifactpath + private ArrayList checksumpairs + + ChecksumInfo(script, artifactpath) { + super(script) + this.artifactpath = artifactpath + } + + 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 + } + + LinkedHashMap serialisationdata() { + def data = [ + 'artifactpath' : artifactpath, + 'checksumpairs' : checksumpairsserialised(), + ] + return data + } + + +class ChecksumInfo extends GISJsonSerialised { + private ArrayList checksumsets + + ChecksumInfo(script) { + super(script) + } + + 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 + } + + LinkedHashMap serialisationdata() { + def data = [ + 'checksumsets' : checksumsetsserialised(), + ] + return data + } +} + class MetaInfo extends GISJsonSerialised { private String METAFOLDERNAME = "meta" private String METAFILENAME = "info.json" @@ -198,6 +278,7 @@ class MetaInfo extends GISJsonSerialised { JenkinsBuildInfo jenkinsbuildinfo BuildStampInfo buildstampinfo ReleaseInfo releaseinfo + ChecksumInfo checksuminfo private ArrayList configurationinfo private ArrayList associatedmeta @@ -208,6 +289,7 @@ class MetaInfo extends GISJsonSerialised { jenkinsbuildinfo = new JenkinsBuildInfo(script) buildstampinfo = new BuildStampInfo(script) releaseinfo = new ReleaseInfo(script) + checksuminfo = new ChecksumInfo(script) configurationinfo = new ArrayList() associatedmeta = new ArrayList() } @@ -246,6 +328,7 @@ class MetaInfo extends GISJsonSerialised { 'buildstampinfo' : buildstampinfo.serialisationdata(), 'releaseinfo' : releaseinfo.serialisationdata(), 'configuration' : configurationinfoserialised(), + 'checksuminfo' : checksuminfo.serialisationdata(), 'associatedmeta' : associatedmetaserialised(), ] return data From 1eaf0617311f9b3608d258a6f4eebc16392ecc7b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 18:33:55 +0000 Subject: [PATCH 0408/1971] Add checksum info to meta --- meta/folder.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 152121c..9a89b70 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -192,7 +192,7 @@ class ChecksumPair extends GISJsonSerialised { private String sum ChecksumPair(script, String filepath, String sum) { - super(checksumset.script) + super(script) this.filepath = filepath this.sum = sum } @@ -210,9 +210,10 @@ class ChecksumSet extends GISJsonSerialised { private String artifactpath private ArrayList checksumpairs - ChecksumInfo(script, artifactpath) { + ChecksumSet(script, artifactpath) { super(script) this.artifactpath = artifactpath + checksumpairs = new ArrayList() } ChecksumPair addChecksumPair(String filepath, String sum) { @@ -236,17 +237,20 @@ class ChecksumSet extends GISJsonSerialised { ] return data } - +} class ChecksumInfo extends GISJsonSerialised { private ArrayList checksumsets ChecksumInfo(script) { super(script) + checksumsets = new ArrayList() } ChecksumSet addChecksumSet(String artifactpath) { + script.echo "Entering addChecksumSet" def cs = new ChecksumSet(script, artifactpath) + script.echo "Created ChecksumSet" checksumsets.add(cs) return cs } @@ -339,8 +343,7 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME } - String generateartifacts() { - def String metafilepath = "${METAFOLDERNAME}/${METAFILENAME}" + String generateartifacts(String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}") { saveJsonSerialised(metafilepath) return METAARTIFACTS } From 2b6378e8e41fe7ea26ead77643be8db2b5e8a761 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 18:33:55 +0000 Subject: [PATCH 0409/1971] Add checksum info to meta --- meta/folder.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 152121c..9a89b70 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -192,7 +192,7 @@ class ChecksumPair extends GISJsonSerialised { private String sum ChecksumPair(script, String filepath, String sum) { - super(checksumset.script) + super(script) this.filepath = filepath this.sum = sum } @@ -210,9 +210,10 @@ class ChecksumSet extends GISJsonSerialised { private String artifactpath private ArrayList checksumpairs - ChecksumInfo(script, artifactpath) { + ChecksumSet(script, artifactpath) { super(script) this.artifactpath = artifactpath + checksumpairs = new ArrayList() } ChecksumPair addChecksumPair(String filepath, String sum) { @@ -236,17 +237,20 @@ class ChecksumSet extends GISJsonSerialised { ] return data } - +} class ChecksumInfo extends GISJsonSerialised { private ArrayList checksumsets ChecksumInfo(script) { super(script) + checksumsets = new ArrayList() } ChecksumSet addChecksumSet(String artifactpath) { + script.echo "Entering addChecksumSet" def cs = new ChecksumSet(script, artifactpath) + script.echo "Created ChecksumSet" checksumsets.add(cs) return cs } @@ -339,8 +343,7 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME } - String generateartifacts() { - def String metafilepath = "${METAFOLDERNAME}/${METAFILENAME}" + String generateartifacts(String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}") { saveJsonSerialised(metafilepath) return METAARTIFACTS } From e7fb9a8805581a27fd54425d85994d1911969e5d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 18:40:12 +0000 Subject: [PATCH 0410/1971] Add checksum info to meta --- checksum/utils.groovy | 4 ++-- meta/folder.groovy | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index c090bf3..c2503cd 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -2,7 +2,7 @@ // 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 checksumset = meta.checksuminfo.addChecksumSet(filepath) def files = findFiles(glob: filepath) for (file in files) { def sum = sha1(file: file.path).trim() @@ -11,4 +11,4 @@ def generatelist(meta, checksummable) { } } -return this; +return this; \ No newline at end of file diff --git a/meta/folder.groovy b/meta/folder.groovy index 9a89b70..421fec8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -248,9 +248,7 @@ class ChecksumInfo extends GISJsonSerialised { } ChecksumSet addChecksumSet(String artifactpath) { - script.echo "Entering addChecksumSet" def cs = new ChecksumSet(script, artifactpath) - script.echo "Created ChecksumSet" checksumsets.add(cs) return cs } From 084e8367d7b1907771e65a9f1689686ca605fdc5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 18:40:12 +0000 Subject: [PATCH 0411/1971] Add checksum info to meta --- checksum/utils.groovy | 4 ++-- meta/folder.groovy | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index c090bf3..c2503cd 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -2,7 +2,7 @@ // 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 checksumset = meta.checksuminfo.addChecksumSet(filepath) def files = findFiles(glob: filepath) for (file in files) { def sum = sha1(file: file.path).trim() @@ -11,4 +11,4 @@ def generatelist(meta, checksummable) { } } -return this; +return this; \ No newline at end of file diff --git a/meta/folder.groovy b/meta/folder.groovy index 9a89b70..421fec8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -248,9 +248,7 @@ class ChecksumInfo extends GISJsonSerialised { } ChecksumSet addChecksumSet(String artifactpath) { - script.echo "Entering addChecksumSet" def cs = new ChecksumSet(script, artifactpath) - script.echo "Created ChecksumSet" checksumsets.add(cs) return cs } From d44af429e0ce3720419f221240d116601b87a4c1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 20:19:08 +0000 Subject: [PATCH 0412/1971] Add publishable items to meta --- meta/folder.groovy | 32 ++++++++++++++++++++++++++++++++ publishing/utils.groovy | 20 ++------------------ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 421fec8..7471f74 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -269,6 +269,22 @@ class ChecksumInfo extends GISJsonSerialised { } } +class PublishableInfo extends GISJsonSerialised { + private String filepath + + PublishableInfo(script, String filepath = "") { + super(script) + this.filepath = filepath + } + + LinkedHashMap serialisationdata() { + def data = [ + 'filepath' : filepath, + ] + return data + } +} + class MetaInfo extends GISJsonSerialised { private String METAFOLDERNAME = "meta" private String METAFILENAME = "info.json" @@ -282,6 +298,7 @@ class MetaInfo extends GISJsonSerialised { ReleaseInfo releaseinfo ChecksumInfo checksuminfo private ArrayList configurationinfo + private ArrayList publishableinfo private ArrayList associatedmeta MetaInfo(script) { @@ -293,6 +310,7 @@ class MetaInfo extends GISJsonSerialised { releaseinfo = new ReleaseInfo(script) checksuminfo = new ChecksumInfo(script) configurationinfo = new ArrayList() + publishableinfo = new ArrayList() associatedmeta = new ArrayList() } @@ -304,11 +322,24 @@ class MetaInfo extends GISJsonSerialised { return configuration } + void addPublishable(String filepath) { + def PublishableInfo pi = new PublishableInfo(script, filepath) + publishableinfo.add(pi) + } + void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) configurationinfo.add(ci) } + List publishableinfoserialised() { + def publishable = [] + for (publishableitem in publishableinfo) { + publishable.add(publishableitem.serialisationdata()) + } + return publishable + } + List associatedmetaserialised() { def associated = [] for (metaitem in associatedmeta) { @@ -331,6 +362,7 @@ class MetaInfo extends GISJsonSerialised { 'releaseinfo' : releaseinfo.serialisationdata(), 'configuration' : configurationinfoserialised(), 'checksuminfo' : checksuminfo.serialisationdata(), + 'publishableinfo' : publishableinfoserialised(), 'associatedmeta' : associatedmetaserialised(), ] return data diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 72c6566..145a7e9 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,26 +1,10 @@ -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -env.PUBLISHABLEARTIFACTS = "${metafolder.METAFOLDERNAME}/publishable/**" - // Generate a list of artifact files that are publishable to outside parties -def generatelist(publishable) { - def PUBLISHABLEFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/publishable" - sh """ - rm -rf "${PUBLISHABLEFOLDER}" - mkdir -p "${PUBLISHABLEFOLDER}" - """ +def generatelist(meta, publishable) { filelist = [] for (filepath in publishable) { - def files = findFiles(glob: filepath) - for (file in files) { - if (!file.directory) { - filelist.add(file.path) - } - } + meta.addPublishable(filepath) } - def outJson = readJSON text: groovy.json.JsonOutput.toJson(filelist) - def PUBLISHABLEFILE = "${PUBLISHABLEFOLDER}/list.json" - writeJSON(file: PUBLISHABLEFILE, json: outJson, pretty: 4) } return this; From 8d90a54ebd266a26ed229d56bd5c741e054ad55e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 20:19:08 +0000 Subject: [PATCH 0413/1971] Add publishable items to meta --- meta/folder.groovy | 32 ++++++++++++++++++++++++++++++++ publishing/utils.groovy | 20 ++------------------ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 421fec8..7471f74 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -269,6 +269,22 @@ class ChecksumInfo extends GISJsonSerialised { } } +class PublishableInfo extends GISJsonSerialised { + private String filepath + + PublishableInfo(script, String filepath = "") { + super(script) + this.filepath = filepath + } + + LinkedHashMap serialisationdata() { + def data = [ + 'filepath' : filepath, + ] + return data + } +} + class MetaInfo extends GISJsonSerialised { private String METAFOLDERNAME = "meta" private String METAFILENAME = "info.json" @@ -282,6 +298,7 @@ class MetaInfo extends GISJsonSerialised { ReleaseInfo releaseinfo ChecksumInfo checksuminfo private ArrayList configurationinfo + private ArrayList publishableinfo private ArrayList associatedmeta MetaInfo(script) { @@ -293,6 +310,7 @@ class MetaInfo extends GISJsonSerialised { releaseinfo = new ReleaseInfo(script) checksuminfo = new ChecksumInfo(script) configurationinfo = new ArrayList() + publishableinfo = new ArrayList() associatedmeta = new ArrayList() } @@ -304,11 +322,24 @@ class MetaInfo extends GISJsonSerialised { return configuration } + void addPublishable(String filepath) { + def PublishableInfo pi = new PublishableInfo(script, filepath) + publishableinfo.add(pi) + } + void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) configurationinfo.add(ci) } + List publishableinfoserialised() { + def publishable = [] + for (publishableitem in publishableinfo) { + publishable.add(publishableitem.serialisationdata()) + } + return publishable + } + List associatedmetaserialised() { def associated = [] for (metaitem in associatedmeta) { @@ -331,6 +362,7 @@ class MetaInfo extends GISJsonSerialised { 'releaseinfo' : releaseinfo.serialisationdata(), 'configuration' : configurationinfoserialised(), 'checksuminfo' : checksuminfo.serialisationdata(), + 'publishableinfo' : publishableinfoserialised(), 'associatedmeta' : associatedmetaserialised(), ] return data diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 72c6566..145a7e9 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,26 +1,10 @@ -metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy") -env.PUBLISHABLEARTIFACTS = "${metafolder.METAFOLDERNAME}/publishable/**" - // Generate a list of artifact files that are publishable to outside parties -def generatelist(publishable) { - def PUBLISHABLEFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/publishable" - sh """ - rm -rf "${PUBLISHABLEFOLDER}" - mkdir -p "${PUBLISHABLEFOLDER}" - """ +def generatelist(meta, publishable) { filelist = [] for (filepath in publishable) { - def files = findFiles(glob: filepath) - for (file in files) { - if (!file.directory) { - filelist.add(file.path) - } - } + meta.addPublishable(filepath) } - def outJson = readJSON text: groovy.json.JsonOutput.toJson(filelist) - def PUBLISHABLEFILE = "${PUBLISHABLEFOLDER}/list.json" - writeJSON(file: PUBLISHABLEFILE, json: outJson, pretty: 4) } return this; From e5cb43356948c2cb30e13289c80b2d08190c0c12 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 22:17:38 +0000 Subject: [PATCH 0414/1971] Add release information items to meta --- meta/folder.groovy | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7471f74..b5cc379 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -143,20 +143,35 @@ class BuildStampInfo extends GISJsonSerialised { } class ReleaseInfo extends GISJsonSerialised { - private String releasejobname + private String releaserepoURL + private ArrayList releaseitems - ReleaseInfo(script, releasejobname = "") { + ReleaseInfo(script, releaserepoURL = "") { super(script) - this.releasejobname = releasejobname + this.releaserepoURL = releaserepoURL + this.releaseitems = new ArrayList() } - void set(String releasejobname) { - this.releasejobname = releasejobname + void set(String releaserepoURL = "") { + this.releaserepoURL = releaserepoURL + } + + void addReleaseItem(String releaseitem) { + releaseitems.add(releaseitem) + } + + List releaseitemssserialised() { + def items = [] + for (ri in releaseitems) { + items.add(ri) + } + return items } LinkedHashMap serialisationdata() { def data = [ - 'releasejobname' : releasejobname, + 'releaserepoURL' : releaserepoURL, + 'releaseitems' : releaseitemssserialised(), ] return data } @@ -373,9 +388,21 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME } - String generateartifacts(String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}") { + String generateartifacts(ArrayList releasedfromhere = new ArrayList(), + ArrayList releasedfromsubmeta = new ArrayList(), + 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 METAARTIFACTS + return artifactlist } } From a06e33d10d6690247fa569a7331eb376ebfb4ab3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Nov 2018 22:17:38 +0000 Subject: [PATCH 0415/1971] Add release information items to meta --- meta/folder.groovy | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7471f74..b5cc379 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -143,20 +143,35 @@ class BuildStampInfo extends GISJsonSerialised { } class ReleaseInfo extends GISJsonSerialised { - private String releasejobname + private String releaserepoURL + private ArrayList releaseitems - ReleaseInfo(script, releasejobname = "") { + ReleaseInfo(script, releaserepoURL = "") { super(script) - this.releasejobname = releasejobname + this.releaserepoURL = releaserepoURL + this.releaseitems = new ArrayList() } - void set(String releasejobname) { - this.releasejobname = releasejobname + void set(String releaserepoURL = "") { + this.releaserepoURL = releaserepoURL + } + + void addReleaseItem(String releaseitem) { + releaseitems.add(releaseitem) + } + + List releaseitemssserialised() { + def items = [] + for (ri in releaseitems) { + items.add(ri) + } + return items } LinkedHashMap serialisationdata() { def data = [ - 'releasejobname' : releasejobname, + 'releaserepoURL' : releaserepoURL, + 'releaseitems' : releaseitemssserialised(), ] return data } @@ -373,9 +388,21 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME } - String generateartifacts(String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}") { + String generateartifacts(ArrayList releasedfromhere = new ArrayList(), + ArrayList releasedfromsubmeta = new ArrayList(), + 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 METAARTIFACTS + return artifactlist } } From 6adf4cd514083b8e249e5d86a23e88470c608267 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 17:23:17 +0000 Subject: [PATCH 0416/1971] Deserialise meta from file and associate with job meta --- import/importer.groovy | 14 ++++ meta/folder.groovy | 154 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 162 insertions(+), 6 deletions(-) create mode 100644 import/importer.groovy diff --git a/import/importer.groovy b/import/importer.groovy new file mode 100644 index 0000000..ba912f4 --- /dev/null +++ b/import/importer.groovy @@ -0,0 +1,14 @@ + +def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { + copyArtifacts( + filter: filter, + fingerprintArtifacts: fingerprint, + projectName: jenkinsjob.trim(), + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: buildselector + ], + target: destpath + ) + meta.importrelated(destpath) +} \ No newline at end of file diff --git a/meta/folder.groovy b/meta/folder.groovy index b5cc379..9d90cee 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -6,7 +6,9 @@ abstract class GISJsonSerialised implements Serializable { this.script = script } - abstract LinkedHashMap serialisationdata(); + abstract LinkedHashMap serialisationdata() + + abstract void deserialiseJson(rawmeta) def saveJsonSerialised(String outputfile, int prettylevel = 4) { def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) @@ -32,6 +34,12 @@ class ProductInfo extends GISJsonSerialised { this.jirakey = jirakey } + void deserialiseJson(rawmeta) { + productname = rawmeta['productname'] + subcomponentname = rawmeta['subcomponentname'] + jirakey = rawmeta['jirakey'] + } + LinkedHashMap serialisationdata() { def data = [ 'productname' : productname, @@ -66,6 +74,14 @@ class GitInfo extends GISJsonSerialised { 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, @@ -99,6 +115,13 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } + void deserialiseJson(rawmeta) { + buildjobname = rawmeta['buildjobname'] + buildnumber = rawmeta['buildnumber'] + buildmachine = rawmeta['buildmachine'] + builddate = rawmeta['builddate'] + } + LinkedHashMap serialisationdata() { def data = [ 'buildjobname' : buildjobname, @@ -131,6 +154,13 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } + void deserialiseJson(rawmeta) { + buildstampprefix = rawmeta['buildstampprefix'] + revision = rawmeta['revision'] + buildstamp = rawmeta['buildstamp'] + buildstampcommasep = rawmeta['buildstampcommasep'] + } + LinkedHashMap serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, @@ -168,6 +198,14 @@ class ReleaseInfo extends GISJsonSerialised { return items } + void deserialiseJson(rawmeta) { + releaserepoURL = rawmeta['releaserepoURL'] + releaseitems = new ArrayList() + for (rawreleaseitem in rawmeta['releaseitems']) { + releaseitems.add(rawreleaseitem) + } + } + LinkedHashMap serialisationdata() { def data = [ 'releaserepoURL' : releaserepoURL, @@ -191,6 +229,13 @@ class ConfigurationInfo extends GISJsonSerialised { this.configurationSHA = configurationSHA } + void deserialiseJson(rawmeta) { + configurationname = rawmeta['configurationname'] + configurationURL = rawmeta['configurationURL'] + configurationversion = rawmeta['configurationversion'] + configurationSHA = rawmeta['configurationSHA'] + } + LinkedHashMap serialisationdata() { def data = [ 'configurationname' : configurationname, @@ -212,6 +257,11 @@ class ChecksumPair extends GISJsonSerialised { this.sum = sum } + void deserialiseJson(rawmeta) { + filepath = rawmeta['filepath'] + sum = rawmeta['sum'] + } + LinkedHashMap serialisationdata() { def data = [ 'filepath' : filepath, @@ -245,6 +295,16 @@ class ChecksumSet extends GISJsonSerialised { 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, @@ -276,6 +336,15 @@ class ChecksumInfo extends GISJsonSerialised { 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(), @@ -292,6 +361,10 @@ class PublishableInfo extends GISJsonSerialised { this.filepath = filepath } + void deserialiseJson(rawmeta) { + filepath = rawmeta['filepath'] + } + LinkedHashMap serialisationdata() { def data = [ 'filepath' : filepath, @@ -301,11 +374,37 @@ class PublishableInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { + private String FORMAT = "0.1" private String METAFOLDERNAME = "meta" private String METAFILENAME = "info.json" private String METAARTIFACTS = "${METAFOLDERNAME}/**" - private String format = '0.1' + 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 @@ -314,7 +413,7 @@ class MetaInfo extends GISJsonSerialised { ChecksumInfo checksuminfo private ArrayList configurationinfo private ArrayList publishableinfo - private ArrayList associatedmeta + private ArrayList associatedmeta MetaInfo(script) { super(script) @@ -326,7 +425,7 @@ class MetaInfo extends GISJsonSerialised { checksuminfo = new ChecksumInfo(script) configurationinfo = new ArrayList() publishableinfo = new ArrayList() - associatedmeta = new ArrayList() + associatedmeta = new ArrayList() } List configurationinfoserialised() { @@ -363,8 +462,51 @@ class MetaInfo extends GISJsonSerialised { return associated } - void addAssociatedMetaInfo(mi) { - associatedmeta.add(mi) + 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) + } + for (rawrelatedmeta in rawmeta['associatedmeta']) { + def rm = new RelatedMetaInfo(script) + rm.deserialiseJson(rawrelatedmeta) + associatedmeta.add(rm) + } + } + + def deserialiseJson(String filepath) { + def rawmeta = script.readJSON(file: filepath) + deserialiseJson(rawmeta) + } + + MetaInfo importrelated(String destpath) { + MetaInfo mi = new MetaInfo(script) + + def importedmetafile = destpath + "/" + METAFOLDERNAME + "/" + METAFILENAME + if (script.fileExists(importedmetafile)) { + mi.deserialiseJson(importedmetafile) + } + + RelatedMetaInfo rmi = new RelatedMetaInfo(script, destpath, mi) + associatedmeta.add(rmi) + + return mi } LinkedHashMap serialisationdata() { From f14ce9fc0cf3d85cbc66a8f4155515c538dd603c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 17:23:17 +0000 Subject: [PATCH 0417/1971] Deserialise meta from file and associate with job meta --- import/importer.groovy | 14 ++++ meta/folder.groovy | 154 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 162 insertions(+), 6 deletions(-) create mode 100644 import/importer.groovy diff --git a/import/importer.groovy b/import/importer.groovy new file mode 100644 index 0000000..ba912f4 --- /dev/null +++ b/import/importer.groovy @@ -0,0 +1,14 @@ + +def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { + copyArtifacts( + filter: filter, + fingerprintArtifacts: fingerprint, + projectName: jenkinsjob.trim(), + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: buildselector + ], + target: destpath + ) + meta.importrelated(destpath) +} \ No newline at end of file diff --git a/meta/folder.groovy b/meta/folder.groovy index b5cc379..9d90cee 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -6,7 +6,9 @@ abstract class GISJsonSerialised implements Serializable { this.script = script } - abstract LinkedHashMap serialisationdata(); + abstract LinkedHashMap serialisationdata() + + abstract void deserialiseJson(rawmeta) def saveJsonSerialised(String outputfile, int prettylevel = 4) { def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata()) @@ -32,6 +34,12 @@ class ProductInfo extends GISJsonSerialised { this.jirakey = jirakey } + void deserialiseJson(rawmeta) { + productname = rawmeta['productname'] + subcomponentname = rawmeta['subcomponentname'] + jirakey = rawmeta['jirakey'] + } + LinkedHashMap serialisationdata() { def data = [ 'productname' : productname, @@ -66,6 +74,14 @@ class GitInfo extends GISJsonSerialised { 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, @@ -99,6 +115,13 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.builddate = builddate } + void deserialiseJson(rawmeta) { + buildjobname = rawmeta['buildjobname'] + buildnumber = rawmeta['buildnumber'] + buildmachine = rawmeta['buildmachine'] + builddate = rawmeta['builddate'] + } + LinkedHashMap serialisationdata() { def data = [ 'buildjobname' : buildjobname, @@ -131,6 +154,13 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } + void deserialiseJson(rawmeta) { + buildstampprefix = rawmeta['buildstampprefix'] + revision = rawmeta['revision'] + buildstamp = rawmeta['buildstamp'] + buildstampcommasep = rawmeta['buildstampcommasep'] + } + LinkedHashMap serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, @@ -168,6 +198,14 @@ class ReleaseInfo extends GISJsonSerialised { return items } + void deserialiseJson(rawmeta) { + releaserepoURL = rawmeta['releaserepoURL'] + releaseitems = new ArrayList() + for (rawreleaseitem in rawmeta['releaseitems']) { + releaseitems.add(rawreleaseitem) + } + } + LinkedHashMap serialisationdata() { def data = [ 'releaserepoURL' : releaserepoURL, @@ -191,6 +229,13 @@ class ConfigurationInfo extends GISJsonSerialised { this.configurationSHA = configurationSHA } + void deserialiseJson(rawmeta) { + configurationname = rawmeta['configurationname'] + configurationURL = rawmeta['configurationURL'] + configurationversion = rawmeta['configurationversion'] + configurationSHA = rawmeta['configurationSHA'] + } + LinkedHashMap serialisationdata() { def data = [ 'configurationname' : configurationname, @@ -212,6 +257,11 @@ class ChecksumPair extends GISJsonSerialised { this.sum = sum } + void deserialiseJson(rawmeta) { + filepath = rawmeta['filepath'] + sum = rawmeta['sum'] + } + LinkedHashMap serialisationdata() { def data = [ 'filepath' : filepath, @@ -245,6 +295,16 @@ class ChecksumSet extends GISJsonSerialised { 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, @@ -276,6 +336,15 @@ class ChecksumInfo extends GISJsonSerialised { 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(), @@ -292,6 +361,10 @@ class PublishableInfo extends GISJsonSerialised { this.filepath = filepath } + void deserialiseJson(rawmeta) { + filepath = rawmeta['filepath'] + } + LinkedHashMap serialisationdata() { def data = [ 'filepath' : filepath, @@ -301,11 +374,37 @@ class PublishableInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { + private String FORMAT = "0.1" private String METAFOLDERNAME = "meta" private String METAFILENAME = "info.json" private String METAARTIFACTS = "${METAFOLDERNAME}/**" - private String format = '0.1' + 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 @@ -314,7 +413,7 @@ class MetaInfo extends GISJsonSerialised { ChecksumInfo checksuminfo private ArrayList configurationinfo private ArrayList publishableinfo - private ArrayList associatedmeta + private ArrayList associatedmeta MetaInfo(script) { super(script) @@ -326,7 +425,7 @@ class MetaInfo extends GISJsonSerialised { checksuminfo = new ChecksumInfo(script) configurationinfo = new ArrayList() publishableinfo = new ArrayList() - associatedmeta = new ArrayList() + associatedmeta = new ArrayList() } List configurationinfoserialised() { @@ -363,8 +462,51 @@ class MetaInfo extends GISJsonSerialised { return associated } - void addAssociatedMetaInfo(mi) { - associatedmeta.add(mi) + 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) + } + for (rawrelatedmeta in rawmeta['associatedmeta']) { + def rm = new RelatedMetaInfo(script) + rm.deserialiseJson(rawrelatedmeta) + associatedmeta.add(rm) + } + } + + def deserialiseJson(String filepath) { + def rawmeta = script.readJSON(file: filepath) + deserialiseJson(rawmeta) + } + + MetaInfo importrelated(String destpath) { + MetaInfo mi = new MetaInfo(script) + + def importedmetafile = destpath + "/" + METAFOLDERNAME + "/" + METAFILENAME + if (script.fileExists(importedmetafile)) { + mi.deserialiseJson(importedmetafile) + } + + RelatedMetaInfo rmi = new RelatedMetaInfo(script, destpath, mi) + associatedmeta.add(rmi) + + return mi } LinkedHashMap serialisationdata() { From 214f2db8da535ed2cc88562a995e922343ccf837 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 18:51:51 +0000 Subject: [PATCH 0418/1971] Deserialise meta from file and associate with job meta --- import/importer.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index ba912f4..d3c97e4 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -11,4 +11,6 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat target: destpath ) meta.importrelated(destpath) -} \ No newline at end of file +} + +return this; \ No newline at end of file From 53878daf609b8eacf1dd815b89cc4d1e8507d5a1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 18:51:51 +0000 Subject: [PATCH 0419/1971] Deserialise meta from file and associate with job meta --- import/importer.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index ba912f4..d3c97e4 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -11,4 +11,6 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat target: destpath ) meta.importrelated(destpath) -} \ No newline at end of file +} + +return this; \ No newline at end of file From 5d333d926dd73727555dfbad94768e9d91a26b69 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 19:54:32 +0000 Subject: [PATCH 0420/1971] Store offset paths relative to WORKSPACE if given as absolute paths --- meta/folder.groovy | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9d90cee..28fe85f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,3 +1,5 @@ +import java.nio.file.Paths +import java.nio.file.Path abstract class GISJsonSerialised implements Serializable { def script @@ -494,16 +496,27 @@ class MetaInfo extends GISJsonSerialised { def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } + + String relativize(String path) { + def Path thispath = Paths.get(path) + if (thispath.startsWith(script.WORKSPACE)) { + def Path wspath = Paths.get(script.WORKSPACE) + def Path wsrelativePath = wspath.relativize(thispath) + return wsrelativePath.toString() + } + return path + } MetaInfo importrelated(String destpath) { MetaInfo mi = new MetaInfo(script) - def importedmetafile = destpath + "/" + METAFOLDERNAME + "/" + METAFILENAME + def String adjustedpath = relativize(destpath) + def importedmetafile = adjustedpath + "/" + METAFOLDERNAME + "/" + METAFILENAME if (script.fileExists(importedmetafile)) { mi.deserialiseJson(importedmetafile) } - RelatedMetaInfo rmi = new RelatedMetaInfo(script, destpath, mi) + RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) associatedmeta.add(rmi) return mi From 929c18f5b690313da022d54bd815b8b0aab76dc8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 19:54:32 +0000 Subject: [PATCH 0421/1971] Store offset paths relative to WORKSPACE if given as absolute paths --- meta/folder.groovy | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9d90cee..28fe85f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,3 +1,5 @@ +import java.nio.file.Paths +import java.nio.file.Path abstract class GISJsonSerialised implements Serializable { def script @@ -494,16 +496,27 @@ class MetaInfo extends GISJsonSerialised { def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } + + String relativize(String path) { + def Path thispath = Paths.get(path) + if (thispath.startsWith(script.WORKSPACE)) { + def Path wspath = Paths.get(script.WORKSPACE) + def Path wsrelativePath = wspath.relativize(thispath) + return wsrelativePath.toString() + } + return path + } MetaInfo importrelated(String destpath) { MetaInfo mi = new MetaInfo(script) - def importedmetafile = destpath + "/" + METAFOLDERNAME + "/" + METAFILENAME + def String adjustedpath = relativize(destpath) + def importedmetafile = adjustedpath + "/" + METAFOLDERNAME + "/" + METAFILENAME if (script.fileExists(importedmetafile)) { mi.deserialiseJson(importedmetafile) } - RelatedMetaInfo rmi = new RelatedMetaInfo(script, destpath, mi) + RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) associatedmeta.add(rmi) return mi From 61b8d45657d6d84ddcb853c8af90817810ff732b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 20:06:10 +0000 Subject: [PATCH 0422/1971] Only show SHA code of configuration --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 031094b..cb9354b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -2,7 +2,7 @@ clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { - return clh.getCommandOutput('git log -1 --format=oneline') + return clh.getCommandOutput('git rev-parse HEAD') } } From 8d119dcdbc340866d01f763a592649a445d4cd38 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 20:06:10 +0000 Subject: [PATCH 0423/1971] Only show SHA code of configuration --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 031094b..cb9354b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -2,7 +2,7 @@ clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { - return clh.getCommandOutput('git log -1 --format=oneline') + return clh.getCommandOutput('git rev-parse HEAD') } } From 31918ae70080d0ba226f2896362fb2f73c176e54 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 21:05:06 +0000 Subject: [PATCH 0424/1971] Handle more version number strings --- versionnumbering/generate.groovy | 46 +++++++++++++++++--------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 16fb1a9..59fe2a3 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -28,6 +28,8 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { // origin/master // origin/2.0.x def getVersionPrefix(String sourcebranch) { + def int MAXVERSIONNUMBER = 65535 + echo "Determining version number prefix from source branch name: ${sourcebranch}" sourcebranch = sourcebranch.toLowerCase() @@ -51,43 +53,45 @@ def getVersionPrefix(String sourcebranch) { echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" return thirdpartyversionprefix } - splits = [] + for (split in splits2) { - if (split.isInteger()) { - splits.add(split) - } - else if (split == "x") { + 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 (splits.size() < 1) { + if (integers.size() < 1) { echo "This source branch name has no numbers in its name so defaulting to: ${defaultversionprefix}" versionprefix = defaultversionprefix } else { - def int splitnumbercount = 0 - for (split in splits) { - if (split.isInteger()) { - versionprefix += split + "." - splitnumbercount += 1 - } - else if (splitnumbercount > 2) { + def int integernumbercount = 0 + for (integer in integers) { + versionprefix += integer + "." + integernumbercount += 1 + if (integernumbercount > 2) { break } } - if (splitnumbercount == 0) { + if (integernumbercount == 0) { echo "No leading numbers were found in source branch name so defaulting to: ${defaultversionprefix}" versionprefix = defaultversionprefix } - else { - if (splitnumbercount == 1) { - versionprefix += "0.0." - } - else if (splitnumbercount == 2) { - versionprefix += "0." - } + else if (integernumbercount == 1) { + versionprefix += "0.0." + } + else if (integernumbercount == 2) { + versionprefix += "0." } } echo "Determined version prefix to be: ${versionprefix}" From 9b51bd7cf89adcbd1de56613d51d22336bec760c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 21:05:06 +0000 Subject: [PATCH 0425/1971] Handle more version number strings --- versionnumbering/generate.groovy | 46 +++++++++++++++++--------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 16fb1a9..59fe2a3 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -28,6 +28,8 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { // origin/master // origin/2.0.x def getVersionPrefix(String sourcebranch) { + def int MAXVERSIONNUMBER = 65535 + echo "Determining version number prefix from source branch name: ${sourcebranch}" sourcebranch = sourcebranch.toLowerCase() @@ -51,43 +53,45 @@ def getVersionPrefix(String sourcebranch) { echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" return thirdpartyversionprefix } - splits = [] + for (split in splits2) { - if (split.isInteger()) { - splits.add(split) - } - else if (split == "x") { + 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 (splits.size() < 1) { + if (integers.size() < 1) { echo "This source branch name has no numbers in its name so defaulting to: ${defaultversionprefix}" versionprefix = defaultversionprefix } else { - def int splitnumbercount = 0 - for (split in splits) { - if (split.isInteger()) { - versionprefix += split + "." - splitnumbercount += 1 - } - else if (splitnumbercount > 2) { + def int integernumbercount = 0 + for (integer in integers) { + versionprefix += integer + "." + integernumbercount += 1 + if (integernumbercount > 2) { break } } - if (splitnumbercount == 0) { + if (integernumbercount == 0) { echo "No leading numbers were found in source branch name so defaulting to: ${defaultversionprefix}" versionprefix = defaultversionprefix } - else { - if (splitnumbercount == 1) { - versionprefix += "0.0." - } - else if (splitnumbercount == 2) { - versionprefix += "0." - } + else if (integernumbercount == 1) { + versionprefix += "0.0." + } + else if (integernumbercount == 2) { + versionprefix += "0." } } echo "Determined version prefix to be: ${versionprefix}" From 9bd5d03e498beec93f8caba72ff45753d7595e3f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 21:36:36 +0000 Subject: [PATCH 0426/1971] Parameterise the release repo --- autobuilder.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index bbe7bb9..732e268 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -40,7 +40,9 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) - + + meta.releaseinfo.set(releaserepo) + def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From 3bad7e2597a9242c529a66b3dbb2949de572ac79 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 21:36:36 +0000 Subject: [PATCH 0427/1971] Parameterise the release repo --- autobuilder.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index bbe7bb9..732e268 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -26,7 +26,7 @@ def getautobuildpath() { } // Start up boilderplate -def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -40,7 +40,9 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) - + + meta.releaseinfo.set(releaserepo) + def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From ce1ac15aac688b102ec175f8bab6714555da7db1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 22:20:04 +0000 Subject: [PATCH 0428/1971] Check for existence of release repo by checking it out --- autobuilder.groovy | 3 ++- release/registerrepo.groovy | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 release/registerrepo.groovy diff --git a/autobuilder.groovy b/autobuilder.groovy index 732e268..2a04925 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -41,7 +41,8 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) - meta.releaseinfo.set(releaserepo) + def rr = load("${commonscripts()}/release/registerrepo.groovy") + rr.registerrepo(meta, releaserepo) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy new file mode 100644 index 0000000..1fc76ab --- /dev/null +++ b/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.gitCheckout(releaserepo, "origin/master", "meta/releaserepo") + } + meta.releaseinfo.set(releaserepo) +} + +return this; From 3eb169c9da50d78f63ac92c33a7a8fd585049ef0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 22:20:04 +0000 Subject: [PATCH 0429/1971] Check for existence of release repo by checking it out --- autobuilder.groovy | 3 ++- release/registerrepo.groovy | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 release/registerrepo.groovy diff --git a/autobuilder.groovy b/autobuilder.groovy index 732e268..2a04925 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -41,7 +41,8 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) - meta.releaseinfo.set(releaserepo) + def rr = load("${commonscripts()}/release/registerrepo.groovy") + rr.registerrepo(meta, releaserepo) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy new file mode 100644 index 0000000..1fc76ab --- /dev/null +++ b/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.gitCheckout(releaserepo, "origin/master", "meta/releaserepo") + } + meta.releaseinfo.set(releaserepo) +} + +return this; From dcbf2c6e116c256dc7a66f76ab9195d7b9836ba5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 22:32:50 +0000 Subject: [PATCH 0430/1971] Save the temp repo load in a tmp folder --- release/registerrepo.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy index 1fc76ab..ff4d85d 100644 --- a/release/registerrepo.groovy +++ b/release/registerrepo.groovy @@ -4,7 +4,7 @@ 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.gitCheckout(releaserepo, "origin/master", "meta/releaserepo") + vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo") } meta.releaseinfo.set(releaserepo) } From d297db525283febc1e133fb294a0a66b94e1d372 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 22:32:50 +0000 Subject: [PATCH 0431/1971] Save the temp repo load in a tmp folder --- release/registerrepo.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy index 1fc76ab..ff4d85d 100644 --- a/release/registerrepo.groovy +++ b/release/registerrepo.groovy @@ -4,7 +4,7 @@ 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.gitCheckout(releaserepo, "origin/master", "meta/releaserepo") + vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo") } meta.releaseinfo.set(releaserepo) } From 59afde3c0f7ce382c624e44768bb7ff80823302b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 22:59:38 +0000 Subject: [PATCH 0432/1971] Make compile job use meta --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 28fe85f..0f9e0d5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -138,8 +138,8 @@ class JenkinsBuildInfo extends GISJsonSerialised { class BuildStampInfo extends GISJsonSerialised { private String buildstampprefix private int revision - private String buildstamp - private String buildstampcommasep + String buildstamp + String buildstampcommasep BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "", buildstampcommasep = "") { super(script) From 0a7a6673bcb7f21a84fb37fb85f15aa846c2591e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Nov 2018 22:59:38 +0000 Subject: [PATCH 0433/1971] Make compile job use meta --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 28fe85f..0f9e0d5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -138,8 +138,8 @@ class JenkinsBuildInfo extends GISJsonSerialised { class BuildStampInfo extends GISJsonSerialised { private String buildstampprefix private int revision - private String buildstamp - private String buildstampcommasep + String buildstamp + String buildstampcommasep BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "", buildstampcommasep = "") { super(script) From c6268663842da55ff11e820aa738246e5a1d1e91 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Nov 2018 11:24:37 +0000 Subject: [PATCH 0434/1971] Rename compile_init --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0f9e0d5..189014c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -162,7 +162,7 @@ class BuildStampInfo extends GISJsonSerialised { buildstamp = rawmeta['buildstamp'] buildstampcommasep = rawmeta['buildstampcommasep'] } - + LinkedHashMap serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, From c9a8032b36143cd19a38416561047a8948afbd6e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Nov 2018 11:24:37 +0000 Subject: [PATCH 0435/1971] Rename compile_init --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0f9e0d5..189014c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -162,7 +162,7 @@ class BuildStampInfo extends GISJsonSerialised { buildstamp = rawmeta['buildstamp'] buildstampcommasep = rawmeta['buildstampcommasep'] } - + LinkedHashMap serialisationdata() { def data = [ 'buildstampprefix' : buildstampprefix, From 78d78c5f8fc2d4a331e0e30752b25244339a9e1c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Nov 2018 12:34:53 +0000 Subject: [PATCH 0436/1971] Correct checksumset deserialisation --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 189014c..e9491fe 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -253,7 +253,7 @@ class ChecksumPair extends GISJsonSerialised { private String filepath private String sum - ChecksumPair(script, String filepath, String sum) { + ChecksumPair(script, String filepath = "", String sum = "") { super(script) this.filepath = filepath this.sum = sum @@ -277,7 +277,7 @@ class ChecksumSet extends GISJsonSerialised { private String artifactpath private ArrayList checksumpairs - ChecksumSet(script, artifactpath) { + ChecksumSet(script, artifactpath = "") { super(script) this.artifactpath = artifactpath checksumpairs = new ArrayList() From b5d80d67e8e3f561ca4e4c56db73cfc84fcce77d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Nov 2018 12:34:53 +0000 Subject: [PATCH 0437/1971] Correct checksumset deserialisation --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 189014c..e9491fe 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -253,7 +253,7 @@ class ChecksumPair extends GISJsonSerialised { private String filepath private String sum - ChecksumPair(script, String filepath, String sum) { + ChecksumPair(script, String filepath = "", String sum = "") { super(script) this.filepath = filepath this.sum = sum @@ -277,7 +277,7 @@ class ChecksumSet extends GISJsonSerialised { private String artifactpath private ArrayList checksumpairs - ChecksumSet(script, artifactpath) { + ChecksumSet(script, artifactpath = "") { super(script) this.artifactpath = artifactpath checksumpairs = new ArrayList() From fd572074f1916cdade51a53e4d93fcdb735deb20 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Nov 2018 13:18:35 +0000 Subject: [PATCH 0438/1971] Move image create job to use meta --- meta/folder.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index e9491fe..8f26265 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -507,11 +507,15 @@ class MetaInfo extends GISJsonSerialised { return path } + String metafilepath() { + return METAFOLDERNAME + "/" + METAFILENAME + } + MetaInfo importrelated(String destpath) { MetaInfo mi = new MetaInfo(script) def String adjustedpath = relativize(destpath) - def importedmetafile = adjustedpath + "/" + METAFOLDERNAME + "/" + METAFILENAME + def importedmetafile = adjustedpath + "/" + metafilepath() if (script.fileExists(importedmetafile)) { mi.deserialiseJson(importedmetafile) } From 3752aa82ca371a5e4f278fb1821587265e580cf8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Nov 2018 13:18:35 +0000 Subject: [PATCH 0439/1971] Move image create job to use meta --- meta/folder.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index e9491fe..8f26265 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -507,11 +507,15 @@ class MetaInfo extends GISJsonSerialised { return path } + String metafilepath() { + return METAFOLDERNAME + "/" + METAFILENAME + } + MetaInfo importrelated(String destpath) { MetaInfo mi = new MetaInfo(script) def String adjustedpath = relativize(destpath) - def importedmetafile = adjustedpath + "/" + METAFOLDERNAME + "/" + METAFILENAME + def importedmetafile = adjustedpath + "/" + metafilepath() if (script.fileExists(importedmetafile)) { mi.deserialiseJson(importedmetafile) } From 0e31f84cf9f589fac5b14a398a03b45ad617ed96 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Nov 2018 14:14:13 +0000 Subject: [PATCH 0440/1971] Update build job to meta --- artifacts/metaexport.groovy | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 66a8153..0cfc773 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,21 +1,19 @@ // Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders -def combineSubjobArtifacts(subJobs) { - artifactFolders = "" - for (subJob in subJobs) { - subJobObject = subJob[0] - artifactFolder = subJob[1] - if (subJobObject != null) { - subJobName = subJobObject.getProjectName() - subJobNumber = subJobObject.getNumber() - destFolder = "${artifactFolder}" +def combineSubjobArtifacts(meta, subJobs) { + def im = load("${commonscripts()}/import/importer.groovy") - dir("${destFolder}") { + def artifactFolders = "" + for (subJob in subJobs) { + def subJobObject = subJob[0] + if (subJobObject != null) { + def subJobName = subJobObject.getProjectName() + def subJobNumber = subJobObject.getNumber() + destFolder = subJob[1] + dir(destFolder) { deleteDir() } - - echo "Copying artifacts from: Job: ${subJobName} Number: ${subJobNumber} to folder: ${destFolder}" - copyArtifacts fingerprintArtifacts: true, projectName: "${subJobName}", selector: specific("${subJobNumber}"), target: "${destFolder}" + im.artifactimport(meta, subJobName, specific(subJobNumber), destFolder) artifactFolders += "${destFolder}/**," } } From f50bbb36abbcc4e49af0c919afa51b706970e4dc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 24 Nov 2018 14:14:13 +0000 Subject: [PATCH 0441/1971] Update build job to meta --- artifacts/metaexport.groovy | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 66a8153..0cfc773 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,21 +1,19 @@ // Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders -def combineSubjobArtifacts(subJobs) { - artifactFolders = "" - for (subJob in subJobs) { - subJobObject = subJob[0] - artifactFolder = subJob[1] - if (subJobObject != null) { - subJobName = subJobObject.getProjectName() - subJobNumber = subJobObject.getNumber() - destFolder = "${artifactFolder}" +def combineSubjobArtifacts(meta, subJobs) { + def im = load("${commonscripts()}/import/importer.groovy") - dir("${destFolder}") { + def artifactFolders = "" + for (subJob in subJobs) { + def subJobObject = subJob[0] + if (subJobObject != null) { + def subJobName = subJobObject.getProjectName() + def subJobNumber = subJobObject.getNumber() + destFolder = subJob[1] + dir(destFolder) { deleteDir() } - - echo "Copying artifacts from: Job: ${subJobName} Number: ${subJobNumber} to folder: ${destFolder}" - copyArtifacts fingerprintArtifacts: true, projectName: "${subJobName}", selector: specific("${subJobNumber}"), target: "${destFolder}" + im.artifactimport(meta, subJobName, specific(subJobNumber), destFolder) artifactFolders += "${destFolder}/**," } } From 8522eb079ab4171be303505102dfaa7551fdc92c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 25 Nov 2018 17:01:32 +0000 Subject: [PATCH 0442/1971] Update build job to meta --- artifacts/metaexport.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 0cfc773..016add9 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,7 +1,7 @@ // 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, subJobs) { - def im = load("${commonscripts()}/import/importer.groovy") + def im = load("${autobuilder.commonscripts()}/import/importer.groovy") def artifactFolders = "" for (subJob in subJobs) { From ee97d816c8cbb5de9f4224a34c48a525ebb048ce Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 25 Nov 2018 17:01:32 +0000 Subject: [PATCH 0443/1971] Update build job to meta --- artifacts/metaexport.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 0cfc773..016add9 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,7 +1,7 @@ // 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, subJobs) { - def im = load("${commonscripts()}/import/importer.groovy") + def im = load("${autobuilder.commonscripts()}/import/importer.groovy") def artifactFolders = "" for (subJob in subJobs) { From 59d7b3f00f8433982a621d918b696c0d889abeaa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 25 Nov 2018 23:19:27 +0000 Subject: [PATCH 0444/1971] Make release job use meta --- artifacts/metaexport.groovy | 4 ++-- import/importer.groovy | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 016add9..62a6ba4 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,7 +1,7 @@ // 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, subJobs) { - def im = load("${autobuilder.commonscripts()}/import/importer.groovy") + def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def artifactFolders = "" for (subJob in subJobs) { @@ -13,7 +13,7 @@ def combineSubjobArtifacts(meta, subJobs) { dir(destFolder) { deleteDir() } - im.artifactimport(meta, subJobName, specific(subJobNumber), destFolder) + importer.artifactimport(meta, subJobName, subJobNumber, destFolder) artifactFolders += "${destFolder}/**," } } diff --git a/import/importer.groovy b/import/importer.groovy index d3c97e4..a9e28b2 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,4 +1,15 @@ +def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', boolean fingerprint = false) { + copyArtifacts( + filter: filter, + fingerprintArtifacts: fingerprint, + projectName: jenkinsjob.trim(), + selector: specific(buildnumber.toString()), + target: destpath + ) + meta.importrelated(destpath) +} + def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { copyArtifacts( filter: filter, @@ -13,4 +24,4 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat meta.importrelated(destpath) } -return this; \ No newline at end of file +return this; From 36b2d8bd90195a63d8864c1deba918e632fec38c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 25 Nov 2018 23:19:27 +0000 Subject: [PATCH 0445/1971] Make release job use meta --- artifacts/metaexport.groovy | 4 ++-- import/importer.groovy | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 016add9..62a6ba4 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,7 +1,7 @@ // 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, subJobs) { - def im = load("${autobuilder.commonscripts()}/import/importer.groovy") + def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def artifactFolders = "" for (subJob in subJobs) { @@ -13,7 +13,7 @@ def combineSubjobArtifacts(meta, subJobs) { dir(destFolder) { deleteDir() } - im.artifactimport(meta, subJobName, specific(subJobNumber), destFolder) + importer.artifactimport(meta, subJobName, subJobNumber, destFolder) artifactFolders += "${destFolder}/**," } } diff --git a/import/importer.groovy b/import/importer.groovy index d3c97e4..a9e28b2 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,4 +1,15 @@ +def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', boolean fingerprint = false) { + copyArtifacts( + filter: filter, + fingerprintArtifacts: fingerprint, + projectName: jenkinsjob.trim(), + selector: specific(buildnumber.toString()), + target: destpath + ) + meta.importrelated(destpath) +} + def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { copyArtifacts( filter: filter, @@ -13,4 +24,4 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat meta.importrelated(destpath) } -return this; \ No newline at end of file +return this; From 314da99324a31ab00a74d0e723304d483f55f222 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 08:29:56 +0000 Subject: [PATCH 0446/1971] Build up list of artifacts --- artifacts/metaexport.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 62a6ba4..cf5e9b3 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -3,7 +3,7 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def artifactFolders = "" + def artifactFolders = [] for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { @@ -14,7 +14,7 @@ def combineSubjobArtifacts(meta, subJobs) { deleteDir() } importer.artifactimport(meta, subJobName, subJobNumber, destFolder) - artifactFolders += "${destFolder}/**," + artifactFolders.add("${destFolder}/**") } } return artifactFolders; From 9106a00c932747ee5fd0a6baf4cf95d811b60c71 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 08:29:56 +0000 Subject: [PATCH 0447/1971] Build up list of artifacts --- artifacts/metaexport.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 62a6ba4..cf5e9b3 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -3,7 +3,7 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def artifactFolders = "" + def artifactFolders = [] for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { @@ -14,7 +14,7 @@ def combineSubjobArtifacts(meta, subJobs) { deleteDir() } importer.artifactimport(meta, subJobName, subJobNumber, destFolder) - artifactFolders += "${destFolder}/**," + artifactFolders.add("${destFolder}/**") } } return artifactFolders; From eb1bef6b699296f5e027c71f8e53bbbcfbec5421 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 11:16:53 +0000 Subject: [PATCH 0448/1971] Explicitly return artifact list as ArrayList --- artifacts/metaexport.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index cf5e9b3..b6a832b 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -3,7 +3,7 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def artifactFolders = [] + def ArrayList artifactFolders = new ArrayList() for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { From 0150bf139f8e29a8816c786a4ea01f8bce10ecf6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 11:16:53 +0000 Subject: [PATCH 0449/1971] Explicitly return artifact list as ArrayList --- artifacts/metaexport.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index cf5e9b3..b6a832b 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -3,7 +3,7 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def artifactFolders = [] + def ArrayList artifactFolders = new ArrayList() for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { From 85de3c5974d87ef1843df4cbc8275aea08f10087 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 18:17:55 +0000 Subject: [PATCH 0450/1971] Walk meta data for release info --- import/importer.groovy | 4 ++-- meta/folder.groovy | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index a9e28b2..4d24d30 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -7,7 +7,7 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, St selector: specific(buildnumber.toString()), target: destpath ) - meta.importrelated(destpath) + return meta.importrelated(destpath) } def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { @@ -21,7 +21,7 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat ], target: destpath ) - meta.importrelated(destpath) + return meta.importrelated(destpath) } return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 8f26265..c2c30a4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -175,8 +175,8 @@ class BuildStampInfo extends GISJsonSerialised { } class ReleaseInfo extends GISJsonSerialised { - private String releaserepoURL - private ArrayList releaseitems + String releaserepoURL + ArrayList releaseitems ReleaseInfo(script, releaserepoURL = "") { super(script) @@ -563,6 +563,26 @@ class MetaInfo extends GISJsonSerialised { saveJsonSerialised(metafilepath) return artifactlist } + + // Recurse tree of meta looking for release info and accumulate path + private ArrayList releasewalkerp(ArrayList releasemetacollection, String pathsofar) { + if (releaseinfo.releaserepoURL) { + ArrayList rmi(script, pathsofar, this) + releasemetacollection.add(rmi) + } + for (relatedmetainfo in associatedmeta) { + MetaInfo othermeta = relatedmetainfo.meta + String newpathsofar = pathsofar + "/" + relatedmetainfo.offsetpath + releasemetacollection = releasewalkerp(releasemetacollection, newpathsofar) + } + return releasemetacollection + } + + ArrayList releasewalker(String startpath = "") { + ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(releasemetacollection, startpath) + return releasemetacollection + } } MetaInfo metareset(script) { From 7e58b0b5a1babecf042aafc4e79651b8819658d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 18:17:55 +0000 Subject: [PATCH 0451/1971] Walk meta data for release info --- import/importer.groovy | 4 ++-- meta/folder.groovy | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index a9e28b2..4d24d30 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -7,7 +7,7 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, St selector: specific(buildnumber.toString()), target: destpath ) - meta.importrelated(destpath) + return meta.importrelated(destpath) } def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { @@ -21,7 +21,7 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat ], target: destpath ) - meta.importrelated(destpath) + return meta.importrelated(destpath) } return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 8f26265..c2c30a4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -175,8 +175,8 @@ class BuildStampInfo extends GISJsonSerialised { } class ReleaseInfo extends GISJsonSerialised { - private String releaserepoURL - private ArrayList releaseitems + String releaserepoURL + ArrayList releaseitems ReleaseInfo(script, releaserepoURL = "") { super(script) @@ -563,6 +563,26 @@ class MetaInfo extends GISJsonSerialised { saveJsonSerialised(metafilepath) return artifactlist } + + // Recurse tree of meta looking for release info and accumulate path + private ArrayList releasewalkerp(ArrayList releasemetacollection, String pathsofar) { + if (releaseinfo.releaserepoURL) { + ArrayList rmi(script, pathsofar, this) + releasemetacollection.add(rmi) + } + for (relatedmetainfo in associatedmeta) { + MetaInfo othermeta = relatedmetainfo.meta + String newpathsofar = pathsofar + "/" + relatedmetainfo.offsetpath + releasemetacollection = releasewalkerp(releasemetacollection, newpathsofar) + } + return releasemetacollection + } + + ArrayList releasewalker(String startpath = "") { + ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(releasemetacollection, startpath) + return releasemetacollection + } } MetaInfo metareset(script) { From 1ed79e56b659234eab8991dbb08fcd742bf434a5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 18:37:54 +0000 Subject: [PATCH 0452/1971] Walk meta data for release info --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index c2c30a4..361c120 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -567,7 +567,7 @@ class MetaInfo extends GISJsonSerialised { // Recurse tree of meta looking for release info and accumulate path private ArrayList releasewalkerp(ArrayList releasemetacollection, String pathsofar) { if (releaseinfo.releaserepoURL) { - ArrayList rmi(script, pathsofar, this) + RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) releasemetacollection.add(rmi) } for (relatedmetainfo in associatedmeta) { From 1dffa1ef60eb6f9b4da17597dfee0d6992e4b612 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 18:37:54 +0000 Subject: [PATCH 0453/1971] Walk meta data for release info --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index c2c30a4..361c120 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -567,7 +567,7 @@ class MetaInfo extends GISJsonSerialised { // Recurse tree of meta looking for release info and accumulate path private ArrayList releasewalkerp(ArrayList releasemetacollection, String pathsofar) { if (releaseinfo.releaserepoURL) { - ArrayList rmi(script, pathsofar, this) + RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) releasemetacollection.add(rmi) } for (relatedmetainfo in associatedmeta) { From 011c5393b28a5897093341dd67c411f438a8d8ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 21:18:12 +0000 Subject: [PATCH 0454/1971] Walk meta data for release info --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 361c120..b204462 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -573,7 +573,7 @@ class MetaInfo extends GISJsonSerialised { for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta String newpathsofar = pathsofar + "/" + relatedmetainfo.offsetpath - releasemetacollection = releasewalkerp(releasemetacollection, newpathsofar) + releasemetacollection = othermeta.releasewalkerp(releasemetacollection, newpathsofar) } return releasemetacollection } From 68f24e6a30a3f8330a6e5914bb99bd69fc153fbf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 26 Nov 2018 21:18:12 +0000 Subject: [PATCH 0455/1971] Walk meta data for release info --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 361c120..b204462 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -573,7 +573,7 @@ class MetaInfo extends GISJsonSerialised { for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta String newpathsofar = pathsofar + "/" + relatedmetainfo.offsetpath - releasemetacollection = releasewalkerp(releasemetacollection, newpathsofar) + releasemetacollection = othermeta.releasewalkerp(releasemetacollection, newpathsofar) } return releasemetacollection } From 5505e5e7ba315787bfcd78dfbe7567dff0214ae7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 08:34:19 +0000 Subject: [PATCH 0456/1971] Correct release path --- meta/folder.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index b204462..88c5e17 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -572,7 +572,10 @@ class MetaInfo extends GISJsonSerialised { } for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta - String newpathsofar = pathsofar + "/" + relatedmetainfo.offsetpath + if (pathsofar) { + pathsofar += "/" + } + String newpathsofar = pathsofar + relatedmetainfo.offsetpath releasemetacollection = othermeta.releasewalkerp(releasemetacollection, newpathsofar) } return releasemetacollection From 84589b75474c3189c35c18320fc13da0aff4649f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 08:34:19 +0000 Subject: [PATCH 0457/1971] Correct release path --- meta/folder.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index b204462..88c5e17 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -572,7 +572,10 @@ class MetaInfo extends GISJsonSerialised { } for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta - String newpathsofar = pathsofar + "/" + relatedmetainfo.offsetpath + if (pathsofar) { + pathsofar += "/" + } + String newpathsofar = pathsofar + relatedmetainfo.offsetpath releasemetacollection = othermeta.releasewalkerp(releasemetacollection, newpathsofar) } return releasemetacollection From 66eec970b67bb0667feb4b85d0b9caa94947f4ba Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 08:51:27 +0000 Subject: [PATCH 0458/1971] Correct release path --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 88c5e17..802443d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -570,11 +570,11 @@ class MetaInfo extends GISJsonSerialised { RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) releasemetacollection.add(rmi) } + if (pathsofar) { + pathsofar += "/" + } for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta - if (pathsofar) { - pathsofar += "/" - } String newpathsofar = pathsofar + relatedmetainfo.offsetpath releasemetacollection = othermeta.releasewalkerp(releasemetacollection, newpathsofar) } From 6211375100f8e0f029d653d1e7d3851bbe19261f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 08:51:27 +0000 Subject: [PATCH 0459/1971] Correct release path --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 88c5e17..802443d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -570,11 +570,11 @@ class MetaInfo extends GISJsonSerialised { RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) releasemetacollection.add(rmi) } + if (pathsofar) { + pathsofar += "/" + } for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta - if (pathsofar) { - pathsofar += "/" - } String newpathsofar = pathsofar + relatedmetainfo.offsetpath releasemetacollection = othermeta.releasewalkerp(releasemetacollection, newpathsofar) } From 57a8b9bf3714d3f3bd33dfc4faa6608f695958be Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 16:52:38 +0000 Subject: [PATCH 0460/1971] Check out release repos --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 802443d..f5e7c93 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -564,7 +564,7 @@ class MetaInfo extends GISJsonSerialised { return artifactlist } - // Recurse tree of meta looking for release info and accumulate path + // Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java private ArrayList releasewalkerp(ArrayList releasemetacollection, String pathsofar) { if (releaseinfo.releaserepoURL) { RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) From da2e95a8705d2ead0a4e2c9b5f05dd592345226c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 16:52:38 +0000 Subject: [PATCH 0461/1971] Check out release repos --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 802443d..f5e7c93 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -564,7 +564,7 @@ class MetaInfo extends GISJsonSerialised { return artifactlist } - // Recurse tree of meta looking for release info and accumulate path + // Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java private ArrayList releasewalkerp(ArrayList releasemetacollection, String pathsofar) { if (releaseinfo.releaserepoURL) { RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) From 6aa746b16c5a090a5f57a282a5dc136970bcf8e0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 18:09:27 +0000 Subject: [PATCH 0462/1971] Check out release repos --- meta/folder.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f5e7c93..1e45319 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -507,7 +507,7 @@ class MetaInfo extends GISJsonSerialised { return path } - String metafilepath() { + static String metafilepath() { return METAFOLDERNAME + "/" + METAFILENAME } @@ -598,4 +598,9 @@ MetaInfo metareset(script) { return mi } +MetaInfo metafromfolder(String folder = "") { + MetaInfo buildmeta = new MetaInfo(this) + buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") +} + return this; From 976994accc03b3374a4de0efa06fa0b438ea5b3f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 18:09:27 +0000 Subject: [PATCH 0463/1971] Check out release repos --- meta/folder.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f5e7c93..1e45319 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -507,7 +507,7 @@ class MetaInfo extends GISJsonSerialised { return path } - String metafilepath() { + static String metafilepath() { return METAFOLDERNAME + "/" + METAFILENAME } @@ -598,4 +598,9 @@ MetaInfo metareset(script) { return mi } +MetaInfo metafromfolder(String folder = "") { + MetaInfo buildmeta = new MetaInfo(this) + buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") +} + return this; From 75882404038a9540dd29ae3984fd352d62074b73 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 18:47:42 +0000 Subject: [PATCH 0464/1971] Check out release repos --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1e45319..de445f1 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -376,10 +376,10 @@ class PublishableInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { - private String FORMAT = "0.1" - private String METAFOLDERNAME = "meta" - private String METAFILENAME = "info.json" - private String METAARTIFACTS = "${METAFOLDERNAME}/**" + 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 From 03921f73d4226056021efb821daaf18eec6445dc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 18:47:42 +0000 Subject: [PATCH 0465/1971] Check out release repos --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1e45319..de445f1 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -376,10 +376,10 @@ class PublishableInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { - private String FORMAT = "0.1" - private String METAFOLDERNAME = "meta" - private String METAFILENAME = "info.json" - private String METAARTIFACTS = "${METAFOLDERNAME}/**" + 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 From fda8b6fdff44bef328f8f5d2f49b0eca0e39c152 Mon Sep 17 00:00:00 2001 From: Damian Smith Date: Tue, 27 Nov 2018 18:55:45 +0000 Subject: [PATCH 0466/1971] ELGIP-20 moved common_scripts directory as this seems to be expected now --- .project | 17 + .pydevproject | 8 + .settings/org.eclipse.core.resources.prefs | 2 + artifacts/metaexport.groovy | 23 + autobuilder.groovy | 60 ++ checksum/utils.groovy | 14 + clean/clean.groovy | 10 + commandline/commandline.groovy | 13 + .../eclipsebuild/disableparallelbuilds.groovy | 12 + compile/eclipsebuild/eclipseds5build.groovy | 198 ++++++ configuration/configuration.groovy | 16 + differences/.project | 17 + differences/.pydevproject | 8 + differences/do.groovy | 18 + differences/json.groovy | 15 + differences/show_release_differences.py | 226 +++++++ file/utils.groovy | 16 + import/importer.groovy | 27 + install/installhelper.groovy | 42 ++ meta/folder.groovy | 578 ++++++++++++++++++ platform/lineendings.groovy | 5 + publishing/utils.groovy | 10 + release/registerrepo.groovy | 12 + versioncontrol/git.groovy | 67 ++ versionnumbering/do.groovy | 20 + versionnumbering/generate.groovy | 120 ++++ versionnumbering/metaversion.groovy | 100 +++ versionnumbering/versioninfo.py | 180 ++++++ versionstamping/.project | 17 + versionstamping/.pydevproject | 8 + versionstamping/versionstamper.py | 41 ++ 31 files changed, 1900 insertions(+) create mode 100644 .project create mode 100644 .pydevproject create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 artifacts/metaexport.groovy create mode 100644 autobuilder.groovy create mode 100644 checksum/utils.groovy create mode 100644 clean/clean.groovy create mode 100644 commandline/commandline.groovy create mode 100644 compile/eclipsebuild/disableparallelbuilds.groovy create mode 100644 compile/eclipsebuild/eclipseds5build.groovy create mode 100644 configuration/configuration.groovy create mode 100644 differences/.project create mode 100644 differences/.pydevproject create mode 100644 differences/do.groovy create mode 100644 differences/json.groovy create mode 100644 differences/show_release_differences.py create mode 100644 file/utils.groovy create mode 100644 import/importer.groovy create mode 100644 install/installhelper.groovy create mode 100644 meta/folder.groovy create mode 100644 platform/lineendings.groovy create mode 100644 publishing/utils.groovy create mode 100644 release/registerrepo.groovy create mode 100644 versioncontrol/git.groovy create mode 100644 versionnumbering/do.groovy create mode 100644 versionnumbering/generate.groovy create mode 100644 versionnumbering/metaversion.groovy create mode 100644 versionnumbering/versioninfo.py create mode 100644 versionstamping/.project create mode 100644 versionstamping/.pydevproject create mode 100644 versionstamping/versionstamper.py diff --git a/.project b/.project new file mode 100644 index 0000000..e329c3f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Common Build Scripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..1ce5929 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 2.7 +python35 + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..1174a06 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//versionnumbering/versioninfo.py=utf-8 diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy new file mode 100644 index 0000000..b6a832b --- /dev/null +++ b/artifacts/metaexport.groovy @@ -0,0 +1,23 @@ + +// 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, subJobs) { + def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + def ArrayList artifactFolders = new ArrayList() + for (subJob in subJobs) { + def subJobObject = subJob[0] + if (subJobObject != null) { + def subJobName = subJobObject.getProjectName() + def subJobNumber = subJobObject.getNumber() + destFolder = subJob[1] + dir(destFolder) { + deleteDir() + } + importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + artifactFolders.add("${destFolder}/**") + } + } + return artifactFolders; +} + +return this; diff --git a/autobuilder.groovy b/autobuilder.groovy new file mode 100644 index 0000000..2a04925 --- /dev/null +++ b/autobuilder.groovy @@ -0,0 +1,60 @@ +// Assume that WORKSPACE environment variable is set + +autobuildroot = "${WORKSPACE}/autobuild" + +commonscriptsroot = "${autobuildroot}/Common_scripts" + +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 + stash allowEmpty: true, includes: 'autobuild/**', name: 'Clean workspace stash', useDefaultExcludes: false + cleanWs() + unstash name: 'Clean workspace stash' + } + else { + echo "Not cleaning workspace" + } +} + +def commonscripts() { + return commonscriptsroot +} + +def getautobuildpath() { + return autobuildroot +} + +// Start up boilderplate +def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { + echo "Starting...." + + autobuildroot = autobuildpath + commonscriptsroot = commonscriptspath + + conditionalclean() + + def metafolder = load("${commonscripts()}/meta/folder.groovy") + def meta = metafolder.metareset(script) + meta.productinfo.set(productname, subcomponentname, jirakey) + 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") + rr.registerrepo(meta, releaserepo) + + 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/checksum/utils.groovy b/checksum/utils.groovy new file mode 100644 index 0000000..c2503cd --- /dev/null +++ b/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/clean/clean.groovy b/clean/clean.groovy new file mode 100644 index 0000000..4707ba0 --- /dev/null +++ b/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/commandline/commandline.groovy b/commandline/commandline.groovy new file mode 100644 index 0000000..df99a75 --- /dev/null +++ b/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/compile/eclipsebuild/disableparallelbuilds.groovy b/compile/eclipsebuild/disableparallelbuilds.groovy new file mode 100644 index 0000000..03e4c8f --- /dev/null +++ b/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 " + + Release_difference + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/differences/.pydevproject b/differences/.pydevproject new file mode 100644 index 0000000..c3434da --- /dev/null +++ b/differences/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Default + diff --git a/differences/do.groovy b/differences/do.groovy new file mode 100644 index 0000000..35e0980 --- /dev/null +++ b/differences/do.groovy @@ -0,0 +1,18 @@ + +def differences(meta, String sourcerevision, String previoussourcerevision, String sourcepath) { + def String cs = autobuilder.commonscripts() + def String difffolder = meta.folder() + def String jirakey = meta.productinfo.jirakey + if (isUnix()) { + sh """ + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" + """ + } + else { + bat """ + "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" + """ + } +} + +return this; diff --git a/differences/json.groovy b/differences/json.groovy new file mode 100644 index 0000000..47d9cc5 --- /dev/null +++ b/differences/json.groovy @@ -0,0 +1,15 @@ +def comparefiles(importedjsonfile, currentjsonfile) { + env.IMPORTED_JSON="${importedjsonfile}" + env.CURRENT_JSON="${currentjsonfile}" + if (isUnix()) { + sh """ + # jq -S sorts json output + diff -c <(jq -S . "${IMPORTED_JSON}") <(jq -S . "${CURRENT_JSON}") + """ + } + else { + error "Windows not currently supporting json file comparison" + } +} + +return this; diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py new file mode 100644 index 0000000..0813356 --- /dev/null +++ b/differences/show_release_differences.py @@ -0,0 +1,226 @@ +''' +showreleasedifferences -- shortdesc + +showreleasedifferences generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. +''' +import subprocess +import os +import sys +import re + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' + +gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") + +class GitException(Exception): + def __init__(self, message): + self.message = message + + def __repr__(self): + return self.message + +def makeFolder(difffolder): + print("Creating folder (if not already there): {0}".format(difffolder)) + os.makedirs(difffolder, exist_ok = True) + +def printDivider(outfh, times = 1, length = 100): + for _ in range(times): + outfh.write("{0}\n".format("*" * length)) + +TABSIZE = 4 +def printTabbed(outfh, string, tabs = 0): + outfh.write("{0}{1}\n".format(" " * (TABSIZE * tabs), string)) + +def getGitLogDifferences(outfh, gitrootfolder, previousRelease, currentRelease, tripledot = False): + if tripledot: + releaseExpression = previousRelease + "..." + currentRelease + else: + releaseExpression = previousRelease + ".." + currentRelease + currentdir = os.getcwd() + os.chdir(gitrootfolder) + gitlog = [] + printTabbed(outfh, "Executing: {0} {1} {2} {3}".format(gitExecutable, "log", "--oneline", releaseExpression)) + proc = subprocess.Popen([gitExecutable, "log", "--oneline", releaseExpression], stdout=subprocess.PIPE) + while True: + line = proc.stdout.readline() + if line: + linestring = line.decode('utf-8').rstrip() + gitlog.append(linestring) + #printTabbed(outfh, linestring, 1) + else: + break + proc.wait() + if proc.returncode > 0: + raise GitException("Git executable returned an error") + os.chdir(currentdir) + return gitlog + +jiraprojectpattern = { + 'GIS' : ( re.compile("^.* +(?:[gG][iI][sS][ _-]*|[tT]rac \#*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *GIS-(\d+):* (.*)"$'), + ), + 'IMB': ( re.compile("^.* +(?:[Ii][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *IMB-(\d+):* (.*)"$'), + ), + 'HMBXR5601': ( re.compile("^.* +(?:[Hh][Mm][Bb][Xx][Rr]5601[ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBXR5601-(\d+):* (.*)"$'), + ), + 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), + ), + 'MCS': ( re.compile("^.* +(?:[Mm][Cc][Ss][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *MCS-(\d+):* (.*)"$'), + ), + 'HMBFDHV': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Hh][Vv][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBFDHV-(\d+):* (.*)"$'), + ), + } + +mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") + +def processLog(gitlog, jirakeyprefix): + reverts = [] + merges = {} + other = [] + numbered = {} + (expectedpattern, revertpattern) = jiraprojectpattern[jirakeyprefix] + for line in gitlog: + expectedmatch = expectedpattern.match(line) + revertmatch = revertpattern.match(line) + mergematch = mergepattern.match(line) + if expectedmatch == None and revertmatch == None and mergematch == None: + other.append(line) + if revertmatch: + gisnumber = jirakeyprefix + "-" + revertmatch.group(2) + description = revertmatch.group(3) + reverts.append("Revert: {0} {1}".format(gisnumber, description)) + if mergematch: + merge = mergematch.group(2) + if not merge in merges: + merges[merge] = 1 + else: + merges[merge] += 1 + if expectedmatch: + gisnumber = jirakeyprefix + "-" + expectedmatch.group(1) + description = expectedmatch.group(2) + if not gisnumber in numbered: + numbered[gisnumber] = [] + numbered[gisnumber].append(description) + return (reverts, merges, other, numbered) + +def showDifferences(differences, jirakeyprefix, outfh): + (revertslog, mergeslog, otherlog, numberedlog) = differences + printDivider(outfh) + printTabbed(outfh, jirakeyprefix + "-Numbers Log:") + for (gisnumber, descriptions) in sorted(numberedlog.items()): + printTabbed(outfh, gisnumber, 1) + descriptions = numberedlog[gisnumber]; + for description in descriptions: + printTabbed(outfh, description, 2) + printDivider(outfh) + printTabbed(outfh, "Revert log:") + for reversion in sorted(revertslog): + printTabbed(outfh, reversion, 1) + printDivider(outfh) + printTabbed(outfh, "Merges log:") + for merge in sorted(mergeslog): + printTabbed(outfh, merge, 1) + printDivider(outfh) + printTabbed(outfh, "Other log:") + for other in sorted(otherlog): + printTabbed(outfh, other, 1) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-s", "--sourceversion", dest="sourceversion", action="store", default="origin/master", help="source version branch or tag to discover compare against [default: %(default)s]") + parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") + parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") + parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") + parser.add_argument("-d", "--difffolder", dest="difffolder", action="store", default="", help="folder where differences file stored [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + try: + gitrootfolder = args.gitrootfolder + sourceversion = args.sourceversion + previousversion = args.previousversion + jirakeyprefix = args.jirakeyprefix + outputoptions = args.outputoptions + difffolder = args.difffolder + + print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", difffolder) + + if difffolder: + makeFolder(difffolder) + outfh = open(os.path.join(difffolder, "differences.txt"), 'w') + else: + outfh = sys.stdout + + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, previousversion, sourceversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, previousversion, sourceversion) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + if 'opposite' in outputoptions.lower(): + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, sourceversion, previousversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + if 'notcommon' in outputoptions.lower(): + printDivider(outfh, times = 4) + printTabbed(outfh, "Looking for changes that are not common to {1} or {2} at path: {0}".format(gitrootfolder, sourceversion, previousversion)) + gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) + showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) + + if difffolder: + outfh.close() + return 0 + except Exception as e: + print("Error while determining differences:", e.__repr__()) + return 1 + + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/file/utils.groovy b/file/utils.groovy new file mode 100644 index 0000000..0ffa47c --- /dev/null +++ b/file/utils.groovy @@ -0,0 +1,16 @@ + +def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") + +// Get current contents of given file and optionally add a newline string/character; If file doesn't exist, return default contents +def currentContents(file, newline = "${nl}", defaultContents = "") { + def contents = "" + if (fileExists("${file}")) { + contents = readFile(file: "${file}").trim() + newline + } + else { + contents = defaultContents + } + return contents +} + +return this; diff --git a/import/importer.groovy b/import/importer.groovy new file mode 100644 index 0000000..a9e28b2 --- /dev/null +++ b/import/importer.groovy @@ -0,0 +1,27 @@ + +def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', boolean fingerprint = false) { + copyArtifacts( + filter: filter, + fingerprintArtifacts: fingerprint, + projectName: jenkinsjob.trim(), + selector: specific(buildnumber.toString()), + target: destpath + ) + meta.importrelated(destpath) +} + +def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { + copyArtifacts( + filter: filter, + fingerprintArtifacts: fingerprint, + projectName: jenkinsjob.trim(), + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: buildselector + ], + target: destpath + ) + meta.importrelated(destpath) +} + +return this; diff --git a/install/installhelper.groovy b/install/installhelper.groovy new file mode 100644 index 0000000..f523799 --- /dev/null +++ b/install/installhelper.groovy @@ -0,0 +1,42 @@ +// Given details about artifacts to import and details of installers to build, import artifacts that are required +def artifactsImporter(artifactDetails, installerDetails) { + artifactFetched = [:] + + for (installer in toBuild) { + def artifactKey = installerDetails.get(installer)[0] + //echo "To build: ${installer} use artifactKey: ${artifactKey}" + (sourceProject, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + env.importDest = destFolder + if (artifactFetched.get(artifactKey) == null) { + //echo "Artifact info: ${artifactInfo}" + copyArtifacts excludes: notToCopy, filter: toCopy, fingerprintArtifacts: true, projectName: "${sourceProject}", selector: lastSuccessful(), target: "${destFolder}" + def componentVersionFolder = "${WORKSPACE}\\version\\version_${artifactKey}" + def folderToCopy = "${destFolder}\\version" + echo "Copying from: ${folderToCopy} to: ${componentVersionFolder}" + fileOperations([folderCopyOperation(destinationFolderPath: componentVersionFolder, sourceFolderPath: folderToCopy)]) + //fileOperations([fileCopyOperation(excludes: '', flattenFiles: false, includes: filesToCopy, targetLocation: componentVersionFolder )]) + def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + artifactVersion = gh.getSHAFromVersion("${destFolder}/version") + artifactFetched.put(artifactKey, artifactVersion) + } + } + return artifactFetched +} + +// Export any required binaries to the /bin folder +def exportBinaries(artifactDetails, installerDetails) { + for (installer in toBuild) { + (artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer) + if (exportBinaries) { + (artifactsSourceProject, destinationFolder, artifactsToCopy, artifactsToNotCopy, binariesFolders) = artifactDetails.get(artifactSet) + for (binaryFolder in binariesFolders) { + binariesSourceFolder = "${destinationFolder}/${binaryFolder}" + binariesDestFolder = "${WORKSPACE}/bin/${artifactSet}/${binaryFolder}" + echo "Copying from: ${binariesSourceFolder} to: ${binariesDestFolder}" + fileOperations([folderCopyOperation(destinationFolderPath: binariesDestFolder, sourceFolderPath: binariesSourceFolder)]) + } + } + } +} + +return this; \ No newline at end of file diff --git a/meta/folder.groovy b/meta/folder.groovy new file mode 100644 index 0000000..8f26265 --- /dev/null +++ b/meta/folder.groovy @@ -0,0 +1,578 @@ +import java.nio.file.Paths +import java.nio.file.Path + +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 { + private String productname + private String subcomponentname + String jirakey + + ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { + super(script) + this.productname = productname + this.subcomponentname = subcomponentname + this.jirakey = jirakey + } + + void set(String productname, String subcomponentname, String jirakey) { + this.productname = productname + this.subcomponentname = subcomponentname + this.jirakey = jirakey + } + + void deserialiseJson(rawmeta) { + productname = rawmeta['productname'] + subcomponentname = rawmeta['subcomponentname'] + jirakey = rawmeta['jirakey'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'productname' : productname, + 'subcomponentname' : subcomponentname, + 'jirakey' : jirakey, + ] + 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 { + private String buildjobname + private 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 { + private String buildstampprefix + private int revision + String buildstamp + String buildstampcommasep + + BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "", buildstampcommasep = "") { + super(script) + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + this.buildstampcommasep = buildstampcommasep + } + + void set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + this.buildstampcommasep = buildstampcommasep + } + + void deserialiseJson(rawmeta) { + buildstampprefix = rawmeta['buildstampprefix'] + revision = rawmeta['revision'] + buildstamp = rawmeta['buildstamp'] + buildstampcommasep = rawmeta['buildstampcommasep'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'buildstampprefix' : buildstampprefix, + 'revision' : revision, + 'buildstamp' : buildstamp, + 'buildstampcommasep' : buildstampcommasep, + ] + return data + } +} + +class ReleaseInfo extends GISJsonSerialised { + private String releaserepoURL + private ArrayList releaseitems + + ReleaseInfo(script, releaserepoURL = "") { + super(script) + this.releaserepoURL = releaserepoURL + this.releaseitems = new ArrayList() + } + + void set(String releaserepoURL = "") { + this.releaserepoURL = releaserepoURL + } + + void addReleaseItem(String releaseitem) { + releaseitems.add(releaseitem) + } + + 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) + } + } + + LinkedHashMap serialisationdata() { + def data = [ + 'releaserepoURL' : releaserepoURL, + 'releaseitems' : releaseitemssserialised(), + ] + 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 String FORMAT = "0.1" + private String METAFOLDERNAME = "meta" + private String METAFILENAME = "info.json" + private 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 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() + associatedmeta = new ArrayList() + } + + 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) + publishableinfo.add(pi) + } + + void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { + def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA) + configurationinfo.add(ci) + } + + 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) + } + for (rawrelatedmeta in rawmeta['associatedmeta']) { + def rm = new RelatedMetaInfo(script) + rm.deserialiseJson(rawrelatedmeta) + associatedmeta.add(rm) + } + } + + def deserialiseJson(String filepath) { + def rawmeta = script.readJSON(file: filepath) + deserialiseJson(rawmeta) + } + + String relativize(String path) { + def Path thispath = Paths.get(path) + if (thispath.startsWith(script.WORKSPACE)) { + def Path wspath = Paths.get(script.WORKSPACE) + def Path wsrelativePath = wspath.relativize(thispath) + return wsrelativePath.toString() + } + return path + } + + String metafilepath() { + return METAFOLDERNAME + "/" + METAFILENAME + } + + MetaInfo importrelated(String destpath) { + MetaInfo mi = new MetaInfo(script) + + def String adjustedpath = relativize(destpath) + def importedmetafile = adjustedpath + "/" + metafilepath() + if (script.fileExists(importedmetafile)) { + mi.deserialiseJson(importedmetafile) + } + + RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) + 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(), + 'associatedmeta' : associatedmetaserialised(), + ] + return data + } + + + String folder() { + return METAFOLDERNAME + } + + String generateartifacts(ArrayList releasedfromhere = new ArrayList(), + ArrayList releasedfromsubmeta = new ArrayList(), + 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 + } +} + +MetaInfo metareset(script) { + echo "Resetting meta folder" + def mi = new MetaInfo(script) + + dir(mi.folder()) { + deleteDir() + } + return mi +} + +return this; diff --git a/platform/lineendings.groovy b/platform/lineendings.groovy new file mode 100644 index 0000000..9657b0d --- /dev/null +++ b/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/publishing/utils.groovy b/publishing/utils.groovy new file mode 100644 index 0000000..145a7e9 --- /dev/null +++ b/publishing/utils.groovy @@ -0,0 +1,10 @@ + +// Generate a list of artifact files that are publishable to outside parties +def generatelist(meta, publishable) { + filelist = [] + for (filepath in publishable) { + meta.addPublishable(filepath) + } +} + +return this; diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy new file mode 100644 index 0000000..ff4d85d --- /dev/null +++ b/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.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo") + } + meta.releaseinfo.set(releaserepo) +} + +return this; diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy new file mode 100644 index 0000000..cb9354b --- /dev/null +++ b/versioncontrol/git.groovy @@ -0,0 +1,67 @@ +clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") + +String getGitInfo(String workingSetRootPath) { + dir(workingSetRootPath) { + return clh.getCommandOutput('git rev-parse HEAD') + } +} + +def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { + reporootenv = env.REPO_ROOT + if (reporootenv != null && repoRoot != "") { + reporootpath = "${reporootenv.trim()}/${repoRoot}" + } else { + reporootpath = "" + 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" + } + 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] + ], + submoduleCfg: [], + ]) +} + +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 +} + +return this diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy new file mode 100644 index 0000000..9b4a42e --- /dev/null +++ b/versionnumbering/do.groovy @@ -0,0 +1,20 @@ + +def stamp(convertdetails) { + for (convertdetail in convertdetails) { + filetoconvert = convertdetail[0] + pattern = convertdetail[1] + replacement = convertdetail[2] + if (isUnix()) { + sh """ + "${PYTHON}" -u "${autobuilder.commonscripts()}/versionstamping/versionstamper.py" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + """ + } + else { + bat """ + "%${PYTHON}%" -u "%${autobuilder.commonscripts()}%\\versionstamping\\versionstamper.py" -f "%${filetoconvert}%" -p "%${pattern}%" -s "%${replacement}%" + """ + } + } +} + +return this; diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy new file mode 100644 index 0000000..59fe2a3 --- /dev/null +++ b/versionnumbering/generate.groovy @@ -0,0 +1,120 @@ + +def getGitRevision(String gitrootpath, int basebuildnumber) { + def int adjustedchangecount + def String gitrevision + def String remoteinfo + def String remoteurl + dir( gitrootpath) { + def int MAXVERSIONNUMBER = 65535 + + def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() + echo "Change count: ${changecount}" + adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) + echo "Adjusted change count: ${adjustedchangecount}" + + gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() + echo "Revision: ${gitrevision}" + + remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() + echo "Remote info: ${remoteinfo}" + + remoteurl = sh(returnStdout: true, script: "git remote get-url --push origin").trim() + echo "Remote URL: ${remoteurl}" + } + return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] +} + +// Handle: +// origin/master +// origin/2.0.x +def getVersionPrefix(String sourcebranch) { + def int MAXVERSIONNUMBER = 65535 + + echo "Determining version number prefix from source branch name: ${sourcebranch}" + sourcebranch = sourcebranch.toLowerCase() + + def defaultversionprefix = "1.30000.0." + def splits = sourcebranch.split('/') + if (splits.size() < 1) { + echo "Source branch name is invalid. Defaulting to: ${defaultversionprefix}" + return defaultversionprefix + } + + def mastertypeversionprefix = "1.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 = "1.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." + } + } + 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, buildstamp.replace(".", ",")) + + return buildstamp +} + +return this; \ No newline at end of file diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy new file mode 100644 index 0000000..44bfbde --- /dev/null +++ b/versionnumbering/metaversion.groovy @@ -0,0 +1,100 @@ + +def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") +def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") + +def prefixline(rootpath, filepath) { + def fileContents = readFile("${filepath}").trim() + def fileContentsNormalized = fileContents.normalize() + + def newFileContents = "" + def lines = fileContentsNormalized.readLines() + for (aline in lines) { + newFileContents += "${rootpath}" + "/" + aline + "${nl}" + } + return newFileContents +} + +def mergemeta(rootpath, versionFolder, outputFolder) { + echo "Merging meta data from folder: ${versionFolder} to ${outputFolder}" + + def differencesFile = "${versionFolder}/differences.txt" + def newContents = readFile file: "${differencesFile}" + def metadifferencesFile = "${outputFolder}/differences.txt" + writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + newContents + + def buildStampFile = "${versionFolder}/buildstamps.txt" + def buildStampFileContents = prefixline(rootpath, "${buildStampFile}") + def metabuildStampFile = "${outputFolder}/buildstamps.txt" + writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + buildStampFileContents + + def intrevision = 0 + if (fileExists("${versionFolder}/revision.txt")) { + def revision = readFile("${versionFolder}/revision.txt").trim() + intrevision = revision.toInteger() + echo "Revision read in: ${intrevision}" + } + else { + intrevision = 1 + } + + return intrevision +} + +def appendcomponentinfo(rootpath, versionFolder, outputFolder) { + echo "Appending component version data from folder: ${versionFolder} to ${outputFolder}" + + def differencesFile = "${versionFolder}/differences.txt" + if (fileExists("${differencesFile}")) { + def newContents = readFile file: "${differencesFile}" + def metadifferencesFile = "${outputFolder}/differences.txt" + writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents + } + + def buildStampFile = "${versionFolder}/buildstamps.txt" + def buildStampFileContents = readFile("${buildStampFile}").trim() + + def remoteurlFile = "${versionFolder}/remoteurl.txt" + def remoteurlFileContents = fileutils.currentContents(remoteurlFile, "", 'Unknown').trim() + + def gitRevisionFile = "${versionFolder}/gitrevision.txt" + def gitRevisionFileContents = readFile("${gitRevisionFile}").trim() + + def releaseJobNameFile = "${versionFolder}/releasejobname.txt" + def releaseJobNameContents = fileutils.currentContents("${releaseJobNameFile}", "", "-").trim() + + def metabuildStampFile = "${outputFolder}/buildstamps.txt" + writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents + def revision = readFile("${versionFolder}/revision.txt").trim() + def intrevision = revision.toInteger() + echo "Revision read in: ${intrevision}" + + return intrevision +} + +// Each version folder should have been created using version creation scripts in this Common_scripts folder +// as their are well-known files in each folder +def combineSubjobVersions(versionLabelPrefix, artifactList, outputFolder = "${WORKSPACE}/metaversion") { + def totalrevision = 0 + dir("${outputFolder}") { + deleteDir() + } + for (artifactItem in artifactList) { + (rootpath, versionFolder) = artifactItem + echo "Inspecting folder: ${versionFolder}" + def metaversionsignaturefile = "${versionFolder}/metaversion.txt" + // If the sub project is a meta job + def intrevision = 0 + if (fileExists("${metaversionsignaturefile}")) { + intrevision = mergemeta(rootpath, versionFolder, outputFolder) + } + else { + intrevision = appendcomponentinfo(rootpath, versionFolder, outputFolder) + } + totalrevision += intrevision + } + echo "Accumulated revision is: ${totalrevision}" + writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + ((versionLabelPrefix.endsWith(".")) ? "" : ".") + totalrevision.toString() + writeFile(file: "${outputFolder}/revision.txt", text: totalrevision.toString()) +} + +return this; \ No newline at end of file diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py new file mode 100644 index 0000000..3d2a80d --- /dev/null +++ b/versionnumbering/versioninfo.py @@ -0,0 +1,180 @@ +# encoding: utf-8 +''' +versionnumbering -- shortdesc + +versionnumbering generates a version folder with a common set of version information files in it + +@author: dan + +@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. +''' +import os +import sys +import shutil +import subprocess +import re +import datetime + +from argparse import ArgumentParser +from argparse import RawDescriptionHelpFormatter + +__all__ = [] +__version__ = 0.1 +__date__ = '2017-11-29' +__updated__ = '2017-11-29' + +# Handle: +# origin/master +# origin/2.0.x +def getVersionPrefix(sourcebranch): + print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) + + defaultversionprefix = "1.30000.0." + mastertypeversionprefix = "1.20000.0." + thirdpartyversionprefix = "1.25000.0." + splits = sourcebranch.split('/') + if len(splits) < 1: + print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) + return defaultversionprefix + + sourcebranch = splits[-1] + + if sourcebranch.lower().find("master") != -1: # Special case + return mastertypeversionprefix + + splits2 = re.split(r'(\d+)', sourcebranch) + splits = [] + hasdot = False + for split in splits2: + if split.isdigit(): + splits.append(split) + if split == ".": + hasdot = True + + if not hasdot: + print("Source branch name has not dots in it (eg. 1.9.2). Defaulting to: {0}".format(thirdpartyversionprefix)) + return thirdpartyversionprefix + + versionprefix = "" + if len(splits) < 1: + print("This source branch name has no numbers in its name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + splitnumbercount = 0 + isIntermediateReleaseBranch = False + for split in splits: + if split.isdigit(): + versionprefix += split + "." + splitnumbercount += 1 + else: + if split == "x": + isIntermediateReleaseBranch = True + break + if splitnumbercount > 2: + break + if splitnumbercount == 0: + print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) + versionprefix = defaultversionprefix + else: + if isIntermediateReleaseBranch: + versionprefix = mastertypeversionprefix + elif splitnumbercount == 1: + versionprefix += "0.0." + elif splitnumbercount == 2: + versionprefix += "0." + + print("Determined version prefix to be: {0}".format(versionprefix)) + return versionprefix + +def writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp): + with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: + f.write(versionprefix) + + with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: + f.write(str(gitrevisioncount)) + + with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: + f.write(gitrevision) + + with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: + f.write(remoteinfo) + + with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: + f.write(remoteurl) + + with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: + f.write(buildstamp) + + buildstampcommasep = buildstamp.replace(".", ",") + with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: + f.write(buildstampcommasep) + + with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: + f.write(str(datetime.datetime.now())) + +def main(argv=None): # IGNORE:C0111 + '''Command line options.''' + + if argv is None: + argv = sys.argv + else: + sys.argv.extend(argv) + + program_name = os.path.basename(sys.argv[0]) + program_version = "v%s" % __version__ + program_build_date = str(__updated__) + program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) + program_shortdesc = __import__('__main__').__doc__.split("\n")[1] + program_license = '''%s + + Created by dan on %s. + Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. + + Distributed on an "AS IS" basis without warranties + or conditions of any kind, either express or implied. + +USAGE +''' % (program_shortdesc, str(__date__)) + + try: + # Setup argument parser + parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) + parser.add_argument("-s", "--sourcebranch", dest="sourcebranch", action="store", default="origin/master", help="source branch name to discover version number [default: %(default)s]") + parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") + parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") + parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") + + # Process arguments + args = parser.parse_args() + + try: + sourcebranch = args.sourcebranch + versionfolder = args.versionfolder + gitrootfolder = args.gitrootfolder + baseversionnumber = args.baseversionnumber + + print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) + print("Base version number:", baseversionnumber) + + (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(gitrootfolder, baseversionnumber) + + versionprefix = getVersionPrefix(sourcebranch) + + buildstamp = versionprefix + str(gitrevisioncount) + print("Build stamp is: {0}".format(buildstamp)) + + writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp) + + return 0 + except Exception as e: + print("Error while creating version info:", e.__repr__()) + return 1 + + except Exception as e: + indent = len(program_name) * " " + print(program_name + ": " + repr(e) + "\n") + print(indent + " for help use --help") + return 2 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/versionstamping/.project b/versionstamping/.project new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/versionstamping/.project @@ -0,0 +1,17 @@ + + + versionstamping + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/versionstamping/.pydevproject b/versionstamping/.pydevproject new file mode 100644 index 0000000..746d0f0 --- /dev/null +++ b/versionstamping/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +python35 + diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py new file mode 100644 index 0000000..3e59c6f --- /dev/null +++ b/versionstamping/versionstamper.py @@ -0,0 +1,41 @@ +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='1.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)) + + filecopy = filetoconvert + ".orig" + try: + shutil.move(filetoconvert, filecopy) + except FileNotFoundError: + print("Could not find file: {0}\n".format(filetoconvert)) + return 1 + + with open(filetoconvert, 'x') as f: + with open(filecopy,'r') as c: + fileread = c.read() + print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) + converted = fileread.replace(pattern, substitute) + #print ("DEBUG: %s "%converted) + print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) + f.write(converted) + + return 0 + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) From 9dc60d37cb475bfcadbe920d927256aef8dd8764 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 19:10:54 +0000 Subject: [PATCH 0467/1971] Check out release repos --- autobuilder.groovy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 2a04925..9f0aece 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -4,6 +4,8 @@ autobuildroot = "${WORKSPACE}/autobuild" commonscriptsroot = "${autobuildroot}/Common_scripts" +metafolderscript = null + def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { echo "Cleaning workspace" @@ -25,17 +27,21 @@ def getautobuildpath() { return autobuildroot } +def getmetafolderscript() { + return metafolderscript +} + // Start up boilderplate def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath commonscriptsroot = commonscriptspath + metafolderscript = load("${commonscripts()}/meta/folder.groovy") conditionalclean() - def metafolder = load("${commonscripts()}/meta/folder.groovy") - def meta = metafolder.metareset(script) + def meta = getmetafolderscript().metareset(script) meta.productinfo.set(productname, subcomponentname, jirakey) def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) From 0ee39e5c95e1b9b2d1beba62b40548bb4258ea7e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 19:10:54 +0000 Subject: [PATCH 0468/1971] Check out release repos --- autobuilder.groovy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 2a04925..9f0aece 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -4,6 +4,8 @@ autobuildroot = "${WORKSPACE}/autobuild" commonscriptsroot = "${autobuildroot}/Common_scripts" +metafolderscript = null + def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { echo "Cleaning workspace" @@ -25,17 +27,21 @@ def getautobuildpath() { return autobuildroot } +def getmetafolderscript() { + return metafolderscript +} + // Start up boilderplate def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath commonscriptsroot = commonscriptspath + metafolderscript = load("${commonscripts()}/meta/folder.groovy") conditionalclean() - def metafolder = load("${commonscripts()}/meta/folder.groovy") - def meta = metafolder.metareset(script) + def meta = getmetafolderscript().metareset(script) meta.productinfo.set(productname, subcomponentname, jirakey) def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) From 63b97ce0d6b9d3dee10c4eca82e5c43373fb87c8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 21:19:18 +0000 Subject: [PATCH 0469/1971] Check out release repos --- autobuilder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/autobuilder.groovy b/autobuilder.groovy index 9f0aece..885d243 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -28,6 +28,7 @@ def getautobuildpath() { } def getmetafolderscript() { + echo "metafolderscript is type: ${metafolderscript.toClass()}" return metafolderscript } From 6a08d9ef26061b9c6d97afa2a3597aa3acd69c89 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 21:19:18 +0000 Subject: [PATCH 0470/1971] Check out release repos --- autobuilder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/autobuilder.groovy b/autobuilder.groovy index 9f0aece..885d243 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -28,6 +28,7 @@ def getautobuildpath() { } def getmetafolderscript() { + echo "metafolderscript is type: ${metafolderscript.toClass()}" return metafolderscript } From 67cb05649fec253dd76362fcd8940f9a68daf97e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 21:23:17 +0000 Subject: [PATCH 0471/1971] Check out release repos --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 885d243..e40a67e 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -28,7 +28,7 @@ def getautobuildpath() { } def getmetafolderscript() { - echo "metafolderscript is type: ${metafolderscript.toClass()}" + echo "metafolderscript is type: ${metafolderscript.getClass()}" return metafolderscript } From 3c8510bb275a21aa1a883eca2dcc99c9c0b49f7c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 21:23:17 +0000 Subject: [PATCH 0472/1971] Check out release repos --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 885d243..e40a67e 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -28,7 +28,7 @@ def getautobuildpath() { } def getmetafolderscript() { - echo "metafolderscript is type: ${metafolderscript.toClass()}" + echo "metafolderscript is type: ${metafolderscript.getClass()}" return metafolderscript } From 65094bf04d5be86c17241373a07e1e1d57244781 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 21:41:01 +0000 Subject: [PATCH 0473/1971] Check out release repos --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index de445f1..458156d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -601,6 +601,7 @@ MetaInfo metareset(script) { MetaInfo metafromfolder(String folder = "") { MetaInfo buildmeta = new MetaInfo(this) buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") + return buildmeta } return this; From e7085c9e219608078132ee5b65423a2c0f0f401c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 21:41:01 +0000 Subject: [PATCH 0474/1971] Check out release repos --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index de445f1..458156d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -601,6 +601,7 @@ MetaInfo metareset(script) { MetaInfo metafromfolder(String folder = "") { MetaInfo buildmeta = new MetaInfo(this) buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") + return buildmeta } return this; From 8e7fcd689dde683c93d2db4932805d23dfaa9a2c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 22:35:37 +0000 Subject: [PATCH 0475/1971] Remove debug --- autobuilder.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index e40a67e..9f0aece 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -28,7 +28,6 @@ def getautobuildpath() { } def getmetafolderscript() { - echo "metafolderscript is type: ${metafolderscript.getClass()}" return metafolderscript } From fca9f9f00d48ff56eb76fcbeeb27914af5fe1246 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Nov 2018 22:35:37 +0000 Subject: [PATCH 0476/1971] Remove debug --- autobuilder.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index e40a67e..9f0aece 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -28,7 +28,6 @@ def getautobuildpath() { } def getmetafolderscript() { - echo "metafolderscript is type: ${metafolderscript.getClass()}" return metafolderscript } From b81ad461044787a2d20285ba3ee2ddaeb1bec65f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 09:07:06 +0000 Subject: [PATCH 0477/1971] Create a version number for the all build --- artifacts/metaexport.groovy | 8 ++++++-- meta/folder.groovy | 10 +++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index b6a832b..e87e3d9 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -4,6 +4,7 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def ArrayList artifactFolders = new ArrayList() + int revisiontotal = 0 for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { @@ -13,11 +14,14 @@ def combineSubjobArtifacts(meta, subJobs) { dir(destFolder) { deleteDir() } - importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + importedmeta = importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + revisiontotal += importedmeta.buildstampinfo.revision artifactFolders.add("${destFolder}/**") } } - return artifactFolders; + def versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + revisiontotal = revisiontotal % (versiongenerator.MAXVERSIONNUMBER + 1) + return [artifactFolders, revisiontotal] } return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 458156d..74ac7c4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -137,7 +137,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { class BuildStampInfo extends GISJsonSerialised { private String buildstampprefix - private int revision + int revision String buildstamp String buildstampcommasep @@ -156,6 +156,14 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } + void changerevision(int newrevision) { + revision = newrevision + buildstampsplit = buildstamp.split('.') + buildstampsplit[3] = newrevision.toString() + buildstamp = buildstampsplit.join('.') + buildstampcommasep = buildstampsplit.join(',') + } + void deserialiseJson(rawmeta) { buildstampprefix = rawmeta['buildstampprefix'] revision = rawmeta['revision'] From 3f8bb3f6f7c7de23558eaa4111dc8de2c1a33fcc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 09:07:06 +0000 Subject: [PATCH 0478/1971] Create a version number for the all build --- artifacts/metaexport.groovy | 8 ++++++-- meta/folder.groovy | 10 +++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index b6a832b..e87e3d9 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -4,6 +4,7 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def ArrayList artifactFolders = new ArrayList() + int revisiontotal = 0 for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { @@ -13,11 +14,14 @@ def combineSubjobArtifacts(meta, subJobs) { dir(destFolder) { deleteDir() } - importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + importedmeta = importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + revisiontotal += importedmeta.buildstampinfo.revision artifactFolders.add("${destFolder}/**") } } - return artifactFolders; + def versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + revisiontotal = revisiontotal % (versiongenerator.MAXVERSIONNUMBER + 1) + return [artifactFolders, revisiontotal] } return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 458156d..74ac7c4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -137,7 +137,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { class BuildStampInfo extends GISJsonSerialised { private String buildstampprefix - private int revision + int revision String buildstamp String buildstampcommasep @@ -156,6 +156,14 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstampcommasep = buildstampcommasep } + void changerevision(int newrevision) { + revision = newrevision + buildstampsplit = buildstamp.split('.') + buildstampsplit[3] = newrevision.toString() + buildstamp = buildstampsplit.join('.') + buildstampcommasep = buildstampsplit.join(',') + } + void deserialiseJson(rawmeta) { buildstampprefix = rawmeta['buildstampprefix'] revision = rawmeta['revision'] From 1955cdd11041732230f0cfb827a63467681b1a52 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 11:37:10 +0000 Subject: [PATCH 0479/1971] Correct scope of MAXVERSIONNUMBER --- versionnumbering/generate.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 59fe2a3..cf21fd0 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,3 +1,4 @@ +int MAXVERSIONNUMBER = 65535 def getGitRevision(String gitrootpath, int basebuildnumber) { def int adjustedchangecount @@ -5,8 +6,6 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { def String remoteinfo def String remoteurl dir( gitrootpath) { - def int MAXVERSIONNUMBER = 65535 - def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() echo "Change count: ${changecount}" adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) @@ -28,8 +27,6 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { // origin/master // origin/2.0.x def getVersionPrefix(String sourcebranch) { - def int MAXVERSIONNUMBER = 65535 - echo "Determining version number prefix from source branch name: ${sourcebranch}" sourcebranch = sourcebranch.toLowerCase() From 1a4666fdcce33377839c1992fb2f6410a2cd877a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 11:37:10 +0000 Subject: [PATCH 0480/1971] Correct scope of MAXVERSIONNUMBER --- versionnumbering/generate.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 59fe2a3..cf21fd0 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,3 +1,4 @@ +int MAXVERSIONNUMBER = 65535 def getGitRevision(String gitrootpath, int basebuildnumber) { def int adjustedchangecount @@ -5,8 +6,6 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { def String remoteinfo def String remoteurl dir( gitrootpath) { - def int MAXVERSIONNUMBER = 65535 - def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() echo "Change count: ${changecount}" adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) @@ -28,8 +27,6 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { // origin/master // origin/2.0.x def getVersionPrefix(String sourcebranch) { - def int MAXVERSIONNUMBER = 65535 - echo "Determining version number prefix from source branch name: ${sourcebranch}" sourcebranch = sourcebranch.toLowerCase() From b06f0855cf66c1c6260ad59eefc035d093d88f4a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 13:10:26 +0000 Subject: [PATCH 0481/1971] Correct scope of MAXVERSIONNUMBER --- artifacts/metaexport.groovy | 2 +- versionnumbering/generate.groovy | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index e87e3d9..b4d4a6d 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -20,7 +20,7 @@ def combineSubjobArtifacts(meta, subJobs) { } } def versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - revisiontotal = revisiontotal % (versiongenerator.MAXVERSIONNUMBER + 1) + revisiontotal = revisiontotal % (versiongenerator.maxversionnumber() + 1) return [artifactFolders, revisiontotal] } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index cf21fd0..9df06d8 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,4 +1,8 @@ -int MAXVERSIONNUMBER = 65535 + +def int maxversionnumber() { + def int MAXVERSIONNUMBER = 65535 + return MAXVERSIONNUMBER +} def getGitRevision(String gitrootpath, int basebuildnumber) { def int adjustedchangecount @@ -8,7 +12,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { dir( gitrootpath) { def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() echo "Change count: ${changecount}" - adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) + adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() @@ -62,7 +66,7 @@ def getVersionPrefix(String sourcebranch) { def integers = [] for (integerstring in integerstrings) { int integer = integerstring.toInteger() - integer = integer % (MAXVERSIONNUMBER + 1) + integer = integer % (maxversionnumber() + 1) integers.add(integer) } From 46ddde1b777ab67847f7ad5de4cab37ca6488143 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 13:10:26 +0000 Subject: [PATCH 0482/1971] Correct scope of MAXVERSIONNUMBER --- artifacts/metaexport.groovy | 2 +- versionnumbering/generate.groovy | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index e87e3d9..b4d4a6d 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -20,7 +20,7 @@ def combineSubjobArtifacts(meta, subJobs) { } } def versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - revisiontotal = revisiontotal % (versiongenerator.MAXVERSIONNUMBER + 1) + revisiontotal = revisiontotal % (versiongenerator.maxversionnumber() + 1) return [artifactFolders, revisiontotal] } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index cf21fd0..9df06d8 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,4 +1,8 @@ -int MAXVERSIONNUMBER = 65535 + +def int maxversionnumber() { + def int MAXVERSIONNUMBER = 65535 + return MAXVERSIONNUMBER +} def getGitRevision(String gitrootpath, int basebuildnumber) { def int adjustedchangecount @@ -8,7 +12,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { dir( gitrootpath) { def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() echo "Change count: ${changecount}" - adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) + adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() @@ -62,7 +66,7 @@ def getVersionPrefix(String sourcebranch) { def integers = [] for (integerstring in integerstrings) { int integer = integerstring.toInteger() - integer = integer % (MAXVERSIONNUMBER + 1) + integer = integer % (maxversionnumber() + 1) integers.add(integer) } From d479c10bf4b769ef53dca4903e17b52ad7c048af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 17:11:08 +0000 Subject: [PATCH 0483/1971] Load in artifacts for release --- meta/folder.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 74ac7c4..822472d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -594,6 +594,17 @@ class MetaInfo extends GISJsonSerialised { releasemetacollection = releasewalkerp(releasemetacollection, startpath) return releasemetacollection } + + Map releasewalkerunique(String startpath = "") { + Map releasemetauniquecollection = new Map() + ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(releasemetacollection, startpath) + for (relatedmetainfo in releasemetacollection) { + String uniquestring = relatedmetainfo.meta.productinfo.productname + "_" + relatedmetainfo.meta.productinfo.subcomponentname + releasemetauniquecollection.put(uniquestring, relatedmetainfo) + } + return releasemetauniquecollection + } } MetaInfo metareset(script) { From 58b6100215be6ed6ddbe3eb7abacaacac88fff50 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 17:11:08 +0000 Subject: [PATCH 0484/1971] Load in artifacts for release --- meta/folder.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 74ac7c4..822472d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -594,6 +594,17 @@ class MetaInfo extends GISJsonSerialised { releasemetacollection = releasewalkerp(releasemetacollection, startpath) return releasemetacollection } + + Map releasewalkerunique(String startpath = "") { + Map releasemetauniquecollection = new Map() + ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(releasemetacollection, startpath) + for (relatedmetainfo in releasemetacollection) { + String uniquestring = relatedmetainfo.meta.productinfo.productname + "_" + relatedmetainfo.meta.productinfo.subcomponentname + releasemetauniquecollection.put(uniquestring, relatedmetainfo) + } + return releasemetauniquecollection + } } MetaInfo metareset(script) { From 3027bb85e64c0ee1da71be7349dd18be0010ec63 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 17:17:09 +0000 Subject: [PATCH 0485/1971] Load in artifacts for release --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 822472d..8f8ea0a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -596,7 +596,7 @@ class MetaInfo extends GISJsonSerialised { } Map releasewalkerunique(String startpath = "") { - Map releasemetauniquecollection = new Map() + Map releasemetauniquecollection = new LinkedHashMap() ArrayList releasemetacollection = new ArrayList() releasemetacollection = releasewalkerp(releasemetacollection, startpath) for (relatedmetainfo in releasemetacollection) { From c095a2c19ef6afcb69febebfb1a5b5e20392a9d3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 17:17:09 +0000 Subject: [PATCH 0486/1971] Load in artifacts for release --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 822472d..8f8ea0a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -596,7 +596,7 @@ class MetaInfo extends GISJsonSerialised { } Map releasewalkerunique(String startpath = "") { - Map releasemetauniquecollection = new Map() + Map releasemetauniquecollection = new LinkedHashMap() ArrayList releasemetacollection = new ArrayList() releasemetacollection = releasewalkerp(releasemetacollection, startpath) for (relatedmetainfo in releasemetacollection) { From 55c4ce8c81b3263c953dd019a0ca72f9abc82cc0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 17:40:47 +0000 Subject: [PATCH 0487/1971] Load in artifacts for release --- meta/folder.groovy | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 8f8ea0a..24bcbf5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -573,32 +573,34 @@ class MetaInfo extends GISJsonSerialised { } // Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java - private ArrayList releasewalkerp(ArrayList releasemetacollection, String pathsofar) { - 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(releasemetacollection, newpathsofar) + 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(String startpath = "") { + ArrayList releasewalker(int maxdepth, String startpath = "") { ArrayList releasemetacollection = new ArrayList() - releasemetacollection = releasewalkerp(releasemetacollection, startpath) + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) return releasemetacollection } - Map releasewalkerunique(String startpath = "") { + Map releasewalkerunique(int maxdepth, String startpath = "") { Map releasemetauniquecollection = new LinkedHashMap() ArrayList releasemetacollection = new ArrayList() - releasemetacollection = releasewalkerp(releasemetacollection, startpath) + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) for (relatedmetainfo in releasemetacollection) { String uniquestring = relatedmetainfo.meta.productinfo.productname + "_" + relatedmetainfo.meta.productinfo.subcomponentname releasemetauniquecollection.put(uniquestring, relatedmetainfo) From 911d147f81b3c3a3712490e8aca945e96b6c2118 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 17:40:47 +0000 Subject: [PATCH 0488/1971] Load in artifacts for release --- meta/folder.groovy | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 8f8ea0a..24bcbf5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -573,32 +573,34 @@ class MetaInfo extends GISJsonSerialised { } // Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java - private ArrayList releasewalkerp(ArrayList releasemetacollection, String pathsofar) { - 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(releasemetacollection, newpathsofar) + 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(String startpath = "") { + ArrayList releasewalker(int maxdepth, String startpath = "") { ArrayList releasemetacollection = new ArrayList() - releasemetacollection = releasewalkerp(releasemetacollection, startpath) + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) return releasemetacollection } - Map releasewalkerunique(String startpath = "") { + Map releasewalkerunique(int maxdepth, String startpath = "") { Map releasemetauniquecollection = new LinkedHashMap() ArrayList releasemetacollection = new ArrayList() - releasemetacollection = releasewalkerp(releasemetacollection, startpath) + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) for (relatedmetainfo in releasemetacollection) { String uniquestring = relatedmetainfo.meta.productinfo.productname + "_" + relatedmetainfo.meta.productinfo.subcomponentname releasemetauniquecollection.put(uniquestring, relatedmetainfo) From 7982ce90720ffbc7f307e08cb3c92cea3a90bf81 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 19:24:10 +0000 Subject: [PATCH 0489/1971] Perform git push operations --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 24bcbf5..b8120a6 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -158,7 +158,7 @@ class BuildStampInfo extends GISJsonSerialised { void changerevision(int newrevision) { revision = newrevision - buildstampsplit = buildstamp.split('.') + def List buildstampsplit = buildstamp.split('.') buildstampsplit[3] = newrevision.toString() buildstamp = buildstampsplit.join('.') buildstampcommasep = buildstampsplit.join(',') From 1acfec14d58fccd275ea435ef4bae6423aa5dde1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 19:24:10 +0000 Subject: [PATCH 0490/1971] Perform git push operations --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 24bcbf5..b8120a6 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -158,7 +158,7 @@ class BuildStampInfo extends GISJsonSerialised { void changerevision(int newrevision) { revision = newrevision - buildstampsplit = buildstamp.split('.') + def List buildstampsplit = buildstamp.split('.') buildstampsplit[3] = newrevision.toString() buildstamp = buildstampsplit.join('.') buildstampcommasep = buildstampsplit.join(',') From 060234eb5f8ffcf45e6f6d055de6799ea7de177b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 19:44:11 +0000 Subject: [PATCH 0491/1971] Perform git push operations --- meta/folder.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index b8120a6..cfa0a6e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -157,11 +157,13 @@ class BuildStampInfo extends GISJsonSerialised { } void changerevision(int newrevision) { + script.echo("Build stamp currently ${buildstamp}") revision = newrevision def List buildstampsplit = buildstamp.split('.') buildstampsplit[3] = newrevision.toString() buildstamp = buildstampsplit.join('.') buildstampcommasep = buildstampsplit.join(',') + script.echo("Build stamp now ${buildstamp}") } void deserialiseJson(rawmeta) { From a43f93cc15a854ff0425b36a355d6acaa5b614e7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Nov 2018 19:44:11 +0000 Subject: [PATCH 0492/1971] Perform git push operations --- meta/folder.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index b8120a6..cfa0a6e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -157,11 +157,13 @@ class BuildStampInfo extends GISJsonSerialised { } void changerevision(int newrevision) { + script.echo("Build stamp currently ${buildstamp}") revision = newrevision def List buildstampsplit = buildstamp.split('.') buildstampsplit[3] = newrevision.toString() buildstamp = buildstampsplit.join('.') buildstampcommasep = buildstampsplit.join(',') + script.echo("Build stamp now ${buildstamp}") } void deserialiseJson(rawmeta) { From 333f65998462d94893f5cd9d76a53d1c67dc3094 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 00:33:39 +0000 Subject: [PATCH 0493/1971] Calculate version number earlier --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index cfa0a6e..ed17a91 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -159,7 +159,7 @@ class BuildStampInfo extends GISJsonSerialised { void changerevision(int newrevision) { script.echo("Build stamp currently ${buildstamp}") revision = newrevision - def List buildstampsplit = buildstamp.split('.') + def List buildstampsplit = buildstamp.split('\\.') buildstampsplit[3] = newrevision.toString() buildstamp = buildstampsplit.join('.') buildstampcommasep = buildstampsplit.join(',') From 95b1a75e0c8c32161cac0ff241e32f0d9aedf5c7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 00:33:39 +0000 Subject: [PATCH 0494/1971] Calculate version number earlier --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index cfa0a6e..ed17a91 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -159,7 +159,7 @@ class BuildStampInfo extends GISJsonSerialised { void changerevision(int newrevision) { script.echo("Build stamp currently ${buildstamp}") revision = newrevision - def List buildstampsplit = buildstamp.split('.') + def List buildstampsplit = buildstamp.split('\\.') buildstampsplit[3] = newrevision.toString() buildstamp = buildstampsplit.join('.') buildstampcommasep = buildstampsplit.join(',') From 002ab542e035a122ce43cd06384ed54bc11c5512 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 08:06:46 +0000 Subject: [PATCH 0495/1971] Remote URL fetch was not working --- meta/folder.groovy | 2 +- versionnumbering/generate.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ed17a91..2640567 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,4 +1,4 @@ -import java.nio.file.Paths +urimport java.nio.file.Paths import java.nio.file.Path abstract class GISJsonSerialised implements Serializable { diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 9df06d8..f185c40 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -21,7 +21,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() echo "Remote info: ${remoteinfo}" - remoteurl = sh(returnStdout: true, script: "git remote get-url --push origin").trim() + remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] From 24b138ac8ffa91bc3bfee0403212417f8cb0b1de Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 08:06:46 +0000 Subject: [PATCH 0496/1971] Remote URL fetch was not working --- meta/folder.groovy | 2 +- versionnumbering/generate.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ed17a91..2640567 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,4 +1,4 @@ -import java.nio.file.Paths +urimport java.nio.file.Paths import java.nio.file.Path abstract class GISJsonSerialised implements Serializable { diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 9df06d8..f185c40 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -21,7 +21,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() echo "Remote info: ${remoteinfo}" - remoteurl = sh(returnStdout: true, script: "git remote get-url --push origin").trim() + remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] From 7b847a84ab77eede0212af622496237d564ba0e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 08:10:04 +0000 Subject: [PATCH 0497/1971] Remote URL fetch was not working --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2640567..ed17a91 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,4 +1,4 @@ -urimport java.nio.file.Paths +import java.nio.file.Paths import java.nio.file.Path abstract class GISJsonSerialised implements Serializable { From 3fceb3282905b6cef5137eacf9cb0a17774e1d47 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 08:10:04 +0000 Subject: [PATCH 0498/1971] Remote URL fetch was not working --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2640567..ed17a91 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,4 +1,4 @@ -urimport java.nio.file.Paths +import java.nio.file.Paths import java.nio.file.Path abstract class GISJsonSerialised implements Serializable { From 78ad47a964afcca9e7016c14876a71373d574d41 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 08:36:20 +0000 Subject: [PATCH 0499/1971] Remove comma separated buildstamp store --- meta/folder.groovy | 17 ++++++++--------- versionnumbering/generate.groovy | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ed17a91..76fbe43 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -139,30 +139,31 @@ class BuildStampInfo extends GISJsonSerialised { private String buildstampprefix int revision String buildstamp - String buildstampcommasep - BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "", buildstampcommasep = "") { + BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "") { super(script) this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp - this.buildstampcommasep = buildstampcommasep } - void set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { + void set(String buildstampprefix, int revision, String buildstamp) { this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp - this.buildstampcommasep = buildstampcommasep } + String buildstampcommasep() { + buildstampcommasep = buildstamp.replace(".", ",") + return buildstampcommasep + } + void changerevision(int newrevision) { script.echo("Build stamp currently ${buildstamp}") revision = newrevision def List buildstampsplit = buildstamp.split('\\.') - buildstampsplit[3] = newrevision.toString() + buildstampsplit[-1] = newrevision.toString() buildstamp = buildstampsplit.join('.') - buildstampcommasep = buildstampsplit.join(',') script.echo("Build stamp now ${buildstamp}") } @@ -170,7 +171,6 @@ class BuildStampInfo extends GISJsonSerialised { buildstampprefix = rawmeta['buildstampprefix'] revision = rawmeta['revision'] buildstamp = rawmeta['buildstamp'] - buildstampcommasep = rawmeta['buildstampcommasep'] } LinkedHashMap serialisationdata() { @@ -178,7 +178,6 @@ class BuildStampInfo extends GISJsonSerialised { 'buildstampprefix' : buildstampprefix, 'revision' : revision, 'buildstamp' : buildstamp, - 'buildstampcommasep' : buildstampcommasep, ] return data } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f185c40..a7b583a 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -113,7 +113,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum echo "Build stamp is: ${buildstamp}" meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) - meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp, buildstamp.replace(".", ",")) + meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp) return buildstamp } From 347e544b459cb5206c0145bc3007288412a062f3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 08:36:20 +0000 Subject: [PATCH 0500/1971] Remove comma separated buildstamp store --- meta/folder.groovy | 17 ++++++++--------- versionnumbering/generate.groovy | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ed17a91..76fbe43 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -139,30 +139,31 @@ class BuildStampInfo extends GISJsonSerialised { private String buildstampprefix int revision String buildstamp - String buildstampcommasep - BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "", buildstampcommasep = "") { + BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "") { super(script) this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp - this.buildstampcommasep = buildstampcommasep } - void set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { + void set(String buildstampprefix, int revision, String buildstamp) { this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp - this.buildstampcommasep = buildstampcommasep } + String buildstampcommasep() { + buildstampcommasep = buildstamp.replace(".", ",") + return buildstampcommasep + } + void changerevision(int newrevision) { script.echo("Build stamp currently ${buildstamp}") revision = newrevision def List buildstampsplit = buildstamp.split('\\.') - buildstampsplit[3] = newrevision.toString() + buildstampsplit[-1] = newrevision.toString() buildstamp = buildstampsplit.join('.') - buildstampcommasep = buildstampsplit.join(',') script.echo("Build stamp now ${buildstamp}") } @@ -170,7 +171,6 @@ class BuildStampInfo extends GISJsonSerialised { buildstampprefix = rawmeta['buildstampprefix'] revision = rawmeta['revision'] buildstamp = rawmeta['buildstamp'] - buildstampcommasep = rawmeta['buildstampcommasep'] } LinkedHashMap serialisationdata() { @@ -178,7 +178,6 @@ class BuildStampInfo extends GISJsonSerialised { 'buildstampprefix' : buildstampprefix, 'revision' : revision, 'buildstamp' : buildstamp, - 'buildstampcommasep' : buildstampcommasep, ] return data } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f185c40..a7b583a 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -113,7 +113,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum echo "Build stamp is: ${buildstamp}" meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) - meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp, buildstamp.replace(".", ",")) + meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp) return buildstamp } From 7bf878097c5a520a8a1da85b684b04953a005a24 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 12:48:41 +0000 Subject: [PATCH 0501/1971] Correct buildstamp comma sep generation --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 76fbe43..570a3ea 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -154,7 +154,7 @@ class BuildStampInfo extends GISJsonSerialised { } String buildstampcommasep() { - buildstampcommasep = buildstamp.replace(".", ",") + def String buildstampcommasep = buildstamp.replace(".", ",") return buildstampcommasep } From 574c2155a776b67f164ab426da7fcbe606a333f8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 12:48:41 +0000 Subject: [PATCH 0502/1971] Correct buildstamp comma sep generation --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 76fbe43..570a3ea 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -154,7 +154,7 @@ class BuildStampInfo extends GISJsonSerialised { } String buildstampcommasep() { - buildstampcommasep = buildstamp.replace(".", ",") + def String buildstampcommasep = buildstamp.replace(".", ",") return buildstampcommasep } From 583f38f347d4a336295dfad3a7d0b2147be256d0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 13:23:40 +0000 Subject: [PATCH 0503/1971] Remove redundant script; Correct artifact export of release job --- versionnumbering/metaversion.groovy | 100 ---------------------------- 1 file changed, 100 deletions(-) delete mode 100644 versionnumbering/metaversion.groovy diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy deleted file mode 100644 index 44bfbde..0000000 --- a/versionnumbering/metaversion.groovy +++ /dev/null @@ -1,100 +0,0 @@ - -def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") -def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") - -def prefixline(rootpath, filepath) { - def fileContents = readFile("${filepath}").trim() - def fileContentsNormalized = fileContents.normalize() - - def newFileContents = "" - def lines = fileContentsNormalized.readLines() - for (aline in lines) { - newFileContents += "${rootpath}" + "/" + aline + "${nl}" - } - return newFileContents -} - -def mergemeta(rootpath, versionFolder, outputFolder) { - echo "Merging meta data from folder: ${versionFolder} to ${outputFolder}" - - def differencesFile = "${versionFolder}/differences.txt" - def newContents = readFile file: "${differencesFile}" - def metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + newContents - - def buildStampFile = "${versionFolder}/buildstamps.txt" - def buildStampFileContents = prefixline(rootpath, "${buildStampFile}") - def metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + buildStampFileContents - - def intrevision = 0 - if (fileExists("${versionFolder}/revision.txt")) { - def revision = readFile("${versionFolder}/revision.txt").trim() - intrevision = revision.toInteger() - echo "Revision read in: ${intrevision}" - } - else { - intrevision = 1 - } - - return intrevision -} - -def appendcomponentinfo(rootpath, versionFolder, outputFolder) { - echo "Appending component version data from folder: ${versionFolder} to ${outputFolder}" - - def differencesFile = "${versionFolder}/differences.txt" - if (fileExists("${differencesFile}")) { - def newContents = readFile file: "${differencesFile}" - def metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents - } - - def buildStampFile = "${versionFolder}/buildstamps.txt" - def buildStampFileContents = readFile("${buildStampFile}").trim() - - def remoteurlFile = "${versionFolder}/remoteurl.txt" - def remoteurlFileContents = fileutils.currentContents(remoteurlFile, "", 'Unknown').trim() - - def gitRevisionFile = "${versionFolder}/gitrevision.txt" - def gitRevisionFileContents = readFile("${gitRevisionFile}").trim() - - def releaseJobNameFile = "${versionFolder}/releasejobname.txt" - def releaseJobNameContents = fileutils.currentContents("${releaseJobNameFile}", "", "-").trim() - - def metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents - def revision = readFile("${versionFolder}/revision.txt").trim() - def intrevision = revision.toInteger() - echo "Revision read in: ${intrevision}" - - return intrevision -} - -// Each version folder should have been created using version creation scripts in this Common_scripts folder -// as their are well-known files in each folder -def combineSubjobVersions(versionLabelPrefix, artifactList, outputFolder = "${WORKSPACE}/metaversion") { - def totalrevision = 0 - dir("${outputFolder}") { - deleteDir() - } - for (artifactItem in artifactList) { - (rootpath, versionFolder) = artifactItem - echo "Inspecting folder: ${versionFolder}" - def metaversionsignaturefile = "${versionFolder}/metaversion.txt" - // If the sub project is a meta job - def intrevision = 0 - if (fileExists("${metaversionsignaturefile}")) { - intrevision = mergemeta(rootpath, versionFolder, outputFolder) - } - else { - intrevision = appendcomponentinfo(rootpath, versionFolder, outputFolder) - } - totalrevision += intrevision - } - echo "Accumulated revision is: ${totalrevision}" - writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + ((versionLabelPrefix.endsWith(".")) ? "" : ".") + totalrevision.toString() - writeFile(file: "${outputFolder}/revision.txt", text: totalrevision.toString()) -} - -return this; \ No newline at end of file From d33e50f3cc7779f41f6703b52ef97c8e73e62b78 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 13:23:40 +0000 Subject: [PATCH 0504/1971] Remove redundant script; Correct artifact export of release job --- versionnumbering/metaversion.groovy | 100 ---------------------------- 1 file changed, 100 deletions(-) delete mode 100644 versionnumbering/metaversion.groovy diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy deleted file mode 100644 index 44bfbde..0000000 --- a/versionnumbering/metaversion.groovy +++ /dev/null @@ -1,100 +0,0 @@ - -def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") -def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") - -def prefixline(rootpath, filepath) { - def fileContents = readFile("${filepath}").trim() - def fileContentsNormalized = fileContents.normalize() - - def newFileContents = "" - def lines = fileContentsNormalized.readLines() - for (aline in lines) { - newFileContents += "${rootpath}" + "/" + aline + "${nl}" - } - return newFileContents -} - -def mergemeta(rootpath, versionFolder, outputFolder) { - echo "Merging meta data from folder: ${versionFolder} to ${outputFolder}" - - def differencesFile = "${versionFolder}/differences.txt" - def newContents = readFile file: "${differencesFile}" - def metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + newContents - - def buildStampFile = "${versionFolder}/buildstamps.txt" - def buildStampFileContents = prefixline(rootpath, "${buildStampFile}") - def metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + buildStampFileContents - - def intrevision = 0 - if (fileExists("${versionFolder}/revision.txt")) { - def revision = readFile("${versionFolder}/revision.txt").trim() - intrevision = revision.toInteger() - echo "Revision read in: ${intrevision}" - } - else { - intrevision = 1 - } - - return intrevision -} - -def appendcomponentinfo(rootpath, versionFolder, outputFolder) { - echo "Appending component version data from folder: ${versionFolder} to ${outputFolder}" - - def differencesFile = "${versionFolder}/differences.txt" - if (fileExists("${differencesFile}")) { - def newContents = readFile file: "${differencesFile}" - def metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents - } - - def buildStampFile = "${versionFolder}/buildstamps.txt" - def buildStampFileContents = readFile("${buildStampFile}").trim() - - def remoteurlFile = "${versionFolder}/remoteurl.txt" - def remoteurlFileContents = fileutils.currentContents(remoteurlFile, "", 'Unknown').trim() - - def gitRevisionFile = "${versionFolder}/gitrevision.txt" - def gitRevisionFileContents = readFile("${gitRevisionFile}").trim() - - def releaseJobNameFile = "${versionFolder}/releasejobname.txt" - def releaseJobNameContents = fileutils.currentContents("${releaseJobNameFile}", "", "-").trim() - - def metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents - def revision = readFile("${versionFolder}/revision.txt").trim() - def intrevision = revision.toInteger() - echo "Revision read in: ${intrevision}" - - return intrevision -} - -// Each version folder should have been created using version creation scripts in this Common_scripts folder -// as their are well-known files in each folder -def combineSubjobVersions(versionLabelPrefix, artifactList, outputFolder = "${WORKSPACE}/metaversion") { - def totalrevision = 0 - dir("${outputFolder}") { - deleteDir() - } - for (artifactItem in artifactList) { - (rootpath, versionFolder) = artifactItem - echo "Inspecting folder: ${versionFolder}" - def metaversionsignaturefile = "${versionFolder}/metaversion.txt" - // If the sub project is a meta job - def intrevision = 0 - if (fileExists("${metaversionsignaturefile}")) { - intrevision = mergemeta(rootpath, versionFolder, outputFolder) - } - else { - intrevision = appendcomponentinfo(rootpath, versionFolder, outputFolder) - } - totalrevision += intrevision - } - echo "Accumulated revision is: ${totalrevision}" - writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + ((versionLabelPrefix.endsWith(".")) ? "" : ".") + totalrevision.toString() - writeFile(file: "${outputFolder}/revision.txt", text: totalrevision.toString()) -} - -return this; \ No newline at end of file From 56ab82876073c7bf98f3942b88261660c4ebf8e7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:03:12 +0000 Subject: [PATCH 0505/1971] Alter differences file generation; Merge differences when importing --- differences/do.groovy | 6 +++--- differences/show_release_differences.py | 11 +++++------ meta/folder.groovy | 22 +++++++++++++++++++--- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 35e0980..32f18b5 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,16 +1,16 @@ def differences(meta, String sourcerevision, String previoussourcerevision, String sourcepath) { def String cs = autobuilder.commonscripts() - def String difffolder = meta.folder() + def String difffile = meta.difffilepath() def String jirakey = meta.productinfo.jirakey if (isUnix()) { sh """ - "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}" """ } else { bat """ - "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" + "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}" """ } } diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 0813356..fee6f7b 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -172,7 +172,7 @@ USAGE parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") - parser.add_argument("-d", "--difffolder", dest="difffolder", action="store", default="", help="folder where differences file stored [default: %(default)s]") + parser.add_argument("-f", "--difffile", dest="difffile", action="store", default="", help="file where differences file stored [default: %(default)s]") # Process arguments args = parser.parse_args() @@ -183,14 +183,13 @@ USAGE previousversion = args.previousversion jirakeyprefix = args.jirakeyprefix outputoptions = args.outputoptions - difffolder = args.difffolder + difffile = args.difffile print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) - print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", difffolder) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) - if difffolder: - makeFolder(difffolder) - outfh = open(os.path.join(difffolder, "differences.txt"), 'w') + if difffile: + outfh = open(difffile), 'w') else: outfh = sys.stdout diff --git a/meta/folder.groovy b/meta/folder.groovy index 570a3ea..8bd80d3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -19,8 +19,8 @@ abstract class GISJsonSerialised implements Serializable { } class ProductInfo extends GISJsonSerialised { - private String productname - private String subcomponentname + String productname + String subcomponentname String jirakey ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { @@ -388,6 +388,7 @@ class MetaInfo extends GISJsonSerialised { private static String FORMAT = "0.1" private static String METAFOLDERNAME = "meta" private static String METAFILENAME = "info.json" + private static String METADIFFFILENAME = "differences.txt" private static String METAARTIFACTS = "${METAFOLDERNAME}/**" class RelatedMetaInfo extends GISJsonSerialised { @@ -519,7 +520,11 @@ class MetaInfo extends GISJsonSerialised { static String metafilepath() { return METAFOLDERNAME + "/" + METAFILENAME } - + + static String difffilepath() { + return METAFOLDERNAME + "/" + METADIFFFILENAME + } + MetaInfo importrelated(String destpath) { MetaInfo mi = new MetaInfo(script) @@ -532,6 +537,17 @@ class MetaInfo extends GISJsonSerialised { RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) associatedmeta.add(rmi) + def importedmetadifffile = adjustedpath + "/" + difffilepath() + if (script.fileExists(importedmetadifffile)) { + def String newcontents = script.readFile(file: importedmetadifffile) + def String currentcontents = "" + if (script.fileExists(difffilepath())) { + currentcontents = script.readFile(file: difffilepath()) + } + + script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " mi.productinfo.componentname + ":\n" + newcontents) + } + return mi } From cc99fcf2a17aff04d651b5a24338cb8240476c9c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:03:12 +0000 Subject: [PATCH 0506/1971] Alter differences file generation; Merge differences when importing --- differences/do.groovy | 6 +++--- differences/show_release_differences.py | 11 +++++------ meta/folder.groovy | 22 +++++++++++++++++++--- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 35e0980..32f18b5 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,16 +1,16 @@ def differences(meta, String sourcerevision, String previoussourcerevision, String sourcepath) { def String cs = autobuilder.commonscripts() - def String difffolder = meta.folder() + def String difffile = meta.difffilepath() def String jirakey = meta.productinfo.jirakey if (isUnix()) { sh """ - "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}" """ } else { bat """ - "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" + "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}" """ } } diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 0813356..fee6f7b 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -172,7 +172,7 @@ USAGE parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") - parser.add_argument("-d", "--difffolder", dest="difffolder", action="store", default="", help="folder where differences file stored [default: %(default)s]") + parser.add_argument("-f", "--difffile", dest="difffile", action="store", default="", help="file where differences file stored [default: %(default)s]") # Process arguments args = parser.parse_args() @@ -183,14 +183,13 @@ USAGE previousversion = args.previousversion jirakeyprefix = args.jirakeyprefix outputoptions = args.outputoptions - difffolder = args.difffolder + difffile = args.difffile print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) - print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", difffolder) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) - if difffolder: - makeFolder(difffolder) - outfh = open(os.path.join(difffolder, "differences.txt"), 'w') + if difffile: + outfh = open(difffile), 'w') else: outfh = sys.stdout diff --git a/meta/folder.groovy b/meta/folder.groovy index 570a3ea..8bd80d3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -19,8 +19,8 @@ abstract class GISJsonSerialised implements Serializable { } class ProductInfo extends GISJsonSerialised { - private String productname - private String subcomponentname + String productname + String subcomponentname String jirakey ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { @@ -388,6 +388,7 @@ class MetaInfo extends GISJsonSerialised { private static String FORMAT = "0.1" private static String METAFOLDERNAME = "meta" private static String METAFILENAME = "info.json" + private static String METADIFFFILENAME = "differences.txt" private static String METAARTIFACTS = "${METAFOLDERNAME}/**" class RelatedMetaInfo extends GISJsonSerialised { @@ -519,7 +520,11 @@ class MetaInfo extends GISJsonSerialised { static String metafilepath() { return METAFOLDERNAME + "/" + METAFILENAME } - + + static String difffilepath() { + return METAFOLDERNAME + "/" + METADIFFFILENAME + } + MetaInfo importrelated(String destpath) { MetaInfo mi = new MetaInfo(script) @@ -532,6 +537,17 @@ class MetaInfo extends GISJsonSerialised { RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) associatedmeta.add(rmi) + def importedmetadifffile = adjustedpath + "/" + difffilepath() + if (script.fileExists(importedmetadifffile)) { + def String newcontents = script.readFile(file: importedmetadifffile) + def String currentcontents = "" + if (script.fileExists(difffilepath())) { + currentcontents = script.readFile(file: difffilepath()) + } + + script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " mi.productinfo.componentname + ":\n" + newcontents) + } + return mi } From 56fab48730ee1813f2790f2857bc7130ec430f96 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:05:23 +0000 Subject: [PATCH 0507/1971] Alter differences file generation; Merge differences when importing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 8bd80d3..2269a77 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -545,7 +545,7 @@ class MetaInfo extends GISJsonSerialised { currentcontents = script.readFile(file: difffilepath()) } - script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " mi.productinfo.componentname + ":\n" + newcontents) + script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.componentname + ":\n" + newcontents) } return mi From e452d7823e3bb03a2c30157175514cdfb5c9a389 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:05:23 +0000 Subject: [PATCH 0508/1971] Alter differences file generation; Merge differences when importing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 8bd80d3..2269a77 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -545,7 +545,7 @@ class MetaInfo extends GISJsonSerialised { currentcontents = script.readFile(file: difffilepath()) } - script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " mi.productinfo.componentname + ":\n" + newcontents) + script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.componentname + ":\n" + newcontents) } return mi From e079fb83b747468434bc0b5f4e65d6f2780f0bf0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:31:21 +0000 Subject: [PATCH 0509/1971] Alter differences file generation; Merge differences when importing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2269a77..ac2ab9a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -545,7 +545,7 @@ class MetaInfo extends GISJsonSerialised { currentcontents = script.readFile(file: difffilepath()) } - script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.componentname + ":\n" + newcontents) + script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents) } return mi From c98a09f5250d499c22f3c0b426213151cee2ce44 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:31:21 +0000 Subject: [PATCH 0510/1971] Alter differences file generation; Merge differences when importing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2269a77..ac2ab9a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -545,7 +545,7 @@ class MetaInfo extends GISJsonSerialised { currentcontents = script.readFile(file: difffilepath()) } - script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.componentname + ":\n" + newcontents) + script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents) } return mi From 6f1bbf0aef834682debfce53be0e317311c30bfe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:36:42 +0000 Subject: [PATCH 0511/1971] Alter differences file generation; Merge differences when importing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ac2ab9a..9c5367e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -545,7 +545,7 @@ class MetaInfo extends GISJsonSerialised { currentcontents = script.readFile(file: difffilepath()) } - script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents) + script.writeFile(file: difffilepath(), text: currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents) } return mi From 0f2ae8596496efab7e0bf0448bac9ec93e494346 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:36:42 +0000 Subject: [PATCH 0512/1971] Alter differences file generation; Merge differences when importing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ac2ab9a..9c5367e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -545,7 +545,7 @@ class MetaInfo extends GISJsonSerialised { currentcontents = script.readFile(file: difffilepath()) } - script.writeFile(file: difffilepath(), currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents) + script.writeFile(file: difffilepath(), text: currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents) } return mi From 76bcd9fdea770e94dac367703efece5a1f8db87c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:41:49 +0000 Subject: [PATCH 0513/1971] Alter differences file generation; Merge differences when importing --- differences/show_release_differences.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index fee6f7b..0600753 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -189,7 +189,7 @@ USAGE print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) if difffile: - outfh = open(difffile), 'w') + outfh = open(difffile, 'w') else: outfh = sys.stdout From 94ef8956ba6bdd56bd225850ae290e2c0771dfde Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:41:49 +0000 Subject: [PATCH 0514/1971] Alter differences file generation; Merge differences when importing --- differences/show_release_differences.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index fee6f7b..0600753 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -189,7 +189,7 @@ USAGE print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) if difffile: - outfh = open(difffile), 'w') + outfh = open(difffile, 'w') else: outfh = sys.stdout From eb295970556ebef75e7e0a0112de745a26ac6ea2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:51:43 +0000 Subject: [PATCH 0515/1971] Alter differences file generation; Merge differences when importing --- differences/show_release_differences.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 0600753..ddf8c0d 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -29,10 +29,6 @@ class GitException(Exception): def __repr__(self): return self.message -def makeFolder(difffolder): - print("Creating folder (if not already there): {0}".format(difffolder)) - os.makedirs(difffolder, exist_ok = True) - def printDivider(outfh, times = 1, length = 100): for _ in range(times): outfh.write("{0}\n".format("*" * length)) @@ -208,7 +204,7 @@ USAGE gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if difffolder: + if difffile: outfh.close() return 0 except Exception as e: From 5491405110db56d84eedeb45368523c1d2793721 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 14:51:43 +0000 Subject: [PATCH 0516/1971] Alter differences file generation; Merge differences when importing --- differences/show_release_differences.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 0600753..ddf8c0d 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -29,10 +29,6 @@ class GitException(Exception): def __repr__(self): return self.message -def makeFolder(difffolder): - print("Creating folder (if not already there): {0}".format(difffolder)) - os.makedirs(difffolder, exist_ok = True) - def printDivider(outfh, times = 1, length = 100): for _ in range(times): outfh.write("{0}\n".format("*" * length)) @@ -208,7 +204,7 @@ USAGE gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if difffolder: + if difffile: outfh.close() return 0 except Exception as e: From a68a9027717abb013386d18d5774ae25c89454b0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 15:05:23 +0000 Subject: [PATCH 0517/1971] Add HMBFDGMA jira comment regular expression --- differences/show_release_differences.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index ddf8c0d..80b636e 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -80,6 +80,9 @@ jiraprojectpattern = { 'HMBFDHV': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Hh][Vv][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *HMBFDHV-(\d+):* (.*)"$'), ), + 'HMBFDGMA': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Gg][Mm][Aa][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBFDGMA-(\d+):* (.*)"$'), + ), } mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") From 5bb08476af818e51c87b40798049bf249bc2b6a4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 15:05:23 +0000 Subject: [PATCH 0518/1971] Add HMBFDGMA jira comment regular expression --- differences/show_release_differences.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index ddf8c0d..80b636e 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -80,6 +80,9 @@ jiraprojectpattern = { 'HMBFDHV': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Hh][Vv][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *HMBFDHV-(\d+):* (.*)"$'), ), + 'HMBFDGMA': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Gg][Mm][Aa][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBFDGMA-(\d+):* (.*)"$'), + ), } mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") From 2f5617caea148498daadd3f4faf6aca95727777f Mon Sep 17 00:00:00 2001 From: Damian Smith Date: Thu, 29 Nov 2018 15:13:15 +0000 Subject: [PATCH 0519/1971] Merge commit '5bb08476af818e51c87b40798049bf249bc2b6a4' into 1.10003.j20-comscr # Conflicts: # autobuild/Common_scripts/versionnumbering/metaversion.groovy --- artifacts/metaexport.groovy | 8 +- autobuilder.groovy | 10 ++- differences/do.groovy | 6 +- differences/show_release_differences.py | 20 +++-- import/importer.groovy | 4 +- meta/folder.groovy | 103 +++++++++++++++++++----- versionnumbering/generate.groovy | 17 ++-- versionnumbering/metaversion.groovy | 100 ----------------------- 8 files changed, 122 insertions(+), 146 deletions(-) delete mode 100644 versionnumbering/metaversion.groovy diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index b6a832b..b4d4a6d 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -4,6 +4,7 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def ArrayList artifactFolders = new ArrayList() + int revisiontotal = 0 for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { @@ -13,11 +14,14 @@ def combineSubjobArtifacts(meta, subJobs) { dir(destFolder) { deleteDir() } - importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + importedmeta = importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + revisiontotal += importedmeta.buildstampinfo.revision artifactFolders.add("${destFolder}/**") } } - return artifactFolders; + def versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + revisiontotal = revisiontotal % (versiongenerator.maxversionnumber() + 1) + return [artifactFolders, revisiontotal] } return this; diff --git a/autobuilder.groovy b/autobuilder.groovy index 2a04925..9f0aece 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -4,6 +4,8 @@ autobuildroot = "${WORKSPACE}/autobuild" commonscriptsroot = "${autobuildroot}/Common_scripts" +metafolderscript = null + def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { echo "Cleaning workspace" @@ -25,17 +27,21 @@ def getautobuildpath() { return autobuildroot } +def getmetafolderscript() { + return metafolderscript +} + // Start up boilderplate def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath commonscriptsroot = commonscriptspath + metafolderscript = load("${commonscripts()}/meta/folder.groovy") conditionalclean() - def metafolder = load("${commonscripts()}/meta/folder.groovy") - def meta = metafolder.metareset(script) + def meta = getmetafolderscript().metareset(script) meta.productinfo.set(productname, subcomponentname, jirakey) def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) diff --git a/differences/do.groovy b/differences/do.groovy index 35e0980..32f18b5 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -1,16 +1,16 @@ def differences(meta, String sourcerevision, String previoussourcerevision, String sourcepath) { def String cs = autobuilder.commonscripts() - def String difffolder = meta.folder() + def String difffile = meta.difffilepath() def String jirakey = meta.productinfo.jirakey if (isUnix()) { sh """ - "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" + "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}" """ } else { bat """ - "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -d "${difffolder}" + "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}" """ } } diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 0813356..80b636e 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -29,10 +29,6 @@ class GitException(Exception): def __repr__(self): return self.message -def makeFolder(difffolder): - print("Creating folder (if not already there): {0}".format(difffolder)) - os.makedirs(difffolder, exist_ok = True) - def printDivider(outfh, times = 1, length = 100): for _ in range(times): outfh.write("{0}\n".format("*" * length)) @@ -84,6 +80,9 @@ jiraprojectpattern = { 'HMBFDHV': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Hh][Vv][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *HMBFDHV-(\d+):* (.*)"$'), ), + 'HMBFDGMA': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Gg][Mm][Aa][ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBFDGMA-(\d+):* (.*)"$'), + ), } mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") @@ -172,7 +171,7 @@ USAGE parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") - parser.add_argument("-d", "--difffolder", dest="difffolder", action="store", default="", help="folder where differences file stored [default: %(default)s]") + parser.add_argument("-f", "--difffile", dest="difffile", action="store", default="", help="file where differences file stored [default: %(default)s]") # Process arguments args = parser.parse_args() @@ -183,14 +182,13 @@ USAGE previousversion = args.previousversion jirakeyprefix = args.jirakeyprefix outputoptions = args.outputoptions - difffolder = args.difffolder + difffile = args.difffile print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) - print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Version folder:", difffolder) + print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) - if difffolder: - makeFolder(difffolder) - outfh = open(os.path.join(difffolder, "differences.txt"), 'w') + if difffile: + outfh = open(difffile, 'w') else: outfh = sys.stdout @@ -209,7 +207,7 @@ USAGE gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if difffolder: + if difffile: outfh.close() return 0 except Exception as e: diff --git a/import/importer.groovy b/import/importer.groovy index a9e28b2..4d24d30 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -7,7 +7,7 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, St selector: specific(buildnumber.toString()), target: destpath ) - meta.importrelated(destpath) + return meta.importrelated(destpath) } def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { @@ -21,7 +21,7 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat ], target: destpath ) - meta.importrelated(destpath) + return meta.importrelated(destpath) } return this; diff --git a/meta/folder.groovy b/meta/folder.groovy index 8f26265..9c5367e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -19,8 +19,8 @@ abstract class GISJsonSerialised implements Serializable { } class ProductInfo extends GISJsonSerialised { - private String productname - private String subcomponentname + String productname + String subcomponentname String jirakey ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { @@ -137,30 +137,40 @@ class JenkinsBuildInfo extends GISJsonSerialised { class BuildStampInfo extends GISJsonSerialised { private String buildstampprefix - private int revision + int revision String buildstamp - String buildstampcommasep - BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "", buildstampcommasep = "") { + BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "") { super(script) this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp - this.buildstampcommasep = buildstampcommasep } - void set(String buildstampprefix, int revision, String buildstamp, String buildstampcommasep) { + void set(String buildstampprefix, int revision, String buildstamp) { this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp - this.buildstampcommasep = buildstampcommasep + } + + 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 deserialiseJson(rawmeta) { buildstampprefix = rawmeta['buildstampprefix'] revision = rawmeta['revision'] buildstamp = rawmeta['buildstamp'] - buildstampcommasep = rawmeta['buildstampcommasep'] } LinkedHashMap serialisationdata() { @@ -168,15 +178,14 @@ class BuildStampInfo extends GISJsonSerialised { 'buildstampprefix' : buildstampprefix, 'revision' : revision, 'buildstamp' : buildstamp, - 'buildstampcommasep' : buildstampcommasep, ] return data } } class ReleaseInfo extends GISJsonSerialised { - private String releaserepoURL - private ArrayList releaseitems + String releaserepoURL + ArrayList releaseitems ReleaseInfo(script, releaserepoURL = "") { super(script) @@ -376,10 +385,11 @@ class PublishableInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { - private String FORMAT = "0.1" - private String METAFOLDERNAME = "meta" - private String METAFILENAME = "info.json" - private String METAARTIFACTS = "${METAFOLDERNAME}/**" + private static String FORMAT = "0.1" + private static String METAFOLDERNAME = "meta" + private static String METAFILENAME = "info.json" + private static String METADIFFFILENAME = "differences.txt" + private static String METAARTIFACTS = "${METAFOLDERNAME}/**" class RelatedMetaInfo extends GISJsonSerialised { String offsetpath @@ -507,10 +517,14 @@ class MetaInfo extends GISJsonSerialised { return path } - String metafilepath() { + static String metafilepath() { return METAFOLDERNAME + "/" + METAFILENAME } - + + static String difffilepath() { + return METAFOLDERNAME + "/" + METADIFFFILENAME + } + MetaInfo importrelated(String destpath) { MetaInfo mi = new MetaInfo(script) @@ -523,6 +537,17 @@ class MetaInfo extends GISJsonSerialised { RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) associatedmeta.add(rmi) + def importedmetadifffile = adjustedpath + "/" + difffilepath() + if (script.fileExists(importedmetadifffile)) { + def String newcontents = script.readFile(file: importedmetadifffile) + def String currentcontents = "" + if (script.fileExists(difffilepath())) { + currentcontents = script.readFile(file: difffilepath()) + } + + script.writeFile(file: difffilepath(), text: currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents) + } + return mi } @@ -563,6 +588,42 @@ class MetaInfo extends GISJsonSerialised { 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 + } + + Map releasewalkerunique(int maxdepth, String startpath = "") { + Map releasemetauniquecollection = new LinkedHashMap() + ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) + for (relatedmetainfo in releasemetacollection) { + String uniquestring = relatedmetainfo.meta.productinfo.productname + "_" + relatedmetainfo.meta.productinfo.subcomponentname + releasemetauniquecollection.put(uniquestring, relatedmetainfo) + } + return releasemetauniquecollection + } } MetaInfo metareset(script) { @@ -575,4 +636,10 @@ MetaInfo metareset(script) { return mi } +MetaInfo metafromfolder(String folder = "") { + MetaInfo buildmeta = new MetaInfo(this) + buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") + return buildmeta +} + return this; diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 59fe2a3..a7b583a 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,15 +1,18 @@ +def int maxversionnumber() { + def int MAXVERSIONNUMBER = 65535 + return MAXVERSIONNUMBER +} + def getGitRevision(String gitrootpath, int basebuildnumber) { def int adjustedchangecount def String gitrevision def String remoteinfo def String remoteurl dir( gitrootpath) { - def int MAXVERSIONNUMBER = 65535 - def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() echo "Change count: ${changecount}" - adjustedchangecount = (changecount + basebuildnumber) % (MAXVERSIONNUMBER + 1) + adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() @@ -18,7 +21,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() echo "Remote info: ${remoteinfo}" - remoteurl = sh(returnStdout: true, script: "git remote get-url --push origin").trim() + remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] @@ -28,8 +31,6 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { // origin/master // origin/2.0.x def getVersionPrefix(String sourcebranch) { - def int MAXVERSIONNUMBER = 65535 - echo "Determining version number prefix from source branch name: ${sourcebranch}" sourcebranch = sourcebranch.toLowerCase() @@ -65,7 +66,7 @@ def getVersionPrefix(String sourcebranch) { def integers = [] for (integerstring in integerstrings) { int integer = integerstring.toInteger() - integer = integer % (MAXVERSIONNUMBER + 1) + integer = integer % (maxversionnumber() + 1) integers.add(integer) } @@ -112,7 +113,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum echo "Build stamp is: ${buildstamp}" meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) - meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp, buildstamp.replace(".", ",")) + meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp) return buildstamp } diff --git a/versionnumbering/metaversion.groovy b/versionnumbering/metaversion.groovy deleted file mode 100644 index 44bfbde..0000000 --- a/versionnumbering/metaversion.groovy +++ /dev/null @@ -1,100 +0,0 @@ - -def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") -def fileutils = load("${autobuilder.commonscripts()}/file/utils.groovy") - -def prefixline(rootpath, filepath) { - def fileContents = readFile("${filepath}").trim() - def fileContentsNormalized = fileContents.normalize() - - def newFileContents = "" - def lines = fileContentsNormalized.readLines() - for (aline in lines) { - newFileContents += "${rootpath}" + "/" + aline + "${nl}" - } - return newFileContents -} - -def mergemeta(rootpath, versionFolder, outputFolder) { - echo "Merging meta data from folder: ${versionFolder} to ${outputFolder}" - - def differencesFile = "${versionFolder}/differences.txt" - def newContents = readFile file: "${differencesFile}" - def metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + newContents - - def buildStampFile = "${versionFolder}/buildstamps.txt" - def buildStampFileContents = prefixline(rootpath, "${buildStampFile}") - def metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + buildStampFileContents - - def intrevision = 0 - if (fileExists("${versionFolder}/revision.txt")) { - def revision = readFile("${versionFolder}/revision.txt").trim() - intrevision = revision.toInteger() - echo "Revision read in: ${intrevision}" - } - else { - intrevision = 1 - } - - return intrevision -} - -def appendcomponentinfo(rootpath, versionFolder, outputFolder) { - echo "Appending component version data from folder: ${versionFolder} to ${outputFolder}" - - def differencesFile = "${versionFolder}/differences.txt" - if (fileExists("${differencesFile}")) { - def newContents = readFile file: "${differencesFile}" - def metadifferencesFile = "${outputFolder}/differences.txt" - writeFile file: "${metadifferencesFile}", text: fileutils.currentContents(metadifferencesFile) + "${differencesFile}:\n" + newContents - } - - def buildStampFile = "${versionFolder}/buildstamps.txt" - def buildStampFileContents = readFile("${buildStampFile}").trim() - - def remoteurlFile = "${versionFolder}/remoteurl.txt" - def remoteurlFileContents = fileutils.currentContents(remoteurlFile, "", 'Unknown').trim() - - def gitRevisionFile = "${versionFolder}/gitrevision.txt" - def gitRevisionFileContents = readFile("${gitRevisionFile}").trim() - - def releaseJobNameFile = "${versionFolder}/releasejobname.txt" - def releaseJobNameContents = fileutils.currentContents("${releaseJobNameFile}", "", "-").trim() - - def metabuildStampFile = "${outputFolder}/buildstamps.txt" - writeFile file: "${metabuildStampFile}", text: fileutils.currentContents(metabuildStampFile) + "${rootpath}" + ":" + buildStampFileContents + "," + remoteurlFileContents + "," + gitRevisionFileContents + "," + releaseJobNameContents - def revision = readFile("${versionFolder}/revision.txt").trim() - def intrevision = revision.toInteger() - echo "Revision read in: ${intrevision}" - - return intrevision -} - -// Each version folder should have been created using version creation scripts in this Common_scripts folder -// as their are well-known files in each folder -def combineSubjobVersions(versionLabelPrefix, artifactList, outputFolder = "${WORKSPACE}/metaversion") { - def totalrevision = 0 - dir("${outputFolder}") { - deleteDir() - } - for (artifactItem in artifactList) { - (rootpath, versionFolder) = artifactItem - echo "Inspecting folder: ${versionFolder}" - def metaversionsignaturefile = "${versionFolder}/metaversion.txt" - // If the sub project is a meta job - def intrevision = 0 - if (fileExists("${metaversionsignaturefile}")) { - intrevision = mergemeta(rootpath, versionFolder, outputFolder) - } - else { - intrevision = appendcomponentinfo(rootpath, versionFolder, outputFolder) - } - totalrevision += intrevision - } - echo "Accumulated revision is: ${totalrevision}" - writeFile file: "${outputFolder}/metaversion.txt", text: versionLabelPrefix + ((versionLabelPrefix.endsWith(".")) ? "" : ".") + totalrevision.toString() - writeFile(file: "${outputFolder}/revision.txt", text: totalrevision.toString()) -} - -return this; \ No newline at end of file From 694f633e90568dd994f25c75d02241fb0cce5340 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 15:19:55 +0000 Subject: [PATCH 0520/1971] Alter differences file generation; Merge differences when importing --- differences/show_release_differences.py | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 80b636e..5c0f15d 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -188,6 +188,7 @@ USAGE print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) if difffile: + os.makedirs(os.path.dirname(difffile), exist_ok=True) outfh = open(difffile, 'w') else: outfh = sys.stdout From aa497116fd9078857227afef34bf88c184030998 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 15:19:55 +0000 Subject: [PATCH 0521/1971] Alter differences file generation; Merge differences when importing --- differences/show_release_differences.py | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 80b636e..5c0f15d 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -188,6 +188,7 @@ USAGE print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) if difffile: + os.makedirs(os.path.dirname(difffile), exist_ok=True) outfh = open(difffile, 'w') else: outfh = sys.stdout From 74ceec1d875824def70ddd0a0b9a359da227d48b Mon Sep 17 00:00:00 2001 From: Damian Smith Date: Thu, 29 Nov 2018 15:26:07 +0000 Subject: [PATCH 0522/1971] Merge commit 'aa497116fd9078857227afef34bf88c184030998' into 1.10003.j20-comscr --- differences/show_release_differences.py | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 80b636e..5c0f15d 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -188,6 +188,7 @@ USAGE print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) if difffile: + os.makedirs(os.path.dirname(difffile), exist_ok=True) outfh = open(difffile, 'w') else: outfh = sys.stdout From 49718547b78ed58e900d14f47e9319a17ce9686d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 17:48:05 +0000 Subject: [PATCH 0523/1971] Move release functionality into Common_scripts --- release/do.groovy | 131 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 release/do.groovy diff --git a/release/do.groovy b/release/do.groovy new file mode 100644 index 0000000..72c2f9f --- /dev/null +++ b/release/do.groovy @@ -0,0 +1,131 @@ +boolean markunstable = false +String unstablereason = "" + +String summaryfolder = "${WORKSPACE}/summary" +String summaryfile = "${summaryfolder}/summary.txt" +String releaserepofolder = "${WORKSPACE}/releaserepos" +String tempfolder = "${WORKSPACE}/temp" + +def resetfolders() { + dir(summaryfolder) { + deleteDir() + } + dir(releaserepofolder) { + deleteDir() + } + dir(tempfolder) { + deleteDir() + } +} + +def start() { + markunstable = false + unstablereason = "" + writeFile(file: summaryfile, text: "Release 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 + "\n") +} + +def checkoutreleaserepo(info, String checkoutfolder) { + def String releaserepo = info.meta.releaseinfo.releaserepoURL + // Get the latest head revision of the release repo without checking out working copy; Check out to a folder unique to component + dir(releaserepofolder) { + sh("git clone -n --depth 1 ${releaserepo} ${checkoutfolder}") + } +} + +def getcomponentartifacts(info, String repofolder, String tempfolder) { + // Copy relevant artifacts to temp folder + summaryappend("Artifacts: ") + for (artifactfilter in info.meta.releaseinfo.releaseitems) { + def filterpath = artifactfilter + if (info.offsetpath) { + filterpath = info.offsetpath + '/' + artifactfilter + } + // Copy relevant artifacts to temp folder + echo "Copying artifacts: ${filterpath} to ${tempfolder}" + copyArtifacts( + filter: filterpath, + projectName: BUILD_JOB, + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: BUILD_JOB_SELECTOR + ], + target: tempfolder + ) + // Move relevant artifacts from temp folder to release position + def originalrootdir = tempfolder + "/" + info.offsetpath + dir(originalrootdir) { + sh("mv * ${repofolder}") + } + summaryappend("${artifactfilter},") + } +} + +def gitrelease(String releaserepo, String buildstamp) { + summaryappend(" Git operations: ") + dir(releaserepo) { + // Add anything new + sh("git add .") + summaryappend("Add,") + // Perform git commit (if necessary) + def changesoccurred = sh(script: "git status --porcelain", returnStdout: true) + if (changesoccurred) { + sh("git commit -a -m ${buildstamp}") + summaryappend("Commit,") + } + else { + summaryappend("No-commit,") + } + // Tag with buildstamp + sh("git tag ${buildstamp}") + summaryappend("Tag (${buildstamp}),") + if (DRY_RUN_PUSH == "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 releasecomponent(info) { + def String uniquefolder = "${info.meta.productinfo.productname}_${info.meta.productinfo.subcomponentname}" + def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" + def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" + + summaryappend("${info.meta.productinfo.productname} ${info.meta.productinfo.subcomponentname}: ") + checkoutreleaserepo(info, uniquefolderforrepo) + + getcomponentartifacts(info, uniquefolderforrepo, uniquefoldertemp) + + def String buildstamp = info.meta.buildstampinfo.buildstamp + gitrelease(uniquefolderforrepo, buildstamp) +} + +def releasehierarchy(buildmeta, int maxdepth = MAX_META_DEPTH) { + start() + + // Walk the meta information to a max depth, looking for artifacts to import for release + componentReleaseInfo = buildmeta.releasewalkerunique(maxdepth.toInteger()) + + // For each component + for (key in componentReleaseInfo.keySet()) { + def info = componentReleaseInfo[key] + releasecomponent(info) + } + return [markunstable, unstablereason] +} + +return this; \ No newline at end of file From db54da7b0577f004033c5104c5f22fc10f090fdc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 17:48:05 +0000 Subject: [PATCH 0524/1971] Move release functionality into Common_scripts --- release/do.groovy | 131 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 release/do.groovy diff --git a/release/do.groovy b/release/do.groovy new file mode 100644 index 0000000..72c2f9f --- /dev/null +++ b/release/do.groovy @@ -0,0 +1,131 @@ +boolean markunstable = false +String unstablereason = "" + +String summaryfolder = "${WORKSPACE}/summary" +String summaryfile = "${summaryfolder}/summary.txt" +String releaserepofolder = "${WORKSPACE}/releaserepos" +String tempfolder = "${WORKSPACE}/temp" + +def resetfolders() { + dir(summaryfolder) { + deleteDir() + } + dir(releaserepofolder) { + deleteDir() + } + dir(tempfolder) { + deleteDir() + } +} + +def start() { + markunstable = false + unstablereason = "" + writeFile(file: summaryfile, text: "Release 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 + "\n") +} + +def checkoutreleaserepo(info, String checkoutfolder) { + def String releaserepo = info.meta.releaseinfo.releaserepoURL + // Get the latest head revision of the release repo without checking out working copy; Check out to a folder unique to component + dir(releaserepofolder) { + sh("git clone -n --depth 1 ${releaserepo} ${checkoutfolder}") + } +} + +def getcomponentartifacts(info, String repofolder, String tempfolder) { + // Copy relevant artifacts to temp folder + summaryappend("Artifacts: ") + for (artifactfilter in info.meta.releaseinfo.releaseitems) { + def filterpath = artifactfilter + if (info.offsetpath) { + filterpath = info.offsetpath + '/' + artifactfilter + } + // Copy relevant artifacts to temp folder + echo "Copying artifacts: ${filterpath} to ${tempfolder}" + copyArtifacts( + filter: filterpath, + projectName: BUILD_JOB, + selector: [ + $class: 'ParameterizedBuildSelector', + parameterName: BUILD_JOB_SELECTOR + ], + target: tempfolder + ) + // Move relevant artifacts from temp folder to release position + def originalrootdir = tempfolder + "/" + info.offsetpath + dir(originalrootdir) { + sh("mv * ${repofolder}") + } + summaryappend("${artifactfilter},") + } +} + +def gitrelease(String releaserepo, String buildstamp) { + summaryappend(" Git operations: ") + dir(releaserepo) { + // Add anything new + sh("git add .") + summaryappend("Add,") + // Perform git commit (if necessary) + def changesoccurred = sh(script: "git status --porcelain", returnStdout: true) + if (changesoccurred) { + sh("git commit -a -m ${buildstamp}") + summaryappend("Commit,") + } + else { + summaryappend("No-commit,") + } + // Tag with buildstamp + sh("git tag ${buildstamp}") + summaryappend("Tag (${buildstamp}),") + if (DRY_RUN_PUSH == "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 releasecomponent(info) { + def String uniquefolder = "${info.meta.productinfo.productname}_${info.meta.productinfo.subcomponentname}" + def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" + def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" + + summaryappend("${info.meta.productinfo.productname} ${info.meta.productinfo.subcomponentname}: ") + checkoutreleaserepo(info, uniquefolderforrepo) + + getcomponentartifacts(info, uniquefolderforrepo, uniquefoldertemp) + + def String buildstamp = info.meta.buildstampinfo.buildstamp + gitrelease(uniquefolderforrepo, buildstamp) +} + +def releasehierarchy(buildmeta, int maxdepth = MAX_META_DEPTH) { + start() + + // Walk the meta information to a max depth, looking for artifacts to import for release + componentReleaseInfo = buildmeta.releasewalkerunique(maxdepth.toInteger()) + + // For each component + for (key in componentReleaseInfo.keySet()) { + def info = componentReleaseInfo[key] + releasecomponent(info) + } + return [markunstable, unstablereason] +} + +return this; \ No newline at end of file From 94bb1d5c7dbe63d6b598be07f72d55a6b4fb5185 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 17:56:08 +0000 Subject: [PATCH 0525/1971] Move release functionality into Common_scripts --- release/do.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 72c2f9f..239cc17 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -114,11 +114,12 @@ def releasecomponent(info) { gitrelease(uniquefolderforrepo, buildstamp) } -def releasehierarchy(buildmeta, int maxdepth = MAX_META_DEPTH) { +def releasehierarchy(buildmeta, String maxdepth) { + int md = maxdepth.toInteger() start() // Walk the meta information to a max depth, looking for artifacts to import for release - componentReleaseInfo = buildmeta.releasewalkerunique(maxdepth.toInteger()) + componentReleaseInfo = buildmeta.releasewalkerunique(md) // For each component for (key in componentReleaseInfo.keySet()) { From 66973f0034206d128ecdbd661410425d0bd4c999 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 17:56:08 +0000 Subject: [PATCH 0526/1971] Move release functionality into Common_scripts --- release/do.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 72c2f9f..239cc17 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -114,11 +114,12 @@ def releasecomponent(info) { gitrelease(uniquefolderforrepo, buildstamp) } -def releasehierarchy(buildmeta, int maxdepth = MAX_META_DEPTH) { +def releasehierarchy(buildmeta, String maxdepth) { + int md = maxdepth.toInteger() start() // Walk the meta information to a max depth, looking for artifacts to import for release - componentReleaseInfo = buildmeta.releasewalkerunique(maxdepth.toInteger()) + componentReleaseInfo = buildmeta.releasewalkerunique(md) // For each component for (key in componentReleaseInfo.keySet()) { From 24c40a47d951e3ce6244fd3fa048063d4e1e5036 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:09:13 +0000 Subject: [PATCH 0527/1971] Move release functionality into Common_scripts --- release/do.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 239cc17..17090fe 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -1,10 +1,10 @@ -boolean markunstable = false -String unstablereason = "" +markunstable = false +unstablereason = "" -String summaryfolder = "${WORKSPACE}/summary" -String summaryfile = "${summaryfolder}/summary.txt" -String releaserepofolder = "${WORKSPACE}/releaserepos" -String tempfolder = "${WORKSPACE}/temp" +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +releaserepofolder = "${WORKSPACE}/releaserepos" +tempfolder = "${WORKSPACE}/temp" def resetfolders() { dir(summaryfolder) { From f724c2115209e3d049b3e7bc381cbf5ba5609e34 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:09:13 +0000 Subject: [PATCH 0528/1971] Move release functionality into Common_scripts --- release/do.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 239cc17..17090fe 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -1,10 +1,10 @@ -boolean markunstable = false -String unstablereason = "" +markunstable = false +unstablereason = "" -String summaryfolder = "${WORKSPACE}/summary" -String summaryfile = "${summaryfolder}/summary.txt" -String releaserepofolder = "${WORKSPACE}/releaserepos" -String tempfolder = "${WORKSPACE}/temp" +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +releaserepofolder = "${WORKSPACE}/releaserepos" +tempfolder = "${WORKSPACE}/temp" def resetfolders() { dir(summaryfolder) { From 3500c13448bb2326bc50dbe39da037778e1b6813 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:11:37 +0000 Subject: [PATCH 0529/1971] Move release functionality into Common_scripts --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index 17090fe..177593d 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -118,6 +118,7 @@ def releasehierarchy(buildmeta, String maxdepth) { int md = maxdepth.toInteger() start() + resetfolders() // Walk the meta information to a max depth, looking for artifacts to import for release componentReleaseInfo = buildmeta.releasewalkerunique(md) From e17df02c5cb1017411d435c7b061365ea7fd287f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:11:37 +0000 Subject: [PATCH 0530/1971] Move release functionality into Common_scripts --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index 17090fe..177593d 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -118,6 +118,7 @@ def releasehierarchy(buildmeta, String maxdepth) { int md = maxdepth.toInteger() start() + resetfolders() // Walk the meta information to a max depth, looking for artifacts to import for release componentReleaseInfo = buildmeta.releasewalkerunique(md) From e0f0194df0306a9bf9adb5cc06e119faad3eb0df Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:15:32 +0000 Subject: [PATCH 0531/1971] Move release functionality into Common_scripts --- release/do.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 177593d..1eaf2b8 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -18,7 +18,7 @@ def resetfolders() { } } -def start() { +def preconditions() { markunstable = false unstablereason = "" writeFile(file: summaryfile, text: "Release summary: \n") @@ -116,9 +116,9 @@ def releasecomponent(info) { def releasehierarchy(buildmeta, String maxdepth) { int md = maxdepth.toInteger() - start() - resetfolders() + preconditions() + // Walk the meta information to a max depth, looking for artifacts to import for release componentReleaseInfo = buildmeta.releasewalkerunique(md) From 5d53126d199b99a070b4ebbf7c58b7623ea5535a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:15:32 +0000 Subject: [PATCH 0532/1971] Move release functionality into Common_scripts --- release/do.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 177593d..1eaf2b8 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -18,7 +18,7 @@ def resetfolders() { } } -def start() { +def preconditions() { markunstable = false unstablereason = "" writeFile(file: summaryfile, text: "Release summary: \n") @@ -116,9 +116,9 @@ def releasecomponent(info) { def releasehierarchy(buildmeta, String maxdepth) { int md = maxdepth.toInteger() - start() - resetfolders() + preconditions() + // Walk the meta information to a max depth, looking for artifacts to import for release componentReleaseInfo = buildmeta.releasewalkerunique(md) From 6765aaa932221f24fafae8304b03a3ba7adcf97f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:19:59 +0000 Subject: [PATCH 0533/1971] Move release functionality into Common_scripts --- release/do.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 1eaf2b8..264bd53 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -70,7 +70,7 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { } } -def gitrelease(String releaserepo, String buildstamp) { +def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { summaryappend(" Git operations: ") dir(releaserepo) { // Add anything new @@ -88,7 +88,7 @@ def gitrelease(String releaserepo, String buildstamp) { // Tag with buildstamp sh("git tag ${buildstamp}") summaryappend("Tag (${buildstamp}),") - if (DRY_RUN_PUSH == "true") { + 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)") @@ -100,7 +100,7 @@ def gitrelease(String releaserepo, String buildstamp) { } } -def releasecomponent(info) { +def releasecomponent(info, String dryrunpush) { def String uniquefolder = "${info.meta.productinfo.productname}_${info.meta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -111,10 +111,10 @@ def releasecomponent(info) { getcomponentartifacts(info, uniquefolderforrepo, uniquefoldertemp) def String buildstamp = info.meta.buildstampinfo.buildstamp - gitrelease(uniquefolderforrepo, buildstamp) + gitrelease(uniquefolderforrepo, buildstamp, dryrunpush) } -def releasehierarchy(buildmeta, String maxdepth) { +def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { int md = maxdepth.toInteger() resetfolders() preconditions() @@ -125,7 +125,7 @@ def releasehierarchy(buildmeta, String maxdepth) { // For each component for (key in componentReleaseInfo.keySet()) { def info = componentReleaseInfo[key] - releasecomponent(info) + releasecomponent(info, dryrunpush) } return [markunstable, unstablereason] } From 8316cf4cf71f0dba161436441509e0cd168235c3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:19:59 +0000 Subject: [PATCH 0534/1971] Move release functionality into Common_scripts --- release/do.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 1eaf2b8..264bd53 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -70,7 +70,7 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { } } -def gitrelease(String releaserepo, String buildstamp) { +def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { summaryappend(" Git operations: ") dir(releaserepo) { // Add anything new @@ -88,7 +88,7 @@ def gitrelease(String releaserepo, String buildstamp) { // Tag with buildstamp sh("git tag ${buildstamp}") summaryappend("Tag (${buildstamp}),") - if (DRY_RUN_PUSH == "true") { + 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)") @@ -100,7 +100,7 @@ def gitrelease(String releaserepo, String buildstamp) { } } -def releasecomponent(info) { +def releasecomponent(info, String dryrunpush) { def String uniquefolder = "${info.meta.productinfo.productname}_${info.meta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -111,10 +111,10 @@ def releasecomponent(info) { getcomponentartifacts(info, uniquefolderforrepo, uniquefoldertemp) def String buildstamp = info.meta.buildstampinfo.buildstamp - gitrelease(uniquefolderforrepo, buildstamp) + gitrelease(uniquefolderforrepo, buildstamp, dryrunpush) } -def releasehierarchy(buildmeta, String maxdepth) { +def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { int md = maxdepth.toInteger() resetfolders() preconditions() @@ -125,7 +125,7 @@ def releasehierarchy(buildmeta, String maxdepth) { // For each component for (key in componentReleaseInfo.keySet()) { def info = componentReleaseInfo[key] - releasecomponent(info) + releasecomponent(info, dryrunpush) } return [markunstable, unstablereason] } From 1e2d7e257a2a81f97e89914cafa2808c29d2d577 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:39:53 +0000 Subject: [PATCH 0535/1971] Move release functionality into Common_scripts --- release/do.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 264bd53..6db301c 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -31,7 +31,7 @@ def setunstable(String reason) { def summaryappend(String summary) { def String currentsummarycontents = readFile(file: summaryfile) - writeFile(file: summaryfile, text: currentsummarycontents + summary + "\n") + writeFile(file: summaryfile, text: currentsummarycontents + summary) } def checkoutreleaserepo(info, String checkoutfolder) { @@ -112,6 +112,8 @@ def releasecomponent(info, String dryrunpush) { def String buildstamp = info.meta.buildstampinfo.buildstamp gitrelease(uniquefolderforrepo, buildstamp, dryrunpush) + + summaryappend("\n") } def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { From e4f8dab2bbee21d2504f8466f2f60cd9eb00717b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 29 Nov 2018 18:39:53 +0000 Subject: [PATCH 0536/1971] Move release functionality into Common_scripts --- release/do.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 264bd53..6db301c 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -31,7 +31,7 @@ def setunstable(String reason) { def summaryappend(String summary) { def String currentsummarycontents = readFile(file: summaryfile) - writeFile(file: summaryfile, text: currentsummarycontents + summary + "\n") + writeFile(file: summaryfile, text: currentsummarycontents + summary) } def checkoutreleaserepo(info, String checkoutfolder) { @@ -112,6 +112,8 @@ def releasecomponent(info, String dryrunpush) { def String buildstamp = info.meta.buildstampinfo.buildstamp gitrelease(uniquefolderforrepo, buildstamp, dryrunpush) + + summaryappend("\n") } def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { From 522ec5c40960c8b6685904a004fff95b8d31a0da Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:07:08 +0000 Subject: [PATCH 0537/1971] Check for changes occurring --- release/do.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 6db301c..0d8e0de 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -73,11 +73,14 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { summaryappend(" Git operations: ") dir(releaserepo) { + def String precommitshacode = sh("git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Pre commit sha code: ${precommitshacode}" // Add anything new sh("git add .") summaryappend("Add,") // Perform git commit (if necessary) - def changesoccurred = sh(script: "git status --porcelain", returnStdout: true) + def changes = sh(script: "git status --porcelain", returnStdout: true) + boolean changesoccurred = changes?.trim() if (changesoccurred) { sh("git commit -a -m ${buildstamp}") summaryappend("Commit,") @@ -85,6 +88,8 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { else { summaryappend("No-commit,") } + def String postcommitshacode = sh("git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Post commit sha code: ${precommitshacode}" // Tag with buildstamp sh("git tag ${buildstamp}") summaryappend("Tag (${buildstamp}),") From 4e140fe10a98a0b28c82bfc39c86442dc5f22a64 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:07:08 +0000 Subject: [PATCH 0538/1971] Check for changes occurring --- release/do.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 6db301c..0d8e0de 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -73,11 +73,14 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { summaryappend(" Git operations: ") dir(releaserepo) { + def String precommitshacode = sh("git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Pre commit sha code: ${precommitshacode}" // Add anything new sh("git add .") summaryappend("Add,") // Perform git commit (if necessary) - def changesoccurred = sh(script: "git status --porcelain", returnStdout: true) + def changes = sh(script: "git status --porcelain", returnStdout: true) + boolean changesoccurred = changes?.trim() if (changesoccurred) { sh("git commit -a -m ${buildstamp}") summaryappend("Commit,") @@ -85,6 +88,8 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { else { summaryappend("No-commit,") } + def String postcommitshacode = sh("git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Post commit sha code: ${precommitshacode}" // Tag with buildstamp sh("git tag ${buildstamp}") summaryappend("Tag (${buildstamp}),") From 2100c7a0f371ecf347aab8b2605d5d1798e6f0c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:09:48 +0000 Subject: [PATCH 0539/1971] Check for changes occurring --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 0d8e0de..cd49d41 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -73,7 +73,7 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { summaryappend(" Git operations: ") dir(releaserepo) { - def String precommitshacode = sh("git rev-parse --verify HEAD", returnStdout: true).trim() + def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" // Add anything new sh("git add .") @@ -88,7 +88,7 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { else { summaryappend("No-commit,") } - def String postcommitshacode = sh("git rev-parse --verify HEAD", returnStdout: true).trim() + def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Post commit sha code: ${precommitshacode}" // Tag with buildstamp sh("git tag ${buildstamp}") From 2a7e51f64d6c2915e65cebe714611f771637519c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:09:48 +0000 Subject: [PATCH 0540/1971] Check for changes occurring --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 0d8e0de..cd49d41 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -73,7 +73,7 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { summaryappend(" Git operations: ") dir(releaserepo) { - def String precommitshacode = sh("git rev-parse --verify HEAD", returnStdout: true).trim() + def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" // Add anything new sh("git add .") @@ -88,7 +88,7 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { else { summaryappend("No-commit,") } - def String postcommitshacode = sh("git rev-parse --verify HEAD", returnStdout: true).trim() + def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Post commit sha code: ${precommitshacode}" // Tag with buildstamp sh("git tag ${buildstamp}") From 5616f9154065a0d26cdbcffce89f497785e31dfe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:28:15 +0000 Subject: [PATCH 0541/1971] Check for changes occurring --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index cd49d41..e72d6f2 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -81,6 +81,7 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { // Perform git commit (if necessary) def changes = sh(script: "git status --porcelain", returnStdout: true) boolean changesoccurred = changes?.trim() + echo "changesoccurred: ${changesoccurred}" if (changesoccurred) { sh("git commit -a -m ${buildstamp}") summaryappend("Commit,") From 0489ee2d82472b3b65410f91e7e199ff41e1b9f0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:28:15 +0000 Subject: [PATCH 0542/1971] Check for changes occurring --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index cd49d41..e72d6f2 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -81,6 +81,7 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { // Perform git commit (if necessary) def changes = sh(script: "git status --porcelain", returnStdout: true) boolean changesoccurred = changes?.trim() + echo "changesoccurred: ${changesoccurred}" if (changesoccurred) { sh("git commit -a -m ${buildstamp}") summaryappend("Commit,") From 9b886717159ba65ec6d32e788ed4e6f7a1aed162 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:32:17 +0000 Subject: [PATCH 0543/1971] Update --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index e72d6f2..11eb648 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -81,11 +81,11 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { // Perform git commit (if necessary) def changes = sh(script: "git status --porcelain", returnStdout: true) boolean changesoccurred = changes?.trim() - echo "changesoccurred: ${changesoccurred}" + echo "changes: ${changes}\nchangesoccurred: ${changesoccurred}" if (changesoccurred) { sh("git commit -a -m ${buildstamp}") summaryappend("Commit,") - } + else { summaryappend("No-commit,") } From ae1dcc41bf920341c60f6c12743b2e96102a928e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:32:17 +0000 Subject: [PATCH 0544/1971] Update --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index e72d6f2..11eb648 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -81,11 +81,11 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { // Perform git commit (if necessary) def changes = sh(script: "git status --porcelain", returnStdout: true) boolean changesoccurred = changes?.trim() - echo "changesoccurred: ${changesoccurred}" + echo "changes: ${changes}\nchangesoccurred: ${changesoccurred}" if (changesoccurred) { sh("git commit -a -m ${buildstamp}") summaryappend("Commit,") - } + else { summaryappend("No-commit,") } From 15b9fe77bffd29bfcbbf929d79993f6bab003698 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:34:57 +0000 Subject: [PATCH 0545/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 11eb648..d7f05f7 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -85,7 +85,7 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { if (changesoccurred) { sh("git commit -a -m ${buildstamp}") summaryappend("Commit,") - + } else { summaryappend("No-commit,") } From eb42ae659889748fac6e9150450cf6cbdd0e30b4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 11:34:57 +0000 Subject: [PATCH 0546/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 11eb648..d7f05f7 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -85,7 +85,7 @@ def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { if (changesoccurred) { sh("git commit -a -m ${buildstamp}") summaryappend("Commit,") - + } else { summaryappend("No-commit,") } From 419dc725451a9bef1780d99fda80ea7685f3154b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:06:40 +0000 Subject: [PATCH 0547/1971] Check for changes occurring --- meta/folder.groovy | 2 +- release/do.groovy | 167 +++++++++++++++++++++++++++++++++------------ 2 files changed, 125 insertions(+), 44 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9c5367e..cfce68f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -568,7 +568,7 @@ class MetaInfo extends GISJsonSerialised { } - String folder() { + static String folder() { return METAFOLDERNAME } diff --git a/release/do.groovy b/release/do.groovy index d7f05f7..80e10de 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -6,6 +6,8 @@ summaryfile = "${summaryfolder}/summary.txt" releaserepofolder = "${WORKSPACE}/releaserepos" tempfolder = "${WORKSPACE}/temp" +metascript = autobuilder.getmetafolderscript() + def resetfolders() { dir(summaryfolder) { deleteDir() @@ -34,21 +36,36 @@ def summaryappend(String summary) { writeFile(file: summaryfile, text: currentsummarycontents + summary) } -def checkoutreleaserepo(info, String checkoutfolder) { - def String releaserepo = info.meta.releaseinfo.releaserepoURL - // Get the latest head revision of the release repo without checking out working copy; Check out to a folder unique to component - dir(releaserepofolder) { - sh("git clone -n --depth 1 ${releaserepo} ${checkoutfolder}") +def getpreviousreleasemeta(buildmeta, String checkoutfolder) { + def previousreleasemeta = new metascript.MetaInfo(this) + // See if there is meta data file from the current release + def String releasemetafolderpath = "${checkoutfolder}/${buildmeta.folder()}" + if (fileExists(releasemetafolderpath)) { + previousreleasemeta = metascript.metafromfolder(releasemetafolderpath) } + return previousreleasemeta } -def getcomponentartifacts(info, String repofolder, String tempfolder) { +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 + def previousreleasemeta = new metascript.MetaInfo(this) + dir(releaserepofolder) { + sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") + previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + // Clear all existing files + sh("git rm *") + } + return previousreleasemeta +} + +def getcomponentartifacts(buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") - for (artifactfilter in info.meta.releaseinfo.releaseitems) { + for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { def filterpath = artifactfilter - if (info.offsetpath) { - filterpath = info.offsetpath + '/' + artifactfilter + if (buildinfo.offsetpath) { + filterpath = buildinfo.offsetpath + '/' + artifactfilter } // Copy relevant artifacts to temp folder echo "Copying artifacts: ${filterpath} to ${tempfolder}" @@ -62,7 +79,7 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { target: tempfolder ) // Move relevant artifacts from temp folder to release position - def originalrootdir = tempfolder + "/" + info.offsetpath + def originalrootdir = tempfolder + "/" + buildinfo.offsetpath dir(originalrootdir) { sh("mv * ${repofolder}") } @@ -70,59 +87,123 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { } } -def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { +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 changed = (buildsha != previoussha) + echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" + return changed +} + +def ArrayList maketaglist(String buildstamp, String otherreleasetags) { + ArrayList taglist = new ArrayList() + taglist.add(buildstamp) + + ArrayList othertaglist = otherreleasetags.split(',') + for (othertagitem in othertaglist) { + taglist.add(othertagitem.trim()) + } + return taglist +} + +def boolean releasegittag(String postcommitshacode, String tag) { + // Tag + sh("git tag ${tag}") + summaryappend("(${tag}),") +} + +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 releasegitpush(String dryrunpush ) { + 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 gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") + def String buildstamp = buildinfo.meta.buildstampinfo.buildstamp dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" - // Add anything new - sh("git add .") - summaryappend("Add,") - // Perform git commit (if necessary) - def changes = sh(script: "git status --porcelain", returnStdout: true) - boolean changesoccurred = changes?.trim() - echo "changes: ${changes}\nchangesoccurred: ${changesoccurred}" - if (changesoccurred) { - sh("git commit -a -m ${buildstamp}") - summaryappend("Commit,") + + releasegitadd() + + def boolean changed = checkforchange(buildmeta, previousreleasemeta) + if (changed) { + releasegitcommit(buildstamp) } else { + releasegitreset() summaryappend("No-commit,") } + def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Post commit sha code: ${precommitshacode}" - // Tag with buildstamp - sh("git tag ${buildstamp}") - summaryappend("Tag (${buildstamp}),") - 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") + echo "Post commit sha code: ${postcommitshacode}" + + ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + + def boolean tagadded = releasegittags(postcommitshacode, taglist) + + if (changed || tagadded) { + releasegitpush(dryrunpush) } } } -def releasecomponent(info, String dryrunpush) { - def String uniquefolder = "${info.meta.productinfo.productname}_${info.meta.productinfo.subcomponentname}" +def releasecomponent(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}" - summaryappend("${info.meta.productinfo.productname} ${info.meta.productinfo.subcomponentname}: ") - checkoutreleaserepo(info, uniquefolderforrepo) + summaryappend("${buildmeta.productinfo.productname} ${buildmeta.productinfo.subcomponentname}: ") + def previousreleasemeta = checkoutreleaserepo(buildmeta, uniquefolderforrepo) - getcomponentartifacts(info, uniquefolderforrepo, uniquefoldertemp) + getcomponentartifacts(buildinfo, uniquefolderforrepo, uniquefoldertemp) - def String buildstamp = info.meta.buildstampinfo.buildstamp - gitrelease(uniquefolderforrepo, buildstamp, dryrunpush) + gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, otherreleasetags, dryrunpush) summaryappend("\n") } -def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { +def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) { int md = maxdepth.toInteger() resetfolders() preconditions() @@ -132,8 +213,8 @@ def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { // For each component for (key in componentReleaseInfo.keySet()) { - def info = componentReleaseInfo[key] - releasecomponent(info, dryrunpush) + def buildinfo = componentReleaseInfo[key] + releasecomponent(buildinfo, otherreleasetags, dryrunpush) } return [markunstable, unstablereason] } From 68cf41bc6f2f7994d4daaf261f584278317783cf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:06:40 +0000 Subject: [PATCH 0548/1971] Check for changes occurring --- meta/folder.groovy | 2 +- release/do.groovy | 167 +++++++++++++++++++++++++++++++++------------ 2 files changed, 125 insertions(+), 44 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9c5367e..cfce68f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -568,7 +568,7 @@ class MetaInfo extends GISJsonSerialised { } - String folder() { + static String folder() { return METAFOLDERNAME } diff --git a/release/do.groovy b/release/do.groovy index d7f05f7..80e10de 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -6,6 +6,8 @@ summaryfile = "${summaryfolder}/summary.txt" releaserepofolder = "${WORKSPACE}/releaserepos" tempfolder = "${WORKSPACE}/temp" +metascript = autobuilder.getmetafolderscript() + def resetfolders() { dir(summaryfolder) { deleteDir() @@ -34,21 +36,36 @@ def summaryappend(String summary) { writeFile(file: summaryfile, text: currentsummarycontents + summary) } -def checkoutreleaserepo(info, String checkoutfolder) { - def String releaserepo = info.meta.releaseinfo.releaserepoURL - // Get the latest head revision of the release repo without checking out working copy; Check out to a folder unique to component - dir(releaserepofolder) { - sh("git clone -n --depth 1 ${releaserepo} ${checkoutfolder}") +def getpreviousreleasemeta(buildmeta, String checkoutfolder) { + def previousreleasemeta = new metascript.MetaInfo(this) + // See if there is meta data file from the current release + def String releasemetafolderpath = "${checkoutfolder}/${buildmeta.folder()}" + if (fileExists(releasemetafolderpath)) { + previousreleasemeta = metascript.metafromfolder(releasemetafolderpath) } + return previousreleasemeta } -def getcomponentartifacts(info, String repofolder, String tempfolder) { +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 + def previousreleasemeta = new metascript.MetaInfo(this) + dir(releaserepofolder) { + sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") + previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + // Clear all existing files + sh("git rm *") + } + return previousreleasemeta +} + +def getcomponentartifacts(buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") - for (artifactfilter in info.meta.releaseinfo.releaseitems) { + for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { def filterpath = artifactfilter - if (info.offsetpath) { - filterpath = info.offsetpath + '/' + artifactfilter + if (buildinfo.offsetpath) { + filterpath = buildinfo.offsetpath + '/' + artifactfilter } // Copy relevant artifacts to temp folder echo "Copying artifacts: ${filterpath} to ${tempfolder}" @@ -62,7 +79,7 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { target: tempfolder ) // Move relevant artifacts from temp folder to release position - def originalrootdir = tempfolder + "/" + info.offsetpath + def originalrootdir = tempfolder + "/" + buildinfo.offsetpath dir(originalrootdir) { sh("mv * ${repofolder}") } @@ -70,59 +87,123 @@ def getcomponentartifacts(info, String repofolder, String tempfolder) { } } -def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { +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 changed = (buildsha != previoussha) + echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" + return changed +} + +def ArrayList maketaglist(String buildstamp, String otherreleasetags) { + ArrayList taglist = new ArrayList() + taglist.add(buildstamp) + + ArrayList othertaglist = otherreleasetags.split(',') + for (othertagitem in othertaglist) { + taglist.add(othertagitem.trim()) + } + return taglist +} + +def boolean releasegittag(String postcommitshacode, String tag) { + // Tag + sh("git tag ${tag}") + summaryappend("(${tag}),") +} + +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 releasegitpush(String dryrunpush ) { + 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 gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") + def String buildstamp = buildinfo.meta.buildstampinfo.buildstamp dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" - // Add anything new - sh("git add .") - summaryappend("Add,") - // Perform git commit (if necessary) - def changes = sh(script: "git status --porcelain", returnStdout: true) - boolean changesoccurred = changes?.trim() - echo "changes: ${changes}\nchangesoccurred: ${changesoccurred}" - if (changesoccurred) { - sh("git commit -a -m ${buildstamp}") - summaryappend("Commit,") + + releasegitadd() + + def boolean changed = checkforchange(buildmeta, previousreleasemeta) + if (changed) { + releasegitcommit(buildstamp) } else { + releasegitreset() summaryappend("No-commit,") } + def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Post commit sha code: ${precommitshacode}" - // Tag with buildstamp - sh("git tag ${buildstamp}") - summaryappend("Tag (${buildstamp}),") - 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") + echo "Post commit sha code: ${postcommitshacode}" + + ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + + def boolean tagadded = releasegittags(postcommitshacode, taglist) + + if (changed || tagadded) { + releasegitpush(dryrunpush) } } } -def releasecomponent(info, String dryrunpush) { - def String uniquefolder = "${info.meta.productinfo.productname}_${info.meta.productinfo.subcomponentname}" +def releasecomponent(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}" - summaryappend("${info.meta.productinfo.productname} ${info.meta.productinfo.subcomponentname}: ") - checkoutreleaserepo(info, uniquefolderforrepo) + summaryappend("${buildmeta.productinfo.productname} ${buildmeta.productinfo.subcomponentname}: ") + def previousreleasemeta = checkoutreleaserepo(buildmeta, uniquefolderforrepo) - getcomponentartifacts(info, uniquefolderforrepo, uniquefoldertemp) + getcomponentartifacts(buildinfo, uniquefolderforrepo, uniquefoldertemp) - def String buildstamp = info.meta.buildstampinfo.buildstamp - gitrelease(uniquefolderforrepo, buildstamp, dryrunpush) + gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, otherreleasetags, dryrunpush) summaryappend("\n") } -def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { +def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) { int md = maxdepth.toInteger() resetfolders() preconditions() @@ -132,8 +213,8 @@ def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { // For each component for (key in componentReleaseInfo.keySet()) { - def info = componentReleaseInfo[key] - releasecomponent(info, dryrunpush) + def buildinfo = componentReleaseInfo[key] + releasecomponent(buildinfo, otherreleasetags, dryrunpush) } return [markunstable, unstablereason] } From d449e458f29e636a7f9a343237aa6f95ab3703d6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:16:10 +0000 Subject: [PATCH 0549/1971] Check for changes occurring --- meta/folder.groovy | 4 ++++ release/do.groovy | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index cfce68f..13b1fe5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -624,6 +624,10 @@ class MetaInfo extends GISJsonSerialised { } return releasemetauniquecollection } + + MetaInfo getNewMetaObject(script) { + return new MetaInfo(script) + } } MetaInfo metareset(script) { diff --git a/release/do.groovy b/release/do.groovy index 80e10de..9d3e09a 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -37,7 +37,7 @@ def summaryappend(String summary) { } def getpreviousreleasemeta(buildmeta, String checkoutfolder) { - def previousreleasemeta = new metascript.MetaInfo(this) + 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)) { @@ -49,7 +49,7 @@ def getpreviousreleasemeta(buildmeta, String checkoutfolder) { 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 - def previousreleasemeta = new metascript.MetaInfo(this) + def previousreleasemeta = buildmeta.getNewMetaObject(this) dir(releaserepofolder) { sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) From 01b5194cabc2f4023c011b8f1f128b77c6358ee2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:16:10 +0000 Subject: [PATCH 0550/1971] Check for changes occurring --- meta/folder.groovy | 4 ++++ release/do.groovy | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index cfce68f..13b1fe5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -624,6 +624,10 @@ class MetaInfo extends GISJsonSerialised { } return releasemetauniquecollection } + + MetaInfo getNewMetaObject(script) { + return new MetaInfo(script) + } } MetaInfo metareset(script) { diff --git a/release/do.groovy b/release/do.groovy index 80e10de..9d3e09a 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -37,7 +37,7 @@ def summaryappend(String summary) { } def getpreviousreleasemeta(buildmeta, String checkoutfolder) { - def previousreleasemeta = new metascript.MetaInfo(this) + 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)) { @@ -49,7 +49,7 @@ def getpreviousreleasemeta(buildmeta, String checkoutfolder) { 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 - def previousreleasemeta = new metascript.MetaInfo(this) + def previousreleasemeta = buildmeta.getNewMetaObject(this) dir(releaserepofolder) { sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) From ef90356389a24a5ebb87cb4d213bb81a0080fb8a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:21:49 +0000 Subject: [PATCH 0551/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 9d3e09a..576a188 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -41,7 +41,7 @@ def getpreviousreleasemeta(buildmeta, String checkoutfolder) { // See if there is meta data file from the current release def String releasemetafolderpath = "${checkoutfolder}/${buildmeta.folder()}" if (fileExists(releasemetafolderpath)) { - previousreleasemeta = metascript.metafromfolder(releasemetafolderpath) + previousreleasemeta = metascript.metafromfolder(checkoutfolder) } return previousreleasemeta } From d532ddbdb5c7a0966becac910025ec9a82f502bb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:21:49 +0000 Subject: [PATCH 0552/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 9d3e09a..576a188 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -41,7 +41,7 @@ def getpreviousreleasemeta(buildmeta, String checkoutfolder) { // See if there is meta data file from the current release def String releasemetafolderpath = "${checkoutfolder}/${buildmeta.folder()}" if (fileExists(releasemetafolderpath)) { - previousreleasemeta = metascript.metafromfolder(releasemetafolderpath) + previousreleasemeta = metascript.metafromfolder(checkoutfolder) } return previousreleasemeta } From d16e5a426a78fd8091f8c274b5b1041130471580 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:27:03 +0000 Subject: [PATCH 0553/1971] Check for changes occurring --- release/do.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 576a188..644b995 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -52,7 +52,9 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { def previousreleasemeta = buildmeta.getNewMetaObject(this) dir(releaserepofolder) { sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") - previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + } + previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + dir(checkoutfolder) { // Clear all existing files sh("git rm *") } From 42d175974e6ea34722219476a44c9813378f4d0d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:27:03 +0000 Subject: [PATCH 0554/1971] Check for changes occurring --- release/do.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 576a188..644b995 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -52,7 +52,9 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { def previousreleasemeta = buildmeta.getNewMetaObject(this) dir(releaserepofolder) { sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") - previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + } + previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + dir(checkoutfolder) { // Clear all existing files sh("git rm *") } From ad9b3482b0a0d34d41ec1df60c9f49484ef6a61e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:29:48 +0000 Subject: [PATCH 0555/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 644b995..6cf55e2 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -56,7 +56,7 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) dir(checkoutfolder) { // Clear all existing files - sh("git rm *") + sh("git rm -r *") } return previousreleasemeta } From 47545c5206c4a466f0eeac1357e85859040786b9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:29:48 +0000 Subject: [PATCH 0556/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 644b995..6cf55e2 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -56,7 +56,7 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) dir(checkoutfolder) { // Clear all existing files - sh("git rm *") + sh("git rm -r *") } return previousreleasemeta } From 0388e87adf98c28587d6e60f33750b704957ef7c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:32:39 +0000 Subject: [PATCH 0557/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 6cf55e2..bcdc419 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -160,7 +160,7 @@ def releasegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = buildinfo.meta.buildstampinfo.buildstamp + def String buildstamp = buildmeta.buildstampinfo.buildstamp dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" From 75855fd9fb152e51978f5b9f785dd3cc5920a04e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 15:32:39 +0000 Subject: [PATCH 0558/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 6cf55e2..bcdc419 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -160,7 +160,7 @@ def releasegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = buildinfo.meta.buildstampinfo.buildstamp + def String buildstamp = buildmeta.buildstampinfo.buildstamp dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" From e82f6be42017371d3622a9428f987c40f9858b77 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 16:15:58 +0000 Subject: [PATCH 0559/1971] Check for changes occurring --- release/do.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release/do.groovy b/release/do.groovy index bcdc419..a86bf04 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -129,6 +129,11 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { } def boolean releasegittag(String postcommitshacode, String tag) { + // Check if tag exists already + def retvalue = sh(script: "git rev-parse ${tag} >2 /dev/null", returnStdout: true, returnStatus: true) + echo "retvalue: ${retvalue} class: ${retvalue.getClass()}" + + // Tag sh("git tag ${tag}") summaryappend("(${tag}),") From 5926f63c7bdd534b5b4c9de784d15ad6dc9e6ee9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 16:15:58 +0000 Subject: [PATCH 0560/1971] Check for changes occurring --- release/do.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release/do.groovy b/release/do.groovy index bcdc419..a86bf04 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -129,6 +129,11 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { } def boolean releasegittag(String postcommitshacode, String tag) { + // Check if tag exists already + def retvalue = sh(script: "git rev-parse ${tag} >2 /dev/null", returnStdout: true, returnStatus: true) + echo "retvalue: ${retvalue} class: ${retvalue.getClass()}" + + // Tag sh("git tag ${tag}") summaryappend("(${tag}),") From 02e759acbf187f12dcc9d79b4da9b2d76587f1b2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 16:38:43 +0000 Subject: [PATCH 0561/1971] Check for changes occurring --- release/do.groovy | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index a86bf04..2438b54 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -129,14 +129,26 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { } def boolean releasegittag(String postcommitshacode, String tag) { + def boolean tagadded = false // Check if tag exists already - def retvalue = sh(script: "git rev-parse ${tag} >2 /dev/null", returnStdout: true, returnStatus: true) - echo "retvalue: ${retvalue} class: ${retvalue.getClass()}" - - - // Tag - sh("git tag ${tag}") - summaryappend("(${tag}),") + def existingshacode = sh(script: "git rev-parse ${tag}", returnStdout: true).trim() + if (existingshacode?.trim()) { // If tag/sha code does exist + if (existingshacode != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") + summaryappend("(${tag} - Could not add!),") + } + else { + summaryappend("(${tag} - Already added),") + } + } + else { // If sha code does not exist already + // Tag + sh("git tag ${tag}") + summaryappend("(${tag}),") + tagadded = true + } + return tagadded } def boolean releasegittags(String postcommitshacode, ArrayList taglist) { From 476c771144c259f23222061fcd8490615ab99ecb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 16:38:43 +0000 Subject: [PATCH 0562/1971] Check for changes occurring --- release/do.groovy | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index a86bf04..2438b54 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -129,14 +129,26 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { } def boolean releasegittag(String postcommitshacode, String tag) { + def boolean tagadded = false // Check if tag exists already - def retvalue = sh(script: "git rev-parse ${tag} >2 /dev/null", returnStdout: true, returnStatus: true) - echo "retvalue: ${retvalue} class: ${retvalue.getClass()}" - - - // Tag - sh("git tag ${tag}") - summaryappend("(${tag}),") + def existingshacode = sh(script: "git rev-parse ${tag}", returnStdout: true).trim() + if (existingshacode?.trim()) { // If tag/sha code does exist + if (existingshacode != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") + summaryappend("(${tag} - Could not add!),") + } + else { + summaryappend("(${tag} - Already added),") + } + } + else { // If sha code does not exist already + // Tag + sh("git tag ${tag}") + summaryappend("(${tag}),") + tagadded = true + } + return tagadded } def boolean releasegittags(String postcommitshacode, ArrayList taglist) { From a5703babe06575ffd5b9d745e81ca6c066fd5b83 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 16:48:17 +0000 Subject: [PATCH 0563/1971] Check for changes occurring --- release/do.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 2438b54..e69f09b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -125,6 +125,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { for (othertagitem in othertaglist) { taglist.add(othertagitem.trim()) } + echo "Taglist: ${taglist}" return taglist } @@ -136,16 +137,16 @@ def boolean releasegittag(String postcommitshacode, String tag) { if (existingshacode != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") - summaryappend("(${tag} - Could not add!),") + summaryappend("(${tag} - Could not add!)") } else { - summaryappend("(${tag} - Already added),") + summaryappend("(${tag} - Already added)") } } else { // If sha code does not exist already // Tag sh("git tag ${tag}") - summaryappend("(${tag}),") + summaryappend("(${tag})") tagadded = true } return tagadded From 6494069af5d92a59fe9c552c77a3938eb1756023 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 16:48:17 +0000 Subject: [PATCH 0564/1971] Check for changes occurring --- release/do.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 2438b54..e69f09b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -125,6 +125,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { for (othertagitem in othertaglist) { taglist.add(othertagitem.trim()) } + echo "Taglist: ${taglist}" return taglist } @@ -136,16 +137,16 @@ def boolean releasegittag(String postcommitshacode, String tag) { if (existingshacode != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") - summaryappend("(${tag} - Could not add!),") + summaryappend("(${tag} - Could not add!)") } else { - summaryappend("(${tag} - Already added),") + summaryappend("(${tag} - Already added)") } } else { // If sha code does not exist already // Tag sh("git tag ${tag}") - summaryappend("(${tag}),") + summaryappend("(${tag})") tagadded = true } return tagadded From 16a7f88ec3ed498f5044f41de685add319a4f931 Mon Sep 17 00:00:00 2001 From: Damian Smith Date: Fri, 30 Nov 2018 16:53:54 +0000 Subject: [PATCH 0565/1971] ELGIP-20 let script run on windows --- versionnumbering/generate.groovy | 33 ++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index a7b583a..803a543 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -10,18 +10,43 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { def String remoteinfo def String remoteurl dir( gitrootpath) { - def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() + + if (isUnix()) { + def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() + } + else { + def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim() + def int changecount = stdout.readLines()[1] as int + } echo "Change count: ${changecount}" adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" - gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() + if (isUnix()) { + gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() + } + else { + def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim() + gitrevision = stdout.readLines()[1] as int + } echo "Revision: ${gitrevision}" - remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() + if (isUnix()) { + remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() + } + else { + def stdout = bat(returnStdout:true , script: "git remote show origin").trim() + remoteinfo = stdout.readLines()[1] as int + } echo "Remote info: ${remoteinfo}" - remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() + if (isUnix()) { + remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() + } + else { + def stdout = bat(returnStdout:true , script: "git config --get remote.origin.ur").trim() + remoteurl = stdout.readLines()[1] as int + } echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] From c1553971f3caac2fbff4cf097f675469093cddc9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 17:16:45 +0000 Subject: [PATCH 0566/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index e69f09b..1fe7cd4 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -125,7 +125,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { for (othertagitem in othertaglist) { taglist.add(othertagitem.trim()) } - echo "Taglist: ${taglist}" + echo "Taglist: ${taglist} size: ${taglist.size()}" return taglist } From 9c12e97ea42a82e7a92d6843d941a684815e04e3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 17:16:45 +0000 Subject: [PATCH 0567/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index e69f09b..1fe7cd4 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -125,7 +125,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { for (othertagitem in othertaglist) { taglist.add(othertagitem.trim()) } - echo "Taglist: ${taglist}" + echo "Taglist: ${taglist} size: ${taglist.size()}" return taglist } From 460b758b05b9fe51d3e24c2f5beaa12b0a83a07b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 17:20:36 +0000 Subject: [PATCH 0568/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 1fe7cd4..788838b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -121,7 +121,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { ArrayList taglist = new ArrayList() taglist.add(buildstamp) - ArrayList othertaglist = otherreleasetags.split(',') + ArrayList othertaglist = otherreleasetags.trim().split(',') for (othertagitem in othertaglist) { taglist.add(othertagitem.trim()) } From 192678568584e1e2e0052b2db99560c478d4e81d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 17:20:36 +0000 Subject: [PATCH 0569/1971] Check for changes occurring --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 1fe7cd4..788838b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -121,7 +121,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { ArrayList taglist = new ArrayList() taglist.add(buildstamp) - ArrayList othertaglist = otherreleasetags.split(',') + ArrayList othertaglist = otherreleasetags.trim().split(',') for (othertagitem in othertaglist) { taglist.add(othertagitem.trim()) } From 2dcb050ab38355b30d39f1f2a0032354b99866fe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 17:36:43 +0000 Subject: [PATCH 0570/1971] Check for changes occurring --- release/do.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 788838b..5d4f2e9 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -119,9 +119,12 @@ def boolean checkforchange(buildmeta, previousreleasemeta) { def ArrayList maketaglist(String buildstamp, String otherreleasetags) { ArrayList taglist = new ArrayList() - taglist.add(buildstamp) + taglist.add(buildstamp.trim()) + echo "Taglist: ${taglist} size: ${taglist.size()}" + ArrayList othertaglist = otherreleasetags.trim().split(',') + echo "othertaglist: ${othertaglist} size: ${othertaglist.size()}" for (othertagitem in othertaglist) { taglist.add(othertagitem.trim()) } @@ -178,7 +181,7 @@ def releasegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = buildmeta.buildstampinfo.buildstamp + def String buildstamp = buildmeta.buildstampinfo.buildstamp.trim() dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" From e1671aba544d1021fa2939b094219df6defe5e0d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 17:36:43 +0000 Subject: [PATCH 0571/1971] Check for changes occurring --- release/do.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 788838b..5d4f2e9 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -119,9 +119,12 @@ def boolean checkforchange(buildmeta, previousreleasemeta) { def ArrayList maketaglist(String buildstamp, String otherreleasetags) { ArrayList taglist = new ArrayList() - taglist.add(buildstamp) + taglist.add(buildstamp.trim()) + echo "Taglist: ${taglist} size: ${taglist.size()}" + ArrayList othertaglist = otherreleasetags.trim().split(',') + echo "othertaglist: ${othertaglist} size: ${othertaglist.size()}" for (othertagitem in othertaglist) { taglist.add(othertagitem.trim()) } @@ -178,7 +181,7 @@ def releasegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = buildmeta.buildstampinfo.buildstamp + def String buildstamp = buildmeta.buildstampinfo.buildstamp.trim() dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" From 55262543d73eea07a265a815db213e360a8a9525 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 17:41:40 +0000 Subject: [PATCH 0572/1971] Check for changes occurring --- release/do.groovy | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 5d4f2e9..7b7c07c 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -118,15 +118,14 @@ def boolean checkforchange(buildmeta, previousreleasemeta) { } def ArrayList maketaglist(String buildstamp, String otherreleasetags) { - ArrayList taglist = new ArrayList() - taglist.add(buildstamp.trim()) + def ArrayList taglist = new ArrayList() + taglist.add(buildstamp) - echo "Taglist: ${taglist} size: ${taglist.size()}" - - ArrayList othertaglist = otherreleasetags.trim().split(',') - echo "othertaglist: ${othertaglist} size: ${othertaglist.size()}" + def ArrayList othertaglist = otherreleasetags.split(',') for (othertagitem in othertaglist) { - taglist.add(othertagitem.trim()) + if (othertagitem?.trim()) { + taglist.add(othertagitem.trim()) + } } echo "Taglist: ${taglist} size: ${taglist.size()}" return taglist @@ -181,7 +180,7 @@ def releasegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = buildmeta.buildstampinfo.buildstamp.trim() + def String buildstamp = buildmeta.buildstampinfo.buildstamp dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" From 1500adb084374cf918b98b67b81272ae1c7172df Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 17:41:40 +0000 Subject: [PATCH 0573/1971] Check for changes occurring --- release/do.groovy | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 5d4f2e9..7b7c07c 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -118,15 +118,14 @@ def boolean checkforchange(buildmeta, previousreleasemeta) { } def ArrayList maketaglist(String buildstamp, String otherreleasetags) { - ArrayList taglist = new ArrayList() - taglist.add(buildstamp.trim()) + def ArrayList taglist = new ArrayList() + taglist.add(buildstamp) - echo "Taglist: ${taglist} size: ${taglist.size()}" - - ArrayList othertaglist = otherreleasetags.trim().split(',') - echo "othertaglist: ${othertaglist} size: ${othertaglist.size()}" + def ArrayList othertaglist = otherreleasetags.split(',') for (othertagitem in othertaglist) { - taglist.add(othertagitem.trim()) + if (othertagitem?.trim()) { + taglist.add(othertagitem.trim()) + } } echo "Taglist: ${taglist} size: ${taglist.size()}" return taglist @@ -181,7 +180,7 @@ def releasegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = buildmeta.buildstampinfo.buildstamp.trim() + def String buildstamp = buildmeta.buildstampinfo.buildstamp dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" From b8a0e604f1d84a4d1e1cbdc52f04db831b67f776 Mon Sep 17 00:00:00 2001 From: Damian Smith Date: Fri, 30 Nov 2018 17:55:55 +0000 Subject: [PATCH 0574/1971] ELGIP-20 edits to allow use on windows --- versionnumbering/generate.groovy | 56 ++++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 803a543..925ed65 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -10,43 +10,43 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { def String remoteinfo def String remoteurl dir( gitrootpath) { - - if (isUnix()) { - def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() + def int changecount + if (isUnix()) { + changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() } - else { - def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim() - def int changecount = stdout.readLines()[1] as int - } + else { + def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim() + changecount = stdout.readLines()[1] as int + } echo "Change count: ${changecount}" adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" - - if (isUnix()) { + + if (isUnix()) { gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() - } - else { - def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim() - gitrevision = stdout.readLines()[1] as int - } + } + else { + def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim() + gitrevision = stdout.readLines()[1] + } echo "Revision: ${gitrevision}" - - if (isUnix()) { + + if (isUnix()) { remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() - } - else { - def stdout = bat(returnStdout:true , script: "git remote show origin").trim() - remoteinfo = stdout.readLines()[1] as int - } + } + else { + def stdout = bat(returnStdout:true , script: "git remote show origin").trim() + remoteinfo = stdout.readLines()[1..-1] + } echo "Remote info: ${remoteinfo}" - - if (isUnix()) { + + if (isUnix()) { remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() - } - else { - def stdout = bat(returnStdout:true , script: "git config --get remote.origin.ur").trim() - remoteurl = stdout.readLines()[1] as int - } + } + else { + def stdout = bat(returnStdout:true , script: "git config --get remote.origin.url").trim() + remoteurl = stdout.readLines()[1] + } echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] From b380eef774e2a3d8c79f64bbc7767fe00983c788 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 18:20:30 +0000 Subject: [PATCH 0575/1971] Restoration of subtree contents --- versionnumbering/generate.groovy | 39 ++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index a7b583a..925ed65 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -10,18 +10,43 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { def String remoteinfo def String remoteurl dir( gitrootpath) { - def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() + def int changecount + if (isUnix()) { + changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() + } + else { + def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim() + changecount = stdout.readLines()[1] as int + } echo "Change count: ${changecount}" adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" - - gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() + + if (isUnix()) { + gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() + } + else { + def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim() + gitrevision = stdout.readLines()[1] + } echo "Revision: ${gitrevision}" - - remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() + + if (isUnix()) { + remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim() + } + else { + def stdout = bat(returnStdout:true , script: "git remote show origin").trim() + remoteinfo = stdout.readLines()[1..-1] + } echo "Remote info: ${remoteinfo}" - - remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() + + if (isUnix()) { + remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim() + } + else { + def stdout = bat(returnStdout:true , script: "git config --get remote.origin.url").trim() + remoteurl = stdout.readLines()[1] + } echo "Remote URL: ${remoteurl}" } return [adjustedchangecount, gitrevision, remoteinfo, remoteurl] From 10e2a571787bae9dedf1a5d2267d85df0dfd20e8 Mon Sep 17 00:00:00 2001 From: Damian Smith Date: Fri, 30 Nov 2018 18:26:07 +0000 Subject: [PATCH 0576/1971] Merge commit 'b380eef774e2a3d8c79f64bbc7767fe00983c788' into 1.10003.j20-comscr --- release/do.groovy | 135 ---------------------------------------------- 1 file changed, 135 deletions(-) delete mode 100644 release/do.groovy diff --git a/release/do.groovy b/release/do.groovy deleted file mode 100644 index 6db301c..0000000 --- a/release/do.groovy +++ /dev/null @@ -1,135 +0,0 @@ -markunstable = false -unstablereason = "" - -summaryfolder = "${WORKSPACE}/summary" -summaryfile = "${summaryfolder}/summary.txt" -releaserepofolder = "${WORKSPACE}/releaserepos" -tempfolder = "${WORKSPACE}/temp" - -def resetfolders() { - dir(summaryfolder) { - deleteDir() - } - dir(releaserepofolder) { - deleteDir() - } - dir(tempfolder) { - deleteDir() - } -} - -def preconditions() { - markunstable = false - unstablereason = "" - writeFile(file: summaryfile, text: "Release 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) -} - -def checkoutreleaserepo(info, String checkoutfolder) { - def String releaserepo = info.meta.releaseinfo.releaserepoURL - // Get the latest head revision of the release repo without checking out working copy; Check out to a folder unique to component - dir(releaserepofolder) { - sh("git clone -n --depth 1 ${releaserepo} ${checkoutfolder}") - } -} - -def getcomponentartifacts(info, String repofolder, String tempfolder) { - // Copy relevant artifacts to temp folder - summaryappend("Artifacts: ") - for (artifactfilter in info.meta.releaseinfo.releaseitems) { - def filterpath = artifactfilter - if (info.offsetpath) { - filterpath = info.offsetpath + '/' + artifactfilter - } - // Copy relevant artifacts to temp folder - echo "Copying artifacts: ${filterpath} to ${tempfolder}" - copyArtifacts( - filter: filterpath, - projectName: BUILD_JOB, - selector: [ - $class: 'ParameterizedBuildSelector', - parameterName: BUILD_JOB_SELECTOR - ], - target: tempfolder - ) - // Move relevant artifacts from temp folder to release position - def originalrootdir = tempfolder + "/" + info.offsetpath - dir(originalrootdir) { - sh("mv * ${repofolder}") - } - summaryappend("${artifactfilter},") - } -} - -def gitrelease(String releaserepo, String buildstamp, String dryrunpush) { - summaryappend(" Git operations: ") - dir(releaserepo) { - // Add anything new - sh("git add .") - summaryappend("Add,") - // Perform git commit (if necessary) - def changesoccurred = sh(script: "git status --porcelain", returnStdout: true) - if (changesoccurred) { - sh("git commit -a -m ${buildstamp}") - summaryappend("Commit,") - } - else { - summaryappend("No-commit,") - } - // Tag with buildstamp - sh("git tag ${buildstamp}") - summaryappend("Tag (${buildstamp}),") - 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 releasecomponent(info, String dryrunpush) { - def String uniquefolder = "${info.meta.productinfo.productname}_${info.meta.productinfo.subcomponentname}" - def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" - def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" - - summaryappend("${info.meta.productinfo.productname} ${info.meta.productinfo.subcomponentname}: ") - checkoutreleaserepo(info, uniquefolderforrepo) - - getcomponentartifacts(info, uniquefolderforrepo, uniquefoldertemp) - - def String buildstamp = info.meta.buildstampinfo.buildstamp - gitrelease(uniquefolderforrepo, buildstamp, dryrunpush) - - summaryappend("\n") -} - -def releasehierarchy(buildmeta, String maxdepth, dryrunpush) { - int md = maxdepth.toInteger() - resetfolders() - preconditions() - - // Walk the meta information to a max depth, looking for artifacts to import for release - componentReleaseInfo = buildmeta.releasewalkerunique(md) - - // For each component - for (key in componentReleaseInfo.keySet()) { - def info = componentReleaseInfo[key] - releasecomponent(info, dryrunpush) - } - return [markunstable, unstablereason] -} - -return this; \ No newline at end of file From c4b875e5e9fe925d8da100789d1d05719399bd4f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 18:46:33 +0000 Subject: [PATCH 0577/1971] Check for changes occurring --- release/do.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 7b7c07c..b2f09bd 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -127,7 +127,6 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { taglist.add(othertagitem.trim()) } } - echo "Taglist: ${taglist} size: ${taglist.size()}" return taglist } From 2c15e3fb45bc603d41b1381d1f44e75cca1fc0dc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 30 Nov 2018 18:46:33 +0000 Subject: [PATCH 0578/1971] Check for changes occurring --- release/do.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 7b7c07c..b2f09bd 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -127,7 +127,6 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { taglist.add(othertagitem.trim()) } } - echo "Taglist: ${taglist} size: ${taglist.size()}" return taglist } From 9b5c42f42824398390ac7730e3bd130fd0a0def9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 08:25:26 +0000 Subject: [PATCH 0579/1971] Make sure changecount is an integer --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 925ed65..f80d021 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -12,7 +12,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { dir( gitrootpath) { def int changecount if (isUnix()) { - changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() + changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger() } else { def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim() From 75708e8b1ded943eaa76016cf0d342341c68b9c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 08:25:26 +0000 Subject: [PATCH 0580/1971] Make sure changecount is an integer --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 925ed65..f80d021 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -12,7 +12,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { dir( gitrootpath) { def int changecount if (isUnix()) { - changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim() + changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger() } else { def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim() From 09bf96a4b7a89e47229fbd01295c06144c228b6c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 09:32:23 +0000 Subject: [PATCH 0581/1971] Add a summary on the console --- release/do.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index b2f09bd..2866793 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -5,6 +5,7 @@ summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" releaserepofolder = "${WORKSPACE}/releaserepos" tempfolder = "${WORKSPACE}/temp" +summarystring = "" metascript = autobuilder.getmetafolderscript() @@ -23,6 +24,7 @@ def resetfolders() { def preconditions() { markunstable = false unstablereason = "" + summarystring = "" writeFile(file: summaryfile, text: "Release summary: \n") } @@ -34,6 +36,7 @@ def setunstable(String reason) { def summaryappend(String summary) { def String currentsummarycontents = readFile(file: summaryfile) writeFile(file: summaryfile, text: currentsummarycontents + summary) + summarystring += summary } def getpreviousreleasemeta(buildmeta, String checkoutfolder) { @@ -237,7 +240,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String def buildinfo = componentReleaseInfo[key] releasecomponent(buildinfo, otherreleasetags, dryrunpush) } - return [markunstable, unstablereason] + return [summarystring, markunstable, unstablereason] } return this; \ No newline at end of file From 7b4ccb95da39981937b3fe4376e821ea46a30378 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 09:32:23 +0000 Subject: [PATCH 0582/1971] Add a summary on the console --- release/do.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index b2f09bd..2866793 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -5,6 +5,7 @@ summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" releaserepofolder = "${WORKSPACE}/releaserepos" tempfolder = "${WORKSPACE}/temp" +summarystring = "" metascript = autobuilder.getmetafolderscript() @@ -23,6 +24,7 @@ def resetfolders() { def preconditions() { markunstable = false unstablereason = "" + summarystring = "" writeFile(file: summaryfile, text: "Release summary: \n") } @@ -34,6 +36,7 @@ def setunstable(String reason) { def summaryappend(String summary) { def String currentsummarycontents = readFile(file: summaryfile) writeFile(file: summaryfile, text: currentsummarycontents + summary) + summarystring += summary } def getpreviousreleasemeta(buildmeta, String checkoutfolder) { @@ -237,7 +240,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String def buildinfo = componentReleaseInfo[key] releasecomponent(buildinfo, otherreleasetags, dryrunpush) } - return [markunstable, unstablereason] + return [summarystring, markunstable, unstablereason] } return this; \ No newline at end of file From 3e8f5dbaedc66569acacff5d20d9f8bea7631914 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 10:19:27 +0000 Subject: [PATCH 0583/1971] Handle case of tag not already existing in release repo correctly --- release/do.groovy | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 2866793..187fb01 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -3,9 +3,10 @@ unstablereason = "" summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" releaserepofolder = "${WORKSPACE}/releaserepos" tempfolder = "${WORKSPACE}/temp" -summarystring = "" +gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" metascript = autobuilder.getmetafolderscript() @@ -136,8 +137,9 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { def boolean releasegittag(String postcommitshacode, String tag) { def boolean tagadded = false // Check if tag exists already - def existingshacode = sh(script: "git rev-parse ${tag}", returnStdout: true).trim() - if (existingshacode?.trim()) { // If tag/sha code does exist + def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" > \"${gitrevparseoutputfile}\"", returnStatus: true).trim() + if (gitrevparsestatus == 0) { // Tag exists + def existingshacode = readFile(file: gitrevparseoutputfile).trim() if (existingshacode != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") @@ -147,9 +149,9 @@ def boolean releasegittag(String postcommitshacode, String tag) { summaryappend("(${tag} - Already added)") } } - else { // If sha code does not exist already + else { // If tag does not exist already // Tag - sh("git tag ${tag}") + sh("git tag \"${tag}\"") summaryappend("(${tag})") tagadded = true } @@ -243,4 +245,4 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String return [summarystring, markunstable, unstablereason] } -return this; \ No newline at end of file +return this; From 77c0c47b5c09944bb6f7963e46d31207da96da99 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 10:19:27 +0000 Subject: [PATCH 0584/1971] Handle case of tag not already existing in release repo correctly --- release/do.groovy | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 2866793..187fb01 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -3,9 +3,10 @@ unstablereason = "" summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" releaserepofolder = "${WORKSPACE}/releaserepos" tempfolder = "${WORKSPACE}/temp" -summarystring = "" +gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" metascript = autobuilder.getmetafolderscript() @@ -136,8 +137,9 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { def boolean releasegittag(String postcommitshacode, String tag) { def boolean tagadded = false // Check if tag exists already - def existingshacode = sh(script: "git rev-parse ${tag}", returnStdout: true).trim() - if (existingshacode?.trim()) { // If tag/sha code does exist + def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" > \"${gitrevparseoutputfile}\"", returnStatus: true).trim() + if (gitrevparsestatus == 0) { // Tag exists + def existingshacode = readFile(file: gitrevparseoutputfile).trim() if (existingshacode != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") @@ -147,9 +149,9 @@ def boolean releasegittag(String postcommitshacode, String tag) { summaryappend("(${tag} - Already added)") } } - else { // If sha code does not exist already + else { // If tag does not exist already // Tag - sh("git tag ${tag}") + sh("git tag \"${tag}\"") summaryappend("(${tag})") tagadded = true } @@ -243,4 +245,4 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String return [summarystring, markunstable, unstablereason] } -return this; \ No newline at end of file +return this; From b6007e252c7d9f2746dc84b313ec33505f7f817b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 10:25:10 +0000 Subject: [PATCH 0585/1971] Handle case of tag not already existing in release repo correctly --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 187fb01..a43beda 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -137,7 +137,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { def boolean releasegittag(String postcommitshacode, String tag) { def boolean tagadded = false // Check if tag exists already - def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" > \"${gitrevparseoutputfile}\"", returnStatus: true).trim() + def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" > \"${gitrevparseoutputfile}\"", returnStatus: true) if (gitrevparsestatus == 0) { // Tag exists def existingshacode = readFile(file: gitrevparseoutputfile).trim() if (existingshacode != postcommitshacode) { // If the existing tag is not associated with HEAD From 483c6ee6306aa1bfa7073d339a9b1b05abb1ffeb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 10:25:10 +0000 Subject: [PATCH 0586/1971] Handle case of tag not already existing in release repo correctly --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 187fb01..a43beda 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -137,7 +137,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { def boolean releasegittag(String postcommitshacode, String tag) { def boolean tagadded = false // Check if tag exists already - def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" > \"${gitrevparseoutputfile}\"", returnStatus: true).trim() + def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" > \"${gitrevparseoutputfile}\"", returnStatus: true) if (gitrevparsestatus == 0) { // Tag exists def existingshacode = readFile(file: gitrevparseoutputfile).trim() if (existingshacode != postcommitshacode) { // If the existing tag is not associated with HEAD From a0c6fc46211e2bebdd525d8240c4012fbb6649f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 10:43:26 +0000 Subject: [PATCH 0587/1971] Handle case of tag not already existing in release repo correctly --- release/do.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index a43beda..dc834ea 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -137,7 +137,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { def boolean releasegittag(String postcommitshacode, String tag) { def boolean tagadded = false // Check if tag exists already - def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" > \"${gitrevparseoutputfile}\"", returnStatus: true) + 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 != postcommitshacode) { // If the existing tag is not associated with HEAD @@ -173,12 +173,12 @@ def boolean releasegittags(String postcommitshacode, ArrayList taglist) def releasegitpush(String dryrunpush ) { if (dryrunpush == "true") { sh("git push -n --tags origin master") - summaryappend("Dry-Run-Push") + 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") + summaryappend(",Push") } } From 72072efecbb7796042d100c3a37068a6402f1395 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 10:43:26 +0000 Subject: [PATCH 0588/1971] Handle case of tag not already existing in release repo correctly --- release/do.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index a43beda..dc834ea 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -137,7 +137,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { def boolean releasegittag(String postcommitshacode, String tag) { def boolean tagadded = false // Check if tag exists already - def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" > \"${gitrevparseoutputfile}\"", returnStatus: true) + 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 != postcommitshacode) { // If the existing tag is not associated with HEAD @@ -173,12 +173,12 @@ def boolean releasegittags(String postcommitshacode, ArrayList taglist) def releasegitpush(String dryrunpush ) { if (dryrunpush == "true") { sh("git push -n --tags origin master") - summaryappend("Dry-Run-Push") + 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") + summaryappend(",Push") } } From 3665d5e9a653a0dfc4445ae676ed9e067e8dfbf7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 10:47:30 +0000 Subject: [PATCH 0589/1971] Handle case of tag not already existing in release repo correctly --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index dc834ea..f71c3df 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -137,7 +137,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { def boolean releasegittag(String postcommitshacode, 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) + 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 != postcommitshacode) { // If the existing tag is not associated with HEAD From 467ffd7ac0b4385506665742d5a607125d7916d7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 10:47:30 +0000 Subject: [PATCH 0590/1971] Handle case of tag not already existing in release repo correctly --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index dc834ea..f71c3df 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -137,7 +137,7 @@ def ArrayList maketaglist(String buildstamp, String otherreleasetags) { def boolean releasegittag(String postcommitshacode, 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) + 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 != postcommitshacode) { // If the existing tag is not associated with HEAD From 813d6c77a69e11c18b5d6ed0b5d0fe467f9492a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 12:27:00 +0000 Subject: [PATCH 0591/1971] Tag associated source repos --- release/do.groovy | 86 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 8 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index f71c3df..a320775 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -5,6 +5,7 @@ summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" summarystring = "" releaserepofolder = "${WORKSPACE}/releaserepos" +sourcerepofolder = "${WORKSPACE}/sourcerepos" tempfolder = "${WORKSPACE}/temp" gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" @@ -65,6 +66,14 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { return previousreleasemeta } +def checkoutsourcerepo(buildmeta, String checkoutfolder) { + def String sourcerepo = buildmeta.gitinfo.remoteurl + // Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component + dir(sourcerepofolder) { + sh("git clone --depth 1 ${sourcerepo} ${checkoutfolder}") + } +} + def getcomponentartifacts(buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") @@ -112,13 +121,13 @@ def releasegitcommit(String buildstamp) { } // 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) { +def checkforchange(buildmeta, previousreleasemeta) { String buildsha = buildmeta.gitinfo.gitrevision String previoussha = previousreleasemeta.gitinfo.gitrevision def boolean changed = (buildsha != previoussha) echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" - return changed + return [changed, buildsha] } def ArrayList maketaglist(String buildstamp, String otherreleasetags) { @@ -170,6 +179,42 @@ def boolean releasegittags(String postcommitshacode, ArrayList taglist) 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") + 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 sourcegittags(buildsha, taglist) { + boolean tagadded = false + + summaryappend("Src Tag ") + for (tag in taglist) { + if (sourcegittag(buildsha, tag)) { + tagadded = true + } + } + return tagadded +} + def releasegitpush(String dryrunpush ) { if (dryrunpush == "true") { sh("git push -n --tags origin master") @@ -182,16 +227,34 @@ def releasegitpush(String dryrunpush ) { } } -def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { +def sourcegitpush(String dryrunpush ) { + if (dryrunpush == "true") { + sh("git push -n --tags") + summaryappend(",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(",Push") + } +} + +def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String sourcerepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") def String buildstamp = buildmeta.buildstampinfo.buildstamp + + ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + + def boolean changed = false + def String buildsha = "" + def boolean tagadded = false dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" releasegitadd() - def boolean changed = checkforchange(buildmeta, previousreleasemeta) + (changed, buildsha)= checkforchange(buildmeta, previousreleasemeta) if (changed) { releasegitcommit(buildstamp) } @@ -203,14 +266,18 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherr def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Post commit sha code: ${postcommitshacode}" - ArrayList taglist = maketaglist(buildstamp, otherreleasetags) - - def boolean tagadded = releasegittags(postcommitshacode, taglist) + tagadded = releasegittags(postcommitshacode, taglist) if (changed || tagadded) { releasegitpush(dryrunpush) } } + dir(sourcerepo) { + tagadded = sourcegittags(buildsha, taglist) + if (tagadded) { + sourcegitpush(dryrunpush) + } + } } def releasecomponent(buildinfo, String otherreleasetags, String dryrunpush) { @@ -218,13 +285,16 @@ def releasecomponent(buildinfo, String otherreleasetags, String dryrunpush) { 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}: ") def previousreleasemeta = checkoutreleaserepo(buildmeta, uniquefolderforrepo) + checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo) + getcomponentartifacts(buildinfo, uniquefolderforrepo, uniquefoldertemp) - gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, otherreleasetags, dryrunpush) + gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) summaryappend("\n") } From df484224e7911770599998344c7a9416a342792e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 12:27:00 +0000 Subject: [PATCH 0592/1971] Tag associated source repos --- release/do.groovy | 86 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 8 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index f71c3df..a320775 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -5,6 +5,7 @@ summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" summarystring = "" releaserepofolder = "${WORKSPACE}/releaserepos" +sourcerepofolder = "${WORKSPACE}/sourcerepos" tempfolder = "${WORKSPACE}/temp" gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" @@ -65,6 +66,14 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { return previousreleasemeta } +def checkoutsourcerepo(buildmeta, String checkoutfolder) { + def String sourcerepo = buildmeta.gitinfo.remoteurl + // Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component + dir(sourcerepofolder) { + sh("git clone --depth 1 ${sourcerepo} ${checkoutfolder}") + } +} + def getcomponentartifacts(buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") @@ -112,13 +121,13 @@ def releasegitcommit(String buildstamp) { } // 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) { +def checkforchange(buildmeta, previousreleasemeta) { String buildsha = buildmeta.gitinfo.gitrevision String previoussha = previousreleasemeta.gitinfo.gitrevision def boolean changed = (buildsha != previoussha) echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" - return changed + return [changed, buildsha] } def ArrayList maketaglist(String buildstamp, String otherreleasetags) { @@ -170,6 +179,42 @@ def boolean releasegittags(String postcommitshacode, ArrayList taglist) 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") + 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 sourcegittags(buildsha, taglist) { + boolean tagadded = false + + summaryappend("Src Tag ") + for (tag in taglist) { + if (sourcegittag(buildsha, tag)) { + tagadded = true + } + } + return tagadded +} + def releasegitpush(String dryrunpush ) { if (dryrunpush == "true") { sh("git push -n --tags origin master") @@ -182,16 +227,34 @@ def releasegitpush(String dryrunpush ) { } } -def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherreleasetags, String dryrunpush) { +def sourcegitpush(String dryrunpush ) { + if (dryrunpush == "true") { + sh("git push -n --tags") + summaryappend(",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(",Push") + } +} + +def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String sourcerepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") def String buildstamp = buildmeta.buildstampinfo.buildstamp + + ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + + def boolean changed = false + def String buildsha = "" + def boolean tagadded = false dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" releasegitadd() - def boolean changed = checkforchange(buildmeta, previousreleasemeta) + (changed, buildsha)= checkforchange(buildmeta, previousreleasemeta) if (changed) { releasegitcommit(buildstamp) } @@ -203,14 +266,18 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String otherr def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Post commit sha code: ${postcommitshacode}" - ArrayList taglist = maketaglist(buildstamp, otherreleasetags) - - def boolean tagadded = releasegittags(postcommitshacode, taglist) + tagadded = releasegittags(postcommitshacode, taglist) if (changed || tagadded) { releasegitpush(dryrunpush) } } + dir(sourcerepo) { + tagadded = sourcegittags(buildsha, taglist) + if (tagadded) { + sourcegitpush(dryrunpush) + } + } } def releasecomponent(buildinfo, String otherreleasetags, String dryrunpush) { @@ -218,13 +285,16 @@ def releasecomponent(buildinfo, String otherreleasetags, String dryrunpush) { 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}: ") def previousreleasemeta = checkoutreleaserepo(buildmeta, uniquefolderforrepo) + checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo) + getcomponentartifacts(buildinfo, uniquefolderforrepo, uniquefoldertemp) - gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, otherreleasetags, dryrunpush) + gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) summaryappend("\n") } From deb48be9fe1bccc9d02d7b57c65e7de999b67b12 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 13:25:00 +0000 Subject: [PATCH 0593/1971] Tag associated source repos --- release/do.groovy | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index a320775..6992f81 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -121,13 +121,13 @@ def releasegitcommit(String buildstamp) { } // Determine if there has been a change by comparing the sha code in previous release meta and the build meta -def checkforchange(buildmeta, previousreleasemeta) { +def boolean checkforchange(buildmeta, previousreleasemeta) { String buildsha = buildmeta.gitinfo.gitrevision String previoussha = previousreleasemeta.gitinfo.gitrevision def boolean changed = (buildsha != previoussha) echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" - return [changed, buildsha] + return changed } def ArrayList maketaglist(String buildstamp, String otherreleasetags) { @@ -196,17 +196,17 @@ def boolean sourcegittag(String shacode, String tag) { } else { // If tag does not exist already // Tag - sh("git tag \"${tag}\"") + sh("git tag \"${tag}\" ${shacode}") summaryappend("(${tag})") tagadded = true } return tagadded } -def sourcegittags(buildsha, taglist) { +def sourcegittags(String buildsha, List taglist) { boolean tagadded = false - summaryappend("Src Tag ") + summaryappend(",Src Tag ") for (tag in taglist) { if (sourcegittag(buildsha, tag)) { tagadded = true @@ -243,18 +243,14 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source summaryappend(" Git operations: ") def String buildstamp = buildmeta.buildstampinfo.buildstamp - ArrayList taglist = maketaglist(buildstamp, otherreleasetags) - - def boolean changed = false def String buildsha = "" - def boolean tagadded = false dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" releasegitadd() - (changed, buildsha)= checkforchange(buildmeta, previousreleasemeta) + def boolean changed = checkforchange(buildmeta, previousreleasemeta) if (changed) { releasegitcommit(buildstamp) } @@ -266,14 +262,19 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Post commit sha code: ${postcommitshacode}" - tagadded = releasegittags(postcommitshacode, taglist) + ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + def tagadded = releasegittags(postcommitshacode, taglist) if (changed || tagadded) { releasegitpush(dryrunpush) } } dir(sourcerepo) { - tagadded = sourcegittags(buildsha, taglist) + def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.buildstampinfo.buildstamp}" + def String buildsha = buildmeta.gitinfo.gitrevision + + def ArrayList srctaglist = maketaglist(srcbuildstamp, otherreleasetags) + def tagadded = sourcegittags(buildsha, srctaglist) if (tagadded) { sourcegitpush(dryrunpush) } @@ -306,7 +307,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String // Walk the meta information to a max depth, looking for artifacts to import for release componentReleaseInfo = buildmeta.releasewalkerunique(md) - + // For each component for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] From 995062473d2f0c27ca143832626f1cb08f796fb3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 13:25:00 +0000 Subject: [PATCH 0594/1971] Tag associated source repos --- release/do.groovy | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index a320775..6992f81 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -121,13 +121,13 @@ def releasegitcommit(String buildstamp) { } // Determine if there has been a change by comparing the sha code in previous release meta and the build meta -def checkforchange(buildmeta, previousreleasemeta) { +def boolean checkforchange(buildmeta, previousreleasemeta) { String buildsha = buildmeta.gitinfo.gitrevision String previoussha = previousreleasemeta.gitinfo.gitrevision def boolean changed = (buildsha != previoussha) echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" - return [changed, buildsha] + return changed } def ArrayList maketaglist(String buildstamp, String otherreleasetags) { @@ -196,17 +196,17 @@ def boolean sourcegittag(String shacode, String tag) { } else { // If tag does not exist already // Tag - sh("git tag \"${tag}\"") + sh("git tag \"${tag}\" ${shacode}") summaryappend("(${tag})") tagadded = true } return tagadded } -def sourcegittags(buildsha, taglist) { +def sourcegittags(String buildsha, List taglist) { boolean tagadded = false - summaryappend("Src Tag ") + summaryappend(",Src Tag ") for (tag in taglist) { if (sourcegittag(buildsha, tag)) { tagadded = true @@ -243,18 +243,14 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source summaryappend(" Git operations: ") def String buildstamp = buildmeta.buildstampinfo.buildstamp - ArrayList taglist = maketaglist(buildstamp, otherreleasetags) - - def boolean changed = false def String buildsha = "" - def boolean tagadded = false dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" releasegitadd() - (changed, buildsha)= checkforchange(buildmeta, previousreleasemeta) + def boolean changed = checkforchange(buildmeta, previousreleasemeta) if (changed) { releasegitcommit(buildstamp) } @@ -266,14 +262,19 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Post commit sha code: ${postcommitshacode}" - tagadded = releasegittags(postcommitshacode, taglist) + ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + def tagadded = releasegittags(postcommitshacode, taglist) if (changed || tagadded) { releasegitpush(dryrunpush) } } dir(sourcerepo) { - tagadded = sourcegittags(buildsha, taglist) + def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.buildstampinfo.buildstamp}" + def String buildsha = buildmeta.gitinfo.gitrevision + + def ArrayList srctaglist = maketaglist(srcbuildstamp, otherreleasetags) + def tagadded = sourcegittags(buildsha, srctaglist) if (tagadded) { sourcegitpush(dryrunpush) } @@ -306,7 +307,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String // Walk the meta information to a max depth, looking for artifacts to import for release componentReleaseInfo = buildmeta.releasewalkerunique(md) - + // For each component for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] From 75fc183c8908baac52fd9678cefec9f8adffe1c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 13:27:12 +0000 Subject: [PATCH 0595/1971] Tag associated source repos --- release/do.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 6992f81..ce2aef0 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -243,7 +243,6 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source summaryappend(" Git operations: ") def String buildstamp = buildmeta.buildstampinfo.buildstamp - def String buildsha = "" dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" From 8a08eefc068043ff5e775162760f94709bf1a21f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 13:27:12 +0000 Subject: [PATCH 0596/1971] Tag associated source repos --- release/do.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 6992f81..ce2aef0 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -243,7 +243,6 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source summaryappend(" Git operations: ") def String buildstamp = buildmeta.buildstampinfo.buildstamp - def String buildsha = "" dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" From ad6e69a19a0439038b8388fad9e69069afa9ce94 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 14:19:59 +0000 Subject: [PATCH 0597/1971] Tag associated source repos --- release/do.groovy | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index ce2aef0..4a00491 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -69,8 +69,20 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { def checkoutsourcerepo(buildmeta, String checkoutfolder) { def String sourcerepo = buildmeta.gitinfo.remoteurl // Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component - dir(sourcerepofolder) { - sh("git clone --depth 1 ${sourcerepo} ${checkoutfolder}") + if (fileExists(checkoutfolder)) { + dir(checkoutfolder) { + sh(""" + git reset --hard" + git clean -fdx + git pull + """ + ) + } + } + else { + dir(sourcerepofolder) { + sh("git clone ${sourcerepo} ${checkoutfolder}") + } } } @@ -269,7 +281,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source } } dir(sourcerepo) { - def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.buildstampinfo.buildstamp}" + def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}" def String buildsha = buildmeta.gitinfo.gitrevision def ArrayList srctaglist = maketaglist(srcbuildstamp, otherreleasetags) From 70473b38d8f4a5a5d01a010be067363778d18ce9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 14:19:59 +0000 Subject: [PATCH 0598/1971] Tag associated source repos --- release/do.groovy | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index ce2aef0..4a00491 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -69,8 +69,20 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { def checkoutsourcerepo(buildmeta, String checkoutfolder) { def String sourcerepo = buildmeta.gitinfo.remoteurl // Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component - dir(sourcerepofolder) { - sh("git clone --depth 1 ${sourcerepo} ${checkoutfolder}") + if (fileExists(checkoutfolder)) { + dir(checkoutfolder) { + sh(""" + git reset --hard" + git clean -fdx + git pull + """ + ) + } + } + else { + dir(sourcerepofolder) { + sh("git clone ${sourcerepo} ${checkoutfolder}") + } } } @@ -269,7 +281,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source } } dir(sourcerepo) { - def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.buildstampinfo.buildstamp}" + def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}" def String buildsha = buildmeta.gitinfo.gitrevision def ArrayList srctaglist = maketaglist(srcbuildstamp, otherreleasetags) From 2b15ebbd1890f76f60b690fc118c905548425876 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 14:22:22 +0000 Subject: [PATCH 0599/1971] Tag associated source repos --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 4a00491..f0c6c8b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -72,7 +72,7 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { if (fileExists(checkoutfolder)) { dir(checkoutfolder) { sh(""" - git reset --hard" + git reset --hard git clean -fdx git pull """ From f08e4ba3aab0c53ed2740f8b517e54c7316e0eae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 14:22:22 +0000 Subject: [PATCH 0600/1971] Tag associated source repos --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 4a00491..f0c6c8b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -72,7 +72,7 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { if (fileExists(checkoutfolder)) { dir(checkoutfolder) { sh(""" - git reset --hard" + git reset --hard git clean -fdx git pull """ From f4688da0078abecb9c4ba94bd4ec8a46b0d7c340 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 14:52:01 +0000 Subject: [PATCH 0601/1971] Make sure product name and sub component names can be used in tags --- meta/folder.groovy | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 13b1fe5..7ab5744 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -31,6 +31,15 @@ class ProductInfo extends GISJsonSerialised { } void set(String productname, String subcomponentname, String jirakey) { + // Make sure the fields can be used in git tags + def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\"", , 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 = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\"", , 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 this.jirakey = jirakey From e02d609283aa6f14a0b1498f18b6cc45ca021a14 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 14:52:01 +0000 Subject: [PATCH 0602/1971] Make sure product name and sub component names can be used in tags --- meta/folder.groovy | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 13b1fe5..7ab5744 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -31,6 +31,15 @@ class ProductInfo extends GISJsonSerialised { } void set(String productname, String subcomponentname, String jirakey) { + // Make sure the fields can be used in git tags + def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\"", , 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 = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\"", , 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 this.jirakey = jirakey From 5e7a447a1032c86e5deda0bd4a7b243ba1c0cc3e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 15:00:02 +0000 Subject: [PATCH 0603/1971] Make sure product name and sub component names can be used in tags --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7ab5744..e1e38aa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -32,11 +32,11 @@ class ProductInfo extends GISJsonSerialised { void set(String productname, String subcomponentname, String jirakey) { // Make sure the fields can be used in git tags - def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\"", , returnStatus: true) + def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , 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 = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\"", , returnStatus: true) + def int sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , 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") } From 9044b468b62882c353351d94b5c604629a8dd3fe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 15:00:02 +0000 Subject: [PATCH 0604/1971] Make sure product name and sub component names can be used in tags --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7ab5744..e1e38aa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -32,11 +32,11 @@ class ProductInfo extends GISJsonSerialised { void set(String productname, String subcomponentname, String jirakey) { // Make sure the fields can be used in git tags - def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\"", , returnStatus: true) + def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , 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 = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\"", , returnStatus: true) + def int sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , 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") } From 09984a65b6a6790ac515ba860d4ec8143d6b2062 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 23:27:47 +0000 Subject: [PATCH 0605/1971] Make sure all excess local tags are removed from the source repo at the start --- release/do.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release/do.groovy b/release/do.groovy index f0c6c8b..ecdd4eb 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -75,6 +75,8 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { git reset --hard git clean -fdx git pull + # Remove all tags that are not already on the remote + git fetch --tags --prune """ ) } From 391001aa3bd2a805da83cdc29f951873c9cc0b76 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 23:27:47 +0000 Subject: [PATCH 0606/1971] Make sure all excess local tags are removed from the source repo at the start --- release/do.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release/do.groovy b/release/do.groovy index f0c6c8b..ecdd4eb 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -75,6 +75,8 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { git reset --hard git clean -fdx git pull + # Remove all tags that are not already on the remote + git fetch --tags --prune """ ) } From 5a60dddd9a4e55a4ce5e30e21724dd9c16a4ec1e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 23:53:17 +0000 Subject: [PATCH 0607/1971] Make sure all excess local tags are removed from the source repo at the start --- release/do.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index ecdd4eb..c8e1ce6 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -76,7 +76,8 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { git clean -fdx git pull # Remove all tags that are not already on the remote - git fetch --tags --prune + git tag -l | xargs git tag -d >/dev/null + git fetch -t >/dev/null """ ) } From e419aac74f0ed95134730adb0154e6f7f1830052 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 1 Dec 2018 23:53:17 +0000 Subject: [PATCH 0608/1971] Make sure all excess local tags are removed from the source repo at the start --- release/do.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index ecdd4eb..c8e1ce6 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -76,7 +76,8 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { git clean -fdx git pull # Remove all tags that are not already on the remote - git fetch --tags --prune + git tag -l | xargs git tag -d >/dev/null + git fetch -t >/dev/null """ ) } From 299f74fb853c207b19b018cec2cf5ca7bad61981 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 2 Dec 2018 17:04:33 +0000 Subject: [PATCH 0609/1971] Distinguish src and release repo pushes --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index c8e1ce6..169c292 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -245,12 +245,12 @@ def releasegitpush(String dryrunpush ) { def sourcegitpush(String dryrunpush ) { if (dryrunpush == "true") { sh("git push -n --tags") - summaryappend(",Dry-Run-Push") + 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(",Push") + summaryappend(",Src Push") } } From 9abb04a84816cde72ddde80e15ac4b4b78b423bc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 2 Dec 2018 17:04:33 +0000 Subject: [PATCH 0610/1971] Distinguish src and release repo pushes --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index c8e1ce6..169c292 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -245,12 +245,12 @@ def releasegitpush(String dryrunpush ) { def sourcegitpush(String dryrunpush ) { if (dryrunpush == "true") { sh("git push -n --tags") - summaryappend(",Dry-Run-Push") + 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(",Push") + summaryappend(",Src Push") } } From 783cb9c9629fb5275ec3e7d666bfc9d6f1e16d65 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 2 Dec 2018 18:08:43 +0000 Subject: [PATCH 0611/1971] Make sure product name and sub component names can be used in tags --- meta/folder.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index e1e38aa..1edd45c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -434,6 +434,7 @@ class MetaInfo extends GISJsonSerialised { ChecksumInfo checksuminfo private ArrayList configurationinfo private ArrayList publishableinfo + private LinkedHashMap custominfo private ArrayList associatedmeta MetaInfo(script) { @@ -446,6 +447,7 @@ class MetaInfo extends GISJsonSerialised { checksuminfo = new ChecksumInfo(script) configurationinfo = new ArrayList() publishableinfo = new ArrayList() + custominfo = new LinkedHashMap() associatedmeta = new ArrayList() } @@ -467,6 +469,14 @@ class MetaInfo extends GISJsonSerialised { 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) { @@ -504,6 +514,7 @@ class MetaInfo extends GISJsonSerialised { pb.deserialiseJson(rawpublishable) publishableinfo.add(pb) } + custominfo = rawmeta['custominfo'] for (rawrelatedmeta in rawmeta['associatedmeta']) { def rm = new RelatedMetaInfo(script) rm.deserialiseJson(rawrelatedmeta) @@ -571,6 +582,7 @@ class MetaInfo extends GISJsonSerialised { 'configuration' : configurationinfoserialised(), 'checksuminfo' : checksuminfo.serialisationdata(), 'publishableinfo' : publishableinfoserialised(), + 'custominfo' : custominfo, 'associatedmeta' : associatedmetaserialised(), ] return data From 9cb07c5f1617d0b59d47d0ac486f1d8650827bf3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 2 Dec 2018 18:08:43 +0000 Subject: [PATCH 0612/1971] Make sure product name and sub component names can be used in tags --- meta/folder.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index e1e38aa..1edd45c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -434,6 +434,7 @@ class MetaInfo extends GISJsonSerialised { ChecksumInfo checksuminfo private ArrayList configurationinfo private ArrayList publishableinfo + private LinkedHashMap custominfo private ArrayList associatedmeta MetaInfo(script) { @@ -446,6 +447,7 @@ class MetaInfo extends GISJsonSerialised { checksuminfo = new ChecksumInfo(script) configurationinfo = new ArrayList() publishableinfo = new ArrayList() + custominfo = new LinkedHashMap() associatedmeta = new ArrayList() } @@ -467,6 +469,14 @@ class MetaInfo extends GISJsonSerialised { 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) { @@ -504,6 +514,7 @@ class MetaInfo extends GISJsonSerialised { pb.deserialiseJson(rawpublishable) publishableinfo.add(pb) } + custominfo = rawmeta['custominfo'] for (rawrelatedmeta in rawmeta['associatedmeta']) { def rm = new RelatedMetaInfo(script) rm.deserialiseJson(rawrelatedmeta) @@ -571,6 +582,7 @@ class MetaInfo extends GISJsonSerialised { 'configuration' : configurationinfoserialised(), 'checksuminfo' : checksuminfo.serialisationdata(), 'publishableinfo' : publishableinfoserialised(), + 'custominfo' : custominfo, 'associatedmeta' : associatedmetaserialised(), ] return data From bf616a38a1e9ef837be0ca6e94d9b9cfb9c4bb56 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 3 Dec 2018 08:37:23 +0000 Subject: [PATCH 0613/1971] Add bat variant of git commands --- meta/folder.groovy | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1edd45c..643e203 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -32,11 +32,23 @@ class ProductInfo extends GISJsonSerialised { void set(String productname, String subcomponentname, String jirakey) { // Make sure the fields can be used in git tags - def int pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) + 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 = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true) + 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") } From 66082496ba822a5d2883823f745b97cc4e54a89b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 3 Dec 2018 08:48:11 +0000 Subject: [PATCH 0614/1971] Add bat variant of git commands --- versionnumbering/generate.groovy | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f80d021..ae7e5f4 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -10,42 +10,35 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { def String remoteinfo def String remoteurl dir( gitrootpath) { - def int changecount + def int changecount = 0 if (isUnix()) { changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger() } else { - def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim() - changecount = stdout.readLines()[1] as int - } + changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger() + } echo "Change count: ${changecount}" adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" - if (isUnix()) { gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() } else { - def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim() - gitrevision = stdout.readLines()[1] + 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 { - def stdout = bat(returnStdout:true , script: "git remote show origin").trim() - remoteinfo = stdout.readLines()[1..-1] + 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 { - def stdout = bat(returnStdout:true , script: "git config --get remote.origin.url").trim() - remoteurl = stdout.readLines()[1] + remoteurl = bat(returnStdout: true, script: "@git config --get remote.origin.url").trim() } echo "Remote URL: ${remoteurl}" } From 95caf56875baa6ed8b58fd36c7e9cf9855a3ea81 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 3 Dec 2018 13:28:28 +0000 Subject: [PATCH 0615/1971] Make installer build use meta --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 643e203..15f77d0 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -605,8 +605,8 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME } - String generateartifacts(ArrayList releasedfromhere = new ArrayList(), - ArrayList releasedfromsubmeta = new ArrayList(), + 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 From a5cd7e43acf791622620f270e12decfe2953ff3f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 3 Dec 2018 14:47:13 +0000 Subject: [PATCH 0616/1971] Import specific job binaries; Add imported meta to this jobs meta --- import/importer.groovy | 6 ++++-- install/installhelper.groovy | 19 +++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 4d24d30..bf040ce 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,7 +1,8 @@ -def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', boolean fingerprint = false) { +def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', String excludes = '', boolean fingerprint = false) { copyArtifacts( filter: filter, + excludes: excludes, fingerprintArtifacts: fingerprint, projectName: jenkinsjob.trim(), selector: specific(buildnumber.toString()), @@ -10,9 +11,10 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, St return meta.importrelated(destpath) } -def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { +def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', String excludes = '', boolean fingerprint = false) { copyArtifacts( filter: filter, + excludes: excludes, fingerprintArtifacts: fingerprint, projectName: jenkinsjob.trim(), selector: [ diff --git a/install/installhelper.groovy b/install/installhelper.groovy index f523799..fdd6016 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -1,30 +1,21 @@ // Given details about artifacts to import and details of installers to build, import artifacts that are required -def artifactsImporter(artifactDetails, installerDetails) { +def artifactsImporter(meta, artifactDetails, installerDetails) { artifactFetched = [:] + def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { def artifactKey = installerDetails.get(installer)[0] - //echo "To build: ${installer} use artifactKey: ${artifactKey}" - (sourceProject, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + (sourceProject, sourceselector, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) env.importDest = destFolder if (artifactFetched.get(artifactKey) == null) { - //echo "Artifact info: ${artifactInfo}" - copyArtifacts excludes: notToCopy, filter: toCopy, fingerprintArtifacts: true, projectName: "${sourceProject}", selector: lastSuccessful(), target: "${destFolder}" - def componentVersionFolder = "${WORKSPACE}\\version\\version_${artifactKey}" - def folderToCopy = "${destFolder}\\version" - echo "Copying from: ${folderToCopy} to: ${componentVersionFolder}" - fileOperations([folderCopyOperation(destinationFolderPath: componentVersionFolder, sourceFolderPath: folderToCopy)]) - //fileOperations([fileCopyOperation(excludes: '', flattenFiles: false, includes: filesToCopy, targetLocation: componentVersionFolder )]) - def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - artifactVersion = gh.getSHAFromVersion("${destFolder}/version") - artifactFetched.put(artifactKey, artifactVersion) + def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destpath, toCopy, notToCopy, true) } } return artifactFetched } // Export any required binaries to the /bin folder -def exportBinaries(artifactDetails, installerDetails) { +def placeBinaries(artifactDetails, installerDetails) { for (installer in toBuild) { (artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer) if (exportBinaries) { From 5aae28adceb6c3d13281be015d9f9519b3e34262 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 3 Dec 2018 15:06:26 +0000 Subject: [PATCH 0617/1971] Import specific job binaries; Add imported meta to this jobs meta --- install/installhelper.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index fdd6016..206a6c1 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -6,9 +6,8 @@ def artifactsImporter(meta, artifactDetails, installerDetails) { for (installer in toBuild) { def artifactKey = installerDetails.get(installer)[0] (sourceProject, sourceselector, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) - env.importDest = destFolder if (artifactFetched.get(artifactKey) == null) { - def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destpath, toCopy, notToCopy, true) + def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, toCopy, notToCopy, true) } } return artifactFetched From 2d679105c8c4f23cf7e46940d8547c36d9e99351 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 3 Dec 2018 15:36:06 +0000 Subject: [PATCH 0618/1971] Import specific job binaries; Add imported meta to this jobs meta --- install/installhelper.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 206a6c1..0155c7f 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -1,5 +1,5 @@ // Given details about artifacts to import and details of installers to build, import artifacts that are required -def artifactsImporter(meta, artifactDetails, installerDetails) { +def Map artifactsImporter(meta, artifactDetails, installerDetails) { artifactFetched = [:] def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") @@ -8,6 +8,7 @@ def artifactsImporter(meta, artifactDetails, installerDetails) { (sourceProject, sourceselector, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, toCopy, notToCopy, true) + artifactFetched.put(artifactKey, importmeta) } } return artifactFetched From 165888b6d98a6eaa5ddf9b32947eb7dc7407b388 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 10 Dec 2018 11:03:43 +0000 Subject: [PATCH 0619/1971] Turn off fingerprinting --- install/installhelper.gsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.gsh b/install/installhelper.gsh index a55292d..c1ccc6a 100644 --- a/install/installhelper.gsh +++ b/install/installhelper.gsh @@ -9,7 +9,7 @@ def artifactsImporter(artifactDetails, installerDetails) { env.importDest = destFolder if (artifactFetched.get(artifactKey) == null) { //echo "Artifact info: ${artifactInfo}" - copyArtifacts excludes: notToCopy, filter: toCopy, fingerprintArtifacts: true, projectName: "${sourceProject}", selector: lastSuccessful(), target: "${destFolder}" + copyArtifacts excludes: notToCopy, filter: toCopy, fingerprintArtifacts: false, projectName: "${sourceProject}", selector: lastSuccessful(), target: "${destFolder}" def componentVersionFolder = "${WORKSPACE}\\version\\version_${artifactKey}" def folderToCopy = "${destFolder}\\version" echo "Copying from: ${folderToCopy} to: ${componentVersionFolder}" From c53ab475b15f335709421f54a291b8b925351c6b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 10 Dec 2018 18:30:15 +0000 Subject: [PATCH 0620/1971] Add publishing script --- publish/do.groovy | 313 ++++++++++++++++++++++++++++++++++++++ versioncontrol/git.groovy | 18 ++- 2 files changed, 329 insertions(+), 2 deletions(-) create mode 100644 publish/do.groovy diff --git a/publish/do.groovy b/publish/do.groovy new file mode 100644 index 0000000..2c5a018 --- /dev/null +++ b/publish/do.groovy @@ -0,0 +1,313 @@ +markunstable = false +unstablereason = "" + +FTP_CLIENT_LOCATION='ftp' +FTP_URL='ie1.hostedftp.com' +FTP_USER='ftp@globalinkjetsystems.com' +FTP_CUSTOMER_ROOT='/Customers/' +FTP_PASSWORD='ramshorn42' +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" +releaserepofolder = "${WORKSPACE}/releaserepos" +sourcerepofolder = "${WORKSPACE}/sourcerepos" +tempfolder = "${WORKSPACE}/temp" +gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" + +metascript = autobuilder.getmetafolderscript() +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + +def resetfolders() { + dir(summaryfolder) { + deleteDir() + } + dir(releaserepofolder) { + deleteDir() + } + dir(tempfolder) { + deleteDir() + } +} + +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 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 + def previousreleasemeta = buildmeta.getNewMetaObject(this) + dir(releaserepofolder) { + sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") + } + previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + dir(checkoutfolder) { + // Clear all existing files + sh("git rm -r *") + } + return previousreleasemeta +} + +def checkoutsourcerepo(buildmeta, String checkoutfolder) { + def String sourcerepo = buildmeta.gitinfo.remoteurl + // 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}") + } + } +} + +def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { + // Copy relevant artifacts to temp folder + summaryappend("Artifacts: ") + + def releasemeta = releaseinfo.meta + def String componentURL = releasemeta.releaseinfo.releaserepoURL + def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}" + def publishableitems = releasemeta.publishableinfo + def ArrayList publishablePaths = new ArrayList() + for (publishableitem in publishableitems) { + publishablePaths.add(publishableitem.filepath) + summaryappend("${publishableitem.filepath},") + } + gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone +} + +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 changed = (buildsha != previoussha) + echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" + return changed +} + +def ArrayList maketaglist(String buildstamp, String otherreleasetags) { + def ArrayList taglist = new ArrayList() + taglist.add(buildstamp) + + def ArrayList othertaglist = otherreleasetags.split(',') + for (othertagitem in othertaglist) { + if (othertagitem?.trim()) { + taglist.add(othertagitem.trim()) + } + } + return taglist +} + +def boolean releasegittag(String postcommitshacode, 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 != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") + 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") + 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 ) { + 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 ) { + 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 publish(releasemeta, String uniquefolderforrepo) { + summaryappend(" Git operations: ") + def String buildstamp = releasemeta.buildstampinfo.buildstamp + + dir(uniquefolderforrepo) { + def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Pre commit sha code: ${precommitshacode}" + + releasegitadd() + + def boolean changed = checkforchange(buildmeta, previousreleasemeta) + if (changed) { + releasegitcommit(buildstamp) + } + else { + releasegitreset() + summaryappend("No-commit,") + } + + def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Post commit sha code: ${postcommitshacode}" + + ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + def tagadded = releasegittags(postcommitshacode, taglist) + + if (changed || tagadded) { + releasegitpush(dryrunpush) + } + } +} + +def recallcomponent(releaseinfo) { + def releasemeta = releaseinfo.meta + def String uniquefolder = "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" + def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" + + summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") + + getcomponentartifacts(releaseinfo, uniquefolderforrepo, uniquefoldertemp) + + summaryappend("\n") +} + +def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) { + int md = maxdepth.toInteger() + resetfolders() + preconditions() + + // Walk the meta information to a max depth, looking for artifacts to import for release + componentReleaseInfo = releasemeta.releasewalkerunique(md) + + // For each component + for (key in componentReleaseInfo.keySet()) { + def releaseinfo = componentReleaseInfo[key] + recallcomponent(releaseinfo) + } + // publish(releasemeta, uniquefolderforrepo) + + return [summarystring, markunstable, unstablereason] +} + +return this; diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index cb9354b..8bd7968 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -1,3 +1,7 @@ +import hudson.plugins.git.* +import hudson.plugins.git.extensions.* +import hudson.plugins.git.extensions.impl.* + clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") String getGitInfo(String workingSetRootPath) { @@ -6,7 +10,16 @@ String getGitInfo(String workingSetRootPath) { } } -def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { +@NonCPS +def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { + ArrayList sparsecheckoutpaths = new ArrayList() + for (path in paths) { + sparsecheckoutpaths.add(new SparseCheckoutPath(path)) + } + return new SparseCheckoutPaths(sparsecheckoutpaths) +} + +def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { reporootenv = env.REPO_ROOT if (reporootenv != null && repoRoot != "") { reporootpath = "${reporootenv.trim()}/${repoRoot}" @@ -28,7 +41,8 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], - [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir] + [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], + sparsecheckoutconfig(sparseitemlist) ], submoduleCfg: [], ]) From db6163fff766bbaecc039aa3ccafa9df7b2b0aee Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 10 Dec 2018 18:30:15 +0000 Subject: [PATCH 0621/1971] Add publishing script --- publish/do.groovy | 313 ++++++++++++++++++++++++++++++++++++++ versioncontrol/git.groovy | 18 ++- 2 files changed, 329 insertions(+), 2 deletions(-) create mode 100644 publish/do.groovy diff --git a/publish/do.groovy b/publish/do.groovy new file mode 100644 index 0000000..2c5a018 --- /dev/null +++ b/publish/do.groovy @@ -0,0 +1,313 @@ +markunstable = false +unstablereason = "" + +FTP_CLIENT_LOCATION='ftp' +FTP_URL='ie1.hostedftp.com' +FTP_USER='ftp@globalinkjetsystems.com' +FTP_CUSTOMER_ROOT='/Customers/' +FTP_PASSWORD='ramshorn42' +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" +releaserepofolder = "${WORKSPACE}/releaserepos" +sourcerepofolder = "${WORKSPACE}/sourcerepos" +tempfolder = "${WORKSPACE}/temp" +gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" + +metascript = autobuilder.getmetafolderscript() +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + +def resetfolders() { + dir(summaryfolder) { + deleteDir() + } + dir(releaserepofolder) { + deleteDir() + } + dir(tempfolder) { + deleteDir() + } +} + +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 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 + def previousreleasemeta = buildmeta.getNewMetaObject(this) + dir(releaserepofolder) { + sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") + } + previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) + dir(checkoutfolder) { + // Clear all existing files + sh("git rm -r *") + } + return previousreleasemeta +} + +def checkoutsourcerepo(buildmeta, String checkoutfolder) { + def String sourcerepo = buildmeta.gitinfo.remoteurl + // 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}") + } + } +} + +def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { + // Copy relevant artifacts to temp folder + summaryappend("Artifacts: ") + + def releasemeta = releaseinfo.meta + def String componentURL = releasemeta.releaseinfo.releaserepoURL + def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}" + def publishableitems = releasemeta.publishableinfo + def ArrayList publishablePaths = new ArrayList() + for (publishableitem in publishableitems) { + publishablePaths.add(publishableitem.filepath) + summaryappend("${publishableitem.filepath},") + } + gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone +} + +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 changed = (buildsha != previoussha) + echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" + return changed +} + +def ArrayList maketaglist(String buildstamp, String otherreleasetags) { + def ArrayList taglist = new ArrayList() + taglist.add(buildstamp) + + def ArrayList othertaglist = otherreleasetags.split(',') + for (othertagitem in othertaglist) { + if (othertagitem?.trim()) { + taglist.add(othertagitem.trim()) + } + } + return taglist +} + +def boolean releasegittag(String postcommitshacode, 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 != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") + 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") + 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 ) { + 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 ) { + 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 publish(releasemeta, String uniquefolderforrepo) { + summaryappend(" Git operations: ") + def String buildstamp = releasemeta.buildstampinfo.buildstamp + + dir(uniquefolderforrepo) { + def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Pre commit sha code: ${precommitshacode}" + + releasegitadd() + + def boolean changed = checkforchange(buildmeta, previousreleasemeta) + if (changed) { + releasegitcommit(buildstamp) + } + else { + releasegitreset() + summaryappend("No-commit,") + } + + def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() + echo "Post commit sha code: ${postcommitshacode}" + + ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + def tagadded = releasegittags(postcommitshacode, taglist) + + if (changed || tagadded) { + releasegitpush(dryrunpush) + } + } +} + +def recallcomponent(releaseinfo) { + def releasemeta = releaseinfo.meta + def String uniquefolder = "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" + def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" + + summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") + + getcomponentartifacts(releaseinfo, uniquefolderforrepo, uniquefoldertemp) + + summaryappend("\n") +} + +def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) { + int md = maxdepth.toInteger() + resetfolders() + preconditions() + + // Walk the meta information to a max depth, looking for artifacts to import for release + componentReleaseInfo = releasemeta.releasewalkerunique(md) + + // For each component + for (key in componentReleaseInfo.keySet()) { + def releaseinfo = componentReleaseInfo[key] + recallcomponent(releaseinfo) + } + // publish(releasemeta, uniquefolderforrepo) + + return [summarystring, markunstable, unstablereason] +} + +return this; diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index cb9354b..8bd7968 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -1,3 +1,7 @@ +import hudson.plugins.git.* +import hudson.plugins.git.extensions.* +import hudson.plugins.git.extensions.impl.* + clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy") String getGitInfo(String workingSetRootPath) { @@ -6,7 +10,16 @@ String getGitInfo(String workingSetRootPath) { } } -def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { +@NonCPS +def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { + ArrayList sparsecheckoutpaths = new ArrayList() + for (path in paths) { + sparsecheckoutpaths.add(new SparseCheckoutPath(path)) + } + return new SparseCheckoutPaths(sparsecheckoutpaths) +} + +def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { reporootenv = env.REPO_ROOT if (reporootenv != null && repoRoot != "") { reporootpath = "${reporootenv.trim()}/${repoRoot}" @@ -28,7 +41,8 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], - [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir] + [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], + sparsecheckoutconfig(sparseitemlist) ], submoduleCfg: [], ]) From 6bf82480ff7719403ced72bbc9a4bb95db0d161b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 11:22:13 +0000 Subject: [PATCH 0622/1971] Only checkout repositories that have publishable items --- publish/do.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 2c5a018..c7084d0 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -104,11 +104,13 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}" def publishableitems = releasemeta.publishableinfo def ArrayList publishablePaths = new ArrayList() - for (publishableitem in publishableitems) { - publishablePaths.add(publishableitem.filepath) - summaryappend("${publishableitem.filepath},") + if (publishableitems.size() > 0) { + for (publishableitem in publishableitems) { + publishablePaths.add(publishableitem.filepath) + summaryappend("${publishableitem.filepath},") + } + gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone } - gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone } def releasegitadd() { From 9ea146b13318e6f5beedd7dd917d6cda79ac60b5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 11:22:13 +0000 Subject: [PATCH 0623/1971] Only checkout repositories that have publishable items --- publish/do.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 2c5a018..c7084d0 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -104,11 +104,13 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}" def publishableitems = releasemeta.publishableinfo def ArrayList publishablePaths = new ArrayList() - for (publishableitem in publishableitems) { - publishablePaths.add(publishableitem.filepath) - summaryappend("${publishableitem.filepath},") + if (publishableitems.size() > 0) { + for (publishableitem in publishableitems) { + publishablePaths.add(publishableitem.filepath) + summaryappend("${publishableitem.filepath},") + } + gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone } - gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone } def releasegitadd() { From 907c3668e81d0d6016616c4494aaec4318f801c2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 13:15:10 +0000 Subject: [PATCH 0624/1971] Build up folder structure for FTP --- publish/do.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index c7084d0..4d02b4f 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -281,9 +281,9 @@ def publish(releasemeta, String uniquefolderforrepo) { } } -def recallcomponent(releaseinfo) { +def recallcomponent(releaseinfo, String customer, String softwarerelease) { def releasemeta = releaseinfo.meta - def String uniquefolder = "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolder = "${customer}/${PRODUCT_NAME}/${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -305,7 +305,7 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin // For each component for (key in componentReleaseInfo.keySet()) { def releaseinfo = componentReleaseInfo[key] - recallcomponent(releaseinfo) + recallcomponent(releaseinfo, customer, softwarerelease) } // publish(releasemeta, uniquefolderforrepo) From a7f6f97d7720cebc81be274449a9634d3569cfbc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 13:15:10 +0000 Subject: [PATCH 0625/1971] Build up folder structure for FTP --- publish/do.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index c7084d0..4d02b4f 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -281,9 +281,9 @@ def publish(releasemeta, String uniquefolderforrepo) { } } -def recallcomponent(releaseinfo) { +def recallcomponent(releaseinfo, String customer, String softwarerelease) { def releasemeta = releaseinfo.meta - def String uniquefolder = "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolder = "${customer}/${PRODUCT_NAME}/${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -305,7 +305,7 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin // For each component for (key in componentReleaseInfo.keySet()) { def releaseinfo = componentReleaseInfo[key] - recallcomponent(releaseinfo) + recallcomponent(releaseinfo, customer, softwarerelease) } // publish(releasemeta, uniquefolderforrepo) From 7f98363f995c347a941916906f1f4e6521902b6f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 13:59:24 +0000 Subject: [PATCH 0626/1971] Change root path for transfer; Add an example FTP operation --- publish/do.groovy | 53 ++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 4d02b4f..b953f4c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -1,11 +1,6 @@ markunstable = false unstablereason = "" -FTP_CLIENT_LOCATION='ftp' -FTP_URL='ie1.hostedftp.com' -FTP_USER='ftp@globalinkjetsystems.com' -FTP_CUSTOMER_ROOT='/Customers/' -FTP_PASSWORD='ramshorn42' summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" summarystring = "" @@ -250,40 +245,32 @@ def sourcegitpush(String dryrunpush ) { } } -def publish(releasemeta, String uniquefolderforrepo) { - summaryappend(" Git operations: ") - def String buildstamp = releasemeta.buildstampinfo.buildstamp +def String FTP_CLIENT_LOCATION='ftp' +def String FTP_URL='ie1.hostedftp.com' +def String FTP_USER='ftp@globalinkjetsystems.com' +def String FTP_CUSTOMER_ROOT='/Customers/' +def String FTP_PASSWORD='ramshorn42' - dir(uniquefolderforrepo) { - def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Pre commit sha code: ${precommitshacode}" - - releasegitadd() +def publish() { + summaryappend(" FTP operations: ") - def boolean changed = checkforchange(buildmeta, previousreleasemeta) - if (changed) { - releasegitcommit(buildstamp) - } - else { - releasegitreset() - summaryappend("No-commit,") - } - - def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Post commit sha code: ${postcommitshacode}" - - ArrayList taglist = maketaglist(buildstamp, otherreleasetags) - def tagadded = releasegittags(postcommitshacode, taglist) - - if (changed || tagadded) { - releasegitpush(dryrunpush) - } + dir(releaserepofolder) { + sh """#!/bin/bash + ftp -n -v ${FTP_URL} << EOT + ascii + user ${FTP_USER} ${FTP_PASSWORD} + prompt + cd ${FTP_CUSTOMER_ROOT} + ls -la + bye + EOT + """ } } def recallcomponent(releaseinfo, String customer, String softwarerelease) { def releasemeta = releaseinfo.meta - def String uniquefolder = "${customer}/${PRODUCT_NAME}/${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolder = "${customer}/Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -307,7 +294,7 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin def releaseinfo = componentReleaseInfo[key] recallcomponent(releaseinfo, customer, softwarerelease) } - // publish(releasemeta, uniquefolderforrepo) + publish() return [summarystring, markunstable, unstablereason] } From 67ca5024c206ccfd03e322717df27ae1458332f9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 13:59:24 +0000 Subject: [PATCH 0627/1971] Change root path for transfer; Add an example FTP operation --- publish/do.groovy | 53 ++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 4d02b4f..b953f4c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -1,11 +1,6 @@ markunstable = false unstablereason = "" -FTP_CLIENT_LOCATION='ftp' -FTP_URL='ie1.hostedftp.com' -FTP_USER='ftp@globalinkjetsystems.com' -FTP_CUSTOMER_ROOT='/Customers/' -FTP_PASSWORD='ramshorn42' summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" summarystring = "" @@ -250,40 +245,32 @@ def sourcegitpush(String dryrunpush ) { } } -def publish(releasemeta, String uniquefolderforrepo) { - summaryappend(" Git operations: ") - def String buildstamp = releasemeta.buildstampinfo.buildstamp +def String FTP_CLIENT_LOCATION='ftp' +def String FTP_URL='ie1.hostedftp.com' +def String FTP_USER='ftp@globalinkjetsystems.com' +def String FTP_CUSTOMER_ROOT='/Customers/' +def String FTP_PASSWORD='ramshorn42' - dir(uniquefolderforrepo) { - def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Pre commit sha code: ${precommitshacode}" - - releasegitadd() +def publish() { + summaryappend(" FTP operations: ") - def boolean changed = checkforchange(buildmeta, previousreleasemeta) - if (changed) { - releasegitcommit(buildstamp) - } - else { - releasegitreset() - summaryappend("No-commit,") - } - - def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Post commit sha code: ${postcommitshacode}" - - ArrayList taglist = maketaglist(buildstamp, otherreleasetags) - def tagadded = releasegittags(postcommitshacode, taglist) - - if (changed || tagadded) { - releasegitpush(dryrunpush) - } + dir(releaserepofolder) { + sh """#!/bin/bash + ftp -n -v ${FTP_URL} << EOT + ascii + user ${FTP_USER} ${FTP_PASSWORD} + prompt + cd ${FTP_CUSTOMER_ROOT} + ls -la + bye + EOT + """ } } def recallcomponent(releaseinfo, String customer, String softwarerelease) { def releasemeta = releaseinfo.meta - def String uniquefolder = "${customer}/${PRODUCT_NAME}/${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolder = "${customer}/Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -307,7 +294,7 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin def releaseinfo = componentReleaseInfo[key] recallcomponent(releaseinfo, customer, softwarerelease) } - // publish(releasemeta, uniquefolderforrepo) + publish() return [summarystring, markunstable, unstablereason] } From bc9dc68534aca9bd0480a5d1422b6ca2194de734 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 14:26:20 +0000 Subject: [PATCH 0628/1971] Build up folder structure for FTP --- publish/do.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index b953f4c..46b3fdd 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -245,15 +245,15 @@ def sourcegitpush(String dryrunpush ) { } } -def String FTP_CLIENT_LOCATION='ftp' -def String FTP_URL='ie1.hostedftp.com' -def String FTP_USER='ftp@globalinkjetsystems.com' -def String FTP_CUSTOMER_ROOT='/Customers/' -def String FTP_PASSWORD='ramshorn42' def publish() { summaryappend(" FTP operations: ") + def String FTP_CLIENT_LOCATION='ftp' + def String FTP_URL='ie1.hostedftp.com' + def String FTP_USER='ftp@globalinkjetsystems.com' + def String FTP_CUSTOMER_ROOT='/Customers/' + def String FTP_PASSWORD='ramshorn42' dir(releaserepofolder) { sh """#!/bin/bash ftp -n -v ${FTP_URL} << EOT From b178b86f6ee9199bdc418f5cf79d28b6505b7a00 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 14:26:20 +0000 Subject: [PATCH 0629/1971] Build up folder structure for FTP --- publish/do.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index b953f4c..46b3fdd 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -245,15 +245,15 @@ def sourcegitpush(String dryrunpush ) { } } -def String FTP_CLIENT_LOCATION='ftp' -def String FTP_URL='ie1.hostedftp.com' -def String FTP_USER='ftp@globalinkjetsystems.com' -def String FTP_CUSTOMER_ROOT='/Customers/' -def String FTP_PASSWORD='ramshorn42' def publish() { summaryappend(" FTP operations: ") + def String FTP_CLIENT_LOCATION='ftp' + def String FTP_URL='ie1.hostedftp.com' + def String FTP_USER='ftp@globalinkjetsystems.com' + def String FTP_CUSTOMER_ROOT='/Customers/' + def String FTP_PASSWORD='ramshorn42' dir(releaserepofolder) { sh """#!/bin/bash ftp -n -v ${FTP_URL} << EOT From 3b5e27f3e3f851a14e76506d0c893193e312af1e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 15:14:29 +0000 Subject: [PATCH 0630/1971] Use ncftpput to transfer --- publish/do.groovy | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 46b3fdd..13a280a 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -106,6 +106,9 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { } gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone } + else { + summaryappend("None ") + } } def releasegitadd() { @@ -245,32 +248,26 @@ def sourcegitpush(String dryrunpush ) { } } - -def publish() { +def publish(String customer) { summaryappend(" FTP operations: ") def String FTP_CLIENT_LOCATION='ftp' def String FTP_URL='ie1.hostedftp.com' def String FTP_USER='ftp@globalinkjetsystems.com' - def String FTP_CUSTOMER_ROOT='/Customers/' + def String FTP_CUSTOMER_ROOT="/Customers/${customer}" def String FTP_PASSWORD='ramshorn42' dir(releaserepofolder) { + summaryappend(" FTP operations: Transferring to ${FTP_CUSTOMER_ROOT} ") sh """#!/bin/bash - ftp -n -v ${FTP_URL} << EOT - ascii - user ${FTP_USER} ${FTP_PASSWORD} - prompt - cd ${FTP_CUSTOMER_ROOT} - ls -la - bye - EOT + ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" . """ + summaryappend(", Transferred ") } } -def recallcomponent(releaseinfo, String customer, String softwarerelease) { +def recallcomponent(releaseinfo, String softwarerelease) { def releasemeta = releaseinfo.meta - def String uniquefolder = "${customer}/Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolder = "Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -292,9 +289,9 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin // For each component for (key in componentReleaseInfo.keySet()) { def releaseinfo = componentReleaseInfo[key] - recallcomponent(releaseinfo, customer, softwarerelease) + recallcomponent(releaseinfo, softwarerelease) } - publish() + publish(customer) return [summarystring, markunstable, unstablereason] } From 4230e4dcd33918892e2f4ac90fafb688dad4ba87 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 15:14:29 +0000 Subject: [PATCH 0631/1971] Use ncftpput to transfer --- publish/do.groovy | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 46b3fdd..13a280a 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -106,6 +106,9 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { } gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone } + else { + summaryappend("None ") + } } def releasegitadd() { @@ -245,32 +248,26 @@ def sourcegitpush(String dryrunpush ) { } } - -def publish() { +def publish(String customer) { summaryappend(" FTP operations: ") def String FTP_CLIENT_LOCATION='ftp' def String FTP_URL='ie1.hostedftp.com' def String FTP_USER='ftp@globalinkjetsystems.com' - def String FTP_CUSTOMER_ROOT='/Customers/' + def String FTP_CUSTOMER_ROOT="/Customers/${customer}" def String FTP_PASSWORD='ramshorn42' dir(releaserepofolder) { + summaryappend(" FTP operations: Transferring to ${FTP_CUSTOMER_ROOT} ") sh """#!/bin/bash - ftp -n -v ${FTP_URL} << EOT - ascii - user ${FTP_USER} ${FTP_PASSWORD} - prompt - cd ${FTP_CUSTOMER_ROOT} - ls -la - bye - EOT + ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" . """ + summaryappend(", Transferred ") } } -def recallcomponent(releaseinfo, String customer, String softwarerelease) { +def recallcomponent(releaseinfo, String softwarerelease) { def releasemeta = releaseinfo.meta - def String uniquefolder = "${customer}/Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolder = "Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -292,9 +289,9 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin // For each component for (key in componentReleaseInfo.keySet()) { def releaseinfo = componentReleaseInfo[key] - recallcomponent(releaseinfo, customer, softwarerelease) + recallcomponent(releaseinfo, softwarerelease) } - publish() + publish(customer) return [summarystring, markunstable, unstablereason] } From 8229e666d8769f6b587c489899973c8b337a2c87 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 15:59:04 +0000 Subject: [PATCH 0632/1971] Use ncftpput to transfer --- publish/do.groovy | 200 +++------------------------------------------- 1 file changed, 10 insertions(+), 190 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 13a280a..8cdf9a3 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -5,12 +5,7 @@ summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" summarystring = "" releaserepofolder = "${WORKSPACE}/releaserepos" -sourcerepofolder = "${WORKSPACE}/sourcerepos" tempfolder = "${WORKSPACE}/temp" -gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" - -metascript = autobuilder.getmetafolderscript() -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def resetfolders() { dir(summaryfolder) { @@ -42,54 +37,7 @@ def summaryappend(String summary) { summarystring += 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 - def previousreleasemeta = buildmeta.getNewMetaObject(this) - dir(releaserepofolder) { - sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") - } - previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) - dir(checkoutfolder) { - // Clear all existing files - sh("git rm -r *") - } - return previousreleasemeta -} - -def checkoutsourcerepo(buildmeta, String checkoutfolder) { - def String sourcerepo = buildmeta.gitinfo.remoteurl - // 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}") - } - } -} - +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") @@ -111,143 +59,6 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { } } -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 changed = (buildsha != previoussha) - echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" - return changed -} - -def ArrayList maketaglist(String buildstamp, String otherreleasetags) { - def ArrayList taglist = new ArrayList() - taglist.add(buildstamp) - - def ArrayList othertaglist = otherreleasetags.split(',') - for (othertagitem in othertaglist) { - if (othertagitem?.trim()) { - taglist.add(othertagitem.trim()) - } - } - return taglist -} - -def boolean releasegittag(String postcommitshacode, 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 != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") - 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") - 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 ) { - 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 ) { - 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 publish(String customer) { summaryappend(" FTP operations: ") @@ -278,6 +89,14 @@ def recallcomponent(releaseinfo, String softwarerelease) { summaryappend("\n") } +def stripgithistory() { + dir(releaserepofolder) { + sh """#!/bin/bash + ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf + """ + } +} + def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) { int md = maxdepth.toInteger() resetfolders() @@ -291,6 +110,7 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin def releaseinfo = componentReleaseInfo[key] recallcomponent(releaseinfo, softwarerelease) } + stripgithistory() publish(customer) return [summarystring, markunstable, unstablereason] From e06d3705497981903880f07cb750004a800e5669 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 15:59:04 +0000 Subject: [PATCH 0633/1971] Use ncftpput to transfer --- publish/do.groovy | 200 +++------------------------------------------- 1 file changed, 10 insertions(+), 190 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 13a280a..8cdf9a3 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -5,12 +5,7 @@ summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" summarystring = "" releaserepofolder = "${WORKSPACE}/releaserepos" -sourcerepofolder = "${WORKSPACE}/sourcerepos" tempfolder = "${WORKSPACE}/temp" -gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" - -metascript = autobuilder.getmetafolderscript() -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def resetfolders() { dir(summaryfolder) { @@ -42,54 +37,7 @@ def summaryappend(String summary) { summarystring += 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 - def previousreleasemeta = buildmeta.getNewMetaObject(this) - dir(releaserepofolder) { - sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") - } - previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) - dir(checkoutfolder) { - // Clear all existing files - sh("git rm -r *") - } - return previousreleasemeta -} - -def checkoutsourcerepo(buildmeta, String checkoutfolder) { - def String sourcerepo = buildmeta.gitinfo.remoteurl - // 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}") - } - } -} - +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") @@ -111,143 +59,6 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { } } -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 changed = (buildsha != previoussha) - echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" - return changed -} - -def ArrayList maketaglist(String buildstamp, String otherreleasetags) { - def ArrayList taglist = new ArrayList() - taglist.add(buildstamp) - - def ArrayList othertaglist = otherreleasetags.split(',') - for (othertagitem in othertaglist) { - if (othertagitem?.trim()) { - taglist.add(othertagitem.trim()) - } - } - return taglist -} - -def boolean releasegittag(String postcommitshacode, 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 != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") - 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") - 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 ) { - 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 ) { - 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 publish(String customer) { summaryappend(" FTP operations: ") @@ -278,6 +89,14 @@ def recallcomponent(releaseinfo, String softwarerelease) { summaryappend("\n") } +def stripgithistory() { + dir(releaserepofolder) { + sh """#!/bin/bash + ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf + """ + } +} + def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) { int md = maxdepth.toInteger() resetfolders() @@ -291,6 +110,7 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin def releaseinfo = componentReleaseInfo[key] recallcomponent(releaseinfo, softwarerelease) } + stripgithistory() publish(customer) return [summarystring, markunstable, unstablereason] From 9a8a0b0c10505a9ae02007a0de8bc8cf6dd4ff10 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 16:01:13 +0000 Subject: [PATCH 0634/1971] Use ncftpput to transfer --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 8cdf9a3..34d0e42 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -68,7 +68,7 @@ def publish(String customer) { def String FTP_CUSTOMER_ROOT="/Customers/${customer}" def String FTP_PASSWORD='ramshorn42' dir(releaserepofolder) { - summaryappend(" FTP operations: Transferring to ${FTP_CUSTOMER_ROOT} ") + summaryappend("FTP operations: Transferring to ${FTP_CUSTOMER_ROOT}") sh """#!/bin/bash ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" . """ From 8ba5a2c59a7407c8d993bd343793818953edbc7c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 16:01:13 +0000 Subject: [PATCH 0635/1971] Use ncftpput to transfer --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 8cdf9a3..34d0e42 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -68,7 +68,7 @@ def publish(String customer) { def String FTP_CUSTOMER_ROOT="/Customers/${customer}" def String FTP_PASSWORD='ramshorn42' dir(releaserepofolder) { - summaryappend(" FTP operations: Transferring to ${FTP_CUSTOMER_ROOT} ") + summaryappend("FTP operations: Transferring to ${FTP_CUSTOMER_ROOT}") sh """#!/bin/bash ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" . """ From cf977356fc885ec7e011a437dbe8e7fdbdb7de58 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 18:12:45 +0000 Subject: [PATCH 0636/1971] Use ncftpput to transfer --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 34d0e42..a30bfc9 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -92,7 +92,7 @@ def recallcomponent(releaseinfo, String softwarerelease) { def stripgithistory() { dir(releaserepofolder) { sh """#!/bin/bash - ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf + ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" && find . -iname ".gitattributes") | xargs rm -rvf """ } } From 08e458d9d633bfca42d0dd39bb5e549066a6b277 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 18:12:45 +0000 Subject: [PATCH 0637/1971] Use ncftpput to transfer --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 34d0e42..a30bfc9 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -92,7 +92,7 @@ def recallcomponent(releaseinfo, String softwarerelease) { def stripgithistory() { dir(releaserepofolder) { sh """#!/bin/bash - ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf + ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" && find . -iname ".gitattributes") | xargs rm -rvf """ } } From 04cc212c89e0ae6f33c75d0e870fbdae5dc6785e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 18:53:08 +0000 Subject: [PATCH 0638/1971] Revision number needs to be altered if a job imports a dependent component; Make sure imports happen after the initial revision number is calculated --- artifacts/metaexport.groovy | 8 ++------ import/importer.groovy | 10 ++++++++-- versionnumbering/generate.groovy | 5 +++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index b4d4a6d..0ca5da7 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -4,7 +4,6 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def ArrayList artifactFolders = new ArrayList() - int revisiontotal = 0 for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { @@ -14,14 +13,11 @@ def combineSubjobArtifacts(meta, subJobs) { dir(destFolder) { deleteDir() } - importedmeta = importer.artifactimport(meta, subJobName, subJobNumber, destFolder) - revisiontotal += importedmeta.buildstampinfo.revision + importer.artifactimport(meta, subJobName, subJobNumber, destFolder) artifactFolders.add("${destFolder}/**") } } - def versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - revisiontotal = revisiontotal % (versiongenerator.maxversionnumber() + 1) - return [artifactFolders, revisiontotal] + return artifactFolders } return this; diff --git a/import/importer.groovy b/import/importer.groovy index 4d24d30..081226a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,4 +1,6 @@ +versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', boolean fingerprint = false) { copyArtifacts( filter: filter, @@ -7,7 +9,9 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, St selector: specific(buildnumber.toString()), target: destpath ) - return meta.importrelated(destpath) + def importedmeta = meta.importrelated(destpath) + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + return importedmeta } def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { @@ -21,7 +25,9 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat ], target: destpath ) - return meta.importrelated(destpath) + def importedmeta = meta.importrelated(destpath) + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + return importedmeta } return this; diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index ae7e5f4..e73782f 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -136,4 +136,9 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum return buildstamp } +int incrementrevision(int current, int increment) { + def int newrevision = (current + increment) % (maxversionnumber() + 1) + return newrevision +} + return this; \ No newline at end of file From 64a6b177de8bce34c2a37982ec5305bd62be2d96 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 18:53:08 +0000 Subject: [PATCH 0639/1971] Revision number needs to be altered if a job imports a dependent component; Make sure imports happen after the initial revision number is calculated --- artifacts/metaexport.groovy | 8 ++------ import/importer.groovy | 10 ++++++++-- versionnumbering/generate.groovy | 5 +++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index b4d4a6d..0ca5da7 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -4,7 +4,6 @@ def combineSubjobArtifacts(meta, subJobs) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def ArrayList artifactFolders = new ArrayList() - int revisiontotal = 0 for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { @@ -14,14 +13,11 @@ def combineSubjobArtifacts(meta, subJobs) { dir(destFolder) { deleteDir() } - importedmeta = importer.artifactimport(meta, subJobName, subJobNumber, destFolder) - revisiontotal += importedmeta.buildstampinfo.revision + importer.artifactimport(meta, subJobName, subJobNumber, destFolder) artifactFolders.add("${destFolder}/**") } } - def versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - revisiontotal = revisiontotal % (versiongenerator.maxversionnumber() + 1) - return [artifactFolders, revisiontotal] + return artifactFolders } return this; diff --git a/import/importer.groovy b/import/importer.groovy index 4d24d30..081226a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,4 +1,6 @@ +versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', boolean fingerprint = false) { copyArtifacts( filter: filter, @@ -7,7 +9,9 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, St selector: specific(buildnumber.toString()), target: destpath ) - return meta.importrelated(destpath) + def importedmeta = meta.importrelated(destpath) + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + return importedmeta } def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', boolean fingerprint = false) { @@ -21,7 +25,9 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat ], target: destpath ) - return meta.importrelated(destpath) + def importedmeta = meta.importrelated(destpath) + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + return importedmeta } return this; diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index ae7e5f4..e73782f 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -136,4 +136,9 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum return buildstamp } +int incrementrevision(int current, int increment) { + def int newrevision = (current + increment) % (maxversionnumber() + 1) + return newrevision +} + return this; \ No newline at end of file From bac7536940e8b6149c161038813c84b13798953e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 21:25:38 +0000 Subject: [PATCH 0640/1971] Revision number needs to be altered if a job imports a dependent component; Make sure imports happen after the initial revision number is calculated --- versionnumbering/generate.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index e73782f..7e5568a 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -138,6 +138,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum int incrementrevision(int current, int increment) { def int newrevision = (current + increment) % (maxversionnumber() + 1) + echo "Current revision: ${current} Increment: ${increment} New revision: ${newrevision}" return newrevision } From e3bf9774ede490241fd0840e834e5230e4c9dc4d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Dec 2018 21:25:38 +0000 Subject: [PATCH 0641/1971] Revision number needs to be altered if a job imports a dependent component; Make sure imports happen after the initial revision number is calculated --- versionnumbering/generate.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index e73782f..7e5568a 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -138,6 +138,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum int incrementrevision(int current, int increment) { def int newrevision = (current + increment) % (maxversionnumber() + 1) + echo "Current revision: ${current} Increment: ${increment} New revision: ${newrevision}" return newrevision } From b73e5fd49fccefcd2b7922bce6cfd53ebe57edfb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 11:14:13 +0000 Subject: [PATCH 0642/1971] Remove .git files/folders before publishing --- publish/do.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index a30bfc9..91f3b3e 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -90,9 +90,14 @@ def recallcomponent(releaseinfo, String softwarerelease) { } def stripgithistory() { + echo "Stripping git history out of ${releaserepo}" dir(releaserepofolder) { sh """#!/bin/bash - ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" && find . -iname ".gitattributes") | xargs rm -rvf + pwd + find . -type d -name ".git" | xargs rm -rvf + find . -name ".gitignore" | xargs rm -rvf + find . -name ".gitmodules" | xargs rm -rvf + find . -iname ".gitattributes" | xargs rm -rvf """ } } From 2dbfbdab472fc59f27e233fb3f9fdf5759a99278 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 11:14:13 +0000 Subject: [PATCH 0643/1971] Remove .git files/folders before publishing --- publish/do.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index a30bfc9..91f3b3e 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -90,9 +90,14 @@ def recallcomponent(releaseinfo, String softwarerelease) { } def stripgithistory() { + echo "Stripping git history out of ${releaserepo}" dir(releaserepofolder) { sh """#!/bin/bash - ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" && find . -iname ".gitattributes") | xargs rm -rvf + pwd + find . -type d -name ".git" | xargs rm -rvf + find . -name ".gitignore" | xargs rm -rvf + find . -name ".gitmodules" | xargs rm -rvf + find . -iname ".gitattributes" | xargs rm -rvf """ } } From 517610eeab92a6d54cdb9ef1aa55a0afd1b9c602 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 11:29:40 +0000 Subject: [PATCH 0644/1971] Remove .git files/folders before publishing --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 91f3b3e..ec9b53f 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -90,7 +90,7 @@ def recallcomponent(releaseinfo, String softwarerelease) { } def stripgithistory() { - echo "Stripping git history out of ${releaserepo}" + echo "Stripping git history out of ${releaserepofolder}" dir(releaserepofolder) { sh """#!/bin/bash pwd From 6ac6396c6f7ffeac25f73b7c8344d561b81e859d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 11:29:40 +0000 Subject: [PATCH 0645/1971] Remove .git files/folders before publishing --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 91f3b3e..ec9b53f 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -90,7 +90,7 @@ def recallcomponent(releaseinfo, String softwarerelease) { } def stripgithistory() { - echo "Stripping git history out of ${releaserepo}" + echo "Stripping git history out of ${releaserepofolder}" dir(releaserepofolder) { sh """#!/bin/bash pwd From f003a641ab95843999adc8ddcdc1020aa051b144 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 14:01:09 +0000 Subject: [PATCH 0646/1971] Releasing to git was relying on the source code sha changing only; However it needs to take into account that a dependent component revision number changed too --- release/do.groovy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 169c292..85753e6 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -140,8 +140,18 @@ def boolean checkforchange(buildmeta, previousreleasemeta) { String buildsha = buildmeta.gitinfo.gitrevision String previoussha = previousreleasemeta.gitinfo.gitrevision - def boolean changed = (buildsha != previoussha) - echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" + 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 } From 7a4c46d342ac3671f42d2077be48d0bbf21176ce Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 14:01:09 +0000 Subject: [PATCH 0647/1971] Releasing to git was relying on the source code sha changing only; However it needs to take into account that a dependent component revision number changed too --- release/do.groovy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 169c292..85753e6 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -140,8 +140,18 @@ def boolean checkforchange(buildmeta, previousreleasemeta) { String buildsha = buildmeta.gitinfo.gitrevision String previoussha = previousreleasemeta.gitinfo.gitrevision - def boolean changed = (buildsha != previoussha) - echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" + 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 } From 30ef4a61b2be74b7b610b107ce7dab05f89d2674 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 15:20:25 +0000 Subject: [PATCH 0648/1971] Remove .git detritus from published folders --- publish/do.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index ec9b53f..e280c0c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -94,10 +94,10 @@ def stripgithistory() { dir(releaserepofolder) { sh """#!/bin/bash pwd - find . -type d -name ".git" | xargs rm -rvf - find . -name ".gitignore" | xargs rm -rvf - find . -name ".gitmodules" | xargs rm -rvf - find . -iname ".gitattributes" | xargs rm -rvf + find . -type d -name ".git" | xargs -iXX rm -rvf XX + find . -name ".gitignore" | xargs -iXX rm -rvf XX + find . -name ".gitmodules" | xargs -iXX rm -rvf XX + find . -iname ".gitattributes" | xargs -iXX rm -rvf XX """ } } From ca914eebd209abcefaca8ffbbd1f21847e9de156 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 15:20:25 +0000 Subject: [PATCH 0649/1971] Remove .git detritus from published folders --- publish/do.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index ec9b53f..e280c0c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -94,10 +94,10 @@ def stripgithistory() { dir(releaserepofolder) { sh """#!/bin/bash pwd - find . -type d -name ".git" | xargs rm -rvf - find . -name ".gitignore" | xargs rm -rvf - find . -name ".gitmodules" | xargs rm -rvf - find . -iname ".gitattributes" | xargs rm -rvf + find . -type d -name ".git" | xargs -iXX rm -rvf XX + find . -name ".gitignore" | xargs -iXX rm -rvf XX + find . -name ".gitmodules" | xargs -iXX rm -rvf XX + find . -iname ".gitattributes" | xargs -iXX rm -rvf XX """ } } From 670bea0d2ccf2e2c38c348c7e4c6100923eaafa7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 15:22:15 +0000 Subject: [PATCH 0650/1971] Move product agnostic scripts into common subtree area --- publish/publish.groovy | 90 ++++++++++++++++++++++++++++++++++++++++++ release/release.groovy | 87 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 publish/publish.groovy create mode 100644 release/release.groovy diff --git a/publish/publish.groovy b/publish/publish.groovy new file mode 100644 index 0000000..8ed7aa8 --- /dev/null +++ b/publish/publish.groovy @@ -0,0 +1,90 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, 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") + MAX_META_DEPTH='2' + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, 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/release/release.groovy b/release/release.groovy new file mode 100644 index 0000000..828f1ff --- /dev/null +++ b/release/release.groovy @@ -0,0 +1,87 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, 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") + (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' + } + } +} + From 5a1a55aa35a0b9d2a4fae58c9c3143947aa65e68 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 15:22:15 +0000 Subject: [PATCH 0651/1971] Move product agnostic scripts into common subtree area --- publish/publish.groovy | 90 ++++++++++++++++++++++++++++++++++++++++++ release/release.groovy | 87 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 publish/publish.groovy create mode 100644 release/release.groovy diff --git a/publish/publish.groovy b/publish/publish.groovy new file mode 100644 index 0000000..8ed7aa8 --- /dev/null +++ b/publish/publish.groovy @@ -0,0 +1,90 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, 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") + MAX_META_DEPTH='2' + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, 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/release/release.groovy b/release/release.groovy new file mode 100644 index 0000000..828f1ff --- /dev/null +++ b/release/release.groovy @@ -0,0 +1,87 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, 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") + (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' + } + } +} + From fa3cc37a4d9ec6c79c55aaa09e2772aea9065977 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 12 Dec 2018 16:47:07 +0000 Subject: [PATCH 0652/1971] Post subtree pull corrections --- publish/do.groovy | 7 +++- publish/publish.groovy | 90 ++++++++++++++++++++++++++++++++++++++++++ release/do.groovy | 14 ++++++- release/release.groovy | 87 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 195 insertions(+), 3 deletions(-) create mode 100644 publish/publish.groovy create mode 100644 release/release.groovy diff --git a/publish/do.groovy b/publish/do.groovy index a30bfc9..e280c0c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -90,9 +90,14 @@ def recallcomponent(releaseinfo, String softwarerelease) { } def stripgithistory() { + echo "Stripping git history out of ${releaserepofolder}" dir(releaserepofolder) { sh """#!/bin/bash - ( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" && find . -iname ".gitattributes") | xargs rm -rvf + pwd + find . -type d -name ".git" | xargs -iXX rm -rvf XX + find . -name ".gitignore" | xargs -iXX rm -rvf XX + find . -name ".gitmodules" | xargs -iXX rm -rvf XX + find . -iname ".gitattributes" | xargs -iXX rm -rvf XX """ } } diff --git a/publish/publish.groovy b/publish/publish.groovy new file mode 100644 index 0000000..8ed7aa8 --- /dev/null +++ b/publish/publish.groovy @@ -0,0 +1,90 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, 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") + MAX_META_DEPTH='2' + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, 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/release/do.groovy b/release/do.groovy index 169c292..85753e6 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -140,8 +140,18 @@ def boolean checkforchange(buildmeta, previousreleasemeta) { String buildsha = buildmeta.gitinfo.gitrevision String previoussha = previousreleasemeta.gitinfo.gitrevision - def boolean changed = (buildsha != previoussha) - echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${changed}" + 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 } diff --git a/release/release.groovy b/release/release.groovy new file mode 100644 index 0000000..828f1ff --- /dev/null +++ b/release/release.groovy @@ -0,0 +1,87 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, 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") + (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' + } + } +} + From d7c5d334283d9efc54c8547104431e911df39862 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Dec 2018 17:49:02 +0000 Subject: [PATCH 0653/1971] Remove redundant common_scripts --- file/utils.groovy | 16 --- versionnumbering/versioninfo.py | 180 -------------------------------- 2 files changed, 196 deletions(-) delete mode 100644 file/utils.groovy delete mode 100644 versionnumbering/versioninfo.py diff --git a/file/utils.groovy b/file/utils.groovy deleted file mode 100644 index 0ffa47c..0000000 --- a/file/utils.groovy +++ /dev/null @@ -1,16 +0,0 @@ - -def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") - -// Get current contents of given file and optionally add a newline string/character; If file doesn't exist, return default contents -def currentContents(file, newline = "${nl}", defaultContents = "") { - def contents = "" - if (fileExists("${file}")) { - contents = readFile(file: "${file}").trim() + newline - } - else { - contents = defaultContents - } - return contents -} - -return this; diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py deleted file mode 100644 index 3d2a80d..0000000 --- a/versionnumbering/versioninfo.py +++ /dev/null @@ -1,180 +0,0 @@ -# encoding: utf-8 -''' -versionnumbering -- shortdesc - -versionnumbering generates a version folder with a common set of version information files in it - -@author: dan - -@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. -''' -import os -import sys -import shutil -import subprocess -import re -import datetime - -from argparse import ArgumentParser -from argparse import RawDescriptionHelpFormatter - -__all__ = [] -__version__ = 0.1 -__date__ = '2017-11-29' -__updated__ = '2017-11-29' - -# Handle: -# origin/master -# origin/2.0.x -def getVersionPrefix(sourcebranch): - print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) - - defaultversionprefix = "1.30000.0." - mastertypeversionprefix = "1.20000.0." - thirdpartyversionprefix = "1.25000.0." - splits = sourcebranch.split('/') - if len(splits) < 1: - print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) - return defaultversionprefix - - sourcebranch = splits[-1] - - if sourcebranch.lower().find("master") != -1: # Special case - return mastertypeversionprefix - - splits2 = re.split(r'(\d+)', sourcebranch) - splits = [] - hasdot = False - for split in splits2: - if split.isdigit(): - splits.append(split) - if split == ".": - hasdot = True - - if not hasdot: - print("Source branch name has not dots in it (eg. 1.9.2). Defaulting to: {0}".format(thirdpartyversionprefix)) - return thirdpartyversionprefix - - versionprefix = "" - if len(splits) < 1: - print("This source branch name has no numbers in its name so defaulting to: {0}".format(defaultversionprefix)) - versionprefix = defaultversionprefix - else: - splitnumbercount = 0 - isIntermediateReleaseBranch = False - for split in splits: - if split.isdigit(): - versionprefix += split + "." - splitnumbercount += 1 - else: - if split == "x": - isIntermediateReleaseBranch = True - break - if splitnumbercount > 2: - break - if splitnumbercount == 0: - print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) - versionprefix = defaultversionprefix - else: - if isIntermediateReleaseBranch: - versionprefix = mastertypeversionprefix - elif splitnumbercount == 1: - versionprefix += "0.0." - elif splitnumbercount == 2: - versionprefix += "0." - - print("Determined version prefix to be: {0}".format(versionprefix)) - return versionprefix - -def writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp): - with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: - f.write(versionprefix) - - with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: - f.write(str(gitrevisioncount)) - - with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: - f.write(gitrevision) - - with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: - f.write(remoteinfo) - - with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: - f.write(remoteurl) - - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: - f.write(buildstamp) - - buildstampcommasep = buildstamp.replace(".", ",") - with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: - f.write(buildstampcommasep) - - with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: - f.write(str(datetime.datetime.now())) - -def main(argv=None): # IGNORE:C0111 - '''Command line options.''' - - if argv is None: - argv = sys.argv - else: - sys.argv.extend(argv) - - program_name = os.path.basename(sys.argv[0]) - program_version = "v%s" % __version__ - program_build_date = str(__updated__) - program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) - program_shortdesc = __import__('__main__').__doc__.split("\n")[1] - program_license = '''%s - - Created by dan on %s. - Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. - - Distributed on an "AS IS" basis without warranties - or conditions of any kind, either express or implied. - -USAGE -''' % (program_shortdesc, str(__date__)) - - try: - # Setup argument parser - parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) - parser.add_argument("-s", "--sourcebranch", dest="sourcebranch", action="store", default="origin/master", help="source branch name to discover version number [default: %(default)s]") - parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") - parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") - parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") - - # Process arguments - args = parser.parse_args() - - try: - sourcebranch = args.sourcebranch - versionfolder = args.versionfolder - gitrootfolder = args.gitrootfolder - baseversionnumber = args.baseversionnumber - - print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) - print("Base version number:", baseversionnumber) - - (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(gitrootfolder, baseversionnumber) - - versionprefix = getVersionPrefix(sourcebranch) - - buildstamp = versionprefix + str(gitrevisioncount) - print("Build stamp is: {0}".format(buildstamp)) - - writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp) - - return 0 - except Exception as e: - print("Error while creating version info:", e.__repr__()) - return 1 - - except Exception as e: - indent = len(program_name) * " " - print(program_name + ": " + repr(e) + "\n") - print(indent + " for help use --help") - return 2 - -if __name__ == "__main__": - sys.exit(main()) From e00d396c2b5dab238d2b0bff57abf0a1d0a0c082 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Dec 2018 17:49:02 +0000 Subject: [PATCH 0654/1971] Remove redundant common_scripts --- file/utils.groovy | 16 --- versionnumbering/versioninfo.py | 180 -------------------------------- 2 files changed, 196 deletions(-) delete mode 100644 file/utils.groovy delete mode 100644 versionnumbering/versioninfo.py diff --git a/file/utils.groovy b/file/utils.groovy deleted file mode 100644 index 0ffa47c..0000000 --- a/file/utils.groovy +++ /dev/null @@ -1,16 +0,0 @@ - -def lineendings = load("${autobuilder.commonscripts()}/platform/lineendings.groovy") - -// Get current contents of given file and optionally add a newline string/character; If file doesn't exist, return default contents -def currentContents(file, newline = "${nl}", defaultContents = "") { - def contents = "" - if (fileExists("${file}")) { - contents = readFile(file: "${file}").trim() + newline - } - else { - contents = defaultContents - } - return contents -} - -return this; diff --git a/versionnumbering/versioninfo.py b/versionnumbering/versioninfo.py deleted file mode 100644 index 3d2a80d..0000000 --- a/versionnumbering/versioninfo.py +++ /dev/null @@ -1,180 +0,0 @@ -# encoding: utf-8 -''' -versionnumbering -- shortdesc - -versionnumbering generates a version folder with a common set of version information files in it - -@author: dan - -@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. -''' -import os -import sys -import shutil -import subprocess -import re -import datetime - -from argparse import ArgumentParser -from argparse import RawDescriptionHelpFormatter - -__all__ = [] -__version__ = 0.1 -__date__ = '2017-11-29' -__updated__ = '2017-11-29' - -# Handle: -# origin/master -# origin/2.0.x -def getVersionPrefix(sourcebranch): - print("Determining version number prefix from source branch name: {0}".format(sourcebranch)) - - defaultversionprefix = "1.30000.0." - mastertypeversionprefix = "1.20000.0." - thirdpartyversionprefix = "1.25000.0." - splits = sourcebranch.split('/') - if len(splits) < 1: - print("Source branch name is invalid. Defaulting to: {0}".format(defaultversionprefix)) - return defaultversionprefix - - sourcebranch = splits[-1] - - if sourcebranch.lower().find("master") != -1: # Special case - return mastertypeversionprefix - - splits2 = re.split(r'(\d+)', sourcebranch) - splits = [] - hasdot = False - for split in splits2: - if split.isdigit(): - splits.append(split) - if split == ".": - hasdot = True - - if not hasdot: - print("Source branch name has not dots in it (eg. 1.9.2). Defaulting to: {0}".format(thirdpartyversionprefix)) - return thirdpartyversionprefix - - versionprefix = "" - if len(splits) < 1: - print("This source branch name has no numbers in its name so defaulting to: {0}".format(defaultversionprefix)) - versionprefix = defaultversionprefix - else: - splitnumbercount = 0 - isIntermediateReleaseBranch = False - for split in splits: - if split.isdigit(): - versionprefix += split + "." - splitnumbercount += 1 - else: - if split == "x": - isIntermediateReleaseBranch = True - break - if splitnumbercount > 2: - break - if splitnumbercount == 0: - print("No leading numbers were found in source branch name so defaulting to: {0}".format(defaultversionprefix)) - versionprefix = defaultversionprefix - else: - if isIntermediateReleaseBranch: - versionprefix = mastertypeversionprefix - elif splitnumbercount == 1: - versionprefix += "0.0." - elif splitnumbercount == 2: - versionprefix += "0." - - print("Determined version prefix to be: {0}".format(versionprefix)) - return versionprefix - -def writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp): - with open(os.path.join(versionfolder, "prefix.txt"), 'w') as f: - f.write(versionprefix) - - with open(os.path.join(versionfolder, "revision.txt"), 'w') as f: - f.write(str(gitrevisioncount)) - - with open(os.path.join(versionfolder, "gitrevision.txt"), 'w') as f: - f.write(gitrevision) - - with open(os.path.join(versionfolder, "remoteinfo.txt"), 'w') as f: - f.write(remoteinfo) - - with open(os.path.join(versionfolder, "remoteurl.txt"), 'w') as f: - f.write(remoteurl) - - with open(os.path.join(versionfolder, "buildstamp.txt"), 'w') as f: - f.write(buildstamp) - - buildstampcommasep = buildstamp.replace(".", ",") - with open(os.path.join(versionfolder, "buildstampcommasep.txt"), 'w') as f: - f.write(buildstampcommasep) - - with open(os.path.join(versionfolder, "builddate.txt"), 'w') as f: - f.write(str(datetime.datetime.now())) - -def main(argv=None): # IGNORE:C0111 - '''Command line options.''' - - if argv is None: - argv = sys.argv - else: - sys.argv.extend(argv) - - program_name = os.path.basename(sys.argv[0]) - program_version = "v%s" % __version__ - program_build_date = str(__updated__) - program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) - program_shortdesc = __import__('__main__').__doc__.split("\n")[1] - program_license = '''%s - - Created by dan on %s. - Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. - - Distributed on an "AS IS" basis without warranties - or conditions of any kind, either express or implied. - -USAGE -''' % (program_shortdesc, str(__date__)) - - try: - # Setup argument parser - parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) - parser.add_argument("-s", "--sourcebranch", dest="sourcebranch", action="store", default="origin/master", help="source branch name to discover version number [default: %(default)s]") - parser.add_argument("-v", "--versionfolder", dest="versionfolder", action="store", default="version", help="version folder to be created [default: %(default)s]") - parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") - parser.add_argument("-b", "--baseversionnumber", dest="baseversionnumber", action="store", default=int(1000), help="base git version number [default: %(default)s]") - - # Process arguments - args = parser.parse_args() - - try: - sourcebranch = args.sourcebranch - versionfolder = args.versionfolder - gitrootfolder = args.gitrootfolder - baseversionnumber = args.baseversionnumber - - print("Source branch:", sourcebranch, "version folder:", versionfolder, "Git root:", gitrootfolder) - print("Base version number:", baseversionnumber) - - (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(gitrootfolder, baseversionnumber) - - versionprefix = getVersionPrefix(sourcebranch) - - buildstamp = versionprefix + str(gitrevisioncount) - print("Build stamp is: {0}".format(buildstamp)) - - writeversionfiles(versionfolder, versionprefix, gitrevisioncount, gitrevision, remoteinfo, remoteurl, buildstamp) - - return 0 - except Exception as e: - print("Error while creating version info:", e.__repr__()) - return 1 - - except Exception as e: - indent = len(program_name) * " " - print(program_name + ": " + repr(e) + "\n") - print(indent + " for help use --help") - return 2 - -if __name__ == "__main__": - sys.exit(main()) From 06c24df1afce0afef39cc46011715c3dc035493d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Dec 2018 18:00:34 +0000 Subject: [PATCH 0655/1971] Remove compile retries --- compile/eclipsebuild/eclipseds5build.groovy | 52 ++++++++++----------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 93a8064..cf382b1 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -142,39 +142,35 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou buildtype = "-build" } for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ - } + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ } - result = doExport(exportfolder, exportpathlist, "", build_variant) - if (result != 0) { - error "Failed to copy...." + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ } } - else { - echo "Not building ${build_variant} variant of project: ${project}" + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." } - } catch (Exception e) { - echo "Build failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." } + else { + echo "Not building ${build_variant} variant of project: ${project}" + } + } catch (Exception e) { + error "Build failed..." } } } From 1eba3bf0162fead6284b53e63647c2f2456326d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Dec 2018 18:00:34 +0000 Subject: [PATCH 0656/1971] Remove compile retries --- compile/eclipsebuild/eclipseds5build.groovy | 52 ++++++++++----------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 93a8064..cf382b1 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -142,39 +142,35 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou buildtype = "-build" } for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ - } + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ } - result = doExport(exportfolder, exportpathlist, "", build_variant) - if (result != 0) { - error "Failed to copy...." + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ } } - else { - echo "Not building ${build_variant} variant of project: ${project}" + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." } - } catch (Exception e) { - echo "Build failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." } + else { + echo "Not building ${build_variant} variant of project: ${project}" + } + } catch (Exception e) { + error "Build failed..." } } } From 8ae90886986d45e2261d7a1674737241b85298a5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 11:38:54 +0000 Subject: [PATCH 0657/1971] Fixing version stamping in windows --- versionnumbering/do.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index 9b4a42e..0c53ce9 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -1,17 +1,20 @@ def stamp(convertdetails) { for (convertdetail in convertdetails) { - filetoconvert = convertdetail[0] - pattern = convertdetail[1] - replacement = convertdetail[2] + 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 "${autobuilder.commonscripts()}/versionstamping/versionstamper.py" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ } else { bat """ - "%${PYTHON}%" -u "%${autobuilder.commonscripts()}%\\versionstamping\\versionstamper.py" -f "%${filetoconvert}%" -p "%${pattern}%" -s "%${replacement}%" + "%${PYTHON}%" -u "%${stampscript}%" -f "%${filetoconvert}%" -p "%${pattern}%" -s "%${replacement}%" """ } } From fc461ba62b9caf0e2f7d1c8215f7aa309ee45a4f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 11:46:44 +0000 Subject: [PATCH 0658/1971] Fixing version stamping in windows --- versionnumbering/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index 0c53ce9..9f45f70 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -14,7 +14,7 @@ def stamp(convertdetails) { } else { bat """ - "%${PYTHON}%" -u "%${stampscript}%" -f "%${filetoconvert}%" -p "%${pattern}%" -s "%${replacement}%" + "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ } } From 7bd8655a9224716056a3ec25beed4d4ba97ad6b3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 11:59:26 +0000 Subject: [PATCH 0659/1971] Fixing version stamping in windows --- versionnumbering/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index 9f45f70..666aee3 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -4,9 +4,9 @@ def stamp(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}" + //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}" + //echo "Using python: ${PYTHON} and script: ${stampscript}" if (isUnix()) { sh """ "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" From e77d7391cfabb14f5cd0872ade82a52edf0c4106 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 12:05:47 +0000 Subject: [PATCH 0660/1971] Revert "Remove compile retries" This reverts commit 90ee2b5c1c5c2bcf13af8d3c501114f41b3d8181. --- compile/eclipsebuild/eclipseds5build.groovy | 52 +++++++++++---------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index cf382b1..93a8064 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -142,35 +142,39 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou buildtype = "-build" } for (build_variant in variants) { - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ + } } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." } } - result = doExport(exportfolder, exportpathlist, "", build_variant) - if (result != 0) { - error "Failed to copy...." + else { + echo "Not building ${build_variant} variant of project: ${project}" } + } catch (Exception e) { + echo "Build failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." } - else { - echo "Not building ${build_variant} variant of project: ${project}" - } - } catch (Exception e) { - error "Build failed..." } } } From 93ef7dfcf78b80b3eb033320caa9494a0052cb33 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 12:05:47 +0000 Subject: [PATCH 0661/1971] Revert "Remove compile retries" This reverts commit 90ee2b5c1c5c2bcf13af8d3c501114f41b3d8181. --- compile/eclipsebuild/eclipseds5build.groovy | 52 +++++++++++---------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index cf382b1..93a8064 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -142,35 +142,39 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou buildtype = "-build" } for (build_variant in variants) { - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' - echo End time: `date` - """ + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + """ + } } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" - """ + result = doExport(exportfolder, exportpathlist, "", build_variant) + if (result != 0) { + error "Failed to copy...." } } - result = doExport(exportfolder, exportpathlist, "", build_variant) - if (result != 0) { - error "Failed to copy...." + else { + echo "Not building ${build_variant} variant of project: ${project}" } + } catch (Exception e) { + echo "Build failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." } - else { - echo "Not building ${build_variant} variant of project: ${project}" - } - } catch (Exception e) { - error "Build failed..." } } } From 2371eff2e841e448c32bf7c2e84f5023a0b44e19 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 17:24:46 +0000 Subject: [PATCH 0662/1971] Move eclipse nios operation into common area --- compile/eclipsebuild/eclipseniosbuild.groovy | 103 +++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 compile/eclipsebuild/eclipseniosbuild.groovy diff --git a/compile/eclipsebuild/eclipseniosbuild.groovy b/compile/eclipsebuild/eclipseniosbuild.groovy new file mode 100644 index 0000000..18c31d1 --- /dev/null +++ b/compile/eclipsebuild/eclipseniosbuild.groovy @@ -0,0 +1,103 @@ +// Gets the debug and optimization flags. +// Arg1 is "app" or "lib". Returns flags. +// Restore the debug and optimization levels, in case this is a dev machine. +// Arg1 is "app" or "lib". Arg2-3 is flags from getFlags. Returns nothing. +def setFlagsToRelease(NIOSEDS, project, wdir) { + if ( project == "app" ) { + if (isUnix()) { + sh """#!/bin/bash + set -x + cd "${wdir}" + + "${NIOSEDS}/nios2_command_shell.sh" nios2-app-update-makefile --app-dir=. --set-optimization=-O2 --set-debug-level= + """ + } + } + else if ( project == "lib" ) { + if (isUnix()) { + sh """#!/bin/bash + set -x + cd "${wdir}" + + "${NIOSEDS}/nios2_command_shell.sh" nios2-lib-update-makefile --lib-dir=. --set-optimization=-O2 --set-debug-level= + """ + } + } +} + +def remake_and_check(NIOSEDS, wdir) { + if (isUnix()) { + sh """#!/bin/bash + set -x + cd "${wdir}" + + # Use the makefile to clean and build + "${NIOSEDS}/nios2_command_shell.sh" make clean + if [ \$? -ne 0 ]; then exit 1; fi + + # Set the debug and optimization levels to production values + "${NIOSEDS}/nios2_command_shell.sh" make -j12 all + if [ \$? -ne 0 ]; then exit 1; fi + """ + } +} + +def generate_bsp(NIOSEDS, bspfolder) { + if (isUnix()) { + sh """#!/bin/bash + set -x + + "${NIOSEDS}/nios2_command_shell.sh" nios2-bsp-generate-files --bsp-dir "${bspfolder}" --log "${bspfolder}/bsp.log" --settings "${bspfolder}/settings.bsp" + """ + } +} + +def modifylib(NIOSEDS, bspfolder, buildconfig, wdir) { + if (isUnix()) { + sh """#!/bin/bash + set -x + + cd "${wdir}" + + "${NIOSEDS}/nios2_command_shell.sh" nios2-lib-update-makefile --lib-dir=. --set-bsp-dir "${bspfolder}" --set-active-build-config "${buildconfig}" + """ + } +} + +def modifyapp(NIOSEDS, bspfolder, wdir) { + if (isUnix()) { + sh """#!/bin/bash + set -x + + cd "${wdir}" + + "${NIOSEDS}/nios2_command_shell.sh" nios2-app-update-makefile --app-dir=. --set-bsp-dir "${bspfolder}" + """ + } +} + +def dump_elf_info(NIOSEDS, elffile, outputdir) { + sh """#!/bin/bash + set -x + + mkdir -p "${outputdir}" + if [ \$? -ne 0 ]; then exit 1; fi + + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name > "${outputdir}/lower_cpu_name.txt" + if [ \$? -ne 0 ]; then exit 1; fi + + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp > "${outputdir}/lower_sidp.txt" + if [ \$? -ne 0 ]; then exit 1; fi + + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id > "${outputdir}/lower_id.txt" + if [ \$? -ne 0 ]; then exit 1; fi + + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp > "${outputdir}/lower_timestamp.txt" + if [ \$? -ne 0 ]; then exit 1; fi + + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo > "${outputdir}/lower_sopcinfo.txt" + if [ \$? -ne 0 ]; then exit 1; fi + """ +} + +return this; \ No newline at end of file From 5127186c4f974c68c635d82a28ef6d7a80be1ee9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 18:26:50 +0000 Subject: [PATCH 0663/1971] Output version information to meta --- compile/eclipsebuild/eclipseniosbuild.groovy | 55 ++++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/compile/eclipsebuild/eclipseniosbuild.groovy b/compile/eclipsebuild/eclipseniosbuild.groovy index 18c31d1..a3bb4b9 100644 --- a/compile/eclipsebuild/eclipseniosbuild.groovy +++ b/compile/eclipsebuild/eclipseniosbuild.groovy @@ -76,28 +76,39 @@ def modifyapp(NIOSEDS, bspfolder, wdir) { } } -def dump_elf_info(NIOSEDS, elffile, outputdir) { - sh """#!/bin/bash - set -x - - mkdir -p "${outputdir}" - if [ \$? -ne 0 ]; then exit 1; fi - - "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name > "${outputdir}/lower_cpu_name.txt" - if [ \$? -ne 0 ]; then exit 1; fi - - "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp > "${outputdir}/lower_sidp.txt" - if [ \$? -ne 0 ]; then exit 1; fi - - "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id > "${outputdir}/lower_id.txt" - if [ \$? -ne 0 ]; then exit 1; fi - - "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp > "${outputdir}/lower_timestamp.txt" - if [ \$? -ne 0 ]; then exit 1; fi - - "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo > "${outputdir}/lower_sopcinfo.txt" - if [ \$? -ne 0 ]; then exit 1; fi - """ +def dump_elf_info(NIOSEDS, elffile, meta, custominfokeyprefix) { + if (isUnix()) { + def cpu_name = sh(script: """#!/bin/bash + `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name` + """, + returnStdout: true + ) + meta.addCustomInfo("${custominfokeyprefix}_cpu_name", cpu_name) + def sidp = sh(script: """#!/bin/bash + `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp` + """, + returnStdout: true + ) + meta.addCustomInfo("${custominfokeyprefix}_sidp", sidp) + def id = sh(script: """#!/bin/bash + `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id` + """, + returnStdout: true + ) + meta.addCustomInfo("${custominfokeyprefix}_id", id) + def timestamp = sh(script: """#!/bin/bash + `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp` + """, + returnStdout: true + ) + meta.addCustomInfo("${custominfokeyprefix}_timestamp", timestamp) + def sopcinfo = sh(script: """#!/bin/bash + `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo` + """, + returnStdout: true + ) + meta.addCustomInfo("${custominfokeyprefix}_sopcinfo", sopcinfo) + } } return this; \ No newline at end of file From a20fce505017824b40b7185b6ee4127e24a92c75 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 18:33:06 +0000 Subject: [PATCH 0664/1971] Output version information to meta --- compile/eclipsebuild/eclipseniosbuild.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compile/eclipsebuild/eclipseniosbuild.groovy b/compile/eclipsebuild/eclipseniosbuild.groovy index a3bb4b9..ce7d798 100644 --- a/compile/eclipsebuild/eclipseniosbuild.groovy +++ b/compile/eclipsebuild/eclipseniosbuild.groovy @@ -79,31 +79,31 @@ def modifyapp(NIOSEDS, bspfolder, wdir) { def dump_elf_info(NIOSEDS, elffile, meta, custominfokeyprefix) { if (isUnix()) { def cpu_name = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name """, returnStdout: true ) meta.addCustomInfo("${custominfokeyprefix}_cpu_name", cpu_name) def sidp = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp """, returnStdout: true ) meta.addCustomInfo("${custominfokeyprefix}_sidp", sidp) def id = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id """, returnStdout: true ) meta.addCustomInfo("${custominfokeyprefix}_id", id) def timestamp = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp """, returnStdout: true ) meta.addCustomInfo("${custominfokeyprefix}_timestamp", timestamp) def sopcinfo = sh(script: """#!/bin/bash - `"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo` + "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo """, returnStdout: true ) From d1f32dc580e9b5b299fddcc11d0289a780f00b00 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Dec 2018 21:33:59 +0000 Subject: [PATCH 0665/1971] Output version information to meta --- compile/eclipsebuild/eclipseniosbuild.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/compile/eclipsebuild/eclipseniosbuild.groovy b/compile/eclipsebuild/eclipseniosbuild.groovy index ce7d798..a808932 100644 --- a/compile/eclipsebuild/eclipseniosbuild.groovy +++ b/compile/eclipsebuild/eclipseniosbuild.groovy @@ -82,32 +82,34 @@ def dump_elf_info(NIOSEDS, elffile, meta, custominfokeyprefix) { "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name """, returnStdout: true - ) + ).trim() meta.addCustomInfo("${custominfokeyprefix}_cpu_name", cpu_name) def sidp = sh(script: """#!/bin/bash "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp """, returnStdout: true - ) + ).trim() meta.addCustomInfo("${custominfokeyprefix}_sidp", sidp) def id = sh(script: """#!/bin/bash "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id """, returnStdout: true - ) + ).trim() meta.addCustomInfo("${custominfokeyprefix}_id", id) def timestamp = sh(script: """#!/bin/bash "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp """, returnStdout: true - ) + ).trim() meta.addCustomInfo("${custominfokeyprefix}_timestamp", timestamp) +/* def sopcinfo = sh(script: """#!/bin/bash "${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo """, returnStdout: true - ) + ).trim() meta.addCustomInfo("${custominfokeyprefix}_sopcinfo", sopcinfo) +*/ } } From 9fda4bce8b159fcba75abc8cf6a91f3d7d18950e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 18 Dec 2018 13:40:05 +0000 Subject: [PATCH 0666/1971] Turn off fingerprinting --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 0155c7f..093ddef 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -7,7 +7,7 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { def artifactKey = installerDetails.get(installer)[0] (sourceProject, sourceselector, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { - def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, toCopy, notToCopy, true) + def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, toCopy, notToCopy) artifactFetched.put(artifactKey, importmeta) } } From c34da70d948cb5176022e5a0b202bcfe8ddc8cb9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 19 Dec 2018 18:33:17 +0000 Subject: [PATCH 0667/1971] Basebuildnumber is now an external parameter --- versionnumbering/generate.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 7e5568a..f26806d 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -136,6 +136,11 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum return buildstamp } +String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber = "1000") { + def int bbn = basebuildnumber.trim().toInteger() + return generate(meta, String sourcerevision, String sourcepath, bbn) +} + int incrementrevision(int current, int increment) { def int newrevision = (current + increment) % (maxversionnumber() + 1) echo "Current revision: ${current} Increment: ${increment} New revision: ${newrevision}" From c41563f0c216b19902af393136ce2d4cba468f60 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 19 Dec 2018 18:33:17 +0000 Subject: [PATCH 0668/1971] Basebuildnumber is now an external parameter --- versionnumbering/generate.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 7e5568a..f26806d 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -136,6 +136,11 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum return buildstamp } +String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber = "1000") { + def int bbn = basebuildnumber.trim().toInteger() + return generate(meta, String sourcerevision, String sourcepath, bbn) +} + int incrementrevision(int current, int increment) { def int newrevision = (current + increment) % (maxversionnumber() + 1) echo "Current revision: ${current} Increment: ${increment} New revision: ${newrevision}" From 90a8c5a811f0992618fc92281f297c7450be766e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 19 Dec 2018 18:46:09 +0000 Subject: [PATCH 0669/1971] Basebuildnumber is now an external parameter - make sure it is positive --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f26806d..e2dc932 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -18,7 +18,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger() } echo "Change count: ${changecount}" - adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) + adjustedchangecount = ((changecount + basebuildnumber).abs()) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" if (isUnix()) { gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() From f4c573627e3e0a949d04764bf211733892d0c096 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 19 Dec 2018 18:46:09 +0000 Subject: [PATCH 0670/1971] Basebuildnumber is now an external parameter - make sure it is positive --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f26806d..e2dc932 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -18,7 +18,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger() } echo "Change count: ${changecount}" - adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1) + adjustedchangecount = ((changecount + basebuildnumber).abs()) % (maxversionnumber() + 1) echo "Adjusted change count: ${adjustedchangecount}" if (isUnix()) { gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() From 5fcb3244fc4a6b2c55d96ba981b852658e11c882 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 19 Dec 2018 18:50:06 +0000 Subject: [PATCH 0671/1971] Basebuildnumber is now an external parameter - make sure it is positive --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index e2dc932..e28fa2f 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -138,7 +138,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber = "1000") { def int bbn = basebuildnumber.trim().toInteger() - return generate(meta, String sourcerevision, String sourcepath, bbn) + return generate(meta, sourcerevision, sourcepath, bbn) } int incrementrevision(int current, int increment) { From db1ebc1959b7bb4818aacc8f79e830cba1431a70 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 19 Dec 2018 18:50:06 +0000 Subject: [PATCH 0672/1971] Basebuildnumber is now an external parameter - make sure it is positive --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index e2dc932..e28fa2f 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -138,7 +138,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber = "1000") { def int bbn = basebuildnumber.trim().toInteger() - return generate(meta, String sourcerevision, String sourcepath, bbn) + return generate(meta, sourcerevision, sourcepath, bbn) } int incrementrevision(int current, int increment) { From 423e1061f5bb69c70ca82e5a13ca6dfa2f135d7a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 19 Dec 2018 18:55:27 +0000 Subject: [PATCH 0673/1971] Basebuildnumber is now an external parameter - make sure it is positive --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index e28fa2f..4b11cf0 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -136,7 +136,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum return buildstamp } -String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber = "1000") { +String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) { def int bbn = basebuildnumber.trim().toInteger() return generate(meta, sourcerevision, sourcepath, bbn) } From fc6258b158c691c550194a50db86bbd06fb83af4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 19 Dec 2018 18:55:27 +0000 Subject: [PATCH 0674/1971] Basebuildnumber is now an external parameter - make sure it is positive --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index e28fa2f..4b11cf0 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -136,7 +136,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum return buildstamp } -String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber = "1000") { +String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) { def int bbn = basebuildnumber.trim().toInteger() return generate(meta, sourcerevision, sourcepath, bbn) } From f7010f5eaf8cb9aeb77ca252f0616b14ceb19b0c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 31 Dec 2018 14:03:46 +0000 Subject: [PATCH 0675/1971] Set buildstamp --- meta/folder.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 15f77d0..629aa5b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -161,7 +161,7 @@ class BuildStampInfo extends GISJsonSerialised { int revision String buildstamp - BuildStampInfo(script, buildstampprefix = "", revision = 0, buildstamp = "") { + BuildStampInfo(script, buildstampprefix = "1.30000.0.", revision = 0, buildstamp = "1.30000.0.0") { super(script) this.buildstampprefix = buildstampprefix this.revision = revision @@ -188,6 +188,12 @@ class BuildStampInfo extends GISJsonSerialised { script.echo("Build stamp now ${buildstamp}") } + void set(String buildstampprefix, int revision) { + buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.' + this.buildstampprefix = buildstampprefix + changerevision(revision) + } + void deserialiseJson(rawmeta) { buildstampprefix = rawmeta['buildstampprefix'] revision = rawmeta['revision'] From f664375cc2bf27ccd89fc672b01d418a4a3c5462 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 31 Dec 2018 14:10:10 +0000 Subject: [PATCH 0676/1971] Set buildstamp --- meta/folder.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 629aa5b..5ba3485 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -194,6 +194,10 @@ class BuildStampInfo extends GISJsonSerialised { changerevision(revision) } + void set(String buildstampprefix, String revision) { + set(buildstampprefix, revision.toInteger()) + } + void deserialiseJson(rawmeta) { buildstampprefix = rawmeta['buildstampprefix'] revision = rawmeta['revision'] From 83c89342711ecdc6509d1f5a312990d21b585a4c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 31 Dec 2018 14:21:29 +0000 Subject: [PATCH 0677/1971] Set buildstamp --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 5ba3485..39de31f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -191,6 +191,7 @@ class BuildStampInfo extends GISJsonSerialised { void set(String buildstampprefix, int revision) { buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.' this.buildstampprefix = buildstampprefix + this.buildstamp = buildstampprefix + "0" changerevision(revision) } From fc17af2c5faf83682d17cd9bead0e3f5972c39e6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 31 Dec 2018 16:09:25 +0000 Subject: [PATCH 0678/1971] Handle components that don't have associated source code --- release/do.groovy | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 85753e6..1ded952 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -68,23 +68,25 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { def checkoutsourcerepo(buildmeta, String checkoutfolder) { def String sourcerepo = buildmeta.gitinfo.remoteurl - // 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 - """ - ) + 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 + # 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 { + dir(sourcerepofolder) { + sh("git clone ${sourcerepo} ${checkoutfolder}") + } } } } @@ -297,10 +299,15 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}" def String buildsha = buildmeta.gitinfo.gitrevision - def ArrayList srctaglist = maketaglist(srcbuildstamp, otherreleasetags) - def tagadded = sourcegittags(buildsha, srctaglist) - if (tagadded) { - sourcegitpush(dryrunpush) + if (buildsha) { + def ArrayList srctaglist = maketaglist(srcbuildstamp, otherreleasetags) + def tagadded = sourcegittags(buildsha, srctaglist) + if (tagadded) { + sourcegitpush(dryrunpush) + } + } + else { + summaryappend(",No Src ") } } } From fa1feb73b91d0ac86865e1c8d9bca9d8b0a1f9fa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 5 Jan 2019 12:18:09 +0000 Subject: [PATCH 0679/1971] Automatically add the top level meta item tag to all subcomponents --- release/release.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release/release.groovy b/release/release.groovy index 828f1ff..3c13368 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -42,6 +42,9 @@ pipeline { steps { script { def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") + // Place the top level build stamp on all + def topleveltag = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}" + OTHER_RELEASE_TAGS = "${topleveltag},${OTHER_RELEASE_TAGS}" (summarystring, markunstable, unstablereason) = releaser.releasehierarchy(buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH) if (markunstable) { env.unstablereason = unstablereason From 67d92ba13af4f6cf4e3143d83efc72e31f3f3a3a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Jan 2019 14:13:42 +0000 Subject: [PATCH 0680/1971] Make other tags component unique --- release/do.groovy | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 1ded952..852f6f3 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -157,14 +157,15 @@ def boolean checkforchange(buildmeta, previousreleasemeta) { return changed } -def ArrayList maketaglist(String buildstamp, String otherreleasetags) { +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()) { - taglist.add(othertagitem.trim()) + componentothertagitem = "${othertagitem}_${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" + taglist.add(componentothertagitem.trim()) } } return taglist @@ -288,7 +289,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Post commit sha code: ${postcommitshacode}" - ArrayList taglist = maketaglist(buildstamp, otherreleasetags) + ArrayList taglist = maketaglist(buildmeta, buildstamp, otherreleasetags) def tagadded = releasegittags(postcommitshacode, taglist) if (changed || tagadded) { @@ -300,7 +301,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def String buildsha = buildmeta.gitinfo.gitrevision if (buildsha) { - def ArrayList srctaglist = maketaglist(srcbuildstamp, otherreleasetags) + def ArrayList srctaglist = maketaglist(buildmeta, srcbuildstamp, otherreleasetags) def tagadded = sourcegittags(buildsha, srctaglist) if (tagadded) { sourcegitpush(dryrunpush) From 94b5ef18591b9a26758c93702221dc51d04ebc75 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Jan 2019 14:25:20 +0000 Subject: [PATCH 0681/1971] Make other tags component unique; Report more info --- release/do.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 852f6f3..0e53b7f 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -32,7 +32,8 @@ def preconditions() { def setunstable(String reason) { markunstable = true - unstablereason = reason + unstablereason += reason + "\n" + echo "Marked build as unstable: Reason: ${reason}" } def summaryappend(String summary) { From f4d8ff7a5315f15a6a91ad4eb2fd10c086bd582b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Jan 2019 14:35:37 +0000 Subject: [PATCH 0682/1971] Make other tags component unique; Report more info --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 0e53b7f..0ea3399 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -165,8 +165,8 @@ def ArrayList maketaglist(buildmeta, String buildstamp, String otherrele def ArrayList othertaglist = otherreleasetags.split(',') for (othertagitem in othertaglist) { if (othertagitem?.trim()) { - componentothertagitem = "${othertagitem}_${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" - taglist.add(componentothertagitem.trim()) + def componentothertagitem = "${othertagitem.trim()}_${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" + taglist.add(componentothertagitem) } } return taglist From c8c0568c92ec17da36417ae26204158eeb647764 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Jan 2019 12:35:30 +0000 Subject: [PATCH 0683/1971] On releasing, release the top level component last - so that we don't end up with partial release info --- meta/folder.groovy | 6 +++++- release/do.groovy | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 39de31f..ff56928 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -658,12 +658,16 @@ class MetaInfo extends GISJsonSerialised { return releasemetacollection } + String componentidentifier() { + return productinfo.productname + "_" + productinfo.subcomponentname + } + Map releasewalkerunique(int maxdepth, String startpath = "") { Map releasemetauniquecollection = new LinkedHashMap() ArrayList releasemetacollection = new ArrayList() releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) for (relatedmetainfo in releasemetacollection) { - String uniquestring = relatedmetainfo.meta.productinfo.productname + "_" + relatedmetainfo.meta.productinfo.subcomponentname + String uniquestring = relatedmetainfo.meta.componentidentifier() releasemetauniquecollection.put(uniquestring, relatedmetainfo) } return releasemetauniquecollection diff --git a/release/do.groovy b/release/do.groovy index 0ea3399..e264cc0 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -341,11 +341,18 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String // Walk the meta information to a max depth, looking for artifacts to import for release componentReleaseInfo = buildmeta.releasewalkerunique(md) + def toplevelid = buildmeta.componentidentifier() // For each component for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] - releasecomponent(buildinfo, otherreleasetags, dryrunpush) + if (toplevelid != key) { + releasecomponent(buildinfo, otherreleasetags, dryrunpush) + } } + // Do the top level last + def toplevelbuildinfo = componentReleaseInfo[toplevelid] + releasecomponent(toplevelbuildinfo, otherreleasetags, dryrunpush) + return [summarystring, markunstable, unstablereason] } From 329997e9829484c8d350d339fca2bd645c594bf4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Jan 2019 12:35:30 +0000 Subject: [PATCH 0684/1971] On releasing, release the top level component last - so that we don't end up with partial release info --- meta/folder.groovy | 6 +++++- release/do.groovy | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 39de31f..ff56928 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -658,12 +658,16 @@ class MetaInfo extends GISJsonSerialised { return releasemetacollection } + String componentidentifier() { + return productinfo.productname + "_" + productinfo.subcomponentname + } + Map releasewalkerunique(int maxdepth, String startpath = "") { Map releasemetauniquecollection = new LinkedHashMap() ArrayList releasemetacollection = new ArrayList() releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) for (relatedmetainfo in releasemetacollection) { - String uniquestring = relatedmetainfo.meta.productinfo.productname + "_" + relatedmetainfo.meta.productinfo.subcomponentname + String uniquestring = relatedmetainfo.meta.componentidentifier() releasemetauniquecollection.put(uniquestring, relatedmetainfo) } return releasemetauniquecollection diff --git a/release/do.groovy b/release/do.groovy index 0ea3399..e264cc0 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -341,11 +341,18 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String // Walk the meta information to a max depth, looking for artifacts to import for release componentReleaseInfo = buildmeta.releasewalkerunique(md) + def toplevelid = buildmeta.componentidentifier() // For each component for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] - releasecomponent(buildinfo, otherreleasetags, dryrunpush) + if (toplevelid != key) { + releasecomponent(buildinfo, otherreleasetags, dryrunpush) + } } + // Do the top level last + def toplevelbuildinfo = componentReleaseInfo[toplevelid] + releasecomponent(toplevelbuildinfo, otherreleasetags, dryrunpush) + return [summarystring, markunstable, unstablereason] } From 50db2ba7dfbed6d84b61c4679fb34b92b46066c5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Jan 2019 07:58:47 +0000 Subject: [PATCH 0685/1971] Publishing jobs need to provide the meta depth --- publish/publish.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/publish/publish.groovy b/publish/publish.groovy index 8ed7aa8..a703c9e 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -44,7 +44,6 @@ pipeline { steps { script { def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - MAX_META_DEPTH='2' (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason From 59a74b1f9aceda55d7f8a1d1f6f7dbf65b2fb412 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Jan 2019 10:11:51 +0000 Subject: [PATCH 0686/1971] Do an integrity check at release time; Print out information about components --- publish/do.groovy | 10 ++++++++-- release/do.groovy | 23 +++++++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index e280c0c..76dc025 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -107,10 +107,16 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin resetfolders() preconditions() - // Walk the meta information to a max depth, looking for artifacts to import for release - componentReleaseInfo = releasemeta.releasewalkerunique(md) + // Walk the meta information to a max depth, looking for artifacts to publish + (componentReleaseInfo, componentReleaseInfoVersionUnique) = releasemeta.releasewalkerunique(md) // For each component + echo "Components in publish:" + for (key in componentReleaseInfo.keySet()) { + def releaseinfo = componentReleaseInfo[key] + echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + } + for (key in componentReleaseInfo.keySet()) { def releaseinfo = componentReleaseInfo[key] recallcomponent(releaseinfo, softwarerelease) diff --git a/release/do.groovy b/release/do.groovy index e264cc0..cbecc08 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -338,8 +338,27 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String resetfolders() preconditions() - // Walk the meta information to a max depth, looking for artifacts to import for release - componentReleaseInfo = buildmeta.releasewalkerunique(md) + // Walk the meta information to a max depth, looking for components to release + (componentReleaseInfo, componentReleaseInfoVersionUnique) = releasemeta.releasewalkerunique(md) + + + echo "Components in release:" + for (key in componentReleaseInfo.keySet()) { + def releaseinfo = componentReleaseInfo[key] + echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + } + + echo "Version unique components in release:" + for (key in componentReleaseInfoVersionUnique.keySet()) { + def releaseinfo = componentReleaseInfoVersionUnique[key] + echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + } + + if (DO_INTEGRITY_CHECK == "true") { + if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique()) { + 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 From d7834ac5895432b8fdf8ea4e855ec7a70d7d3dac Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Jan 2019 10:36:00 +0000 Subject: [PATCH 0687/1971] Do an integrity check at release time; Print out information about components --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index cbecc08..a8f9e49 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -339,7 +339,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String preconditions() // Walk the meta information to a max depth, looking for components to release - (componentReleaseInfo, componentReleaseInfoVersionUnique) = releasemeta.releasewalkerunique(md) + (componentReleaseInfo, componentReleaseInfoVersionUnique) = buildmeta.releasewalkerunique(md) echo "Components in release:" From 4b720911b4be5e97c1f9ae0ba5a5088eafaf4bdd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Jan 2019 12:59:29 +0000 Subject: [PATCH 0688/1971] Do an integrity check at release time; Print out information about components --- release/do.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index a8f9e49..d1952f0 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -341,7 +341,6 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String // Walk the meta information to a max depth, looking for components to release (componentReleaseInfo, componentReleaseInfoVersionUnique) = buildmeta.releasewalkerunique(md) - echo "Components in release:" for (key in componentReleaseInfo.keySet()) { def releaseinfo = componentReleaseInfo[key] From 4ad0007dceb8155e7d6988c26e7e15e21aaae9f0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Jan 2019 13:14:57 +0000 Subject: [PATCH 0689/1971] Do an integrity check at release time; Print out information about components --- publish/do.groovy | 11 ++--------- release/do.groovy | 14 +------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 76dc025..907f328 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -110,15 +110,8 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin // Walk the meta information to a max depth, looking for artifacts to publish (componentReleaseInfo, componentReleaseInfoVersionUnique) = releasemeta.releasewalkerunique(md) - // For each component - echo "Components in publish:" - for (key in componentReleaseInfo.keySet()) { - def releaseinfo = componentReleaseInfo[key] - echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" - } - - for (key in componentReleaseInfo.keySet()) { - def releaseinfo = componentReleaseInfo[key] + for (key in componentReleaseInfoVersionUnique.keySet()) { + def releaseinfo = componentReleaseInfoVersionUnique[key] recallcomponent(releaseinfo, softwarerelease) } stripgithistory() diff --git a/release/do.groovy b/release/do.groovy index d1952f0..b2577fb 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -341,20 +341,8 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String // Walk the meta information to a max depth, looking for components to release (componentReleaseInfo, componentReleaseInfoVersionUnique) = buildmeta.releasewalkerunique(md) - echo "Components in release:" - for (key in componentReleaseInfo.keySet()) { - def releaseinfo = componentReleaseInfo[key] - echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" - } - - echo "Version unique components in release:" - for (key in componentReleaseInfoVersionUnique.keySet()) { - def releaseinfo = componentReleaseInfoVersionUnique[key] - echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" - } - if (DO_INTEGRITY_CHECK == "true") { - if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique()) { + if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) { error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct?" } } From ce93cdb372560f2313802310f84442ac3e168a8a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Jan 2019 13:40:33 +0000 Subject: [PATCH 0690/1971] Do an integrity check at release time; Print out information about components --- meta/folder.groovy | 25 ++++++++++++++++++++++--- publish/do.groovy | 8 +++++++- release/do.groovy | 17 ++++++++++++++++- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ff56928..2ef8e22 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -662,17 +662,36 @@ class MetaInfo extends GISJsonSerialised { return productinfo.productname + "_" + productinfo.subcomponentname } + String componentversionuniqueidentifier() { + return productinfo.productname + "_" + productinfo.subcomponentname + "_" + buildstampinfo.buildstamp + } + Map releasewalkerunique(int maxdepth, String startpath = "") { - Map releasemetauniquecollection = new LinkedHashMap() - ArrayList releasemetacollection = new ArrayList() + def ArrayList releasemetacollection = new ArrayList() releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) + + def Map releasemetauniquecollection = new LinkedHashMap() for (relatedmetainfo in releasemetacollection) { - String uniquestring = relatedmetainfo.meta.componentidentifier() + def String uniquestring = relatedmetainfo.meta.componentidentifier() releasemetauniquecollection.put(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.put(uniquestring, relatedmetainfo) + } + + return releasemetaversionuniquecollection + } + MetaInfo getNewMetaObject(script) { return new MetaInfo(script) } diff --git a/publish/do.groovy b/publish/do.groovy index 907f328..a88f018 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -108,7 +108,13 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin preconditions() // Walk the meta information to a max depth, looking for artifacts to publish - (componentReleaseInfo, componentReleaseInfoVersionUnique) = releasemeta.releasewalkerunique(md) + def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md) + + echo "Version unique components:" + for (key in componentReleaseInfoVersionUnique.keySet()) { + def releaseinfo = componentReleaseInfoVersionUnique[key] + echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + } for (key in componentReleaseInfoVersionUnique.keySet()) { def releaseinfo = componentReleaseInfoVersionUnique[key] diff --git a/release/do.groovy b/release/do.groovy index b2577fb..172861b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -339,7 +339,22 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String preconditions() // Walk the meta information to a max depth, looking for components to release - (componentReleaseInfo, componentReleaseInfoVersionUnique) = buildmeta.releasewalkerunique(md) + def componentReleaseInfo = buildmeta.releasewalkerunique(md) + + script.echo "Unique components:" + for (key in componentReleaseInfo.keySet()) { + def releaseinfo = componentReleaseInfo[key] + script.echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + } + + // Walk the meta information to a max depth, looking for components to release + def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md) + + echo "Version unique components:" + for (key in componentReleaseInfoVersionUnique.keySet()) { + def releaseinfo = componentReleaseInfoVersionUnique[key] + echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + } if (DO_INTEGRITY_CHECK == "true") { if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) { From 20e86747ef8b0a174c34e15f284e647ecbbc87de Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Jan 2019 13:41:54 +0000 Subject: [PATCH 0691/1971] Do an integrity check at release time; Print out information about components --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 172861b..0c070d1 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -341,10 +341,10 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String // Walk the meta information to a max depth, looking for components to release def componentReleaseInfo = buildmeta.releasewalkerunique(md) - script.echo "Unique components:" + echo "Unique components:" for (key in componentReleaseInfo.keySet()) { def releaseinfo = componentReleaseInfo[key] - script.echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" } // Walk the meta information to a max depth, looking for components to release From 3567488f00d39277ee8a22736289b62db34b7ae3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Jan 2019 13:51:17 +0000 Subject: [PATCH 0692/1971] Do an integrity check at release time; Print out information about components --- publish/do.groovy | 5 +++-- release/do.groovy | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index a88f018..570cb5e 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -111,10 +111,11 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md) echo "Version unique components:" + def String versionuniquecomponent = "" for (key in componentReleaseInfoVersionUnique.keySet()) { - def releaseinfo = componentReleaseInfoVersionUnique[key] - echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + versionuniquecomponent += "${key}\n" } + echo versionuniquecomponent for (key in componentReleaseInfoVersionUnique.keySet()) { def releaseinfo = componentReleaseInfoVersionUnique[key] diff --git a/release/do.groovy b/release/do.groovy index 0c070d1..2326ad5 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -340,21 +340,21 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String // 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()) { - def releaseinfo = componentReleaseInfo[key] - echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + 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()) { - def releaseinfo = componentReleaseInfoVersionUnique[key] - echo "${releaseinfo.offsetpath} : ${releaseinfo.meta.componentversionuniqueidentifier()}" + versionuniquecomponent += "${key}\n" } + echo versionuniquecomponent if (DO_INTEGRITY_CHECK == "true") { if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) { From 3274a8dd0999290c4a12e85432996d66d8520494 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 21 Jan 2019 15:15:27 +0000 Subject: [PATCH 0693/1971] Handle missing jq command --- differences/json.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/differences/json.groovy b/differences/json.groovy index 47d9cc5..19b7cf6 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -3,6 +3,8 @@ def comparefiles(importedjsonfile, currentjsonfile) { env.CURRENT_JSON="${currentjsonfile}" if (isUnix()) { sh """ + which jq + if [ \$? -ne 0 ]; then exit 1; fi # jq -S sorts json output diff -c <(jq -S . "${IMPORTED_JSON}") <(jq -S . "${CURRENT_JSON}") """ From 42df36426c1496d2e67162e9519dfdab542dea0b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 21 Jan 2019 15:15:27 +0000 Subject: [PATCH 0694/1971] Handle missing jq command --- differences/json.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/differences/json.groovy b/differences/json.groovy index 47d9cc5..19b7cf6 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -3,6 +3,8 @@ def comparefiles(importedjsonfile, currentjsonfile) { env.CURRENT_JSON="${currentjsonfile}" if (isUnix()) { sh """ + which jq + if [ \$? -ne 0 ]; then exit 1; fi # jq -S sorts json output diff -c <(jq -S . "${IMPORTED_JSON}") <(jq -S . "${CURRENT_JSON}") """ From 4fd07d22d652a396fab26ef6f468ad509786faf8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Jan 2019 15:32:00 +0000 Subject: [PATCH 0695/1971] Handle the case where rebuilt binaries change even though the original source has not changed and the version number has not changed - Tags now have the build number appended to them so that there is no tag clash during the release process --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 2326ad5..79bafd5 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -270,7 +270,7 @@ def sourcegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String sourcerepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = buildmeta.buildstampinfo.buildstamp + def String buildstamp = "${buildmeta.buildstampinfo.buildstamp}_${buildmeta.jenkinsbuildinfo.buildnumber}" dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() @@ -298,7 +298,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source } } dir(sourcerepo) { - def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}" + def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildstamp}" def String buildsha = buildmeta.gitinfo.gitrevision if (buildsha) { From ca173c1f1310b1e743e626b4b2784b3eef3dbef2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Jan 2019 15:53:13 +0000 Subject: [PATCH 0696/1971] Handle the case where rebuilt binaries change even though the original source has not changed and the version number has not changed - Tags now have the build number appended to them so that there is no tag clash during the release process - change the meta build tags too --- release/do.groovy | 11 ++++++----- release/release.groovy | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 79bafd5..1a785b3 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -270,7 +270,8 @@ def sourcegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String sourcerepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = "${buildmeta.buildstampinfo.buildstamp}_${buildmeta.jenkinsbuildinfo.buildnumber}" + def String buildstamp = buildmeta.buildstampinfo.buildstamp + def String buildstamptag = "${buildstamp}_${buildmeta.jenkinsbuildinfo.buildnumber}" dir(releaserepo) { def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() @@ -280,7 +281,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def boolean changed = checkforchange(buildmeta, previousreleasemeta) if (changed) { - releasegitcommit(buildstamp) + releasegitcommit(buildstamptag) } else { releasegitreset() @@ -290,7 +291,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Post commit sha code: ${postcommitshacode}" - ArrayList taglist = maketaglist(buildmeta, buildstamp, otherreleasetags) + ArrayList taglist = maketaglist(buildmeta, buildstamptag, otherreleasetags) def tagadded = releasegittags(postcommitshacode, taglist) if (changed || tagadded) { @@ -298,11 +299,11 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source } } dir(sourcerepo) { - def String srcbuildstamp = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildstamp}" + def String srcbuildstamptag = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildstamptag}" def String buildsha = buildmeta.gitinfo.gitrevision if (buildsha) { - def ArrayList srctaglist = maketaglist(buildmeta, srcbuildstamp, otherreleasetags) + def ArrayList srctaglist = maketaglist(buildmeta, srcbuildstamptag, otherreleasetags) def tagadded = sourcegittags(buildsha, srctaglist) if (tagadded) { sourcegitpush(dryrunpush) diff --git a/release/release.groovy b/release/release.groovy index 3c13368..b0530be 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -43,7 +43,7 @@ pipeline { script { def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") // Place the top level build stamp on all - def topleveltag = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}" + def topleveltag = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}_${buildmeta.jenkinsbuildinfo.buildnumber}" OTHER_RELEASE_TAGS = "${topleveltag},${OTHER_RELEASE_TAGS}" (summarystring, markunstable, unstablereason) = releaser.releasehierarchy(buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH) if (markunstable) { From 5c5bc9a97804dcf418a87eff5bb187fdc581239a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 27 Jan 2019 11:11:17 +0000 Subject: [PATCH 0697/1971] Adjust publish script to handle buildstamps appended with build number --- publish/do.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 570cb5e..b188165 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -44,7 +44,7 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { def releasemeta = releaseinfo.meta def String componentURL = releasemeta.releaseinfo.releaserepoURL - def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}" + def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}" def publishableitems = releasemeta.publishableinfo def ArrayList publishablePaths = new ArrayList() if (publishableitems.size() > 0) { @@ -78,11 +78,11 @@ def publish(String customer) { def recallcomponent(releaseinfo, String softwarerelease) { def releasemeta = releaseinfo.meta - def String uniquefolder = "Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + def String uniquefolder = "Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}_${releasemeta.jenkinsbuildinfo.buildnumber}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" - summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") + summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname} ${releasemeta.jenkinsbuildinfo.buildnumber}: ") getcomponentartifacts(releaseinfo, uniquefolderforrepo, uniquefoldertemp) From 91f0f07e8d4ca0aa3fea5538eb1904e2f92b44ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 27 Jan 2019 11:27:09 +0000 Subject: [PATCH 0698/1971] Adjust publish script to handle buildstamps appended with build number - The output folders and summary don't need to be keyed by build number --- publish/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index b188165..7844289 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -78,11 +78,11 @@ def publish(String customer) { def recallcomponent(releaseinfo, String softwarerelease) { def releasemeta = releaseinfo.meta - def String uniquefolder = "Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}_${releasemeta.jenkinsbuildinfo.buildnumber}" + def String uniquefolder = "Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" - summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname} ${releasemeta.jenkinsbuildinfo.buildnumber}: ") + summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") getcomponentartifacts(releaseinfo, uniquefolderforrepo, uniquefoldertemp) From fb25a6b30b16515306aaa7032dcf94484d82e53c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 27 Jan 2019 12:21:29 +0000 Subject: [PATCH 0699/1971] When generating revision numbers, take into account negative basebuildnumbers --- versionnumbering/generate.groovy | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 4b11cf0..4761174 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -4,6 +4,12 @@ def int maxversionnumber() { 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 @@ -18,7 +24,9 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger() } echo "Change count: ${changecount}" - adjustedchangecount = ((changecount + basebuildnumber).abs()) % (maxversionnumber() + 1) + 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() @@ -141,10 +149,4 @@ String generate(meta, String sourcerevision, String sourcepath, String basebuild return generate(meta, sourcerevision, sourcepath, bbn) } -int incrementrevision(int current, int increment) { - def int newrevision = (current + increment) % (maxversionnumber() + 1) - echo "Current revision: ${current} Increment: ${increment} New revision: ${newrevision}" - return newrevision -} - return this; \ No newline at end of file From 4df4b0d568ea3401acbef1bbacdd4f3bd31bf081 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 28 Jan 2019 11:18:49 +0000 Subject: [PATCH 0700/1971] Certain components are built from the same source repository so therefore their version numbers should not be incremented when they are imported into a build component using the same source repository --- artifacts/metaexport.groovy | 5 +++-- import/importer.groovy | 12 ++++++++---- install/installhelper.groovy | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 0ca5da7..043c4de 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -9,11 +9,12 @@ def combineSubjobArtifacts(meta, subJobs) { if (subJobObject != null) { def subJobName = subJobObject.getProjectName() def subJobNumber = subJobObject.getNumber() - destFolder = subJob[1] + def destFolder = subJob[1] + def boolean incrementversionnumber = subJob[2] dir(destFolder) { deleteDir() } - importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) artifactFolders.add("${destFolder}/**") } } diff --git a/import/importer.groovy b/import/importer.groovy index 1f89426..5c996b4 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,6 +1,6 @@ versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") -def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', String excludes = '', boolean fingerprint = false) { +def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { copyArtifacts( filter: filter, excludes: excludes, @@ -10,11 +10,13 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, St target: destpath ) def importedmeta = meta.importrelated(destpath) - meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + if (incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } return importedmeta } -def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', String excludes = '', boolean fingerprint = false) { +def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { copyArtifacts( filter: filter, excludes: excludes, @@ -27,7 +29,9 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat target: destpath ) def importedmeta = meta.importrelated(destpath) - meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + if (incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } return importedmeta } diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 093ddef..03ee9e4 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -5,9 +5,9 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { def artifactKey = installerDetails.get(installer)[0] - (sourceProject, sourceselector, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { - def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, toCopy, notToCopy) + def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy) artifactFetched.put(artifactKey, importmeta) } } From a80034e809b74e60c5109b7349c8e4af7a53e279 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 28 Jan 2019 11:18:49 +0000 Subject: [PATCH 0701/1971] Certain components are built from the same source repository so therefore their version numbers should not be incremented when they are imported into a build component using the same source repository --- artifacts/metaexport.groovy | 5 +++-- import/importer.groovy | 12 ++++++++---- install/installhelper.groovy | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 0ca5da7..043c4de 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -9,11 +9,12 @@ def combineSubjobArtifacts(meta, subJobs) { if (subJobObject != null) { def subJobName = subJobObject.getProjectName() def subJobNumber = subJobObject.getNumber() - destFolder = subJob[1] + def destFolder = subJob[1] + def boolean incrementversionnumber = subJob[2] dir(destFolder) { deleteDir() } - importer.artifactimport(meta, subJobName, subJobNumber, destFolder) + importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) artifactFolders.add("${destFolder}/**") } } diff --git a/import/importer.groovy b/import/importer.groovy index 1f89426..5c996b4 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,6 +1,6 @@ versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") -def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, String filter = '**', String excludes = '', boolean fingerprint = false) { +def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { copyArtifacts( filter: filter, excludes: excludes, @@ -10,11 +10,13 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, St target: destpath ) def importedmeta = meta.importrelated(destpath) - meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + if (incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } return importedmeta } -def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, String filter = '**', String excludes = '', boolean fingerprint = false) { +def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { copyArtifacts( filter: filter, excludes: excludes, @@ -27,7 +29,9 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat target: destpath ) def importedmeta = meta.importrelated(destpath) - meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + if (incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } return importedmeta } diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 093ddef..03ee9e4 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -5,9 +5,9 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { def artifactKey = installerDetails.get(installer)[0] - (sourceProject, sourceselector, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { - def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, toCopy, notToCopy) + def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy) artifactFetched.put(artifactKey, importmeta) } } From bae55fa66609d54a7537bc71e9b4cbf2977dc9fd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 28 Jan 2019 22:14:31 +0000 Subject: [PATCH 0702/1971] Alter location of differences file so that it no longer gets published --- meta/folder.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2ef8e22..461a8fb 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -419,6 +419,7 @@ class PublishableInfo extends GISJsonSerialised { class MetaInfo extends GISJsonSerialised { private static String FORMAT = "0.1" private static String METAFOLDERNAME = "meta" + private static String DIFFFOLDERNAME = "diff" private static String METAFILENAME = "info.json" private static String METADIFFFILENAME = "differences.txt" private static String METAARTIFACTS = "${METAFOLDERNAME}/**" @@ -565,7 +566,7 @@ class MetaInfo extends GISJsonSerialised { } static String difffilepath() { - return METAFOLDERNAME + "/" + METADIFFFILENAME + return DIFFFOLDERNAME + "/" + METADIFFFILENAME } MetaInfo importrelated(String destpath) { From 18272f5bc97fedf92d6bf70bc23d15d96e778bcf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 28 Jan 2019 22:14:31 +0000 Subject: [PATCH 0703/1971] Alter location of differences file so that it no longer gets published --- meta/folder.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2ef8e22..461a8fb 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -419,6 +419,7 @@ class PublishableInfo extends GISJsonSerialised { class MetaInfo extends GISJsonSerialised { private static String FORMAT = "0.1" private static String METAFOLDERNAME = "meta" + private static String DIFFFOLDERNAME = "diff" private static String METAFILENAME = "info.json" private static String METADIFFFILENAME = "differences.txt" private static String METAARTIFACTS = "${METAFOLDERNAME}/**" @@ -565,7 +566,7 @@ class MetaInfo extends GISJsonSerialised { } static String difffilepath() { - return METAFOLDERNAME + "/" + METADIFFFILENAME + return DIFFFOLDERNAME + "/" + METADIFFFILENAME } MetaInfo importrelated(String destpath) { From 553feb031b3a06fd2e2425e7cc023dee6885f249 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 28 Jan 2019 23:07:18 +0000 Subject: [PATCH 0704/1971] Alter location of differences file so that it no longer gets published --- meta/folder.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 461a8fb..efc8df2 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -423,6 +423,7 @@ class MetaInfo extends GISJsonSerialised { private static String METAFILENAME = "info.json" private static String METADIFFFILENAME = "differences.txt" private static String METAARTIFACTS = "${METAFOLDERNAME}/**" + private static String DIFFARTIFACTS = "${DIFFFOLDERNAME}/**" class RelatedMetaInfo extends GISJsonSerialised { String offsetpath @@ -621,7 +622,7 @@ class MetaInfo extends GISJsonSerialised { ArrayList releasedfromsubmeta = new ArrayList(), // These items are not recorded in meta as released from here String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}" ) { - def String artifactlist = METAARTIFACTS + def String artifactlist = "${METAARTIFACTS},${DIFFARTIFACTS}" releaseinfo.addReleaseItem(METAARTIFACTS) for (releaseitem in releasedfromhere) { artifactlist += "," + releaseitem From a4fc87477f8bb4a9cfaf62feff4b6b14fc281897 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 28 Jan 2019 23:07:18 +0000 Subject: [PATCH 0705/1971] Alter location of differences file so that it no longer gets published --- meta/folder.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 461a8fb..efc8df2 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -423,6 +423,7 @@ class MetaInfo extends GISJsonSerialised { private static String METAFILENAME = "info.json" private static String METADIFFFILENAME = "differences.txt" private static String METAARTIFACTS = "${METAFOLDERNAME}/**" + private static String DIFFARTIFACTS = "${DIFFFOLDERNAME}/**" class RelatedMetaInfo extends GISJsonSerialised { String offsetpath @@ -621,7 +622,7 @@ class MetaInfo extends GISJsonSerialised { ArrayList releasedfromsubmeta = new ArrayList(), // These items are not recorded in meta as released from here String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}" ) { - def String artifactlist = METAARTIFACTS + def String artifactlist = "${METAARTIFACTS},${DIFFARTIFACTS}" releaseinfo.addReleaseItem(METAARTIFACTS) for (releaseitem in releasedfromhere) { artifactlist += "," + releaseitem From 54185b50486c7eef935aabbe62e77f14cabe2dfc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 31 Jan 2019 18:32:44 +0000 Subject: [PATCH 0706/1971] Select the artifacts from a specific build for the duration of the job --- meta/folder.groovy | 4 ++-- release/do.groovy | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index efc8df2..1b74fed 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -118,8 +118,8 @@ class GitInfo extends GISJsonSerialised { } class JenkinsBuildInfo extends GISJsonSerialised { - private String buildjobname - private int buildnumber + String buildjobname + int buildnumber private String buildmachine private String builddate diff --git a/release/do.groovy b/release/do.groovy index 1a785b3..1d9e721 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -92,7 +92,7 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { } } -def getcomponentartifacts(buildinfo, String repofolder, String tempfolder) { +def getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { @@ -104,10 +104,10 @@ def getcomponentartifacts(buildinfo, String repofolder, String tempfolder) { echo "Copying artifacts: ${filterpath} to ${tempfolder}" copyArtifacts( filter: filterpath, - projectName: BUILD_JOB, + projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname, selector: [ $class: 'ParameterizedBuildSelector', - parameterName: BUILD_JOB_SELECTOR + parameterName: " ${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}") ], target: tempfolder ) @@ -315,7 +315,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source } } -def releasecomponent(buildinfo, String otherreleasetags, String dryrunpush) { +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}" @@ -327,7 +327,7 @@ def releasecomponent(buildinfo, String otherreleasetags, String dryrunpush) { checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo) - getcomponentartifacts(buildinfo, uniquefolderforrepo, uniquefoldertemp) + getcomponentartifacts(toplevelbuildmeta, buildinfo, uniquefolderforrepo, uniquefoldertemp) gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) @@ -368,12 +368,12 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] if (toplevelid != key) { - releasecomponent(buildinfo, otherreleasetags, dryrunpush) + releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) } } // Do the top level last def toplevelbuildinfo = componentReleaseInfo[toplevelid] - releasecomponent(toplevelbuildinfo, otherreleasetags, dryrunpush) + releasecomponent(buildmeta, toplevelbuildinfo, otherreleasetags, dryrunpush) return [summarystring, markunstable, unstablereason] } From 4b6c3aff23174460d121db08793cb9a586862976 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 31 Jan 2019 18:38:21 +0000 Subject: [PATCH 0707/1971] Select the artifacts from a specific build for the duration of the job --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 1d9e721..0f65035 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -107,7 +107,7 @@ def getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, Strin projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname, selector: [ $class: 'ParameterizedBuildSelector', - parameterName: " ${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}") + parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" ], target: tempfolder ) From 628fe40745113bb353cb60021fc0f61ce527321e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 31 Jan 2019 22:35:18 +0000 Subject: [PATCH 0708/1971] Clone depth 1 is causing issues during release to git --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 0f65035..604581a 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -57,7 +57,7 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { // 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 def previousreleasemeta = buildmeta.getNewMetaObject(this) dir(releaserepofolder) { - sh("git clone --depth 1 ${releaserepo} ${checkoutfolder}") + sh("git clone ${releaserepo} ${checkoutfolder}") } previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) dir(checkoutfolder) { From 05472dfcda37b37b20ed1f79c9fed2c06eb29cba Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Feb 2019 11:36:23 +0000 Subject: [PATCH 0709/1971] Update build script to use updated Common_scripts --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1b74fed..934ffe3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -157,7 +157,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { } class BuildStampInfo extends GISJsonSerialised { - private String buildstampprefix + String buildstampprefix int revision String buildstamp From 7323493b05ab01ff46cf1d86207dfc19ff761870 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Feb 2019 18:28:15 +0000 Subject: [PATCH 0710/1971] Add non-build startup boilerplate --- autobuilder.groovy | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/autobuilder.groovy b/autobuilder.groovy index 9f0aece..1210aab 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -56,6 +56,28 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA return meta } +// 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("", "", "") + 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") } From eb07ef6dc046a36c85c16ea32799a756a7eda3b1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Feb 2019 18:43:08 +0000 Subject: [PATCH 0711/1971] Try to use the REPO_ROOT environment variable --- versioncontrol/git.groovy | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 8bd7968..730335a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -19,12 +19,8 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { return new SparseCheckoutPaths(sparsecheckoutpaths) } -def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { - reporootenv = env.REPO_ROOT - if (reporootenv != null && repoRoot != "") { - reporootpath = "${reporootenv.trim()}/${repoRoot}" - } else { - reporootpath = "" +def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = env.REPO_ROOT.trim(), int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + if (repoRoot == "") { 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" } checkout([ @@ -39,7 +35,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo extensions: [ [$class: 'GitLFSPull'], [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], + [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: repoRoot, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], sparsecheckoutconfig(sparseitemlist) From 31196dbede6b5c339c21dfb24080e928bf4bd435 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Feb 2019 18:47:04 +0000 Subject: [PATCH 0712/1971] Revert "Try to use the REPO_ROOT environment variable" This reverts commit aa04eb23b85ac42d236d21dc489f3a03038fbfba. --- versioncontrol/git.groovy | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 730335a..8bd7968 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -19,8 +19,12 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { return new SparseCheckoutPaths(sparsecheckoutpaths) } -def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = env.REPO_ROOT.trim(), int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { - if (repoRoot == "") { +def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + reporootenv = env.REPO_ROOT + if (reporootenv != null && repoRoot != "") { + reporootpath = "${reporootenv.trim()}/${repoRoot}" + } else { + reporootpath = "" 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" } checkout([ @@ -35,7 +39,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo extensions: [ [$class: 'GitLFSPull'], [$class: 'CleanBeforeCheckout'], - [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: repoRoot, shallow: shallowClone, timeout: 120], + [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], sparsecheckoutconfig(sparseitemlist) From 9f47550d0e051c80f3ef9c44163558dd6b2d5e7c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Feb 2019 19:07:43 +0000 Subject: [PATCH 0713/1971] Try to speed up release repo check out --- autobuilder.groovy | 4 ++-- release/registerrepo.groovy | 4 ++-- versioncontrol/git.groovy | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 1210aab..b9a36d4 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -32,7 +32,7 @@ def getmetafolderscript() { } // Start up boilderplate -def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, String repoRootSuffix = "", autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { echo "Starting...." autobuildroot = autobuildpath @@ -48,7 +48,7 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) def rr = load("${commonscripts()}/release/registerrepo.groovy") - rr.registerrepo(meta, releaserepo) + rr.registerrepo(meta, releaserepo, repoRootSuffix) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy index ff4d85d..2dffdc7 100644 --- a/release/registerrepo.groovy +++ b/release/registerrepo.groovy @@ -2,9 +2,9 @@ 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) { +def registerrepo(meta, String releaserepo, String repoRootSuffix = "") { if (releaserepo?.trim()) { - vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo") + vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo", repoRootSuffix) } meta.releaseinfo.set(releaserepo) } diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 8bd7968..f7d10bb 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -19,10 +19,11 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { return new SparseCheckoutPaths(sparsecheckoutpaths) } -def gitCheckout(String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { +def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { reporootenv = env.REPO_ROOT - if (reporootenv != null && repoRoot != "") { - reporootpath = "${reporootenv.trim()}/${repoRoot}" + if (reporootenv != null && repoRootSuffix != "") { + reporootpath = "${reporootenv.trim()}/${repoRootSuffix}" + echo "Using release repo: ${reporootpath}" } else { reporootpath = "" 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" From 643161784419d1c66ab10c56e3db6195c3d55778 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Feb 2019 21:02:16 +0000 Subject: [PATCH 0714/1971] Update build script to use updated Common_scripts - Installers --- install/installhelper.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 03ee9e4..0447cb8 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -4,7 +4,7 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { - def artifactKey = installerDetails.get(installer)[0] + def artifactKey = installerDetails.get(installer)[1] (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy) @@ -17,7 +17,7 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { // Export any required binaries to the /bin folder def placeBinaries(artifactDetails, installerDetails) { for (installer in toBuild) { - (artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer) + (installertool, artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer) if (exportBinaries) { (artifactsSourceProject, destinationFolder, artifactsToCopy, artifactsToNotCopy, binariesFolders) = artifactDetails.get(artifactSet) for (binaryFolder in binariesFolders) { From 2ab7619f1a649a54e465a5dd8729e3e09947c603 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Feb 2019 21:15:21 +0000 Subject: [PATCH 0715/1971] Update build script to use updated Common_scripts - Installers --- install/installhelper.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 0447cb8..819a580 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -19,10 +19,10 @@ def placeBinaries(artifactDetails, installerDetails) { for (installer in toBuild) { (installertool, artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer) if (exportBinaries) { - (artifactsSourceProject, destinationFolder, artifactsToCopy, artifactsToNotCopy, binariesFolders) = artifactDetails.get(artifactSet) + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactSet) for (binaryFolder in binariesFolders) { - binariesSourceFolder = "${destinationFolder}/${binaryFolder}" - binariesDestFolder = "${WORKSPACE}/bin/${artifactSet}/${binaryFolder}" + def binariesSourceFolder = "${destFolder}/${binaryFolder}" + def binariesDestFolder = "${WORKSPACE}/bin/${artifactSet}/${binaryFolder}" echo "Copying from: ${binariesSourceFolder} to: ${binariesDestFolder}" fileOperations([folderCopyOperation(destinationFolderPath: binariesDestFolder, sourceFolderPath: binariesSourceFolder)]) } From 134f5497362b537147699257f3ac79322ca9ff61 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Feb 2019 23:14:18 +0000 Subject: [PATCH 0716/1971] Update build script to use updated Common_scripts - Installers --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index b9a36d4..63ca2de 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -67,7 +67,7 @@ def startnonbuild(script, autobuildpath = autobuildroot, commonscriptspath = com conditionalclean() def meta = getmetafolderscript().metareset(script) - meta.productinfo.set("", "", "") + meta.productinfo.set("Non-build-product", "Non-build-subcomponent", "Non-build-jira-key") def now = new Date() now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) From 3264655356b72f27aa28e5fbd4ccb5a77a47efd3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 13 Feb 2019 18:20:05 +0000 Subject: [PATCH 0717/1971] Compare hps_0.h files --- differences/file.groovy | 12 ++++++++++++ differences/json.groovy | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 differences/file.groovy diff --git a/differences/file.groovy b/differences/file.groovy new file mode 100644 index 0000000..f5e93da --- /dev/null +++ b/differences/file.groovy @@ -0,0 +1,12 @@ +def comparefiles(importedfile, currentfile) { + if (isUnix()) { + sh """ + diff -c <"${importedfile}" <"${currentfile}" + """ + } + else { + error "Windows not currently supporting file comparison" + } +} + +return this; diff --git a/differences/json.groovy b/differences/json.groovy index 19b7cf6..5ac37f2 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -1,12 +1,10 @@ def comparefiles(importedjsonfile, currentjsonfile) { - env.IMPORTED_JSON="${importedjsonfile}" - env.CURRENT_JSON="${currentjsonfile}" if (isUnix()) { sh """ which jq if [ \$? -ne 0 ]; then exit 1; fi # jq -S sorts json output - diff -c <(jq -S . "${IMPORTED_JSON}") <(jq -S . "${CURRENT_JSON}") + diff -c <(jq -S . "${importedjsonfile}") <(jq -S . "${currentjsonfile}") """ } else { From 2013c582c73ae5adf5b1c0bc26da48963faac83a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 13 Feb 2019 19:01:59 +0000 Subject: [PATCH 0718/1971] Compare hps_0.h files --- differences/file.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/file.groovy b/differences/file.groovy index f5e93da..dee78b9 100644 --- a/differences/file.groovy +++ b/differences/file.groovy @@ -1,7 +1,7 @@ def comparefiles(importedfile, currentfile) { if (isUnix()) { sh """ - diff -c <"${importedfile}" <"${currentfile}" + diff -c "${importedfile}" "${currentfile}" """ } else { From 06c096fc7c054611d8847394e52bf1916163633b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 13 Feb 2019 19:17:49 +0000 Subject: [PATCH 0719/1971] Compare hps_0.h files --- differences/file.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/differences/file.groovy b/differences/file.groovy index dee78b9..ab4102f 100644 --- a/differences/file.groovy +++ b/differences/file.groovy @@ -1,7 +1,11 @@ -def comparefiles(importedfile, currentfile) { +def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { if (isUnix()) { + def wsparameter = "-w" + if (!ignorewhitespace) { + wsparameter = "" + } sh """ - diff -c "${importedfile}" "${currentfile}" + diff -c ${wsparameter} "${importedfile}" "${currentfile}" """ } else { From f61e44d6dbe4ddfb39935d26dd14eb6edaf7a251 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Feb 2019 13:42:58 +0000 Subject: [PATCH 0720/1971] Debug publishable list addition --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 934ffe3..52ceb06 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -486,6 +486,7 @@ class MetaInfo extends GISJsonSerialised { void addPublishable(String filepath) { def PublishableInfo pi = new PublishableInfo(script, filepath) + script.echo("Adding ${filepath} to publishable list") publishableinfo.add(pi) } From f37be2706ac69392bad0da925d25e1702cf80652 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 16:07:52 +0000 Subject: [PATCH 0721/1971] Try to create WORKSPACE relative paths --- meta/folder.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 52ceb06..245d961 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -554,13 +554,16 @@ class MetaInfo extends GISJsonSerialised { } String relativize(String path) { - def Path thispath = Paths.get(path) - if (thispath.startsWith(script.WORKSPACE)) { + def Path mypath = Paths.get(path) + String pathRelative + if (mypath.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) - def Path wsrelativePath = wspath.relativize(thispath) - return wsrelativePath.toString() + def Path wsrelativePath = wspath.relativize(mypath) + pathRelative = wsrelativePath.toString() + } else { + pathRelative = mypath.toString() } - return path + return pathRelative } static String metafilepath() { From 0f636ea4276e66e4656eaf8afb2e9ae760abba27 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 16:07:52 +0000 Subject: [PATCH 0722/1971] Try to create WORKSPACE relative paths --- meta/folder.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 52ceb06..245d961 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -554,13 +554,16 @@ class MetaInfo extends GISJsonSerialised { } String relativize(String path) { - def Path thispath = Paths.get(path) - if (thispath.startsWith(script.WORKSPACE)) { + def Path mypath = Paths.get(path) + String pathRelative + if (mypath.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) - def Path wsrelativePath = wspath.relativize(thispath) - return wsrelativePath.toString() + def Path wsrelativePath = wspath.relativize(mypath) + pathRelative = wsrelativePath.toString() + } else { + pathRelative = mypath.toString() } - return path + return pathRelative } static String metafilepath() { From bdcc0833e8dc003f022c9eaa7def5370403ea0de Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:05:25 +0000 Subject: [PATCH 0723/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 245d961..d7cbc4f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -556,12 +556,15 @@ class MetaInfo extends GISJsonSerialised { String relativize(String path) { def Path mypath = Paths.get(path) String pathRelative - if (mypath.startsWith(script.WORKSPACE)) { + script.echo("Seeing if ${path} begins with from ${script.WORKSPACE}") + if (path.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) pathRelative = wsrelativePath.toString() + script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}" } else { pathRelative = mypath.toString() + script.echo("Path relative is unchanged: ${pathRelative}" } return pathRelative } From dc6e7c6b1d5a0e54aec98ce61539ae27b855c2dd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:05:25 +0000 Subject: [PATCH 0724/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 245d961..d7cbc4f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -556,12 +556,15 @@ class MetaInfo extends GISJsonSerialised { String relativize(String path) { def Path mypath = Paths.get(path) String pathRelative - if (mypath.startsWith(script.WORKSPACE)) { + script.echo("Seeing if ${path} begins with from ${script.WORKSPACE}") + if (path.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) pathRelative = wsrelativePath.toString() + script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}" } else { pathRelative = mypath.toString() + script.echo("Path relative is unchanged: ${pathRelative}" } return pathRelative } From 8bfaeda1e14ed816aeefebc6d07a595187dd1dfa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:07:33 +0000 Subject: [PATCH 0725/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d7cbc4f..0c94a12 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -561,7 +561,7 @@ class MetaInfo extends GISJsonSerialised { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) pathRelative = wsrelativePath.toString() - script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}" + script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") } else { pathRelative = mypath.toString() script.echo("Path relative is unchanged: ${pathRelative}" From de9e4d82ed9664de567db925c1213be31cc8e84a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:07:33 +0000 Subject: [PATCH 0726/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d7cbc4f..0c94a12 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -561,7 +561,7 @@ class MetaInfo extends GISJsonSerialised { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) pathRelative = wsrelativePath.toString() - script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}" + script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") } else { pathRelative = mypath.toString() script.echo("Path relative is unchanged: ${pathRelative}" From cd1226b83acc540ad3fb9754b3903b4970d42058 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:18:29 +0000 Subject: [PATCH 0727/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0c94a12..f6797a2 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -564,7 +564,7 @@ class MetaInfo extends GISJsonSerialised { script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") } else { pathRelative = mypath.toString() - script.echo("Path relative is unchanged: ${pathRelative}" + script.echo("Path relative is unchanged: ${pathRelative}") } return pathRelative } From 6ca84a13fecedfda50a8a8f594bf761b60a26fc9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:18:29 +0000 Subject: [PATCH 0728/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0c94a12..f6797a2 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -564,7 +564,7 @@ class MetaInfo extends GISJsonSerialised { script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") } else { pathRelative = mypath.toString() - script.echo("Path relative is unchanged: ${pathRelative}" + script.echo("Path relative is unchanged: ${pathRelative}") } return pathRelative } From 3926df768bf61fdd3ef92980598c5f8fc65eb2d8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:21:14 +0000 Subject: [PATCH 0729/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f6797a2..ce041d0 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -556,7 +556,7 @@ class MetaInfo extends GISJsonSerialised { String relativize(String path) { def Path mypath = Paths.get(path) String pathRelative - script.echo("Seeing if ${path} begins with from ${script.WORKSPACE}") + script.echo("Seeing if ${path} begins with ${script.WORKSPACE}") if (path.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) From d66b7b80d602550ccae4aca1b1483f36f19b4a67 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:21:14 +0000 Subject: [PATCH 0730/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f6797a2..ce041d0 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -556,7 +556,7 @@ class MetaInfo extends GISJsonSerialised { String relativize(String path) { def Path mypath = Paths.get(path) String pathRelative - script.echo("Seeing if ${path} begins with from ${script.WORKSPACE}") + script.echo("Seeing if ${path} begins with ${script.WORKSPACE}") if (path.startsWith(script.WORKSPACE)) { def Path wspath = Paths.get(script.WORKSPACE) def Path wsrelativePath = wspath.relativize(mypath) From eb37e310949a8bbceb71dac47c5285a89b9b1b6d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:45:39 +0000 Subject: [PATCH 0731/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ce041d0..74c00cc 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -553,17 +553,14 @@ class MetaInfo extends GISJsonSerialised { deserialiseJson(rawmeta) } - String relativize(String path) { - def Path mypath = Paths.get(path) + String relativize(String mypath) { String pathRelative - script.echo("Seeing if ${path} begins with ${script.WORKSPACE}") - if (path.startsWith(script.WORKSPACE)) { - def Path wspath = Paths.get(script.WORKSPACE) - def Path wsrelativePath = wspath.relativize(mypath) - pathRelative = wsrelativePath.toString() - script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") + 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.toString() + pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } return pathRelative From 736f0ece675736032cc8b1dc1f33c313015648e4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 17:45:39 +0000 Subject: [PATCH 0732/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ce041d0..74c00cc 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -553,17 +553,14 @@ class MetaInfo extends GISJsonSerialised { deserialiseJson(rawmeta) } - String relativize(String path) { - def Path mypath = Paths.get(path) + String relativize(String mypath) { String pathRelative - script.echo("Seeing if ${path} begins with ${script.WORKSPACE}") - if (path.startsWith(script.WORKSPACE)) { - def Path wspath = Paths.get(script.WORKSPACE) - def Path wsrelativePath = wspath.relativize(mypath) - pathRelative = wsrelativePath.toString() - script.echo("Extracted ${pathRelative} from ${wspath.toString()} and ${mypath.toString()}") + 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.toString() + pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } return pathRelative From c8fa1243fd3c38062517254701a26c7bf11414d7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 18:07:16 +0000 Subject: [PATCH 0733/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 74c00cc..1f90c61 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -563,6 +563,13 @@ class MetaInfo extends GISJsonSerialised { pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } + // Strip leading / if any + pathRelative = pathRelative.replaceAll("^/+", "") + // Strip leading \ if any + pathRelative = pathRelative.replaceAll("^\\+", "") + + script.echo("Path relative is ${pathRelative}") + return pathRelative } From d2bd59bfa5c3a6d922a118e86fc46e707f4b5f90 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Feb 2019 18:07:16 +0000 Subject: [PATCH 0734/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 74c00cc..1f90c61 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -563,6 +563,13 @@ class MetaInfo extends GISJsonSerialised { pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } + // Strip leading / if any + pathRelative = pathRelative.replaceAll("^/+", "") + // Strip leading \ if any + pathRelative = pathRelative.replaceAll("^\\+", "") + + script.echo("Path relative is ${pathRelative}") + return pathRelative } From 4425de19dcbca4b1e9f8843040f7c0a4052bae84 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:06:38 +0000 Subject: [PATCH 0735/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1f90c61..3a4d464 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -564,9 +564,11 @@ class MetaInfo extends GISJsonSerialised { script.echo("Path relative is unchanged: ${pathRelative}") } // Strip leading / if any - pathRelative = pathRelative.replaceAll("^/+", "") + pathRelative = pathRelative.replaceAll('^/+', '') // Strip leading \ if any - pathRelative = pathRelative.replaceAll("^\\+", "") + pathRelative = pathRelative.replaceAll('^\\+', '') + // Convert \ with / + pathRelative = pathRelative.replaceAll('\\', '/') script.echo("Path relative is ${pathRelative}") From 4c7726123e43370c5c6397b678615717ec11e8ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:06:38 +0000 Subject: [PATCH 0736/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1f90c61..3a4d464 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -564,9 +564,11 @@ class MetaInfo extends GISJsonSerialised { script.echo("Path relative is unchanged: ${pathRelative}") } // Strip leading / if any - pathRelative = pathRelative.replaceAll("^/+", "") + pathRelative = pathRelative.replaceAll('^/+', '') // Strip leading \ if any - pathRelative = pathRelative.replaceAll("^\\+", "") + pathRelative = pathRelative.replaceAll('^\\+', '') + // Convert \ with / + pathRelative = pathRelative.replaceAll('\\', '/') script.echo("Path relative is ${pathRelative}") From d7ecd0f1809de688e109ffefdddc8cc1dd7069cb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:23:02 +0000 Subject: [PATCH 0737/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 3a4d464..adfee97 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -568,7 +568,7 @@ class MetaInfo extends GISJsonSerialised { // Strip leading \ if any pathRelative = pathRelative.replaceAll('^\\+', '') // Convert \ with / - pathRelative = pathRelative.replaceAll('\\', '/') + pathRelative = pathRelative.replace('\\', '/') script.echo("Path relative is ${pathRelative}") From da35fd3aa07e1ee84822752e74a9b2fcc3a5ec3e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:23:02 +0000 Subject: [PATCH 0738/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 3a4d464..adfee97 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -568,7 +568,7 @@ class MetaInfo extends GISJsonSerialised { // Strip leading \ if any pathRelative = pathRelative.replaceAll('^\\+', '') // Convert \ with / - pathRelative = pathRelative.replaceAll('\\', '/') + pathRelative = pathRelative.replace('\\', '/') script.echo("Path relative is ${pathRelative}") From dedcdfd5e964d005d59ec7cffa50b0ae7bf3715d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:46:23 +0000 Subject: [PATCH 0739/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index adfee97..f9d4bf3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -563,12 +563,10 @@ class MetaInfo extends GISJsonSerialised { pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } + // Convert \ with / + pathRelative = pathRelative.tokenize('\\').join('/') // Strip leading / if any pathRelative = pathRelative.replaceAll('^/+', '') - // Strip leading \ if any - pathRelative = pathRelative.replaceAll('^\\+', '') - // Convert \ with / - pathRelative = pathRelative.replace('\\', '/') script.echo("Path relative is ${pathRelative}") From 06ca80c596d36ce9c758edd6982132eec3e3c44a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Feb 2019 08:46:23 +0000 Subject: [PATCH 0740/1971] offsetpath field in meta files was absolute; should be relative to workspace --- meta/folder.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index adfee97..f9d4bf3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -563,12 +563,10 @@ class MetaInfo extends GISJsonSerialised { pathRelative = mypath script.echo("Path relative is unchanged: ${pathRelative}") } + // Convert \ with / + pathRelative = pathRelative.tokenize('\\').join('/') // Strip leading / if any pathRelative = pathRelative.replaceAll('^/+', '') - // Strip leading \ if any - pathRelative = pathRelative.replaceAll('^\\+', '') - // Convert \ with / - pathRelative = pathRelative.replace('\\', '/') script.echo("Path relative is ${pathRelative}") From c7d58a0e48e912ac5156daef3b74544e223675a4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Feb 2019 00:01:14 +0000 Subject: [PATCH 0741/1971] Do a dependency check on each binary produced --- compile/eclipsebuild/eclipseds5build.groovy | 42 ++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 93a8064..d333af3 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -28,22 +28,50 @@ 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}") + result = sh( script: """ + // Print out dependencies of the built file + readelf -d "${srcFileExpanded}" | grep NEEDED + if [ \$? -ne 0 ]; then exit 1; fi + """, + returnStatus: true + ) + if (result != 0) { + return result + } + } + } + } + return result +} + def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { def result = 0 + def destFolder = "" + def srcFile = "" + def srcFileExpanded = "" for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - env.destFolder = "${exportfolder}/${build_variant}" - env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + destFolder = "${exportfolder}/${build_variant}" + srcFile = "${WORKSPACE}/${exportpath}" + srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" - env.destFolder = "${exportfolder}/${project}" - env.srcFileExpanded = "${WORKSPACE}/${exportpath}" + destFolder = "${exportfolder}/${project}" + srcFileExpanded = "${WORKSPACE}/${exportpath}" } } dir (env.destFolder) { @@ -162,6 +190,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou """ } } + result = doCheck(exportpathlist, build_variant) + if (result != 0) { + error "Failed to check files...." + } result = doExport(exportfolder, exportpathlist, "", build_variant) if (result != 0) { error "Failed to copy...." From a7da6556d91007e844760c552e804cce87f312ca Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Feb 2019 00:01:14 +0000 Subject: [PATCH 0742/1971] Do a dependency check on each binary produced --- compile/eclipsebuild/eclipseds5build.groovy | 42 ++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 93a8064..d333af3 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -28,22 +28,50 @@ 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}") + result = sh( script: """ + // Print out dependencies of the built file + readelf -d "${srcFileExpanded}" | grep NEEDED + if [ \$? -ne 0 ]; then exit 1; fi + """, + returnStatus: true + ) + if (result != 0) { + return result + } + } + } + } + return result +} + def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { def result = 0 + def destFolder = "" + def srcFile = "" + def srcFileExpanded = "" for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - env.destFolder = "${exportfolder}/${build_variant}" - env.srcFile = "${WORKSPACE}/${exportpath}" - env.srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") + destFolder = "${exportfolder}/${build_variant}" + srcFile = "${WORKSPACE}/${exportpath}" + srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" - env.destFolder = "${exportfolder}/${project}" - env.srcFileExpanded = "${WORKSPACE}/${exportpath}" + destFolder = "${exportfolder}/${project}" + srcFileExpanded = "${WORKSPACE}/${exportpath}" } } dir (env.destFolder) { @@ -162,6 +190,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou """ } } + result = doCheck(exportpathlist, build_variant) + if (result != 0) { + error "Failed to check files...." + } result = doExport(exportfolder, exportpathlist, "", build_variant) if (result != 0) { error "Failed to copy...." From 1f771c6290ba633f262935293a0b59cb913ddc52 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Feb 2019 00:33:36 +0000 Subject: [PATCH 0743/1971] Do a dependency check on each binary produced --- compile/eclipsebuild/eclipseds5build.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index d333af3..2dbd6ea 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -74,7 +74,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { srcFileExpanded = "${WORKSPACE}/${exportpath}" } } - dir (env.destFolder) { + dir (destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { result = sh( script: """ @@ -88,10 +88,10 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } } else { - result = bat( script: ''' - copy \"%srcFileExpanded%\" \"%destFolder%\" + result = bat( script: """ + copy "${srcFileExpanded}" "${destFolder}" if errorlevel 1 EXIT /b 1 - ''', + """, returnStatus: true ) if (result != 0) { From 4c7053017eadcc4d6fe308bf6abbe087de31f0dc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Feb 2019 00:33:36 +0000 Subject: [PATCH 0744/1971] Do a dependency check on each binary produced --- compile/eclipsebuild/eclipseds5build.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index d333af3..2dbd6ea 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -74,7 +74,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { srcFileExpanded = "${WORKSPACE}/${exportpath}" } } - dir (env.destFolder) { + dir (destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" if (isUnix()) { result = sh( script: """ @@ -88,10 +88,10 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } } else { - result = bat( script: ''' - copy \"%srcFileExpanded%\" \"%destFolder%\" + result = bat( script: """ + copy "${srcFileExpanded}" "${destFolder}" if errorlevel 1 EXIT /b 1 - ''', + """, returnStatus: true ) if (result != 0) { From 2ace18a3793095da848291cab4eae63e00ea20c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Feb 2019 07:55:15 +0000 Subject: [PATCH 0745/1971] Do a dependency check on each binary produced --- compile/eclipsebuild/eclipseds5build.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 2dbd6ea..302b4f8 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -37,8 +37,9 @@ def doCheck(checkpathlist, 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}" result = sh( script: """ - // Print out dependencies of the built file readelf -d "${srcFileExpanded}" | grep NEEDED if [ \$? -ne 0 ]; then exit 1; fi """, From 49f1b99e477c945156e9caaa4215ff8659a360eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Feb 2019 07:55:15 +0000 Subject: [PATCH 0746/1971] Do a dependency check on each binary produced --- compile/eclipsebuild/eclipseds5build.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 2dbd6ea..302b4f8 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -37,8 +37,9 @@ def doCheck(checkpathlist, 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}" result = sh( script: """ - // Print out dependencies of the built file readelf -d "${srcFileExpanded}" | grep NEEDED if [ \$? -ne 0 ]; then exit 1; fi """, From c4247d45ed5bfcfeab751fdb6595158f51c14bdc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 1 Mar 2019 18:37:55 +0000 Subject: [PATCH 0747/1971] Add publish item selector script --- publish/publish_item_select.groovy | 90 ++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 publish/publish_item_select.groovy diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy new file mode 100755 index 0000000..747b9f6 --- /dev/null +++ b/publish/publish_item_select.groovy @@ -0,0 +1,90 @@ +#!/usr/local/bin/groovy +metarepo="git@hydra:jenkinsautobuild/Common_scripts.git" + +import hudson.model.* + +def log(message) { + boolean dolog = true + if (dolog) { + println message + } +} + +println "hello" + +def createfolder(String folder) { + def sout = new StringBuilder() + def serr = new StringBuilder() + + log("Creating directory: ${folder}") + def s = ['mkdir', '-p', folder].execute() + s.consumeProcessOutput(sout, serr) + s.waitFor() + + log("Out: ${sout} Err: ${serr}") + return [sout, serr] +} + +def gitCloneOrPull(String repo, String folder) { + def sout = new StringBuilder() + def serr = new StringBuilder() + + if (!new File(folder).exists()) { + log("Cloning: ${repo} to: ${folder}") + createfolder(folder) + def s = ['git', 'clone', repo, folder].execute() + s.consumeProcessOutput(sout, serr) + s.waitFor() + } else { + log("Pull in: ${folder}") + def s = ['/bin/sh', '-c', "cd ${folder}"].execute() | ['git', 'pull'].execute() + s.consumeProcessOutput(sout, serr) + s.waitFor() + } + + log("Out: ${sout} Err: ${serr}") + return [sout, serr] +} + +def String makeworking() { + def r = ['whoami'].execute() + r.waitFor() + def user = r.text.trim() + + log("User is ${user}") + def rootfolder = "/home/${user}/tmp" + createfolder(rootfolder) + + def commonscripts = "${rootfolder}/commonscripts" + gitCloneOrPull(metarepo, commonscripts); + +} + +def List getItems() { + def List items = new ArrayList() + try { + log("Getting items") + def p = ['pwd'].execute() + p.waitFor() + items.add(p.text) + items.add(metarepo) + items.add(metalevels) + + items.add("ATLAS_SERVICES CORE_INSTALL installers/**") + + items.add("Item 2") + items.add("Item 3") + return items + } catch (Exception e) { + items.add("Error ${e}") + return items + } +} + +makeworking() +count = 0 +for (item in getItems()) { + log (count) + count += 1 + log (item) +} \ No newline at end of file From 07c3e7ce16f61f387e878f610c76da079bf79ae0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 1 Mar 2019 18:51:12 +0000 Subject: [PATCH 0748/1971] Add publish item selector script --- publish/publish_item_select.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index 747b9f6..50090a8 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -29,7 +29,7 @@ def gitCloneOrPull(String repo, String folder) { def sout = new StringBuilder() def serr = new StringBuilder() - if (!new File(folder).exists()) { + if (!(new File(folder).exists())) { log("Cloning: ${repo} to: ${folder}") createfolder(folder) def s = ['git', 'clone', repo, folder].execute() @@ -37,7 +37,7 @@ def gitCloneOrPull(String repo, String folder) { s.waitFor() } else { log("Pull in: ${folder}") - def s = ['/bin/sh', '-c', "cd ${folder}"].execute() | ['git', 'pull'].execute() + def s = ["/bin/sh -c cd ${folder}; git pull"].execute() s.consumeProcessOutput(sout, serr) s.waitFor() } From fdff1c1ef7f568673752e35d1db2c138d377a9f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 1 Mar 2019 18:55:44 +0000 Subject: [PATCH 0749/1971] Add publish item selector script --- publish/publish_item_select.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index 50090a8..68215ff 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -37,7 +37,7 @@ def gitCloneOrPull(String repo, String folder) { s.waitFor() } else { log("Pull in: ${folder}") - def s = ["/bin/sh -c cd ${folder}; git pull"].execute() + def s = ["/bin/bash -c cd ${folder}; pwd; git pull"].execute() s.consumeProcessOutput(sout, serr) s.waitFor() } From d7a8dd14add18cd947df7e4dac99331efe898172 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 1 Mar 2019 19:28:47 +0000 Subject: [PATCH 0750/1971] Add publish item selector script --- publish/publish_item_select.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index 68215ff..56f7e37 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -37,7 +37,7 @@ def gitCloneOrPull(String repo, String folder) { s.waitFor() } else { log("Pull in: ${folder}") - def s = ["/bin/bash -c cd ${folder}; pwd; git pull"].execute() + def s = ['git', 'pull'].execute(null, new File(folder)) s.consumeProcessOutput(sout, serr) s.waitFor() } From 6cc9f1928d2dc28693bbc10f1165b80a3724b688 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 1 Mar 2019 23:34:08 +0000 Subject: [PATCH 0751/1971] Add publish item selector script --- publish/publish_item_select.groovy | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index 56f7e37..ef39d78 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -1,5 +1,7 @@ #!/usr/local/bin/groovy -metarepo="git@hydra:jenkinsautobuild/Common_scripts.git" +metarepoext = "git@hydra:HMB_XR_5601_Releases/hmb_xr_5601_whole.git" + +commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git" import hudson.model.* @@ -46,6 +48,15 @@ def gitCloneOrPull(String repo, String folder) { return [sout, serr] } +def loadmetaclass(String commonscripts) { + def metafolderscriptfile = "${commonscripts}/meta/folder.groovy" + log("Loading script: ${metafolderscriptfile}") + def script = new GroovyScriptEngine('.').with { + loadScriptByName(metafolderscriptfile) + } + return script +} + def String makeworking() { def r = ['whoami'].execute() r.waitFor() @@ -56,8 +67,10 @@ def String makeworking() { createfolder(rootfolder) def commonscripts = "${rootfolder}/commonscripts" - gitCloneOrPull(metarepo, commonscripts); + gitCloneOrPull(commonscriptsrepo, commonscripts); + def metascript = loadmetaclass(commonscripts) + return metascript } def List getItems() { @@ -67,7 +80,7 @@ def List getItems() { def p = ['pwd'].execute() p.waitFor() items.add(p.text) - items.add(metarepo) + items.add(metarepoext) items.add(metalevels) items.add("ATLAS_SERVICES CORE_INSTALL installers/**") @@ -82,6 +95,7 @@ def List getItems() { } makeworking() +loadmetaclass() count = 0 for (item in getItems()) { log (count) From 39d54ecfa090ffa7d6f69a97c4b5ca66ccacfca2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 2 Mar 2019 11:17:25 +0000 Subject: [PATCH 0752/1971] Add publish item selector script --- meta/folder.groovy | 15 +++++++++- publish/publish_item_select.groovy | 48 ++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f9d4bf3..9f747ad 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1,5 +1,6 @@ import java.nio.file.Paths import java.nio.file.Path +import groovy.json.JsonSlurperClassic abstract class GISJsonSerialised implements Serializable { def script @@ -552,7 +553,13 @@ class MetaInfo extends GISJsonSerialised { def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } - + + def deserialiseJsonSlurper(String filepath) { + def jsonfile = readFile(file: filepath) + def rawmeta = new JsonSlurperClassic().parseText(jsonfile) + deserialiseJson(rawmeta) + } + String relativize(String mypath) { String pathRelative script.echo("Seeing if ${mypath} begins with ${script.WORKSPACE}") @@ -726,4 +733,10 @@ MetaInfo metafromfolder(String folder = "") { return buildmeta } +MetaInfo metafromfolderSlurper(String folder = "") { + MetaInfo buildmeta = new MetaInfo(this) + buildmeta.deserialiseJsonSlurper("${folder}/${MetaInfo.metafilepath()}") + return buildmeta +} + return this; diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index ef39d78..7eeae29 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -1,5 +1,7 @@ #!/usr/local/bin/groovy +jobname="anything" metarepoext = "git@hydra:HMB_XR_5601_Releases/hmb_xr_5601_whole.git" +metalevels = 2 commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git" @@ -48,13 +50,25 @@ def gitCloneOrPull(String repo, String folder) { return [sout, serr] } -def loadmetaclass(String commonscripts) { +def loadmetaclass(String commonscripts, String metafolder) { def metafolderscriptfile = "${commonscripts}/meta/folder.groovy" log("Loading script: ${metafolderscriptfile}") - def script = new GroovyScriptEngine('.').with { - loadScriptByName(metafolderscriptfile) - } - return script + + GroovyShell shell = new GroovyShell() + def metafolderscript = shell.parse(new File(metafolderscriptfile)) + log("metafolderscript is ${metafolderscript.getClass()}") + def meta = metafolderscript.metafromfolder(metafolder) + log("meta is ${meta.getClass()}") + + + + //Class groovyClass = new GroovyClassLoader(getClass().getClassLoader()).parseClass(metafolderscriptfile) + //log("groovyClass is ${groovyClass.getClass()}") + //GroovyObject metafolderobject = (GroovyObject) groovyClass.newInstance() + //log("metafolderobject is ${metafolderobject.getClass()}") + //metaObject = new metafolderobject.MetaInfo(this) + //log("metaobject is ${metaObject.getClass()}") + return meta } def String makeworking() { @@ -67,10 +81,19 @@ def String makeworking() { createfolder(rootfolder) def commonscripts = "${rootfolder}/commonscripts" - gitCloneOrPull(commonscriptsrepo, commonscripts); + gitCloneOrPull(commonscriptsrepo, commonscripts) - def metascript = loadmetaclass(commonscripts) - return metascript + // Clone or pull the relevant meta repo + def metareporoot = "${rootfolder}/${jobname}" + gitCloneOrPull(metarepoext, metareporoot) + def metafolder = "${metareporoot}/meta" + + // Load the meta folder class that interprets the meta repo + def metascript = loadmetaclass(commonscripts, metafolder) + + // Read in the meta + meta = metascript.metafromfolder(metafolder) + return meta } def List getItems() { @@ -79,7 +102,7 @@ def List getItems() { log("Getting items") def p = ['pwd'].execute() p.waitFor() - items.add(p.text) + items.add(p.text.trim()) items.add(metarepoext) items.add(metalevels) @@ -95,10 +118,9 @@ def List getItems() { } makeworking() -loadmetaclass() count = 0 -for (item in getItems()) { - log (count) +def items = getItems() +for (item in items) { count += 1 - log (item) + log ("${count}: ${item}") } \ No newline at end of file From 6746c4dccf1ca52ad77424e1917a989880107542 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 2 Mar 2019 11:24:26 +0000 Subject: [PATCH 0753/1971] Add publish item selector script --- meta/folder.groovy | 5 +++-- publish/publish_item_select.groovy | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9f747ad..d751f5e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -555,8 +555,9 @@ class MetaInfo extends GISJsonSerialised { } def deserialiseJsonSlurper(String filepath) { - def jsonfile = readFile(file: filepath) - def rawmeta = new JsonSlurperClassic().parseText(jsonfile) + File jsonfile = new File(filepath) + def jsonfiletext = jsonfile.getText() + def rawmeta = new JsonSlurperClassic().parseText(jsonfiletext) deserialiseJson(rawmeta) } diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index 7eeae29..4af7c2b 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -57,7 +57,7 @@ def loadmetaclass(String commonscripts, String metafolder) { GroovyShell shell = new GroovyShell() def metafolderscript = shell.parse(new File(metafolderscriptfile)) log("metafolderscript is ${metafolderscript.getClass()}") - def meta = metafolderscript.metafromfolder(metafolder) + def meta = metafolderscript.metafromfolderSlurper(metafolder) log("meta is ${meta.getClass()}") From 875e21b092e721f5e35183da36a11832d57c18da Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 2 Mar 2019 11:53:57 +0000 Subject: [PATCH 0754/1971] Add publish item selector script --- publish/publish_item_select.groovy | 53 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index 4af7c2b..f02b800 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -60,18 +60,10 @@ def loadmetaclass(String commonscripts, String metafolder) { def meta = metafolderscript.metafromfolderSlurper(metafolder) log("meta is ${meta.getClass()}") - - - //Class groovyClass = new GroovyClassLoader(getClass().getClassLoader()).parseClass(metafolderscriptfile) - //log("groovyClass is ${groovyClass.getClass()}") - //GroovyObject metafolderobject = (GroovyObject) groovyClass.newInstance() - //log("metafolderobject is ${metafolderobject.getClass()}") - //metaObject = new metafolderobject.MetaInfo(this) - //log("metaobject is ${metaObject.getClass()}") return meta } -def String makeworking() { +def makeworking() { def r = ['whoami'].execute() r.waitFor() def user = r.text.trim() @@ -89,37 +81,46 @@ def String makeworking() { def metafolder = "${metareporoot}/meta" // Load the meta folder class that interprets the meta repo - def metascript = loadmetaclass(commonscripts, metafolder) - - // Read in the meta - meta = metascript.metafromfolder(metafolder) + def meta = loadmetaclass(commonscripts, metareporoot) + log("2: meta is ${meta.getClass()}") + return meta } -def List getItems() { - def List items = new ArrayList() +def List getItems(meta) { + def List menuitems = new ArrayList() + def metaitems = meta.releasewalkerunique(metalevels) + log("metaitems is ${metaitems.getClass()}") + try { log("Getting items") def p = ['pwd'].execute() p.waitFor() - items.add(p.text.trim()) - items.add(metarepoext) - items.add(metalevels) + menuitems.add(p.text.trim()) + menuitems.add(metarepoext) + menuitems.add(metalevels) - items.add("ATLAS_SERVICES CORE_INSTALL installers/**") + menuitems.add("ATLAS_SERVICES CORE_INSTALL installers/**") - items.add("Item 2") - items.add("Item 3") - return items + menuitems.add("Item 2") + menuitems.add("Item 3") + for (key in metaitems.keySet()) { + def releaseinfo = metaitems[key] + menuitems.add(releaseinfo.offsetpath) + //MetaInfo meta + } + return menuitems } catch (Exception e) { - items.add("Error ${e}") - return items + menuitems.add("Error ${e}") + return menuitems } } -makeworking() +def meta = makeworking() +log("3: meta is ${meta.getClass()}") + count = 0 -def items = getItems() +def items = getItems(meta) for (item in items) { count += 1 log ("${count}: ${item}") From b480d4a965d99e1463a7f96046b36bcf7491facf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 2 Mar 2019 12:40:37 +0000 Subject: [PATCH 0755/1971] Add publish item selector script --- publish/publish_item_select.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index f02b800..47b64dc 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -1,6 +1,6 @@ #!/usr/local/bin/groovy -jobname="anything" -metarepoext = "git@hydra:HMB_XR_5601_Releases/hmb_xr_5601_whole.git" +jobname="anythingnew" +metarepoext = "git@hydra:print-server-releases/print_server_whole.git" metalevels = 2 commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git" @@ -124,4 +124,6 @@ def items = getItems(meta) for (item in items) { count += 1 log ("${count}: ${item}") -} \ No newline at end of file +} + +return items \ No newline at end of file From 18f6b42a56f11aee83ea1d62b0a8d013d70782fe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 3 Mar 2019 18:02:51 +0000 Subject: [PATCH 0756/1971] Add publish item selector script; Add eclipse groovy project --- publish/.classpath | 9 +++++++ publish/.gitignore | 7 ++++++ publish/.project | 18 ++++++++++++++ .../org.eclipse.jdt.groovy.core.prefs | 3 +++ publish/publish_item_select.groovy | 24 +------------------ 5 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 publish/.classpath create mode 100644 publish/.gitignore create mode 100644 publish/.project create mode 100644 publish/.settings/org.eclipse.jdt.groovy.core.prefs diff --git a/publish/.classpath b/publish/.classpath new file mode 100644 index 0000000..287c1ab --- /dev/null +++ b/publish/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/publish/.gitignore b/publish/.gitignore new file mode 100644 index 0000000..abed335 --- /dev/null +++ b/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/publish/.project b/publish/.project new file mode 100644 index 0000000..5c60328 --- /dev/null +++ b/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/publish/.settings/org.eclipse.jdt.groovy.core.prefs b/publish/.settings/org.eclipse.jdt.groovy.core.prefs new file mode 100644 index 0000000..1e68ed6 --- /dev/null +++ b/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/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index 47b64dc..a7cfa1b 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -5,8 +5,6 @@ metalevels = 2 commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git" -import hudson.model.* - def log(message) { boolean dolog = true if (dolog) { @@ -52,14 +50,10 @@ def gitCloneOrPull(String repo, String folder) { def loadmetaclass(String commonscripts, String metafolder) { def metafolderscriptfile = "${commonscripts}/meta/folder.groovy" - log("Loading script: ${metafolderscriptfile}") GroovyShell shell = new GroovyShell() def metafolderscript = shell.parse(new File(metafolderscriptfile)) - log("metafolderscript is ${metafolderscript.getClass()}") def meta = metafolderscript.metafromfolderSlurper(metafolder) - log("meta is ${meta.getClass()}") - return meta } @@ -68,7 +62,6 @@ def makeworking() { r.waitFor() def user = r.text.trim() - log("User is ${user}") def rootfolder = "/home/${user}/tmp" createfolder(rootfolder) @@ -82,8 +75,6 @@ def makeworking() { // Load the meta folder class that interprets the meta repo def meta = loadmetaclass(commonscripts, metareporoot) - log("2: meta is ${meta.getClass()}") - return meta } @@ -93,21 +84,9 @@ def List getItems(meta) { log("metaitems is ${metaitems.getClass()}") try { - log("Getting items") - def p = ['pwd'].execute() - p.waitFor() - menuitems.add(p.text.trim()) - menuitems.add(metarepoext) - menuitems.add(metalevels) - - menuitems.add("ATLAS_SERVICES CORE_INSTALL installers/**") - - menuitems.add("Item 2") - menuitems.add("Item 3") for (key in metaitems.keySet()) { def releaseinfo = metaitems[key] menuitems.add(releaseinfo.offsetpath) - //MetaInfo meta } return menuitems } catch (Exception e) { @@ -117,10 +96,9 @@ def List getItems(meta) { } def meta = makeworking() -log("3: meta is ${meta.getClass()}") +def items = getItems(meta) count = 0 -def items = getItems(meta) for (item in items) { count += 1 log ("${count}: ${item}") From c4a5e7a36177d7218b0af68c618bb9122516360c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 3 Mar 2019 22:24:58 +0000 Subject: [PATCH 0757/1971] Add publish item selector script; Add eclipse groovy project --- publish/publish_item_select.groovy | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index a7cfa1b..2299f37 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -1,19 +1,18 @@ #!/usr/local/bin/groovy jobname="anythingnew" metarepoext = "git@hydra:print-server-releases/print_server_whole.git" +outputselect = "description" metalevels = 2 +dolog = false commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git" def log(message) { - boolean dolog = true if (dolog) { println message } } -println "hello" - def createfolder(String folder) { def sout = new StringBuilder() def serr = new StringBuilder() @@ -78,6 +77,22 @@ def makeworking() { return meta } +def String outputDescription(menuitems, releaseinfo) { + meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + } +} + +def String outputSelection(menuitems, releaseinfo) { + meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") + } +} + def List getItems(meta) { def List menuitems = new ArrayList() def metaitems = meta.releasewalkerunique(metalevels) @@ -85,8 +100,13 @@ def List getItems(meta) { try { for (key in metaitems.keySet()) { - def releaseinfo = metaitems[key] - menuitems.add(releaseinfo.offsetpath) + def releaseinfo = metaitems[key] + if (outputselect == "description") { + outputDescription(menuitems, releaseinfo) + } + if (outputselect == "selection") { + outputSelection(menuitems, releaseinfo) + } } return menuitems } catch (Exception e) { From 2426465d7db8aab7801a86e1e6c1bbd105baabc7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 3 Mar 2019 22:57:57 +0000 Subject: [PATCH 0758/1971] Add publish item selector script --- publish/publish_item_select.groovy | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy index 2299f37..99e424f 100755 --- a/publish/publish_item_select.groovy +++ b/publish/publish_item_select.groovy @@ -1,8 +1,16 @@ #!/usr/local/bin/groovy -jobname="anythingnew" -metarepoext = "git@hydra:print-server-releases/print_server_whole.git" -outputselect = "description" -metalevels = 2 + +jobnameext = jobname ?: "jobunique" +metarepoext = metarepo ?: "git@hydra:print-server-releases/print_server_whole.git" +outputselectext = outputselect ?: "description" +metalevelsstringext = metalevels ?: "2" + +//jobnameext = "jobunique" +//metarepoext = "git@hydra:print-server-releases/print_server_whole.git" +//outputselectext = "description" +//metalevelsstringext = "2" + +metalevelsext = metalevelsstringext.toInteger() dolog = false commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git" @@ -68,7 +76,7 @@ def makeworking() { gitCloneOrPull(commonscriptsrepo, commonscripts) // Clone or pull the relevant meta repo - def metareporoot = "${rootfolder}/${jobname}" + def metareporoot = "${rootfolder}/${jobnameext}" gitCloneOrPull(metarepoext, metareporoot) def metafolder = "${metareporoot}/meta" @@ -95,16 +103,16 @@ def String outputSelection(menuitems, releaseinfo) { def List getItems(meta) { def List menuitems = new ArrayList() - def metaitems = meta.releasewalkerunique(metalevels) + def metaitems = meta.releasewalkerunique(metalevelsext) log("metaitems is ${metaitems.getClass()}") try { for (key in metaitems.keySet()) { def releaseinfo = metaitems[key] - if (outputselect == "description") { + if (outputselectext == "description") { outputDescription(menuitems, releaseinfo) } - if (outputselect == "selection") { + if (outputselectext == "selection") { outputSelection(menuitems, releaseinfo) } } From bb65e72373fe39938ef6f96b13128db3c53b7e77 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 13 Mar 2019 18:57:10 +0000 Subject: [PATCH 0759/1971] Clone jobs --- versionnumbering/generate.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 4761174..f4f1bdc 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -56,7 +56,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { // Handle: // origin/master // origin/2.0.x -def getVersionPrefix(String sourcebranch) { +def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) { echo "Determining version number prefix from source branch name: ${sourcebranch}" sourcebranch = sourcebranch.toLowerCase() @@ -121,6 +121,9 @@ def getVersionPrefix(String sourcebranch) { versionprefix += "0." } } + if (droptrailingdot == true) { + versionprefix = versionprefix.substring(0, versionprefix.length() - 1); + } echo "Determined version prefix to be: ${versionprefix}" return versionprefix } From 79038df4d3eae65cbfa51ed46a0e82692e4e75ec Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 00:32:36 +0000 Subject: [PATCH 0760/1971] Add filtered publishing --- publish/do.groovy | 66 ++++++++++++++++++++++++++++++++++++++---- publish/publish.groovy | 2 +- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 7844289..7ec8be8 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -5,6 +5,7 @@ summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" summarystring = "" releaserepofolder = "${WORKSPACE}/releaserepos" +filteredreleaserepofolder = "${WORKSPACE}/filteredreleaserepos" tempfolder = "${WORKSPACE}/temp" def resetfolders() { @@ -14,6 +15,9 @@ def resetfolders() { dir(releaserepofolder) { deleteDir() } + dir(filteredreleaserepofolder) { + deleteDir() + } dir(tempfolder) { deleteDir() } @@ -59,7 +63,7 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { } } -def publish(String customer) { +def publish(String customer, String finalreleaserepofolder = releaserepofolder) { summaryappend(" FTP operations: ") def String FTP_CLIENT_LOCATION='ftp' @@ -67,15 +71,41 @@ def publish(String customer) { def String FTP_USER='ftp@globalinkjetsystems.com' def String FTP_CUSTOMER_ROOT="/Customers/${customer}" def String FTP_PASSWORD='ramshorn42' - dir(releaserepofolder) { + dir(finalreleaserepofolder) { summaryappend("FTP operations: Transferring to ${FTP_CUSTOMER_ROOT}") sh """#!/bin/bash - ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" . + ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" . """ summaryappend(", Transferred ") } } +def copydirectory(File dirFrom, File dirTo) { + if (!dirTo.exists()) { + dirTo.mkdir(); + } + dirFrom.eachFile(FILES) { File source -> + File target = new File(dirTo, source.getName()) + target.bytes = source.bytes + } + dirFrom.eachFile(DIRECTORIES) { File source -> + File target = new File(dirTo, source.getName()) + copyLargeDir(source, target) + } +} + +def filteredpublish(itempathstopublish, customer) { + for (String itempath : itempathstopublish) { + def srcpath = "${releaserepofolder}/${itempath}" + File srcpathfile = new File(srcpath) + def dstpath = "${filteredreleaserepofolder}/${itempath}" + File dstpathfile = new File(dstpath) + def dstpathdirname = dstpathfile.getParent() + copydirectory(srcpath, dstpath) + } + publish(customer, filteredreleaserepofolder) +} + def recallcomponent(releaseinfo, String softwarerelease) { def releasemeta = releaseinfo.meta def String uniquefolder = "Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" @@ -102,11 +132,25 @@ def stripgithistory() { } } -def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) { +def convertitemstopublish(String itemstopublishstring) { + def List paths = [] + + def String[] items = itemstopublishstring.split(',') + for(String item : items) { + def String[] pathitems = item.split('#') + def String path = "${pathitems[0]}_${pathitems[1]}/${pathitems[2]}" + paths.add(path) + } + 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(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { int md = maxdepth.toInteger() resetfolders() preconditions() - + // Walk the meta information to a max depth, looking for artifacts to publish def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md) @@ -122,9 +166,19 @@ def publishhierarchy(releasemeta, String customer, String softwarerelease, Strin recallcomponent(releaseinfo, softwarerelease) } stripgithistory() - publish(customer) + + itempathstopublish = convertitemstopublish(itemstopublishstring) + if (itempathstopublish.isEmpty()) { + publish(customer) + } else { + filteredpublish(itempathstopublish, customer) + } return [summarystring, markunstable, unstablereason] } +def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) { + return publishhierarchy(releasemeta, "", customer, softwarerelease, maxdepth) +} + return this; diff --git a/publish/publish.groovy b/publish/publish.groovy index a703c9e..b478a5d 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -44,7 +44,7 @@ pipeline { steps { script { def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH) + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, ITEMS_TO_PUBLISH, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' From 9fad59a8a8c08b0fac03e5160d21212e0cdb9874 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 07:44:00 +0000 Subject: [PATCH 0761/1971] Add filtered publishing --- publish/do.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/publish/do.groovy b/publish/do.groovy index 7ec8be8..996123c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -101,6 +101,7 @@ def filteredpublish(itempathstopublish, customer) { def dstpath = "${filteredreleaserepofolder}/${itempath}" File dstpathfile = new File(dstpath) def dstpathdirname = dstpathfile.getParent() + echo "Copying recursively from ${srcpath} to ${dstpath}" copydirectory(srcpath, dstpath) } publish(customer, filteredreleaserepofolder) @@ -140,6 +141,7 @@ def convertitemstopublish(String itemstopublishstring) { def String[] pathitems = item.split('#') def String path = "${pathitems[0]}_${pathitems[1]}/${pathitems[2]}" paths.add(path) + echo "Selected item to publish: ${path}" } return paths } From 9ee093481dc01085da4318e4ce3e12a32e28270a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 08:34:07 +0000 Subject: [PATCH 0762/1971] Add filtered publishing --- publish/do.groovy | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 996123c..572c2e3 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -41,6 +41,16 @@ def summaryappend(String summary) { summarystring += summary } +def guessreporoot(componentURL) { + if (env.REPOROOT || env.REPOROOT.length() == 0) { + return '' + } + def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') + def reporoot = "${REPOROOT}/${guess}" + echo "Guessing reporoot is: ${reporoot}" + return reporoot +} + gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder @@ -56,7 +66,8 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { publishablePaths.add(publishableitem.filepath) summaryappend("${publishableitem.filepath},") } - gh.gitCheckout(componentURL, revision, repofolder, "", 1, true, publishablePaths) // Shallow clone + def reporoot = guessreporoot(componentURL) + gh.gitCheckout(componentURL, revision, repofolder, reporoot, 1, true, publishablePaths) // Shallow clone } else { summaryappend("None ") From 6a334f56f12470738342f88bdb58c28d06c317db Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 08:42:18 +0000 Subject: [PATCH 0763/1971] Add filtered publishing --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 572c2e3..ade1c3f 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -42,7 +42,7 @@ def summaryappend(String summary) { } def guessreporoot(componentURL) { - if (env.REPOROOT || env.REPOROOT.length() == 0) { + if (!env.REPOROOT || env.REPOROOT.size() == 0) { return '' } def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') From e328e823e4db25723952a5a900c20c9bd7a9cbcd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 08:47:47 +0000 Subject: [PATCH 0764/1971] Add filtered publishing --- publish/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index ade1c3f..14286b9 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -42,11 +42,11 @@ def summaryappend(String summary) { } def guessreporoot(componentURL) { - if (!env.REPOROOT || env.REPOROOT.size() == 0) { + if (!env.REPO_ROOT || env.REPO_ROOT.size() == 0) { return '' } def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') - def reporoot = "${REPOROOT}/${guess}" + def reporoot = "${REPO_ROOT}/${guess}" echo "Guessing reporoot is: ${reporoot}" return reporoot } From 94a966c7cd4e055acf894b34a4edd4bcdd3d4740 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 08:52:40 +0000 Subject: [PATCH 0765/1971] Add filtered publishing --- publish/do.groovy | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 14286b9..e637e8f 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -41,14 +41,9 @@ def summaryappend(String summary) { summarystring += summary } -def guessreporoot(componentURL) { - if (!env.REPO_ROOT || env.REPO_ROOT.size() == 0) { - return '' - } +def guessreporootsuffix(componentURL) { def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') - def reporoot = "${REPO_ROOT}/${guess}" - echo "Guessing reporoot is: ${reporoot}" - return reporoot + return guess } gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") @@ -66,8 +61,8 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { publishablePaths.add(publishableitem.filepath) summaryappend("${publishableitem.filepath},") } - def reporoot = guessreporoot(componentURL) - gh.gitCheckout(componentURL, revision, repofolder, reporoot, 1, true, publishablePaths) // Shallow clone + def reporootsuffix = guessreporootsuffix(componentURL) + gh.gitCheckout(componentURL, revision, reporootsuffix, reporoot, 1, true, publishablePaths) // Shallow clone } else { summaryappend("None ") From 944f732e896a578636bc72be9851eba8032aa0ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 08:54:45 +0000 Subject: [PATCH 0766/1971] Add filtered publishing --- versioncontrol/git.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index f7d10bb..9a313f2 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -19,6 +19,16 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { return new SparseCheckoutPaths(sparsecheckoutpaths) } +def guessreporoot(componentURL) { + if (!env.REPO_ROOT || env.REPO_ROOT.size() == 0) { + return '' + } + def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') + def reporoot = "${REPO_ROOT}/${guess}" + echo "Guessing reporoot is: ${reporoot}" + return reporoot +} + def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { reporootenv = env.REPO_ROOT if (reporootenv != null && repoRootSuffix != "") { From 7c4d1df78d2022f6ba5fcf626d45257d35fee93c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 08:56:32 +0000 Subject: [PATCH 0767/1971] Add filtered publishing --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index e637e8f..20e332a 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -62,7 +62,7 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { summaryappend("${publishableitem.filepath},") } def reporootsuffix = guessreporootsuffix(componentURL) - gh.gitCheckout(componentURL, revision, reporootsuffix, reporoot, 1, true, publishablePaths) // Shallow clone + gh.gitCheckout(componentURL, revision, repofolder, reporootsuffix, 1, true, publishablePaths) // Shallow clone } else { summaryappend("None ") From df095fec9622a63f8591a9a5d65d11979c6af685 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 11:04:52 +0000 Subject: [PATCH 0768/1971] Add filtered publishing --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 20e332a..c3d229e 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -108,7 +108,7 @@ def filteredpublish(itempathstopublish, customer) { File dstpathfile = new File(dstpath) def dstpathdirname = dstpathfile.getParent() echo "Copying recursively from ${srcpath} to ${dstpath}" - copydirectory(srcpath, dstpath) + copydirectory(srcpathfile, dstpathfile) } publish(customer, filteredreleaserepofolder) } From 889d2b87977862468d0358e752395773537e10e4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 11:20:02 +0000 Subject: [PATCH 0769/1971] Add filtered publishing --- publish/do.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index c3d229e..eea1015 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -88,7 +88,7 @@ def publish(String customer, String finalreleaserepofolder = releaserepofolder) def copydirectory(File dirFrom, File dirTo) { if (!dirTo.exists()) { - dirTo.mkdir(); + dirTo.mkdirs(); } dirFrom.eachFile(FILES) { File source -> File target = new File(dirTo, source.getName()) @@ -103,12 +103,12 @@ def copydirectory(File dirFrom, File dirTo) { def filteredpublish(itempathstopublish, customer) { for (String itempath : itempathstopublish) { def srcpath = "${releaserepofolder}/${itempath}" - File srcpathfile = new File(srcpath) + def File srcpathfile = new File(srcpath) def dstpath = "${filteredreleaserepofolder}/${itempath}" - File dstpathfile = new File(dstpath) - def dstpathdirname = dstpathfile.getParent() - echo "Copying recursively from ${srcpath} to ${dstpath}" - copydirectory(srcpathfile, dstpathfile) + def File dstpathfile = new File(dstpath) + def dstpathparentdir = dstpathfile.getParentFile() + echo "Copying recursively from ${srcpath} to ${dstpathparentdir.getName()}" + copydirectory(srcpathfile, dstpathparentdir) } publish(customer, filteredreleaserepofolder) } From e4e83a02f747485eb5f2aa47e63aaa0c9757aea0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 11:26:40 +0000 Subject: [PATCH 0770/1971] Add filtered publishing --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index eea1015..255fae9 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -107,7 +107,7 @@ def filteredpublish(itempathstopublish, customer) { def dstpath = "${filteredreleaserepofolder}/${itempath}" def File dstpathfile = new File(dstpath) def dstpathparentdir = dstpathfile.getParentFile() - echo "Copying recursively from ${srcpath} to ${dstpathparentdir.getName()}" + echo "Copying recursively from ${srcpath} to ${dstpathparentdir.getAbsolutePath()}" copydirectory(srcpathfile, dstpathparentdir) } publish(customer, filteredreleaserepofolder) From 9160ff3e7c3600be0bda79ef55d94520151f5e11 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 11:45:43 +0000 Subject: [PATCH 0771/1971] Add filtered publishing --- publish/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 255fae9..e5e7965 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -90,11 +90,11 @@ def copydirectory(File dirFrom, File dirTo) { if (!dirTo.exists()) { dirTo.mkdirs(); } - dirFrom.eachFile(FILES) { File source -> + dirFrom.eachFile(FileType.FILES) { File source -> File target = new File(dirTo, source.getName()) target.bytes = source.bytes } - dirFrom.eachFile(DIRECTORIES) { File source -> + dirFrom.eachFile(FileType.DIRECTORIES) { File source -> File target = new File(dirTo, source.getName()) copyLargeDir(source, target) } From d868c21c174d8157ef3820dd0bd0ea1dc5699325 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 11:48:13 +0000 Subject: [PATCH 0772/1971] Add filtered publishing --- publish/do.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index e5e7965..7ce778c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -143,12 +143,14 @@ 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) - echo "Selected item to publish: ${path}" + allpaths += path } + echo "Selected item to publish: ${allpaths}" return paths } From 76f24173a3091d3c5b652159adb3769bfe917374 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 11:54:08 +0000 Subject: [PATCH 0773/1971] Add filtered publishing --- publish/do.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 7ce778c..c4bf7eb 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -1,3 +1,5 @@ +import groovy.io.FileType + markunstable = false unstablereason = "" @@ -143,14 +145,14 @@ def convertitemstopublish(String itemstopublishstring) { def List paths = [] def String[] items = itemstopublishstring.split(',') - def String allpaths + 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 + allpaths += "${path}\n" } - echo "Selected item to publish: ${allpaths}" + echo "Selected item to publish:\n${allpaths}" return paths } From 7f8b0cf8667f2df714f1aeefc187e0366b148d4f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 12:54:50 +0000 Subject: [PATCH 0774/1971] Add filtered publishing --- publish/do.groovy | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index c4bf7eb..749497a 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -104,13 +104,16 @@ def copydirectory(File dirFrom, File dirTo) { def filteredpublish(itempathstopublish, customer) { for (String itempath : itempathstopublish) { - def srcpath = "${releaserepofolder}/${itempath}" - def File srcpathfile = new File(srcpath) - def dstpath = "${filteredreleaserepofolder}/${itempath}" - def File dstpathfile = new File(dstpath) - def dstpathparentdir = dstpathfile.getParentFile() - echo "Copying recursively from ${srcpath} to ${dstpathparentdir.getAbsolutePath()}" - copydirectory(srcpathfile, dstpathparentdir) + def srcpathglob = "${releaserepofolder}/${itempath}" + def srcpaths = new FileNameFinder().getFileNames(srcpathglob) + for (String srcpath: srcpaths) { + def File srcpathfile = new File(srcpath) + def dstpath = "${filteredreleaserepofolder}/${itempath}" + def File dstpathfile = new File(dstpath) + def dstpathparentdir = dstpathfile.getParentFile() + echo "Copying recursively from ${srcpath} to ${dstpathparentdir.getAbsolutePath()}" + copydirectory(srcpathfile, dstpathparentdir) + } } publish(customer, filteredreleaserepofolder) } From b822e39e2a591c86fe35ad4ed014fff8a7d5205a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 13:04:43 +0000 Subject: [PATCH 0775/1971] Add filtered publishing --- publish/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 749497a..7262a3a 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -104,8 +104,8 @@ def copydirectory(File dirFrom, File dirTo) { def filteredpublish(itempathstopublish, customer) { for (String itempath : itempathstopublish) { - def srcpathglob = "${releaserepofolder}/${itempath}" - def srcpaths = new FileNameFinder().getFileNames(srcpathglob) + // Convert glob wildcard paths to real paths + def srcpaths = new FileNameFinder().getFileNames(releaserepofolder, itempath) for (String srcpath: srcpaths) { def File srcpathfile = new File(srcpath) def dstpath = "${filteredreleaserepofolder}/${itempath}" From f9a078c895c5facd1c3f8273d416907444169abe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 13:15:54 +0000 Subject: [PATCH 0776/1971] Add filtered publishing --- publish/do.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/publish/do.groovy b/publish/do.groovy index 7262a3a..2d5ee05 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -105,7 +105,9 @@ def copydirectory(File dirFrom, File dirTo) { def filteredpublish(itempathstopublish, customer) { for (String itempath : itempathstopublish) { // Convert glob wildcard paths to real paths + echo "Finding files at base folder: ${releaserepofolder} and glob filter: ${itempath}" def srcpaths = new FileNameFinder().getFileNames(releaserepofolder, itempath) + echo "Paths found: ${srcpaths}" for (String srcpath: srcpaths) { def File srcpathfile = new File(srcpath) def dstpath = "${filteredreleaserepofolder}/${itempath}" From 36ca33077f74c74c11dc747d33e345a165a904ee Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 13:34:40 +0000 Subject: [PATCH 0777/1971] Add filtered publishing --- publish/do.groovy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 2d5ee05..732373e 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -104,9 +104,14 @@ def copydirectory(File dirFrom, File dirTo) { def filteredpublish(itempathstopublish, customer) { for (String itempath : itempathstopublish) { - // Convert glob wildcard paths to real paths - echo "Finding files at base folder: ${releaserepofolder} and glob filter: ${itempath}" - def srcpaths = new FileNameFinder().getFileNames(releaserepofolder, itempath) + def defaultsrcpath = "${releaserepofolder}/${itempath}" + def srcpaths = [ defaultsrcpath ] + if (itempath.endsWith('**') { // Convert glob wildcard paths to real paths + File srcfilepath = new File(defaultsrcpath).getParentFile() + def globpattern = '**' + echo "Finding files at base folder: ${srcfilepath} and glob filter: ${globpattern}" + srcpaths = new FileNameFinder().getFileNames(releaserepofolder, globpattern) + } echo "Paths found: ${srcpaths}" for (String srcpath: srcpaths) { def File srcpathfile = new File(srcpath) From 36ea650ea7dfa7601b75ae3244bfb0a80f3390f7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 13:42:43 +0000 Subject: [PATCH 0778/1971] Add filtered publishing --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 732373e..dcc88ca 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -106,7 +106,7 @@ def filteredpublish(itempathstopublish, customer) { for (String itempath : itempathstopublish) { def defaultsrcpath = "${releaserepofolder}/${itempath}" def srcpaths = [ defaultsrcpath ] - if (itempath.endsWith('**') { // Convert glob wildcard paths to real paths + if (itempath.endsWith('**')) { // Convert glob wildcard paths to real paths File srcfilepath = new File(defaultsrcpath).getParentFile() def globpattern = '**' echo "Finding files at base folder: ${srcfilepath} and glob filter: ${globpattern}" From aa100d8731cea24e75714c07a85e86c011c4040b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 14:21:51 +0000 Subject: [PATCH 0779/1971] Add filtered publishing - different approach for filtering --- publish/do.groovy | 68 ++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index dcc88ca..a10fe51 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -25,6 +25,14 @@ def resetfolders() { } } +def uniquereleasefolder(String softwarerelease, releasemeta) { + return "Software/${PRODUCT_NAME} ${softwarerelease}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" +} + +def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) { + return "${releaserepofolder}/${uniquereleasefolder(softwarerelease, releasemeta)}" +} + def preconditions() { markunstable = false unstablereason = "" @@ -49,7 +57,7 @@ def guessreporootsuffix(componentURL) { } gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { +def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder, itempathstopublish) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") @@ -57,14 +65,18 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder) { 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() + def ArrayList publishablepaths = new ArrayList() if (publishableitems.size() > 0) { for (publishableitem in publishableitems) { - publishablePaths.add(publishableitem.filepath) - summaryappend("${publishableitem.filepath},") + if (itempathstopublish.size() == 0 || publishableitem in itempathstopublish) { + publishablepaths.add(publishableitem.filepath) + summaryappend("${publishableitem.filepath},") + } } + } + if (publishablepaths.size() > 0) { def reporootsuffix = guessreporootsuffix(componentURL) - gh.gitCheckout(componentURL, revision, repofolder, reporootsuffix, 1, true, publishablePaths) // Shallow clone + gh.gitCheckout(componentURL, revision, repofolder, reporootsuffix, 1, true, publishablepaths) // Shallow clone } else { summaryappend("None ") @@ -102,38 +114,22 @@ def copydirectory(File dirFrom, File dirTo) { } } -def filteredpublish(itempathstopublish, customer) { - for (String itempath : itempathstopublish) { - def defaultsrcpath = "${releaserepofolder}/${itempath}" - def srcpaths = [ defaultsrcpath ] - if (itempath.endsWith('**')) { // Convert glob wildcard paths to real paths - File srcfilepath = new File(defaultsrcpath).getParentFile() - def globpattern = '**' - echo "Finding files at base folder: ${srcfilepath} and glob filter: ${globpattern}" - srcpaths = new FileNameFinder().getFileNames(releaserepofolder, globpattern) - } - echo "Paths found: ${srcpaths}" - for (String srcpath: srcpaths) { - def File srcpathfile = new File(srcpath) - def dstpath = "${filteredreleaserepofolder}/${itempath}" - def File dstpathfile = new File(dstpath) - def dstpathparentdir = dstpathfile.getParentFile() - echo "Copying recursively from ${srcpath} to ${dstpathparentdir.getAbsolutePath()}" - copydirectory(srcpathfile, dstpathparentdir) - } - } - publish(customer, filteredreleaserepofolder) +def uniquereleasefolder(String softwarerelease, releasemeta) { + return "Software/${PRODUCT_NAME} ${softwarerelease}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" } -def recallcomponent(releaseinfo, String softwarerelease) { +def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) { + return "${releaserepofolder}/${uniquereleasefolder(softwarerelease, releasemeta)}" +} + +def recallcomponent(releaseinfo, String softwarerelease, itempathstopublish) { def releasemeta = releaseinfo.meta - def String uniquefolder = "Software/${PRODUCT_NAME} ${software_release}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" - def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" - def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" + def String uniquefolderforrepo = uniqueabsoluterreleasefolder(releaserepofolder, softwarerelease, releasemeta) + def String uniquefoldertemp = uniqueabsoluterreleasefolder(tempfolder, softwarerelease, releasemeta) summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") - getcomponentartifacts(releaseinfo, uniquefolderforrepo, uniquefoldertemp) + getcomponentartifacts(releaseinfo, uniquefolderforrepo, uniquefoldertemp, itempathstopublish) summaryappend("\n") } @@ -183,19 +179,13 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, } echo versionuniquecomponent + def itempathstopublish = convertitemstopublish(itemstopublishstring) for (key in componentReleaseInfoVersionUnique.keySet()) { def releaseinfo = componentReleaseInfoVersionUnique[key] - recallcomponent(releaseinfo, softwarerelease) + recallcomponent(releaseinfo, softwarerelease, itempathstopublish) } stripgithistory() - itempathstopublish = convertitemstopublish(itemstopublishstring) - if (itempathstopublish.isEmpty()) { - publish(customer) - } else { - filteredpublish(itempathstopublish, customer) - } - return [summarystring, markunstable, unstablereason] } From e05f6a2da23d5c6d621365322c3fb3200edf3feb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 14:26:14 +0000 Subject: [PATCH 0780/1971] Add filtered publishing - different approach for filtering --- publish/do.groovy | 8 -------- 1 file changed, 8 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index a10fe51..62dea7c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -114,14 +114,6 @@ def copydirectory(File dirFrom, File dirTo) { } } -def uniquereleasefolder(String softwarerelease, releasemeta) { - return "Software/${PRODUCT_NAME} ${softwarerelease}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" -} - -def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) { - return "${releaserepofolder}/${uniquereleasefolder(softwarerelease, releasemeta)}" -} - def recallcomponent(releaseinfo, String softwarerelease, itempathstopublish) { def releasemeta = releaseinfo.meta def String uniquefolderforrepo = uniqueabsoluterreleasefolder(releaserepofolder, softwarerelease, releasemeta) From 755172bc503eb7e7bd9b89c7c67c282b9815e1c2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 14:32:52 +0000 Subject: [PATCH 0781/1971] Add filtered publishing - different approach for filtering --- publish/do.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/publish/do.groovy b/publish/do.groovy index 62dea7c..53fc791 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -65,6 +65,10 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder, ite def String componentURL = releasemeta.releaseinfo.releaserepoURL def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}" def publishableitems = releasemeta.publishableinfo + + echo "itempathstopublish: ${itempathstopublish}" + echo "publishableitems: ${publishableitems}" + def ArrayList publishablepaths = new ArrayList() if (publishableitems.size() > 0) { for (publishableitem in publishableitems) { From 14a6291d3dd39cbddfad5c92cc2715a7c105c4cc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 14:40:16 +0000 Subject: [PATCH 0782/1971] Add filtered publishing - different approach for filtering --- publish/do.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 53fc791..f4aad08 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -66,13 +66,10 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder, ite def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}" def publishableitems = releasemeta.publishableinfo - echo "itempathstopublish: ${itempathstopublish}" - echo "publishableitems: ${publishableitems}" - def ArrayList publishablepaths = new ArrayList() if (publishableitems.size() > 0) { for (publishableitem in publishableitems) { - if (itempathstopublish.size() == 0 || publishableitem in itempathstopublish) { + if (itempathstopublish.size() == 0 || publishableitem.filepath in itempathstopublish) { publishablepaths.add(publishableitem.filepath) summaryappend("${publishableitem.filepath},") } From 19932d9f1549f8d9cfc449f07e9d4127d94b8492 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 14:50:46 +0000 Subject: [PATCH 0783/1971] Add filtered publishing - different approach for filtering --- publish/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/do.groovy b/publish/do.groovy index f4aad08..9073b85 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -69,6 +69,7 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder, ite def ArrayList publishablepaths = new ArrayList() if (publishableitems.size() > 0) { for (publishableitem in publishableitems) { + echo "publishableitem: ${publishableitem.filepath}" if (itempathstopublish.size() == 0 || publishableitem.filepath in itempathstopublish) { publishablepaths.add(publishableitem.filepath) summaryappend("${publishableitem.filepath},") From d112e4f7d187ee601f6ecd1d9c1ba1b12808dafc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 14:59:06 +0000 Subject: [PATCH 0784/1971] Add filtered publishing - different approach for filtering --- publish/do.groovy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 9073b85..80113f3 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -25,8 +25,12 @@ def resetfolders() { } } +def productuniquefolder(releasemeta) { + return "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" +} + def uniquereleasefolder(String softwarerelease, releasemeta) { - return "Software/${PRODUCT_NAME} ${softwarerelease}/${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + return "Software/${PRODUCT_NAME} ${softwarerelease}/${productuniquefolder(releasemeta)}" } def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) { @@ -69,8 +73,9 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder, ite def ArrayList publishablepaths = new ArrayList() if (publishableitems.size() > 0) { for (publishableitem in publishableitems) { - echo "publishableitem: ${publishableitem.filepath}" - if (itempathstopublish.size() == 0 || publishableitem.filepath in itempathstopublish) { + def String productuniquepublishableitem = "${productuniquefolder(releasemeta)}/${publishableitem.filepath}" + echo "publishableitem: ${productuniquepublishableitem}" + if (itempathstopublish.size() == 0 || productuniquepublishableitem in itempathstopublish) { publishablepaths.add(publishableitem.filepath) summaryappend("${publishableitem.filepath},") } From 5cac7a574bdba3dcf6dd31516ff249d7813eebb1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 19 Mar 2019 15:53:27 +0000 Subject: [PATCH 0785/1971] Add filtered publishing - different approach for filtering --- publish/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/do.groovy b/publish/do.groovy index 80113f3..1a54b23 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -184,6 +184,7 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, recallcomponent(releaseinfo, softwarerelease, itempathstopublish) } stripgithistory() + publish(customer) return [summarystring, markunstable, unstablereason] } From fa989ef12f6ac06ac840cc1b562e9590fd242883 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 22 Mar 2019 13:36:45 +0000 Subject: [PATCH 0786/1971] SMB-119 - Not barfing when no substitions occurred --- versionstamping/versionstamper.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 3e59c6f..4c380a6 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -26,15 +26,18 @@ def main(argv): print("Could not find file: {0}\n".format(filetoconvert)) return 1 + count = 0 with open(filetoconvert, 'x') as f: with open(filecopy,'r') as c: fileread = c.read() print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) converted = fileread.replace(pattern, substitute) - #print ("DEBUG: %s "%converted) - print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),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__": From ec6d8e9e0eb1b740c077bb5a6b20cba03159ce45 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 10:37:17 +0000 Subject: [PATCH 0787/1971] Add some checking job scripts --- check/build_meta.groovy | 86 +++++++++++++++++++++++++++++++++++++++++ check/do_meta.groovy | 64 ++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 check/build_meta.groovy create mode 100644 check/do_meta.groovy diff --git a/check/build_meta.groovy b/check/build_meta.groovy new file mode 100644 index 0000000..34eed98 --- /dev/null +++ b/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/check/do_meta.groovy b/check/do_meta.groovy new file mode 100644 index 0000000..75353da --- /dev/null +++ b/check/do_meta.groovy @@ -0,0 +1,64 @@ +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, looking for components to release + def componentReleaseInfo = buildmeta.releasewalkerunique(md) + echo "Unique components:" + def String versioncomponent = "" + for (key in componentReleaseInfo.keySet()) { + def buildinfo = componentReleaseInfo[key] + def offsetpath = buildinfo.offsetpath + versioncomponent += "Key: ${key} Path: ${offsetpath}\n" + } + echo versioncomponent + + return [summarystring, markunstable, unstablereason] +} + +return this; From d1741859bc1a0c42885e702edd9b9fce8dd7d31a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 10:37:17 +0000 Subject: [PATCH 0788/1971] Add some checking job scripts --- check/build_meta.groovy | 86 +++++++++++++++++++++++++++++++++++++++++ check/do_meta.groovy | 64 ++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 check/build_meta.groovy create mode 100644 check/do_meta.groovy diff --git a/check/build_meta.groovy b/check/build_meta.groovy new file mode 100644 index 0000000..34eed98 --- /dev/null +++ b/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/check/do_meta.groovy b/check/do_meta.groovy new file mode 100644 index 0000000..75353da --- /dev/null +++ b/check/do_meta.groovy @@ -0,0 +1,64 @@ +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, looking for components to release + def componentReleaseInfo = buildmeta.releasewalkerunique(md) + echo "Unique components:" + def String versioncomponent = "" + for (key in componentReleaseInfo.keySet()) { + def buildinfo = componentReleaseInfo[key] + def offsetpath = buildinfo.offsetpath + versioncomponent += "Key: ${key} Path: ${offsetpath}\n" + } + echo versioncomponent + + return [summarystring, markunstable, unstablereason] +} + +return this; From f68b9241823cc105c7affccac31a97974aa481d5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 10:44:08 +0000 Subject: [PATCH 0789/1971] Add some checking job scripts --- check/do_meta.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 75353da..6712a11 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -47,14 +47,15 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { resetfolders() preconditions() - // Walk the meta information to a max depth, looking for components to release + // 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 buildinfo = componentReleaseInfo[key] def offsetpath = buildinfo.offsetpath - versioncomponent += "Key: ${key} Path: ${offsetpath}\n" + def abspath = "${buildpathroot}/${offsetpath}" + versioncomponent += "Key: ${key} Path: ${offsetpath} File exists in import: ${fileExists(abspath)}\n" } echo versioncomponent From d75c59e92ada16a48032b23a85d5d5dc89ea097d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 10:44:08 +0000 Subject: [PATCH 0790/1971] Add some checking job scripts --- check/do_meta.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 75353da..6712a11 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -47,14 +47,15 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { resetfolders() preconditions() - // Walk the meta information to a max depth, looking for components to release + // 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 buildinfo = componentReleaseInfo[key] def offsetpath = buildinfo.offsetpath - versioncomponent += "Key: ${key} Path: ${offsetpath}\n" + def abspath = "${buildpathroot}/${offsetpath}" + versioncomponent += "Key: ${key} Path: ${offsetpath} File exists in import: ${fileExists(abspath)}\n" } echo versioncomponent From 719e82d40bea95e56e979389285456611e3dbeb0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:07:24 +0000 Subject: [PATCH 0791/1971] Add some checking job scripts --- check/do_meta.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 6712a11..e01aa41 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -55,7 +55,7 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { def buildinfo = componentReleaseInfo[key] def offsetpath = buildinfo.offsetpath def abspath = "${buildpathroot}/${offsetpath}" - versioncomponent += "Key: ${key} Path: ${offsetpath} File exists in import: ${fileExists(abspath)}\n" + versioncomponent += "Key: ${key}Path: ${offsetpath}File exists in import: ${fileExists(abspath)}\n" } echo versioncomponent From 86fc6f3b5eb22b2dd35a792fce3acfc485a045ec Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:07:24 +0000 Subject: [PATCH 0792/1971] Add some checking job scripts --- check/do_meta.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 6712a11..e01aa41 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -55,7 +55,7 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { def buildinfo = componentReleaseInfo[key] def offsetpath = buildinfo.offsetpath def abspath = "${buildpathroot}/${offsetpath}" - versioncomponent += "Key: ${key} Path: ${offsetpath} File exists in import: ${fileExists(abspath)}\n" + versioncomponent += "Key: ${key}Path: ${offsetpath}File exists in import: ${fileExists(abspath)}\n" } echo versioncomponent From 2cad1ff24eca3e72fc1f0c69f8c41f400f2cd88f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:12:31 +0000 Subject: [PATCH 0793/1971] Add some checking job scripts --- check/do_meta.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index e01aa41..7fce1eb 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -55,7 +55,7 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { def buildinfo = componentReleaseInfo[key] def offsetpath = buildinfo.offsetpath def abspath = "${buildpathroot}/${offsetpath}" - versioncomponent += "Key: ${key}Path: ${offsetpath}File exists in import: ${fileExists(abspath)}\n" + versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n" } echo versioncomponent From 64fecfb6b3208ae982a277d34d0bcfe3dae893a6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:12:31 +0000 Subject: [PATCH 0794/1971] Add some checking job scripts --- check/do_meta.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index e01aa41..7fce1eb 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -55,7 +55,7 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { def buildinfo = componentReleaseInfo[key] def offsetpath = buildinfo.offsetpath def abspath = "${buildpathroot}/${offsetpath}" - versioncomponent += "Key: ${key}Path: ${offsetpath}File exists in import: ${fileExists(abspath)}\n" + versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n" } echo versioncomponent From 36ec063feea07fc2c17f4007f327400ab9485286 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:22:58 +0000 Subject: [PATCH 0795/1971] Add some checking job scripts --- check/do_meta.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 7fce1eb..cb19ddf 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -47,6 +47,18 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { 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 = buildinfo.meta.componentversionuniqueidentifier() + def offsetpath = buildinfo.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:" From 741a9f966c0822e4b678165cab07c6f1dbfb3fe0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:22:58 +0000 Subject: [PATCH 0796/1971] Add some checking job scripts --- check/do_meta.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 7fce1eb..cb19ddf 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -47,6 +47,18 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { 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 = buildinfo.meta.componentversionuniqueidentifier() + def offsetpath = buildinfo.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:" From 1ad8cbb7366ddfac2433ed62a38b5660486e27eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:25:25 +0000 Subject: [PATCH 0797/1971] Add some checking job scripts --- check/do_meta.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index cb19ddf..8935ca5 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -64,8 +64,8 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { echo "Unique components:" def String versioncomponent = "" for (key in componentReleaseInfo.keySet()) { - def buildinfo = componentReleaseInfo[key] - def offsetpath = buildinfo.offsetpath + 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" } From 401ce43ea3d42a469fa41d588ab5e3a464059b0e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:25:25 +0000 Subject: [PATCH 0798/1971] Add some checking job scripts --- check/do_meta.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index cb19ddf..8935ca5 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -64,8 +64,8 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { echo "Unique components:" def String versioncomponent = "" for (key in componentReleaseInfo.keySet()) { - def buildinfo = componentReleaseInfo[key] - def offsetpath = buildinfo.offsetpath + 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" } From ed9284264c32a817e513514927c4834db43af639 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:29:23 +0000 Subject: [PATCH 0799/1971] Add some checking job scripts --- check/do_meta.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 8935ca5..7bfe2d1 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -52,8 +52,8 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { echo "All components:" def String componentinfo = "" for (entry in buildinfo) { - def name = buildinfo.meta.componentversionuniqueidentifier() - def offsetpath = buildinfo.offsetpath + 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" } From c59af13d9c6c6668d7486eb391c1daa4b8dc81ca Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:29:23 +0000 Subject: [PATCH 0800/1971] Add some checking job scripts --- check/do_meta.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 8935ca5..7bfe2d1 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -52,8 +52,8 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { echo "All components:" def String componentinfo = "" for (entry in buildinfo) { - def name = buildinfo.meta.componentversionuniqueidentifier() - def offsetpath = buildinfo.offsetpath + 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" } From d90b8a2b3725454941514cdce985b70217b88473 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:51:03 +0000 Subject: [PATCH 0801/1971] Add some checking job scripts --- meta/folder.groovy | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d751f5e..a18e8d7 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -687,6 +687,18 @@ class MetaInfo extends GISJsonSerialised { return productinfo.productname + "_" + productinfo.subcomponentname + "_" + buildstampinfo.buildstamp } + Map putwithshortestoffsetpath(ArrayList releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { + if (releasemetacollection.containsKey(uniquestring)) { + def existingentry = releasemetacollection[uniquestring] + if (existingentry.offsetpath.size() > relatedmetainfo.offsetpathsize()) { + releasemetaversionuniquecollection.put(uniquestring, relatedmetainfo) + } + } else { + releasemetauniquecollection.put(uniquestring, relatedmetainfo) + } + return releasemetacollection + } + Map releasewalkerunique(int maxdepth, String startpath = "") { def ArrayList releasemetacollection = new ArrayList() releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) @@ -694,7 +706,7 @@ class MetaInfo extends GISJsonSerialised { def Map releasemetauniquecollection = new LinkedHashMap() for (relatedmetainfo in releasemetacollection) { def String uniquestring = relatedmetainfo.meta.componentidentifier() - releasemetauniquecollection.put(uniquestring, relatedmetainfo) + releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo) } return releasemetauniquecollection @@ -707,7 +719,7 @@ class MetaInfo extends GISJsonSerialised { def Map releasemetaversionuniquecollection = new LinkedHashMap() for (relatedmetainfo in releasemetacollection) { def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier() - releasemetaversionuniquecollection.put(uniquestring, relatedmetainfo) + releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo) } return releasemetaversionuniquecollection From 6555898bb55b91d61dae523daa9af06c6d6e3411 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:51:03 +0000 Subject: [PATCH 0802/1971] Add some checking job scripts --- meta/folder.groovy | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d751f5e..a18e8d7 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -687,6 +687,18 @@ class MetaInfo extends GISJsonSerialised { return productinfo.productname + "_" + productinfo.subcomponentname + "_" + buildstampinfo.buildstamp } + Map putwithshortestoffsetpath(ArrayList releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { + if (releasemetacollection.containsKey(uniquestring)) { + def existingentry = releasemetacollection[uniquestring] + if (existingentry.offsetpath.size() > relatedmetainfo.offsetpathsize()) { + releasemetaversionuniquecollection.put(uniquestring, relatedmetainfo) + } + } else { + releasemetauniquecollection.put(uniquestring, relatedmetainfo) + } + return releasemetacollection + } + Map releasewalkerunique(int maxdepth, String startpath = "") { def ArrayList releasemetacollection = new ArrayList() releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) @@ -694,7 +706,7 @@ class MetaInfo extends GISJsonSerialised { def Map releasemetauniquecollection = new LinkedHashMap() for (relatedmetainfo in releasemetacollection) { def String uniquestring = relatedmetainfo.meta.componentidentifier() - releasemetauniquecollection.put(uniquestring, relatedmetainfo) + releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo) } return releasemetauniquecollection @@ -707,7 +719,7 @@ class MetaInfo extends GISJsonSerialised { def Map releasemetaversionuniquecollection = new LinkedHashMap() for (relatedmetainfo in releasemetacollection) { def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier() - releasemetaversionuniquecollection.put(uniquestring, relatedmetainfo) + releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo) } return releasemetaversionuniquecollection From d226eba99021f0811526b01518b286dd336d40fa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:54:50 +0000 Subject: [PATCH 0803/1971] Add some checking job scripts --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a18e8d7..a8ffa41 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -687,14 +687,14 @@ class MetaInfo extends GISJsonSerialised { return productinfo.productname + "_" + productinfo.subcomponentname + "_" + buildstampinfo.buildstamp } - Map putwithshortestoffsetpath(ArrayList releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] if (existingentry.offsetpath.size() > relatedmetainfo.offsetpathsize()) { - releasemetaversionuniquecollection.put(uniquestring, relatedmetainfo) + releasemetacollection.put(uniquestring, relatedmetainfo) } } else { - releasemetauniquecollection.put(uniquestring, relatedmetainfo) + releasemetacollection.put(uniquestring, relatedmetainfo) } return releasemetacollection } From 1ed3b8214c7e945d3ebe452561e2131cc0d99e34 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:54:50 +0000 Subject: [PATCH 0804/1971] Add some checking job scripts --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a18e8d7..a8ffa41 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -687,14 +687,14 @@ class MetaInfo extends GISJsonSerialised { return productinfo.productname + "_" + productinfo.subcomponentname + "_" + buildstampinfo.buildstamp } - Map putwithshortestoffsetpath(ArrayList releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] if (existingentry.offsetpath.size() > relatedmetainfo.offsetpathsize()) { - releasemetaversionuniquecollection.put(uniquestring, relatedmetainfo) + releasemetacollection.put(uniquestring, relatedmetainfo) } } else { - releasemetauniquecollection.put(uniquestring, relatedmetainfo) + releasemetacollection.put(uniquestring, relatedmetainfo) } return releasemetacollection } From 22cd92580cabbf422c2bf7dd44ac2924751e9206 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:57:14 +0000 Subject: [PATCH 0805/1971] Add some checking job scripts --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a8ffa41..1bf855c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -690,7 +690,7 @@ class MetaInfo extends GISJsonSerialised { Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] - if (existingentry.offsetpath.size() > relatedmetainfo.offsetpathsize()) { + if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) { releasemetacollection.put(uniquestring, relatedmetainfo) } } else { From 323da9fdf3edf65330275c026cc8828858b56fdb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 11:57:14 +0000 Subject: [PATCH 0806/1971] Add some checking job scripts --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a8ffa41..1bf855c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -690,7 +690,7 @@ class MetaInfo extends GISJsonSerialised { Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] - if (existingentry.offsetpath.size() > relatedmetainfo.offsetpathsize()) { + if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) { releasemetacollection.put(uniquestring, relatedmetainfo) } } else { From e1bc45fafb9df2ef8d2048fc4b195de9dce6fa36 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 12:21:15 +0000 Subject: [PATCH 0807/1971] Create a script to copy logic to a build job - so that it will be stamped during release --- copy/logic.groovy | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 copy/logic.groovy diff --git a/copy/logic.groovy b/copy/logic.groovy new file mode 100644 index 0000000..6f8f633 --- /dev/null +++ b/copy/logic.groovy @@ -0,0 +1,56 @@ +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 { + cleanfolders = [ + "${WORKSPACE}/logic", + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Copying logic artifacts') { + steps { + script { + env.LOGICDEST = "${WORKSPACE}/logic" + if (LOGIC_ARTIFACT_LOCATION == "Jenkins job artifact") { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + importer.artifactimport(meta, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGICDEST) + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["logic/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} From 9e0f24f0d26d9c2f511d9cdbc32f6bfb6d4fd0f3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 24 Mar 2019 12:21:15 +0000 Subject: [PATCH 0808/1971] Create a script to copy logic to a build job - so that it will be stamped during release --- copy/logic.groovy | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 copy/logic.groovy diff --git a/copy/logic.groovy b/copy/logic.groovy new file mode 100644 index 0000000..6f8f633 --- /dev/null +++ b/copy/logic.groovy @@ -0,0 +1,56 @@ +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 { + cleanfolders = [ + "${WORKSPACE}/logic", + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Copying logic artifacts') { + steps { + script { + env.LOGICDEST = "${WORKSPACE}/logic" + if (LOGIC_ARTIFACT_LOCATION == "Jenkins job artifact") { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + importer.artifactimport(meta, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGICDEST) + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["logic/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} From 55f8109e5fc2c87e8f9acae6be2741948b8ab3bc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Mar 2019 14:21:19 +0000 Subject: [PATCH 0809/1971] Overwrite the benign copy meta with the logic meta --- copy/logic.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/copy/logic.groovy b/copy/logic.groovy index 6f8f633..d951ffa 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -35,6 +35,9 @@ pipeline { script { def artifactlist = meta.generateartifacts(["logic/**"]) archiveArtifacts "${artifactlist}" + sh """ + cp -v -R logic/meta/info.json meta/info.json + """ } } } From 88e955e7653d8b2dc4a42a333b28a385911f191d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Mar 2019 14:21:19 +0000 Subject: [PATCH 0810/1971] Overwrite the benign copy meta with the logic meta --- copy/logic.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/copy/logic.groovy b/copy/logic.groovy index 6f8f633..d951ffa 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -35,6 +35,9 @@ pipeline { script { def artifactlist = meta.generateartifacts(["logic/**"]) archiveArtifacts "${artifactlist}" + sh """ + cp -v -R logic/meta/info.json meta/info.json + """ } } } From 16b2bd8acd31d599a7aa6983199c23c6c2a635be Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Mar 2019 14:25:25 +0000 Subject: [PATCH 0811/1971] Overwrite the benign copy meta with the logic meta --- copy/logic.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index d951ffa..845f676 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -34,10 +34,10 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["logic/**"]) - archiveArtifacts "${artifactlist}" sh """ cp -v -R logic/meta/info.json meta/info.json """ + archiveArtifacts "${artifactlist}" } } } From 3c0b2178a810d4648220e5b258719a8d8a05ec3d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 26 Mar 2019 14:25:25 +0000 Subject: [PATCH 0812/1971] Overwrite the benign copy meta with the logic meta --- copy/logic.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index d951ffa..845f676 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -34,10 +34,10 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["logic/**"]) - archiveArtifacts "${artifactlist}" sh """ cp -v -R logic/meta/info.json meta/info.json """ + archiveArtifacts "${artifactlist}" } } } From aeb2669473c83d694e89cdb3a0d6b197eed2a1e9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Mar 2019 08:56:29 +0000 Subject: [PATCH 0813/1971] Handle the artifact source parameter --- import/importer.groovy | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/import/importer.groovy b/import/importer.groovy index 5c996b4..40151e1 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -35,4 +35,18 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat return importedmeta } +def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { + switch (source) { + case "Jenkins job artifact": { + return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) + } + case "Release repository": { + return artifactimportfromrepo(meta, repo, revision, destpath, incrementversionnumber, filter, excludes, fingerprint) + } + default: + error("Unknown type of artifact source: ${source}") + } + return meta +} + return this; From 6a600862582d3b19a59e358007c038d471c3bc05 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Mar 2019 08:56:29 +0000 Subject: [PATCH 0814/1971] Handle the artifact source parameter --- import/importer.groovy | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/import/importer.groovy b/import/importer.groovy index 5c996b4..40151e1 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -35,4 +35,18 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat return importedmeta } +def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { + switch (source) { + case "Jenkins job artifact": { + return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) + } + case "Release repository": { + return artifactimportfromrepo(meta, repo, revision, destpath, incrementversionnumber, filter, excludes, fingerprint) + } + default: + error("Unknown type of artifact source: ${source}") + } + return meta +} + return this; From a6ce45b21441f9f79aa4ed0fa14b87f3bac536b2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Mar 2019 08:59:37 +0000 Subject: [PATCH 0815/1971] Handle the artifact source parameter --- import/importer.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 40151e1..abf3b2f 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -37,12 +37,10 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { switch (source) { - case "Jenkins job artifact": { + case "Jenkins job artifact": return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) - } - case "Release repository": { + case "Release repository": return artifactimportfromrepo(meta, repo, revision, destpath, incrementversionnumber, filter, excludes, fingerprint) - } default: error("Unknown type of artifact source: ${source}") } From 11b7fe881da3416d70bde83001592cc56f7aa9d8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Mar 2019 08:59:37 +0000 Subject: [PATCH 0816/1971] Handle the artifact source parameter --- import/importer.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 40151e1..abf3b2f 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -37,12 +37,10 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { switch (source) { - case "Jenkins job artifact": { + case "Jenkins job artifact": return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) - } - case "Release repository": { + case "Release repository": return artifactimportfromrepo(meta, repo, revision, destpath, incrementversionnumber, filter, excludes, fingerprint) - } default: error("Unknown type of artifact source: ${source}") } From 56d3088733d632579ad4b5ebca9e2439d0de1ab1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Mar 2019 09:16:18 +0000 Subject: [PATCH 0817/1971] Overwrite the benign copy meta with the logic meta --- copy/logic.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 845f676..fae69b4 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -13,6 +13,7 @@ pipeline { script { cleanfolders = [ "${WORKSPACE}/logic", + "${WORKSPACE}/embedded_logic", ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -33,9 +34,10 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(["logic/**"]) + def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - cp -v -R logic/meta/info.json meta/info.json + rm -v meta/info.json + mv -v logic/embedded_logic . """ archiveArtifacts "${artifactlist}" } From 05afef18481f42696eded8a57404336f63cfd98e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Mar 2019 09:16:18 +0000 Subject: [PATCH 0818/1971] Overwrite the benign copy meta with the logic meta --- copy/logic.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 845f676..fae69b4 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -13,6 +13,7 @@ pipeline { script { cleanfolders = [ "${WORKSPACE}/logic", + "${WORKSPACE}/embedded_logic", ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -33,9 +34,10 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(["logic/**"]) + def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - cp -v -R logic/meta/info.json meta/info.json + rm -v meta/info.json + mv -v logic/embedded_logic . """ archiveArtifacts "${artifactlist}" } From d4812874ab9c1455806a58eb438b7f5ec7e9d33a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Mar 2019 09:19:44 +0000 Subject: [PATCH 0819/1971] Overwrite the benign copy meta with the logic meta --- copy/logic.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index fae69b4..6e97510 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -36,8 +36,8 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - rm -v meta/info.json - mv -v logic/embedded_logic . + rm -v -rf meta + mv -v logic/* . """ archiveArtifacts "${artifactlist}" } From ff733458f94621a24c3af027bd2ae73db169561d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 27 Mar 2019 09:19:44 +0000 Subject: [PATCH 0820/1971] Overwrite the benign copy meta with the logic meta --- copy/logic.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index fae69b4..6e97510 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -36,8 +36,8 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - rm -v meta/info.json - mv -v logic/embedded_logic . + rm -v -rf meta + mv -v logic/* . """ archiveArtifacts "${artifactlist}" } From ec33ceb812e97971316553e88676b32304aa8162 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 09:06:33 +0000 Subject: [PATCH 0821/1971] Import artifacts from repo --- import/importer.groovy | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index abf3b2f..e605743 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,4 +1,4 @@ -versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { copyArtifacts( @@ -35,6 +35,18 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat return importedmeta } +def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { + def rooturl = repo.trim() + def rootrevision = revision.trim() + gh.gitCheckout(rooturl, rootrevision, destpath) + + def importedmeta = meta.importrelated(destpath) + if (incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } + return importedmeta +} + def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { switch (source) { case "Jenkins job artifact": From 51ba9bc94e85d07a464621c1d7d1c8d15f5ec673 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 09:25:47 +0000 Subject: [PATCH 0822/1971] Import artifacts from repo --- import/importer.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/import/importer.groovy b/import/importer.groovy index e605743..fc8395f 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,4 +1,5 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") +versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { copyArtifacts( From 3745e27b9cb5d199044a693bf01f25e686257b7f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 13:57:21 +0000 Subject: [PATCH 0823/1971] When importing artifacts from repo, clone subcomponents --- import/importer.groovy | 9 +++++++++ meta/folder.groovy | 10 +++++++++- release/release.groovy | 3 +-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index fc8395f..133edba 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -42,6 +42,15 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, gh.gitCheckout(rooturl, rootrevision, destpath) def importedmeta = meta.importrelated(destpath) + + for(associatedmeta in getassociatedmeta) { + def cloneurl = associatedmeta.releaseinfo.releaserepoURL + def clonerevision = associatedmeta.releasetag() + def clonepath = "${destpath}/${associatedmeta.offsetpath}" + echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}" + gh.gitCheckout(cloneurl, rootrevision, clonepath) + } + if (incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } diff --git a/meta/folder.groovy b/meta/folder.groovy index 1bf855c..053c38e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -477,6 +477,10 @@ class MetaInfo extends GISJsonSerialised { associatedmeta = new ArrayList() } + ArrayList getassociatedmeta() { + return associatedmeta + } + List configurationinfoserialised() { def configuration = [] for (configurationitem in configurationinfo) { @@ -684,7 +688,11 @@ class MetaInfo extends GISJsonSerialised { } String componentversionuniqueidentifier() { - return productinfo.productname + "_" + productinfo.subcomponentname + "_" + buildstampinfo.buildstamp + return componentidentifier() + "_" + buildstampinfo.buildstamp + } + + String releasetag() { + return componentversionuniqueidentifier() + "_" + jenkinsbuildinfo.buildnumber } Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { diff --git a/release/release.groovy b/release/release.groovy index b0530be..3b5321d 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -43,8 +43,7 @@ pipeline { script { def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") // Place the top level build stamp on all - def topleveltag = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildmeta.buildstampinfo.buildstamp}_${buildmeta.jenkinsbuildinfo.buildnumber}" - OTHER_RELEASE_TAGS = "${topleveltag},${OTHER_RELEASE_TAGS}" + OTHER_RELEASE_TAGS = "${buildmeta.releasetag()},${OTHER_RELEASE_TAGS}" (summarystring, markunstable, unstablereason) = releaser.releasehierarchy(buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH) if (markunstable) { env.unstablereason = unstablereason From 6056ba5874063695b74e72cee121b961e1cb3173 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 14:03:22 +0000 Subject: [PATCH 0824/1971] When importing artifacts from repo, clone subcomponents --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 133edba..09451ec 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -43,7 +43,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def importedmeta = meta.importrelated(destpath) - for(associatedmeta in getassociatedmeta) { + for(associatedmeta in importedmeta.getassociatedmeta()) { def cloneurl = associatedmeta.releaseinfo.releaserepoURL def clonerevision = associatedmeta.releasetag() def clonepath = "${destpath}/${associatedmeta.offsetpath}" From 659859878d3aad5e532b7c2136d0c2b328030d40 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 14:19:39 +0000 Subject: [PATCH 0825/1971] When importing artifacts from repo, clone subcomponents --- import/importer.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 09451ec..2392b83 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -43,10 +43,12 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def importedmeta = meta.importrelated(destpath) - for(associatedmeta in importedmeta.getassociatedmeta()) { - def cloneurl = associatedmeta.releaseinfo.releaserepoURL - def clonerevision = associatedmeta.releasetag() - def clonepath = "${destpath}/${associatedmeta.offsetpath}" + for(relatedmetainfo in importedmeta.getassociatedmeta()) { + 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.gitCheckout(cloneurl, rootrevision, clonepath) } From 9160063d947034622003e95e24eb2e31090e413e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 14:31:49 +0000 Subject: [PATCH 0826/1971] When importing artifacts from repo, clone subcomponents --- import/importer.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 2392b83..c554173 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -43,7 +43,8 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def importedmeta = meta.importrelated(destpath) - for(relatedmetainfo in importedmeta.getassociatedmeta()) { + relatedimportinfo = importedmeta.getassociatedmeta() + for(relatedmetainfo in relatedimportinfo) { def relatedmeta = relatedmetainfo.meta def relatedoffsetpath = relatedmetainfo.offsetpath def cloneurl = relatedmeta.releaseinfo.releaserepoURL From ab18f25218f5afe0402fbc3e9f017ebdbf4af0a0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 16:45:17 +0000 Subject: [PATCH 0827/1971] When importing artifacts from repo, clone subcomponents --- import/importer.groovy | 3 ++- meta/folder.groovy | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index c554173..cdc2e1a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -43,7 +43,8 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def importedmeta = meta.importrelated(destpath) - relatedimportinfo = importedmeta.getassociatedmeta() + relatedimportinfo = importedmeta.getassociated() + echo "Cloning associated repos" for(relatedmetainfo in relatedimportinfo) { def relatedmeta = relatedmetainfo.meta def relatedoffsetpath = relatedmetainfo.offsetpath diff --git a/meta/folder.groovy b/meta/folder.groovy index 053c38e..987041b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -477,7 +477,7 @@ class MetaInfo extends GISJsonSerialised { associatedmeta = new ArrayList() } - ArrayList getassociatedmeta() { + List getassociated() { return associatedmeta } @@ -635,12 +635,11 @@ class MetaInfo extends GISJsonSerialised { ] 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}" From 5006d6cd184fc11e30f1c99edf4dc390cb0e6d9a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 16:48:58 +0000 Subject: [PATCH 0828/1971] When importing artifacts from repo, clone subcomponents --- import/importer.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/import/importer.groovy b/import/importer.groovy index cdc2e1a..78f89cc 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -39,6 +39,7 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { def rooturl = repo.trim() def rootrevision = revision.trim() + echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" gh.gitCheckout(rooturl, rootrevision, destpath) def importedmeta = meta.importrelated(destpath) From e23d564cb589081f986f9181d48e0a3e0b9fd701 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 16:57:54 +0000 Subject: [PATCH 0829/1971] When importing artifacts from repo, clone subcomponents --- meta/folder.groovy | 6 +++++- release/release.groovy | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 987041b..e805118 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -690,10 +690,14 @@ class MetaInfo extends GISJsonSerialised { return componentidentifier() + "_" + buildstampinfo.buildstamp } - String releasetag() { + String globalreleasetag() { return componentversionuniqueidentifier() + "_" + jenkinsbuildinfo.buildnumber } + String releasetag() { + return buildstampinfo.buildstamp + "_" + jenkinsbuildinfo.buildnumber + } + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] diff --git a/release/release.groovy b/release/release.groovy index 3b5321d..79c0234 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -43,7 +43,7 @@ pipeline { script { def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") // Place the top level build stamp on all - OTHER_RELEASE_TAGS = "${buildmeta.releasetag()},${OTHER_RELEASE_TAGS}" + 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 From 7dd532095cc0e8d597fb4cf41c9b1464b0708ca1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 17:00:25 +0000 Subject: [PATCH 0830/1971] When importing artifacts from repo, clone subcomponents --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 78f89cc..c6b80a4 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -53,7 +53,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def clonerevision = "refs/tags/${relatedmeta.releasetag()}" def clonepath = "${destpath}/${relatedoffsetpath}" echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}" - gh.gitCheckout(cloneurl, rootrevision, clonepath) + gh.gitCheckout(cloneurl, clonerevision, clonepath) } if (incrementversionnumber) { From 8cd99c0927f3a215c996e88c8896cb5a5c12077e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 18:33:55 +0000 Subject: [PATCH 0831/1971] When importing artifacts from repo, clone subcomponents; Remove git history; Mark them as released --- import/importer.groovy | 16 +++++++++++++++- meta/folder.groovy | 10 +++++++++- publish/do.groovy | 15 +-------------- versioncontrol/git.groovy | 13 +++++++++++++ 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index c6b80a4..c945ec0 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -36,6 +36,12 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat return importedmeta } +def rewritemetafileasreleased(meta, String filepath) { + // Modify the meta info to say that is has already been released + meta.releaseinfo.markreleased() + meta.saveJsonSerialised(filepath) +} + def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { def rooturl = repo.trim() def rootrevision = revision.trim() @@ -54,8 +60,16 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def clonepath = "${destpath}/${relatedoffsetpath}" echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}" gh.gitCheckout(cloneurl, clonerevision, clonepath) + 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}/${relatedmeta.metafilepath()}" + echo "Marking root meta as released and rewriting meta file: ${metafilepath}" + rewritemetafileasreleased(meta, metafilepath) + if (incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } diff --git a/meta/folder.groovy b/meta/folder.groovy index e805118..ec011ae 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -219,11 +219,13 @@ class BuildStampInfo extends GISJsonSerialised { class ReleaseInfo extends GISJsonSerialised { String releaserepoURL ArrayList releaseitems + boolean released - ReleaseInfo(script, releaserepoURL = "") { + ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { super(script) this.releaserepoURL = releaserepoURL this.releaseitems = new ArrayList() + this.released = released } void set(String releaserepoURL = "") { @@ -234,6 +236,10 @@ class ReleaseInfo extends GISJsonSerialised { releaseitems.add(releaseitem) } + void markreleased() { + this.released = true + } + List releaseitemssserialised() { def items = [] for (ri in releaseitems) { @@ -248,12 +254,14 @@ class ReleaseInfo extends GISJsonSerialised { for (rawreleaseitem in rawmeta['releaseitems']) { releaseitems.add(rawreleaseitem) } + released ?= rawmeta['released'] : false } LinkedHashMap serialisationdata() { def data = [ 'releaserepoURL' : releaserepoURL, 'releaseitems' : releaseitemssserialised(), + 'released' : released ] return data } diff --git a/publish/do.groovy b/publish/do.groovy index 1a54b23..b63b15c 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -133,19 +133,6 @@ def recallcomponent(releaseinfo, String softwarerelease, itempathstopublish) { summaryappend("\n") } -def stripgithistory() { - echo "Stripping git history out of ${releaserepofolder}" - dir(releaserepofolder) { - sh """#!/bin/bash - pwd - find . -type d -name ".git" | xargs -iXX rm -rvf XX - find . -name ".gitignore" | xargs -iXX rm -rvf XX - find . -name ".gitmodules" | xargs -iXX rm -rvf XX - find . -iname ".gitattributes" | xargs -iXX rm -rvf XX - """ - } -} - def convertitemstopublish(String itemstopublishstring) { def List paths = [] @@ -183,7 +170,7 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, def releaseinfo = componentReleaseInfoVersionUnique[key] recallcomponent(releaseinfo, softwarerelease, itempathstopublish) } - stripgithistory() + gh.stripgithistory(releaserepofolder) publish(customer) return [summarystring, markunstable, unstablereason] diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 9a313f2..7a1dd17 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -89,4 +89,17 @@ boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { return true } +def stripgithistory(String rootfolder) { + echo "Stripping git history out of ${rootfolder}" + dir(rootfolder) { + sh """#!/bin/bash + pwd + find . -type d -name ".git" | xargs -iXX rm -rvf XX + find . -name ".gitignore" | xargs -iXX rm -rvf XX + find . -name ".gitmodules" | xargs -iXX rm -rvf XX + find . -iname ".gitattributes" | xargs -iXX rm -rvf XX + """ + } +} + return this From 5659c8eeb41dbc2dcd48b1a7659ac1581e937287 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 18:36:35 +0000 Subject: [PATCH 0832/1971] When importing artifacts from repo, clone subcomponents; Remove git history; Mark them as released --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ec011ae..be85584 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -254,7 +254,7 @@ class ReleaseInfo extends GISJsonSerialised { for (rawreleaseitem in rawmeta['releaseitems']) { releaseitems.add(rawreleaseitem) } - released ?= rawmeta['released'] : false + released = rawmeta['released'] ?= false } LinkedHashMap serialisationdata() { From a5dc59e6b297e8728cb9bcb5723f65f9427318c1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 18:38:02 +0000 Subject: [PATCH 0833/1971] When importing artifacts from repo, clone subcomponents; Remove git history; Mark them as released --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index be85584..a868855 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -254,7 +254,7 @@ class ReleaseInfo extends GISJsonSerialised { for (rawreleaseitem in rawmeta['releaseitems']) { releaseitems.add(rawreleaseitem) } - released = rawmeta['released'] ?= false + released = rawmeta['released'] ?: false } LinkedHashMap serialisationdata() { From 49783e0f468deb3318ce65a0024df3a32c200984 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 18:43:58 +0000 Subject: [PATCH 0834/1971] When importing artifacts from repo, clone subcomponents; Remove git history; Mark them as released --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index c945ec0..a23ee83 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -66,7 +66,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, rewritemetafileasreleased(relatedmeta, metafilepath) } gh.stripgithistory(destpath) - def metafilepath = "${destpath}/${relatedmeta.metafilepath()}" + def metafilepath = "${destpath}/${meta.metafilepath()}" echo "Marking root meta as released and rewriting meta file: ${metafilepath}" rewritemetafileasreleased(meta, metafilepath) From 86613fcb2cf9cab5dc11ec847a65dcfef9f67195 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 19:43:15 +0000 Subject: [PATCH 0835/1971] When releasing, take into account already-released components --- release/do.groovy | 61 ++++++++++++++++++++++++--------------- versioncontrol/git.groovy | 8 ++--- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 604581a..fd2b06b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -172,22 +172,29 @@ def ArrayList maketaglist(buildmeta, String buildstamp, String otherrele return taglist } -def boolean releasegittag(String postcommitshacode, String tag) { - def boolean tagadded = false +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 - def existingshacode = readFile(file: gitrevparseoutputfile).trim() + 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 HEAD // This is a problem - The tag is already at another position in git repo setunstable("The tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") summaryappend("(${tag} - Could not add!)") - } - else { + } else { summaryappend("(${tag} - Already added)") } - } - else { // If tag does not exist already + } else { // If tag does not exist already // Tag sh("git tag \"${tag}\"") summaryappend("(${tag})") @@ -270,26 +277,35 @@ def sourcegitpush(String dryrunpush ) { def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String sourcerepo, String otherreleasetags, String dryrunpush) { summaryappend(" Git operations: ") - def String buildstamp = buildmeta.buildstampinfo.buildstamp - def String buildstamptag = "${buildstamp}_${buildmeta.jenkinsbuildinfo.buildnumber}" + 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}" - releasegitadd() + def boolean alreadyreleased = buildmeta.releaseinfo.released + echo "Already released: ${alreadyreleased}" - def boolean changed = checkforchange(buildmeta, previousreleasemeta) - if (changed) { - releasegitcommit(buildstamptag) - } - else { - releasegitreset() - summaryappend("No-commit,") - } + def String postcommitshacode + def boolean changed = false + if (alreadyreleased) { + summaryappend("Already-released,") + postcommitshacode = releasegitgetshacode(buildstamptag) + echo "Previous release sha code: ${postcommitshacode}" + } else { + releasegitadd() - def String postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() - echo "Post commit sha code: ${postcommitshacode}" + 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) @@ -299,7 +315,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source } } dir(sourcerepo) { - def String srcbuildstamptag = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${buildstamptag}" + def String srcbuildstamptag = buildmeta.globalreleasetag() def String buildsha = buildmeta.gitinfo.gitrevision if (buildsha) { @@ -308,8 +324,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source if (tagadded) { sourcegitpush(dryrunpush) } - } - else { + } else { summaryappend(",No Src ") } } diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 7a1dd17..ba4d96b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -94,10 +94,10 @@ def stripgithistory(String rootfolder) { dir(rootfolder) { sh """#!/bin/bash pwd - find . -type d -name ".git" | xargs -iXX rm -rvf XX - find . -name ".gitignore" | xargs -iXX rm -rvf XX - find . -name ".gitmodules" | xargs -iXX rm -rvf XX - find . -iname ".gitattributes" | xargs -iXX rm -rvf XX + 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 """ } } From 6eb0f77114338dd00296ebfe7a8837c62dec34a6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Mar 2019 19:58:37 +0000 Subject: [PATCH 0836/1971] Recursively mark all associated items of meta as released --- import/importer.groovy | 2 +- meta/folder.groovy | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index a23ee83..34707bc 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -38,7 +38,7 @@ def artifactimport(meta, String jenkinsjob, String buildselector, String destpat def rewritemetafileasreleased(meta, String filepath) { // Modify the meta info to say that is has already been released - meta.releaseinfo.markreleased() + meta.markreleased() meta.saveJsonSerialised(filepath) } diff --git a/meta/folder.groovy b/meta/folder.groovy index a868855..346b2ee 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -489,6 +489,13 @@ class MetaInfo extends GISJsonSerialised { return associatedmeta } + void markreleased() { + releaseinfo.markreleased() + for (associated in associatedmeta) { + associated.meta.releaseinfo.markreleased() + } + } + List configurationinfoserialised() { def configuration = [] for (configurationitem in configurationinfo) { From 4942d1bc6bbf30c5a16c23cf5070d15ec0da0345 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:44:12 +0000 Subject: [PATCH 0837/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 51 +++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index ba4d96b..a474b6e 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -29,15 +29,50 @@ def guessreporoot(componentURL) { return reporoot } -def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { - reporootenv = env.REPO_ROOT - if (reporootenv != null && repoRootSuffix != "") { - reporootpath = "${reporootenv.trim()}/${repoRootSuffix}" - echo "Using release repo: ${reporootpath}" - } else { - reporootpath = "" +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) + def reporootsubfolder = "${reporootenv}/${reporootname}" + + if (!fileExists(reporootsubfolder)) { + echo "Checking out ${gitURL} to ${reporootname}" + 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 ${reporootname}" + } + return reporootsubfolder +} + +def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + def reporootpath = checkouttoreporoot(gitURL) checkout([ $class: 'GitSCM', userRemoteConfigs: [ From a756df369aae75957a999570992da95b59335fd1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:44:12 +0000 Subject: [PATCH 0838/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 51 +++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index ba4d96b..a474b6e 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -29,15 +29,50 @@ def guessreporoot(componentURL) { return reporoot } -def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { - reporootenv = env.REPO_ROOT - if (reporootenv != null && repoRootSuffix != "") { - reporootpath = "${reporootenv.trim()}/${repoRootSuffix}" - echo "Using release repo: ${reporootpath}" - } else { - reporootpath = "" +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) + def reporootsubfolder = "${reporootenv}/${reporootname}" + + if (!fileExists(reporootsubfolder)) { + echo "Checking out ${gitURL} to ${reporootname}" + 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 ${reporootname}" + } + return reporootsubfolder +} + +def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + def reporootpath = checkouttoreporoot(gitURL) checkout([ $class: 'GitSCM', userRemoteConfigs: [ From d3e547b6c447942fcdcdb043a4786cd1f5cda515 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:48:35 +0000 Subject: [PATCH 0839/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index a474b6e..bd1b15e 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -19,16 +19,6 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { return new SparseCheckoutPaths(sparsecheckoutpaths) } -def guessreporoot(componentURL) { - if (!env.REPO_ROOT || env.REPO_ROOT.size() == 0) { - return '' - } - def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') - def reporoot = "${REPO_ROOT}/${guess}" - echo "Guessing reporoot is: ${reporoot}" - return reporoot -} - def String uniquereporootname(String gitURL) { def uniquename = gitURL.replaceAll("[^A-Za-z0-9]", "_") echo "Unique reporoot name for URL: ${gitURL} is: ${uniquename}" @@ -68,6 +58,7 @@ def String checkouttoreporoot(String gitURL) { } else { echo "Found ${gitURL} checked out at ${reporootname}" } + } return reporootsubfolder } From df087201a3f9bb54c2b65561f4c95fc21be1c344 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:48:35 +0000 Subject: [PATCH 0840/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index a474b6e..bd1b15e 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -19,16 +19,6 @@ def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { return new SparseCheckoutPaths(sparsecheckoutpaths) } -def guessreporoot(componentURL) { - if (!env.REPO_ROOT || env.REPO_ROOT.size() == 0) { - return '' - } - def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1') - def reporoot = "${REPO_ROOT}/${guess}" - echo "Guessing reporoot is: ${reporoot}" - return reporoot -} - def String uniquereporootname(String gitURL) { def uniquename = gitURL.replaceAll("[^A-Za-z0-9]", "_") echo "Unique reporoot name for URL: ${gitURL} is: ${uniquename}" @@ -68,6 +58,7 @@ def String checkouttoreporoot(String gitURL) { } else { echo "Found ${gitURL} checked out at ${reporootname}" } + } return reporootsubfolder } From b598a99b2e675b41dccf1a98173dcd4d1ffdfd6c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:49:54 +0000 Subject: [PATCH 0841/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index bd1b15e..ea3501c 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,7 +34,7 @@ def String checkouttoreporoot(String gitURL) { 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) - def reporootsubfolder = "${reporootenv}/${reporootname}" + reporootsubfolder = "${reporootenv}/${reporootname}" if (!fileExists(reporootsubfolder)) { echo "Checking out ${gitURL} to ${reporootname}" From 9dd09e4444eabe13100dec7a3dbca9b5825b5f20 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:49:54 +0000 Subject: [PATCH 0842/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index bd1b15e..ea3501c 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,7 +34,7 @@ def String checkouttoreporoot(String gitURL) { 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) - def reporootsubfolder = "${reporootenv}/${reporootname}" + reporootsubfolder = "${reporootenv}/${reporootname}" if (!fileExists(reporootsubfolder)) { echo "Checking out ${gitURL} to ${reporootname}" From 2a8f6327ecf68ef03b27e5c852a6ceb924b26303 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:52:55 +0000 Subject: [PATCH 0843/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index ea3501c..432316f 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,10 +34,10 @@ def String checkouttoreporoot(String gitURL) { 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}" + reporootsubfolder = "${reporootenv}/${reporootsubfolder}" if (!fileExists(reporootsubfolder)) { - echo "Checking out ${gitURL} to ${reporootname}" + echo "Checking out ${gitURL} to ${reporootsubfolder}" checkout([ $class: 'GitSCM', userRemoteConfigs: [ @@ -56,7 +56,7 @@ def String checkouttoreporoot(String gitURL) { submoduleCfg: [], ]) } else { - echo "Found ${gitURL} checked out at ${reporootname}" + echo "Found ${gitURL} checked out at ${reporootsubfolder}" } } return reporootsubfolder From d1e8531b5ad42b0997fc53036a555e9c25c961fa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:52:55 +0000 Subject: [PATCH 0844/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index ea3501c..432316f 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,10 +34,10 @@ def String checkouttoreporoot(String gitURL) { 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}" + reporootsubfolder = "${reporootenv}/${reporootsubfolder}" if (!fileExists(reporootsubfolder)) { - echo "Checking out ${gitURL} to ${reporootname}" + echo "Checking out ${gitURL} to ${reporootsubfolder}" checkout([ $class: 'GitSCM', userRemoteConfigs: [ @@ -56,7 +56,7 @@ def String checkouttoreporoot(String gitURL) { submoduleCfg: [], ]) } else { - echo "Found ${gitURL} checked out at ${reporootname}" + echo "Found ${gitURL} checked out at ${reporootsubfolder}" } } return reporootsubfolder From 6beb745a69a25cd13757b1bbcbe09cff04aed2c4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:56:01 +0000 Subject: [PATCH 0845/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 432316f..5599dc6 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,7 +34,7 @@ def String checkouttoreporoot(String gitURL) { 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}/${reporootsubfolder}" + reporootsubfolder = "${reporootenv}/${reporootname}" if (!fileExists(reporootsubfolder)) { echo "Checking out ${gitURL} to ${reporootsubfolder}" From add368c009a6f99a15c7bf6d2de25af96be5600d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 29 Mar 2019 08:56:01 +0000 Subject: [PATCH 0846/1971] Always create a repo_root copy of a repo when necessary - in order to speed up jobs --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 432316f..5599dc6 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,7 +34,7 @@ def String checkouttoreporoot(String gitURL) { 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}/${reporootsubfolder}" + reporootsubfolder = "${reporootenv}/${reporootname}" if (!fileExists(reporootsubfolder)) { echo "Checking out ${gitURL} to ${reporootsubfolder}" From 34a79713cdf76c175386f954080896955f6981f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 2 Apr 2019 09:01:42 +0100 Subject: [PATCH 0847/1971] Check contents of reporoot repo --- versioncontrol/git.groovy | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 5599dc6..253ffee 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -56,7 +56,20 @@ def String checkouttoreporoot(String gitURL) { submoduleCfg: [], ]) } else { - echo "Found ${gitURL} checked out at ${reporootsubfolder}" + echo "Found ${gitURL} checked out at ${reporootsubfolder} ... checking status" + 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 From 67785ac859fb5e376be83a6e63e1d4b22007f410 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 2 Apr 2019 17:14:15 +0100 Subject: [PATCH 0848/1971] Use the jenkins pipeline checkout mechanism for getting release and source repo --- release/do.groovy | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index fd2b06b..ada51bb 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -10,6 +10,7 @@ tempfolder = "${WORKSPACE}/temp" gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" metascript = autobuilder.getmetafolderscript() +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def resetfolders() { dir(summaryfolder) { @@ -57,7 +58,7 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { // 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 def previousreleasemeta = buildmeta.getNewMetaObject(this) dir(releaserepofolder) { - sh("git clone ${releaserepo} ${checkoutfolder}") + gh.gitCheckout(releaserepo, '*/master', checkoutfolder, "", 1, false) } previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) dir(checkoutfolder) { @@ -69,27 +70,7 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { def checkoutsourcerepo(buildmeta, String checkoutfolder) { def String sourcerepo = buildmeta.gitinfo.remoteurl - 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 - # 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}") - } - } - } + gh.gitCheckout(sourcerepo, '*/master', checkoutfolder, "", 1, false) } def getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { From fb7953a95909ad06a75d2f4e890a866811963482 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 2 Apr 2019 17:24:13 +0100 Subject: [PATCH 0849/1971] Revert "Use the jenkins pipeline checkout mechanism for getting release and source repo" This reverts commit 6808492ff5bc48c3e5d6a3e4239c0c46b9d0145e. --- release/do.groovy | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index ada51bb..fd2b06b 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -10,7 +10,6 @@ tempfolder = "${WORKSPACE}/temp" gitrevparseoutputfile = "${tempfolder}/gitrevparse.out" metascript = autobuilder.getmetafolderscript() -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def resetfolders() { dir(summaryfolder) { @@ -58,7 +57,7 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { // 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 def previousreleasemeta = buildmeta.getNewMetaObject(this) dir(releaserepofolder) { - gh.gitCheckout(releaserepo, '*/master', checkoutfolder, "", 1, false) + sh("git clone ${releaserepo} ${checkoutfolder}") } previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) dir(checkoutfolder) { @@ -70,7 +69,27 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { def checkoutsourcerepo(buildmeta, String checkoutfolder) { def String sourcerepo = buildmeta.gitinfo.remoteurl - gh.gitCheckout(sourcerepo, '*/master', checkoutfolder, "", 1, false) + 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 + # 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}") + } + } + } } def getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { From ad00620c74ff87efb91ed4c53d309123d2037e97 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 15:53:44 +0100 Subject: [PATCH 0850/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 45 +++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 819a580..d064161 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -30,4 +30,47 @@ def placeBinaries(artifactDetails, installerDetails) { } } -return this; \ No newline at end of file +def checkISMfile(String ISMfile) { + def xmlFile = new File(ISMfile) + + def parsedxml = new XmlParser().parse(xmlFile) + 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 -> + println "pair key: ${pair.key} value: ${pair.value}" + def path = pair.value + def pathvarmatcher = path =~ /<(.*)>.*/ + if (pathvarmatcher.matches()) { + def pathvarfound = pathvarmatcher.group(1) + if (pathvarfound != 'WORKSPACE') { + if (!pathvariableinfo.containsKey(pathvarfound)) { + println "Undefined path variable ${pathvarfound} found" + exitcode = 1 + } + } + } else { + println "Path: ${path} does not begin with a path variable" + exitcode = 1 + } + } + if (exitcode > 0) { + error "The ISM file: ${ISMfile} contains a path that is either absolute or does not begin with another path variable definition" + } +} + +return this; From c9e2557aa9c7b48a11602393b53842ba5e23cfe3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 15:53:44 +0100 Subject: [PATCH 0851/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 45 +++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 819a580..d064161 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -30,4 +30,47 @@ def placeBinaries(artifactDetails, installerDetails) { } } -return this; \ No newline at end of file +def checkISMfile(String ISMfile) { + def xmlFile = new File(ISMfile) + + def parsedxml = new XmlParser().parse(xmlFile) + 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 -> + println "pair key: ${pair.key} value: ${pair.value}" + def path = pair.value + def pathvarmatcher = path =~ /<(.*)>.*/ + if (pathvarmatcher.matches()) { + def pathvarfound = pathvarmatcher.group(1) + if (pathvarfound != 'WORKSPACE') { + if (!pathvariableinfo.containsKey(pathvarfound)) { + println "Undefined path variable ${pathvarfound} found" + exitcode = 1 + } + } + } else { + println "Path: ${path} does not begin with a path variable" + exitcode = 1 + } + } + if (exitcode > 0) { + error "The ISM file: ${ISMfile} contains a path that is either absolute or does not begin with another path variable definition" + } +} + +return this; From 1435d338acc9019903594c3b2298bd4ab3150f2b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 17:58:05 +0100 Subject: [PATCH 0852/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index d064161..886c604 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -31,9 +31,9 @@ def placeBinaries(artifactDetails, installerDetails) { } def checkISMfile(String ISMfile) { - def xmlFile = new File(ISMfile) + def xml = readFile(ISMfile) - def parsedxml = new XmlParser().parse(xmlFile) + def parsedxml = new XmlParser().parseText(xml) def pathvariableinfo = [:] def exitcode = 0 // Load up a map of path variable and path pairs From eee2111033b7dd9ae16c553277a7f069f7782e3a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 17:58:05 +0100 Subject: [PATCH 0853/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index d064161..886c604 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -31,9 +31,9 @@ def placeBinaries(artifactDetails, installerDetails) { } def checkISMfile(String ISMfile) { - def xmlFile = new File(ISMfile) + def xml = readFile(ISMfile) - def parsedxml = new XmlParser().parse(xmlFile) + def parsedxml = new XmlParser().parseText(xml) def pathvariableinfo = [:] def exitcode = 0 // Load up a map of path variable and path pairs From ee7da8715fc2b4f4b8f2fb269207746d83d409ca Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 18:07:31 +0100 Subject: [PATCH 0854/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 886c604..6cecb85 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -33,7 +33,7 @@ def placeBinaries(artifactDetails, installerDetails) { def checkISMfile(String ISMfile) { def xml = readFile(ISMfile) - def parsedxml = new XmlParser().parseText(xml) + def parsedxml = new XmlParser(true, true, true).parseText(xml) def pathvariableinfo = [:] def exitcode = 0 // Load up a map of path variable and path pairs From fb6c1a0e31c5f112a449ad5f4c46bdc1e8d0dd46 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 18:07:31 +0100 Subject: [PATCH 0855/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 886c604..6cecb85 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -33,7 +33,7 @@ def placeBinaries(artifactDetails, installerDetails) { def checkISMfile(String ISMfile) { def xml = readFile(ISMfile) - def parsedxml = new XmlParser().parseText(xml) + def parsedxml = new XmlParser(true, true, true).parseText(xml) def pathvariableinfo = [:] def exitcode = 0 // Load up a map of path variable and path pairs From 63202270913c56490108966727ca6edca7e11950 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 18:21:53 +0100 Subject: [PATCH 0856/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 6cecb85..f3dcdd4 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -30,6 +30,7 @@ def placeBinaries(artifactDetails, installerDetails) { } } +@NonCPS def checkISMfile(String ISMfile) { def xml = readFile(ISMfile) From 1fce006fe33c5932874df279d98bc391fb85ea2b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 18:21:53 +0100 Subject: [PATCH 0857/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 6cecb85..f3dcdd4 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -30,6 +30,7 @@ def placeBinaries(artifactDetails, installerDetails) { } } +@NonCPS def checkISMfile(String ISMfile) { def xml = readFile(ISMfile) From 1c10bfba373c73007a0ca0cae5cb2ec611bd0f24 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 18:30:16 +0100 Subject: [PATCH 0858/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index f3dcdd4..823c117 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -33,7 +33,8 @@ def placeBinaries(artifactDetails, installerDetails) { @NonCPS def checkISMfile(String ISMfile) { def xml = readFile(ISMfile) - + echo "Checking ISM file: ${ISMfile}" + def parsedxml = new XmlParser(true, true, true).parseText(xml) def pathvariableinfo = [:] def exitcode = 0 @@ -53,24 +54,26 @@ def checkISMfile(String ISMfile) { } // Check that each path variable is defined beginning with a path variable or the WORKSPACE one pathvariableinfo.each{ pair -> - println "pair key: ${pair.key} value: ${pair.value}" + echo "pair key: ${pair.key} value: ${pair.value}" def path = pair.value def pathvarmatcher = path =~ /<(.*)>.*/ if (pathvarmatcher.matches()) { def pathvarfound = pathvarmatcher.group(1) if (pathvarfound != 'WORKSPACE') { if (!pathvariableinfo.containsKey(pathvarfound)) { - println "Undefined path variable ${pathvarfound} found" + echo "Undefined path variable ${pathvarfound} found" exitcode = 1 } } } else { - println "Path: ${path} does not begin with a path variable" + echo "Path: ${path} does not begin with a path variable" exitcode = 1 } } if (exitcode > 0) { error "The ISM file: ${ISMfile} contains a path that is either absolute or does not begin with another path variable definition" + } else { + echo "ISM file: ${ISMfile} - ok" } } From 865deaecf843177e6f223ef3c676dcbbc1d96601 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Apr 2019 18:30:16 +0100 Subject: [PATCH 0859/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index f3dcdd4..823c117 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -33,7 +33,8 @@ def placeBinaries(artifactDetails, installerDetails) { @NonCPS def checkISMfile(String ISMfile) { def xml = readFile(ISMfile) - + echo "Checking ISM file: ${ISMfile}" + def parsedxml = new XmlParser(true, true, true).parseText(xml) def pathvariableinfo = [:] def exitcode = 0 @@ -53,24 +54,26 @@ def checkISMfile(String ISMfile) { } // Check that each path variable is defined beginning with a path variable or the WORKSPACE one pathvariableinfo.each{ pair -> - println "pair key: ${pair.key} value: ${pair.value}" + echo "pair key: ${pair.key} value: ${pair.value}" def path = pair.value def pathvarmatcher = path =~ /<(.*)>.*/ if (pathvarmatcher.matches()) { def pathvarfound = pathvarmatcher.group(1) if (pathvarfound != 'WORKSPACE') { if (!pathvariableinfo.containsKey(pathvarfound)) { - println "Undefined path variable ${pathvarfound} found" + echo "Undefined path variable ${pathvarfound} found" exitcode = 1 } } } else { - println "Path: ${path} does not begin with a path variable" + echo "Path: ${path} does not begin with a path variable" exitcode = 1 } } if (exitcode > 0) { error "The ISM file: ${ISMfile} contains a path that is either absolute or does not begin with another path variable definition" + } else { + echo "ISM file: ${ISMfile} - ok" } } From 08a7350ee8eed79257c89a310a10de6580d04d8c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Apr 2019 08:39:15 +0100 Subject: [PATCH 0860/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 823c117..51edd3d 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -31,9 +31,8 @@ def placeBinaries(artifactDetails, installerDetails) { } @NonCPS -def checkISMfile(String ISMfile) { - def xml = readFile(ISMfile) - echo "Checking ISM file: ${ISMfile}" +def checkISMfilebackend(String xml) { + def String message = "" def parsedxml = new XmlParser(true, true, true).parseText(xml) def pathvariableinfo = [:] @@ -54,26 +53,31 @@ def checkISMfile(String ISMfile) { } // Check that each path variable is defined beginning with a path variable or the WORKSPACE one pathvariableinfo.each{ pair -> - echo "pair key: ${pair.key} value: ${pair.value}" + 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)) { - echo "Undefined path variable ${pathvarfound} found" + message += "Undefined path variable ${pathvarfound} found\n" exitcode = 1 } } } else { - echo "Path: ${path} does not begin with a path variable" + 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) if (exitcode > 0) { - error "The ISM file: ${ISMfile} contains a path that is either absolute or does not begin with another path variable definition" - } else { - echo "ISM file: ${ISMfile} - ok" + error "ISM file errors found:\n${message}" } } From 16ff70565612f9ef6590e8c4c3c928b6ed66e27e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Apr 2019 08:39:15 +0100 Subject: [PATCH 0861/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 823c117..51edd3d 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -31,9 +31,8 @@ def placeBinaries(artifactDetails, installerDetails) { } @NonCPS -def checkISMfile(String ISMfile) { - def xml = readFile(ISMfile) - echo "Checking ISM file: ${ISMfile}" +def checkISMfilebackend(String xml) { + def String message = "" def parsedxml = new XmlParser(true, true, true).parseText(xml) def pathvariableinfo = [:] @@ -54,26 +53,31 @@ def checkISMfile(String ISMfile) { } // Check that each path variable is defined beginning with a path variable or the WORKSPACE one pathvariableinfo.each{ pair -> - echo "pair key: ${pair.key} value: ${pair.value}" + 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)) { - echo "Undefined path variable ${pathvarfound} found" + message += "Undefined path variable ${pathvarfound} found\n" exitcode = 1 } } } else { - echo "Path: ${path} does not begin with a path variable" + 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) if (exitcode > 0) { - error "The ISM file: ${ISMfile} contains a path that is either absolute or does not begin with another path variable definition" - } else { - echo "ISM file: ${ISMfile} - ok" + error "ISM file errors found:\n${message}" } } From b7c5f9805b841417dc59a28c2a1fa96fb8374fcf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Apr 2019 08:57:32 +0100 Subject: [PATCH 0862/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 51edd3d..6ac2e80 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -42,10 +42,10 @@ def checkISMfilebackend(String xml) { // 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") { + 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 } } From 291b39bf5bd2e05374a2fe136ca5476747df62e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Apr 2019 08:57:32 +0100 Subject: [PATCH 0863/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 51edd3d..6ac2e80 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -42,10 +42,10 @@ def checkISMfilebackend(String xml) { // 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") { + 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 } } From f141d804103ce3301c18dbe79cdeaf10fd61d188 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Apr 2019 09:30:24 +0100 Subject: [PATCH 0864/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 6ac2e80..ca9c502 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -78,6 +78,9 @@ def checkISMfile(String ISMfile) { (exitcode, message) = checkISMfilebackend(xml) if (exitcode > 0) { error "ISM file errors found:\n${message}" + } else { + echo "Checked ISM file: ${ISMfile} - ok" + echo message } } From 429d901d014ef6cd5669d9c0c078f680bd1c8649 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Apr 2019 09:30:24 +0100 Subject: [PATCH 0865/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 6ac2e80..ca9c502 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -78,6 +78,9 @@ def checkISMfile(String ISMfile) { (exitcode, message) = checkISMfilebackend(xml) if (exitcode > 0) { error "ISM file errors found:\n${message}" + } else { + echo "Checked ISM file: ${ISMfile} - ok" + echo message } } From 2317111f3bde99ef2feae3a6feaaade1dd78868d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Apr 2019 10:44:43 +0100 Subject: [PATCH 0866/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index ca9c502..1464e9d 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -76,11 +76,11 @@ 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:\n${message}" + error "ISM file errors found" } else { - echo "Checked ISM file: ${ISMfile} - ok" - echo message + echo "Checked ISM file - ok" } } From 098b0cb8372189e4c30c6b55fe56b0ac4c7725c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Apr 2019 10:44:43 +0100 Subject: [PATCH 0867/1971] Perform installer file (ISM) checking --- install/installhelper.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index ca9c502..1464e9d 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -76,11 +76,11 @@ 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:\n${message}" + error "ISM file errors found" } else { - echo "Checked ISM file: ${ISMfile} - ok" - echo message + echo "Checked ISM file - ok" } } From 64f742ffa7aca162745f986688280725cc543f5d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 12 Apr 2019 14:55:49 +0100 Subject: [PATCH 0868/1971] Remove diff folder before building --- copy/logic.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/copy/logic.groovy b/copy/logic.groovy index 6e97510..0b4823d 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -14,6 +14,7 @@ pipeline { cleanfolders = [ "${WORKSPACE}/logic", "${WORKSPACE}/embedded_logic", + "${WORKSPACE}/diff", ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) From 49a38e0eb1930649c7aa61a4cda9f64cb23a0f42 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 12 Apr 2019 14:55:49 +0100 Subject: [PATCH 0869/1971] Remove diff folder before building --- copy/logic.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/copy/logic.groovy b/copy/logic.groovy index 6e97510..0b4823d 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -14,6 +14,7 @@ pipeline { cleanfolders = [ "${WORKSPACE}/logic", "${WORKSPACE}/embedded_logic", + "${WORKSPACE}/diff", ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) From 019ec1ab3b6e3c571cd2c82fe42adddbfe2f10a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 15 Apr 2019 09:57:18 +0100 Subject: [PATCH 0870/1971] Logic copy doesn't work if pre-existing folders from previous builds exist --- copy/logic.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 6e97510..5a0c80d 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -36,7 +36,7 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - rm -v -rf meta + rm -v -rf diff meta embedded_logic mv -v logic/* . """ archiveArtifacts "${artifactlist}" From 3286473a46b80cb90aaeba9fd13c24e13a540821 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 15 Apr 2019 09:57:18 +0100 Subject: [PATCH 0871/1971] Logic copy doesn't work if pre-existing folders from previous builds exist --- copy/logic.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 6e97510..5a0c80d 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -36,7 +36,7 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - rm -v -rf meta + rm -v -rf diff meta embedded_logic mv -v logic/* . """ archiveArtifacts "${artifactlist}" From 5daf7c01d8239569439ea5ed3ab0f7e53460e0c5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Apr 2019 11:28:51 +0100 Subject: [PATCH 0872/1971] Meta-diff folder is not being reset at the beginning of a build --- meta/folder.groovy | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 346b2ee..6e0823e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -655,6 +655,10 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME } + static String difffolder() { + return DIFFFOLDERNAME + } + 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}" @@ -763,6 +767,11 @@ MetaInfo metareset(script) { dir(mi.folder()) { deleteDir() } + + dir(mi.difffolder()) { + deleteDir() + } + return mi } From 46105a841d748708cb18a9627d7081744ce5964d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 25 Apr 2019 22:47:29 +0100 Subject: [PATCH 0873/1971] GIS-7565 - Attempt at altering artifact output structure in order to simplify publishable item presentation to CAMs at publishing time --- release/do.groovy | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index fd2b06b..596f107 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -275,6 +275,22 @@ def sourcegitpush(String dryrunpush ) { } } +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() @@ -283,8 +299,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim() echo "Pre commit sha code: ${precommitshacode}" - def boolean alreadyreleased = buildmeta.releaseinfo.released - echo "Already released: ${alreadyreleased}" + def boolean alreadyreleased = isalreadyreleased(buildmeta, buildstamptag) def String postcommitshacode def boolean changed = false From 8cadf19ce95e36b8c6b4a89409d62d722a64ca06 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Apr 2019 18:30:16 +0100 Subject: [PATCH 0874/1971] Slight change of message --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 596f107..9b46114 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -189,7 +189,7 @@ def boolean releasegittag(String postcommitshacode, String tag) { if (existingshacode) { // Tag exists if (existingshacode != postcommitshacode) { // 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 tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") + setunstable("The release tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") summaryappend("(${tag} - Could not add!)") } else { summaryappend("(${tag} - Already added)") From cbacd69e00c09bc24c21f473bbbbff9de27f1cc3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 28 Apr 2019 09:38:53 +0100 Subject: [PATCH 0875/1971] Perform a git lfs install each time there is a git checkout --- versioncontrol/git.groovy | 58 +++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 253ffee..b386a9a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -75,7 +75,23 @@ def String checkouttoreporoot(String gitURL) { 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 + """ + } +} + def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + checkgitlfsinstall() def reporootpath = checkouttoreporoot(gitURL) checkout([ $class: 'GitSCM', @@ -99,33 +115,33 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo } String getSHAFromVersion(String versionFolder) { - dir (versionFolder) { + dir (versionFolder) { srcRevision = readFile("gitrevision.txt").trim() - } - return srcRevision + } + return srcRevision } boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { def keys = versions.keySet() - if (keys.size() < 1) { - return false - } - if (keys.size() == 1) { - return true - } + 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 + version = "" + for (key in keys) { + nextversion = versions.get(key) + if (version == "") { + version = nextversion + } + if (nextversion != version) { + return false + } + } + } + return true } def stripgithistory(String rootfolder) { From e12939d9287e9a8f24c6ebb83d3a93a4007fb523 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 28 Apr 2019 11:56:15 +0100 Subject: [PATCH 0876/1971] Added a comment --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 9b46114..b3d54c7 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -61,7 +61,7 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { } previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder) dir(checkoutfolder) { - // Clear all existing files + // Clear all existing files - Note that this does not remove .git* sh("git rm -r *") } return previousreleasemeta From e00f228c7b9a5bdefa3eeefa1e929f473e4d2591 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 28 Apr 2019 14:20:28 +0100 Subject: [PATCH 0877/1971] Detect if a publishable item filepath is valid or not --- publishing/utils.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 145a7e9..2ab4059 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,8 +1,23 @@ + +// The filepath must end in "/**" or "/" - Glob wildcard - as a git sparse checkout +def checkallowed(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) { + checkallowed(filepath) meta.addPublishable(filepath) } } From 8fecc6c3200bb0643b33ac9b44b78f43b7545cc6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 28 Apr 2019 14:50:31 +0100 Subject: [PATCH 0878/1971] Move functionality to common area --- install/installhelper.groovy | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 1464e9d..32da99b 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -1,3 +1,27 @@ +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, artifactDetails, installerDetails) { artifactFetched = [:] From c4651ca04e4c18cacb292be662a19681712b11b1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 28 Apr 2019 15:13:20 +0100 Subject: [PATCH 0879/1971] Release list is not being passed correctly --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 6e0823e..b16db5d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -233,6 +233,7 @@ class ReleaseInfo extends GISJsonSerialised { } void addReleaseItem(String releaseitem) { + script.echo("Adding release item: ${releaseitem} to release items") releaseitems.add(releaseitem) } From 91a58544c3e8af3870b1200270c8cf90c5174b94 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 28 Apr 2019 15:36:29 +0100 Subject: [PATCH 0880/1971] Remove redundant binaries copy to bin folder stage --- install/installhelper.groovy | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 32da99b..eebbd34 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -38,22 +38,6 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { return artifactFetched } -// Export any required binaries to the /bin folder -def placeBinaries(artifactDetails, installerDetails) { - for (installer in toBuild) { - (installertool, artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer) - if (exportBinaries) { - (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactSet) - for (binaryFolder in binariesFolders) { - def binariesSourceFolder = "${destFolder}/${binaryFolder}" - def binariesDestFolder = "${WORKSPACE}/bin/${artifactSet}/${binaryFolder}" - echo "Copying from: ${binariesSourceFolder} to: ${binariesDestFolder}" - fileOperations([folderCopyOperation(destinationFolderPath: binariesDestFolder, sourceFolderPath: binariesSourceFolder)]) - } - } - } -} - @NonCPS def checkISMfilebackend(String xml) { def String message = "" From 730ec0c5ff05fcec74bc1b7b1c432d07f9058df5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 29 Apr 2019 10:55:10 +0100 Subject: [PATCH 0881/1971] Don't check publishable file paths for meta/** as its only save usually at the end of the build --- publishing/utils.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 2ab4059..2daf6f6 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,7 +1,7 @@ // The filepath must end in "/**" or "/" - Glob wildcard - as a git sparse checkout -def checkallowed(String filepath) { +def allowed(String filepath) { if (filepath.endsWith('/**') || filepath.endsWith('/')) { def files = findFiles glob: filepath if (files.length > 0) { @@ -17,7 +17,9 @@ def checkallowed(String filepath) { def generatelist(meta, publishable) { filelist = [] for (filepath in publishable) { - checkallowed(filepath) + if (filepath != meta.METAARTIFACTS) { + allowed(filepath) + } meta.addPublishable(filepath) } } From d55d2a24c4ea87e35a3ebae26f402807f7b10819 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 May 2019 15:13:08 +0100 Subject: [PATCH 0882/1971] Rather than check out a release repo to see if it exists or not use git ls-remote to establish if it exists --- release/registerrepo.groovy | 2 +- versioncontrol/git.groovy | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy index 2dffdc7..bd6a528 100644 --- a/release/registerrepo.groovy +++ b/release/registerrepo.groovy @@ -4,7 +4,7 @@ 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, String repoRootSuffix = "") { if (releaserepo?.trim()) { - vc.gitCheckout(releaserepo, "origin/master", "tmp/releaserepo", repoRootSuffix) + vc.checkRepoExists(releaserepo) } meta.releaseinfo.set(releaserepo) } diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index b386a9a..96fa571 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -114,6 +114,28 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo ]) } +def checkRepoExists(String gitURL) { + def boolean result = false + if (isUnix()) { + result = sh( script: """ + git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY + if [ \$? -ne 0 ]; then exit 1; fi + """, + returnStatus: true + ) + } else { + result = bash( script: """ + git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY + if errorlevel 1 EXIT /b 1 + """, + returnStatus: true + ) + } + if (!result) { + error("The release repo: ${gitURL} cannot be found. Please ensure this exists before building") + } +} + String getSHAFromVersion(String versionFolder) { dir (versionFolder) { srcRevision = readFile("gitrevision.txt").trim() From c13ba0d6289bd14c0a76198ca7125cfa859b3328 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 May 2019 15:15:34 +0100 Subject: [PATCH 0883/1971] Rather than check out a release repo to see if it exists or not use git ls-remote to establish if it exists --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 96fa571..cea31fc 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -124,7 +124,7 @@ def checkRepoExists(String gitURL) { returnStatus: true ) } else { - result = bash( script: """ + result = bat( script: """ git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY if errorlevel 1 EXIT /b 1 """, From 9af654fb28e93396c128a571be4ab365fbd2bd45 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 May 2019 15:20:36 +0100 Subject: [PATCH 0884/1971] Rather than check out a release repo to see if it exists or not use git ls-remote to establish if it exists --- versioncontrol/git.groovy | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index cea31fc..36f4c64 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -119,14 +119,12 @@ def checkRepoExists(String gitURL) { if (isUnix()) { result = sh( script: """ git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY - if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true ) } else { result = bat( script: """ - git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY - if errorlevel 1 EXIT /b 1 + @git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY """, returnStatus: true ) From a42acef027fd7fb3b8c4b47c9fb470584a27b75b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 May 2019 15:26:22 +0100 Subject: [PATCH 0885/1971] Rather than check out a release repo to see if it exists or not use git ls-remote to establish if it exists --- versioncontrol/git.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 36f4c64..12d5bc6 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -130,6 +130,7 @@ def checkRepoExists(String gitURL) { ) } if (!result) { + echo "git ls-remote return result: ${result}" error("The release repo: ${gitURL} cannot be found. Please ensure this exists before building") } } From 7a62550a07890fc69f415e36dcaf5c4f22627dd8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 May 2019 15:29:15 +0100 Subject: [PATCH 0886/1971] Rather than check out a release repo to see if it exists or not use git ls-remote to establish if it exists --- versioncontrol/git.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 12d5bc6..ee7e99a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -115,7 +115,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo } def checkRepoExists(String gitURL) { - def boolean result = false + def int result = 0 if (isUnix()) { result = sh( script: """ git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY @@ -129,7 +129,7 @@ def checkRepoExists(String gitURL) { returnStatus: true ) } - if (!result) { + if (result > 0) { echo "git ls-remote return result: ${result}" error("The release repo: ${gitURL} cannot be found. Please ensure this exists before building") } From 0216685c99d3ce9c564a6c88fc61fd1f8bb99c22 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 May 2019 15:31:49 +0100 Subject: [PATCH 0887/1971] Rather than check out a release repo to see if it exists or not use git ls-remote to establish if it exists --- versioncontrol/git.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index ee7e99a..f72fc5a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -129,9 +129,11 @@ def checkRepoExists(String gitURL) { returnStatus: true ) } + echo "git ls-remote return result: ${result}" if (result > 0) { - echo "git ls-remote return result: ${result}" error("The release repo: ${gitURL} cannot be found. Please ensure this exists before building") + } else { + echo "The release repo: ${gitURL} exists" } } From 4bb8bcec23a4ced93535ab7d4f19538568b30ba1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 7 May 2019 10:28:39 +0100 Subject: [PATCH 0888/1971] Warn of git stripping not being supported in Windows --- versioncontrol/git.groovy | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index f72fc5a..b639c91 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -170,13 +170,17 @@ boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { def stripgithistory(String rootfolder) { echo "Stripping git history out of ${rootfolder}" dir(rootfolder) { - 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 - """ + 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 + """ + } else { + echo "Not supporting git stripping in Windows at the moment" + } } } From 55a2e2a03444ed9e942316f3785667ba4f338375 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 7 May 2019 10:28:39 +0100 Subject: [PATCH 0889/1971] Warn of git stripping not being supported in Windows --- versioncontrol/git.groovy | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index f72fc5a..b639c91 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -170,13 +170,17 @@ boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) { def stripgithistory(String rootfolder) { echo "Stripping git history out of ${rootfolder}" dir(rootfolder) { - 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 - """ + 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 + """ + } else { + echo "Not supporting git stripping in Windows at the moment" + } } } From b18dba3c00b34ce1202609d5947050950679d98b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 May 2019 21:51:31 +0100 Subject: [PATCH 0890/1971] Print out items in sparse item list if the list is not empty --- versioncontrol/git.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index b639c91..fc15f81 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -93,6 +93,12 @@ def checkgitlfsinstall() { def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { checkgitlfsinstall() def reporootpath = checkouttoreporoot(gitURL) + if (!sparseitemlist.isEmpty()) { + echo "Items in sparse item list: " + for (item in sparseitemlist) { + echo item + } + } checkout([ $class: 'GitSCM', userRemoteConfigs: [ From 4c4958db9b40be65fa611df7a5feb3e820873483 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 May 2019 22:11:54 +0100 Subject: [PATCH 0891/1971] Print out items in sparse item list if the list is not empty --- versioncontrol/git.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index fc15f81..56d206c 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -94,10 +94,11 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo checkgitlfsinstall() def reporootpath = checkouttoreporoot(gitURL) if (!sparseitemlist.isEmpty()) { - echo "Items in sparse item list: " + def itemstring = "Items in sparse item list:\n" for (item in sparseitemlist) { - echo item + itemstring += item + "\n" } + echo itemstring } checkout([ $class: 'GitSCM', @@ -114,7 +115,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], - sparsecheckoutconfig(sparseitemlist) + [$class: 'SparseCheckoutPaths', sparseCheckoutPaths: sparsecheckoutconfig(sparseitemlist)], ], submoduleCfg: [], ]) From 5be5dfce45b25b7544fc9b0012f51905c66581d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 May 2019 22:14:22 +0100 Subject: [PATCH 0892/1971] Print out items in sparse item list if the list is not empty --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 56d206c..5a92884 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -115,7 +115,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo [$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)], + [$class: 'SparseCheckoutPaths', sparsecheckoutconfig(sparseitemlist)], ], submoduleCfg: [], ]) From ddc231ccacd21a672eaf1be65fa30640ba692178 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 May 2019 22:54:47 +0100 Subject: [PATCH 0893/1971] Print out items in sparse item list if the list is not empty --- versioncontrol/git.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 5a92884..b37bbc7 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -11,12 +11,12 @@ String getGitInfo(String workingSetRootPath) { } @NonCPS -def SparseCheckoutPaths sparsecheckoutconfig(ArrayList paths) { +def ArrayList sparsecheckoutconfig(ArrayList paths) { ArrayList sparsecheckoutpaths = new ArrayList() for (path in paths) { sparsecheckoutpaths.add(new SparseCheckoutPath(path)) } - return new SparseCheckoutPaths(sparsecheckoutpaths) + return sparsecheckoutpaths } def String uniquereporootname(String gitURL) { @@ -115,7 +115,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], - [$class: 'SparseCheckoutPaths', sparsecheckoutconfig(sparseitemlist)], + [$class: 'SparseCheckoutPaths', sparseCheckoutPaths: sparsecheckoutconfig(sparseitemlist)], ], submoduleCfg: [], ]) From 2c9113cc4d8045de29f6a9aeb33f9c5501904aab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 May 2019 23:17:20 +0100 Subject: [PATCH 0894/1971] Print out items in sparse item list if the list is not empty --- publish/publish.groovy | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/publish/publish.groovy b/publish/publish.groovy index b478a5d..b74b72a 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -32,6 +32,15 @@ pipeline { } } } + stage('Test sparse checkout') { + steps { + script { + def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + def ArrayList publishablepaths = ['installers/KM/'] + gh.gitCheckout('git@hydra:releases/print-server-installer.git', 'origin/master', 'testfolder', "", 1, true, publishablepaths) // Shallow clone + } + } + } stage('Get release artifact meta') { steps { script { From 7b50a27c26a0b492ddd17160babbaaa40756ef2d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 May 2019 23:23:32 +0100 Subject: [PATCH 0895/1971] Print out items in sparse item list if the list is not empty --- publish/publish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publish.groovy b/publish/publish.groovy index b74b72a..6f9fd44 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -36,7 +36,7 @@ pipeline { steps { script { def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - def ArrayList publishablepaths = ['installers/KM/'] + def ArrayList publishablepaths = ['installers/KM/*'] gh.gitCheckout('git@hydra:releases/print-server-installer.git', 'origin/master', 'testfolder', "", 1, true, publishablepaths) // Shallow clone } } From 6b9f624770a3e093ffdde027ed228d9d0880b9d0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 May 2019 09:11:38 +0100 Subject: [PATCH 0896/1971] Need an alternative way to checkout because git plugin is not working when using LFS and sparse checkout simultaneously --- versioncontrol/git.groovy | 85 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index b37bbc7..fed039a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -90,6 +90,91 @@ def checkgitlfsinstall() { } } +def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { + checkgitlfsinstall() + def reporootpath = checkouttoreporoot(gitURL) + if (!sparseitemlist.isEmpty()) { + def itemstring = "Items in sparse item list:\n" + for (item in sparseitemlist) { + itemstring += item + "\n" + } + echo itemstring + } + 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: [], + ]) +} + +//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 + +// 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()) { checkgitlfsinstall() def reporootpath = checkouttoreporoot(gitURL) From a6cdcccb123d651b62c93fcc1792c4aaa955fe7b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 May 2019 23:21:35 +0100 Subject: [PATCH 0897/1971] Try to get sparse checkout to work with lfs --- publish/do.groovy | 2 +- versioncontrol/git.groovy | 96 +++++++++++++++++++++++++-------------- 2 files changed, 63 insertions(+), 35 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index b63b15c..1599ca8 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -83,7 +83,7 @@ def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder, ite } if (publishablepaths.size() > 0) { def reporootsuffix = guessreporootsuffix(componentURL) - gh.gitCheckout(componentURL, revision, repofolder, reporootsuffix, 1, true, publishablepaths) // Shallow clone + gh.gitCheckoutAlt(componentURL, revision, repofolder, reporootsuffix, 1, true, publishablepaths) // Shallow clone } else { summaryappend("None ") diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index fed039a..1652e6b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -90,37 +90,6 @@ def checkgitlfsinstall() { } } -def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { - checkgitlfsinstall() - def reporootpath = checkouttoreporoot(gitURL) - if (!sparseitemlist.isEmpty()) { - def itemstring = "Items in sparse item list:\n" - for (item in sparseitemlist) { - itemstring += item + "\n" - } - echo itemstring - } - 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: [], - ]) -} - //No credentials specified //Cloning the remote Git repository //Cloning repository git@hydra:print-server-releases/print_server_whole.git @@ -174,10 +143,12 @@ def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repo // Commit message: "2.10180.7389.21125_3" // > git rev-list --no-walk d0788d22622862e441c5995a22629846573c39f3 # timeout=10 -// 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 lfsinstallandreporoot(String gitURL) { checkgitlfsinstall() - def reporootpath = checkouttoreporoot(gitURL) + return checkouttoreporoot(gitURL) +} + +def showsparseitemlist(ArrayList sparseitemlist = new ArrayList()) { if (!sparseitemlist.isEmpty()) { def itemstring = "Items in sparse item list:\n" for (item in sparseitemlist) { @@ -185,6 +156,9 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo } echo itemstring } +} + +def docheckout(String gitURL, String revision, int cloneDepth, String reporootpath, boolean shallowClone, String targetDir, sparseitemlist) { checkout([ $class: 'GitSCM', userRemoteConfigs: [ @@ -206,6 +180,60 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo ]) } +// 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 + if (isUnix()) { + sh """ + git init "${targetDir}" + """ + } else { + bat """ + git init "${targetDir}" + """ + } + 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}," + } + dir(targetDir) { + if (isUnix()) { + sh """ + git config lfs.fetchinclude "${sparseitemliststring}" + """ + } else { + bat """ + git config lfs.fetchinclude "${sparseitemliststring}" + """ + } + } + } +} + +def gitCheckoutAlt(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) + if (!sparseitemlist.isEmpty()) { + gitinit(targetDir, reporootpath) + setlfsfetchinclude(targetDir, sparseitemlist) + } + docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist) +} + def checkRepoExists(String gitURL) { def int result = 0 if (isUnix()) { From 3686e219763bdaaf9608366e0bc57bfc5e63c4f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 May 2019 23:32:18 +0100 Subject: [PATCH 0898/1971] Try to get sparse checkout to work with lfs --- versioncontrol/git.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 1652e6b..a5890f2 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -189,6 +189,7 @@ def gitCheckout(String gitURL, String revision, String targetDir, String repoRoo 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}" @@ -198,6 +199,7 @@ def gitinit(String targetDir, String reporootpath) { 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") } @@ -210,6 +212,7 @@ def setlfsfetchinclude(String targetDir, ArrayList sparseitemlist) { for (item in sparseitemlist) { sparseitemliststring += "${item}," } + echo "git config lfs.fetchinclude ${sparseitemliststring}" dir(targetDir) { if (isUnix()) { sh """ @@ -225,6 +228,7 @@ def setlfsfetchinclude(String targetDir, ArrayList sparseitemlist) { } 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()) { From f29e1beb7b0774d09dbc87d8d5810b3e8ae65bc5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 May 2019 23:34:52 +0100 Subject: [PATCH 0899/1971] Try to get sparse checkout to work with lfs --- publish/publish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publish.groovy b/publish/publish.groovy index 6f9fd44..e4539f1 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -37,7 +37,7 @@ pipeline { script { def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def ArrayList publishablepaths = ['installers/KM/*'] - gh.gitCheckout('git@hydra:releases/print-server-installer.git', 'origin/master', 'testfolder', "", 1, true, publishablepaths) // Shallow clone + gh.gitCheckoutAlt('git@hydra:releases/print-server-installer.git', 'origin/master', 'testfolder', "", 1, true, publishablepaths) // Shallow clone } } } From 1aee93e12163bc61a6dbacadf895674519b2fae0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 May 2019 23:42:49 +0100 Subject: [PATCH 0900/1971] Try to get sparse checkout to work with lfs --- versioncontrol/git.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index a5890f2..1bf9cd1 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -199,10 +199,10 @@ def gitinit(String targetDir, String reporootpath) { 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") - } + } + echo "Writing ${reporootpath}/.git/objects to ${targetDir}/.git/objects/info/alternates" + dir("${targetDir}/.git/objects/info") { + writeFile(file: 'alternates', text: "${reporootpath}/.git/objects") } } From eb8a1005ec7f2e4f62e65a76f9386d72e3514699 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 May 2019 00:02:48 +0100 Subject: [PATCH 0901/1971] Try to get sparse checkout to work with lfs --- versioncontrol/git.groovy | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 1bf9cd1..ccbd458 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -227,6 +227,25 @@ def setlfsfetchinclude(String targetDir, ArrayList sparseitemlist) { } } +def gitsparserestore(String targetDir) { + echo "Clean out full fetch; Force a sparse fetch" + dir(targetDir) { + if (isUnix()) { + sh """ + git rm -rf . + git clean -fxd + git reset --hard + """ + } else { + bat """ + git rm -rf . + git clean -fxd + git reset --hard + """ + } + } + } + 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) @@ -236,6 +255,9 @@ def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repo setlfsfetchinclude(targetDir, sparseitemlist) } docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist) + if (!sparseitemlist.isEmpty()) { + gitsparserestore(targetDir) + } } def checkRepoExists(String gitURL) { From 35ef539f5c85632660016fcbd60a58179001894b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 May 2019 00:16:04 +0100 Subject: [PATCH 0902/1971] Try to get sparse checkout to work with lfs --- versioncontrol/git.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index ccbd458..8886076 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -232,15 +232,15 @@ def gitsparserestore(String targetDir) { dir(targetDir) { if (isUnix()) { sh """ - git rm -rf . - git clean -fxd - git reset --hard + git rm -rf . > /dev/null + git clean -fxd > /dev/null + git reset --hard > /dev/null """ } else { bat """ - git rm -rf . - git clean -fxd - git reset --hard + git rm -rf . 2> nul + git clean -fxd 2> nul + git reset --hard 2> nul """ } } From c1ceeca1430b9d90f792572c38291bbc7ea60aab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 May 2019 00:22:01 +0100 Subject: [PATCH 0903/1971] Try to get sparse checkout to work with lfs --- publish/publish.groovy | 9 --------- 1 file changed, 9 deletions(-) diff --git a/publish/publish.groovy b/publish/publish.groovy index e4539f1..b478a5d 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -32,15 +32,6 @@ pipeline { } } } - stage('Test sparse checkout') { - steps { - script { - def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - def ArrayList publishablepaths = ['installers/KM/*'] - gh.gitCheckoutAlt('git@hydra:releases/print-server-installer.git', 'origin/master', 'testfolder', "", 1, true, publishablepaths) // Shallow clone - } - } - } stage('Get release artifact meta') { steps { script { From 26650ee254403cc2d6a850be1241b9000e124530 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 16 May 2019 18:27:20 +0100 Subject: [PATCH 0904/1971] Add skeletal meta differences script files --- differences/dometahierarchy.groovy | 10 ++++ differences/metahierarchy.groovy | 92 ++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 differences/dometahierarchy.groovy create mode 100644 differences/metahierarchy.groovy diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy new file mode 100644 index 0000000..65e6cf4 --- /dev/null +++ b/differences/dometahierarchy.groovy @@ -0,0 +1,10 @@ + +def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String summaryfolder, int maxdepth) { + def String summarystring = "No summary" + def boolean markunstable = true + def unstablereason = "No compare implementation yet" + + return [summarystring, markunstable, unstablereason] +} + +return this; diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy new file mode 100644 index 0000000..3ea9dbc --- /dev/null +++ b/differences/metahierarchy.groovy @@ -0,0 +1,92 @@ +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" + cleanfolders = [ + "${WORKSPACE}/build_artifacts", + "${WORKSPACE}/early", + "${WORKSPACE}/later", + "${SUMMARYDIR}", + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Checkout top level meta') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + SOURCEURL = 'git@hydra:gis/newsw.git' + + EARLYREVISION = "${RELEASE_EARLY_REVISION}".trim() + EARLYROOTDIR = 'early' + EARLYDIR = "${WORKSPACE}/${EARLYROOTDIR}" + configurationhelper.gitCheckoutAndRegister(meta, EARLYROOTDIR, SOURCEURL, EARLYREVISION, EARLYDIR, EARLYROOTDIR, 0, false) + + LATERREVISION = "${RELEASE_LATER_REVISION}".trim() + LATERROOTDIR = 'later' + LATERDIR = "${WORKSPACE}/${LATERROOTDIR}" + configurationhelper.gitCheckoutAndRegister(meta, LATERROOTDIR, SOURCEURL, LATERREVISION, LATERDIR, LATERROOTDIR, 0, false) + } + } + } + stage('Diff components') { + steps { + script { + def comparator = load("${autobuilder.commonscripts()}/differences/dometahierarchy.groovy") + (summarystring, markunstable, unstablereason) = comparator.comparehierarchy(meta, EARLYDIR, LATERDIR, SUMMARYDIR, 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' + } + } +} + From f70406e72ba6ed5188134541454dd78a8f9561e7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 16 May 2019 18:35:45 +0100 Subject: [PATCH 0905/1971] Add skeletal meta differences script files --- differences/metahierarchy.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 3ea9dbc..d82fcc0 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -29,14 +29,14 @@ pipeline { script { configurationhelper = autobuilder.configurationhelper() - SOURCEURL = 'git@hydra:gis/newsw.git' + SOURCEURL = TOP_LEVEL_META_REPOSITORY.trim() - EARLYREVISION = "${RELEASE_EARLY_REVISION}".trim() + EARLYREVISION = RELEASE_EARLY_REVISION.trim() EARLYROOTDIR = 'early' EARLYDIR = "${WORKSPACE}/${EARLYROOTDIR}" configurationhelper.gitCheckoutAndRegister(meta, EARLYROOTDIR, SOURCEURL, EARLYREVISION, EARLYDIR, EARLYROOTDIR, 0, false) - LATERREVISION = "${RELEASE_LATER_REVISION}".trim() + LATERREVISION = RELEASE_LATER_REVISION.trim() LATERROOTDIR = 'later' LATERDIR = "${WORKSPACE}/${LATERROOTDIR}" configurationhelper.gitCheckoutAndRegister(meta, LATERROOTDIR, SOURCEURL, LATERREVISION, LATERDIR, LATERROOTDIR, 0, false) From 36224b7c865a8218da05cc410ad96e2eddf50b86 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 16 May 2019 18:48:25 +0100 Subject: [PATCH 0906/1971] Add skeletal meta differences script files --- differences/dometahierarchy.groovy | 6 +++++- differences/metahierarchy.groovy | 2 +- release/do.groovy | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 65e6cf4..1d6885f 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,5 +1,9 @@ -def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String summaryfolder, int maxdepth) { +def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { + def int md = maxdepth.toInteger() + + echo "Comparing product meta hierarchy from folders: ${earlymetafolder} and ${latermetafolder} to a depth of ${md}. Exporting summary to ${summaryfolder}" + def String summarystring = "No summary" def boolean markunstable = true def unstablereason = "No compare implementation yet" diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index d82fcc0..cd6738d 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -47,7 +47,7 @@ pipeline { steps { script { def comparator = load("${autobuilder.commonscripts()}/differences/dometahierarchy.groovy") - (summarystring, markunstable, unstablereason) = comparator.comparehierarchy(meta, EARLYDIR, LATERDIR, SUMMARYDIR, MAX_META_DEPTH) + (summarystring, markunstable, unstablereason) = comparator.comparehierarchy(meta, EARLYDIR, LATERDIR, MAX_META_DEPTH, SUMMARYDIR) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' diff --git a/release/do.groovy b/release/do.groovy index b3d54c7..738c04a 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -365,7 +365,7 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri } def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) { - int md = maxdepth.toInteger() + def int md = maxdepth.toInteger() resetfolders() preconditions() From 7e5c624d72bec8116849ac59e57cb75272981407 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 May 2019 11:02:28 +0100 Subject: [PATCH 0907/1971] Strip *@tmp folders from published folder --- versioncontrol/git.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 8886076..534084d 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -323,6 +323,7 @@ def stripgithistory(String rootfolder) { 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" From a6fe97d65e5b7c3c3a45ce53ff4f6f150b6b931c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 19:39:52 +0100 Subject: [PATCH 0908/1971] MCS-425 - Perform a sparse checkout of items to import from a release repo --- import/importer.groovy | 23 ++++++++++++++++++++++- publish/do.groovy | 13 +++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 34707bc..9620e8a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -42,7 +42,7 @@ def rewritemetafileasreleased(meta, String filepath) { meta.saveJsonSerialised(filepath) } -def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { +def hierarchyartifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { def rooturl = repo.trim() def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" @@ -76,6 +76,27 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, return importedmeta } +def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { + def rooturl = repo.trim() + def rootrevision = revision.trim() + echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" + + def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) { + gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) + + def importedmeta = meta.importrelated(destpath) + + gh.stripgithistory(destpath) + def metafilepath = "${destpath}/${meta.metafilepath()}" + echo "Marking root meta as released and rewriting meta file: ${metafilepath}" + rewritemetafileasreleased(meta, metafilepath) + + if (incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } + return importedmeta +} + def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { switch (source) { case "Jenkins job artifact": diff --git a/publish/do.groovy b/publish/do.groovy index 1599ca8..6207380 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -148,6 +148,19 @@ def convertitemstopublish(String itemstopublishstring) { return paths } +def convertstringitemstopublish(String itemstopublishstring) { + def List paths = [] + + def String[] items = itemstopublishstring.split(',') + def String allpaths = "" + for(String item : items) { + paths.add(item) + 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(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { From 8961f250b17a89620fa0ea35b796d664512fdfb8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 19:39:52 +0100 Subject: [PATCH 0909/1971] MCS-425 - Perform a sparse checkout of items to import from a release repo --- import/importer.groovy | 23 ++++++++++++++++++++++- publish/do.groovy | 13 +++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 34707bc..9620e8a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -42,7 +42,7 @@ def rewritemetafileasreleased(meta, String filepath) { meta.saveJsonSerialised(filepath) } -def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { +def hierarchyartifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { def rooturl = repo.trim() def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" @@ -76,6 +76,27 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, return importedmeta } +def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { + def rooturl = repo.trim() + def rootrevision = revision.trim() + echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" + + def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) { + gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) + + def importedmeta = meta.importrelated(destpath) + + gh.stripgithistory(destpath) + def metafilepath = "${destpath}/${meta.metafilepath()}" + echo "Marking root meta as released and rewriting meta file: ${metafilepath}" + rewritemetafileasreleased(meta, metafilepath) + + if (incrementversionnumber) { + meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) + } + return importedmeta +} + def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { switch (source) { case "Jenkins job artifact": diff --git a/publish/do.groovy b/publish/do.groovy index 1599ca8..6207380 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -148,6 +148,19 @@ def convertitemstopublish(String itemstopublishstring) { return paths } +def convertstringitemstopublish(String itemstopublishstring) { + def List paths = [] + + def String[] items = itemstopublishstring.split(',') + def String allpaths = "" + for(String item : items) { + paths.add(item) + 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(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { From 907a0f00e6b488f167c7ecd5a0a46f708ca29b6c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 23:04:39 +0100 Subject: [PATCH 0910/1971] MCS-425 - Perform a sparse checkout of items to import from a release repo --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 9620e8a..d85818f 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -81,7 +81,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) { + def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(destpath) From e418c593be9bb8ba865142321491b846567c3a7c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 23:04:39 +0100 Subject: [PATCH 0911/1971] MCS-425 - Perform a sparse checkout of items to import from a release repo --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 9620e8a..d85818f 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -81,7 +81,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) { + def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(destpath) From a32fbee67b59dba3c928b67fe2aa80b1b838b101 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 23:25:53 +0100 Subject: [PATCH 0912/1971] MCS-425 - Perform a sparse checkout of items to import from a release repo --- import/importer.groovy | 2 +- publish/do.groovy | 13 ------------- versioncontrol/git.groovy | 13 +++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index d85818f..764618c 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -81,7 +81,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) + def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(destpath) diff --git a/publish/do.groovy b/publish/do.groovy index 6207380..1599ca8 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -148,19 +148,6 @@ def convertitemstopublish(String itemstopublishstring) { return paths } -def convertstringitemstopublish(String itemstopublishstring) { - def List paths = [] - - def String[] items = itemstopublishstring.split(',') - def String allpaths = "" - for(String item : items) { - paths.add(item) - 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(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 534084d..818734a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -246,6 +246,19 @@ def gitsparserestore(String targetDir) { } } +def List convertSparseItemsString(String itemstopublish) { + def List paths = [] + + def String[] items = itemstopublish.split(',') + def String allpaths = "" + for(String item : items) { + paths.add(item) + allpaths += "${path}\n" + } + echo "Selected item to publish:\n${allpaths}" + return paths +} + 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) From a5a2603e27dfd1e94c84b134a06d07d0dfc5f8f6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 23:25:53 +0100 Subject: [PATCH 0913/1971] MCS-425 - Perform a sparse checkout of items to import from a release repo --- import/importer.groovy | 2 +- publish/do.groovy | 13 ------------- versioncontrol/git.groovy | 13 +++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index d85818f..764618c 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -81,7 +81,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertstringitemstopublish(filter) + def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(destpath) diff --git a/publish/do.groovy b/publish/do.groovy index 6207380..1599ca8 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -148,19 +148,6 @@ def convertitemstopublish(String itemstopublishstring) { return paths } -def convertstringitemstopublish(String itemstopublishstring) { - def List paths = [] - - def String[] items = itemstopublishstring.split(',') - def String allpaths = "" - for(String item : items) { - paths.add(item) - 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(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 534084d..818734a 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -246,6 +246,19 @@ def gitsparserestore(String targetDir) { } } +def List convertSparseItemsString(String itemstopublish) { + def List paths = [] + + def String[] items = itemstopublish.split(',') + def String allpaths = "" + for(String item : items) { + paths.add(item) + allpaths += "${path}\n" + } + echo "Selected item to publish:\n${allpaths}" + return paths +} + 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) From 03046f5c04c23f17a14d6e46bac38d2bf71d4e70 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 23:33:55 +0100 Subject: [PATCH 0914/1971] MCS-425 - Perform a sparse checkout of items to import from a release repo --- versioncontrol/git.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 818734a..811d072 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -247,16 +247,16 @@ def gitsparserestore(String targetDir) { } def List convertSparseItemsString(String itemstopublish) { - def List paths = [] + def List sparsepaths = [] def String[] items = itemstopublish.split(',') def String allpaths = "" for(String item : items) { - paths.add(item) - allpaths += "${path}\n" + sparsepaths.add(item) + allpaths += "${item}\n" } echo "Selected item to publish:\n${allpaths}" - return paths + return sparsepaths } def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { From f1cb5075a2794e74a09d58c5f50a118f9813eeff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 May 2019 23:33:55 +0100 Subject: [PATCH 0915/1971] MCS-425 - Perform a sparse checkout of items to import from a release repo --- versioncontrol/git.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 818734a..811d072 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -247,16 +247,16 @@ def gitsparserestore(String targetDir) { } def List convertSparseItemsString(String itemstopublish) { - def List paths = [] + def List sparsepaths = [] def String[] items = itemstopublish.split(',') def String allpaths = "" for(String item : items) { - paths.add(item) - allpaths += "${path}\n" + sparsepaths.add(item) + allpaths += "${item}\n" } echo "Selected item to publish:\n${allpaths}" - return paths + return sparsepaths } def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList sparseitemlist = new ArrayList()) { From af12802f1b0661ffe15ba79dacfd058a8e1e0e6a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 6 Jun 2019 13:30:15 +0100 Subject: [PATCH 0916/1971] One level of meta too high was being marked as released when importing an already released component (from a release repository) --- import/importer.groovy | 2 +- meta/folder.groovy | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 764618c..fd43379 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -68,7 +68,7 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d gh.stripgithistory(destpath) def metafilepath = "${destpath}/${meta.metafilepath()}" echo "Marking root meta as released and rewriting meta file: ${metafilepath}" - rewritemetafileasreleased(meta, metafilepath) + rewritemetafileasreleased(importedmeta, metafilepath) if (incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) diff --git a/meta/folder.groovy b/meta/folder.groovy index b16db5d..f8c033b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -491,6 +491,7 @@ class MetaInfo extends GISJsonSerialised { } void markreleased() { + script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") releaseinfo.markreleased() for (associated in associatedmeta) { associated.meta.releaseinfo.markreleased() From 2c5caba8ec8d123c2e4f852a7c33baafce6723e2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 6 Jun 2019 13:30:15 +0100 Subject: [PATCH 0917/1971] One level of meta too high was being marked as released when importing an already released component (from a release repository) --- import/importer.groovy | 2 +- meta/folder.groovy | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 764618c..fd43379 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -68,7 +68,7 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d gh.stripgithistory(destpath) def metafilepath = "${destpath}/${meta.metafilepath()}" echo "Marking root meta as released and rewriting meta file: ${metafilepath}" - rewritemetafileasreleased(meta, metafilepath) + rewritemetafileasreleased(importedmeta, metafilepath) if (incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) diff --git a/meta/folder.groovy b/meta/folder.groovy index b16db5d..f8c033b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -491,6 +491,7 @@ class MetaInfo extends GISJsonSerialised { } void markreleased() { + script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") releaseinfo.markreleased() for (associated in associatedmeta) { associated.meta.releaseinfo.markreleased() From 78f45274fa261ec1c0b7200a0e62835a9b2417a1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 6 Jun 2019 14:08:13 +0100 Subject: [PATCH 0918/1971] One level of meta too high was being marked as released when importing an already released component (from a release repository) --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index fd43379..09eb337 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -89,7 +89,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, gh.stripgithistory(destpath) def metafilepath = "${destpath}/${meta.metafilepath()}" echo "Marking root meta as released and rewriting meta file: ${metafilepath}" - rewritemetafileasreleased(meta, metafilepath) + rewritemetafileasreleased(importedmeta, metafilepath) if (incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) From 633a8dc8cb9bd107300c238a539cf97a56b5bcec Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 6 Jun 2019 14:08:13 +0100 Subject: [PATCH 0919/1971] One level of meta too high was being marked as released when importing an already released component (from a release repository) --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index fd43379..09eb337 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -89,7 +89,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, gh.stripgithistory(destpath) def metafilepath = "${destpath}/${meta.metafilepath()}" echo "Marking root meta as released and rewriting meta file: ${metafilepath}" - rewritemetafileasreleased(meta, metafilepath) + rewritemetafileasreleased(importedmeta, metafilepath) if (incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) From 4b914018772260e54de9add6519d4f55803c2c13 Mon Sep 17 00:00:00 2001 From: Ben Dowding Date: Thu, 20 Jun 2019 11:11:41 +0100 Subject: [PATCH 0920/1971] Update to load both sg600 and ktb logic --- copy/logic.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index f71c083..a5b134b 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -24,10 +24,12 @@ pipeline { stage('Copying logic artifacts') { steps { script { - env.LOGICDEST = "${WORKSPACE}/logic" + env.SG600_LOGICDEST = "${WORKSPACE}/sg600_logic" + env.KTB_LOGICDEST = "${WORKSPACE}/ktb_logic" if (LOGIC_ARTIFACT_LOCATION == "Jenkins job artifact") { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - importer.artifactimport(meta, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGICDEST) + importer.artifactimport(meta, KTB_LOGIC_ARTIFACT_PROJECT, KTB_LOGIC_ARTIFACT_BUILD_SELECTOR, KTB_LOGICDEST) + importer.artifactimport(meta, SG600_LOGIC_ARTIFACT_PROJECT, SG600_LOGIC_ARTIFACT_BUILD_SELECTOR, SG600_LOGICDEST) } } } From b1d34d8f8795d1c6629537a7a5a5bc9b911becb4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 28 Jun 2019 18:25:28 +0100 Subject: [PATCH 0921/1971] Make the default filter blank; Alter the order of build import --- import/importer.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 09eb337..418fd9a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -17,7 +17,7 @@ def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, bo return importedmeta } -def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { +def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { copyArtifacts( filter: filter, excludes: excludes, @@ -42,7 +42,7 @@ def rewritemetafileasreleased(meta, String filepath) { meta.saveJsonSerialised(filepath) } -def hierarchyartifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { +def hierarchyartifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { def rooturl = repo.trim() def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" @@ -76,7 +76,7 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d return importedmeta } -def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { +def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { def rooturl = repo.trim() def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" @@ -97,7 +97,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, return importedmeta } -def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { +def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { switch (source) { case "Jenkins job artifact": return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) From 2907eb9dc5ed4ff20295a5ca4af4d816b1506553 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 1 Jul 2019 09:54:24 +0100 Subject: [PATCH 0922/1971] Make the default filter blank; Alter the order of build import --- versioncontrol/git.groovy | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 811d072..7e065d5 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -249,13 +249,16 @@ def gitsparserestore(String targetDir) { def List convertSparseItemsString(String itemstopublish) { def List sparsepaths = [] - def String[] items = itemstopublish.split(',') - def String allpaths = "" - for(String item : items) { - sparsepaths.add(item) - allpaths += "${item}\n" + 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}" } - echo "Selected item to publish:\n${allpaths}" return sparsepaths } From 7577060104098b6daf10a463b7758ce9d29930fd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 1 Jul 2019 10:49:46 +0100 Subject: [PATCH 0923/1971] Remove redundant references to temp folders --- publish/do.groovy | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 1599ca8..18ec404 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -8,7 +8,6 @@ summaryfile = "${summaryfolder}/summary.txt" summarystring = "" releaserepofolder = "${WORKSPACE}/releaserepos" filteredreleaserepofolder = "${WORKSPACE}/filteredreleaserepos" -tempfolder = "${WORKSPACE}/temp" def resetfolders() { dir(summaryfolder) { @@ -20,9 +19,6 @@ def resetfolders() { dir(filteredreleaserepofolder) { deleteDir() } - dir(tempfolder) { - deleteDir() - } } def productuniquefolder(releasemeta) { @@ -61,8 +57,7 @@ def guessreporootsuffix(componentURL) { } gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -def getcomponentartifacts(releaseinfo, String repofolder, String tempfolder, itempathstopublish) { - // Copy relevant artifacts to temp folder +def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { summaryappend("Artifacts: ") def releasemeta = releaseinfo.meta @@ -124,11 +119,10 @@ def copydirectory(File dirFrom, File dirTo) { def recallcomponent(releaseinfo, String softwarerelease, itempathstopublish) { def releasemeta = releaseinfo.meta def String uniquefolderforrepo = uniqueabsoluterreleasefolder(releaserepofolder, softwarerelease, releasemeta) - def String uniquefoldertemp = uniqueabsoluterreleasefolder(tempfolder, softwarerelease, releasemeta) summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") - getcomponentartifacts(releaseinfo, uniquefolderforrepo, uniquefoldertemp, itempathstopublish) + getcomponentartifacts(releaseinfo, uniquefolderforrepo, itempathstopublish) summaryappend("\n") } From 575fade931e0c0e1e83adc7168c44cef606015d2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 1 Jul 2019 12:59:46 +0100 Subject: [PATCH 0924/1971] Add an option to import from repo to import lower levels of artifacts --- import/importer.groovy | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 418fd9a..68b8e4c 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -42,11 +42,14 @@ def rewritemetafileasreleased(meta, String filepath) { meta.saveJsonSerialised(filepath) } +publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") def hierarchyartifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { def rooturl = repo.trim() def rootrevision = revision.trim() echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - gh.gitCheckout(rooturl, rootrevision, destpath) + + def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) + gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(destpath) @@ -59,8 +62,11 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d def clonerevision = "refs/tags/${relatedmeta.releasetag()}" def clonepath = "${destpath}/${relatedoffsetpath}" echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}" - gh.gitCheckout(cloneurl, clonerevision, 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) @@ -90,18 +96,21 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def metafilepath = "${destpath}/${meta.metafilepath()}" echo "Marking root meta as released and rewriting meta file: ${metafilepath}" rewritemetafileasreleased(importedmeta, metafilepath) - + if (incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } return importedmeta } -def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { +def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false, boolean recursive = false) { switch (source) { case "Jenkins job artifact": return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) case "Release repository": + if (nested) { + return hierarchyartifactimportfromrepo(meta, repo, revision, destpath, incrementversionnumber, filter, excludes, fingerprint) + } return artifactimportfromrepo(meta, repo, revision, destpath, incrementversionnumber, filter, excludes, fingerprint) default: error("Unknown type of artifact source: ${source}") From d9cd1acbb8fc5196ecb51dfe2494653ec297fa87 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 1 Jul 2019 13:19:05 +0100 Subject: [PATCH 0925/1971] Add an option to import from repo to import lower levels of artifacts --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 68b8e4c..ba5eb0b 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -103,7 +103,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, return importedmeta } -def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false, boolean recursive = false) { +def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false, boolean nested = false) { switch (source) { case "Jenkins job artifact": return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) From f209f2a9d824ac0a4aac5da2f76af397d8237951 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 2 Jul 2019 08:51:06 +0100 Subject: [PATCH 0926/1971] Further meta hierarchy difference work --- configuration/configuration.groovy | 2 +- differences/dometahierarchy.groovy | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 30b7086..1864ba9 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -9,7 +9,7 @@ def registerPipelineScriptConfiguration(meta) { } def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { - gh.gitCheckout(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) + gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) } diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 1d6885f..f5de8e8 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,3 +1,12 @@ +metafolderscript = load("${commonscripts()}/meta/folder.groovy") + +def showmetaitems(metaitems) + for (entry in metaitems) { + def name = entry.meta.componentversionuniqueidentifier() + def offsetpath = entry.offsetpath + echo "Name: ${name}\t\t\t\tPath: ${offsetpath}" + } +} def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { def int md = maxdepth.toInteger() @@ -7,6 +16,18 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin def String summarystring = "No summary" def boolean markunstable = true def unstablereason = "No compare implementation yet" + + def earlymeta = metafolderscript.importrelated(earlymetafolder) + def latermeta = metafolderscript.importrelated(latermetafolder) + + def earlymetaitems = earlymeta.releasewalkerunique(md) + def latermetaitems = latermeta.releasewalkerunique(md) + + echo "Early items:" + showmetaitems(earlymetaitems) + + echo "Later items:" + showmetaitems(latermetaitems) return [summarystring, markunstable, unstablereason] } From d68196c2c62eb7ae0c7c52783c6a726a06625cea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 2 Jul 2019 13:26:33 +0100 Subject: [PATCH 0927/1971] Further meta hierarchy difference work --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index f5de8e8..fa11a2d 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,6 +1,6 @@ metafolderscript = load("${commonscripts()}/meta/folder.groovy") -def showmetaitems(metaitems) +def showmetaitems(metaitems) { for (entry in metaitems) { def name = entry.meta.componentversionuniqueidentifier() def offsetpath = entry.offsetpath From 6cfd67289696fbc49560a91c2bc9f860f2402bca Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 2 Jul 2019 13:32:54 +0100 Subject: [PATCH 0928/1971] Further meta hierarchy difference work --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index fa11a2d..7f60aae 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,4 +1,4 @@ -metafolderscript = load("${commonscripts()}/meta/folder.groovy") +metafolderscript = load("${autobuilder.commonscripts()}/meta/folder.groovy") def showmetaitems(metaitems) { for (entry in metaitems) { From ebcc588604e682ec6296fba51b312ab670ecfb3f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 08:05:43 +0100 Subject: [PATCH 0929/1971] No need to import meta script - attempting to remove jenkins crash --- differences/dometahierarchy.groovy | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 7f60aae..b6c9660 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,5 +1,3 @@ -metafolderscript = load("${autobuilder.commonscripts()}/meta/folder.groovy") - def showmetaitems(metaitems) { for (entry in metaitems) { def name = entry.meta.componentversionuniqueidentifier() @@ -11,18 +9,18 @@ def showmetaitems(metaitems) { def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { def int md = maxdepth.toInteger() - echo "Comparing product meta hierarchy from folders: ${earlymetafolder} and ${latermetafolder} to a depth of ${md}. Exporting summary to ${summaryfolder}" + echo "Comparing product meta hierarchy from folders: ${earlymetafolder} and ${latermetafolder} to a depth of ${md}. Exporting summary to ${summaryfolder}" def String summarystring = "No summary" def boolean markunstable = true def unstablereason = "No compare implementation yet" - - def earlymeta = metafolderscript.importrelated(earlymetafolder) - def latermeta = metafolderscript.importrelated(latermetafolder) - + + def earlymeta = meta.importrelated(earlymetafolder) + def latermeta = meta.importrelated(latermetafolder) + def earlymetaitems = earlymeta.releasewalkerunique(md) def latermetaitems = latermeta.releasewalkerunique(md) - + echo "Early items:" showmetaitems(earlymetaitems) From 8b4fbe2005f4a53731e8646d4a11cee00263a3ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 08:26:53 +0100 Subject: [PATCH 0930/1971] No need to import meta script - attempting to remove jenkins crash --- differences/dometahierarchy.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index b6c9660..62cd5ee 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,8 +1,8 @@ def showmetaitems(metaitems) { - for (entry in metaitems) { - def name = entry.meta.componentversionuniqueidentifier() - def offsetpath = entry.offsetpath - echo "Name: ${name}\t\t\t\tPath: ${offsetpath}" + for (key in metaitems.keySet()) { + def relatedmetainfo = metaitems[key] + def offsetpath = relatedmetainfo.offsetpath + echo "Name: ${key}\t\t\t\tPath: ${offsetpath}" } } From 01ff6c1a5f46f883662e1268b925c03f9d8a6b94 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 08:47:33 +0100 Subject: [PATCH 0931/1971] No need to import meta script - attempting to remove jenkins crash --- differences/dometahierarchy.groovy | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 62cd5ee..1a6ed7f 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,9 +1,23 @@ def showmetaitems(metaitems) { + String info = '' for (key in metaitems.keySet()) { def relatedmetainfo = metaitems[key] def offsetpath = relatedmetainfo.offsetpath - echo "Name: ${key}\t\t\t\tPath: ${offsetpath}" + info += "Name: ${key}\t\t\t\tPath: ${offsetpath}\n" } + echo info +} + +def compare(earlymetaitems, latermetaitems, key) { + echo "Collecting changes between early and later versions of component: ${key}" +} + +def deletedcomponent(earlymetaitems, key) { + echo "Component ${key} has been deleted in later version" +} + +def addedcomponent(latermetaitems, key) { + echo "Component ${key} has been added in later version" } def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { @@ -26,6 +40,19 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin echo "Later items:" showmetaitems(latermetaitems) + + for (key in earlymetaitems.keySet()) { + if (latermetaitems.containsKey(key)) { + compare(earlymetaitems, latermetaitems, key) + } else { + deletedcomponent(earlymetaitems, key) + } + } + for (key in latermetaitems.keySet()) { + if (!earlymetaitems.containsKey(key)) { + addedcomponent(latermetaitems, key) + } + } return [summarystring, markunstable, unstablereason] } From 22a5b7bde7460474ac9e1c9f148b837bac82bd0d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 15:17:21 +0100 Subject: [PATCH 0932/1971] More infrastructure for differencing versions of component --- differences/do.groovy | 20 ++++++++ differences/dometahierarchy.groovy | 76 ++++++++++++++++++++++++++++-- 2 files changed, 92 insertions(+), 4 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 32f18b5..1499e6d 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -15,4 +15,24 @@ def differences(meta, String sourcerevision, String previoussourcerevision, Stri } } +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 uniquefolderforsourcerepo = getcomponent(earlymeta) + def earlyrevision = earlygitinfo.gitrevision + def laterrevision = latergitinfo.gitrevision + echo "Comparing early revision: ${earlyrevision} with: ${laterrevision} Working copy path: ${sourcepath}" + } else { + echo "The early and later git urls don't match" + result = false; + } + + return [result, differencerecords] +} + return this; diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 1a6ed7f..6ca7e08 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,3 +1,44 @@ +markunstable = false +unstablereason = "" + +summaryfolder = "${WORKSPACE}/summary" +summaryfile = "${summaryfolder}/summary.txt" +summarystring = "" + +sourcerepofolder = "${WORKSPACE}/sourcerepos" +tempfolder = "${WORKSPACE}/temp" + +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 showmetaitems(metaitems) { String info = '' for (key in metaitems.keySet()) { @@ -8,8 +49,33 @@ def showmetaitems(metaitems) { echo info } -def compare(earlymetaitems, latermetaitems, key) { +def String getcomponent(meta) { + def String uniquefolder = "${meta.productinfo.productname}_${meta.productinfo.subcomponentname}" + def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" + def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" + + summaryappend("${meta.productinfo.productname} ${meta.productinfo.subcomponentname}: ") + + def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") + releaser.checkoutsourcerepo(meta, uniquefolderforsourcerepo) + + summaryappend("\n") + return uniquefolderforsourcerepo +} + +def boolean 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 + + def uniquefolderforsourcerepo = getcomponent(earlymeta) + + def differencer = load("${autobuilder.commonscripts()}/differences/do.groovy") + (result, differencerecords) = differencer.getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) + + return result; } def deletedcomponent(earlymetaitems, key) { @@ -22,12 +88,14 @@ def addedcomponent(latermetaitems, key) { def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { 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 String summarystring = "No summary" - def boolean markunstable = true - def unstablereason = "No compare implementation yet" + summarystring = "No summary" + markunstable = true + unstablereason = "No compare implementation yet" def earlymeta = meta.importrelated(earlymetafolder) def latermeta = meta.importrelated(latermetafolder) From 4dfde882fea490a115158a8ecb2b72508bb1b66a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 15:28:24 +0100 Subject: [PATCH 0933/1971] More infrastructure for differencing versions of component --- differences/dometahierarchy.groovy | 3 --- 1 file changed, 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 6ca7e08..5047ce2 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -12,9 +12,6 @@ def resetfolders() { dir(summaryfolder) { deleteDir() } - dir(releaserepofolder) { - deleteDir() - } dir(tempfolder) { deleteDir() } From cc262c09ad51cedc1908203b99b760e65c9f5767 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 15:45:04 +0100 Subject: [PATCH 0934/1971] More infrastructure for differencing versions of component --- differences/do.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/differences/do.groovy b/differences/do.groovy index 1499e6d..6c5c947 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -23,7 +23,6 @@ def getdifferencerecords(earlymeta, latermeta, String sourcepath) { def latergitinfo = latermeta.gitinfo if (earlygitinfo.remoteurl == latergitinfo.remoteurl) { - def uniquefolderforsourcerepo = getcomponent(earlymeta) def earlyrevision = earlygitinfo.gitrevision def laterrevision = latergitinfo.gitrevision echo "Comparing early revision: ${earlyrevision} with: ${laterrevision} Working copy path: ${sourcepath}" From 437e27b0e2e67b31e1c03a28ba2c30a0741d8f7b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 16:09:14 +0100 Subject: [PATCH 0935/1971] More infrastructure for differencing versions of component --- differences/do.groovy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/differences/do.groovy b/differences/do.groovy index 6c5c947..0bf3f4f 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -15,6 +15,20 @@ def differences(meta, String sourcerevision, String previoussourcerevision, Stri } } +def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { + def differencerecords = [] + def String releaseexpression + if tripledot: + releaseexpression = earlyrevision + "..." + laterrevision + else: + releaseexpression = earlyrevision + ".." + laterrevision + def String differencetext + dir(gitrootfolder) { + differencetext = sh(returnStdout: true, script: "git log --oneline ${releaseexpression}").trim() + } + return differencetext +} + def getdifferencerecords(earlymeta, latermeta, String sourcepath) { boolean result = true; def List differencerecords = [] @@ -26,6 +40,8 @@ def getdifferencerecords(earlymeta, latermeta, String sourcepath) { def earlyrevision = earlygitinfo.gitrevision def laterrevision = latergitinfo.gitrevision echo "Comparing early revision: ${earlyrevision} with: ${laterrevision} Working copy path: ${sourcepath}" + def String differencetext = getgitlogdifferences(sourcepath, earlyrevision, laterrevision) + echo "Difference text is:\n${differencetext}" } else { echo "The early and later git urls don't match" result = false; From 9458a9485a8be66e046e562974db7c3865d453ad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 16:12:44 +0100 Subject: [PATCH 0936/1971] More infrastructure for differencing versions of component --- differences/do.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 0bf3f4f..eb4a53a 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -18,10 +18,11 @@ def differences(meta, String sourcerevision, String previoussourcerevision, Stri def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { def differencerecords = [] def String releaseexpression - if tripledot: + if (tripledot) { releaseexpression = earlyrevision + "..." + laterrevision - else: + } else { releaseexpression = earlyrevision + ".." + laterrevision + } def String differencetext dir(gitrootfolder) { differencetext = sh(returnStdout: true, script: "git log --oneline ${releaseexpression}").trim() From 79405e223b00fb298bbb011abef8687e11058277 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 18:04:24 +0100 Subject: [PATCH 0937/1971] More infrastructure for differencing versions of component --- differences/do.groovy | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/differences/do.groovy b/differences/do.groovy index eb4a53a..99596f3 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -15,6 +15,20 @@ def differences(meta, String sourcerevision, String previoussourcerevision, Stri } } +class DifferenceRecord { + String productname + String subcomponentname + String jirakey + + String rawdifferencetext + String sha + int type + String jiraticketinfo + + DifferenceRecord() { + } +} + def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { def differencerecords = [] def String releaseexpression @@ -30,6 +44,26 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late return differencetext } +def List processtext(meta, String text) { + def List differencerecords = [] + + text.eachLine { + def DifferenceRecord dr = new DifferenceRecord() + + dr.productname = meta.productinfo.productname + dr.subcomponentname = meta.productinfo.subcomponentname + dr.jirakey = meta.productinfo.jirakey + + dr.rawdifferencetext = it.trim() + dr.sha = "sha" + dr.type = 0 + dr.jiraticketinfo = "info" + + differencerecords.add(dr) + } + return differencerecords +} + def getdifferencerecords(earlymeta, latermeta, String sourcepath) { boolean result = true; def List differencerecords = [] @@ -43,6 +77,7 @@ def getdifferencerecords(earlymeta, latermeta, String sourcepath) { echo "Comparing early revision: ${earlyrevision} with: ${laterrevision} Working copy path: ${sourcepath}" def String differencetext = getgitlogdifferences(sourcepath, earlyrevision, laterrevision) echo "Difference text is:\n${differencetext}" + differencerecords = differencerecords + processtext(earlymeta, differencetext) } else { echo "The early and later git urls don't match" result = false; From d202e0bb3e4460735385f25a1f32bdb45cac9970 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 18:19:12 +0100 Subject: [PATCH 0938/1971] More infrastructure for differencing versions of component --- differences/do.groovy | 11 +++++++++-- differences/dometahierarchy.groovy | 13 +++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 99596f3..b29aaa4 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -16,6 +16,8 @@ def differences(meta, String sourcerevision, String previoussourcerevision, Stri } class DifferenceRecord { + def script + String productname String subcomponentname String jirakey @@ -25,7 +27,12 @@ class DifferenceRecord { int type String jiraticketinfo - DifferenceRecord() { + DifferenceRecord(script) { + this.script = script + } + + def dump() { + script.echo("Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\njiraticketinfo: ${jiraticketinfo}" } } @@ -48,7 +55,7 @@ def List processtext(meta, String text) { def List differencerecords = [] text.eachLine { - def DifferenceRecord dr = new DifferenceRecord() + def DifferenceRecord dr = new DifferenceRecord(this) dr.productname = meta.productinfo.productname dr.subcomponentname = meta.productinfo.subcomponentname diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 5047ce2..464dce9 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -60,7 +60,7 @@ def String getcomponent(meta) { return uniquefolderforsourcerepo } -def boolean compare(earlymetaitems, latermetaitems, key) { +def compare(earlymetaitems, latermetaitems, key) { boolean result = true; echo "Collecting changes between early and later versions of component: ${key}" @@ -72,7 +72,7 @@ def boolean compare(earlymetaitems, latermetaitems, key) { def differencer = load("${autobuilder.commonscripts()}/differences/do.groovy") (result, differencerecords) = differencer.getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) - return result; + return [result, differencerecords]; } def deletedcomponent(earlymetaitems, key) { @@ -84,6 +84,8 @@ def addedcomponent(latermetaitems, key) { } def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { + def List differencerecords = [] + def int md = maxdepth.toInteger() resetfolders() preconditions() @@ -108,7 +110,8 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin for (key in earlymetaitems.keySet()) { if (latermetaitems.containsKey(key)) { - compare(earlymetaitems, latermetaitems, key) + (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) + differencerecords = differencerecords + componentdifferencerecords } else { deletedcomponent(earlymetaitems, key) } @@ -118,7 +121,9 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin addedcomponent(latermetaitems, key) } } - + for (record in differencerecords) { + record.dump() + } return [summarystring, markunstable, unstablereason] } From 28d24268fb9a78a98ac492092fe983d1a40f99ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 18:29:03 +0100 Subject: [PATCH 0939/1971] Add more difference infrastructure --- differences/do.groovy | 6 ++---- differences/dometahierarchy.groovy | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index b29aaa4..0de5395 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -16,8 +16,6 @@ def differences(meta, String sourcerevision, String previoussourcerevision, Stri } class DifferenceRecord { - def script - String productname String subcomponentname String jirakey @@ -31,8 +29,8 @@ class DifferenceRecord { this.script = script } - def dump() { - script.echo("Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\njiraticketinfo: ${jiraticketinfo}" + def String dump() { + return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\njiraticketinfo: ${jiraticketinfo}" } } diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 464dce9..2770c4a 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -122,7 +122,7 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin } } for (record in differencerecords) { - record.dump() + echo "${record.dump()}" } return [summarystring, markunstable, unstablereason] } From f00082dd8b3fa3daf6e65669cb48d4fba4e99076 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 18:51:01 +0100 Subject: [PATCH 0940/1971] Add more difference infrastructure --- differences/do.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 0de5395..611ce68 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -25,8 +25,7 @@ class DifferenceRecord { int type String jiraticketinfo - DifferenceRecord(script) { - this.script = script + DifferenceRecord() { } def String dump() { @@ -53,7 +52,7 @@ def List processtext(meta, String text) { def List differencerecords = [] text.eachLine { - def DifferenceRecord dr = new DifferenceRecord(this) + def DifferenceRecord dr = new DifferenceRecord() dr.productname = meta.productinfo.productname dr.subcomponentname = meta.productinfo.subcomponentname From 02b104312dceca59b681c8911501b3593c070888 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 19:34:26 +0100 Subject: [PATCH 0941/1971] Add more difference infrastructure --- differences/do.groovy | 75 -------------------- differences/dometahierarchy.groovy | 106 +++++++++++++++++++++++++++-- 2 files changed, 102 insertions(+), 79 deletions(-) diff --git a/differences/do.groovy b/differences/do.groovy index 611ce68..32f18b5 100644 --- a/differences/do.groovy +++ b/differences/do.groovy @@ -15,79 +15,4 @@ def differences(meta, String sourcerevision, String previoussourcerevision, Stri } } -class DifferenceRecord { - String productname - String subcomponentname - String jirakey - - String rawdifferencetext - String sha - int type - String jiraticketinfo - - DifferenceRecord() { - } - - def String dump() { - return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\njiraticketinfo: ${jiraticketinfo}" - } -} - -def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { - def differencerecords = [] - def String releaseexpression - if (tripledot) { - releaseexpression = earlyrevision + "..." + laterrevision - } else { - releaseexpression = earlyrevision + ".." + laterrevision - } - def String differencetext - dir(gitrootfolder) { - differencetext = sh(returnStdout: true, script: "git log --oneline ${releaseexpression}").trim() - } - return differencetext -} - -def List processtext(meta, String text) { - def List differencerecords = [] - - text.eachLine { - def DifferenceRecord dr = new DifferenceRecord() - - dr.productname = meta.productinfo.productname - dr.subcomponentname = meta.productinfo.subcomponentname - dr.jirakey = meta.productinfo.jirakey - - dr.rawdifferencetext = it.trim() - dr.sha = "sha" - dr.type = 0 - dr.jiraticketinfo = "info" - - differencerecords.add(dr) - } - 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}" - def String differencetext = getgitlogdifferences(sourcepath, earlyrevision, laterrevision) - echo "Difference text is:\n${differencetext}" - differencerecords = differencerecords + processtext(earlymeta, differencetext) - } else { - echo "The early and later git urls don't match" - result = false; - } - - return [result, differencerecords] -} - return this; diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 2770c4a..f60efd7 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -8,6 +8,24 @@ summarystring = "" sourcerepofolder = "${WORKSPACE}/sourcerepos" tempfolder = "${WORKSPACE}/temp" +class DifferenceRecord { + String productname + String subcomponentname + String jirakey + + String rawdifferencetext + String sha + int type + String jiraticketinfo + + DifferenceRecord() { + } + + def String dump() { + return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\njiraticketinfo: ${jiraticketinfo}" + } +} + def resetfolders() { dir(summaryfolder) { deleteDir() @@ -46,6 +64,31 @@ def showmetaitems(metaitems) { echo info } +def checkoutsourcerepo(buildmeta, String checkoutfolder) { + def String sourcerepo = buildmeta.gitinfo.remoteurl + 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 + # 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}") + } + } + } +} + def String getcomponent(meta) { def String uniquefolder = "${meta.productinfo.productname}_${meta.productinfo.subcomponentname}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" @@ -53,13 +96,69 @@ def String getcomponent(meta) { summaryappend("${meta.productinfo.productname} ${meta.productinfo.subcomponentname}: ") - def releaser = load("${autobuilder.commonscripts()}/release/do.groovy") - releaser.checkoutsourcerepo(meta, uniquefolderforsourcerepo) + checkoutsourcerepo(meta, uniquefolderforsourcerepo) summaryappend("\n") return uniquefolderforsourcerepo } +def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { + def differencerecords = [] + def String releaseexpression + if (tripledot) { + releaseexpression = earlyrevision + "..." + laterrevision + } else { + releaseexpression = earlyrevision + ".." + laterrevision + } + def String differencetext + dir(gitrootfolder) { + differencetext = sh(returnStdout: true, script: "git log --oneline ${releaseexpression}").trim() + } + return differencetext +} + +def List processtext(meta, String text) { + def List differencerecords = [] + + text.eachLine { + def DifferenceRecord dr = new DifferenceRecord() + + dr.productname = meta.productinfo.productname + dr.subcomponentname = meta.productinfo.subcomponentname + dr.jirakey = meta.productinfo.jirakey + + dr.rawdifferencetext = it.trim() + dr.sha = "sha" + dr.type = 0 + dr.jiraticketinfo = "info" + + differencerecords.add(dr) + } + 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}" + def String differencetext = getgitlogdifferences(sourcepath, earlyrevision, laterrevision) + echo "Difference text is:\n${differencetext}" + differencerecords = processtext(earlymeta, differencetext) + } else { + echo "The early and later git urls don't match" + result = false; + } + + return [result, differencerecords] +} + def compare(earlymetaitems, latermetaitems, key) { boolean result = true; echo "Collecting changes between early and later versions of component: ${key}" @@ -69,8 +168,7 @@ def compare(earlymetaitems, latermetaitems, key) { def uniquefolderforsourcerepo = getcomponent(earlymeta) - def differencer = load("${autobuilder.commonscripts()}/differences/do.groovy") - (result, differencerecords) = differencer.getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) + (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) return [result, differencerecords]; } From 665e0039adb0f3a5a64efd0f77a3f9e763f9d523 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 19:52:53 +0100 Subject: [PATCH 0942/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index f60efd7..9e166b7 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -120,9 +120,11 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late def List processtext(meta, String text) { def List differencerecords = [] + record = 0; text.eachLine { def DifferenceRecord dr = new DifferenceRecord() + echo "Creating record: ${record}" dr.productname = meta.productinfo.productname dr.subcomponentname = meta.productinfo.subcomponentname dr.jirakey = meta.productinfo.jirakey @@ -133,6 +135,7 @@ def List processtext(meta, String text) { dr.jiraticketinfo = "info" differencerecords.add(dr) + record += 1 } return differencerecords } @@ -169,7 +172,7 @@ def compare(earlymetaitems, latermetaitems, key) { def uniquefolderforsourcerepo = getcomponent(earlymeta) (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) - + return [result, differencerecords]; } @@ -209,6 +212,8 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin for (key in earlymetaitems.keySet()) { if (latermetaitems.containsKey(key)) { (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) + echo "Returned: ${result}, records: ${componentdifferencerecords.size()}" + differencerecords = differencerecords + componentdifferencerecords } else { deletedcomponent(earlymetaitems, key) @@ -219,6 +224,7 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin addedcomponent(latermetaitems, key) } } + echo "Result: ${result}, total records: ${differencerecords.size()}" for (record in differencerecords) { echo "${record.dump()}" } From c75e58cc697dac6bed9d4bcaf4ba7277a0b30d72 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Jul 2019 19:59:31 +0100 Subject: [PATCH 0943/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 9e166b7..97efa08 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -121,7 +121,7 @@ def List processtext(meta, String text) { def List differencerecords = [] record = 0; - text.eachLine { + text.split('\n').each { def DifferenceRecord dr = new DifferenceRecord() echo "Creating record: ${record}" From fe72ba4a9f1b4e210508f2afff1cd3e18c86d60f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 08:40:22 +0100 Subject: [PATCH 0944/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 97efa08..dc35bdf 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -94,11 +94,8 @@ def String getcomponent(meta) { def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" - summaryappend("${meta.productinfo.productname} ${meta.productinfo.subcomponentname}: ") - checkoutsourcerepo(meta, uniquefolderforsourcerepo) - summaryappend("\n") return uniquefolderforsourcerepo } @@ -120,11 +117,9 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late def List processtext(meta, String text) { def List differencerecords = [] - record = 0; text.split('\n').each { def DifferenceRecord dr = new DifferenceRecord() - echo "Creating record: ${record}" dr.productname = meta.productinfo.productname dr.subcomponentname = meta.productinfo.subcomponentname dr.jirakey = meta.productinfo.jirakey @@ -135,7 +130,6 @@ def List processtext(meta, String text) { dr.jiraticketinfo = "info" differencerecords.add(dr) - record += 1 } return differencerecords } @@ -151,12 +145,14 @@ def getdifferencerecords(earlymeta, latermeta, String sourcepath) { 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) - echo "Difference text is:\n${differencetext}" differencerecords = processtext(earlymeta, differencetext) } 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] @@ -165,6 +161,7 @@ def getdifferencerecords(earlymeta, latermeta, String sourcepath) { def compare(earlymetaitems, latermetaitems, key) { boolean result = true; echo "Collecting changes between early and later versions of component: ${key}" + summaryappend("Changed: ") def earlymeta = earlymetaitems[key].meta def latermeta = latermetaitems[key].meta @@ -178,10 +175,12 @@ def compare(earlymetaitems, latermetaitems, key) { 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 ") } def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { @@ -193,10 +192,6 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin echo "Comparing product meta hierarchy from folders: ${earlymetafolder} and ${latermetafolder} to a depth of ${md}. Exporting summary to ${summaryfolder}" - summarystring = "No summary" - markunstable = true - unstablereason = "No compare implementation yet" - def earlymeta = meta.importrelated(earlymetafolder) def latermeta = meta.importrelated(latermetafolder) @@ -210,21 +205,26 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin showmetaitems(latermetaitems) for (key in earlymetaitems.keySet()) { + def earlymeta = earlymetaitems[key].meta if (latermetaitems.containsKey(key)) { + summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) - echo "Returned: ${result}, records: ${componentdifferencerecords.size()}" - differencerecords = differencerecords + componentdifferencerecords + summaryappend("\n") } else { + summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") deletedcomponent(earlymetaitems, key) + summaryappend("\n") } } for (key in latermetaitems.keySet()) { + def latermeta = latermetaitems[key].meta if (!earlymetaitems.containsKey(key)) { + summaryappend("${latermeta.productinfo.productname} ${latermeta.productinfo.subcomponentname}: ") addedcomponent(latermetaitems, key) + summaryappend("\n") } } - echo "Result: ${result}, total records: ${differencerecords.size()}" for (record in differencerecords) { echo "${record.dump()}" } From 319ae116ca3af419130919ce71b136f43b1d5af4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 09:06:52 +0100 Subject: [PATCH 0945/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index dc35bdf..0b42152 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -205,7 +205,6 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin showmetaitems(latermetaitems) for (key in earlymetaitems.keySet()) { - def earlymeta = earlymetaitems[key].meta if (latermetaitems.containsKey(key)) { summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) @@ -218,7 +217,6 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin } } for (key in latermetaitems.keySet()) { - def latermeta = latermetaitems[key].meta if (!earlymetaitems.containsKey(key)) { summaryappend("${latermeta.productinfo.productname} ${latermeta.productinfo.subcomponentname}: ") addedcomponent(latermetaitems, key) From d1d69c6c63c9f2aa9cd7bd8d996264dab1828804 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 11:03:16 +0100 Subject: [PATCH 0946/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 45 ++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 0b42152..bbfde2b 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -114,21 +114,42 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late return differencetext } +def extractsha(String line) { + def pattern = ~"^(.*)\s(.*)" + + def sha = line.replaceFirst(pattern) { _, sha, therest -> "${sha.trim()}" } + def therest = line.replaceFirst(pattern) { _, sha, therest -> "${therest.trim()}" } + + echo "Sha filtering: line: ${line} sha: ${sha} therest: ${therest}" + + return [sha, therest] +} + +def DifferenceRecord fillrecord(meta, line) { + def DifferenceRecord dr = new DifferenceRecord() + + dr.productname = meta.productinfo.productname + dr.subcomponentname = meta.productinfo.subcomponentname + dr.jirakey = meta.productinfo.jirakey + + dr.rawdifferencetext = line + + // Example of raw text to process: + // 76056562e4 GIS-1621 - Removing redundant lines and effects of this - Restore nuget_version_edit.py + + (dr.sha, line) = extractsha(line) + + dr.type = 0 + dr.jiraticketinfo = "info" + + return dr +} + def List processtext(meta, String text) { def List differencerecords = [] - - text.split('\n').each { - def DifferenceRecord dr = new DifferenceRecord() - - dr.productname = meta.productinfo.productname - dr.subcomponentname = meta.productinfo.subcomponentname - dr.jirakey = meta.productinfo.jirakey - dr.rawdifferencetext = it.trim() - dr.sha = "sha" - dr.type = 0 - dr.jiraticketinfo = "info" - + text.split('\n').each { + DifferenceRecord dr = fillrecord(meta, it.trim()) differencerecords.add(dr) } return differencerecords From a08335c68eb0712f9266182b84d15e6a9a05754b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 11:07:47 +0100 Subject: [PATCH 0947/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index bbfde2b..395b478 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -115,7 +115,7 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late } def extractsha(String line) { - def pattern = ~"^(.*)\s(.*)" + def pattern = ~"^(.*)\\s(.*)" def sha = line.replaceFirst(pattern) { _, sha, therest -> "${sha.trim()}" } def therest = line.replaceFirst(pattern) { _, sha, therest -> "${therest.trim()}" } From a9ff43ff0aa8922e76f622218cdb18ddd579f35d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 11:14:53 +0100 Subject: [PATCH 0948/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 395b478..912583d 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -137,7 +137,8 @@ def DifferenceRecord fillrecord(meta, line) { // Example of raw text to process: // 76056562e4 GIS-1621 - Removing redundant lines and effects of this - Restore nuget_version_edit.py - (dr.sha, line) = extractsha(line) + (sha, line) = extractsha(line) + dr.sha = sha dr.type = 0 dr.jiraticketinfo = "info" From a457787eeab03a0baa1cef505244f61357cec648 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 11:18:32 +0100 Subject: [PATCH 0949/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 912583d..5350529 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -117,10 +117,10 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late def extractsha(String line) { def pattern = ~"^(.*)\\s(.*)" - def sha = line.replaceFirst(pattern) { _, sha, therest -> "${sha.trim()}" } - def therest = line.replaceFirst(pattern) { _, sha, therest -> "${therest.trim()}" } + def sha = line.replaceFirst(pattern) { _, shabit, therest -> "${shabit.trim()}" } + def restofline = line.replaceFirst(pattern) { _, shabit, therest -> "${therest.trim()}" } - echo "Sha filtering: line: ${line} sha: ${sha} therest: ${therest}" + echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}" return [sha, therest] } From ca296aac27be9194802b150a9ec9a3d6e15c9298 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 13:05:37 +0100 Subject: [PATCH 0950/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 5350529..f98b96f 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -115,14 +115,14 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late } def extractsha(String line) { - def pattern = ~"^(.*)\\s(.*)" + def pattern = ~"^(\\p{XDigit}*) (.*)" - def sha = line.replaceFirst(pattern) { _, shabit, therest -> "${shabit.trim()}" } - def restofline = line.replaceFirst(pattern) { _, shabit, therest -> "${therest.trim()}" } + def sha = line.replaceFirst(pattern) { _, shabit, therest -> "${shabit}" } + def restofline = line.replaceFirst(pattern) { _, shabit, therest -> "${therest}" } echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}" - return [sha, therest] + return [sha.trim(), therest.trim()] } def DifferenceRecord fillrecord(meta, line) { @@ -137,7 +137,7 @@ def DifferenceRecord fillrecord(meta, line) { // Example of raw text to process: // 76056562e4 GIS-1621 - Removing redundant lines and effects of this - Restore nuget_version_edit.py - (sha, line) = extractsha(line) + (sha, line2) = extractsha(line) dr.sha = sha dr.type = 0 From 90ed5663c64016860a6aba5883086a20bf6eef68 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 13:08:43 +0100 Subject: [PATCH 0951/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index f98b96f..a58c02e 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -122,7 +122,7 @@ def extractsha(String line) { echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}" - return [sha.trim(), therest.trim()] + return [sha.trim(), restofline.trim()] } def DifferenceRecord fillrecord(meta, line) { From d51458d7b45d64a03305f1d30684f788d5a1e3e7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 13:26:46 +0100 Subject: [PATCH 0952/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index a58c02e..583c7f1 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -116,9 +116,11 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late def extractsha(String line) { def pattern = ~"^(\\p{XDigit}*) (.*)" + def match = (line =~ pattern) + match.find() - def sha = line.replaceFirst(pattern) { _, shabit, therest -> "${shabit}" } - def restofline = line.replaceFirst(pattern) { _, shabit, therest -> "${therest}" } + def sha = match.group(1) + def restofline = match.group(2) echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}" From b51c69707a3a0de818238981d7a97ac0c830730b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 14:28:43 +0100 Subject: [PATCH 0953/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 64 +++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 583c7f1..9e20da2 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -16,13 +16,15 @@ class DifferenceRecord { String rawdifferencetext String sha int type - String jiraticketinfo + String mergeinfo + List jiraticketinfo + String comment DifferenceRecord() { } def String dump() { - return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\njiraticketinfo: ${jiraticketinfo}" + return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: $(mergeinfo)\njiraticketinfo: ${jiraticketinfo}\ncomment: ${comment}" } } @@ -122,11 +124,45 @@ def extractsha(String line) { def sha = match.group(1) def restofline = match.group(2) - echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}" + //echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}" return [sha.trim(), restofline.trim()] } +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 extractjiraticketinfo(String line) { + bool result = true + + return [result, [], line] +} + def DifferenceRecord fillrecord(meta, line) { def DifferenceRecord dr = new DifferenceRecord() @@ -142,8 +178,26 @@ def DifferenceRecord fillrecord(meta, line) { (sha, line2) = extractsha(line) dr.sha = sha - dr.type = 0 - dr.jiraticketinfo = "info" + (result, mergeinfo) = extractmerges(line2) + if (result) { + dr.type = 1 + dr.jiraticketinfo = [] + dr.mergeinfo = mergeinfo + dr.comment = "" + } else { + (result, jiraticketinfo, comment) = extractjiraticketinfo(line2) + if (result) { + dr.type = 2 + dr.jiraticketinfo = jiraticketinfo + dr.mergeinfo = "" + dr.comment = comment + } else { + dr.type = 3 + dr.jiraticketinfo = [] + dr.mergeinfo = "" + df.comment = line2 + } + } return dr } From 299df9b6b219992d7760f9a68524545c9e57b72d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 14:31:16 +0100 Subject: [PATCH 0954/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 9e20da2..f997983 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -24,7 +24,7 @@ class DifferenceRecord { } def String dump() { - return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: $(mergeinfo)\njiraticketinfo: ${jiraticketinfo}\ncomment: ${comment}" + return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketinfo}\ncomment: ${comment}" } } From 151bbc9599c1d8115d91f1220d0d449ed9c7322d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 18:27:49 +0100 Subject: [PATCH 0955/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index f997983..5b85543 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -158,7 +158,7 @@ def extractmerges(String line) { } def extractjiraticketinfo(String line) { - bool result = true + boolean result = true return [result, [], line] } From 1c5fae0ab028666c4b083da36ce822211bbfb542 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 19:09:23 +0100 Subject: [PATCH 0956/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 47 +++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 5b85543..bcc79dc 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -15,7 +15,7 @@ class DifferenceRecord { String rawdifferencetext String sha - int type + String type String mergeinfo List jiraticketinfo String comment @@ -163,6 +163,28 @@ def extractjiraticketinfo(String line) { return [result, [], 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 DifferenceRecord fillrecord(meta, line) { def DifferenceRecord dr = new DifferenceRecord() @@ -180,22 +202,25 @@ def DifferenceRecord fillrecord(meta, line) { (result, mergeinfo) = extractmerges(line2) if (result) { - dr.type = 1 - dr.jiraticketinfo = [] + dr.type = "Merge" dr.mergeinfo = mergeinfo - dr.comment = "" } else { - (result, jiraticketinfo, comment) = extractjiraticketinfo(line2) + (result, jiraticketinfo, comment) = extractreverts(line2) if (result) { - dr.type = 2 + dr.type = "Revert" dr.jiraticketinfo = jiraticketinfo - dr.mergeinfo = "" dr.comment = comment } else { - dr.type = 3 - dr.jiraticketinfo = [] - dr.mergeinfo = "" - df.comment = line2 + (result, jiraticketinfo, comment) = extractjiraticketinfo(line2) + if (result) { + dr.type = "Ticketed" + dr.jiraticketinfo = jiraticketinfo + dr.comment = comment + } else { + dr.type = "Unticketed" + dr.jiraticketinfo = [] + df.comment = line2 + } } } From a2a582cd3988a42fa7e8592079ee8a4f009464c4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 20:44:51 +0100 Subject: [PATCH 0957/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index bcc79dc..31b2e13 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -166,7 +166,7 @@ def extractjiraticketinfo(String line) { def extractreverts(String line) { boolean result = true - def pattern1 = '^(.*)(Revert \"(.*)\"' + def pattern1 = '^(.*)Revert \"(.*)\"' def match1 = (line =~ pattern1) if (match1.find()) { def line2 = match1.group(2) @@ -174,7 +174,7 @@ def extractreverts(String line) { return [true, originaljiraticketinfo, originalcomment] } - def pattern2 = '^(.*)(Partial Revert \"(.*)\"' + def pattern2 = '^(.*)Partial Revert \"(.*)\"' def match2 = (line =~ pattern2) if (match2.find()) { def line2 = match2.group(2) From c564a70e8de086b626aeaf65f2d8600639b3d354 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 22:08:04 +0100 Subject: [PATCH 0958/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 46 ++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 31b2e13..6485c72 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -21,6 +21,16 @@ class DifferenceRecord { String comment DifferenceRecord() { + productname = "" + subcomponentname = "" + jirakey = "" + + rawdifferencetext = "" + sha = "" + type = "" + mergeinfo = "" + jiraticketinfo = [] + comment = "" } def String dump() { @@ -158,9 +168,40 @@ def extractmerges(String line) { } def extractjiraticketinfo(String line) { - boolean result = true + def List jiratickets = [] - return [result, [], line] + boolean amatch = false + while (!amatch) { + line = line.trim() + def pattern1 = '^(\w+-\d+)(.*)' //GIS-1234 hmbxr5601-1234 + def match1 = (line =~ pattern1) + if (match1.find()) { + jiraticket = match1.group(1) + jiratickets.add(jiraticket) + line = match1.group(2) + amatch = true + } else { + def pattern2 = '^(\w+\d+)(.*)' //GIS1234 smb1234 + def match2 = (line =~ pattern2) + if (match2.find()) { + jiraticket = match2.group(1) + jiratickets.add(jiraticket) + line = match2.group(2) + amatch = true + } else { + def pattern3 = '^(\w+ \d+)(.*)' //GIS 1234 smb 1234 + def match3 = (line =~ pattern3) + if (match3.find()) { + jiraticket = match3.group(1) + jiratickets.add(jiraticket) + line = match3.group(2) + amatch = true + } + } + } + } + boolean result = jiratickets.size() > 0 + return [result, jiratickets, line] } def extractreverts(String line) { @@ -218,7 +259,6 @@ def DifferenceRecord fillrecord(meta, line) { dr.comment = comment } else { dr.type = "Unticketed" - dr.jiraticketinfo = [] df.comment = line2 } } From 1f6b1f8aae1032e2fd93c8e16760c1e440e31444 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 22:14:50 +0100 Subject: [PATCH 0959/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 6485c72..f3ffb80 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -173,7 +173,7 @@ def extractjiraticketinfo(String line) { boolean amatch = false while (!amatch) { line = line.trim() - def pattern1 = '^(\w+-\d+)(.*)' //GIS-1234 hmbxr5601-1234 + def pattern1 = '^(\\w+-\\d+)(.*)' //GIS-1234 hmbxr5601-1234 def match1 = (line =~ pattern1) if (match1.find()) { jiraticket = match1.group(1) @@ -181,7 +181,7 @@ def extractjiraticketinfo(String line) { line = match1.group(2) amatch = true } else { - def pattern2 = '^(\w+\d+)(.*)' //GIS1234 smb1234 + def pattern2 = '^(\\w+\\d+)(.*)' //GIS1234 smb1234 def match2 = (line =~ pattern2) if (match2.find()) { jiraticket = match2.group(1) @@ -189,7 +189,7 @@ def extractjiraticketinfo(String line) { line = match2.group(2) amatch = true } else { - def pattern3 = '^(\w+ \d+)(.*)' //GIS 1234 smb 1234 + def pattern3 = '^(\\w+ \\d+)(.*)' //GIS 1234 smb 1234 def match3 = (line =~ pattern3) if (match3.find()) { jiraticket = match3.group(1) From 6c0b5c63c2575104f907fce6a75e3464638fc7dd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Jul 2019 23:59:08 +0100 Subject: [PATCH 0960/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 65 +++++++++++++++++++++++++++++- differences/metahierarchy.groovy | 4 +- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index f3ffb80..cc3d168 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -8,6 +8,8 @@ summarystring = "" sourcerepofolder = "${WORKSPACE}/sourcerepos" tempfolder = "${WORKSPACE}/temp" +reportfolder = "${WORKSPACE}/reports" + class DifferenceRecord { String productname String subcomponentname @@ -45,6 +47,9 @@ def resetfolders() { dir(tempfolder) { deleteDir() } + dir(reportfolder) { + deleteDir() + } } def preconditions() { @@ -326,6 +331,62 @@ def addedcomponent(latermetaitems, key) { summaryappend("Added ") } +def boolean componentreport(meta, componentdifferencerecords) { + def ticketed = [:] + def merges = [:] + def reverts = [:] + def unticketed = [:] + def tickets = [:] + + for (record in componentdifferencerecords) { + if (dr.type == "Merge") { + merges[record.mergeinfo] = record + } + if (dr.type == "Revert") { + for (ticket in record.jiraticketinfo) { + if (!reverts.containsKey(ticket)) { + reverts[ticket] = [record.comment] + } else { + reverts[ticket].add(record.comment) + } + if (!tickets.containsKey(ticket)) { + tickets[ticket] = 1 + } else { + tickets[ticket] += 1 + } + } + } + if (dr.type == "Ticketed") { + for (ticket in record.jiraticketinfo) { + if (!ticketed.containsKey(ticket)) { + ticketed[ticket] = [record.comment] + } else { + ticketed[ticket].add(record.comment) + } + if (!tickets.containsKey(ticket)) { + tickets[ticket] = 1 + } else { + tickets[ticket] += 1 + } + } + } + if (dr.type == "Unticketed") { + unticketed[record.comment] = record + } + } + String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" + dir(componentreportfolder) { + String ticketlist = "Ticket list:\n" + for (ticketnumber in tickets.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key) { + ticketlist += "${ticketnumber} (${tickets[ticketnumber]})" + } + writeFile(file: "ticketlist", text: ticketlist) + } +} +m.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key +tickets.sort { a, b -> a.value <=> b.value } + + def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { def List differencerecords = [] @@ -346,11 +407,13 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin echo "Later items:" showmetaitems(latermetaitems) - + for (key in earlymetaitems.keySet()) { if (latermetaitems.containsKey(key)) { summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) + summaryappend("Items: ${componentdifferencerecords.size()} ") + componentreport(earlymeta, componentdifferencerecords) differencerecords = differencerecords + componentdifferencerecords summaryappend("\n") } else { diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index cd6738d..8a42f5e 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -13,11 +13,13 @@ pipeline { steps { script { SUMMARYDIR = "${WORKSPACE}/summary" + REPORTDIR = "${WORKSPACE}/reports" cleanfolders = [ "${WORKSPACE}/build_artifacts", "${WORKSPACE}/early", "${WORKSPACE}/later", "${SUMMARYDIR}", + "${REPORTDIR}", ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -59,7 +61,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - archiveArtifacts "summary/**,${artifactlist}" + archiveArtifacts "summary/**,reports/**,${artifactlist}" } } } From 943ecc2d8d9ea011d2c04a17487d85a735e840da Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 00:02:02 +0100 Subject: [PATCH 0961/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index cc3d168..65be091 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -383,8 +383,8 @@ def boolean componentreport(meta, componentdifferencerecords) { writeFile(file: "ticketlist", text: ticketlist) } } -m.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key -tickets.sort { a, b -> a.value <=> b.value } +//m.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key +//tickets.sort { a, b -> a.value <=> b.value } def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { From 0a28daa24fa1ec6db4f6ddf33d98e864524aed65 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 00:04:38 +0100 Subject: [PATCH 0962/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 65be091..d5f0fdb 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -338,16 +338,16 @@ def boolean componentreport(meta, componentdifferencerecords) { def unticketed = [:] def tickets = [:] - for (record in componentdifferencerecords) { + for (dr in componentdifferencerecords) { if (dr.type == "Merge") { - merges[record.mergeinfo] = record + merges[dr.mergeinfo] = dr } if (dr.type == "Revert") { - for (ticket in record.jiraticketinfo) { + for (ticket in dr.jiraticketinfo) { if (!reverts.containsKey(ticket)) { - reverts[ticket] = [record.comment] + reverts[ticket] = [dr.comment] } else { - reverts[ticket].add(record.comment) + reverts[ticket].add(dr.comment) } if (!tickets.containsKey(ticket)) { tickets[ticket] = 1 @@ -357,11 +357,11 @@ def boolean componentreport(meta, componentdifferencerecords) { } } if (dr.type == "Ticketed") { - for (ticket in record.jiraticketinfo) { + for (ticket in dr.jiraticketinfo) { if (!ticketed.containsKey(ticket)) { - ticketed[ticket] = [record.comment] + ticketed[ticket] = [dr.comment] } else { - ticketed[ticket].add(record.comment) + ticketed[ticket].add(dr.comment) } if (!tickets.containsKey(ticket)) { tickets[ticket] = 1 @@ -371,7 +371,7 @@ def boolean componentreport(meta, componentdifferencerecords) { } } if (dr.type == "Unticketed") { - unticketed[record.comment] = record + unticketed[dr.comment] = dr } } String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" From 99238fb9c521c89efeda2b2a0b0dd8fb4025f452 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 00:09:36 +0100 Subject: [PATCH 0963/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index d5f0fdb..30a0442 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -377,7 +377,7 @@ def boolean componentreport(meta, componentdifferencerecords) { String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" dir(componentreportfolder) { String ticketlist = "Ticket list:\n" - for (ticketnumber in tickets.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key) { + for (ticketnumber in tickets.sort()*.key) { ticketlist += "${ticketnumber} (${tickets[ticketnumber]})" } writeFile(file: "ticketlist", text: ticketlist) @@ -385,7 +385,7 @@ def boolean componentreport(meta, componentdifferencerecords) { } //m.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key //tickets.sort { a, b -> a.value <=> b.value } - +//myMap.sort()*.key def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { def List differencerecords = [] From cfff9bd1025f9786ec6d3e580086f30de612785f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 00:32:12 +0100 Subject: [PATCH 0964/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 45 +++++++++++++++++------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 30a0442..effa08f 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -306,21 +306,6 @@ def getdifferencerecords(earlymeta, latermeta, String sourcepath) { return [result, differencerecords] } -def compare(earlymetaitems, latermetaitems, key) { - boolean result = true; - echo "Collecting changes between early and later versions of component: ${key}" - summaryappend("Changed: ") - - def earlymeta = earlymetaitems[key].meta - def latermeta = latermetaitems[key].meta - - def uniquefolderforsourcerepo = getcomponent(earlymeta) - - (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) - - return [result, differencerecords]; -} - def deletedcomponent(earlymetaitems, key) { echo "Component ${key} has been deleted in later version" summaryappend("Deleted ") @@ -378,7 +363,7 @@ def boolean componentreport(meta, componentdifferencerecords) { dir(componentreportfolder) { String ticketlist = "Ticket list:\n" for (ticketnumber in tickets.sort()*.key) { - ticketlist += "${ticketnumber} (${tickets[ticketnumber]})" + ticketlist += "${ticketnumber} (${tickets[ticketnumber]})\n" } writeFile(file: "ticketlist", text: ticketlist) } @@ -387,6 +372,26 @@ def boolean componentreport(meta, componentdifferencerecords) { //tickets.sort { a, b -> a.value <=> b.value } //myMap.sort()*.key +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 uniquefolderforsourcerepo = getcomponent(earlymeta) + + (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) + + summaryappend(" Items: ${differencerecords.size()} ") + componentreport(earlymeta, differencerecords) + summaryappend("\n") + + return [result, differencerecords]; +} + def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) { def List differencerecords = [] @@ -410,12 +415,8 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin for (key in earlymetaitems.keySet()) { if (latermetaitems.containsKey(key)) { - summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) - summaryappend("Items: ${componentdifferencerecords.size()} ") - componentreport(earlymeta, componentdifferencerecords) differencerecords = differencerecords + componentdifferencerecords - summaryappend("\n") } else { summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") deletedcomponent(earlymetaitems, key) @@ -435,4 +436,8 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin return [summarystring, markunstable, unstablereason] } + for (key in metaitems.keySet()) { + def relatedmetainfo = metaitems[key] + + return this; From 7e3042e0d27b6334e590ec904a26b2eded64ac53 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 00:34:35 +0100 Subject: [PATCH 0965/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 4 ---- 1 file changed, 4 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index effa08f..f8650be 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -436,8 +436,4 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin return [summarystring, markunstable, unstablereason] } - for (key in metaitems.keySet()) { - def relatedmetainfo = metaitems[key] - - return this; From a260f34a1525cf6dd485af62e9c0be620222b203 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 08:21:49 +0100 Subject: [PATCH 0966/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index f8650be..5734bb6 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -324,38 +324,52 @@ def boolean componentreport(meta, componentdifferencerecords) { def tickets = [:] for (dr in componentdifferencerecords) { + echo "Processing:\n${dr.dump()}" + if (dr.type == "Merge") { + echo "Adding to mergeinfo" merges[dr.mergeinfo] = dr } if (dr.type == "Revert") { + echo "Adding to revert" for (ticket in dr.jiraticketinfo) { if (!reverts.containsKey(ticket)) { + echo "Creating reverts record for ${ticket}" reverts[ticket] = [dr.comment] } else { + echo "Adding to ticketed record for ${ticket}" reverts[ticket].add(dr.comment) } if (!tickets.containsKey(ticket)) { + echo "Creating ticket record for ${ticket}" tickets[ticket] = 1 } else { + echo "Incrementing ticket record for ${ticket}" tickets[ticket] += 1 } } } if (dr.type == "Ticketed") { + echo "Adding to ticketed" for (ticket in dr.jiraticketinfo) { if (!ticketed.containsKey(ticket)) { + echo "Creating ticketed record for ${ticket}" ticketed[ticket] = [dr.comment] } else { + echo "Adding to ticketed record for ${ticket}" ticketed[ticket].add(dr.comment) } if (!tickets.containsKey(ticket)) { + echo "Creating ticket record for ${ticket}" tickets[ticket] = 1 } else { + echo "Incrementing ticket record for ${ticket}" tickets[ticket] += 1 } } } if (dr.type == "Unticketed") { + echo "Adding to unticketed" unticketed[dr.comment] = dr } } @@ -430,9 +444,6 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin summaryappend("\n") } } - for (record in differencerecords) { - echo "${record.dump()}" - } return [summarystring, markunstable, unstablereason] } From 97faaf812e28ef0328d0d2863c0640d0cb3798f5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 08:31:05 +0100 Subject: [PATCH 0967/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 5734bb6..1b622e0 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -347,6 +347,7 @@ def boolean componentreport(meta, componentdifferencerecords) { echo "Incrementing ticket record for ${ticket}" tickets[ticket] += 1 } + echo "tickets size now: ${tickets.size()}" } } if (dr.type == "Ticketed") { @@ -366,6 +367,7 @@ def boolean componentreport(meta, componentdifferencerecords) { echo "Incrementing ticket record for ${ticket}" tickets[ticket] += 1 } + echo "tickets size now: ${tickets.size()}" } } if (dr.type == "Unticketed") { @@ -374,6 +376,7 @@ def boolean componentreport(meta, componentdifferencerecords) { } } String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" + echo "Size of tickets map: ${tickets.size()}" dir(componentreportfolder) { String ticketlist = "Ticket list:\n" for (ticketnumber in tickets.sort()*.key) { From 9c2d045a1883be3a3dc5ac1687f5a1d789a763c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 08:36:05 +0100 Subject: [PATCH 0968/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 1b622e0..861dbca 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -379,6 +379,8 @@ def boolean componentreport(meta, componentdifferencerecords) { echo "Size of tickets map: ${tickets.size()}" dir(componentreportfolder) { String ticketlist = "Ticket list:\n" + echo "tickets map:\n${tickets}" + echo "tickets map sorted:\n${tickets.sort()*.key}" for (ticketnumber in tickets.sort()*.key) { ticketlist += "${ticketnumber} (${tickets[ticketnumber]})\n" } From 3936752cb5e47fadd0201dfa16abc85611af7fa6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 09:14:46 +0100 Subject: [PATCH 0969/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 861dbca..1a4cb36 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -380,8 +380,9 @@ def boolean componentreport(meta, componentdifferencerecords) { dir(componentreportfolder) { String ticketlist = "Ticket list:\n" echo "tickets map:\n${tickets}" - echo "tickets map sorted:\n${tickets.sort()*.key}" - for (ticketnumber in tickets.sort()*.key) { + tickets = tickets.sort { it.key } + echo "tickets map sorted:\n${tickets}" + for (ticketnumber in tickets) { ticketlist += "${ticketnumber} (${tickets[ticketnumber]})\n" } writeFile(file: "ticketlist", text: ticketlist) From d5b25aa338c5895918489753256d015d9e93db15 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 09:34:15 +0100 Subject: [PATCH 0970/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 1a4cb36..a21d475 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -91,9 +91,6 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { 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 """ ) } @@ -380,9 +377,9 @@ def boolean componentreport(meta, componentdifferencerecords) { dir(componentreportfolder) { String ticketlist = "Ticket list:\n" echo "tickets map:\n${tickets}" - tickets = tickets.sort { it.key } - echo "tickets map sorted:\n${tickets}" - for (ticketnumber in tickets) { + ticketssorted = tickets.sort { it.key } + echo "tickets map sorted:\n${ticketssorted}" + for (ticketnumber in ticketssorted) { ticketlist += "${ticketnumber} (${tickets[ticketnumber]})\n" } writeFile(file: "ticketlist", text: ticketlist) From 79abd7ba56717effb371d2ba7aec72c472a599cb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 11:56:56 +0100 Subject: [PATCH 0971/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index a21d475..6df7368 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -377,7 +377,7 @@ def boolean componentreport(meta, componentdifferencerecords) { dir(componentreportfolder) { String ticketlist = "Ticket list:\n" echo "tickets map:\n${tickets}" - ticketssorted = tickets.sort { it.key } + ticketssorted = tickets.toSorted { a, b -> a.key <=> b.key } echo "tickets map sorted:\n${ticketssorted}" for (ticketnumber in ticketssorted) { ticketlist += "${ticketnumber} (${tickets[ticketnumber]})\n" From ae6c895c8ad3c7332d7fc0c47d6bfdacbaf52376 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 12:48:02 +0100 Subject: [PATCH 0972/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 6df7368..cb23c87 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -314,11 +314,11 @@ def addedcomponent(latermetaitems, key) { } def boolean componentreport(meta, componentdifferencerecords) { - def ticketed = [:] - def merges = [:] - def reverts = [:] - def unticketed = [:] - def tickets = [:] + def Map ticketed = [:] + def Map merges = [:] + def Map reverts = [:] + def Map unticketed = [:] + def Map tickets = [:] for (dr in componentdifferencerecords) { echo "Processing:\n${dr.dump()}" @@ -377,7 +377,7 @@ def boolean componentreport(meta, componentdifferencerecords) { dir(componentreportfolder) { String ticketlist = "Ticket list:\n" echo "tickets map:\n${tickets}" - ticketssorted = tickets.toSorted { a, b -> a.key <=> b.key } + ticketssorted = tickets.sort() echo "tickets map sorted:\n${ticketssorted}" for (ticketnumber in ticketssorted) { ticketlist += "${ticketnumber} (${tickets[ticketnumber]})\n" From 7a94c993c6f090cbaab143b117a3b900b5174c46 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 13:01:10 +0100 Subject: [PATCH 0973/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 40 ++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index cb23c87..043a0ca 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -313,6 +313,32 @@ def addedcomponent(latermetaitems, key) { summaryappend("Added ") } +def componentmergereport(String componentreportfolder, merges) { + echo "Size of merges map: ${merges.size()}" + dir(componentreportfolder) { + String mergelist = "Merge list:\n" + echo "merges map:\n${merges}" + mergessorted = merges.sort() + echo "merges map sorted:\n${mergessorted}" + for (amerge in mergessorted) { + mergelist += "${amerge.key}\n" + } + writeFile(file: "mergelist.txt", text: mergelist) + } +} + +def componentticketsreport(String componentreportfolder, tickets) { + echo "Size of tickets map: ${tickets.size()}" + dir(componentreportfolder) { + String ticketlist = "Ticket list:\n" + ticketssorted = tickets.sort() + for (ticketnumber in ticketssorted) { + ticketlist += "${ticketnumber.key} (${tickets.value})\n" + } + writeFile(file: "ticketlist.txt", text: ticketlist) + } +} + def boolean componentreport(meta, componentdifferencerecords) { def Map ticketed = [:] def Map merges = [:] @@ -373,17 +399,9 @@ def boolean componentreport(meta, componentdifferencerecords) { } } String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" - echo "Size of tickets map: ${tickets.size()}" - dir(componentreportfolder) { - String ticketlist = "Ticket list:\n" - echo "tickets map:\n${tickets}" - ticketssorted = tickets.sort() - echo "tickets map sorted:\n${ticketssorted}" - for (ticketnumber in ticketssorted) { - ticketlist += "${ticketnumber} (${tickets[ticketnumber]})\n" - } - writeFile(file: "ticketlist", text: ticketlist) - } + componentmergereport(componentreportfolder, merges) + componentticketreport(componentreportfolder, tickets) + } //m.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key //tickets.sort { a, b -> a.value <=> b.value } From e982b587219d6958f933c1542f307ad3310e2ecd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 13:04:38 +0100 Subject: [PATCH 0974/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 043a0ca..3d08eb8 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -400,7 +400,7 @@ def boolean componentreport(meta, componentdifferencerecords) { } String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" componentmergereport(componentreportfolder, merges) - componentticketreport(componentreportfolder, tickets) + componentticketsreport(componentreportfolder, tickets) } //m.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key From fdec3b5601069aae577252beb20da369cdc2ce89 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 13:16:56 +0100 Subject: [PATCH 0975/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 3d08eb8..a384a07 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -313,13 +313,10 @@ def addedcomponent(latermetaitems, key) { summaryappend("Added ") } -def componentmergereport(String componentreportfolder, merges) { - echo "Size of merges map: ${merges.size()}" +def mergereport(String componentreportfolder, merges) { dir(componentreportfolder) { String mergelist = "Merge list:\n" - echo "merges map:\n${merges}" mergessorted = merges.sort() - echo "merges map sorted:\n${mergessorted}" for (amerge in mergessorted) { mergelist += "${amerge.key}\n" } @@ -327,13 +324,26 @@ def componentmergereport(String componentreportfolder, merges) { } } -def componentticketsreport(String componentreportfolder, tickets) { - echo "Size of tickets map: ${tickets.size()}" +def revertsreport(String componentreportfolder, reverts) { + echo "Size of reverts map: ${reverts.size()}" + dir(componentreportfolder) { + String revertlist = "Revert list:\n" + echo "reverts map:\n${reverts}" + revertssorted = reverts.sort() + echo "reverts map sorted:\n${revertssorted}" + for (arevert in revertssorted) { + revertlist += "${arevert.key}:\n${arevert.value.join("\n")}\n" + } + writeFile(file: "revertlist.txt", text: revertlist) + } +} + +def ticketsreport(String componentreportfolder, tickets) { dir(componentreportfolder) { String ticketlist = "Ticket list:\n" ticketssorted = tickets.sort() for (ticketnumber in ticketssorted) { - ticketlist += "${ticketnumber.key} (${tickets.value})\n" + ticketlist += "${ticketnumber.key} (${ticketnumber.value})\n" } writeFile(file: "ticketlist.txt", text: ticketlist) } @@ -399,8 +409,9 @@ def boolean componentreport(meta, componentdifferencerecords) { } } String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" - componentmergereport(componentreportfolder, merges) - componentticketsreport(componentreportfolder, tickets) + mergereport(componentreportfolder, merges) + revertsreport(componentreportfolder, reverts) + ticketsreport(componentreportfolder, tickets) } //m.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key From 248803207feae3e8daecf8838d3e1aa8f5691b0c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 13:23:08 +0100 Subject: [PATCH 0976/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index a384a07..4c1bffe 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -338,6 +338,20 @@ def revertsreport(String componentreportfolder, reverts) { } } +def ticketedreport(String componentreportfolder, ticketed) { + echo "Size of ticketed map: ${ticketed.size()}" + dir(componentreportfolder) { + String ticketedlist = "Ticketed list:\n" + echo "ticketed map:\n${ticketed}" + ticketedsorted = ticketed.sort() + echo "ticketed map sorted:\n${ticketedsorted}" + for (aticketed in ticketedsorted) { + ticketedlist += "${aticketed.key}:\n${aticketed.value.join("\n")}\n" + } + writeFile(file: "ticketedlist.txt", text: ticketedlist) + } +} + def ticketsreport(String componentreportfolder, tickets) { dir(componentreportfolder) { String ticketlist = "Ticket list:\n" @@ -411,6 +425,7 @@ def boolean componentreport(meta, componentdifferencerecords) { String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" mergereport(componentreportfolder, merges) revertsreport(componentreportfolder, reverts) + ticketedreport(String componentreportfolder, ticketed) ticketsreport(componentreportfolder, tickets) } From 807ba4492dcdd3e4bed8f1dd9dd2778849ffb47d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 13:32:51 +0100 Subject: [PATCH 0977/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 4c1bffe..fef482b 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -425,7 +425,7 @@ def boolean componentreport(meta, componentdifferencerecords) { String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" mergereport(componentreportfolder, merges) revertsreport(componentreportfolder, reverts) - ticketedreport(String componentreportfolder, ticketed) + ticketedreport(componentreportfolder, ticketed) ticketsreport(componentreportfolder, tickets) } From 437a15986dd6d3f1cc3c7a7cb6ceca595b144502 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 13:52:26 +0100 Subject: [PATCH 0978/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 55 ++++++++++++++++++------------ 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index fef482b..29c8a43 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -313,7 +313,7 @@ def addedcomponent(latermetaitems, key) { summaryappend("Added ") } -def mergereport(String componentreportfolder, merges) { +def mergereport(String componentreportfolder, merges, boolean iscomponent = true) { dir(componentreportfolder) { String mergelist = "Merge list:\n" mergessorted = merges.sort() @@ -324,13 +324,10 @@ def mergereport(String componentreportfolder, merges) { } } -def revertsreport(String componentreportfolder, reverts) { - echo "Size of reverts map: ${reverts.size()}" +def revertsreport(String componentreportfolder, reverts, boolean iscomponent = true) { dir(componentreportfolder) { String revertlist = "Revert list:\n" - echo "reverts map:\n${reverts}" revertssorted = reverts.sort() - echo "reverts map sorted:\n${revertssorted}" for (arevert in revertssorted) { revertlist += "${arevert.key}:\n${arevert.value.join("\n")}\n" } @@ -338,13 +335,10 @@ def revertsreport(String componentreportfolder, reverts) { } } -def ticketedreport(String componentreportfolder, ticketed) { - echo "Size of ticketed map: ${ticketed.size()}" +def ticketedreport(String componentreportfolder, ticketed, boolean iscomponent = true) { dir(componentreportfolder) { String ticketedlist = "Ticketed list:\n" - echo "ticketed map:\n${ticketed}" ticketedsorted = ticketed.sort() - echo "ticketed map sorted:\n${ticketedsorted}" for (aticketed in ticketedsorted) { ticketedlist += "${aticketed.key}:\n${aticketed.value.join("\n")}\n" } @@ -352,7 +346,21 @@ def ticketedreport(String componentreportfolder, ticketed) { } } -def ticketsreport(String componentreportfolder, tickets) { +def unticketedreport(String componentreportfolder, unticketed, boolean iscomponent = true) { + echo "Size of ticketed map: ${unticketed.size()}" + dir(componentreportfolder) { + String unticketedlist = "Unticketed list:\n" + echo "unticketed map:\n${unticketed}" + unticketedsorted = unticketed.sort() + echo "unticketed map sorted:\n${unticketedsorted}" + for (anunticketed in unticketedsorted) { + unticketedlist += "${anunticketed.key}\n" + } + writeFile(file: "unticketedlist.txt", text: unticketedlist) + } +} + +def ticketsreport(String componentreportfolder, tickets, boolean iscomponent = true) { dir(componentreportfolder) { String ticketlist = "Ticket list:\n" ticketssorted = tickets.sort() @@ -363,14 +371,14 @@ def ticketsreport(String componentreportfolder, tickets) { } } -def boolean componentreport(meta, componentdifferencerecords) { +def boolean report(meta, differencerecords, boolean iscomponent = true) { def Map ticketed = [:] def Map merges = [:] def Map reverts = [:] def Map unticketed = [:] def Map tickets = [:] - for (dr in componentdifferencerecords) { + for (dr in differencerecords) { echo "Processing:\n${dr.dump()}" if (dr.type == "Merge") { @@ -422,16 +430,18 @@ def boolean componentreport(meta, componentdifferencerecords) { unticketed[dr.comment] = dr } } - String componentreportfolder = "${reportfolder}/${meta.componentidentifier()}" - mergereport(componentreportfolder, merges) - revertsreport(componentreportfolder, reverts) - ticketedreport(componentreportfolder, ticketed) - ticketsreport(componentreportfolder, tickets) - + String reportsubfolder = "" + if (iscomponent) { + reportsubfolder = "${reportfolder}/${meta.componentidentifier()}" + } else { + reportsubfolder = "${reportfolder}/Combined" + } + mergereport(reportsubfolder, merges, iscomponent) + revertsreport(reportsubfolder, reverts, iscomponent) + ticketedreport(reportsubfolder, ticketed, iscomponent) + unticketedreport(reportsubfolder, unticketed, iscomponent) + ticketsreport(reportsubfolder, tickets, iscomponent) } -//m.sort( { k1, k2 -> k1 <=> k2 } as Comparator )*.key -//tickets.sort { a, b -> a.value <=> b.value } -//myMap.sort()*.key def compare(earlymetaitems, latermetaitems, key) { boolean result = true; @@ -447,7 +457,7 @@ def compare(earlymetaitems, latermetaitems, key) { (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) summaryappend(" Items: ${differencerecords.size()} ") - componentreport(earlymeta, differencerecords) + report(earlymeta, differencerecords) summaryappend("\n") return [result, differencerecords]; @@ -491,6 +501,7 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin summaryappend("\n") } } + report(meta, differencerecords, false) return [summarystring, markunstable, unstablereason] } From 5122aca1bf70a5b54137f21b000a2f3300bb5918 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 14:34:32 +0100 Subject: [PATCH 0979/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 29c8a43..dc174a7 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -329,7 +329,10 @@ def revertsreport(String componentreportfolder, reverts, boolean iscomponent = t String revertlist = "Revert list:\n" revertssorted = reverts.sort() for (arevert in revertssorted) { - revertlist += "${arevert.key}:\n${arevert.value.join("\n")}\n" + revertlist += "${arevert.key}:\n" + for (revertlistcomment in arevert.value) { + revertlist += "${revertlistcomment.key} (${revertlistcomment.value})\n" + } } writeFile(file: "revertlist.txt", text: revertlist) } @@ -340,7 +343,10 @@ def ticketedreport(String componentreportfolder, ticketed, boolean iscomponent = String ticketedlist = "Ticketed list:\n" ticketedsorted = ticketed.sort() for (aticketed in ticketedsorted) { - ticketedlist += "${aticketed.key}:\n${aticketed.value.join("\n")}\n" + ticketedlist += "${aticketed.key}:\n" + for (ticketedlistcomment in aticketed.value) { + ticketedlist += "${ticketedlistcomment.key} (${ticketedlistcomment.value})\n" + } } writeFile(file: "ticketedlist.txt", text: ticketedlist) } @@ -355,6 +361,9 @@ def unticketedreport(String componentreportfolder, unticketed, boolean iscompone echo "unticketed map sorted:\n${unticketedsorted}" for (anunticketed in unticketedsorted) { unticketedlist += "${anunticketed.key}\n" + for (unticketedlistcomment in anunticketed.value) { + unticketedlist += "${unticketedlistcomment.key} (${unticketedlistcomment.value})\n" + } } writeFile(file: "unticketedlist.txt", text: unticketedlist) } @@ -390,10 +399,11 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { for (ticket in dr.jiraticketinfo) { if (!reverts.containsKey(ticket)) { echo "Creating reverts record for ${ticket}" - reverts[ticket] = [dr.comment] + reverts[ticket] = [:] + reverts[ticket][dr.comment] = 1 } else { echo "Adding to ticketed record for ${ticket}" - reverts[ticket].add(dr.comment) + reverts[ticket][dr.comment] += 1 } if (!tickets.containsKey(ticket)) { echo "Creating ticket record for ${ticket}" @@ -410,10 +420,11 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { for (ticket in dr.jiraticketinfo) { if (!ticketed.containsKey(ticket)) { echo "Creating ticketed record for ${ticket}" - ticketed[ticket] = [dr.comment] + ticketed[ticket] = [:] + ticketed[ticket][dr.comment] = 1 } else { echo "Adding to ticketed record for ${ticket}" - ticketed[ticket].add(dr.comment) + ticketed[ticket][dr.comment] += 1 } if (!tickets.containsKey(ticket)) { echo "Creating ticket record for ${ticket}" From 83e50fc58518da467ed89cc663fa85029854cc2c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 15:01:28 +0100 Subject: [PATCH 0980/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index dc174a7..c337e9a 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -397,14 +397,18 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { if (dr.type == "Revert") { echo "Adding to revert" for (ticket in dr.jiraticketinfo) { + def comments = [:] if (!reverts.containsKey(ticket)) { echo "Creating reverts record for ${ticket}" reverts[ticket] = [:] - reverts[ticket][dr.comment] = 1 + comments = reverts[ticket] + comments[dr.comment] = 1 } else { echo "Adding to ticketed record for ${ticket}" - reverts[ticket][dr.comment] += 1 + comments = reverts[ticket] + comments[dr.comment] += 1 } + reverts[ticket] = comments if (!tickets.containsKey(ticket)) { echo "Creating ticket record for ${ticket}" tickets[ticket] = 1 @@ -418,14 +422,18 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { if (dr.type == "Ticketed") { echo "Adding to ticketed" for (ticket in dr.jiraticketinfo) { + def comments = [:] if (!ticketed.containsKey(ticket)) { echo "Creating ticketed record for ${ticket}" ticketed[ticket] = [:] - ticketed[ticket][dr.comment] = 1 + comments = ticketed[ticket] + comments[dr.comment] = 1 } else { echo "Adding to ticketed record for ${ticket}" - ticketed[ticket][dr.comment] += 1 + def comments = ticketed[ticket] + comments[dr.comment] += 1 } + ticketed[ticket] = comments if (!tickets.containsKey(ticket)) { echo "Creating ticket record for ${ticket}" tickets[ticket] = 1 From 11fcc3279bf20505d00a7412813f9ec0cd8b51f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 15:03:20 +0100 Subject: [PATCH 0981/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index c337e9a..c1449f5 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -430,7 +430,7 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { comments[dr.comment] = 1 } else { echo "Adding to ticketed record for ${ticket}" - def comments = ticketed[ticket] + comments = ticketed[ticket] comments[dr.comment] += 1 } ticketed[ticket] = comments From 2f1a51c7582e9ebd417831abc92a1aeef9f09dee Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 15:34:57 +0100 Subject: [PATCH 0982/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index c1449f5..dfb75c4 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -405,8 +405,12 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { comments[dr.comment] = 1 } else { echo "Adding to ticketed record for ${ticket}" - comments = reverts[ticket] - comments[dr.comment] += 1 + comments = ticketed[ticket] + if (!comments.containsKey(dr.comment)) { + comments[dr.comment] = 1 + } else { + comments[dr.comment] += 1 + } } reverts[ticket] = comments if (!tickets.containsKey(ticket)) { @@ -431,7 +435,11 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { } else { echo "Adding to ticketed record for ${ticket}" comments = ticketed[ticket] - comments[dr.comment] += 1 + if (!comments.containsKey(dr.comment)) { + comments[dr.comment] = 1 + } else { + comments[dr.comment] += 1 + } } ticketed[ticket] = comments if (!tickets.containsKey(ticket)) { From b3b47d259328d157433d8b7cd3d6453322d4a447 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 15:45:00 +0100 Subject: [PATCH 0983/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index dfb75c4..cd988ac 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -380,6 +380,16 @@ def ticketsreport(String componentreportfolder, tickets, boolean iscomponent = t } } +def differencerecordsreport(String reportsubfolder, differencerecords, , boolean iscomponent = true) { + dir(componentreportfolder) { + String recordlist = "" + for (record in differencerecords) { + recordlist += dr.dump() + } + writeFile(file: "recordlist.txt", text: recordlist) + } +} + def boolean report(meta, differencerecords, boolean iscomponent = true) { def Map ticketed = [:] def Map merges = [:] @@ -388,8 +398,6 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { def Map tickets = [:] for (dr in differencerecords) { - echo "Processing:\n${dr.dump()}" - if (dr.type == "Merge") { echo "Adding to mergeinfo" merges[dr.mergeinfo] = dr @@ -468,6 +476,7 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { ticketedreport(reportsubfolder, ticketed, iscomponent) unticketedreport(reportsubfolder, unticketed, iscomponent) ticketsreport(reportsubfolder, tickets, iscomponent) + differencerecordsreport(reportsubfolder, differencerecords, iscomponent) } def compare(earlymetaitems, latermetaitems, key) { From 095ae84b697ad192ccd24ba54dbea017334cdc6f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 15:48:19 +0100 Subject: [PATCH 0984/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index cd988ac..203d09b 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -380,7 +380,7 @@ def ticketsreport(String componentreportfolder, tickets, boolean iscomponent = t } } -def differencerecordsreport(String reportsubfolder, differencerecords, , boolean iscomponent = true) { +def differencerecordsreport(String reportsubfolder, differencerecords, boolean iscomponent = true) { dir(componentreportfolder) { String recordlist = "" for (record in differencerecords) { From e441a724ce95b0be3cc8c866258984992ea55ee2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 16:01:18 +0100 Subject: [PATCH 0985/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 203d09b..e1d684b 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -313,8 +313,8 @@ def addedcomponent(latermetaitems, key) { summaryappend("Added ") } -def mergereport(String componentreportfolder, merges, boolean iscomponent = true) { - dir(componentreportfolder) { +def mergereport(String reportsubfolder, merges, boolean iscomponent = true) { + dir(reportsubfolder) { String mergelist = "Merge list:\n" mergessorted = merges.sort() for (amerge in mergessorted) { @@ -324,8 +324,8 @@ def mergereport(String componentreportfolder, merges, boolean iscomponent = true } } -def revertsreport(String componentreportfolder, reverts, boolean iscomponent = true) { - dir(componentreportfolder) { +def revertsreport(String reportsubfolder, reverts, boolean iscomponent = true) { + dir(reportsubfolder) { String revertlist = "Revert list:\n" revertssorted = reverts.sort() for (arevert in revertssorted) { @@ -338,8 +338,8 @@ def revertsreport(String componentreportfolder, reverts, boolean iscomponent = t } } -def ticketedreport(String componentreportfolder, ticketed, boolean iscomponent = true) { - dir(componentreportfolder) { +def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) { + dir(reportsubfolder) { String ticketedlist = "Ticketed list:\n" ticketedsorted = ticketed.sort() for (aticketed in ticketedsorted) { @@ -352,9 +352,9 @@ def ticketedreport(String componentreportfolder, ticketed, boolean iscomponent = } } -def unticketedreport(String componentreportfolder, unticketed, boolean iscomponent = true) { +def unticketedreport(String reportsubfolder, unticketed, boolean iscomponent = true) { echo "Size of ticketed map: ${unticketed.size()}" - dir(componentreportfolder) { + dir(reportsubfolder) { String unticketedlist = "Unticketed list:\n" echo "unticketed map:\n${unticketed}" unticketedsorted = unticketed.sort() @@ -369,8 +369,8 @@ def unticketedreport(String componentreportfolder, unticketed, boolean iscompone } } -def ticketsreport(String componentreportfolder, tickets, boolean iscomponent = true) { - dir(componentreportfolder) { +def ticketsreport(String reportsubfolder, tickets, boolean iscomponent = true) { + dir(reportsubfolder) { String ticketlist = "Ticket list:\n" ticketssorted = tickets.sort() for (ticketnumber in ticketssorted) { @@ -381,7 +381,7 @@ def ticketsreport(String componentreportfolder, tickets, boolean iscomponent = t } def differencerecordsreport(String reportsubfolder, differencerecords, boolean iscomponent = true) { - dir(componentreportfolder) { + dir(reportsubfolder) { String recordlist = "" for (record in differencerecords) { recordlist += dr.dump() From e95197837f6a5660cbc7be2f6d6a3eef8b76f3ff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 16:05:14 +0100 Subject: [PATCH 0986/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index e1d684b..34b90ec 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -383,7 +383,7 @@ def ticketsreport(String reportsubfolder, tickets, boolean iscomponent = true) { def differencerecordsreport(String reportsubfolder, differencerecords, boolean iscomponent = true) { dir(reportsubfolder) { String recordlist = "" - for (record in differencerecords) { + for (dr in differencerecords) { recordlist += dr.dump() } writeFile(file: "recordlist.txt", text: recordlist) @@ -399,20 +399,16 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { for (dr in differencerecords) { if (dr.type == "Merge") { - echo "Adding to mergeinfo" merges[dr.mergeinfo] = dr } if (dr.type == "Revert") { - echo "Adding to revert" for (ticket in dr.jiraticketinfo) { def comments = [:] if (!reverts.containsKey(ticket)) { - echo "Creating reverts record for ${ticket}" reverts[ticket] = [:] comments = reverts[ticket] comments[dr.comment] = 1 } else { - echo "Adding to ticketed record for ${ticket}" comments = ticketed[ticket] if (!comments.containsKey(dr.comment)) { comments[dr.comment] = 1 @@ -422,26 +418,20 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { } reverts[ticket] = comments if (!tickets.containsKey(ticket)) { - echo "Creating ticket record for ${ticket}" tickets[ticket] = 1 } else { - echo "Incrementing ticket record for ${ticket}" tickets[ticket] += 1 } - echo "tickets size now: ${tickets.size()}" } } if (dr.type == "Ticketed") { - echo "Adding to ticketed" for (ticket in dr.jiraticketinfo) { def comments = [:] if (!ticketed.containsKey(ticket)) { - echo "Creating ticketed record for ${ticket}" ticketed[ticket] = [:] comments = ticketed[ticket] comments[dr.comment] = 1 } else { - echo "Adding to ticketed record for ${ticket}" comments = ticketed[ticket] if (!comments.containsKey(dr.comment)) { comments[dr.comment] = 1 @@ -451,17 +441,13 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { } ticketed[ticket] = comments if (!tickets.containsKey(ticket)) { - echo "Creating ticket record for ${ticket}" tickets[ticket] = 1 } else { - echo "Incrementing ticket record for ${ticket}" tickets[ticket] += 1 } - echo "tickets size now: ${tickets.size()}" } } if (dr.type == "Unticketed") { - echo "Adding to unticketed" unticketed[dr.comment] = dr } } From 15cf1e840a122536023ee50a9feebf45336309b9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 17:11:52 +0100 Subject: [PATCH 0987/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- differences/metahierarchy.groovy | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 34b90ec..26230ab 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -384,7 +384,7 @@ def differencerecordsreport(String reportsubfolder, differencerecords, boolean i dir(reportsubfolder) { String recordlist = "" for (dr in differencerecords) { - recordlist += dr.dump() + recordlist += dr.dump() + "\n" } writeFile(file: "recordlist.txt", text: recordlist) } diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 8a42f5e..3392fdc 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -14,10 +14,15 @@ pipeline { script { SUMMARYDIR = "${WORKSPACE}/summary" REPORTDIR = "${WORKSPACE}/reports" + EARLYROOTDIR = 'early' + EARLYDIR = "${WORKSPACE}/${EARLYROOTDIR}" + LATERROOTDIR = 'later' + LATERDIR = "${WORKSPACE}/${LATERROOTDIR}" + cleanfolders = [ "${WORKSPACE}/build_artifacts", - "${WORKSPACE}/early", - "${WORKSPACE}/later", + "${EARLYDIR}", + "${LATERDIR}", "${SUMMARYDIR}", "${REPORTDIR}", ] @@ -26,22 +31,14 @@ pipeline { } } } - stage('Checkout top level meta') { + stage('Obtain top level meta') { steps { script { - configurationhelper = autobuilder.configurationhelper() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") SOURCEURL = TOP_LEVEL_META_REPOSITORY.trim() - - EARLYREVISION = RELEASE_EARLY_REVISION.trim() - EARLYROOTDIR = 'early' - EARLYDIR = "${WORKSPACE}/${EARLYROOTDIR}" - configurationhelper.gitCheckoutAndRegister(meta, EARLYROOTDIR, SOURCEURL, EARLYREVISION, EARLYDIR, EARLYROOTDIR, 0, false) - - LATERREVISION = RELEASE_LATER_REVISION.trim() - LATERROOTDIR = 'later' - LATERDIR = "${WORKSPACE}/${LATERROOTDIR}" - configurationhelper.gitCheckoutAndRegister(meta, LATERROOTDIR, SOURCEURL, LATERREVISION, LATERDIR, LATERROOTDIR, 0, false) + importer.artifactimport(meta, EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION, EARLYROOTDIR) + importer.artifactimport(meta, LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION, LATERROOTDIR) } } } From 5520e3d09708a6c3b60223e4184aa4f296308a6e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 17:33:32 +0100 Subject: [PATCH 0988/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 26230ab..9db7309 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -123,7 +123,7 @@ def getgitlogdifferences(String gitrootfolder, String earlyrevision, String late } def String differencetext dir(gitrootfolder) { - differencetext = sh(returnStdout: true, script: "git log --oneline ${releaseexpression}").trim() + differencetext = sh(returnStdout: true, script: "git --no-pager log --oneline ${releaseexpression}").trim() } return differencetext } From 67a3458e96ed9584ff71c6b14a6360c148fdde9a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 17:40:04 +0100 Subject: [PATCH 0989/1971] Add more difference infrastructure --- differences/metahierarchy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 3392fdc..4bcdcdc 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -37,8 +37,8 @@ pipeline { 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) - importer.artifactimport(meta, LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION, LATERROOTDIR) + 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/**') } } } From 529067c8442a0610f765f3ac3302c8f04eedfb2f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 17:47:11 +0100 Subject: [PATCH 0990/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 9db7309..46a2943 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -275,6 +275,7 @@ def List processtext(meta, String text) { text.split('\n').each { DifferenceRecord dr = fillrecord(meta, it.trim()) differencerecords.add(dr) + echo "${dr.dump()}" } return differencerecords } From 1743fdef3dae5ff73771dea12b9ce7e7664f7e68 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 17:50:16 +0100 Subject: [PATCH 0991/1971] Add more difference infrastructure --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 7e065d5..3ea97ec 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -251,7 +251,7 @@ def List convertSparseItemsString(String itemstopublish) { boolean nonempty = itemstopublish?.trim() if (nonempty) { - def String[] items = itemstopublish..trim().split(',') + def String[] items = itemstopublish.trim().split(',') def String allpaths = "" for(String item : items) { sparsepaths.add(item) From a95eb0c1a251d9d595438d17c593c6fe6e6fa795 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 18:06:21 +0100 Subject: [PATCH 0992/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 46a2943..67b08f3 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -172,8 +172,7 @@ def extractmerges(String line) { def extractjiraticketinfo(String line) { def List jiratickets = [] - boolean amatch = false - while (!amatch) { + while (true) { line = line.trim() def pattern1 = '^(\\w+-\\d+)(.*)' //GIS-1234 hmbxr5601-1234 def match1 = (line =~ pattern1) @@ -181,7 +180,6 @@ def extractjiraticketinfo(String line) { jiraticket = match1.group(1) jiratickets.add(jiraticket) line = match1.group(2) - amatch = true } else { def pattern2 = '^(\\w+\\d+)(.*)' //GIS1234 smb1234 def match2 = (line =~ pattern2) @@ -189,7 +187,6 @@ def extractjiraticketinfo(String line) { jiraticket = match2.group(1) jiratickets.add(jiraticket) line = match2.group(2) - amatch = true } else { def pattern3 = '^(\\w+ \\d+)(.*)' //GIS 1234 smb 1234 def match3 = (line =~ pattern3) @@ -197,8 +194,9 @@ def extractjiraticketinfo(String line) { jiraticket = match3.group(1) jiratickets.add(jiraticket) line = match3.group(2) - amatch = true } + } else { + break } } } From 81717b573f8e8e6e1b01de92d1b74d87e0f414a1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 18:14:51 +0100 Subject: [PATCH 0993/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 67b08f3..f98ee06 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -194,10 +194,10 @@ def extractjiraticketinfo(String line) { jiraticket = match3.group(1) jiratickets.add(jiraticket) line = match3.group(2) + } else { + break } - } else { - break - } + } } } boolean result = jiratickets.size() > 0 From e7bf289130db82cca79ac19992189e14519604b4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Jul 2019 18:17:54 +0100 Subject: [PATCH 0994/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index f98ee06..1b6055e 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -259,7 +259,7 @@ def DifferenceRecord fillrecord(meta, line) { dr.comment = comment } else { dr.type = "Unticketed" - df.comment = line2 + dr.comment = line2 } } } From 29b0981c8a7a07e81e646193a633dce9d14c4965 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 10:55:38 +0100 Subject: [PATCH 0995/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 1b6055e..0a71913 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -359,10 +359,7 @@ def unticketedreport(String reportsubfolder, unticketed, boolean iscomponent = t unticketedsorted = unticketed.sort() echo "unticketed map sorted:\n${unticketedsorted}" for (anunticketed in unticketedsorted) { - unticketedlist += "${anunticketed.key}\n" - for (unticketedlistcomment in anunticketed.value) { - unticketedlist += "${unticketedlistcomment.key} (${unticketedlistcomment.value})\n" - } + unticketedlist += "${anunticketed.key}\n${anunticketed.value()}" } writeFile(file: "unticketedlist.txt", text: unticketedlist) } @@ -447,7 +444,12 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { } } if (dr.type == "Unticketed") { - unticketed[dr.comment] = dr + if (!unticketed.containsKey(dr.comment)) { + unticketed[dr.comment] = 1 + } else { + unticketed[dr.comment] += 1 + } + } } } String reportsubfolder = "" From e8122dbab1f3eff143d55504e5d4762dc24b02de Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 10:58:56 +0100 Subject: [PATCH 0996/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 0a71913..ca2a633 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -446,9 +446,8 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { if (dr.type == "Unticketed") { if (!unticketed.containsKey(dr.comment)) { unticketed[dr.comment] = 1 - } else { - unticketed[dr.comment] += 1 - } + } else { + unticketed[dr.comment] += 1 } } } From e98a769dd1b0c29812e53c7c19e9988d602df2c5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 11:02:20 +0100 Subject: [PATCH 0997/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index ca2a633..379c482 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -359,7 +359,7 @@ def unticketedreport(String reportsubfolder, unticketed, boolean iscomponent = t unticketedsorted = unticketed.sort() echo "unticketed map sorted:\n${unticketedsorted}" for (anunticketed in unticketedsorted) { - unticketedlist += "${anunticketed.key}\n${anunticketed.value()}" + unticketedlist += "${anunticketed.key}\n${anunticketed.value}" } writeFile(file: "unticketedlist.txt", text: unticketedlist) } From 0280c4ec003d8c004382fb52370beaf6b5cef5e1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 11:14:16 +0100 Subject: [PATCH 0998/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 379c482..f894e65 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -405,7 +405,7 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { comments = reverts[ticket] comments[dr.comment] = 1 } else { - comments = ticketed[ticket] + comments = reverts[ticket] if (!comments.containsKey(dr.comment)) { comments[dr.comment] = 1 } else { From 750955d8cdffc153bde3a6a4871ed3ac858b34a7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 12:26:55 +0100 Subject: [PATCH 0999/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 57 ++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index f894e65..c29a278 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -169,6 +169,21 @@ def extractmerges(String line) { return [false, line] } +def jiraticketexists(String jiraticket) { + def String URI = "${JIRA_URI}/browse/${jiraticket}" + def get = new URL(URI).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(); + + if(!getRC.equals(200)) { + return [false, ''] + } + return [true, URI] +} + def extractjiraticketinfo(String line) { def List jiratickets = [] @@ -178,22 +193,37 @@ def extractjiraticketinfo(String line) { def match1 = (line =~ pattern1) if (match1.find()) { jiraticket = match1.group(1) - jiratickets.add(jiraticket) - line = match1.group(2) - } else { - def pattern2 = '^(\\w+\\d+)(.*)' //GIS1234 smb1234 + (exists, URI) = jiraticketexists(jiraticket) + if (exists) { + jiratickets.add([jiraticket, URI]) + line = match1.group(2) + } else { + break + } + } else { + def pattern2 = '^(\\w+)(\\d+)(.*)' //GIS1234 smb1234 def match2 = (line =~ pattern2) if (match2.find()) { - jiraticket = match2.group(1) - jiratickets.add(jiraticket) - line = match2.group(2) + jiraticket = match2.group(1) + "-" + match2.group(2) + (exists, URI) = jiraticketexists(jiraticket) + if (exists) { + jiratickets.add([jiraticket, URI]) + line = match2.group(3) + } else { + break + } } else { - def pattern3 = '^(\\w+ \\d+)(.*)' //GIS 1234 smb 1234 + def pattern3 = '^(\\w+)\\s(\\d+)(.*)' //GIS 1234 smb 1234 def match3 = (line =~ pattern3) if (match3.find()) { - jiraticket = match3.group(1) - jiratickets.add(jiraticket) - line = match3.group(2) + jiraticket = match3.group(1) + "-" + match3.group(2) + (exists, URI) = jiraticketexists(jiraticket) + if (exists) { + jiratickets.add([jiraticket, URI]) + line = match3.group(3) + } else { + break + } } else { break } @@ -352,14 +382,11 @@ def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) } def unticketedreport(String reportsubfolder, unticketed, boolean iscomponent = true) { - echo "Size of ticketed map: ${unticketed.size()}" dir(reportsubfolder) { String unticketedlist = "Unticketed list:\n" - echo "unticketed map:\n${unticketed}" unticketedsorted = unticketed.sort() - echo "unticketed map sorted:\n${unticketedsorted}" for (anunticketed in unticketedsorted) { - unticketedlist += "${anunticketed.key}\n${anunticketed.value}" + unticketedlist += "${anunticketed.key} (${anunticketed.value})\n" } writeFile(file: "unticketedlist.txt", text: unticketedlist) } From d755e394e97e5eef8ac46e191a1c3b01f0a81e48 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 12:34:33 +0100 Subject: [PATCH 1000/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index c29a278..449a162 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -186,7 +186,9 @@ def jiraticketexists(String jiraticket) { def extractjiraticketinfo(String line) { def List jiratickets = [] - + boolean exists = false + String URI = '' + while (true) { line = line.trim() def pattern1 = '^(\\w+-\\d+)(.*)' //GIS-1234 hmbxr5601-1234 From 2cf59337afb680a4551bc7fe787dff099d03bcd7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 13:07:57 +0100 Subject: [PATCH 1001/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 449a162..43e42cb 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -197,7 +197,8 @@ def extractjiraticketinfo(String line) { jiraticket = match1.group(1) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - jiratickets.add([jiraticket, URI]) + def jiraticketmap = ['jiraticket' : jiraticket, 'uri' : URI] + jiratickets.add(jiraticketmap) line = match1.group(2) } else { break @@ -209,7 +210,8 @@ def extractjiraticketinfo(String line) { jiraticket = match2.group(1) + "-" + match2.group(2) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - jiratickets.add([jiraticket, URI]) + def jiraticketmap = ['jiraticket' : jiraticket, 'uri' : URI] + jiratickets.add(jiraticketmap) line = match2.group(3) } else { break @@ -221,7 +223,8 @@ def extractjiraticketinfo(String line) { jiraticket = match3.group(1) + "-" + match3.group(2) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - jiratickets.add([jiraticket, URI]) + def jiraticketmap = ['jiraticket' : jiraticket, 'uri' : URI] + jiratickets.add(jiraticketmap) line = match3.group(3) } else { break From 86d40f76887a5af654c7ac91e789fdf3222f5cc0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 14:46:50 +0100 Subject: [PATCH 1002/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 43e42cb..7d66151 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -361,7 +361,7 @@ def mergereport(String reportsubfolder, merges, boolean iscomponent = true) { def revertsreport(String reportsubfolder, reverts, boolean iscomponent = true) { dir(reportsubfolder) { String revertlist = "Revert list:\n" - revertssorted = reverts.sort() + revertssorted = reverts.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } for (arevert in revertssorted) { revertlist += "${arevert.key}:\n" for (revertlistcomment in arevert.value) { @@ -375,7 +375,7 @@ def revertsreport(String reportsubfolder, reverts, boolean iscomponent = true) { def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) { dir(reportsubfolder) { String ticketedlist = "Ticketed list:\n" - ticketedsorted = ticketed.sort() + ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } for (aticketed in ticketedsorted) { ticketedlist += "${aticketed.key}:\n" for (ticketedlistcomment in aticketed.value) { @@ -400,7 +400,7 @@ def unticketedreport(String reportsubfolder, unticketed, boolean iscomponent = t def ticketsreport(String reportsubfolder, tickets, boolean iscomponent = true) { dir(reportsubfolder) { String ticketlist = "Ticket list:\n" - ticketssorted = tickets.sort() + ticketssorted = tickets.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } for (ticketnumber in ticketssorted) { ticketlist += "${ticketnumber.key} (${ticketnumber.value})\n" } From 19cfa866a4a422a67676bb21c187e08bd882e97d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 15:05:27 +0100 Subject: [PATCH 1003/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 7d66151..d959b0f 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -444,7 +444,8 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { comments[dr.comment] += 1 } } - reverts[ticket] = comments + reverts[ticket] = comments + echo "ticket: ${ticket} revert[ticket]: ${reverts[ticket]}" if (!tickets.containsKey(ticket)) { tickets[ticket] = 1 } else { From 783f5e2b42c6df2113565a445f3da1a1430495b5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 15:15:18 +0100 Subject: [PATCH 1004/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index d959b0f..307fd48 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -363,7 +363,7 @@ def revertsreport(String reportsubfolder, reverts, boolean iscomponent = true) { String revertlist = "Revert list:\n" revertssorted = reverts.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } for (arevert in revertssorted) { - revertlist += "${arevert.key}:\n" + revertlist += "${arevert.key['jiraticket']}: ${arevert.key['uri']}\n" for (revertlistcomment in arevert.value) { revertlist += "${revertlistcomment.key} (${revertlistcomment.value})\n" } @@ -377,7 +377,7 @@ def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) String ticketedlist = "Ticketed list:\n" ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } for (aticketed in ticketedsorted) { - ticketedlist += "${aticketed.key}:\n" + ticketedlist += "${aticketed.key['jiraticket']}: ${aticketed.key['uri']}\n" for (ticketedlistcomment in aticketed.value) { ticketedlist += "${ticketedlistcomment.key} (${ticketedlistcomment.value})\n" } @@ -386,6 +386,8 @@ def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) } } +ticket: [jiraticket:GIS-7312, uri:https://jira.gisapps.co.uk/browse/GIS-7312] revert[ticket]: [- The download of the latest 'sentinel super pro' drivers and placed next to the original dongle drivers.:1] + def unticketedreport(String reportsubfolder, unticketed, boolean iscomponent = true) { dir(reportsubfolder) { String unticketedlist = "Unticketed list:\n" @@ -402,7 +404,7 @@ def ticketsreport(String reportsubfolder, tickets, boolean iscomponent = true) { String ticketlist = "Ticket list:\n" ticketssorted = tickets.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } for (ticketnumber in ticketssorted) { - ticketlist += "${ticketnumber.key} (${ticketnumber.value})\n" + ticketlist += "${ticketnumber.key['jiraticket']}: ${ticketnumber.key['uri']} (${ticketnumber.value})\n" } writeFile(file: "ticketlist.txt", text: ticketlist) } From 1ff0e8298b30e5b42b5c3869c6af0d80e3ab52fa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 15:17:10 +0100 Subject: [PATCH 1005/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 307fd48..bb86e36 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -386,7 +386,7 @@ def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) } } -ticket: [jiraticket:GIS-7312, uri:https://jira.gisapps.co.uk/browse/GIS-7312] revert[ticket]: [- The download of the latest 'sentinel super pro' drivers and placed next to the original dongle drivers.:1] +//ticket: [jiraticket:GIS-7312, uri:https://jira.gisapps.co.uk/browse/GIS-7312] revert[ticket]: [- The download of the latest 'sentinel super pro' drivers and placed next to the original dongle drivers.:1] def unticketedreport(String reportsubfolder, unticketed, boolean iscomponent = true) { dir(reportsubfolder) { From 05271844bbd4f43c2863faebe16d390aee8c4f77 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 15:23:30 +0100 Subject: [PATCH 1006/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index bb86e36..e35cd8d 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -377,6 +377,7 @@ def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) String ticketedlist = "Ticketed list:\n" ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } for (aticketed in ticketedsorted) { + echo "aticketed: ${aticketed}" ticketedlist += "${aticketed.key['jiraticket']}: ${aticketed.key['uri']}\n" for (ticketedlistcomment in aticketed.value) { ticketedlist += "${ticketedlistcomment.key} (${ticketedlistcomment.value})\n" @@ -447,7 +448,6 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { } } reverts[ticket] = comments - echo "ticket: ${ticket} revert[ticket]: ${reverts[ticket]}" if (!tickets.containsKey(ticket)) { tickets[ticket] = 1 } else { From d154a643e2bfe378b9472e865b8cd657c1f8e56a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 15:31:40 +0100 Subject: [PATCH 1007/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index e35cd8d..a7ca611 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -376,6 +376,7 @@ def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) dir(reportsubfolder) { String ticketedlist = "Ticketed list:\n" ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } + echo "ticketedsorted: ${ticketedsorted}" for (aticketed in ticketedsorted) { echo "aticketed: ${aticketed}" ticketedlist += "${aticketed.key['jiraticket']}: ${aticketed.key['uri']}\n" From 79a9eecc51aa05306b088ae1c8d21b2eb94ba033 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 15:37:27 +0100 Subject: [PATCH 1008/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index a7ca611..adefdfc 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -375,7 +375,8 @@ def revertsreport(String reportsubfolder, reverts, boolean iscomponent = true) { def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) { dir(reportsubfolder) { String ticketedlist = "Ticketed list:\n" - ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } + echo "ticketed: ${ticketed}" + ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } echo "ticketedsorted: ${ticketedsorted}" for (aticketed in ticketedsorted) { echo "aticketed: ${aticketed}" From 15ae9f815f3680b0a5103929eace3aca17eec691 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 16:25:52 +0100 Subject: [PATCH 1009/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index adefdfc..1b297de 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -375,8 +375,14 @@ def revertsreport(String reportsubfolder, reverts, boolean iscomponent = true) { def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) { dir(reportsubfolder) { String ticketedlist = "Ticketed list:\n" - echo "ticketed: ${ticketed}" - ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } + echo "ticketed: ${ticketed}" + for (ticket in ticketed) { + echo "|${ticket.key['jiraticket']|\n|${ticket.key['uri']|\n" + for (comment in ticket.value) { + echo "|${comment.key}|${comment.value}|\n" + } + } + ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } echo "ticketedsorted: ${ticketedsorted}" for (aticketed in ticketedsorted) { echo "aticketed: ${aticketed}" From 39b849c61caf2315b059c04fd3f6557fe9359975 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 16:38:32 +0100 Subject: [PATCH 1010/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 1b297de..5d290b9 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -377,7 +377,7 @@ def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) String ticketedlist = "Ticketed list:\n" echo "ticketed: ${ticketed}" for (ticket in ticketed) { - echo "|${ticket.key['jiraticket']|\n|${ticket.key['uri']|\n" + echo "|${ticket.key['jiraticket']}|\n|${ticket.key['uri']}|\n" for (comment in ticket.value) { echo "|${comment.key}|${comment.value}|\n" } From 9062919a7f4b1a43d6cd87d65218574eaeb1c3f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 16:56:19 +0100 Subject: [PATCH 1011/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 5d290b9..06ade92 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -377,9 +377,9 @@ def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) String ticketedlist = "Ticketed list:\n" echo "ticketed: ${ticketed}" for (ticket in ticketed) { - echo "|${ticket.key['jiraticket']}|\n|${ticket.key['uri']}|\n" + echo "|${ticket.key['jiraticket']}(${ticket.key['jiraticket'].getClass()})|\n|${ticket.key['uri']}(${ticket.key['uri'].getClass()})|\n" for (comment in ticket.value) { - echo "|${comment.key}|${comment.value}|\n" + echo "|${comment.key}(${comment.key.getClass()})|${comment.value}(${comment.value.getClass()})|\n" } } ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } From 1b247ccb774aed23a3dde6a33050c4c800058459 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 20:38:16 +0100 Subject: [PATCH 1012/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 262 +++++++++++++++++++++-------- 1 file changed, 195 insertions(+), 67 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 06ade92..9adc784 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -184,6 +184,16 @@ def jiraticketexists(String jiraticket) { return [true, URI] } +class JiraTicketInfo { + String jiranumber + String uri + + JiraTicketInfo() { + jiranumber = '' + uri = '' + } +} + def extractjiraticketinfo(String line) { def List jiratickets = [] boolean exists = false @@ -197,8 +207,10 @@ def extractjiraticketinfo(String line) { jiraticket = match1.group(1) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - def jiraticketmap = ['jiraticket' : jiraticket, 'uri' : URI] - jiratickets.add(jiraticketmap) + def JiraTicketInfo j = new JiraTicketInfo + j.jiranumber = jiraticket + j.uri = URI + jiratickets.add(j) line = match1.group(2) } else { break @@ -210,8 +222,10 @@ def extractjiraticketinfo(String line) { jiraticket = match2.group(1) + "-" + match2.group(2) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - def jiraticketmap = ['jiraticket' : jiraticket, 'uri' : URI] - jiratickets.add(jiraticketmap) + def JiraTicketInfo j = new JiraTicketInfo + j.jiranumber = jiraticket + j.uri = URI + jiratickets.add(j) line = match2.group(3) } else { break @@ -223,8 +237,10 @@ def extractjiraticketinfo(String line) { jiraticket = match3.group(1) + "-" + match3.group(2) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - def jiraticketmap = ['jiraticket' : jiraticket, 'uri' : URI] - jiratickets.add(jiraticketmap) + def JiraTicketInfo j = new JiraTicketInfo + j.jiranumber = jiraticket + j.uri = URI + jiratickets.add(j) line = match3.group(3) } else { break @@ -347,73 +363,137 @@ def addedcomponent(latermetaitems, key) { summaryappend("Added ") } -def mergereport(String reportsubfolder, merges, boolean iscomponent = true) { +class MergeReportRecord { + String comment + int duplicates + + MergeReportRecord() { + comment = '' + duplicates = 0 + } +} + +def mergereport(String reportsubfolder, LinkedHashMap merges, boolean iscomponent = true) { dir(reportsubfolder) { - String mergelist = "Merge list:\n" - mergessorted = merges.sort() + def String mergelist = "Merge list:\n" + def mergessorted = merges.sort() for (amerge in mergessorted) { - mergelist += "${amerge.key}\n" + def MergeReportRecord m = amerge.value + mergelist += "${m.comment} (${m.duplicates()})\n" } writeFile(file: "mergelist.txt", text: mergelist) } } -def revertsreport(String reportsubfolder, reverts, boolean iscomponent = true) { +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, LinkedHashMap reverts, boolean iscomponent = true) { dir(reportsubfolder) { - String revertlist = "Revert list:\n" - revertssorted = reverts.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } + def String revertlist = "Revert list:\n" + def revertssorted = reverts.sort() for (arevert in revertssorted) { - revertlist += "${arevert.key['jiraticket']}: ${arevert.key['uri']}\n" - for (revertlistcomment in arevert.value) { - revertlist += "${revertlistcomment.key} (${revertlistcomment.value})\n" + def RevertsReportRecord r = arevert.value + revertlist += "${r.jiraticket} (${r.ticketURI}):\n" + def commentscollection = r.commentscollection + def sortedcommentscollection = commentscollection.sort() + for (commentrecord in sortedcommentscollection) { + revertlist += "${commentrecord.comment} (${commentrecord.duplicates})\n" } } writeFile(file: "revertlist.txt", text: revertlist) } } -def ticketedreport(String reportsubfolder, ticketed, boolean iscomponent = true) { +class TicketedReportRecord { + String jiraticket + String ticketURI + LinkedHashMap commentscollection + + TicketedReportRecord() { + jiraticket = '' + ticketURI = '' + commentscollection = new LinkedHashMap() + } +} + +def ticketedreport(String reportsubfolder, LinkedHashMap ticketed, boolean iscomponent = true) { dir(reportsubfolder) { - String ticketedlist = "Ticketed list:\n" - echo "ticketed: ${ticketed}" - for (ticket in ticketed) { - echo "|${ticket.key['jiraticket']}(${ticket.key['jiraticket'].getClass()})|\n|${ticket.key['uri']}(${ticket.key['uri'].getClass()})|\n" - for (comment in ticket.value) { - echo "|${comment.key}(${comment.key.getClass()})|${comment.value}(${comment.value.getClass()})|\n" - } - } - ticketedsorted = ticketed.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } - echo "ticketedsorted: ${ticketedsorted}" + def String ticketedlist = "Ticketed list:\n" + def ticketedsorted = ticketed.sort() for (aticketed in ticketedsorted) { - echo "aticketed: ${aticketed}" - ticketedlist += "${aticketed.key['jiraticket']}: ${aticketed.key['uri']}\n" - for (ticketedlistcomment in aticketed.value) { - ticketedlist += "${ticketedlistcomment.key} (${ticketedlistcomment.value})\n" + def TicketedReportRecord r = aticket.value + ticketedlist += "${r.jiraticket} (${r.ticketURI}):\n" + def commentscollection = r.commentscollection + def sortedcommentscollection = commentscollection.sort() + for (commentrecord in sortedcommentscollection) { + ticketedlist += "${commentrecord.comment} (${commentrecord.duplicates})\n" } } writeFile(file: "ticketedlist.txt", text: ticketedlist) } } -//ticket: [jiraticket:GIS-7312, uri:https://jira.gisapps.co.uk/browse/GIS-7312] revert[ticket]: [- The download of the latest 'sentinel super pro' drivers and placed next to the original dongle drivers.:1] +class UnticketedReportRecord { + String comment + int duplicates + + UnticketedReportRecord() { + comment = '' + duplicates = 0 + } +} -def unticketedreport(String reportsubfolder, unticketed, boolean iscomponent = true) { +def unticketedreport(String reportsubfolder, LinkedHashMap unticketed, boolean iscomponent = true) { dir(reportsubfolder) { - String unticketedlist = "Unticketed list:\n" - unticketedsorted = unticketed.sort() + def String unticketedlist = "Unticketed list:\n" + def unticketedsorted = unticketed.sort() for (anunticketed in unticketedsorted) { - unticketedlist += "${anunticketed.key} (${anunticketed.value})\n" + 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, tickets, boolean iscomponent = true) { dir(reportsubfolder) { String ticketlist = "Ticket list:\n" - ticketssorted = tickets.toSorted { a, b -> a.key['jiraticket'] <=> b.key['jiraticket'] } + ticketssorted = tickets.sort() for (ticketnumber in ticketssorted) { - ticketlist += "${ticketnumber.key['jiraticket']}: ${ticketnumber.key['uri']} (${ticketnumber.value})\n" + TicketsReportRecord t = ticketnumber.value + ticketlist += "${t.jiraticket} (${t.ticketURI}) (${t.duplicates})\n" } writeFile(file: "ticketlist.txt", text: ticketlist) } @@ -438,60 +518,108 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { for (dr in differencerecords) { if (dr.type == "Merge") { - merges[dr.mergeinfo] = dr + def MergeReportRecord m + if (!merges.containsKey(dr.mergeinfo)) { + m = new MergeReportRecord() + m.comment = dr.mergeinfo + m.duplicate = 1 + } else { + m = merges[dr.mergeinfo] + m.duplicate += 1 + } + merges[dr.mergeinfo] = m } if (dr.type == "Revert") { + def RevertsReportRecord r for (ticket in dr.jiraticketinfo) { - def comments = [:] - if (!reverts.containsKey(ticket)) { - reverts[ticket] = [:] - comments = reverts[ticket] - comments[dr.comment] = 1 + JiraTicketInfo j = ticket + if (!reverts.containsKey(j.jiranumber)) { + r = new RevertsReportRecord() + r.jiraticket = j.jiranumber + r.ticketURI = j.uri + CommentsRecord c = mew CommentsRecord() + c.comment = dr.comment + c.duplicates = 1 + r.commentscollection[dr.comment] = c } else { - comments = reverts[ticket] - if (!comments.containsKey(dr.comment)) { - comments[dr.comment] = 1 + r = reverts[j.jiranumber] + def CommentsRecord c + if (!r.commentscollection.containsKey(dr.comment)) { + c = mew CommentsRecord() + c.comment = dr.comment + c.duplicates = 1 + r.commentscollection[dr.comment] = c } else { - comments[dr.comment] += 1 + c = r.commentscollection[dr.comment] + c.duplicates += 1 } + r.commentscollection[dr.comment] = c } - reverts[ticket] = comments - if (!tickets.containsKey(ticket)) { - tickets[ticket] = 1 + 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 { - tickets[ticket] += 1 + t = tickets[j.jiranumber] + t.duplicates += 1 } + tickets[j.jiranumber] = t } } if (dr.type == "Ticketed") { + def TicketedReportRecord t for (ticket in dr.jiraticketinfo) { - def comments = [:] - if (!ticketed.containsKey(ticket)) { - ticketed[ticket] = [:] - comments = ticketed[ticket] - comments[dr.comment] = 1 + JiraTicketInfo j = ticket + if (!ticketed.containsKey(j.jiranumber)) { + t = new TicketedReportRecord() + t.jiraticket = j.jiranumber + t.ticketURI = j.uri + CommentsRecord c = mew CommentsRecord() + c.comment = dr.comment + c.duplicates = 1 + t.commentscollection[dr.comment] = c } else { - comments = ticketed[ticket] - if (!comments.containsKey(dr.comment)) { - comments[dr.comment] = 1 + t = ticketed[j.jiranumber] + def CommentsRecord c + if (!t.commentscollection.containsKey(dr.comment)) { + c = mew CommentsRecord() + c.comment = dr.comment + c.duplicates = 1 + t.commentscollection[dr.comment] = c } else { - comments[dr.comment] += 1 + c = t.commentscollection[dr.comment] + c.duplicates += 1 } + t.commentscollection[dr.comment] = c } - ticketed[ticket] = comments - if (!tickets.containsKey(ticket)) { - tickets[ticket] = 1 + ticketed[j.jiranumber] = t + def TicketsReportRecord t + if (!tickets.containsKey(j.jiranumber)) { + t = new TicketsReportRecord() + t.jiraticket = j.jiranumber + t.ticketURI = j.uri + t.duplicates = 1 } else { - tickets[ticket] += 1 + t = tickets[j.jiranumber] + t.duplicates += 1 } + tickets[j.jiranumber] = t } } if (dr.type == "Unticketed") { + UnticketedReportRecord u if (!unticketed.containsKey(dr.comment)) { - unticketed[dr.comment] = 1 + u = new UnticketedReportRecord() + u.comment = dr.comment + u.duplicates = 1 } else { - unticketed[dr.comment] += 1 + u = unticketed[dr.comment] + u.duplicates += 1 } + unticketed[dr.comment] = u } } String reportsubfolder = "" From c7536f377b217c189eb09499d12838bc1cf44312 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 20:43:43 +0100 Subject: [PATCH 1013/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 9adc784..a542edb 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -207,7 +207,7 @@ def extractjiraticketinfo(String line) { jiraticket = match1.group(1) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - def JiraTicketInfo j = new JiraTicketInfo + def JiraTicketInfo j = new JiraTicketInfo() j.jiranumber = jiraticket j.uri = URI jiratickets.add(j) @@ -222,7 +222,7 @@ def extractjiraticketinfo(String line) { jiraticket = match2.group(1) + "-" + match2.group(2) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - def JiraTicketInfo j = new JiraTicketInfo + def JiraTicketInfo j = new JiraTicketInfo() j.jiranumber = jiraticket j.uri = URI jiratickets.add(j) @@ -237,7 +237,7 @@ def extractjiraticketinfo(String line) { jiraticket = match3.group(1) + "-" + match3.group(2) (exists, URI) = jiraticketexists(jiraticket) if (exists) { - def JiraTicketInfo j = new JiraTicketInfo + def JiraTicketInfo j = new JiraTicketInfo() j.jiranumber = jiraticket j.uri = URI jiratickets.add(j) From b3188c775247a4a2de587a47b00571ac222cd716 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 20:47:56 +0100 Subject: [PATCH 1014/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index a542edb..3a2538e 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -596,17 +596,17 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { t.commentscollection[dr.comment] = c } ticketed[j.jiranumber] = t - def TicketsReportRecord t + def TicketsReportRecord ti if (!tickets.containsKey(j.jiranumber)) { - t = new TicketsReportRecord() - t.jiraticket = j.jiranumber - t.ticketURI = j.uri - t.duplicates = 1 + ti = new TicketsReportRecord() + ti.jiraticket = j.jiranumber + ti.ticketURI = j.uri + ti.duplicates = 1 } else { - t = tickets[j.jiranumber] - t.duplicates += 1 + ti = tickets[j.jiranumber] + ti.duplicates += 1 } - tickets[j.jiranumber] = t + tickets[j.jiranumber] = ti } } if (dr.type == "Unticketed") { From 28dc2231bf161b289c5b678603bba78e6b91c1a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 20:56:07 +0100 Subject: [PATCH 1015/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 3a2538e..a1ed656 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -192,6 +192,10 @@ class JiraTicketInfo { jiranumber = '' uri = '' } + + def String dump() { + return "jiranumber: ${jiranumber} uri: ${uri}" + } } def extractjiraticketinfo(String line) { @@ -522,10 +526,10 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { if (!merges.containsKey(dr.mergeinfo)) { m = new MergeReportRecord() m.comment = dr.mergeinfo - m.duplicate = 1 + m.duplicates = 1 } else { m = merges[dr.mergeinfo] - m.duplicate += 1 + m.duplicates += 1 } merges[dr.mergeinfo] = m } From 7ff591f1fa1db05fa59294bdc0a8aba2ed382560 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 21:04:00 +0100 Subject: [PATCH 1016/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index a1ed656..4401059 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -10,6 +10,20 @@ 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 @@ -19,7 +33,7 @@ class DifferenceRecord { String sha String type String mergeinfo - List jiraticketinfo + List jiraticketinfo String comment DifferenceRecord() { @@ -31,7 +45,7 @@ class DifferenceRecord { sha = "" type = "" mergeinfo = "" - jiraticketinfo = [] + jiraticketinfo = new List comment = "" } @@ -184,20 +198,6 @@ def jiraticketexists(String jiraticket) { return [true, URI] } -class JiraTicketInfo { - String jiranumber - String uri - - JiraTicketInfo() { - jiranumber = '' - uri = '' - } - - def String dump() { - return "jiranumber: ${jiranumber} uri: ${uri}" - } -} - def extractjiraticketinfo(String line) { def List jiratickets = [] boolean exists = false @@ -541,7 +541,7 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { r = new RevertsReportRecord() r.jiraticket = j.jiranumber r.ticketURI = j.uri - CommentsRecord c = mew CommentsRecord() + CommentsRecord c = new CommentsRecord() c.comment = dr.comment c.duplicates = 1 r.commentscollection[dr.comment] = c @@ -549,7 +549,7 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { r = reverts[j.jiranumber] def CommentsRecord c if (!r.commentscollection.containsKey(dr.comment)) { - c = mew CommentsRecord() + c = new CommentsRecord() c.comment = dr.comment c.duplicates = 1 r.commentscollection[dr.comment] = c @@ -581,7 +581,7 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { t = new TicketedReportRecord() t.jiraticket = j.jiranumber t.ticketURI = j.uri - CommentsRecord c = mew CommentsRecord() + CommentsRecord c = new CommentsRecord() c.comment = dr.comment c.duplicates = 1 t.commentscollection[dr.comment] = c @@ -589,7 +589,7 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { t = ticketed[j.jiranumber] def CommentsRecord c if (!t.commentscollection.containsKey(dr.comment)) { - c = mew CommentsRecord() + c = new CommentsRecord() c.comment = dr.comment c.duplicates = 1 t.commentscollection[dr.comment] = c From 348620371002aa07e3f964979188d75bfb2a08cf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 21:15:41 +0100 Subject: [PATCH 1017/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 4401059..3916d61 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -45,7 +45,7 @@ class DifferenceRecord { sha = "" type = "" mergeinfo = "" - jiraticketinfo = new List + jiraticketinfo = new List() comment = "" } From 4b2b4018f787e05f177d68d559e2acf7e74ffda7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 21:29:06 +0100 Subject: [PATCH 1018/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 3916d61..1fb6444 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -45,7 +45,7 @@ class DifferenceRecord { sha = "" type = "" mergeinfo = "" - jiraticketinfo = new List() + jiraticketinfo = [] comment = "" } From 5c1c461bcd07812720d7c5a25dfd904cf60378a3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 21:37:55 +0100 Subject: [PATCH 1019/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 1fb6444..08017cb 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -50,7 +50,11 @@ class DifferenceRecord { } def String dump() { - return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketinfo}\ncomment: ${comment}" + String jiraticketstring = '' + for (j in jiraticketinfo) { + jiraticketstring += j.dump() + " " + } + return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketstring}\ncomment: ${comment}" } } @@ -383,7 +387,7 @@ def mergereport(String reportsubfolder, LinkedHashMap def mergessorted = merges.sort() for (amerge in mergessorted) { def MergeReportRecord m = amerge.value - mergelist += "${m.comment} (${m.duplicates()})\n" + mergelist += "${m.comment} (${m.duplicates})\n" } writeFile(file: "mergelist.txt", text: mergelist) } From bac02149cecb8723e138ce062f6e51035dd2524d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 21:48:53 +0100 Subject: [PATCH 1020/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 08017cb..20c2af6 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -425,7 +425,8 @@ def revertsreport(String reportsubfolder, LinkedHashMap Date: Sat, 6 Jul 2019 21:50:21 +0100 Subject: [PATCH 1021/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 20c2af6..63ba65e 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -425,7 +425,7 @@ def revertsreport(String reportsubfolder, LinkedHashMap Date: Sat, 6 Jul 2019 22:03:12 +0100 Subject: [PATCH 1022/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 63ba65e..8bd1a74 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -209,6 +209,11 @@ def extractjiraticketinfo(String line) { 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()) { @@ -450,7 +455,7 @@ def ticketedreport(String reportsubfolder, LinkedHashMap Date: Sat, 6 Jul 2019 22:11:00 +0100 Subject: [PATCH 1023/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 8bd1a74..39b57e6 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -460,7 +460,8 @@ def ticketedreport(String reportsubfolder, LinkedHashMap Date: Sat, 6 Jul 2019 22:42:21 +0100 Subject: [PATCH 1024/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 39b57e6..60a4c66 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -464,6 +464,7 @@ def ticketedreport(String reportsubfolder, LinkedHashMap Date: Sat, 6 Jul 2019 22:47:09 +0100 Subject: [PATCH 1025/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 60a4c66..3c4aefb 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -337,7 +337,7 @@ def List processtext(meta, String text) { text.split('\n').each { DifferenceRecord dr = fillrecord(meta, it.trim()) differencerecords.add(dr) - echo "${dr.dump()}" + //echo "${dr.dump()}" } return differencerecords } From 39e4ff5409bd48803dd52e493f7685505c8f630e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 22:50:03 +0100 Subject: [PATCH 1026/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 3c4aefb..9443fd1 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -433,6 +433,7 @@ def revertsreport(String reportsubfolder, LinkedHashMap Date: Sat, 6 Jul 2019 23:01:36 +0100 Subject: [PATCH 1027/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 9443fd1..b4f438f 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -189,7 +189,8 @@ def extractmerges(String line) { def jiraticketexists(String jiraticket) { def String URI = "${JIRA_URI}/browse/${jiraticket}" - def get = new URL(URI).openConnection(); + def String URIforsummary = "${URI}?fields=summary" + def get = new URL(URIforsummary).openConnection(); get.setRequestProperty( 'X-AUSERNAME', "${JIRA_USERNAME}" ) get.setRequestProperty( 'Authorization', "Basic ${JIRA_ENCODED_PASSWORD}" ) get.setRequestProperty( 'User-Agent', 'groovy-2.4.4' ) From b2a891e9cc36fff7b28f5ebec31269f13f85cbc8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 23:17:12 +0100 Subject: [PATCH 1028/1971] Add more difference infrastructure; Check with Jira --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index b4f438f..6d5c2fb 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -521,7 +521,7 @@ def differencerecordsreport(String reportsubfolder, differencerecords, boolean i dir(reportsubfolder) { String recordlist = "" for (dr in differencerecords) { - recordlist += dr.dump() + "\n" + recordlist += dr.dump() + "\n\n" } writeFile(file: "recordlist.txt", text: recordlist) } From 4a796b33abb626ada8b8e45e47058a53eeada34f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Jul 2019 23:57:39 +0100 Subject: [PATCH 1029/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 6d5c2fb..0b056cf 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -101,6 +101,7 @@ def showmetaitems(metaitems) { def checkoutsourcerepo(buildmeta, String checkoutfolder) { def String sourcerepo = buildmeta.gitinfo.remoteurl + 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)) { From e40949419a5d18721bc66f27b73b0342242d773d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Jul 2019 00:06:45 +0100 Subject: [PATCH 1030/1971] Add more difference infrastructure --- differences/dometahierarchy.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 0b056cf..3c97076 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -127,6 +127,7 @@ def String getcomponent(meta) { def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" + echo "Cloning/updating source repo in folder: ${uniquefolderforsourcerepo}" checkoutsourcerepo(meta, uniquefolderforsourcerepo) return uniquefolderforsourcerepo From 85d7f751da8e638bd2d77331810978f3f29d4a0f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Jul 2019 00:27:10 +0100 Subject: [PATCH 1031/1971] Handle components that have no source repo --- differences/dometahierarchy.groovy | 57 ++++++++++++++++++------------ 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 3c97076..6336c33 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -99,27 +99,32 @@ def showmetaitems(metaitems) { echo info } -def checkoutsourcerepo(buildmeta, String checkoutfolder) { +def boolean checkoutsourcerepo(buildmeta, String checkoutfolder) { + boolean checkedout = false def String sourcerepo = buildmeta.gitinfo.remoteurl - 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 - """ - ) + 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}") + else { + dir(sourcerepofolder) { + sh("git clone ${sourcerepo} ${checkoutfolder}") + } } } + checkedout = true } + return checkedout } def String getcomponent(meta) { @@ -127,10 +132,9 @@ def String getcomponent(meta) { def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" - echo "Cloning/updating source repo in folder: ${uniquefolderforsourcerepo}" - checkoutsourcerepo(meta, uniquefolderforsourcerepo) + bool checkedout = checkoutsourcerepo(meta, uniquefolderforsourcerepo) - return uniquefolderforsourcerepo + return [checkedout, uniquefolderforsourcerepo] } def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { @@ -665,12 +669,19 @@ def compare(earlymetaitems, latermetaitems, key) { summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ") - def uniquefolderforsourcerepo = getcomponent(earlymeta) + def boolean repoavailable + def String uniquefolderforsourcerepo + (repoavailable, uniquefolderforsourcerepo) = getcomponent(earlymeta) - (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) + List differencerecords = [] + if (repoavailable) { + (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) - summaryappend(" Items: ${differencerecords.size()} ") - report(earlymeta, differencerecords) + summaryappend(" Items: ${differencerecords.size()} ") + report(earlymeta, differencerecords) + } else { + summaryappend(" No source repo ") + } summaryappend("\n") return [result, differencerecords]; From a0fcc01a0d9d808e8453b523458ab89bc48f9d32 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Jul 2019 00:30:39 +0100 Subject: [PATCH 1032/1971] Handle components that have no source repo --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 6336c33..b7d4615 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -132,7 +132,7 @@ def String getcomponent(meta) { def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" - bool checkedout = checkoutsourcerepo(meta, uniquefolderforsourcerepo) + boolean checkedout = checkoutsourcerepo(meta, uniquefolderforsourcerepo) return [checkedout, uniquefolderforsourcerepo] } From 06591a0daaddcc2da9570ce230c86216c355c1ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Jul 2019 07:44:38 +0100 Subject: [PATCH 1033/1971] Handle the no change case - the early and later sha codes match --- differences/dometahierarchy.groovy | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index b7d4615..e515c06 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -342,9 +342,12 @@ def List processtext(meta, String text) { def List differencerecords = [] text.split('\n').each { - DifferenceRecord dr = fillrecord(meta, it.trim()) - differencerecords.add(dr) - //echo "${dr.dump()}" + def line = it + if (line?.trim()) { + def DifferenceRecord dr = fillrecord(meta, line.trim()) + differencerecords.add(dr) + //echo "${dr.dump()}" + } } return differencerecords } @@ -363,6 +366,9 @@ def getdifferencerecords(earlymeta, latermeta, String sourcepath) { summaryappend("Early revision: ${earlyrevision} Later revision: ${laterrevision}") def String differencetext = getgitlogdifferences(sourcepath, earlyrevision, laterrevision) differencerecords = processtext(earlymeta, differencetext) + 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" From aecd252a57158eb20babe62cc40bb43be5e433b5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Jul 2019 09:04:07 +0100 Subject: [PATCH 1034/1971] Normalise Jira ticket number --- differences/dometahierarchy.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index e515c06..dccb5b4 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -225,6 +225,7 @@ def extractjiraticketinfo(String line) { def match1 = (line =~ pattern1) if (match1.find()) { jiraticket = match1.group(1) + jiraticket = jiraticket.toUpperCase() (exists, URI) = jiraticketexists(jiraticket) if (exists) { def JiraTicketInfo j = new JiraTicketInfo() @@ -240,6 +241,7 @@ def extractjiraticketinfo(String line) { def match2 = (line =~ pattern2) if (match2.find()) { jiraticket = match2.group(1) + "-" + match2.group(2) + jiraticket = jiraticket.toUpperCase() (exists, URI) = jiraticketexists(jiraticket) if (exists) { def JiraTicketInfo j = new JiraTicketInfo() @@ -255,6 +257,7 @@ def extractjiraticketinfo(String line) { def match3 = (line =~ pattern3) if (match3.find()) { jiraticket = match3.group(1) + "-" + match3.group(2) + jiraticket = jiraticket.toUpperCase() (exists, URI) = jiraticketexists(jiraticket) if (exists) { def JiraTicketInfo j = new JiraTicketInfo() From 877f022678fc67bc971cb69a18b88b8c2b508a79 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Jul 2019 10:44:26 +0100 Subject: [PATCH 1035/1971] Handle Jira ticket redirects - as a result of a jira ticket being moved to another project --- differences/dometahierarchy.groovy | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index dccb5b4..9258da3 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -1,3 +1,5 @@ +import groovy.json.JsonSlurper + markunstable = false unstablereason = "" @@ -203,10 +205,15 @@ def jiraticketexists(String jiraticket) { get.setRequestProperty( 'Accept', 'application/json' ) def getRC = get.getResponseCode(); + def String redirectedjiraticket = jiraticket if(!getRC.equals(200)) { - return [false, ''] + return [false, '', jiraticket] + } else { + def jsonresponse = new JsonSlurper().parseText(get.inputStream.getText('UTF-8')) + echo "Response: ${jsonresponse}" + redirectedjiraticket = jsonresponse['key'] } - return [true, URI] + return [true, URI, redirectedjiraticket] } def extractjiraticketinfo(String line) { @@ -225,8 +232,7 @@ def extractjiraticketinfo(String line) { def match1 = (line =~ pattern1) if (match1.find()) { jiraticket = match1.group(1) - jiraticket = jiraticket.toUpperCase() - (exists, URI) = jiraticketexists(jiraticket) + (exists, URI, jiraticket) = jiraticketexists(jiraticket) if (exists) { def JiraTicketInfo j = new JiraTicketInfo() j.jiranumber = jiraticket @@ -241,8 +247,7 @@ def extractjiraticketinfo(String line) { def match2 = (line =~ pattern2) if (match2.find()) { jiraticket = match2.group(1) + "-" + match2.group(2) - jiraticket = jiraticket.toUpperCase() - (exists, URI) = jiraticketexists(jiraticket) + (exists, URI, jiraticket) = jiraticketexists(jiraticket) if (exists) { def JiraTicketInfo j = new JiraTicketInfo() j.jiranumber = jiraticket @@ -257,8 +262,7 @@ def extractjiraticketinfo(String line) { def match3 = (line =~ pattern3) if (match3.find()) { jiraticket = match3.group(1) + "-" + match3.group(2) - jiraticket = jiraticket.toUpperCase() - (exists, URI) = jiraticketexists(jiraticket) + (exists, URI, jiraticket) = jiraticketexists(jiraticket) if (exists) { def JiraTicketInfo j = new JiraTicketInfo() j.jiranumber = jiraticket From 8ce4442dd68c7e422a1f4c2abcb1657062293975 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Jul 2019 12:15:53 +0100 Subject: [PATCH 1036/1971] Handle Jira ticket redirects - as a result of a jira ticket being moved to another project --- differences/dometahierarchy.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 9258da3..11b3733 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -197,8 +197,8 @@ def extractmerges(String line) { def jiraticketexists(String jiraticket) { def String URI = "${JIRA_URI}/browse/${jiraticket}" - def String URIforsummary = "${URI}?fields=summary" - def get = new URL(URIforsummary).openConnection(); + 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' ) @@ -210,7 +210,6 @@ def jiraticketexists(String jiraticket) { return [false, '', jiraticket] } else { def jsonresponse = new JsonSlurper().parseText(get.inputStream.getText('UTF-8')) - echo "Response: ${jsonresponse}" redirectedjiraticket = jsonresponse['key'] } return [true, URI, redirectedjiraticket] From 84ff4211df10e319bda246902649d5f99fe85b11 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 18 Jul 2019 11:22:06 +0100 Subject: [PATCH 1037/1971] Provide logging to debug why import of Print Server artifacts results in duff associated meta data --- meta/folder.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index f8c033b..b559458 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -571,6 +571,7 @@ class MetaInfo extends GISJsonSerialised { } def deserialiseJson(String filepath) { + script.echo("Deserialising JSON at file: ${filepath}" def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } @@ -617,6 +618,8 @@ class MetaInfo extends GISJsonSerialised { 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") } RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) From 8af57f80b93098579f7c2e4556c0c6eacd0da00c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 18 Jul 2019 11:22:06 +0100 Subject: [PATCH 1038/1971] Provide logging to debug why import of Print Server artifacts results in duff associated meta data --- meta/folder.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index f8c033b..b559458 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -571,6 +571,7 @@ class MetaInfo extends GISJsonSerialised { } def deserialiseJson(String filepath) { + script.echo("Deserialising JSON at file: ${filepath}" def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } @@ -617,6 +618,8 @@ class MetaInfo extends GISJsonSerialised { 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") } RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) From 4ea4d19eaa1227e15ea2d92622fb7da288bb0ed7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 18 Jul 2019 11:34:23 +0100 Subject: [PATCH 1039/1971] Provide logging to debug why import of Print Server artifacts results in duff associated meta data --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index b559458..ddc99c4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -571,7 +571,7 @@ class MetaInfo extends GISJsonSerialised { } def deserialiseJson(String filepath) { - script.echo("Deserialising JSON at file: ${filepath}" + script.echo("Deserialising JSON at file: ${filepath}") def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } From dbe2cdd5fdbef3e21bf5d7c0a97f69503576ea11 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 18 Jul 2019 11:34:23 +0100 Subject: [PATCH 1040/1971] Provide logging to debug why import of Print Server artifacts results in duff associated meta data --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index b559458..ddc99c4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -571,7 +571,7 @@ class MetaInfo extends GISJsonSerialised { } def deserialiseJson(String filepath) { - script.echo("Deserialising JSON at file: ${filepath}" + script.echo("Deserialising JSON at file: ${filepath}") def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } From dac329445c05a512a1502bc69808ca132ff28488 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 13:43:21 +0100 Subject: [PATCH 1041/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 738c04a..1898594 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -92,9 +92,10 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { } } -def getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { +def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") + bool exceptionduringcopyartifacts = false for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { def filterpath = artifactfilter if (buildinfo.offsetpath) { @@ -102,22 +103,30 @@ def getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, Strin } // Copy relevant artifacts to temp folder echo "Copying artifacts: ${filterpath} to ${tempfolder}" - copyArtifacts( - filter: filterpath, - projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname, - selector: [ - $class: 'ParameterizedBuildSelector', - parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" - ], - target: tempfolder - ) - // Move relevant artifacts from temp folder to release position - def originalrootdir = tempfolder + "/" + buildinfo.offsetpath - dir(originalrootdir) { - sh("mv * ${repofolder}") + 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()}" + exceptionduringcopyartifacts = true + summaryappend("Does not exist: ${artifactfilter}," + } else { + // Move relevant artifacts from temp folder to release position + def originalrootdir = tempfolder + "/" + buildinfo.offsetpath + dir(originalrootdir) { + sh("mv * ${repofolder}") + } } summaryappend("${artifactfilter},") } + return exceptionduringcopyartifacts } def releasegitadd() { @@ -357,9 +366,9 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo) - getcomponentartifacts(toplevelbuildmeta, buildinfo, uniquefolderforrepo, uniquefoldertemp) - - gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) + if (getcomponentartifacts(toplevelbuildmeta, buildinfo, uniquefolderforrepo, uniquefoldertemp)) { + gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) + } summaryappend("\n") } From aaba6bf78ef17b1c84d33490611bb17f4d9ba26a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 13:43:21 +0100 Subject: [PATCH 1042/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 738c04a..1898594 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -92,9 +92,10 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { } } -def getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { +def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") + bool exceptionduringcopyartifacts = false for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { def filterpath = artifactfilter if (buildinfo.offsetpath) { @@ -102,22 +103,30 @@ def getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, Strin } // Copy relevant artifacts to temp folder echo "Copying artifacts: ${filterpath} to ${tempfolder}" - copyArtifacts( - filter: filterpath, - projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname, - selector: [ - $class: 'ParameterizedBuildSelector', - parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" - ], - target: tempfolder - ) - // Move relevant artifacts from temp folder to release position - def originalrootdir = tempfolder + "/" + buildinfo.offsetpath - dir(originalrootdir) { - sh("mv * ${repofolder}") + 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()}" + exceptionduringcopyartifacts = true + summaryappend("Does not exist: ${artifactfilter}," + } else { + // Move relevant artifacts from temp folder to release position + def originalrootdir = tempfolder + "/" + buildinfo.offsetpath + dir(originalrootdir) { + sh("mv * ${repofolder}") + } } summaryappend("${artifactfilter},") } + return exceptionduringcopyartifacts } def releasegitadd() { @@ -357,9 +366,9 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo) - getcomponentartifacts(toplevelbuildmeta, buildinfo, uniquefolderforrepo, uniquefoldertemp) - - gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) + if (getcomponentartifacts(toplevelbuildmeta, buildinfo, uniquefolderforrepo, uniquefoldertemp)) { + gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush) + } summaryappend("\n") } From 32952f0677b254f66df6ec98a6ef2c5b28796ffe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 13:51:29 +0100 Subject: [PATCH 1043/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 1898594..10fc165 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -117,7 +117,8 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" exceptionduringcopyartifacts = true summaryappend("Does not exist: ${artifactfilter}," - } else { + } + if (!exceptionduringcopyartifacts) { // Move relevant artifacts from temp folder to release position def originalrootdir = tempfolder + "/" + buildinfo.offsetpath dir(originalrootdir) { From 31012ff5189f729a1f6c9b349ff5fc4aa0f61c13 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 13:51:29 +0100 Subject: [PATCH 1044/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 1898594..10fc165 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -117,7 +117,8 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" exceptionduringcopyartifacts = true summaryappend("Does not exist: ${artifactfilter}," - } else { + } + if (!exceptionduringcopyartifacts) { // Move relevant artifacts from temp folder to release position def originalrootdir = tempfolder + "/" + buildinfo.offsetpath dir(originalrootdir) { From 152eb536a4ef826e5c183713ca29fcb5a940ccce Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 13:53:31 +0100 Subject: [PATCH 1045/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 10fc165..c1c4277 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -116,7 +116,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } catch (Exception e) { echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" exceptionduringcopyartifacts = true - summaryappend("Does not exist: ${artifactfilter}," + summaryappend("Does not exist: ${artifactfilter},") } if (!exceptionduringcopyartifacts) { // Move relevant artifacts from temp folder to release position From 6539223840f6c7c0a0ec7bb2f3f8977760515a3a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 13:53:31 +0100 Subject: [PATCH 1046/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 10fc165..c1c4277 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -116,7 +116,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } catch (Exception e) { echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" exceptionduringcopyartifacts = true - summaryappend("Does not exist: ${artifactfilter}," + summaryappend("Does not exist: ${artifactfilter},") } if (!exceptionduringcopyartifacts) { // Move relevant artifacts from temp folder to release position From d52f4538de6630627a60b4106f9b4b2a92ede79e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 14:09:53 +0100 Subject: [PATCH 1047/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index c1c4277..0e7809e 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -95,7 +95,7 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") - bool exceptionduringcopyartifacts = false + boolean exceptionduringcopyartifacts = false for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { def filterpath = artifactfilter if (buildinfo.offsetpath) { @@ -116,7 +116,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } catch (Exception e) { echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" exceptionduringcopyartifacts = true - summaryappend("Does not exist: ${artifactfilter},") + summaryappend("Does not exist:") } if (!exceptionduringcopyartifacts) { // Move relevant artifacts from temp folder to release position From 93b2b46cd0c2a03fb0dbbd7311fdaa56c0facfdd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 14:09:53 +0100 Subject: [PATCH 1048/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index c1c4277..0e7809e 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -95,7 +95,7 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") - bool exceptionduringcopyartifacts = false + boolean exceptionduringcopyartifacts = false for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { def filterpath = artifactfilter if (buildinfo.offsetpath) { @@ -116,7 +116,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } catch (Exception e) { echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" exceptionduringcopyartifacts = true - summaryappend("Does not exist: ${artifactfilter},") + summaryappend("Does not exist:") } if (!exceptionduringcopyartifacts) { // Move relevant artifacts from temp folder to release position From bf72927c93ee67dba6c2871de449ab99f2503931 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 14:33:01 +0100 Subject: [PATCH 1049/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 0e7809e..1b21bcf 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -95,7 +95,7 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") - boolean exceptionduringcopyartifacts = false + def boolean result = true for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { def filterpath = artifactfilter if (buildinfo.offsetpath) { @@ -115,10 +115,10 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde ) } catch (Exception e) { echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" - exceptionduringcopyartifacts = true + result = false summaryappend("Does not exist:") } - if (!exceptionduringcopyartifacts) { + if (result) { // Move relevant artifacts from temp folder to release position def originalrootdir = tempfolder + "/" + buildinfo.offsetpath dir(originalrootdir) { @@ -127,7 +127,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } summaryappend("${artifactfilter},") } - return exceptionduringcopyartifacts + return result } def releasegitadd() { From e9ce58fc62c3201c0186d528c66e077ce193c4c4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Jul 2019 14:33:01 +0100 Subject: [PATCH 1050/1971] Don't release a component if it is not available in the build job's artifacts --- release/do.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 0e7809e..1b21bcf 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -95,7 +95,7 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) { // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") - boolean exceptionduringcopyartifacts = false + def boolean result = true for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { def filterpath = artifactfilter if (buildinfo.offsetpath) { @@ -115,10 +115,10 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde ) } catch (Exception e) { echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}" - exceptionduringcopyartifacts = true + result = false summaryappend("Does not exist:") } - if (!exceptionduringcopyartifacts) { + if (result) { // Move relevant artifacts from temp folder to release position def originalrootdir = tempfolder + "/" + buildinfo.offsetpath dir(originalrootdir) { @@ -127,7 +127,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } summaryappend("${artifactfilter},") } - return exceptionduringcopyartifacts + return result } def releasegitadd() { From b6528264be819a05a38b482bbc10bc68d7c22a48 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 25 Jul 2019 17:21:18 +0100 Subject: [PATCH 1051/1971] GIS-1621 - Import print server source such that it is registered in the meta data --- configuration/configuration.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 1864ba9..b8c0b47 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -8,8 +8,10 @@ def registerPipelineScriptConfiguration(meta) { registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) } -def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) { +def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') { + def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) } From 6b7eb941a4597f843e56529fe13122f4052bbea6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 30 Jul 2019 22:48:18 +0100 Subject: [PATCH 1052/1971] GIS-1621 - Allow installer builder handle a list of artifact keys or a single string --- install/installhelper.groovy | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index eebbd34..0d1863e 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -28,11 +28,16 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { - def artifactKey = installerDetails.get(installer)[1] - (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) - if (artifactFetched.get(artifactKey) == null) { - def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy) - artifactFetched.put(artifactKey, importmeta) + def artifactKeys = installerDetails.get(installer)[1] + if (obj instanceof java.lang.Integer) { + artifactKeys = [ artifactKeys ] + } + for (artifactKey in artifactKeys) { + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + if (artifactFetched.get(artifactKey) == null) { + def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy) + artifactFetched.put(artifactKey, importmeta) + } } } return artifactFetched From 09e3bfcd0cf62bc58660694335997fee8a9fc6a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 31 Jul 2019 08:03:54 +0100 Subject: [PATCH 1053/1971] GIS-1621 - Allow installer builder handle a list of artifact keys or a single string --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 0d1863e..75ba5d6 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -29,7 +29,7 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { def artifactKeys = installerDetails.get(installer)[1] - if (obj instanceof java.lang.Integer) { + if (artifactKeys instanceof java.lang.String) { artifactKeys = [ artifactKeys ] } for (artifactKey in artifactKeys) { From e7b86d95226095c5f2f601b6e08a6710705aa942 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Aug 2019 08:55:18 +0100 Subject: [PATCH 1054/1971] Perform a shallow clone check on repos being used to generate version numbers --- versioncontrol/git.groovy | 15 +++++++++++++++ versionnumbering/generate.groovy | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 3ea97ec..0e27faf 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -4,6 +4,21 @@ 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: Change count: ${isshallowclone}" + } + return isshallowclone +} + String getGitInfo(String workingSetRootPath) { dir(workingSetRootPath) { return clh.getCommandOutput('git rev-parse HEAD') diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index f4f1bdc..2e4f60d 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -1,4 +1,5 @@ - +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + def int maxversionnumber() { def int MAXVERSIONNUMBER = 65535 return MAXVERSIONNUMBER @@ -15,6 +16,12 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { 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()) { From b6aa653aeb590a37e2766b89cfc0e08106dee7eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Aug 2019 08:57:53 +0100 Subject: [PATCH 1055/1971] Perform a shallow clone check on repos being used to generate version numbers --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 0e27faf..bb7c0ce 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -14,7 +14,7 @@ def boolean isShallowClonedRepo(String gitrootpath) { else { isshallowclone = bat(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() } - echo "Repo at ${gitrootpath} is shallow cloned: Change count: ${isshallowclone}" + echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" } return isshallowclone } From daad8d0118f20c1cef4cf98c52cb3eec0ce8b400 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 9 Aug 2019 13:04:29 +0100 Subject: [PATCH 1056/1971] GIS-7717 GIS-7718 - Select the host dependent certificate --- install/installhelper.groovy | 12 ++++++++++++ textutils/subst.groovy | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 textutils/subst.groovy diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 75ba5d6..6fcdc6c 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -97,4 +97,16 @@ def checkISMfile(String ISMfile) { } } +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/textutils/subst.groovy b/textutils/subst.groovy new file mode 100644 index 0000000..aae44c6 --- /dev/null +++ b/textutils/subst.groovy @@ -0,0 +1,8 @@ + +def substitute(String filepath, String pattern, String subst) { + fileText = readFile(filepath) + def converted = fileText.replaceAll(pattern, subst) + writeFile(file: filepath, text: converted +} + +return this; \ No newline at end of file From 3cbc5bbf9337fd9ed25e928a8e298712a149bb1a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 9 Aug 2019 13:14:02 +0100 Subject: [PATCH 1057/1971] GIS-7717 GIS-7718 - Select the host dependent certificate --- textutils/subst.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textutils/subst.groovy b/textutils/subst.groovy index aae44c6..ea1678c 100644 --- a/textutils/subst.groovy +++ b/textutils/subst.groovy @@ -2,7 +2,7 @@ def substitute(String filepath, String pattern, String subst) { fileText = readFile(filepath) def converted = fileText.replaceAll(pattern, subst) - writeFile(file: filepath, text: converted + writeFile(file: filepath, text: converted) } return this; \ No newline at end of file From dad17a4f5a0016a5211858f84c9b3b39bfde8be5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 9 Aug 2019 14:52:51 +0100 Subject: [PATCH 1058/1971] GIS-7717 GIS-7718 - Text substitution correction --- textutils/subst.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/textutils/subst.groovy b/textutils/subst.groovy index ea1678c..055a269 100644 --- a/textutils/subst.groovy +++ b/textutils/subst.groovy @@ -1,8 +1,8 @@ def substitute(String filepath, String pattern, String subst) { - fileText = readFile(filepath) + fileText = readFile(file: filepath, encoding: 'UTF-8') def converted = fileText.replaceAll(pattern, subst) - writeFile(file: filepath, text: converted) + writeFile(file: filepath, text: converted, encoding: 'UTF-8') } return this; \ No newline at end of file From f0ef516b8e5383d047524bff65c0e6c6067eaeda Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:12:50 +0100 Subject: [PATCH 1059/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 27 +++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 302b4f8..e93ed4b 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -54,7 +54,7 @@ def doCheck(checkpathlist, build_variant = "") { return result } -def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { +def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { def result = 0 def destFolder = "" def srcFile = "" @@ -71,9 +71,12 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } else { echo "No build variant" - destFolder = "${exportfolder}/${project}" + destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + if (partdest) { + destFolder += "/" + partdest + } } dir (destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" @@ -146,7 +149,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] if (variantstobuild) { toBuildUntrimmed = variantstobuild.split(',') @@ -162,32 +165,26 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo + (build, project, variants, exportpathlist, destpart) = appInfo if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" - } - else { - buildtype = "-build" - } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" timeout(time: 10, unit: 'MINUTES') { if (isUnix()) { sh """ echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" """ } } @@ -195,7 +192,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, "", build_variant) + result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." } @@ -214,7 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - result = doExport(exportfolder, exportpathlist, project) + result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } From 9858ef75a61da7303b2cc60e476c9782c7c78f80 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:12:50 +0100 Subject: [PATCH 1060/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 27 +++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 302b4f8..e93ed4b 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -54,7 +54,7 @@ def doCheck(checkpathlist, build_variant = "") { return result } -def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { +def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { def result = 0 def destFolder = "" def srcFile = "" @@ -71,9 +71,12 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } else { echo "No build variant" - destFolder = "${exportfolder}/${project}" + destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + if (partdest) { + destFolder += "/" + partdest + } } dir (destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" @@ -146,7 +149,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] if (variantstobuild) { toBuildUntrimmed = variantstobuild.split(',') @@ -162,32 +165,26 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo + (build, project, variants, exportpathlist, destpart) = appInfo if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" - } - else { - buildtype = "-build" - } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" timeout(time: 10, unit: 'MINUTES') { if (isUnix()) { sh """ echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" """ } } @@ -195,7 +192,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, "", build_variant) + result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." } @@ -214,7 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - result = doExport(exportfolder, exportpathlist, project) + result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } From 17ddcb8404e77127c2dae4cb22e327ecf622b955 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:38:21 +0100 Subject: [PATCH 1061/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e93ed4b..bb79b36 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -79,10 +79,11 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } } dir (destFolder) { - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ - cp -r -v "${srcFileExpanded}" "${destFolder}" + cp -r -v "${srcFileExpanded}" "${destFolderExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true @@ -93,7 +94,7 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } else { result = bat( script: """ - copy "${srcFileExpanded}" "${destFolder}" + copy "${srcFileExpanded}" "${destFolderExpanded}" if errorlevel 1 EXIT /b 1 """, returnStatus: true @@ -209,12 +210,20 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } } } } From 231f87a98d58b1267978e1c14581e32b2cc0dc96 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:38:21 +0100 Subject: [PATCH 1062/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e93ed4b..bb79b36 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -79,10 +79,11 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } } dir (destFolder) { - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ - cp -r -v "${srcFileExpanded}" "${destFolder}" + cp -r -v "${srcFileExpanded}" "${destFolderExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true @@ -93,7 +94,7 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } else { result = bat( script: """ - copy "${srcFileExpanded}" "${destFolder}" + copy "${srcFileExpanded}" "${destFolderExpanded}" if errorlevel 1 EXIT /b 1 """, returnStatus: true @@ -209,12 +210,20 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } } } } From d123e7f152509ce599b8b353b9a431186ffd7d51 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:49:24 +0100 Subject: [PATCH 1063/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index bb79b36..9ebe541 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -78,8 +78,8 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { destFolder += "/" + partdest } } - dir (destFolder) { - def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + dir (destFolderExpanded) { echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ From 08f6b9b0d9b93d3d267e7862122f7657cfed9732 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:49:24 +0100 Subject: [PATCH 1064/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index bb79b36..9ebe541 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -78,8 +78,8 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { destFolder += "/" + partdest } } - dir (destFolder) { - def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + dir (destFolderExpanded) { echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ From 36c28665e08be410e640d07bbce2d3ddb1ea7839 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:05:02 +0100 Subject: [PATCH 1065/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 9ebe541..b3e25bd 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -62,18 +62,16 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { - echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - destFolder = "${exportfolder}/${build_variant}" srcFile = "${WORKSPACE}/${exportpath}" srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" - destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + destFolder = "${exportfolder}" if (partdest) { destFolder += "/" + partdest } @@ -165,7 +163,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } - for (appInfo in apps ) { + for (appInfo in apps) { (build, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { From 63c4ae0b608be0febc86dbfb5f9f998bbf51d345 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:05:02 +0100 Subject: [PATCH 1066/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 9ebe541..b3e25bd 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -62,18 +62,16 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { - echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - destFolder = "${exportfolder}/${build_variant}" srcFile = "${WORKSPACE}/${exportpath}" srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" - destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + destFolder = "${exportfolder}" if (partdest) { destFolder += "/" + partdest } @@ -165,7 +163,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } - for (appInfo in apps ) { + for (appInfo in apps) { (build, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { From 3c7deff68c6fe5bd2adb87cfdab8d4c6a924985b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:20:48 +0100 Subject: [PATCH 1067/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 34 ++++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b3e25bd..721a024 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, project, variants, exportpathlist, destpart) = appInfo + (build, export, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,9 +191,11 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } else { @@ -208,17 +210,19 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } } From c6eade9db243490c5a21a0d6d99b9187a3cb40a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:20:48 +0100 Subject: [PATCH 1068/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 34 ++++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b3e25bd..721a024 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, project, variants, exportpathlist, destpart) = appInfo + (build, export, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,9 +191,11 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } else { @@ -208,17 +210,19 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } } From 0ae452e1ba613b9ee09aff2d88653902ad701b52 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:43:26 +0100 Subject: [PATCH 1069/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 721a024..77124d7 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, export, project, variants, exportpathlist, destpart) = appInfo + (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,7 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - if (export) { + if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." @@ -210,7 +210,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (export) { + if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { From 8307a878e8590d0a662e5d0a564427c79b93ac9b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:43:26 +0100 Subject: [PATCH 1070/1971] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 721a024..77124d7 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, export, project, variants, exportpathlist, destpart) = appInfo + (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,7 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - if (export) { + if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." @@ -210,7 +210,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (export) { + if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { From 54e5d7ff081b06795b2578ffb2a678aae63529c5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:52:24 +0100 Subject: [PATCH 1071/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 77124d7..e3d2ffb 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -191,6 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } + echo "Doing export: ${doexport}" if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { @@ -202,7 +203,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou echo "Not building ${build_variant} variant of project: ${project}" } } catch (Exception e) { - echo "Build failed - Waiting for a while" + echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') error "Build failed..." } @@ -210,6 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { + echo "Doing export: ${doexport}" if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) @@ -231,7 +233,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } catch (Exception e) { // doKillLeftovers() - error "Build failed - Killing leftovers" + error "Exception: ${e.message()}\nBuild failed - Killing leftovers" } } } From 69f2b9031ad426bcccb3acc85f2845b2055291a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:52:24 +0100 Subject: [PATCH 1072/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 77124d7..e3d2ffb 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -191,6 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } + echo "Doing export: ${doexport}" if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { @@ -202,7 +203,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou echo "Not building ${build_variant} variant of project: ${project}" } } catch (Exception e) { - echo "Build failed - Waiting for a while" + echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') error "Build failed..." } @@ -210,6 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { + echo "Doing export: ${doexport}" if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) @@ -231,7 +233,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } catch (Exception e) { // doKillLeftovers() - error "Build failed - Killing leftovers" + error "Exception: ${e.message()}\nBuild failed - Killing leftovers" } } } From fbd1b756987f7533d70714c9174ea0aa1aad6da8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:32:08 +0100 Subject: [PATCH 1073/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 133 +++++++++++--------- 1 file changed, 71 insertions(+), 62 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e3d2ffb..b5b5401 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,6 +147,74 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } +def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing build and export project: ${project} : ${doexport}" + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" + """ + } + } + result = doCheck(exportpathlist, build_variant) + if (result != 0) { + error "Failed to check files...." + } + echo "Doing export: ${doexport}" + if (doexport) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + else { + echo "Not building ${build_variant} variant of project: ${project}" + } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } + } + } +} + +def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing export only project: ${project} : ${doexport}" + if (doexport) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + } + } +} + // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] @@ -166,74 +234,15 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" - """ - } - } - result = doCheck(exportpathlist, build_variant) - if (result != 0) { - error "Failed to check files...." - } - echo "Doing export: ${doexport}" - if (doexport) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - else { - echo "Not building ${build_variant} variant of project: ${project}" - } - } catch (Exception e) { - echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } - } - } + doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } else { - echo "Doing export: ${doexport}" - if (doexport) { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - } - } + doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } } catch (Exception e) { // doKillLeftovers() - error "Exception: ${e.message()}\nBuild failed - Killing leftovers" + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" } } } From 9eec8e8822a25af77b13b533943d337858eec0e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:32:08 +0100 Subject: [PATCH 1074/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 133 +++++++++++--------- 1 file changed, 71 insertions(+), 62 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e3d2ffb..b5b5401 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,6 +147,74 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } +def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing build and export project: ${project} : ${doexport}" + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" + """ + } + } + result = doCheck(exportpathlist, build_variant) + if (result != 0) { + error "Failed to check files...." + } + echo "Doing export: ${doexport}" + if (doexport) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + else { + echo "Not building ${build_variant} variant of project: ${project}" + } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } + } + } +} + +def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing export only project: ${project} : ${doexport}" + if (doexport) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + } + } +} + // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] @@ -166,74 +234,15 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" - """ - } - } - result = doCheck(exportpathlist, build_variant) - if (result != 0) { - error "Failed to check files...." - } - echo "Doing export: ${doexport}" - if (doexport) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - else { - echo "Not building ${build_variant} variant of project: ${project}" - } - } catch (Exception e) { - echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } - } - } + doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } else { - echo "Doing export: ${doexport}" - if (doexport) { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - } - } + doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } } catch (Exception e) { // doKillLeftovers() - error "Exception: ${e.message()}\nBuild failed - Killing leftovers" + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" } } } From 5d081f74cfbe86f38c6e401723201c76277e9bcf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:39:32 +0100 Subject: [PATCH 1075/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b5b5401..0de368c 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -234,7 +234,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) + doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) } else { doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) From 3702a176238222d7b7faf30b55ae53a12fb34a0a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:39:32 +0100 Subject: [PATCH 1076/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b5b5401..0de368c 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -234,7 +234,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) + doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) } else { doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) From 382a48c08abea0c5d108aebbfbbf335478071130 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:46:24 +0100 Subject: [PATCH 1077/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 0de368c..3070e4e 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { +// try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } - } catch (Exception e) { - echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } +// } catch (Exception e) { +// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" +// sleep(time: 4, unit: 'SECONDS') +// error "Build failed..." +// } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - try { +// try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -240,10 +240,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } - } catch (Exception e) { - // doKillLeftovers() - error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" - } +// } catch (Exception e) { +// // doKillLeftovers() +// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" +// } } } From 71b5f14aebcd7f1d151ec65ec412ce045b8b45a4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:46:24 +0100 Subject: [PATCH 1078/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 0de368c..3070e4e 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { +// try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } - } catch (Exception e) { - echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } +// } catch (Exception e) { +// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" +// sleep(time: 4, unit: 'SECONDS') +// error "Build failed..." +// } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - try { +// try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -240,10 +240,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } - } catch (Exception e) { - // doKillLeftovers() - error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" - } +// } catch (Exception e) { +// // doKillLeftovers() +// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" +// } } } From 709ab6b27699593dc8507e3bbca6fc17fb27d849 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:59:14 +0100 Subject: [PATCH 1079/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 3070e4e..779c235 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -194,7 +194,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 } } -def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doExportOnlyProject(String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing export only project: ${project} : ${doexport}" if (doexport) { if (!variants) { @@ -232,6 +232,8 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { + def Boolean build + def Boolean doexport (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) From 26ccb7c61103daae6805b9054ef0bb5f6136f8f9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:59:14 +0100 Subject: [PATCH 1080/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 3070e4e..779c235 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -194,7 +194,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 } } -def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doExportOnlyProject(String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing export only project: ${project} : ${doexport}" if (doexport) { if (!variants) { @@ -232,6 +232,8 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { + def Boolean build + def Boolean doexport (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) From 5d2d494d20952d487b5795e848812ba9912a8da5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 18:37:16 +0100 Subject: [PATCH 1081/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 779c235..9ab8df3 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) -// try { + try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } -// } catch (Exception e) { -// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" -// sleep(time: 4, unit: 'SECONDS') -// error "Build failed..." -// } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { -// try { + try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -242,10 +242,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } -// } catch (Exception e) { -// // doKillLeftovers() -// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" -// } + } catch (Exception e) { + // doKillLeftovers() + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" + } } } From 82fc5b6e05e9932527420aa318628f4e2a83a5f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 18:37:16 +0100 Subject: [PATCH 1082/1971] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 779c235..9ab8df3 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) -// try { + try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } -// } catch (Exception e) { -// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" -// sleep(time: 4, unit: 'SECONDS') -// error "Build failed..." -// } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { -// try { + try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -242,10 +242,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } -// } catch (Exception e) { -// // doKillLeftovers() -// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" -// } + } catch (Exception e) { + // doKillLeftovers() + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" + } } } From 9a7e394fa2517653ff1f7b4431c55d6e49634465 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:24:14 +0100 Subject: [PATCH 1083/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 packaging/debian.groovy diff --git a/packaging/debian.groovy b/packaging/debian.groovy new file mode 100644 index 0000000..d55b6a9 --- /dev/null +++ b/packaging/debian.groovy @@ -0,0 +1,49 @@ +class DebRootDefinitions { + String PACKAGE_PREFIX + String PACKAGE_FOLDER_NAME + String PACKAGE_NAME + + String DEBPATH + + String ETC + String GIS_OPT_BIN + String GIS_OPT_LIB + String GIS_OPT_SCRIPTS_APP + String GIS_OPT_SCRIPTS_EL + String GIS_OPT_WWW + String GIS_OPT_OTHER + String GIS_OPT_LOGIC + String GIS_OPT_PRINTHEAD + + String USR_BIN + String USR_LIB_ARCH + String LIB_FIRMWARE + String HTTP_DEV_DIV + String LIB_SYSTEMD + + DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + PACKAGE_PREFIX = packageprefix + PACKAGE_FOLDER_NAME = packageprefix + buildstamp + PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + + DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + + ETC = "${DEBPATH}/etc" + GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + + USR_BIN = "${DEBPATH}/usr/bin" + USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + } +} + +return this; \ No newline at end of file From a0f4bcac3f89c19e0d2744fd8816dc819fc429c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:24:14 +0100 Subject: [PATCH 1084/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 packaging/debian.groovy diff --git a/packaging/debian.groovy b/packaging/debian.groovy new file mode 100644 index 0000000..d55b6a9 --- /dev/null +++ b/packaging/debian.groovy @@ -0,0 +1,49 @@ +class DebRootDefinitions { + String PACKAGE_PREFIX + String PACKAGE_FOLDER_NAME + String PACKAGE_NAME + + String DEBPATH + + String ETC + String GIS_OPT_BIN + String GIS_OPT_LIB + String GIS_OPT_SCRIPTS_APP + String GIS_OPT_SCRIPTS_EL + String GIS_OPT_WWW + String GIS_OPT_OTHER + String GIS_OPT_LOGIC + String GIS_OPT_PRINTHEAD + + String USR_BIN + String USR_LIB_ARCH + String LIB_FIRMWARE + String HTTP_DEV_DIV + String LIB_SYSTEMD + + DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + PACKAGE_PREFIX = packageprefix + PACKAGE_FOLDER_NAME = packageprefix + buildstamp + PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + + DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + + ETC = "${DEBPATH}/etc" + GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + + USR_BIN = "${DEBPATH}/usr/bin" + USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + } +} + +return this; \ No newline at end of file From 703c4930db6588ccca56d94bb8f5b74efe7e86e6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:39:05 +0100 Subject: [PATCH 1085/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index d55b6a9..127173e 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,4 @@ -class DebRootDefinitions { +class DebRootDefinition { String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -21,7 +21,7 @@ class DebRootDefinitions { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" @@ -46,4 +46,8 @@ class DebRootDefinitions { } } +def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packageprefix, buildstamp) +} + return this; \ No newline at end of file From 0b7491ef4913a06b16dcc8dd598857bda23b9fe2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:39:05 +0100 Subject: [PATCH 1086/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index d55b6a9..127173e 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,4 @@ -class DebRootDefinitions { +class DebRootDefinition { String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -21,7 +21,7 @@ class DebRootDefinitions { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" @@ -46,4 +46,8 @@ class DebRootDefinitions { } } +def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packageprefix, buildstamp) +} + return this; \ No newline at end of file From 5891f4ec02f54ab96bd42e809982cda6562a5290 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:47:37 +0100 Subject: [PATCH 1087/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 127173e..84ba090 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -3,6 +3,7 @@ class DebRootDefinition { String PACKAGE_FOLDER_NAME String PACKAGE_NAME + String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH String ETC @@ -26,6 +27,7 @@ class DebRootDefinition { PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" From 99bc0a33fc5d0e2e7a8130656a71c7622de381db Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:47:37 +0100 Subject: [PATCH 1088/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 127173e..84ba090 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -3,6 +3,7 @@ class DebRootDefinition { String PACKAGE_FOLDER_NAME String PACKAGE_NAME + String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH String ETC @@ -26,6 +27,7 @@ class DebRootDefinition { PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" From 93430a782e82af1e64ffd0bafc067cf4f0850efe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:59:08 +0100 Subject: [PATCH 1089/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 84ba090..9340180 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,5 @@ class DebRootDefinition { + String ROOTPATH String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -23,12 +24,13 @@ class DebRootDefinition { String LIB_SYSTEMD DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" - PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" - DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" + DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" From 3b5b2d11819ca02b472fc39fc27a55129a5a7e79 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:59:08 +0100 Subject: [PATCH 1090/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 84ba090..9340180 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,5 @@ class DebRootDefinition { + String ROOTPATH String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -23,12 +24,13 @@ class DebRootDefinition { String LIB_SYSTEMD DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" - PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" - DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" + DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" From 6df15e3bf2f60d7daf349426c423574c13dfff7f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 14:42:12 +0100 Subject: [PATCH 1091/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 9340180..a7de1f0 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -54,4 +54,30 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix, Strin return new DebRootDefinition(rootpath, packageprefix, buildstamp) } +def buildPackage(String packageout, DebRootDefinition packagedefs) { + sh """#!/bin/bash + # Exit if any command fails + set -e + + mkdir -v -p "${packagedefs.USR_BIN}" + mkdir -v -p "${packagedefs.USR_LIB_ARCH}" + mkdir -v -p "${packagedefs.LIB_FIRMWARE}" + + mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" + mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" + + cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/preinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/prerm" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postrm" + + mkdir -v -p "${packageout}" + dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + + dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + """ +} + return this; \ No newline at end of file From 6f37f6256364bc748d5de6e4096a9c748e30e7ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 14:42:12 +0100 Subject: [PATCH 1092/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 9340180..a7de1f0 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -54,4 +54,30 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix, Strin return new DebRootDefinition(rootpath, packageprefix, buildstamp) } +def buildPackage(String packageout, DebRootDefinition packagedefs) { + sh """#!/bin/bash + # Exit if any command fails + set -e + + mkdir -v -p "${packagedefs.USR_BIN}" + mkdir -v -p "${packagedefs.USR_LIB_ARCH}" + mkdir -v -p "${packagedefs.LIB_FIRMWARE}" + + mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" + mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" + + cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/preinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/prerm" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postrm" + + mkdir -v -p "${packageout}" + dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + + dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + """ +} + return this; \ No newline at end of file From 99efb640c1e6aea041684c53cff28b3dea1df4e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 18:08:54 +0100 Subject: [PATCH 1093/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index a7de1f0..25d06a2 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -12,6 +12,7 @@ class DebRootDefinition { String GIS_OPT_LIB String GIS_OPT_SCRIPTS_APP String GIS_OPT_SCRIPTS_EL + String GIS_OPT_SCRIPTS_CONTROL String GIS_OPT_WWW String GIS_OPT_OTHER String GIS_OPT_LOGIC @@ -37,6 +38,7 @@ class DebRootDefinition { GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" From b2cbec1d7cf8faf0b920b122662037e0c021639b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 18:08:54 +0100 Subject: [PATCH 1094/1971] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index a7de1f0..25d06a2 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -12,6 +12,7 @@ class DebRootDefinition { String GIS_OPT_LIB String GIS_OPT_SCRIPTS_APP String GIS_OPT_SCRIPTS_EL + String GIS_OPT_SCRIPTS_CONTROL String GIS_OPT_WWW String GIS_OPT_OTHER String GIS_OPT_LOGIC @@ -37,6 +38,7 @@ class DebRootDefinition { GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" From e09b9e780eb477cfb1a08d5ae504d540a6f4d2ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 18:53:12 +0100 Subject: [PATCH 1095/1971] GIS-1621 - Do static analysis --- staticanalysis/ccm.groovy | 110 ++++++++++++++++++++++++++ staticanalysis/cpd.groovy | 139 +++++++++++++++++++++++++++++++++ staticanalysis/cppcheck.groovy | 104 ++++++++++++++++++++++++ 3 files changed, 353 insertions(+) create mode 100644 staticanalysis/ccm.groovy create mode 100644 staticanalysis/cpd.groovy create mode 100644 staticanalysis/cppcheck.groovy diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy new file mode 100644 index 0000000..290c897 --- /dev/null +++ b/staticanalysis/ccm.groovy @@ -0,0 +1,110 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + CCMURL = 'git@hydra:tools/ccm.git' + CCMBRANCH = 'origin/master' + CCMDIR = "${WORKSPACE}/ccm" + configurationhelper.gitCheckoutAndRegister(meta, 'ccm', CCMURL, CCMBRANCH, CCMDIR) + CCM = "${CCMDIR}/bin/CCM.exe" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEREVISION = "${SOURCE_REVISION}" + SOURCEDIR = "${WORKSPACE}/source" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = "${SOURCEDIR}" + env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}" + } + } + } + stage("Clean exports") { + steps { + script { + STATICANALYSIS = 'staticanalysis' + cleanfolders = [ + STATICANALYSIS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Static analysis') { + steps { + script { + def CCMOLDER = "${STATICANALYSIS}/ccm" + dir(CCMOLDER) { + bat """ + "${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml + """ + } + recordIssues(tools: [ + ccm(pattern: "**/ccm.xml", reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy new file mode 100644 index 0000000..18cdb43 --- /dev/null +++ b/staticanalysis/cpd.groovy @@ -0,0 +1,139 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + if (isUnix()) { + PYTHONBRANCH = 'origin/3.6.3_linux' + } else { + PYTHONBRANCH = 'origin/3.6.3_windows' + } + PYTHONDIR = "${WORKSPACE}/python" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + + JAVAURL = 'git@hydra:tools/openjdk.git' + if (isUnix()) { + JAVABRANCH = 'origin/openjdk-11.0.2_linux-x64_bin' + } else { + JAVABRANCH = 'origin/openjdk-11.0.2_windows-x64_bin' + } + JAVADIR = "${WORKSPACE}/java" + configurationhelper.gitCheckoutAndRegister(meta, 'java', JAVAURL, JAVABRANCH, JAVADIR) + JAVA = "${JAVADIR}/ver/bin" + if (isUnix()) { + env.PATH = JAVA + ':' + PATH + } else { + env.PATH = JAVA + ';' + PATH + } + + PPDURL = 'git@hydra:tools/pmd.git' + PPDBRANCH = 'origin/master' + PPDDIR = "${WORKSPACE}/ppd" + configurationhelper.gitCheckoutAndRegister(meta, 'ppd', PPDURL, PPDBRANCH, PPDDIR) + PPD = "${PPDDIR}/bin" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEREVISION = "${SOURCE_REVISION}" + SOURCEDIR = "${WORKSPACE}/source" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = "${SOURCEDIR}" + env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}" + } + } + } + stage("Clean exports") { + steps { + script { + STATICANALYSIS = 'staticanalysis' + cleanfolders = [ + STATICANALYSIS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Static analysis') { + steps { + script { + def PPDFOLDER = "${STATICANALYSIS}/ppd" + dir(PPDFOLDER) { + if (isUnix()) { + sh """#!/bin/bash + set -e + + export PMD_JAVA_OPTS=-Xmx16384m + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml + """ + } else { + bat """ + set PMD_JAVA_OPTS=-Xmx2048m + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml + """ + } + } + recordIssues(tools: [ + cpd(pattern: "**/cpd.xml", reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy new file mode 100644 index 0000000..b3b997e --- /dev/null +++ b/staticanalysis/cppcheck.groovy @@ -0,0 +1,104 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + PYTHONBRANCH = 'origin/3.6.3_windows' + PYTHONDIR = "${WORKSPACE}/python" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEREVISION = "${SOURCE_REVISION}" + SOURCEDIR = "${WORKSPACE}/source" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = "${SOURCEDIR}" + env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}" + } + } + } + stage("Clean exports") { + steps { + script { + STATICANALYSIS = 'staticanalysis' + cleanfolders = [ + STATICANALYSIS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER) + } + } + } + stage('Static analysis') { + steps { + script { + def CPPCHECKFOLDER = "${STATICANALYSIS}/cppcheck" + dir(CPPCHECKFOLDER) { + bat """ + "${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml + """ + } + recordIssues(tools: [ + cppCheck(pattern: "**/cppcheck.xml", reportEncoding: 'UTF-8'), + ]) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} From a87215229efa2b30d451217216c3d93fc8dcf534 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 19:43:30 +0100 Subject: [PATCH 1096/1971] Update static analysis --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 18cdb43..d1a227f 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -84,7 +84,7 @@ pipeline { dir(PPDFOLDER) { if (isUnix()) { sh """#!/bin/bash - set -e + set -xe export PMD_JAVA_OPTS=-Xmx16384m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml From 3ad05866a5c50d26e2b1c786bf19211d7b8ff230 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 19:50:44 +0100 Subject: [PATCH 1097/1971] Update static analysis --- staticanalysis/cpd.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index d1a227f..9277ca9 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -87,12 +87,12 @@ pipeline { set -xe export PMD_JAVA_OPTS=-Xmx16384m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnValidation false > cpd.xml """ } else { bat """ set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml > cpd.xml + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnValidation false > cpd.xml """ } } From 34fd570e60cda2b21df321f6dc8a60bde5581720 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 19:52:55 +0100 Subject: [PATCH 1098/1971] Update static analysis --- staticanalysis/cpd.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 9277ca9..b114ee8 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -87,12 +87,12 @@ pipeline { set -xe export PMD_JAVA_OPTS=-Xmx16384m - "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnValidation false > cpd.xml + "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml """ } else { bat """ set PMD_JAVA_OPTS=-Xmx2048m - "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnValidation false > cpd.xml + "${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml """ } } From d4aea83255d773ff9b59a8df08bc0b0ac9f1391f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 19:56:19 +0100 Subject: [PATCH 1099/1971] Update static analysis --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index b114ee8..4691eb4 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -84,7 +84,7 @@ pipeline { dir(PPDFOLDER) { if (isUnix()) { sh """#!/bin/bash - set -xe + set -e export PMD_JAVA_OPTS=-Xmx16384m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml From 0a198ebd1cf5e714338794c11b04702838e4cf98 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 08:33:35 +0100 Subject: [PATCH 1100/1971] Increase max mem that can be used for cpd --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 4691eb4..defca8a 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,7 +86,7 @@ pipeline { sh """#!/bin/bash set -e - export PMD_JAVA_OPTS=-Xmx16384m + export PMD_JAVA_OPTS=-Xmx49152m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml """ } else { From a8f357e51230763357a22b11939805b63f580ab3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 09:17:23 +0100 Subject: [PATCH 1101/1971] Add static analysis --- staticanalysis/cppcheck.groovy | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index b3b997e..18df1cb 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -57,9 +57,17 @@ pipeline { script { def CPPCHECKFOLDER = "${STATICANALYSIS}/cppcheck" dir(CPPCHECKFOLDER) { - bat """ - "${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'), From bb4f70629ba6bf7f3058d608a8fad358fefb2f4a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 09:19:50 +0100 Subject: [PATCH 1102/1971] Add static analysis --- staticanalysis/cppcheck.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 18df1cb..54b683a 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -57,6 +57,7 @@ pipeline { 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 From 24384288ed2784219716d0e6cb072be679a6214a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 09:21:39 +0100 Subject: [PATCH 1103/1971] Add static analysis --- staticanalysis/cppcheck.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 54b683a..59323c1 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -57,7 +57,7 @@ pipeline { script { def CPPCHECKFOLDER = "${STATICANALYSIS}/cppcheck" dir(CPPCHECKFOLDER) { - echo "Executing: "${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml" + echo "Executing: ${CPPCHECK} --xml --xml-version=2 ${SRC} 2> cppcheck.xml" if (isUnix()) { sh """#!/bin/bash set -e From b0a28652ef2ae8ed61ed660e8dc407707708f69b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 09:33:31 +0100 Subject: [PATCH 1104/1971] GIS-1621 - Update static analysis --- staticanalysis/ccm.groovy | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 290c897..aa697a6 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -63,9 +63,16 @@ pipeline { script { def CCMOLDER = "${STATICANALYSIS}/ccm" dir(CCMOLDER) { - bat """ - "${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml - """ + if (isUnix()) { + sh """#!/bin/bash + # 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'), From 80cbc7c97d7042937d7f2a10f63f711bc79fc951 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 09:52:21 +0100 Subject: [PATCH 1105/1971] Echo ccm command --- staticanalysis/ccm.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index aa697a6..66a75e4 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -63,6 +63,7 @@ pipeline { script { def CCMOLDER = "${STATICANALYSIS}/ccm" dir(CCMOLDER) { + echo "Executing: ${CCM} ${SRC} /xml /nummetrics=100 > ccm.xml" if (isUnix()) { sh """#!/bin/bash # Uses mono From 97e540f2c219587c0d0e68d818bfea93e29767c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 19:20:40 +0100 Subject: [PATCH 1106/1971] Up the amount of memory that cpd can use --- staticanalysis/cpd.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index defca8a..21b8a5e 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -86,7 +86,7 @@ pipeline { sh """#!/bin/bash set -e - export PMD_JAVA_OPTS=-Xmx49152m + export PMD_JAVA_OPTS=-Xmx65536m "${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml """ } else { From 7185c9f4ce98450db3400ecdd20bd373daac3f53 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 23 Aug 2019 21:51:00 +0100 Subject: [PATCH 1107/1971] Strip non C++ files before analysing --- staticanalysis/ccm.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 66a75e4..93e4711 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -66,6 +66,7 @@ pipeline { 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 """ From e3a3ef617673b14b47603a6b15baaa1895c5999a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 14:57:02 +0100 Subject: [PATCH 1108/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 109 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 publish/package.groovy diff --git a/publish/package.groovy b/publish/package.groovy new file mode 100644 index 0000000..3efe70b --- /dev/null +++ b/publish/package.groovy @@ -0,0 +1,109 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + if (isUnix()) { + PYTHONBRANCH = "origin/3.6.3_linux" + } + else { + PYTHONBRANCH = "origin/3.6.3_windows" + } + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + } + stage('Clean exports') { + steps { + script { + PACKAGEDEST = "${WORKSPACE}/package" + cleanfolders = [ + PACKAGEDEST, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Copying package artifacts') { + steps { + script { + packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + } + } + } + stage('Aptly environment') { + steps { + script { + echo "Aptly config file is ${APTLY_CONFIG_FILE}" + sh """!/#bin/bash + aptly config show + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + stage('Create repo - if not already there') { + steps { + script { + echo "Repo name is ${REPO_NAME}" + sh """!/#bin/bash + aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" + if [ \$? -ne 0 ]; then + echo "aptly repo ${REPO_NAME} does not exist; Creating it" + aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + fi + """ + } + } + } + stage('Create snapshot - if not already there') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """!/#bin/bash + # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + """ + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + From 653623282ec8dad33944edd51d1d3661decd9d63 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 14:57:02 +0100 Subject: [PATCH 1109/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 109 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 publish/package.groovy diff --git a/publish/package.groovy b/publish/package.groovy new file mode 100644 index 0000000..3efe70b --- /dev/null +++ b/publish/package.groovy @@ -0,0 +1,109 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + if (isUnix()) { + PYTHONBRANCH = "origin/3.6.3_linux" + } + else { + PYTHONBRANCH = "origin/3.6.3_windows" + } + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + } + stage('Clean exports') { + steps { + script { + PACKAGEDEST = "${WORKSPACE}/package" + cleanfolders = [ + PACKAGEDEST, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Copying package artifacts') { + steps { + script { + packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + } + } + } + stage('Aptly environment') { + steps { + script { + echo "Aptly config file is ${APTLY_CONFIG_FILE}" + sh """!/#bin/bash + aptly config show + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + stage('Create repo - if not already there') { + steps { + script { + echo "Repo name is ${REPO_NAME}" + sh """!/#bin/bash + aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" + if [ \$? -ne 0 ]; then + echo "aptly repo ${REPO_NAME} does not exist; Creating it" + aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + fi + """ + } + } + } + stage('Create snapshot - if not already there') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """!/#bin/bash + # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + """ + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + From 522ee178b12705242020547db45c139a455dd2a5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:10:03 +0100 Subject: [PATCH 1110/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/package.groovy b/publish/package.groovy index 3efe70b..da6791c 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -47,6 +47,7 @@ pipeline { stage('Copying package artifacts') { steps { script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) } } From 0d396b78b9a208804ca9cba33f92c80020ddb586 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:10:03 +0100 Subject: [PATCH 1111/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/package.groovy b/publish/package.groovy index 3efe70b..da6791c 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -47,6 +47,7 @@ pipeline { stage('Copying package artifacts') { steps { script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) } } From 47e4690e2d79e22f1cd8b8aa923f0f0cd9f7b249 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:11:54 +0100 Subject: [PATCH 1112/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index da6791c..bf48231 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -56,7 +56,7 @@ pipeline { steps { script { echo "Aptly config file is ${APTLY_CONFIG_FILE}" - sh """!/#bin/bash + sh """#!/bin/bash -v aptly config show if [ \$? -ne 0 ]; then exit 1; fi """ @@ -67,7 +67,7 @@ pipeline { steps { script { echo "Repo name is ${REPO_NAME}" - sh """!/#bin/bash + sh """#!/bin/bash -v aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" if [ \$? -ne 0 ]; then echo "aptly repo ${REPO_NAME} does not exist; Creating it" @@ -84,7 +84,7 @@ pipeline { echo "Snapshot name is ${SNAPSHOT_NAME}" FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" - sh """!/#bin/bash + sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" """ From fc780b39ac0e77a8b887906c9e9b11369ba7262e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:11:54 +0100 Subject: [PATCH 1113/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index da6791c..bf48231 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -56,7 +56,7 @@ pipeline { steps { script { echo "Aptly config file is ${APTLY_CONFIG_FILE}" - sh """!/#bin/bash + sh """#!/bin/bash -v aptly config show if [ \$? -ne 0 ]; then exit 1; fi """ @@ -67,7 +67,7 @@ pipeline { steps { script { echo "Repo name is ${REPO_NAME}" - sh """!/#bin/bash + sh """#!/bin/bash -v aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" if [ \$? -ne 0 ]; then echo "aptly repo ${REPO_NAME} does not exist; Creating it" @@ -84,7 +84,7 @@ pipeline { echo "Snapshot name is ${SNAPSHOT_NAME}" FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" - sh """!/#bin/bash + sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" """ From 22ab61265cae4656125c728ac38ffaefb1c748b1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:17:50 +0100 Subject: [PATCH 1114/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/package.groovy b/publish/package.groovy index bf48231..8626a61 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -87,6 +87,7 @@ pipeline { sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" """ } } From 11c4c7ab0e21a8530ca2fcf09a9cfb3fbc9c0426 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:17:50 +0100 Subject: [PATCH 1115/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/package.groovy b/publish/package.groovy index bf48231..8626a61 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -87,6 +87,7 @@ pipeline { sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" """ } } From e86106fb26690c70aa8d25a16ed10bb0af2c1fdb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:41:19 +0100 Subject: [PATCH 1116/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/publish/package.groovy b/publish/package.groovy index 8626a61..5fe46e8 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -49,6 +49,7 @@ pipeline { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + PACKAGE_FOLDER = "${PACKAGEDEST}/package" } } } @@ -78,6 +79,17 @@ pipeline { } } } + stage('Add/update package in snapshot') { + steps { + script { + echo "Package folder is ${PACKAGE_FOLDER}" + sh """#!/bin/bash -v + aptly snapshot -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } stage('Create snapshot - if not already there') { steps { script { @@ -86,8 +98,11 @@ pipeline { echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } From 9da4613bfca89e156ab90454c8b0e4af62a52e0f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:41:19 +0100 Subject: [PATCH 1117/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/publish/package.groovy b/publish/package.groovy index 8626a61..5fe46e8 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -49,6 +49,7 @@ pipeline { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + PACKAGE_FOLDER = "${PACKAGEDEST}/package" } } } @@ -78,6 +79,17 @@ pipeline { } } } + stage('Add/update package in snapshot') { + steps { + script { + echo "Package folder is ${PACKAGE_FOLDER}" + sh """#!/bin/bash -v + aptly snapshot -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } stage('Create snapshot - if not already there') { steps { script { @@ -86,8 +98,11 @@ pipeline { echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } From ff5f214124bbf2f1a38d1ca1340d06b4130703c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:42:28 +0100 Subject: [PATCH 1118/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 5fe46e8..253f22e 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly snapshot -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From acb477c98433989ddf77a6098b046276b34aa110 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:42:28 +0100 Subject: [PATCH 1119/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 5fe46e8..253f22e 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly snapshot -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 8a9f983b7bf05b2c3acbe0a1149c118228a9cc92 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:44:26 +0100 Subject: [PATCH 1120/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 253f22e..99a2bdf 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 691c3bb58eb4fc0e3647405688c48397e861c8f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:44:26 +0100 Subject: [PATCH 1121/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 253f22e..99a2bdf 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 387c3d08485020fc4fed16478fb77718180ec38e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:46:25 +0100 Subject: [PATCH 1122/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 99a2bdf..b3256a8 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 6684ef24f0fe98fee8b65fe9b0323c3f632ea271 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:46:25 +0100 Subject: [PATCH 1123/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 99a2bdf..b3256a8 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From d2a12d523e5b1aa3bddfe9f543088405f022a670 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:51:48 +0100 Subject: [PATCH 1124/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/publish/package.groovy b/publish/package.groovy index b3256a8..eac8553 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -86,6 +86,8 @@ pipeline { sh """#!/bin/bash -v aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi + aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } From e4b42daad4ba89c2704138c84b033eb35bc3d7c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:51:48 +0100 Subject: [PATCH 1125/1971] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/publish/package.groovy b/publish/package.groovy index b3256a8..eac8553 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -86,6 +86,8 @@ pipeline { sh """#!/bin/bash -v aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi + aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } From d5de03abb9e9e27ea59cf882e51e8fe26454d5c8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:22:15 +0100 Subject: [PATCH 1126/1971] HMBXR5601-827 - Publish package --- publish/package.groovy | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index eac8553..8e91143 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -92,7 +92,7 @@ pipeline { } } } - stage('Create snapshot - if not already there') { + stage('Create snapshot') { steps { script { echo "Snapshot name is ${SNAPSHOT_NAME}" @@ -109,6 +109,21 @@ pipeline { } } } + stage('Publish snapshot') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } } post { always { From 95c87fad2b6374d0aec64804a3f268a0ab6e89aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:22:15 +0100 Subject: [PATCH 1127/1971] HMBXR5601-827 - Publish package --- publish/package.groovy | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index eac8553..8e91143 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -92,7 +92,7 @@ pipeline { } } } - stage('Create snapshot - if not already there') { + stage('Create snapshot') { steps { script { echo "Snapshot name is ${SNAPSHOT_NAME}" @@ -109,6 +109,21 @@ pipeline { } } } + stage('Publish snapshot') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } } post { always { From 106c5fd0ffa25e7a0ba8aca7891c682cb69304e8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:29:06 +0100 Subject: [PATCH 1128/1971] HMBXR5601-827 - Publish package --- publish/package.groovy | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 8e91143..2a84034 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -79,7 +79,20 @@ pipeline { } } } - stage('Add/update package in snapshot') { + stage('Drop published repo - if any') { + steps { + script { + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + + stage('Add/update package in repo') { steps { script { echo "Package folder is ${PACKAGE_FOLDER}" @@ -112,12 +125,7 @@ pipeline { stage('Publish snapshot') { steps { script { - echo "Snapshot name is ${SNAPSHOT_NAME}" - FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" - echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" sh """#!/bin/bash -v - # This errors if the published repo exists already; Ignore it - aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi """ From f7e227ce0175b0d7cc3d818b9d5997149264363a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:29:06 +0100 Subject: [PATCH 1129/1971] HMBXR5601-827 - Publish package --- publish/package.groovy | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 8e91143..2a84034 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -79,7 +79,20 @@ pipeline { } } } - stage('Add/update package in snapshot') { + stage('Drop published repo - if any') { + steps { + script { + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + + stage('Add/update package in repo') { steps { script { echo "Package folder is ${PACKAGE_FOLDER}" @@ -112,12 +125,7 @@ pipeline { stage('Publish snapshot') { steps { script { - echo "Snapshot name is ${SNAPSHOT_NAME}" - FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" - echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" sh """#!/bin/bash -v - # This errors if the published repo exists already; Ignore it - aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi """ From 7be6867a66da564abeb02da42c5f0587432a8a73 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 11:36:05 +0100 Subject: [PATCH 1130/1971] HMBXR5601-827 - Show more status; Handle component areas of published repos --- publish/package.groovy | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 2a84034..00f5923 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -69,12 +69,14 @@ pipeline { script { echo "Repo name is ${REPO_NAME}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" + aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}" if [ \$? -ne 0 ]; then echo "aptly repo ${REPO_NAME} does not exist; Creating it" aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi fi + aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } @@ -116,7 +118,7 @@ pipeline { aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi """ } @@ -126,7 +128,11 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" -force-overwrite snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" if [ \$? -ne 0 ]; then exit 1; fi """ } From fa69b27231d007ce8c2a3e5882a360bc3d7f33ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 11:36:05 +0100 Subject: [PATCH 1131/1971] HMBXR5601-827 - Show more status; Handle component areas of published repos --- publish/package.groovy | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 2a84034..00f5923 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -69,12 +69,14 @@ pipeline { script { echo "Repo name is ${REPO_NAME}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" + aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}" if [ \$? -ne 0 ]; then echo "aptly repo ${REPO_NAME} does not exist; Creating it" aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi fi + aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } @@ -116,7 +118,7 @@ pipeline { aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi """ } @@ -126,7 +128,11 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" -force-overwrite snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 8b39d2eb49e8b90a65af196b137a3309b83749f6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 3 Sep 2019 17:22:13 +0100 Subject: [PATCH 1132/1971] HMBXR5601-827 - Change names of packages to be neutral and without buildstamps to make future jobs easier --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 25d06a2..57d84fb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -27,8 +27,8 @@ class DebRootDefinition { DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix - PACKAGE_FOLDER_NAME = packageprefix + buildstamp - PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_FOLDER_NAME = packageprefix + PACKAGE_NAME = packageprefix + "_armhf.deb" PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" From 5c86cf641de5ad239511216363ded7574c917ed3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 3 Sep 2019 17:22:13 +0100 Subject: [PATCH 1133/1971] HMBXR5601-827 - Change names of packages to be neutral and without buildstamps to make future jobs easier --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 25d06a2..57d84fb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -27,8 +27,8 @@ class DebRootDefinition { DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix - PACKAGE_FOLDER_NAME = packageprefix + buildstamp - PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_FOLDER_NAME = packageprefix + PACKAGE_NAME = packageprefix + "_armhf.deb" PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" From 02de57be7a966093947b6ae61bcf687b8695508e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:35:37 +0100 Subject: [PATCH 1134/1971] HMBXR5601-827 - Use release tag rather than build number to make each package unique --- packaging/debian.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 57d84fb..9799ba9 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -24,7 +24,7 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix @@ -52,8 +52,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { - return new DebRootDefinition(rootpath, packageprefix, buildstamp) +def DebRootDefinition debDefinition(String rootpath, String packageprefix) { + return new DebRootDefinition(rootpath, packageprefix) } def buildPackage(String packageout, DebRootDefinition packagedefs) { From 78ed8a7e50e09f589cedc6ced581e764df80b7f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:35:37 +0100 Subject: [PATCH 1135/1971] HMBXR5601-827 - Use release tag rather than build number to make each package unique --- packaging/debian.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 57d84fb..9799ba9 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -24,7 +24,7 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix @@ -52,8 +52,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { - return new DebRootDefinition(rootpath, packageprefix, buildstamp) +def DebRootDefinition debDefinition(String rootpath, String packageprefix) { + return new DebRootDefinition(rootpath, packageprefix) } def buildPackage(String packageout, DebRootDefinition packagedefs) { From 2c654736a094d50636963ff05dde125282d342ce Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:40:02 +0100 Subject: [PATCH 1136/1971] HMBXR5601-827 - Use release tag rather than build number to make each package unique --- meta/folder.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index ddc99c4..6967def 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -722,6 +722,10 @@ class MetaInfo extends GISJsonSerialised { return buildstampinfo.buildstamp + "_" + jenkinsbuildinfo.buildnumber } + String releasetagfordebpackage() { + return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber + } + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] From c10055c58c6b3980a992965a8de821d40777e797 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:40:02 +0100 Subject: [PATCH 1137/1971] HMBXR5601-827 - Use release tag rather than build number to make each package unique --- meta/folder.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index ddc99c4..6967def 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -722,6 +722,10 @@ class MetaInfo extends GISJsonSerialised { return buildstampinfo.buildstamp + "_" + jenkinsbuildinfo.buildnumber } + String releasetagfordebpackage() { + return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber + } + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] From 512ba83729a8c3649a118a3c9350f0d1580291ed Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:56:49 +0100 Subject: [PATCH 1138/1971] HMBXR5601-827 - Versionstamper.py is leaving excess files in package --- versionstamping/versionstamper.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 4c380a6..7a9c397 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -19,21 +19,15 @@ def main(argv): print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert)) - filecopy = filetoconvert + ".orig" - try: - shutil.move(filetoconvert, filecopy) - except FileNotFoundError: - print("Could not find file: {0}\n".format(filetoconvert)) - return 1 + with open(filetoconvert,'r') as c: + fileread = c.read() count = 0 with open(filetoconvert, 'x') as f: - with open(filecopy,'r') as c: - fileread = c.read() - print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) - converted = fileread.replace(pattern, substitute) - count = converted.count(substitute) - print("Confirmed %s instances of %s post-conversion"%(count,substitute)) + print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) + converted = fileread.replace(pattern, substitute) + count = converted.count(substitute) + print("Confirmed %s instances of %s post-conversion"%(count,substitute)) f.write(converted) if count == 0: From b83050abc00d2e1efda12d60710ba2554297e458 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:56:49 +0100 Subject: [PATCH 1139/1971] HMBXR5601-827 - Versionstamper.py is leaving excess files in package --- versionstamping/versionstamper.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 4c380a6..7a9c397 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -19,21 +19,15 @@ def main(argv): print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert)) - filecopy = filetoconvert + ".orig" - try: - shutil.move(filetoconvert, filecopy) - except FileNotFoundError: - print("Could not find file: {0}\n".format(filetoconvert)) - return 1 + with open(filetoconvert,'r') as c: + fileread = c.read() count = 0 with open(filetoconvert, 'x') as f: - with open(filecopy,'r') as c: - fileread = c.read() - print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) - converted = fileread.replace(pattern, substitute) - count = converted.count(substitute) - print("Confirmed %s instances of %s post-conversion"%(count,substitute)) + print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) + converted = fileread.replace(pattern, substitute) + count = converted.count(substitute) + print("Confirmed %s instances of %s post-conversion"%(count,substitute)) f.write(converted) if count == 0: From ac0b047a69e2524394f3031aff310e611a4d8f02 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 09:00:42 +0100 Subject: [PATCH 1140/1971] HMBXR5601-827 - Versionstamper.py is leaving excess files in package --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 7a9c397..1a65e6d 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -23,7 +23,7 @@ def main(argv): fileread = c.read() count = 0 - with open(filetoconvert, 'x') as f: + with open(filetoconvert, 'w') as f: print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) converted = fileread.replace(pattern, substitute) count = converted.count(substitute) From 383fe72e7bf827509f4fc9fe70f023fa886b602b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 09:00:42 +0100 Subject: [PATCH 1141/1971] HMBXR5601-827 - Versionstamper.py is leaving excess files in package --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 7a9c397..1a65e6d 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -23,7 +23,7 @@ def main(argv): fileread = c.read() count = 0 - with open(filetoconvert, 'x') as f: + with open(filetoconvert, 'w') as f: print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) converted = fileread.replace(pattern, substitute) count = converted.count(substitute) From 4dc0283ef0f445c8f0167df8da0f58f06df98954 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 6 Sep 2019 18:56:50 +0100 Subject: [PATCH 1142/1971] HMBXR5601-827 - Remove force command options --- publish/package.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 00f5923..32cc9eb 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -99,7 +99,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi @@ -128,7 +128,7 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" -force-overwrite snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi From b0835c04deae3eecde5bf372cfc47af6ac73de5b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 6 Sep 2019 18:56:50 +0100 Subject: [PATCH 1143/1971] HMBXR5601-827 - Remove force command options --- publish/package.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 00f5923..32cc9eb 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -99,7 +99,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi @@ -128,7 +128,7 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" -force-overwrite snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi From 193ddb19808e790de9702e5a9ac88fac3ff0d0bb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:19:21 +0100 Subject: [PATCH 1144/1971] HMBXR5601-827 - Add lintian output to debian package --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 9799ba9..6b3426f 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -79,6 +79,8 @@ def buildPackage(String packageout, DebRootDefinition packagedefs) { dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + + lintian "${packageout}/${packagedefs.PACKAGE_NAME}" || true """ } From 15332b794c185a7b16d939ddeb9c4e2e39158ee4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:19:21 +0100 Subject: [PATCH 1145/1971] HMBXR5601-827 - Add lintian output to debian package --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 9799ba9..6b3426f 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -79,6 +79,8 @@ def buildPackage(String packageout, DebRootDefinition packagedefs) { dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + + lintian "${packageout}/${packagedefs.PACKAGE_NAME}" || true """ } From 3cbb3081af6d0ad940382a5c67f9ad64de13b19f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:34:22 +0100 Subject: [PATCH 1146/1971] HMBXR5601-827 - Change file permissions to satisfy lintian --- packaging/debian.groovy | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 6b3426f..eb53f44 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -56,11 +56,13 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { return new DebRootDefinition(rootpath, packageprefix) } -def buildPackage(String packageout, DebRootDefinition packagedefs) { +def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { sh """#!/bin/bash # Exit if any command fails set -e + echo "${password}" | sudo -S echo + mkdir -v -p "${packagedefs.USR_BIN}" mkdir -v -p "${packagedefs.USR_LIB_ARCH}" mkdir -v -p "${packagedefs.LIB_FIRMWARE}" @@ -69,10 +71,9 @@ def buildPackage(String packageout, DebRootDefinition packagedefs) { mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/preinst" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postinst" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/prerm" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postrm" + + sudo chmod -v -R 755 "${packagedefs.DEBPATH}" + sudo chown -v -R root: "${packagedefs.DEBPATH}" mkdir -v -p "${packageout}" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" From b9eefabe9c7a01354f1d78a4d50b953664bafaf1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:34:22 +0100 Subject: [PATCH 1147/1971] HMBXR5601-827 - Change file permissions to satisfy lintian --- packaging/debian.groovy | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 6b3426f..eb53f44 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -56,11 +56,13 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { return new DebRootDefinition(rootpath, packageprefix) } -def buildPackage(String packageout, DebRootDefinition packagedefs) { +def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { sh """#!/bin/bash # Exit if any command fails set -e + echo "${password}" | sudo -S echo + mkdir -v -p "${packagedefs.USR_BIN}" mkdir -v -p "${packagedefs.USR_LIB_ARCH}" mkdir -v -p "${packagedefs.LIB_FIRMWARE}" @@ -69,10 +71,9 @@ def buildPackage(String packageout, DebRootDefinition packagedefs) { mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/preinst" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postinst" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/prerm" - chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postrm" + + sudo chmod -v -R 755 "${packagedefs.DEBPATH}" + sudo chown -v -R root: "${packagedefs.DEBPATH}" mkdir -v -p "${packageout}" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" From f93a80884de140e1fdc4f88c6d5bcc404477aa20 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:49:44 +0100 Subject: [PATCH 1148/1971] HMBXR5601-827 - Change file permissions to satisfy lintian --- packaging/debian.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index eb53f44..3dda8eb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -81,7 +81,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" - lintian "${packageout}/${packagedefs.PACKAGE_NAME}" || true + lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true """ } From 3b5b7606d5a07ec2392a0a95f0a75c214c831f02 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 10:49:44 +0100 Subject: [PATCH 1149/1971] HMBXR5601-827 - Change file permissions to satisfy lintian --- packaging/debian.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index eb53f44..3dda8eb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -81,7 +81,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" - lintian "${packageout}/${packagedefs.PACKAGE_NAME}" || true + lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true """ } From a619adfd2aa5ac8931daa45a1f87e593d61f3132 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:40:47 +0100 Subject: [PATCH 1150/1971] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 52 ++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 3dda8eb..cef692f 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -57,32 +57,46 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { } def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { - sh """#!/bin/bash - # Exit if any command fails - set -e + try { + sh """#!/bin/bash + # Exit if any command fails + set -e - echo "${password}" | sudo -S echo + echo "${password}" | sudo -S echo - mkdir -v -p "${packagedefs.USR_BIN}" - mkdir -v -p "${packagedefs.USR_LIB_ARCH}" - mkdir -v -p "${packagedefs.LIB_FIRMWARE}" + mkdir -v -p "${packagedefs.USR_BIN}" + mkdir -v -p "${packagedefs.USR_LIB_ARCH}" + mkdir -v -p "${packagedefs.LIB_FIRMWARE}" - mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" - mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" + mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" + mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" - cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" - sudo chmod -v -R 755 "${packagedefs.DEBPATH}" - sudo chown -v -R root: "${packagedefs.DEBPATH}" + sudo chmod -v -R 755 "${packagedefs.DEBPATH}" + sudo chown -v -R root: "${packagedefs.DEBPATH}" - mkdir -v -p "${packageout}" - dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + mkdir -v -p "${packageout}" + dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" - dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" - dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" - - lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true - """ + dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + + lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true + + sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + """ + } + catch (Exception e) { + echo "Exception occurred" + sh """#!/bin/bash -v + echo "${password}" | sudo -S echo + + sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + + exit 1 + """ + } } return this; \ No newline at end of file From c036622a82eeed56381a749027d153377e81f1c4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:40:47 +0100 Subject: [PATCH 1151/1971] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 52 ++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 3dda8eb..cef692f 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -57,32 +57,46 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { } def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { - sh """#!/bin/bash - # Exit if any command fails - set -e + try { + sh """#!/bin/bash + # Exit if any command fails + set -e - echo "${password}" | sudo -S echo + echo "${password}" | sudo -S echo - mkdir -v -p "${packagedefs.USR_BIN}" - mkdir -v -p "${packagedefs.USR_LIB_ARCH}" - mkdir -v -p "${packagedefs.LIB_FIRMWARE}" + mkdir -v -p "${packagedefs.USR_BIN}" + mkdir -v -p "${packagedefs.USR_LIB_ARCH}" + mkdir -v -p "${packagedefs.LIB_FIRMWARE}" - mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" - mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" + mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" + mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" - cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" - sudo chmod -v -R 755 "${packagedefs.DEBPATH}" - sudo chown -v -R root: "${packagedefs.DEBPATH}" + sudo chmod -v -R 755 "${packagedefs.DEBPATH}" + sudo chown -v -R root: "${packagedefs.DEBPATH}" - mkdir -v -p "${packageout}" - dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + mkdir -v -p "${packageout}" + dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" - dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" - dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" - - lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true - """ + dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + + lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true + + sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + """ + } + catch (Exception e) { + echo "Exception occurred" + sh """#!/bin/bash -v + echo "${password}" | sudo -S echo + + sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + + exit 1 + """ + } } return this; \ No newline at end of file From d1f0c5254765420d292d051782a66402a9f1f98c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:43:42 +0100 Subject: [PATCH 1152/1971] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index cef692f..4981c78 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -84,7 +84,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true - sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + sudo chown -R ${USER}: "${packagedefs.DEBPATH}" """ } catch (Exception e) { @@ -92,7 +92,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo sh """#!/bin/bash -v echo "${password}" | sudo -S echo - sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + sudo chown -R ${USER}: "${packagedefs.DEBPATH}" exit 1 """ From 01f570e3481640d8c7da9a12915ecffcec42e778 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:43:42 +0100 Subject: [PATCH 1153/1971] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index cef692f..4981c78 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -84,7 +84,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true - sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + sudo chown -R ${USER}: "${packagedefs.DEBPATH}" """ } catch (Exception e) { @@ -92,7 +92,7 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo sh """#!/bin/bash -v echo "${password}" | sudo -S echo - sudo chown -v -R ${USER}: "${packagedefs.DEBPATH}" + sudo chown -R ${USER}: "${packagedefs.DEBPATH}" exit 1 """ From fd69303adc548a52c1acb96ee04e0040e0993c26 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:47:12 +0100 Subject: [PATCH 1154/1971] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 4981c78..1bd8a6e 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -77,11 +77,15 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo sudo chown -v -R root: "${packagedefs.DEBPATH}" mkdir -v -p "${packageout}" + echo "Building package:" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package:" dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package contents:" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package lintian output:" lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true sudo chown -R ${USER}: "${packagedefs.DEBPATH}" From 0b81e15e34eb6ca52bcaed9e8bf488e5fae38523 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 12:47:12 +0100 Subject: [PATCH 1155/1971] HMBXR5601-827 - Change permissions after package build so that it can be cleaned on the next build --- packaging/debian.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 4981c78..1bd8a6e 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -77,11 +77,15 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo sudo chown -v -R root: "${packagedefs.DEBPATH}" mkdir -v -p "${packageout}" + echo "Building package:" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package:" dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package contents:" dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + echo "Showing package lintian output:" lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true sudo chown -R ${USER}: "${packagedefs.DEBPATH}" From b613549d453480a996767e74e667f35114b78a21 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:48:15 +0100 Subject: [PATCH 1156/1971] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 8 ++++++-- publish/package.groovy | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 1bd8a6e..7762951 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -24,11 +24,12 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix) { + DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix PACKAGE_NAME = packageprefix + "_armhf.deb" + UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb" PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" @@ -56,7 +57,7 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { return new DebRootDefinition(rootpath, packageprefix) } -def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { +def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { try { sh """#!/bin/bash # Exit if any command fails @@ -80,6 +81,9 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo echo "Building package:" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + mkdir -v -p "${uniquepackageout}" + cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}" + echo "Showing package:" dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" echo "Showing package contents:" diff --git a/publish/package.groovy b/publish/package.groovy index 32cc9eb..ea79cfd 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -50,6 +50,7 @@ pipeline { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) PACKAGE_FOLDER = "${PACKAGEDEST}/package" + UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage" } } } @@ -97,9 +98,9 @@ pipeline { stage('Add/update package in repo') { steps { script { - echo "Package folder is ${PACKAGE_FOLDER}" + echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${UNIQUE_PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From 2c62802a84fcb7008a676c5e638fa272912372f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:48:15 +0100 Subject: [PATCH 1157/1971] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 8 ++++++-- publish/package.groovy | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 1bd8a6e..7762951 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -24,11 +24,12 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix) { + DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix PACKAGE_NAME = packageprefix + "_armhf.deb" + UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb" PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" @@ -56,7 +57,7 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) { return new DebRootDefinition(rootpath, packageprefix) } -def buildPackage(String packageout, DebRootDefinition packagedefs, String password) { +def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { try { sh """#!/bin/bash # Exit if any command fails @@ -80,6 +81,9 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo echo "Building package:" dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + mkdir -v -p "${uniquepackageout}" + cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}" + echo "Showing package:" dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" echo "Showing package contents:" diff --git a/publish/package.groovy b/publish/package.groovy index 32cc9eb..ea79cfd 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -50,6 +50,7 @@ pipeline { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) PACKAGE_FOLDER = "${PACKAGEDEST}/package" + UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage" } } } @@ -97,9 +98,9 @@ pipeline { stage('Add/update package in repo') { steps { script { - echo "Package folder is ${PACKAGE_FOLDER}" + echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${UNIQUE_PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From 48c62468007201c862390c4454fa7c39ffe3711c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:51:34 +0100 Subject: [PATCH 1158/1971] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 7762951..0323cea 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -53,8 +53,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix) { - return new DebRootDefinition(rootpath, packageprefix) +def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packageprefix, buildstamp) } def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { From d4012e0dbbce8b82e276126ec5d46f49bc9fdb6d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:51:34 +0100 Subject: [PATCH 1159/1971] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 7762951..0323cea 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -53,8 +53,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix) { - return new DebRootDefinition(rootpath, packageprefix) +def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packageprefix, buildstamp) } def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { From 8bc62d86f4899cf7171310d9ae12f4f66f5e47d0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:53:07 +0100 Subject: [PATCH 1160/1971] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 0323cea..0d6e7e4 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -3,6 +3,7 @@ class DebRootDefinition { String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME + String UNIQUE_PACKAGE_NAME String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH From b1f0476725d07b18ee45cbb7fc30916cc679a402 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 9 Sep 2019 14:53:07 +0100 Subject: [PATCH 1161/1971] HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files --- packaging/debian.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 0323cea..0d6e7e4 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -3,6 +3,7 @@ class DebRootDefinition { String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME + String UNIQUE_PACKAGE_NAME String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH From 9bf1c08f81e03beb74004d240c573505fd498720 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Sep 2019 21:44:08 +0100 Subject: [PATCH 1162/1971] HMBXR5601-827 - Tar up export to preserve links --- compile/eclipsebuild/eclipseds5build.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 9ab8df3..63c8d45 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -81,7 +81,7 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ - cp -r -v "${srcFileExpanded}" "${destFolderExpanded}" + cp -v --no-dereference --preserve=links -r "${srcFileExpanded}" "${destFolderExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true From 7a3bb4426e53b82854c1ace35e9b79d9d2f7f58e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 10 Sep 2019 21:44:08 +0100 Subject: [PATCH 1163/1971] HMBXR5601-827 - Tar up export to preserve links --- compile/eclipsebuild/eclipseds5build.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 9ab8df3..63c8d45 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -81,7 +81,7 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ - cp -r -v "${srcFileExpanded}" "${destFolderExpanded}" + cp -v --no-dereference --preserve=links -r "${srcFileExpanded}" "${destFolderExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true From 0b35442b42e83286cd74795edde980ee2e1cd58c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 19:45:48 +0100 Subject: [PATCH 1164/1971] HMBXR5601-827 - Avoid XR specific path in Common_scripts --- packaging/debian.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 0d6e7e4..6c5240c 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -5,6 +5,7 @@ class DebRootDefinition { String PACKAGE_NAME String UNIQUE_PACKAGE_NAME + String PACKAGE_SOURCE_ROOT String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH @@ -25,13 +26,14 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix PACKAGE_NAME = packageprefix + "_armhf.deb" UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb" + PACKAGE_SOURCE_ROOT = packagesourceroot PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" @@ -54,8 +56,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { - return new DebRootDefinition(rootpath, packageprefix, buildstamp) +def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp) } def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { @@ -73,7 +75,7 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" - cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" sudo chmod -v -R 755 "${packagedefs.DEBPATH}" sudo chown -v -R root: "${packagedefs.DEBPATH}" From c79dbb6bae9f08717eb0e5a67800b1655a8eda7a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 19:45:48 +0100 Subject: [PATCH 1165/1971] HMBXR5601-827 - Avoid XR specific path in Common_scripts --- packaging/debian.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 0d6e7e4..6c5240c 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -5,6 +5,7 @@ class DebRootDefinition { String PACKAGE_NAME String UNIQUE_PACKAGE_NAME + String PACKAGE_SOURCE_ROOT String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH @@ -25,13 +26,14 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix PACKAGE_NAME = packageprefix + "_armhf.deb" UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb" + PACKAGE_SOURCE_ROOT = packagesourceroot PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" @@ -54,8 +56,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { - return new DebRootDefinition(rootpath, packageprefix, buildstamp) +def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp) } def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { @@ -73,7 +75,7 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" - cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" sudo chmod -v -R 755 "${packagedefs.DEBPATH}" sudo chown -v -R root: "${packagedefs.DEBPATH}" From d7ff5ae021b3a56bb9681f92cfb3d6b8d268948a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 20:27:44 +0100 Subject: [PATCH 1166/1971] HMBXR5601-827 - Keep published repos of different products and branches seperate --- publish/package.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index ea79cfd..0f1ad9e 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -87,7 +87,7 @@ pipeline { script { sh """#!/bin/bash -v # This errors if the published repo exists already; Ignore it - aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}" aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi """ @@ -129,11 +129,11 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" "${PUBLISH_PATH_PREFIX}" if [ \$? -ne 0 ]; then exit 1; fi aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi - aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 5bc28decb2bfdb539a95231f1641c7ea885e5b57 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 20:27:44 +0100 Subject: [PATCH 1167/1971] HMBXR5601-827 - Keep published repos of different products and branches seperate --- publish/package.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index ea79cfd..0f1ad9e 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -87,7 +87,7 @@ pipeline { script { sh """#!/bin/bash -v # This errors if the published repo exists already; Ignore it - aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}" aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi """ @@ -129,11 +129,11 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" "${PUBLISH_PATH_PREFIX}" if [ \$? -ne 0 ]; then exit 1; fi aptly publish -config="${APTLY_CONFIG_FILE}" list if [ \$? -ne 0 ]; then exit 1; fi - aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 62e338e7f9da4e3ec89eecbe4f9b0484181b03e0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 23:30:06 +0100 Subject: [PATCH 1168/1971] HMBXR5601-827 - Had to reverse the changes of this commonly used script --- copy/logic.groovy | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index a5b134b..3f3f48d 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -24,12 +24,10 @@ pipeline { stage('Copying logic artifacts') { steps { script { - env.SG600_LOGICDEST = "${WORKSPACE}/sg600_logic" - env.KTB_LOGICDEST = "${WORKSPACE}/ktb_logic" + env.LOGICDEST = "${WORKSPACE}/logic" if (LOGIC_ARTIFACT_LOCATION == "Jenkins job artifact") { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - importer.artifactimport(meta, KTB_LOGIC_ARTIFACT_PROJECT, KTB_LOGIC_ARTIFACT_BUILD_SELECTOR, KTB_LOGICDEST) - importer.artifactimport(meta, SG600_LOGIC_ARTIFACT_PROJECT, SG600_LOGIC_ARTIFACT_BUILD_SELECTOR, SG600_LOGICDEST) + importer.artifactimport(meta, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGICDEST) } } } @@ -39,7 +37,7 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - rm -v -rf diff meta embedded_logic + rm -v -rf meta mv -v logic/* . """ archiveArtifacts "${artifactlist}" @@ -61,4 +59,4 @@ pipeline { echo 'Succeeded build' } } -} +} \ No newline at end of file From f7ea682f6dd92a65ff4019a46b93e493eb5a4fdf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 11 Sep 2019 23:30:06 +0100 Subject: [PATCH 1169/1971] HMBXR5601-827 - Had to reverse the changes of this commonly used script --- copy/logic.groovy | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index a5b134b..3f3f48d 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -24,12 +24,10 @@ pipeline { stage('Copying logic artifacts') { steps { script { - env.SG600_LOGICDEST = "${WORKSPACE}/sg600_logic" - env.KTB_LOGICDEST = "${WORKSPACE}/ktb_logic" + env.LOGICDEST = "${WORKSPACE}/logic" if (LOGIC_ARTIFACT_LOCATION == "Jenkins job artifact") { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - importer.artifactimport(meta, KTB_LOGIC_ARTIFACT_PROJECT, KTB_LOGIC_ARTIFACT_BUILD_SELECTOR, KTB_LOGICDEST) - importer.artifactimport(meta, SG600_LOGIC_ARTIFACT_PROJECT, SG600_LOGIC_ARTIFACT_BUILD_SELECTOR, SG600_LOGICDEST) + importer.artifactimport(meta, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGICDEST) } } } @@ -39,7 +37,7 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - rm -v -rf diff meta embedded_logic + rm -v -rf meta mv -v logic/* . """ archiveArtifacts "${artifactlist}" @@ -61,4 +59,4 @@ pipeline { echo 'Succeeded build' } } -} +} \ No newline at end of file From a67970c3105e97977d8178b046bda99a60bc51b5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:27:44 +0100 Subject: [PATCH 1170/1971] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 0f1ad9e..9a77259 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -113,11 +113,16 @@ pipeline { script { echo "Snapshot name is ${SNAPSHOT_NAME}" FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" - echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + PACKAGE_VERSION_PREFIX = packagemeta.buildstampinfo.buildstampprefix + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME} containing packages of versions beginning with: ${PACKAGE_VERSION_PREFIX}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All" + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All" from repo "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" ${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From c50f45705d58019973e17a732b91ac58ff116017 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:27:44 +0100 Subject: [PATCH 1171/1971] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 0f1ad9e..9a77259 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -113,11 +113,16 @@ pipeline { script { echo "Snapshot name is ${SNAPSHOT_NAME}" FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" - echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + PACKAGE_VERSION_PREFIX = packagemeta.buildstampinfo.buildstampprefix + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME} containing packages of versions beginning with: ${PACKAGE_VERSION_PREFIX}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All" + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All" from repo "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" ${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From f5a27e25ea078bd734b127285b707173263d9e2f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:30:28 +0100 Subject: [PATCH 1172/1971] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 9a77259..9bd9824 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -122,7 +122,7 @@ pipeline { if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" ${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From 0f5768c4b262c1b25b605156a7796e96caba8b29 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:30:28 +0100 Subject: [PATCH 1173/1971] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 9a77259..9bd9824 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -122,7 +122,7 @@ pipeline { if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" ${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From 2c3172d6dc8f6578696a3e0a91b6606f9d57407a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:37:09 +0100 Subject: [PATCH 1174/1971] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 9bd9824..2d5fdcc 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -117,12 +117,12 @@ pipeline { echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME} containing packages of versions beginning with: ${PACKAGE_VERSION_PREFIX}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it - aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All" - aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All" from repo "${REPO_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All_${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All_${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From 4c68d44b75be8d878aa8d62f847f927302d4eb0b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Sep 2019 09:37:09 +0100 Subject: [PATCH 1175/1971] HMBXR5601-827 - Filter one branches packages from another --- publish/package.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 9bd9824..2d5fdcc 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -117,12 +117,12 @@ pipeline { echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME} containing packages of versions beginning with: ${PACKAGE_VERSION_PREFIX}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it - aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All" - aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All" from repo "${REPO_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All_${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All_${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" - aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' + aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)' if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi From a01d7ed17cceb5936676e8282f8431a1b53f283c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 13 Sep 2019 15:26:48 +0100 Subject: [PATCH 1176/1971] HMBFDHV-12 - Logic copy was failing as there was an odd folder in the artifacts --- copy/logic.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 3f3f48d..4b3d521 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -14,7 +14,7 @@ pipeline { cleanfolders = [ "${WORKSPACE}/logic", "${WORKSPACE}/embedded_logic", - "${WORKSPACE}/diff", + "${WORKSPACE}/diff", // Some old artifacts have this folder ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -37,8 +37,9 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ + rm -v -rf diff rm -v -rf meta - mv -v logic/* . + mv -v "logic"/* . """ archiveArtifacts "${artifactlist}" } From 473d9042acb9d6edd362f043b6c8e74ce188a5e9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 13 Sep 2019 16:45:35 +0100 Subject: [PATCH 1177/1971] HMBFDHV-15 - Place firmware in correct position --- packaging/debian.groovy | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 6c5240c..6c7e006 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -68,13 +68,6 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p echo "${password}" | sudo -S echo - mkdir -v -p "${packagedefs.USR_BIN}" - mkdir -v -p "${packagedefs.USR_LIB_ARCH}" - mkdir -v -p "${packagedefs.LIB_FIRMWARE}" - - mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" - mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" - cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" sudo chmod -v -R 755 "${packagedefs.DEBPATH}" From bc67f4dad128a81d3a081b71da6fdb8bec164a78 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:17:49 +0100 Subject: [PATCH 1178/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/ftp_query.groovy | 18 +++++ publish/promptingpublish.groovy | 129 ++++++++++++++++++++++++++++++++ remoteaccess/ftp.groovy | 33 ++++++++ remoteaccess/hostedftp.groovy | 28 +++++++ versioncontrol/git.groovy | 6 ++ 5 files changed, 214 insertions(+) create mode 100644 publish/ftp_query.groovy create mode 100644 publish/promptingpublish.groovy create mode 100644 remoteaccess/ftp.groovy create mode 100644 remoteaccess/hostedftp.groovy diff --git a/publish/ftp_query.groovy b/publish/ftp_query.groovy new file mode 100644 index 0000000..02a4c2d --- /dev/null +++ b/publish/ftp_query.groovy @@ -0,0 +1,18 @@ +ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") + +def getCustomerListFromFTP(FTPSiteInfo ftpsiteinfo) { + def List customerfilenames = new ArrayList() + def List customers = new ArrayList() + + FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) + + customerfilenames = ftpclient.listNames() + for(customer in customerfilenames) { + def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8") + customers.add(converted) + } + ftpclient.disconnect() + return customers +} + +return this; diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy new file mode 100644 index 0000000..deffec8 --- /dev/null +++ b/publish/promptingpublish.groovy @@ -0,0 +1,129 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Clean folders') { + steps { + script { + cleanfolders = [ + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Checkout release repo') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + SOURCEURL = RELEASE_REPO + SOURCEREVISION = "origin/master" + SOURCEDIR = "${WORKSPACE}/whole" + configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + } + } + } + stage('Identify customer to publish to') { + steps { + script { + hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") + def List customers = hostedftb.getCustomerList() + customer = input( + message: 'Please select customer to publish to', + ok: 'Ok', + parameters: [ + choice(name: 'customer', choices: customers, description: 'Which customer?') + ] + ) + echo "Chosen customer is: ${customer}" + } + } + } + stage('Identify software release to publish') { + steps { + script { + gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + def List releases = gh.gettaglist(SOURCEDIR) + release = input( + message: 'Please select the software version', + ok: 'Ok', + parameters: [ + choice(name: 'release', choices: releases, description: 'Which release?') + ] + ) + echo "Chosen software version is: ${release}" + } + } + } + stage('Checkout release repo at selected software version') { + steps { + script { + SOURCEURL = RELEASE_REPO + SOURCEREVISION = "refs/tags/${release}" + SOURCEDIR = "${WORKSPACE}/whole" + configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + } + } + } + stage('Get release artifact meta') { + steps { + script { + def mfs = autobuilderscript.getmetafolderscript() + releasemeta = mfs.metafromfolder(SOURCEDIR) + } + } + } + stage('Publish components') { + steps { + script { + def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, ITEMS_TO_PUBLISH, customer, release, MAX_META_DEPTH) + if (markunstable) { + env.unstablereason = unstablereason + currentBuild.result = 'UNSTABLE' + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts() + archiveArtifacts "summary/**,${artifactlist}" + } + } + } + stage('Summarise') { + steps { + script { + echo "Summary:\n${summarystring}\n" + if (env.unstablereason) { + echo "Instability reason: ${env.unstablereason}" + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + diff --git a/remoteaccess/ftp.groovy b/remoteaccess/ftp.groovy new file mode 100644 index 0000000..750319f --- /dev/null +++ b/remoteaccess/ftp.groovy @@ -0,0 +1,33 @@ +@Grab(group='commons-net', module='commons-net', version='2.0') +import org.apache.commons.net.ftp.FTPClient + +class FTPSiteInfo { + String url + String username + String password + String workingdirectory + + FTPSiteInfo(String url, String username, String password, String workingdirectory) { + this.url = url + this.username = username + this.password = password + this.workingdirectory = workingdirectory + } +} + +FTPSiteInfo createFTPSiteInfo(String url, String username, String password, String workingdirectory) { + FTPSiteInfo ftpsiteinfo = new FTPSiteInfo(url, username, password, workingdirectory) + return ftpsiteinfo +} + +FTPClient createFTPClient(FTPSiteInfo ftpsiteinfo) { + FTPClient ftpclient = new FTPClient().with { + connect ftpsiteinfo.url + enterLocalPassiveMode() + login ftpsiteinfo.username, ftpsiteinfo.password + changeWorkingDirectory ftpsiteinfo.workingdirectory + } + return ftpclient +} + +return this; \ No newline at end of file diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy new file mode 100644 index 0000000..fd81d6d --- /dev/null +++ b/remoteaccess/hostedftp.groovy @@ -0,0 +1,28 @@ +ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") + +FTPSiteInfo getHostedFTPSiteInfo() { + FTPSiteInfo hostedftpsiteinfo = + ftpremote.createFTPSiteInfo("ftp.hostedftp.com", + "ftp@globalinkjetsystems.com", + "ramshorn42", + "/Customers/") + return hostedftpsiteinfo +} + +def getCustomerList() { + def List customerfilenames = new ArrayList() + def List customers = new ArrayList() + + FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() + FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) + + customerfilenames = ftpclient.listNames() + for(customer in customerfilenames) { + def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8") + customers.add(converted) + } + ftpclient.disconnect() + return customers +} + +return this; \ No newline at end of file diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index bb7c0ce..d24f3ff 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -25,6 +25,12 @@ String getGitInfo(String workingSetRootPath) { } } +List gettaglist(String workingSetRootPath) { + dir(workingSetRootPath) { + return clh.getCommandOutput('git tag --sort=-version:refname') + } +} + @NonCPS def ArrayList sparsecheckoutconfig(ArrayList paths) { ArrayList sparsecheckoutpaths = new ArrayList() From 8858c55b23bd25db2e9790e7b3f11bc4d5ba9a41 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:17:49 +0100 Subject: [PATCH 1179/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/ftp_query.groovy | 18 +++++ publish/promptingpublish.groovy | 129 ++++++++++++++++++++++++++++++++ remoteaccess/ftp.groovy | 33 ++++++++ remoteaccess/hostedftp.groovy | 28 +++++++ versioncontrol/git.groovy | 6 ++ 5 files changed, 214 insertions(+) create mode 100644 publish/ftp_query.groovy create mode 100644 publish/promptingpublish.groovy create mode 100644 remoteaccess/ftp.groovy create mode 100644 remoteaccess/hostedftp.groovy diff --git a/publish/ftp_query.groovy b/publish/ftp_query.groovy new file mode 100644 index 0000000..02a4c2d --- /dev/null +++ b/publish/ftp_query.groovy @@ -0,0 +1,18 @@ +ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") + +def getCustomerListFromFTP(FTPSiteInfo ftpsiteinfo) { + def List customerfilenames = new ArrayList() + def List customers = new ArrayList() + + FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) + + customerfilenames = ftpclient.listNames() + for(customer in customerfilenames) { + def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8") + customers.add(converted) + } + ftpclient.disconnect() + return customers +} + +return this; diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy new file mode 100644 index 0000000..deffec8 --- /dev/null +++ b/publish/promptingpublish.groovy @@ -0,0 +1,129 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Clean folders') { + steps { + script { + cleanfolders = [ + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Checkout release repo') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + SOURCEURL = RELEASE_REPO + SOURCEREVISION = "origin/master" + SOURCEDIR = "${WORKSPACE}/whole" + configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + } + } + } + stage('Identify customer to publish to') { + steps { + script { + hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") + def List customers = hostedftb.getCustomerList() + customer = input( + message: 'Please select customer to publish to', + ok: 'Ok', + parameters: [ + choice(name: 'customer', choices: customers, description: 'Which customer?') + ] + ) + echo "Chosen customer is: ${customer}" + } + } + } + stage('Identify software release to publish') { + steps { + script { + gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + def List releases = gh.gettaglist(SOURCEDIR) + release = input( + message: 'Please select the software version', + ok: 'Ok', + parameters: [ + choice(name: 'release', choices: releases, description: 'Which release?') + ] + ) + echo "Chosen software version is: ${release}" + } + } + } + stage('Checkout release repo at selected software version') { + steps { + script { + SOURCEURL = RELEASE_REPO + SOURCEREVISION = "refs/tags/${release}" + SOURCEDIR = "${WORKSPACE}/whole" + configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + } + } + } + stage('Get release artifact meta') { + steps { + script { + def mfs = autobuilderscript.getmetafolderscript() + releasemeta = mfs.metafromfolder(SOURCEDIR) + } + } + } + stage('Publish components') { + steps { + script { + def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, ITEMS_TO_PUBLISH, customer, release, MAX_META_DEPTH) + if (markunstable) { + env.unstablereason = unstablereason + currentBuild.result = 'UNSTABLE' + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts() + archiveArtifacts "summary/**,${artifactlist}" + } + } + } + stage('Summarise') { + steps { + script { + echo "Summary:\n${summarystring}\n" + if (env.unstablereason) { + echo "Instability reason: ${env.unstablereason}" + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + diff --git a/remoteaccess/ftp.groovy b/remoteaccess/ftp.groovy new file mode 100644 index 0000000..750319f --- /dev/null +++ b/remoteaccess/ftp.groovy @@ -0,0 +1,33 @@ +@Grab(group='commons-net', module='commons-net', version='2.0') +import org.apache.commons.net.ftp.FTPClient + +class FTPSiteInfo { + String url + String username + String password + String workingdirectory + + FTPSiteInfo(String url, String username, String password, String workingdirectory) { + this.url = url + this.username = username + this.password = password + this.workingdirectory = workingdirectory + } +} + +FTPSiteInfo createFTPSiteInfo(String url, String username, String password, String workingdirectory) { + FTPSiteInfo ftpsiteinfo = new FTPSiteInfo(url, username, password, workingdirectory) + return ftpsiteinfo +} + +FTPClient createFTPClient(FTPSiteInfo ftpsiteinfo) { + FTPClient ftpclient = new FTPClient().with { + connect ftpsiteinfo.url + enterLocalPassiveMode() + login ftpsiteinfo.username, ftpsiteinfo.password + changeWorkingDirectory ftpsiteinfo.workingdirectory + } + return ftpclient +} + +return this; \ No newline at end of file diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy new file mode 100644 index 0000000..fd81d6d --- /dev/null +++ b/remoteaccess/hostedftp.groovy @@ -0,0 +1,28 @@ +ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") + +FTPSiteInfo getHostedFTPSiteInfo() { + FTPSiteInfo hostedftpsiteinfo = + ftpremote.createFTPSiteInfo("ftp.hostedftp.com", + "ftp@globalinkjetsystems.com", + "ramshorn42", + "/Customers/") + return hostedftpsiteinfo +} + +def getCustomerList() { + def List customerfilenames = new ArrayList() + def List customers = new ArrayList() + + FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() + FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) + + customerfilenames = ftpclient.listNames() + for(customer in customerfilenames) { + def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8") + customers.add(converted) + } + ftpclient.disconnect() + return customers +} + +return this; \ No newline at end of file diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index bb7c0ce..d24f3ff 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -25,6 +25,12 @@ String getGitInfo(String workingSetRootPath) { } } +List gettaglist(String workingSetRootPath) { + dir(workingSetRootPath) { + return clh.getCommandOutput('git tag --sort=-version:refname') + } +} + @NonCPS def ArrayList sparsecheckoutconfig(ArrayList paths) { ArrayList sparsecheckoutpaths = new ArrayList() From 7ac2020f9bf6ec25dc4db23678f44809b834f565 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:48:38 +0100 Subject: [PATCH 1180/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- remoteaccess/hostedftp.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy index fd81d6d..c977b97 100644 --- a/remoteaccess/hostedftp.groovy +++ b/remoteaccess/hostedftp.groovy @@ -1,7 +1,7 @@ ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") -FTPSiteInfo getHostedFTPSiteInfo() { - FTPSiteInfo hostedftpsiteinfo = +ftpremote.FTPSiteInfo getHostedFTPSiteInfo() { + ftpremote.FTPSiteInfo hostedftpsiteinfo = ftpremote.createFTPSiteInfo("ftp.hostedftp.com", "ftp@globalinkjetsystems.com", "ramshorn42", @@ -13,7 +13,7 @@ def getCustomerList() { def List customerfilenames = new ArrayList() def List customers = new ArrayList() - FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() + ftpremote.FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) customerfilenames = ftpclient.listNames() From e98c4bfb228dcc73de588f62219ac701dcfe9689 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:50:45 +0100 Subject: [PATCH 1181/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- remoteaccess/hostedftp.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy index c977b97..eab365e 100644 --- a/remoteaccess/hostedftp.groovy +++ b/remoteaccess/hostedftp.groovy @@ -1,7 +1,7 @@ ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") -ftpremote.FTPSiteInfo getHostedFTPSiteInfo() { - ftpremote.FTPSiteInfo hostedftpsiteinfo = +def getHostedFTPSiteInfo() { + hostedftpsiteinfo = ftpremote.createFTPSiteInfo("ftp.hostedftp.com", "ftp@globalinkjetsystems.com", "ramshorn42", @@ -13,7 +13,7 @@ def getCustomerList() { def List customerfilenames = new ArrayList() def List customers = new ArrayList() - ftpremote.FTPSiteInfo ftpsiteinfo = getHostedFTPSiteInfo() + def ftpsiteinfo = getHostedFTPSiteInfo() FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) customerfilenames = ftpclient.listNames() From 104df0232af8c8b21e005840a77b35a19f94119c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 14:51:57 +0100 Subject: [PATCH 1182/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- remoteaccess/hostedftp.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy index eab365e..5d16de5 100644 --- a/remoteaccess/hostedftp.groovy +++ b/remoteaccess/hostedftp.groovy @@ -14,7 +14,7 @@ def getCustomerList() { def List customers = new ArrayList() def ftpsiteinfo = getHostedFTPSiteInfo() - FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) + def ftpclient = ftpremote.createFTPClient(ftpsiteinfo) customerfilenames = ftpclient.listNames() for(customer in customerfilenames) { From bc89834064392d47f32a4875fdba58ccb3ce5c34 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 15:06:22 +0100 Subject: [PATCH 1183/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- remoteaccess/ftp.groovy | 32 ++++++++++++++++---------------- remoteaccess/hostedftp.groovy | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/remoteaccess/ftp.groovy b/remoteaccess/ftp.groovy index 750319f..bdc441f 100644 --- a/remoteaccess/ftp.groovy +++ b/remoteaccess/ftp.groovy @@ -2,32 +2,32 @@ import org.apache.commons.net.ftp.FTPClient class FTPSiteInfo { - String url - String username - String password - String workingdirectory - - FTPSiteInfo(String url, String username, String password, String workingdirectory) { + String url + String username + String password + String workingdirectory + + FTPSiteInfo(String url, String username, String password, String workingdirectory) { this.url = url this.username = username this.password = password - this.workingdirectory = workingdirectory - } + this.workingdirectory = workingdirectory + } } FTPSiteInfo createFTPSiteInfo(String url, String username, String password, String workingdirectory) { FTPSiteInfo ftpsiteinfo = new FTPSiteInfo(url, username, password, workingdirectory) - return ftpsiteinfo + return ftpsiteinfo } FTPClient createFTPClient(FTPSiteInfo ftpsiteinfo) { - FTPClient ftpclient = new FTPClient().with { - connect ftpsiteinfo.url - enterLocalPassiveMode() - login ftpsiteinfo.username, ftpsiteinfo.password - changeWorkingDirectory ftpsiteinfo.workingdirectory - } - return ftpclient + FTPClient ftpclient = new FTPClient() + ftpclient.connect(ftpsiteinfo.url) + ftpclient.enterLocalPassiveMode() + ftpclient.login(ftpsiteinfo.username, ftpsiteinfo.password) + ftpclient.changeWorkingDirectory(ftpsiteinfo.workingdirectory) + + return ftpclient } return this; \ No newline at end of file diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy index 5d16de5..cf62d32 100644 --- a/remoteaccess/hostedftp.groovy +++ b/remoteaccess/hostedftp.groovy @@ -14,7 +14,7 @@ def getCustomerList() { def List customers = new ArrayList() def ftpsiteinfo = getHostedFTPSiteInfo() - def ftpclient = ftpremote.createFTPClient(ftpsiteinfo) + def ftpclient = ftpremote.createFTPClient(ftpsiteinfo) customerfilenames = ftpclient.listNames() for(customer in customerfilenames) { From 10f872058104cdcfe40625e1c3105f48090f0bf4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 15:22:24 +0100 Subject: [PATCH 1184/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- versioncontrol/git.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index d24f3ff..719af98 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -26,9 +26,12 @@ String getGitInfo(String workingSetRootPath) { } List gettaglist(String workingSetRootPath) { + List taglist = new List() dir(workingSetRootPath) { - return clh.getCommandOutput('git tag --sort=-version:refname') + def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') + taglist = tagliststring.split() } + return taglist } @NonCPS From 6b33cd97fdb610b8f5f3f06971302bd7d974e4c7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 15:29:43 +0100 Subject: [PATCH 1185/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 2 +- versioncontrol/git.groovy | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index deffec8..0ab87af 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -50,7 +50,7 @@ pipeline { steps { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - def List releases = gh.gettaglist(SOURCEDIR) + def releases = gh.gettaglist(SOURCEDIR) release = input( message: 'Please select the software version', ok: 'Ok', diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 719af98..77ca734 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -25,8 +25,8 @@ String getGitInfo(String workingSetRootPath) { } } -List gettaglist(String workingSetRootPath) { - List taglist = new List() +ArrayList gettaglist(String workingSetRootPath) { + ArrayList taglist = new ArrayList() dir(workingSetRootPath) { def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') taglist = tagliststring.split() From 5c585e5555ae2b54a864af64a021bcf99b9f5a11 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 17:47:57 +0100 Subject: [PATCH 1186/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/ftp_query.groovy | 18 ---- publish/promptingpublish.groovy | 27 +++++- publish/publish_item_select.groovy | 135 ----------------------------- publish/publishitems.groovy | 92 ++++++++++++++++++++ versioncontrol/git.groovy | 2 +- 5 files changed, 118 insertions(+), 156 deletions(-) delete mode 100644 publish/ftp_query.groovy delete mode 100755 publish/publish_item_select.groovy create mode 100644 publish/publishitems.groovy diff --git a/publish/ftp_query.groovy b/publish/ftp_query.groovy deleted file mode 100644 index 02a4c2d..0000000 --- a/publish/ftp_query.groovy +++ /dev/null @@ -1,18 +0,0 @@ -ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy") - -def getCustomerListFromFTP(FTPSiteInfo ftpsiteinfo) { - def List customerfilenames = new ArrayList() - def List customers = new ArrayList() - - FTPClient ftpclient = ftpremote.createFTPClient(ftpsiteinfo) - - customerfilenames = ftpclient.listNames() - for(customer in customerfilenames) { - def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8") - customers.add(converted) - } - ftpclient.disconnect() - return customers -} - -return this; diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 0ab87af..8b2cbf6 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -4,7 +4,8 @@ pipeline { stage('Initial setup') { steps { script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = load(autobuilderscript).startnonbuild(this) } } } @@ -72,7 +73,7 @@ pipeline { } } } - stage('Get release artifact meta') { + stage('Get release artifact info') { steps { script { def mfs = autobuilderscript.getmetafolderscript() @@ -80,6 +81,28 @@ pipeline { } } } + stage('Select which items from software release to publish') { + steps { + script { + publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") + def itemsobject = publishitems.getItems(this, releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) + def selecteditems = input( + message: 'Select which items from the release are to be published', + ok: 'Ok', + parameters: [ + itemsobject.multiSelect() + ] + ) + echo "Chosen software version is: ${release}" + } + } + } + + + + + + stage('Publish components') { steps { script { diff --git a/publish/publish_item_select.groovy b/publish/publish_item_select.groovy deleted file mode 100755 index 99e424f..0000000 --- a/publish/publish_item_select.groovy +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/local/bin/groovy - -jobnameext = jobname ?: "jobunique" -metarepoext = metarepo ?: "git@hydra:print-server-releases/print_server_whole.git" -outputselectext = outputselect ?: "description" -metalevelsstringext = metalevels ?: "2" - -//jobnameext = "jobunique" -//metarepoext = "git@hydra:print-server-releases/print_server_whole.git" -//outputselectext = "description" -//metalevelsstringext = "2" - -metalevelsext = metalevelsstringext.toInteger() -dolog = false - -commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git" - -def log(message) { - if (dolog) { - println message - } -} - -def createfolder(String folder) { - def sout = new StringBuilder() - def serr = new StringBuilder() - - log("Creating directory: ${folder}") - def s = ['mkdir', '-p', folder].execute() - s.consumeProcessOutput(sout, serr) - s.waitFor() - - log("Out: ${sout} Err: ${serr}") - return [sout, serr] -} - -def gitCloneOrPull(String repo, String folder) { - def sout = new StringBuilder() - def serr = new StringBuilder() - - if (!(new File(folder).exists())) { - log("Cloning: ${repo} to: ${folder}") - createfolder(folder) - def s = ['git', 'clone', repo, folder].execute() - s.consumeProcessOutput(sout, serr) - s.waitFor() - } else { - log("Pull in: ${folder}") - def s = ['git', 'pull'].execute(null, new File(folder)) - s.consumeProcessOutput(sout, serr) - s.waitFor() - } - - log("Out: ${sout} Err: ${serr}") - return [sout, serr] -} - -def loadmetaclass(String commonscripts, String metafolder) { - def metafolderscriptfile = "${commonscripts}/meta/folder.groovy" - - GroovyShell shell = new GroovyShell() - def metafolderscript = shell.parse(new File(metafolderscriptfile)) - def meta = metafolderscript.metafromfolderSlurper(metafolder) - return meta -} - -def makeworking() { - def r = ['whoami'].execute() - r.waitFor() - def user = r.text.trim() - - def rootfolder = "/home/${user}/tmp" - createfolder(rootfolder) - - def commonscripts = "${rootfolder}/commonscripts" - gitCloneOrPull(commonscriptsrepo, commonscripts) - - // Clone or pull the relevant meta repo - def metareporoot = "${rootfolder}/${jobnameext}" - gitCloneOrPull(metarepoext, metareporoot) - def metafolder = "${metareporoot}/meta" - - // Load the meta folder class that interprets the meta repo - def meta = loadmetaclass(commonscripts, metareporoot) - return meta -} - -def String outputDescription(menuitems, releaseinfo) { - meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") - } -} - -def String outputSelection(menuitems, releaseinfo) { - meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") - } -} - -def List getItems(meta) { - def List menuitems = new ArrayList() - def metaitems = meta.releasewalkerunique(metalevelsext) - log("metaitems is ${metaitems.getClass()}") - - try { - for (key in metaitems.keySet()) { - def releaseinfo = metaitems[key] - if (outputselectext == "description") { - outputDescription(menuitems, releaseinfo) - } - if (outputselectext == "selection") { - outputSelection(menuitems, releaseinfo) - } - } - return menuitems - } catch (Exception e) { - menuitems.add("Error ${e}") - return menuitems - } -} - -def meta = makeworking() -def items = getItems(meta) - -count = 0 -for (item in items) { - count += 1 - log ("${count}: ${item}") -} - -return items \ No newline at end of file diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy new file mode 100644 index 0000000..93ef05b --- /dev/null +++ b/publish/publishitems.groovy @@ -0,0 +1,92 @@ +import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition + +class PublishableItemsSelection { + def script + def ArrayList preselectedmenuitems + def ArrayList menuitemdescriptions + def ArrayList menuitemsfull + + ExtendedChoiceParameterDefinition multiselect + + def outputSelectionfromPreselect(menuitems, preselectedext) { + script.echo ("preselectext: ${preselectedext}") + def menuitemstemp = preselectedext.split(',') + menuitemstemp = menuitemstemp*.trim() + script.echo ("Menuitemstemp: ${menuitemstemp}") + + for (menuitem in menuitemstemp) { + menuitems.add(menuitem) + } + } + + def String outputDescription(menuitems, releaseinfo) { + def meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + } + } + + def String outputSelection(menuitems, releaseinfo) { + meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") + } + } + + PublishableItemsSelection(script, releasemeta, String preselectedext, String metalevelsstringext) { + this.script = script + preselectedmenuitems = new ArrayList() + outputSelectionfromPreselect(preselectedmenuitems, preselectedext) + menuitemdescriptions = new ArrayList() + menuitemsfull = new ArrayList() + + def Integer metalevelsext = metalevelsstringext.toInteger() + def metaitems = releasemeta.releasewalkerunique(metalevelsext) + for (key in metaitems.keySet()) { + def releaseinfo = metaitems[key] + outputDescription(menuitemdescriptions, releaseinfo) + outputSelection(menuitemsfull, releaseinfo) + } + + multiselect = new ExtendedChoiceParameterDefinition( + "name", // String name + "PT_MULTI_SELECT", // String type + menuitemsfull, // String value + "project name", // String projectName + "", // String propertyFile + "", // String groovyScript + "", // String groovyScriptFile + "", // String bindings + "", // String groovyClasspath + "", // String propertyKey + preselectedmenuitems, // String defaultValue + "", // String defaultPropertyFile + "", // String defaultGroovyScript + "", // String defaultGroovyScriptFile + "", // String defaultBindings + "", // String defaultGroovyClasspath + "", // String defaultPropertyKey + menuitemdescriptions, // String descriptionPropertyValue + "", // String descriptionPropertyFile + "", // String descriptionGroovyScript + "", // String descriptionGroovyScriptFile + "", // String descriptionBindings + "", // String descriptionGroovyClasspath + "", // String descriptionPropertyKey + "", // String javascriptFile + "", // String javascript + false, // boolean saveJSONParameterToFile + false, // boolean quoteValue + 3, // int visibleItemCount + "multiselect", // String description + ",") // String multiSelectDelimiter + } + + def multiSelect() { + return multiselect + } +} + +return this; \ No newline at end of file diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 77ca734..751d1c8 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -29,7 +29,7 @@ ArrayList gettaglist(String workingSetRootPath) { ArrayList taglist = new ArrayList() dir(workingSetRootPath) { def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') - taglist = tagliststring.split() + taglist = tagliststring.split('\\n') } return taglist } From b854e0431fc39ed6114f564ae676bda131b6181f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:04:32 +0100 Subject: [PATCH 1187/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 2 +- publish/publishitems.groovy | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 8b2cbf6..c11b907 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -85,7 +85,7 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - def itemsobject = publishitems.getItems(this, releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) + def itemsobject = publishitems.getItems(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) def selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 93ef05b..175eda7 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -89,4 +89,10 @@ class PublishableItemsSelection { } } +PublishableItemsSelection createItemSelector(releasemeta, String preselectedext, String metalevelsstringext) { + PublishableItemsSelection pis = new PublishableItemsSelection(this, releasemeta, preselectedext, metalevelsstringext) + + return pis +} + return this; \ No newline at end of file From ba463fa7305ee4eeb960321739c9b1c465906fc6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:07:11 +0100 Subject: [PATCH 1188/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index c11b907..38e1b42 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -5,7 +5,7 @@ pipeline { steps { script { autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = load(autobuilderscript).startnonbuild(this) + meta = autobuilderscript.startnonbuild(this) } } } @@ -85,7 +85,7 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - def itemsobject = publishitems.getItems(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) + def itemsobject = publishitems.createItemSelector(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) def selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', From 804c895fc69e873ee9b0f6e0fa06b7790590687a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:10:15 +0100 Subject: [PATCH 1189/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 38e1b42..4d921d9 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -85,6 +85,7 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") + ITEMSDEFAULTLIST = "sgfdfsdf,sdfsdfsdfsf" def itemsobject = publishitems.createItemSelector(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) def selecteditems = input( message: 'Select which items from the release are to be published', From 466d9ce33bbbcf8a7d0b49751ad76714d3a20dcf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:14:21 +0100 Subject: [PATCH 1190/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 175eda7..35ac1d1 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -11,11 +11,10 @@ class PublishableItemsSelection { def outputSelectionfromPreselect(menuitems, preselectedext) { script.echo ("preselectext: ${preselectedext}") def menuitemstemp = preselectedext.split(',') - menuitemstemp = menuitemstemp*.trim() script.echo ("Menuitemstemp: ${menuitemstemp}") for (menuitem in menuitemstemp) { - menuitems.add(menuitem) + menuitems.add(menuitem.trim()) } } From 233dab89d442e016a01d67bef3ac16bc28f30100 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:17:03 +0100 Subject: [PATCH 1191/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 55 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 35ac1d1..a6b73f5 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -5,34 +5,7 @@ class PublishableItemsSelection { def ArrayList preselectedmenuitems def ArrayList menuitemdescriptions def ArrayList menuitemsfull - - ExtendedChoiceParameterDefinition multiselect - - def outputSelectionfromPreselect(menuitems, preselectedext) { - script.echo ("preselectext: ${preselectedext}") - def menuitemstemp = preselectedext.split(',') - script.echo ("Menuitemstemp: ${menuitemstemp}") - - for (menuitem in menuitemstemp) { - menuitems.add(menuitem.trim()) - } - } - - def String outputDescription(menuitems, releaseinfo) { - def meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") - } - } - - def String outputSelection(menuitems, releaseinfo) { - meta = releaseinfo.meta - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") - } - } + def ExtendedChoiceParameterDefinition multiselect PublishableItemsSelection(script, releasemeta, String preselectedext, String metalevelsstringext) { this.script = script @@ -83,6 +56,32 @@ class PublishableItemsSelection { ",") // String multiSelectDelimiter } + def outputSelectionfromPreselect(menuitems, preselectedext) { + script.echo ("preselectext: ${preselectedext}") + def menuitemstemp = preselectedext.split(',') + script.echo ("Menuitemstemp: ${menuitemstemp}") + + for (menuitem in menuitemstemp) { + menuitems.add(menuitem.trim()) + } + } + + def String outputDescription(menuitems, releaseinfo) { + def meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + } + } + + def String outputSelection(menuitems, releaseinfo) { + meta = releaseinfo.meta + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") + } + } + def multiSelect() { return multiselect } From 2456add31ac72e8c4e1cf925eacc0f6f7ca40ec6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:33:11 +0100 Subject: [PATCH 1192/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index a6b73f5..5f7e2c2 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -7,13 +7,15 @@ class PublishableItemsSelection { def ArrayList menuitemsfull def ExtendedChoiceParameterDefinition multiselect - PublishableItemsSelection(script, releasemeta, String preselectedext, String metalevelsstringext) { + PublishableItemsSelection(script) { this.script = script preselectedmenuitems = new ArrayList() - outputSelectionfromPreselect(preselectedmenuitems, preselectedext) menuitemdescriptions = new ArrayList() menuitemsfull = new ArrayList() + } + def init(releasemeta, String preselectedext, String metalevelsstringext) { + outputSelectionfromPreselect(preselectedmenuitems, preselectedext) def Integer metalevelsext = metalevelsstringext.toInteger() def metaitems = releasemeta.releasewalkerunique(metalevelsext) for (key in metaitems.keySet()) { @@ -88,7 +90,9 @@ class PublishableItemsSelection { } PublishableItemsSelection createItemSelector(releasemeta, String preselectedext, String metalevelsstringext) { - PublishableItemsSelection pis = new PublishableItemsSelection(this, releasemeta, preselectedext, metalevelsstringext) + PublishableItemsSelection pis = new PublishableItemsSelection(this) + + pis.init(releasemeta, preselectedext, metalevelsstringext) return pis } From 44d4744d68f5f20e550704e522384c7f508e0dc8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:39:49 +0100 Subject: [PATCH 1193/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 5f7e2c2..517e41d 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -64,23 +64,23 @@ class PublishableItemsSelection { script.echo ("Menuitemstemp: ${menuitemstemp}") for (menuitem in menuitemstemp) { - menuitems.add(menuitem.trim()) + menuitems.add(menuitem.trim()) } } - def String outputDescription(menuitems, releaseinfo) { + def outputDescription(menuitems, releaseinfo) { def meta = releaseinfo.meta for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") } } - def String outputSelection(menuitems, releaseinfo) { - meta = releaseinfo.meta + def outputSelection(menuitems, releaseinfo) { + def meta = releaseinfo.meta for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") + menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") } } From 5998729f0e9355d1a2a9ee3fcd7de38e2781ed72 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 18:49:14 +0100 Subject: [PATCH 1194/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 517e41d..c959292 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -23,11 +23,16 @@ class PublishableItemsSelection { outputDescription(menuitemdescriptions, releaseinfo) outputSelection(menuitemsfull, releaseinfo) } + + script.echo("menuitemsfull is: ${menuitemsfull}") + script.echo("preselectedmenuitems is: ${preselectedmenuitems}") + script.echo("menuitemdescriptions is: ${menuitemdescriptions}") + def seperator = "," multiselect = new ExtendedChoiceParameterDefinition( "name", // String name "PT_MULTI_SELECT", // String type - menuitemsfull, // String value + menuitemsfull.join(seperator), // String value "project name", // String projectName "", // String propertyFile "", // String groovyScript @@ -35,14 +40,14 @@ class PublishableItemsSelection { "", // String bindings "", // String groovyClasspath "", // String propertyKey - preselectedmenuitems, // String defaultValue + preselectedmenuitems.join(seperator),// String defaultValue "", // String defaultPropertyFile "", // String defaultGroovyScript "", // String defaultGroovyScriptFile "", // String defaultBindings "", // String defaultGroovyClasspath "", // String defaultPropertyKey - menuitemdescriptions, // String descriptionPropertyValue + menuitemdescriptions.join(seperator),// String descriptionPropertyValue "", // String descriptionPropertyFile "", // String descriptionGroovyScript "", // String descriptionGroovyScriptFile @@ -55,7 +60,7 @@ class PublishableItemsSelection { false, // boolean quoteValue 3, // int visibleItemCount "multiselect", // String description - ",") // String multiSelectDelimiter + seperator) // String multiSelectDelimiter } def outputSelectionfromPreselect(menuitems, preselectedext) { From 8db6e6a864d91423d440dd83bcc98092e49410c3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:02:41 +0100 Subject: [PATCH 1195/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 10 ++-------- publish/publishitems.groovy | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 4d921d9..e8182df 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -94,21 +94,15 @@ pipeline { itemsobject.multiSelect() ] ) - echo "Chosen software version is: ${release}" + echo "Chosen items are: ${selecteditems}" } } } - - - - - - stage('Publish components') { steps { script { def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, ITEMS_TO_PUBLISH, customer, release, MAX_META_DEPTH) + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, selecteditems, customer, release, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index c959292..6ee6392 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -31,7 +31,7 @@ class PublishableItemsSelection { multiselect = new ExtendedChoiceParameterDefinition( "name", // String name - "PT_MULTI_SELECT", // String type + "PT_CHECKBOX", // String type menuitemsfull.join(seperator), // String value "project name", // String projectName "", // String propertyFile @@ -58,7 +58,7 @@ class PublishableItemsSelection { "", // String javascript false, // boolean saveJSONParameterToFile false, // boolean quoteValue - 3, // int visibleItemCount + 100, // int visibleItemCount "multiselect", // String description seperator) // String multiSelectDelimiter } From c2f2a01bff1f914d37a4d5eac08932b38a0a92e0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:23:38 +0100 Subject: [PATCH 1196/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 8 ++++++-- publish/publishitems.groovy | 27 +++++++++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index e8182df..4919116 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -85,8 +85,12 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - ITEMSDEFAULTLIST = "sgfdfsdf,sdfsdfsdfsf" - def itemsobject = publishitems.createItemSelector(releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) + def itemsobject = publishitems.createItemSelector( + 'Select software items', + 'Print Server software items', + releasemeta, + ITEMSDEFAULTLIST, + MAX_META_DEPTH) def selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 6ee6392..5c33921 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -14,9 +14,17 @@ class PublishableItemsSelection { menuitemsfull = new ArrayList() } - def init(releasemeta, String preselectedext, String metalevelsstringext) { + def init( + String name, + String description, + releasemeta, + String preselectedext, + String metalevelsstringext, + String visibleItemCountExt, + String type) { outputSelectionfromPreselect(preselectedmenuitems, preselectedext) def Integer metalevelsext = metalevelsstringext.toInteger() + def Integer visibleItemCount = visibleItemCountExt.toInteger() def metaitems = releasemeta.releasewalkerunique(metalevelsext) for (key in metaitems.keySet()) { def releaseinfo = metaitems[key] @@ -30,7 +38,7 @@ class PublishableItemsSelection { def seperator = "," multiselect = new ExtendedChoiceParameterDefinition( - "name", // String name + name, // String name "PT_CHECKBOX", // String type menuitemsfull.join(seperator), // String value "project name", // String projectName @@ -58,8 +66,8 @@ class PublishableItemsSelection { "", // String javascript false, // boolean saveJSONParameterToFile false, // boolean quoteValue - 100, // int visibleItemCount - "multiselect", // String description + visibleItemCount, // int visibleItemCount + description, // String description seperator) // String multiSelectDelimiter } @@ -94,10 +102,17 @@ class PublishableItemsSelection { } } -PublishableItemsSelection createItemSelector(releasemeta, String preselectedext, String metalevelsstringext) { +PublishableItemsSelection createItemSelector( + String name, + String description, + releasemeta, + String preselectedext, + String metalevelsstringext, + String visibleItemCountExt = '100', + String type = 'PS_MULTI_SELECT') { // Could also be "PT_CHECKBOX" PublishableItemsSelection pis = new PublishableItemsSelection(this) - pis.init(releasemeta, preselectedext, metalevelsstringext) + pis.init(String name, String description, String visibleItemCountExt, releasemeta, preselectedext, metalevelsstringext) return pis } From eef4f7322c4c06e9501a0dd644e7540c963eaaa6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:28:27 +0100 Subject: [PATCH 1197/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 5c33921..6a99385 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -112,7 +112,7 @@ PublishableItemsSelection createItemSelector( String type = 'PS_MULTI_SELECT') { // Could also be "PT_CHECKBOX" PublishableItemsSelection pis = new PublishableItemsSelection(this) - pis.init(String name, String description, String visibleItemCountExt, releasemeta, preselectedext, metalevelsstringext) + pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type) return pis } From 8bddadda9c4f3ed9cc311ed666717bbd5aa9ff3c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:32:24 +0100 Subject: [PATCH 1198/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 6a99385..aa14c71 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -39,7 +39,7 @@ class PublishableItemsSelection { multiselect = new ExtendedChoiceParameterDefinition( name, // String name - "PT_CHECKBOX", // String type + type, // String type menuitemsfull.join(seperator), // String value "project name", // String projectName "", // String propertyFile From 6c0bd777490004baabfba4f4095282fde619aa05 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:43:01 +0100 Subject: [PATCH 1199/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 4 ++-- publish/publishitems.groovy | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 4919116..6186d49 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -56,7 +56,7 @@ pipeline { message: 'Please select the software version', ok: 'Ok', parameters: [ - choice(name: 'release', choices: releases, description: 'Which release?') + choice(name: 'release', choices: releases, description: 'Which software release?') ] ) echo "Chosen software version is: ${release}" @@ -91,7 +91,7 @@ pipeline { releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) - def selecteditems = input( + selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', parameters: [ diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index aa14c71..4510554 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -21,7 +21,7 @@ class PublishableItemsSelection { String preselectedext, String metalevelsstringext, String visibleItemCountExt, - String type) { + String controltype) { outputSelectionfromPreselect(preselectedmenuitems, preselectedext) def Integer metalevelsext = metalevelsstringext.toInteger() def Integer visibleItemCount = visibleItemCountExt.toInteger() @@ -32,14 +32,21 @@ class PublishableItemsSelection { outputSelection(menuitemsfull, releaseinfo) } + script.echo("name is: ${name}") + script.echo("description is: ${description}") script.echo("menuitemsfull is: ${menuitemsfull}") script.echo("preselectedmenuitems is: ${preselectedmenuitems}") script.echo("menuitemdescriptions is: ${menuitemdescriptions}") + script.echo("visibleItemCount is: ${visibleItemCount}") + script.echo("controltype is: ${controltype}") + def seperator = "," + visibleItemCount = min(visibleItemCount, menuitemsfull.size()) + script.echo("visibleItemCount is now: ${visibleItemCount}") multiselect = new ExtendedChoiceParameterDefinition( name, // String name - type, // String type + controltype, // String type menuitemsfull.join(seperator), // String value "project name", // String projectName "", // String propertyFile From 7abe9801c379eea33f95e8112a12927bfca31b74 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:47:53 +0100 Subject: [PATCH 1200/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 4510554..12c264b 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -41,7 +41,7 @@ class PublishableItemsSelection { script.echo("controltype is: ${controltype}") def seperator = "," - visibleItemCount = min(visibleItemCount, menuitemsfull.size()) + visibleItemCount = Math.min(visibleItemCount, menuitemsfull.size()) script.echo("visibleItemCount is now: ${visibleItemCount}") multiselect = new ExtendedChoiceParameterDefinition( From 40cfa28f21a419064bc625101974ea8565de2f2d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 19:58:16 +0100 Subject: [PATCH 1201/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/promptingpublish.groovy | 4 ++-- publish/publishitems.groovy | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 6186d49..1683876 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -86,8 +86,8 @@ pipeline { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") def itemsobject = publishitems.createItemSelector( - 'Select software items', - 'Print Server software items', + 'name', //'Select software items', + 'description', //'Print Server software items', releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 12c264b..ebf42d1 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -115,7 +115,7 @@ PublishableItemsSelection createItemSelector( releasemeta, String preselectedext, String metalevelsstringext, - String visibleItemCountExt = '100', + String visibleItemCountExt = '50', String type = 'PS_MULTI_SELECT') { // Could also be "PT_CHECKBOX" PublishableItemsSelection pis = new PublishableItemsSelection(this) From ebc1d6e3796f3c66628e0e2c4c92894b051b9215 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:01:43 +0100 Subject: [PATCH 1202/1971] GIS-1621 - Use script prompting to obtain publishing info from user --- publish/publishitems.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index ebf42d1..a8c1297 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -115,8 +115,8 @@ PublishableItemsSelection createItemSelector( releasemeta, String preselectedext, String metalevelsstringext, - String visibleItemCountExt = '50', - String type = 'PS_MULTI_SELECT') { // Could also be "PT_CHECKBOX" + String visibleItemCountExt = '20', + String type = 'PT_CHECKBOX') { // Could also be "PS_MULTI_SELECT" PublishableItemsSelection pis = new PublishableItemsSelection(this) pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type) From 1572be9a9124878526e3aa8b274b0ffe811afffd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:15:13 +0100 Subject: [PATCH 1203/1971] GIS-1621 - The PRODUCT_NAME variable is not necessarily defined --- publish/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/do.groovy b/publish/do.groovy index 18ec404..0ce6925 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -26,7 +26,7 @@ def productuniquefolder(releasemeta) { } def uniquereleasefolder(String softwarerelease, releasemeta) { - return "Software/${PRODUCT_NAME} ${softwarerelease}/${productuniquefolder(releasemeta)}" + return "Software/${softwarerelease}/${productuniquefolder(releasemeta)}" } def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) { From b85ff94505d339a6f52a81fe5557e6eef93d1e60 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:23:04 +0100 Subject: [PATCH 1204/1971] GIS-1621 - The PRODUCT_NAME variable is not necessarily defined --- publish/promptingpublish.groovy | 66 ++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 1683876..843a217 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -36,14 +36,16 @@ pipeline { script { hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") def List customers = hostedftb.getCustomerList() - customer = input( - message: 'Please select customer to publish to', - ok: 'Ok', - parameters: [ - choice(name: 'customer', choices: customers, description: 'Which customer?') - ] - ) - echo "Chosen customer is: ${customer}" + timeout(time: 10, unit: 'MINUTES') { + customer = input( + message: 'Please select customer to publish to', + ok: 'Ok', + parameters: [ + choice(name: 'customer', choices: customers, description: 'Which customer?') + ] + ) + echo "Chosen customer is: ${customer}" + } } } } @@ -52,14 +54,16 @@ pipeline { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def releases = gh.gettaglist(SOURCEDIR) - release = input( - message: 'Please select the software version', - ok: 'Ok', - parameters: [ - choice(name: 'release', choices: releases, description: 'Which software release?') - ] - ) - echo "Chosen software version is: ${release}" + timeout(time: 10, unit: 'MINUTES') { + release = input( + message: 'Please select the software version', + ok: 'Ok', + parameters: [ + choice(name: 'release', choices: releases, description: 'Which software release?') + ] + ) + echo "Chosen software version is: ${release}" + } } } } @@ -85,20 +89,22 @@ pipeline { steps { script { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") - def itemsobject = publishitems.createItemSelector( - 'name', //'Select software items', - 'description', //'Print Server software items', - releasemeta, - ITEMSDEFAULTLIST, - MAX_META_DEPTH) - selecteditems = input( - message: 'Select which items from the release are to be published', - ok: 'Ok', - parameters: [ - itemsobject.multiSelect() - ] - ) - echo "Chosen items are: ${selecteditems}" + timeout(time: 10, unit: 'MINUTES') { + def itemsobject = publishitems.createItemSelector( + 'name', //'Select software items', + 'description', //'Print Server software items', + releasemeta, + ITEMSDEFAULTLIST, + MAX_META_DEPTH) + selecteditems = input( + message: 'Select which items from the release are to be published', + ok: 'Ok', + parameters: [ + itemsobject.multiSelect() + ] + ) + echo "Chosen items are: ${selecteditems}" + } } } } From d1475e7619b5ad0256be8733908bcf00d1eb1dc5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:42:03 +0100 Subject: [PATCH 1205/1971] GIS-1621 - The PRODUCT_NAME variable is not necessarily defined; Use the top level product name instead --- publish/do.groovy | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 0ce6925..166a74b 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -25,12 +25,12 @@ def productuniquefolder(releasemeta) { return "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" } -def uniquereleasefolder(String softwarerelease, releasemeta) { - return "Software/${softwarerelease}/${productuniquefolder(releasemeta)}" +def uniquereleasefolder(String productline, String softwarerelease, releasemeta) { + return "Software/${productline} ${softwarerelease}/${productuniquefolder(releasemeta)}" } -def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) { - return "${releaserepofolder}/${uniquereleasefolder(softwarerelease, releasemeta)}" +def uniqueabsoluterreleasefolder(String productline, String releaserepofolder, String softwarerelease, releasemeta) { + return "${releaserepofolder}/${uniquereleasefolder(productline, softwarerelease, releasemeta)}" } def preconditions() { @@ -116,9 +116,9 @@ def copydirectory(File dirFrom, File dirTo) { } } -def recallcomponent(releaseinfo, String softwarerelease, itempathstopublish) { +def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) { def releasemeta = releaseinfo.meta - def String uniquefolderforrepo = uniqueabsoluterreleasefolder(releaserepofolder, softwarerelease, releasemeta) + def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta) summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") @@ -149,6 +149,7 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, resetfolders() preconditions() + def productline = releasemeta.productinfo.productname // Walk the meta information to a max depth, looking for artifacts to publish def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md) @@ -162,7 +163,7 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, def itempathstopublish = convertitemstopublish(itemstopublishstring) for (key in componentReleaseInfoVersionUnique.keySet()) { def releaseinfo = componentReleaseInfoVersionUnique[key] - recallcomponent(releaseinfo, softwarerelease, itempathstopublish) + recallcomponent(productline, releaseinfo, softwarerelease, itempathstopublish) } gh.stripgithistory(releaserepofolder) publish(customer) From d4e83fc00a40fed685734669f4371cac652d7060 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 20:56:14 +0100 Subject: [PATCH 1206/1971] GIS-1621 - Use one object to define hosted FTP site --- publish/do.groovy | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 166a74b..681c809 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -1,5 +1,7 @@ import groovy.io.FileType +hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") + markunstable = false unstablereason = "" @@ -88,15 +90,12 @@ def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { def publish(String customer, String finalreleaserepofolder = releaserepofolder) { summaryappend(" FTP operations: ") - def String FTP_CLIENT_LOCATION='ftp' - def String FTP_URL='ie1.hostedftp.com' - def String FTP_USER='ftp@globalinkjetsystems.com' - def String FTP_CUSTOMER_ROOT="/Customers/${customer}" - def String FTP_PASSWORD='ramshorn42' + def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() + def String ftproot = "${hostedftpsiteinfo.workingdirectory}${customer}" dir(finalreleaserepofolder) { - summaryappend("FTP operations: Transferring to ${FTP_CUSTOMER_ROOT}") + summaryappend("FTP operations: Transferring to ${ftproot}") sh """#!/bin/bash - ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" . + ncftpput -u ${hostedftpsiteinfo.username} -p ${hostedftpsiteinfo.password} -R ${hostedftpsiteinfo.url} "${ftproot}" . """ summaryappend(", Transferred ") } From 60c68622cdd5d95e432a864e338616143a401c0e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 22:56:43 +0100 Subject: [PATCH 1207/1971] GIS-1621 - Alter how hostedftpsite object is passed around - surtsey2 is crashing --- publish/do.groovy | 13 +++++-------- publish/promptingpublish.groovy | 3 ++- publish/publish.groovy | 4 +++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 681c809..1b227f4 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -1,7 +1,5 @@ import groovy.io.FileType -hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") - markunstable = false unstablereason = "" @@ -87,10 +85,9 @@ def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { } } -def publish(String customer, String finalreleaserepofolder = releaserepofolder) { +def publish(hostedftpsiteinfo, String customer, String finalreleaserepofolder = releaserepofolder) { summaryappend(" FTP operations: ") - def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() def String ftproot = "${hostedftpsiteinfo.workingdirectory}${customer}" dir(finalreleaserepofolder) { summaryappend("FTP operations: Transferring to ${ftproot}") @@ -143,7 +140,7 @@ def convertitemstopublish(String itemstopublishstring) { // Publish selected items from a release to the customer folder on the ftp site // itemstopublishstring is a comma-seperated set of strings in this format ## -def publishhierarchy(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { +def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { int md = maxdepth.toInteger() resetfolders() preconditions() @@ -165,13 +162,13 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer, recallcomponent(productline, releaseinfo, softwarerelease, itempathstopublish) } gh.stripgithistory(releaserepofolder) - publish(customer) + publish(hostedftpsiteinfo, customer) return [summarystring, markunstable, unstablereason] } -def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) { - return publishhierarchy(releasemeta, "", customer, softwarerelease, maxdepth) +def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) { + return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth) } return this; diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 843a217..3d3e114 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -112,7 +112,8 @@ pipeline { steps { script { def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, selecteditems, customer, release, MAX_META_DEPTH) + def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, selecteditems, customer, release, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' diff --git a/publish/publish.groovy b/publish/publish.groovy index b478a5d..5750275 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -44,7 +44,9 @@ pipeline { steps { script { def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") - (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, ITEMS_TO_PUBLISH, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH) + def hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy") + def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo() + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, ITEMS_TO_PUBLISH, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' From ebce149ada00f422efe4c81d888d6d3737898835 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 23:06:50 +0100 Subject: [PATCH 1208/1971] GIS-1621 - Alter name of dialog --- publish/promptingpublish.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 3d3e114..500c609 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -91,8 +91,8 @@ pipeline { publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy") timeout(time: 10, unit: 'MINUTES') { def itemsobject = publishitems.createItemSelector( - 'name', //'Select software items', - 'description', //'Print Server software items', + 'Select software items', + 'Print Server software items', releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH) From 512279a5f1d7971a84bb9f6a0d0084deec529d1c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 23:14:42 +0100 Subject: [PATCH 1209/1971] GIS-1621 - Alter name of dialog --- publish/promptingpublish.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 500c609..47f1e9e 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -95,7 +95,9 @@ pipeline { 'Print Server software items', releasemeta, ITEMSDEFAULTLIST, - MAX_META_DEPTH) + MAX_META_DEPTH, + '20', + 'PS_MULTI_SELECT') selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', From af39d5d8f91c2af23458d8cdc963df45e43f3d2c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 23:18:21 +0100 Subject: [PATCH 1210/1971] GIS-1621 - Alter name of dialog --- publish/promptingpublish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 47f1e9e..c9138b0 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -97,7 +97,7 @@ pipeline { ITEMSDEFAULTLIST, MAX_META_DEPTH, '20', - 'PS_MULTI_SELECT') + 'PT_MULTI_SELECT') selecteditems = input( message: 'Select which items from the release are to be published', ok: 'Ok', From fec34dd485dd37aa8f8d062f6676e32ac640a4ec Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 15 Sep 2019 23:19:02 +0100 Subject: [PATCH 1211/1971] GIS-1621 - Alter name of dialog --- publish/publishitems.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index a8c1297..d84123d 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -116,7 +116,7 @@ PublishableItemsSelection createItemSelector( String preselectedext, String metalevelsstringext, String visibleItemCountExt = '20', - String type = 'PT_CHECKBOX') { // Could also be "PS_MULTI_SELECT" + String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT" PublishableItemsSelection pis = new PublishableItemsSelection(this) pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type) From a30a23d3c2ae1ea6608a50e075d6ad735c4b2699 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 16 Sep 2019 16:35:31 +0100 Subject: [PATCH 1212/1971] GIS-1621 - Remove reference to a product in the common area --- publish/promptingpublish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index c9138b0..ced73a2 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -92,7 +92,7 @@ pipeline { timeout(time: 10, unit: 'MINUTES') { def itemsobject = publishitems.createItemSelector( 'Select software items', - 'Print Server software items', + 'Software items', releasemeta, ITEMSDEFAULTLIST, MAX_META_DEPTH, From 2056fd98334dfadbf0870286341851f0e50bd974 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 17 Sep 2019 22:58:28 +0100 Subject: [PATCH 1213/1971] HMBFDHV-12 - Check that files are produced even though they won't be exported --- 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 63c8d45..888ad1e 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -40,7 +40,7 @@ def doCheck(checkpathlist, build_variant = "") { // Print out dependencies of the built file echo "Showing dependencies of ${srcFileExpanded}" result = sh( script: """ - readelf -d "${srcFileExpanded}" | grep NEEDED + readelf -d "${srcFileExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true From 8be8e36ddf2cb9b70fc1284182e77446ff137b87 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Sep 2019 17:39:28 +0100 Subject: [PATCH 1214/1971] SMB-296 - Print out packaging commands --- packaging/debian.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 6c7e006..2ef1ba8 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -64,7 +64,7 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p try { sh """#!/bin/bash # Exit if any command fails - set -e + set -xe echo "${password}" | sudo -S echo From 9282feb36dedac15d6cfb22cb2eb506a1b7dce49 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Oct 2019 13:24:01 +0100 Subject: [PATCH 1215/1971] Add VS2017 installation configuration --- .../vs2017install/buildmachines.vsconfig | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tool configurations/vs2017install/buildmachines.vsconfig diff --git a/tool configurations/vs2017install/buildmachines.vsconfig b/tool configurations/vs2017install/buildmachines.vsconfig new file mode 100644 index 0000000..ea618a3 --- /dev/null +++ b/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 From b32a5116dd657f59b30ef079c6bc9c1056833796 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Oct 2019 16:18:19 +0100 Subject: [PATCH 1216/1971] GIS-1621 - Remove local diffing (superceded); Add as much git info to a meta object when it is not being provided - for old jobs not providing meta information --- configuration/configuration.groovy | 2 +- differences/do.groovy | 18 ------------------ import/importer.groovy | 4 ++-- meta/folder.groovy | 25 ++----------------------- 4 files changed, 5 insertions(+), 44 deletions(-) delete mode 100644 differences/do.groovy diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index b8c0b47..2a7f1ab 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -5,7 +5,7 @@ def registerConfigurationInfo(meta, String configurationName, String configurati } def registerPipelineScriptConfiguration(meta) { - registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}")) + registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo(autobuilder.getautobuildpath())) } def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') { diff --git a/differences/do.groovy b/differences/do.groovy deleted file mode 100644 index 32f18b5..0000000 --- a/differences/do.groovy +++ /dev/null @@ -1,18 +0,0 @@ - -def differences(meta, String sourcerevision, String previoussourcerevision, String sourcepath) { - def String cs = autobuilder.commonscripts() - def String difffile = meta.difffilepath() - def String jirakey = meta.productinfo.jirakey - if (isUnix()) { - sh """ - "${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}" - """ - } - else { - bat """ - "${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}" - """ - } -} - -return this; diff --git a/import/importer.groovy b/import/importer.groovy index ba5eb0b..78c0d62 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -51,7 +51,7 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) - def importedmeta = meta.importrelated(destpath) + def importedmeta = meta.importrelated(destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) relatedimportinfo = importedmeta.getassociated() echo "Cloning associated repos" @@ -90,7 +90,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) - def importedmeta = meta.importrelated(destpath) + def importedmeta = meta.importrelated(destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) gh.stripgithistory(destpath) def metafilepath = "${destpath}/${meta.metafilepath()}" diff --git a/meta/folder.groovy b/meta/folder.groovy index 6967def..6371f38 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -429,11 +429,8 @@ class PublishableInfo extends GISJsonSerialised { class MetaInfo extends GISJsonSerialised { private static String FORMAT = "0.1" private static String METAFOLDERNAME = "meta" - private static String DIFFFOLDERNAME = "diff" private static String METAFILENAME = "info.json" - private static String METADIFFFILENAME = "differences.txt" private static String METAARTIFACTS = "${METAFOLDERNAME}/**" - private static String DIFFARTIFACTS = "${DIFFFOLDERNAME}/**" class RelatedMetaInfo extends GISJsonSerialised { String offsetpath @@ -607,11 +604,7 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME + "/" + METAFILENAME } - static String difffilepath() { - return DIFFFOLDERNAME + "/" + METADIFFFILENAME - } - - MetaInfo importrelated(String destpath) { + MetaInfo importrelated(String destpath, String givenRepo = 'Unknown', String givenRevision = 'Unknown', String givenSHA = 'Unknown') { MetaInfo mi = new MetaInfo(script) def String adjustedpath = relativize(destpath) @@ -620,22 +613,12 @@ class MetaInfo extends GISJsonSerialised { 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) associatedmeta.add(rmi) - def importedmetadifffile = adjustedpath + "/" + difffilepath() - if (script.fileExists(importedmetadifffile)) { - def String newcontents = script.readFile(file: importedmetadifffile) - def String currentcontents = "" - if (script.fileExists(difffilepath())) { - currentcontents = script.readFile(file: difffilepath()) - } - - script.writeFile(file: difffilepath(), text: currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents) - } - return mi } @@ -660,10 +643,6 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME } - static String difffolder() { - return DIFFFOLDERNAME - } - 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}" From f6a55441cf4edca1b789332df255a59ae3979843 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Oct 2019 16:20:57 +0100 Subject: [PATCH 1217/1971] GIS-1621 - Remove local diffing (superceded); Add as much git info to a meta object when it is not being provided - for old jobs not providing meta information --- meta/folder.groovy | 4 ---- 1 file changed, 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 6371f38..2e142a2 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -756,10 +756,6 @@ MetaInfo metareset(script) { deleteDir() } - dir(mi.difffolder()) { - deleteDir() - } - return mi } From a13f11435b7dec72fe8a98a2838b6995ec890f5a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Oct 2019 16:59:55 +0100 Subject: [PATCH 1218/1971] GIS-1621 - Remove local diffing (superceded); Add as much git info to a meta object when it is not being provided - for old jobs not providing meta information --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2e142a2..e5f34f0 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -647,7 +647,7 @@ class MetaInfo extends GISJsonSerialised { ArrayList releasedfromsubmeta = new ArrayList(), // These items are not recorded in meta as released from here String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}" ) { - def String artifactlist = "${METAARTIFACTS},${DIFFARTIFACTS}" + def String artifactlist = METAARTIFACTS releaseinfo.addReleaseItem(METAARTIFACTS) for (releaseitem in releasedfromhere) { artifactlist += "," + releaseitem From c2582fe710abe4d307c5fde5eb17f02a4a6cfd67 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 28 Oct 2019 11:53:49 +0000 Subject: [PATCH 1219/1971] Updated scripts to refer to SI1536 head. --- differences/show_release_differences.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py index 5c0f15d..2b7f589 100644 --- a/differences/show_release_differences.py +++ b/differences/show_release_differences.py @@ -83,6 +83,9 @@ jiraprojectpattern = { 'HMBFDGMA': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Gg][Mm][Aa][ _-]*|\#\s*)(\d+):*(.*)$"), re.compile('^(\S*) Revert " *HMBFDGMA-(\d+):* (.*)"$'), ), + 'HMBSI1536': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ss][Ii]1536[ _-]*|\#\s*)(\d+):*(.*)$"), + re.compile('^(\S*) Revert " *HMBSI1536-(\d+):* (.*)"$'), + ), } mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") From d0ed9310fc8502e8153cc8277341f734368c620c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Nov 2019 09:11:10 +0000 Subject: [PATCH 1220/1971] GIS-1621 - Be selective with releases - don't show those with tags beginning with erroneous_ superceded_ faulty_ inmainline_ unless SHOWALL parameter is true --- publish/promptingpublish.groovy | 16 +++++++++++++++- publish/publishitems.groovy | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index ced73a2..670501d 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -53,7 +53,21 @@ pipeline { steps { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - def releases = gh.gettaglist(SOURCEDIR) + def allreleases = gh.gettaglist(SOURCEDIR) + showall = SHOWALL ?: 'false' + def releases + if (showall) { + releases = allreleases + } else { + for (release in allreleases) { + if (!release.toLowerCase().startsWith("superceded_") && + !release.toLowerCase().startsWith("erroneous_") && + !release.toLowerCase().startsWith("faulty_") && + !release.toLowerCase().startsWith("inmainline_")) { + releases.append(release) + } + } + } timeout(time: 10, unit: 'MINUTES') { release = input( message: 'Please select the software version', diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index d84123d..677970e 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -124,4 +124,4 @@ PublishableItemsSelection createItemSelector( return pis } -return this; \ No newline at end of file +return this; From 1f55e79acfa5989183c409e7e6d8f60ee96ed57b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Nov 2019 09:22:23 +0000 Subject: [PATCH 1221/1971] GIS-1621 - Be selective with releases - don't show those with tags beginning with erroneous_ superceded_ faulty_ inmainline_ unless SHOWALL parameter is true --- publish/promptingpublish.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 670501d..fb312f0 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -63,6 +63,7 @@ pipeline { if (!release.toLowerCase().startsWith("superceded_") && !release.toLowerCase().startsWith("erroneous_") && !release.toLowerCase().startsWith("faulty_") && + !release.toLowerCase().startsWith("ignore_") && !release.toLowerCase().startsWith("inmainline_")) { releases.append(release) } From fc3d611c844ed2219061aae4d2fd4b5cde7f2398 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Nov 2019 09:45:09 +0000 Subject: [PATCH 1222/1971] GIS-1621 - Be selective with releases - don't show those with tags beginning with erroneous_ superceded_ faulty_ inmainline_ unless SHOWALL parameter is true --- publish/promptingpublish.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index fb312f0..6950754 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -55,11 +55,13 @@ pipeline { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def allreleases = gh.gettaglist(SOURCEDIR) showall = SHOWALL ?: 'false' + echo("showall: ${showall} ${SHOWALL}") def releases if (showall) { releases = allreleases } else { for (release in allreleases) { + echo("Evaluating: |${release}|") if (!release.toLowerCase().startsWith("superceded_") && !release.toLowerCase().startsWith("erroneous_") && !release.toLowerCase().startsWith("faulty_") && From 6ce20315af1d097c90e5bbfbfe51c6e1192c1520 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Nov 2019 09:47:59 +0000 Subject: [PATCH 1223/1971] GIS-1621 - Be selective with releases - don't show those with tags beginning with erroneous_ superceded_ faulty_ inmainline_ unless SHOWALL parameter is true --- publish/promptingpublish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 6950754..80dc633 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -54,7 +54,7 @@ pipeline { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def allreleases = gh.gettaglist(SOURCEDIR) - showall = SHOWALL ?: 'false' + boolean showall = (SHOWALL == 'true') echo("showall: ${showall} ${SHOWALL}") def releases if (showall) { From 1bd181cd0b3f0ca44d0d61f67c7b73c08e335d5b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Nov 2019 09:50:30 +0000 Subject: [PATCH 1224/1971] GIS-1621 - Be selective with releases - don't show those with tags beginning with erroneous_ superceded_ faulty_ inmainline_ unless SHOWALL parameter is true --- publish/promptingpublish.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 80dc633..bf95bb2 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -55,8 +55,7 @@ pipeline { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def allreleases = gh.gettaglist(SOURCEDIR) boolean showall = (SHOWALL == 'true') - echo("showall: ${showall} ${SHOWALL}") - def releases + def releases = new ArrayList() if (showall) { releases = allreleases } else { From 3e27e84050ddd73e8b852970a23c4b6a034962da Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Nov 2019 09:53:52 +0000 Subject: [PATCH 1225/1971] GIS-1621 - Be selective with releases - don't show those with tags beginning with erroneous_ superceded_ faulty_ inmainline_ unless SHOWALL parameter is true --- publish/promptingpublish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index bf95bb2..d8d5303 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -66,7 +66,7 @@ pipeline { !release.toLowerCase().startsWith("faulty_") && !release.toLowerCase().startsWith("ignore_") && !release.toLowerCase().startsWith("inmainline_")) { - releases.append(release) + releases.add(release) } } } From d5ab89e81edbc4d984bebcc026ec7a1b67d1b703 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Nov 2019 09:55:55 +0000 Subject: [PATCH 1226/1971] GIS-1621 - Be selective with releases - don't show those with tags beginning with erroneous_ superceded_ faulty_ inmainline_ unless SHOWALL parameter is true --- publish/promptingpublish.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index d8d5303..f2372cd 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -60,7 +60,6 @@ pipeline { releases = allreleases } else { for (release in allreleases) { - echo("Evaluating: |${release}|") if (!release.toLowerCase().startsWith("superceded_") && !release.toLowerCase().startsWith("erroneous_") && !release.toLowerCase().startsWith("faulty_") && From 15f4c4acd3800602327f91f082cb08653e6b0c08 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 7 Nov 2019 17:39:56 +0000 Subject: [PATCH 1227/1971] GIS-1621 - Add some output to debug why configuration information is not being added to imported logic meta --- import/importer.groovy | 4 ++-- meta/folder.groovy | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 78c0d62..25b2614 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -85,7 +85,7 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { def rooturl = repo.trim() def rootrevision = revision.trim() - echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" + echo "Cloning release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) @@ -94,7 +94,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, gh.stripgithistory(destpath) def metafilepath = "${destpath}/${meta.metafilepath()}" - echo "Marking root meta as released and rewriting meta file: ${metafilepath}" + echo "Marking meta as released and rewriting meta file: ${metafilepath}" rewritemetafileasreleased(importedmeta, metafilepath) if (incrementversionnumber) { diff --git a/meta/folder.groovy b/meta/folder.groovy index e5f34f0..40f03aa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -511,6 +511,7 @@ class MetaInfo extends GISJsonSerialised { 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) } From a006c13b6280e72626dad107020906361787383e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 8 Nov 2019 17:44:18 +0000 Subject: [PATCH 1228/1971] GIS-1621 - Debug release filtering --- publish/promptingpublish.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index f2372cd..6f0a6a5 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -54,17 +54,20 @@ pipeline { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def allreleases = gh.gettaglist(SOURCEDIR) - boolean showall = (SHOWALL == 'true') + boolean filterredundantreleases = (FILTER_REDUNDANT_RELEASES == 'true') def releases = new ArrayList() - if (showall) { + if (!filterredundantreleases) { + 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) } } From 29bd0eafc6d2df94d8d5d9e6cd9a372bbb5d11af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 9 Nov 2019 00:41:41 +0000 Subject: [PATCH 1229/1971] GIS-1621 - Show origin just before pushing tags --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index 1b21bcf..ee1bdf5 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -274,6 +274,7 @@ def releasegitpush(String dryrunpush ) { } def sourcegitpush(String dryrunpush ) { + sh("git remote -v") if (dryrunpush == "true") { sh("git push -n --tags") summaryappend(",Src-Dry-Run-Push") From 4e45329fe1c127ee158757295f45f97823bdadae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 9 Nov 2019 07:58:41 +0000 Subject: [PATCH 1230/1971] GIS-1621 - Show origin just before pushing tags --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index ee1bdf5..a9f0a3e 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -262,6 +262,7 @@ def sourcegittags(String buildsha, List taglist) { } def releasegitpush(String dryrunpush ) { + sh("git remote -v") if (dryrunpush == "true") { sh("git push -n --tags origin master") summaryappend(",Dry-Run-Push") From da6b830e8cc068a105ac89e3cb5905ee16fc16c4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 9 Nov 2019 08:03:23 +0000 Subject: [PATCH 1231/1971] GIS-1621 - Debug release filtering --- publish/promptingpublish.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 6f0a6a5..29e9bfd 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -62,11 +62,11 @@ pipeline { } 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_")) { + 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) } From 6b5490069869ca03c4284a2eaa1e39b7574a9558 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 9 Nov 2019 08:08:42 +0000 Subject: [PATCH 1232/1971] GIS-1621 - Debug release filtering --- publish/promptingpublish.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 29e9bfd..80305ab 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -69,6 +69,8 @@ pipeline { !release.toLowerCase().startsWith("inmainline")) { echo("Showing release: ${release}") releases.add(release) + } else { + echo("Not showing release: ${release}") } } } From f64c71e0cd54074f5f941a465619712ed52e547c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 9 Nov 2019 08:53:13 +0000 Subject: [PATCH 1233/1971] GIS-1621 - Remove publish filter debug log --- publish/promptingpublish.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 80305ab..c0e4837 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -54,9 +54,9 @@ pipeline { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def allreleases = gh.gettaglist(SOURCEDIR) - boolean filterredundantreleases = (FILTER_REDUNDANT_RELEASES == 'true') + boolean filterredundantreleases = def releases = new ArrayList() - if (!filterredundantreleases) { + if (FILTER_REDUNDANT_RELEASES == 'false') { echo("Showing all releases") releases = allreleases } else { @@ -67,10 +67,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 0958de510814aa41340c8edf15d37d03e3f26ed3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 9 Nov 2019 09:16:06 +0000 Subject: [PATCH 1234/1971] GIS-1621 - Remove publish filter debug log --- publish/promptingpublish.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index c0e4837..9f2d7dc 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -54,7 +54,6 @@ pipeline { script { gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def allreleases = gh.gettaglist(SOURCEDIR) - boolean filterredundantreleases = def releases = new ArrayList() if (FILTER_REDUNDANT_RELEASES == 'false') { echo("Showing all releases") From 6a2df6c31c33851f13d694425f2c4f97f66cb5aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 28 Nov 2019 09:11:52 +0000 Subject: [PATCH 1235/1971] Increase build timeout - which is now tripping on longer builds --- 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 888ad1e..3e58e4f 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -156,7 +156,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { + timeout(time: 20, unit: 'MINUTES') { if (isUnix()) { sh """ echo Start time: `date` From c38b0dc2d061d837aa2164d91e3c9144a8c1a523 Mon Sep 17 00:00:00 2001 From: "george.linsdell" Date: Mon, 2 Dec 2019 15:40:29 +0000 Subject: [PATCH 1236/1971] Checkout python and use it to run the collation step --- meta/folder.groovy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 40f03aa..474e756 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -19,6 +19,26 @@ abstract class GISJsonSerialised implements Serializable { } } +class TestInfo extends GISJsonSerialised{ + String buildjobname + int buildnumber + + TestInfo(script) { + super(script) + script.echo("Initializing Test Info Object") + } + + void setInfoFromFile(String filepath){ + script.echo("TestInfo: Deserialising JSON at file: ${filepath}") + def rawmeta = script.readJSON(file: filepath) + deserialiseJson(rawmeta) + } + + void deserialiseJson(rawmeta) { + TestInfo = rawmeta['TestInfo'] + } +} + class ProductInfo extends GISJsonSerialised { String productname String subcomponentname From 43642b3b58fecb1946b0b266cfecad8da4543a6e Mon Sep 17 00:00:00 2001 From: "george.linsdell" Date: Mon, 2 Dec 2019 15:43:24 +0000 Subject: [PATCH 1237/1971] revert prmature change --- meta/folder.groovy | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 474e756..40f03aa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -19,26 +19,6 @@ abstract class GISJsonSerialised implements Serializable { } } -class TestInfo extends GISJsonSerialised{ - String buildjobname - int buildnumber - - TestInfo(script) { - super(script) - script.echo("Initializing Test Info Object") - } - - void setInfoFromFile(String filepath){ - script.echo("TestInfo: Deserialising JSON at file: ${filepath}") - def rawmeta = script.readJSON(file: filepath) - deserialiseJson(rawmeta) - } - - void deserialiseJson(rawmeta) { - TestInfo = rawmeta['TestInfo'] - } -} - class ProductInfo extends GISJsonSerialised { String productname String subcomponentname From 24c4df35abda438d2da67cc95029d484ed367a08 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 4 Dec 2019 22:51:52 +0000 Subject: [PATCH 1238/1971] HMBXR5601-186 - Replace original init image generation with latest; Lose redundant partitions from image --- versionnumbering/generate.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 2e4f60d..de60b66 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -159,4 +159,11 @@ String generate(meta, String sourcerevision, String sourcepath, String basebuild 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 From 7bc58a493dc7afc2da3ad6f3b450c52dce3e944b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 6 Dec 2019 17:48:05 +0000 Subject: [PATCH 1239/1971] GIS-1621 - Add a title to each report --- differences/dometahierarchy.groovy | 54 ++++++++++++++++++------------ 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 11b3733..e4095af 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -405,9 +405,9 @@ class MergeReportRecord { } } -def mergereport(String reportsubfolder, LinkedHashMap merges, boolean iscomponent = true) { +def mergereport(String reportsubfolder, String title, LinkedHashMap merges, boolean iscomponent = true) { dir(reportsubfolder) { - def String mergelist = "Merge list:\n" + def String mergelist = "${title}\nMerge list:\n" def mergessorted = merges.sort() for (amerge in mergessorted) { def MergeReportRecord m = amerge.value @@ -439,9 +439,9 @@ class RevertsReportRecord { } } -def revertsreport(String reportsubfolder, LinkedHashMap reverts, boolean iscomponent = true) { +def revertsreport(String reportsubfolder, String title, LinkedHashMap reverts, boolean iscomponent = true) { dir(reportsubfolder) { - def String revertlist = "Revert list:\n" + def String revertlist = "${title}\nRevert list:\n" def revertssorted = reverts.sort() for (arevert in revertssorted) { def RevertsReportRecord r = arevert.value @@ -470,9 +470,9 @@ class TicketedReportRecord { } } -def ticketedreport(String reportsubfolder, LinkedHashMap ticketed, boolean iscomponent = true) { +def ticketedreport(String reportsubfolder, String title, LinkedHashMap ticketed, boolean iscomponent = true) { dir(reportsubfolder) { - def String ticketedlist = "Ticketed list:\n" + def String ticketedlist = "${title}\nTicketed list:\n" def ticketedsorted = ticketed.sort() for (aticketed in ticketedsorted) { def TicketedReportRecord r = aticketed.value @@ -499,9 +499,9 @@ class UnticketedReportRecord { } } -def unticketedreport(String reportsubfolder, LinkedHashMap unticketed, boolean iscomponent = true) { +def unticketedreport(String reportsubfolder, String title, LinkedHashMap unticketed, boolean iscomponent = true) { dir(reportsubfolder) { - def String unticketedlist = "Unticketed list:\n" + def String unticketedlist = "${title}\nUnticketed list:\n" def unticketedsorted = unticketed.sort() for (anunticketed in unticketedsorted) { UnticketedReportRecord u = anunticketed.value @@ -523,9 +523,9 @@ class TicketsReportRecord { } } -def ticketsreport(String reportsubfolder, tickets, boolean iscomponent = true) { +def ticketsreport(String reportsubfolder, String title, tickets, boolean iscomponent = true) { dir(reportsubfolder) { - String ticketlist = "Ticket list:\n" + String ticketlist = "${title}\nTicket list:\n" ticketssorted = tickets.sort() for (ticketnumber in ticketssorted) { TicketsReportRecord t = ticketnumber.value @@ -535,9 +535,9 @@ def ticketsreport(String reportsubfolder, tickets, boolean iscomponent = true) { } } -def differencerecordsreport(String reportsubfolder, differencerecords, boolean iscomponent = true) { +def differencerecordsreport(String reportsubfolder, String title, differencerecords, boolean iscomponent = true) { dir(reportsubfolder) { - String recordlist = "" + String recordlist = "${title}\n" for (dr in differencerecords) { recordlist += dr.dump() + "\n\n" } @@ -545,7 +545,7 @@ def differencerecordsreport(String reportsubfolder, differencerecords, boolean i } } -def boolean report(meta, differencerecords, boolean iscomponent = true) { +def boolean report(meta, title, differencerecords, boolean iscomponent = true) { def Map ticketed = [:] def Map merges = [:] def Map reverts = [:] @@ -664,12 +664,24 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) { } else { reportsubfolder = "${reportfolder}/Combined" } - mergereport(reportsubfolder, merges, iscomponent) - revertsreport(reportsubfolder, reverts, iscomponent) - ticketedreport(reportsubfolder, ticketed, iscomponent) - unticketedreport(reportsubfolder, unticketed, iscomponent) - ticketsreport(reportsubfolder, tickets, iscomponent) - differencerecordsreport(reportsubfolder, differencerecords, iscomponent) + mergereport(reportsubfolder, title, merges, 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) +} + +String 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) { @@ -690,7 +702,7 @@ def compare(earlymetaitems, latermetaitems, key) { (result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo) summaryappend(" Items: ${differencerecords.size()} ") - report(earlymeta, differencerecords) + report(earlymeta, title(earlymeta, latermeta), differencerecords) } else { summaryappend(" No source repo ") } @@ -737,7 +749,7 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin summaryappend("\n") } } - report(meta, differencerecords, false) + report(meta, title(earlymeta, latermeta), differencerecords, false) return [summarystring, markunstable, unstablereason] } From d2a31e9baffe4e4d9c3493f7bec2e30d6b97da18 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 6 Dec 2019 17:50:17 +0000 Subject: [PATCH 1240/1971] GIS-1621 - Add a title to each report --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index e4095af..2e94820 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -672,7 +672,7 @@ def boolean report(meta, title, differencerecords, boolean iscomponent = true) { differencerecordsreport(reportsubfolder, title, differencerecords, iscomponent) } -String def title(earlymeta, latermeta) { +def title(earlymeta, latermeta) { return """ Differences in: Product: ${earlymeta.productinfo.productname} Subcomponent: ${earlymeta.productinfo.subcomponentname} From 958ad765d03041dbe18bf4e80b1697bdeddb7aa3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 12 Dec 2019 11:32:56 +0000 Subject: [PATCH 1241/1971] GIS-1621 - Handle FD1200 embedded software building --- import/importer.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/import/importer.groovy b/import/importer.groovy index 25b2614..a8b64f5 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -106,6 +106,7 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false, boolean nested = false) { switch (source) { case "Jenkins job artifact": + case "Jenkins job artefact": return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) case "Release repository": if (nested) { From 21c59682a1976ee78a41222bdbcbdd27be736866 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 13 Dec 2019 14:32:32 +0000 Subject: [PATCH 1242/1971] GIS-1621 - Make an ESW copier job script --- copy/esw.groovy | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 copy/esw.groovy diff --git a/copy/esw.groovy b/copy/esw.groovy new file mode 100644 index 0000000..2a63171 --- /dev/null +++ b/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 From 2241c0c982e1b9a5a36fbd2660b8f9de99bc4631 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 17 Dec 2019 18:38:57 +0000 Subject: [PATCH 1243/1971] GIS-1621 - Allow logic copies from repositories --- copy/logic.groovy | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 4b3d521..8c82d02 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -5,16 +5,18 @@ pipeline { 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 = [ - "${WORKSPACE}/logic", + LOGICDEST, "${WORKSPACE}/embedded_logic", - "${WORKSPACE}/diff", // Some old artifacts have this folder ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -24,11 +26,7 @@ pipeline { stage('Copying logic artifacts') { steps { script { - env.LOGICDEST = "${WORKSPACE}/logic" - if (LOGIC_ARTIFACT_LOCATION == "Jenkins job artifact") { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - importer.artifactimport(meta, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGICDEST) - } + importer.artifactimport(meta, LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_RELEASE_REPO, LOGIC _RELEASE_REVISION, LOGICDEST) } } } @@ -37,7 +35,6 @@ pipeline { script { def artifactlist = meta.generateartifacts(["embedded_logic/**"]) sh """ - rm -v -rf diff rm -v -rf meta mv -v "logic"/* . """ From d0f9244af4c83124b338a54c8ac36ece48973290 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 17 Dec 2019 18:43:14 +0000 Subject: [PATCH 1244/1971] GIS-1621 - Allow logic copies from repositories --- copy/logic.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 8c82d02..4d5291c 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -26,7 +26,7 @@ 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) + importer.artifactimport(meta, LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_RELEASE_REPO, LOGIC_RELEASE_REVISION, LOGICDEST) } } } From 0ea84ea80eaa0427f39b6a8e067bd194d66516e0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 19 Dec 2019 08:57:51 +0000 Subject: [PATCH 1245/1971] GIS-1621 - Correct script --- staticanalysis/ccm.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 93e4711..865e5fa 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -66,7 +66,7 @@ pipeline { 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 {} \; + 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 """ From 83e8b67ca601e874fe2c7abad5debc9351c5a347 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:04:34 +0000 Subject: [PATCH 1246/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 218 +++++++++++++++++++++++++++++++++-------- 1 file changed, 179 insertions(+), 39 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index a8b64f5..666f389 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,36 +1,122 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") -def artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { - copyArtifacts( - filter: filter, - excludes: excludes, - fingerprintArtifacts: fingerprint, - projectName: jenkinsjob.trim(), - selector: specific(buildnumber.toString()), - target: destpath - ) - def importedmeta = meta.importrelated(destpath) - if (incrementversionnumber) { - meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) +class ImportOptions { + def script // Script to use if wanting to execute script commands (eg. echo -> script.echo) + + boolean incrementversionnumber // If true, increment the parent's (4th) version number with the (4th) version number of this object being imported + String filter // Only import files/paths/folders that match the filter + String excludes // Exclude files/paths/folders that match the exclude filter + boolean fingerprint // Do Jenkins fingerprinting on imported artifacts + boolean nested // Import all child artifacts too (identified in the related meta info + boolean appendtoparentmeta // Append to parent meta + String source // Where are the artifacts coming from + + String jenkinsjob + def buildnumberorselector + + String repo + String revision + + ImportOptions(script, + String source = 'Jenkins job artifact' + boolean incrementversionnumber = true, + String filter = '', + String excludes = '', + boolean fingerprint = false, + boolean nested = false, + appendtoparentmeta = true) { + this.script = script + setsource(source) + setIncrementVersionNumber(incrementversionnumber) + setfilter(filter) + setexcludes(excludes) + setfingerprint(fingerprint) + setnested(nested) + setappendtoparentmeta(appendtoparentmeta) + } + + setsource(String source) { + source = source.trim() + switch (source) { + case 'Jenkins job artefact': + this.source = 'Jenkins job artifact' + break + case 'Jenkins job artifact': + case 'Release repository': + this.source = source + break + default: + error("Unknown type of artifact source: ${source}") + } + } + + setIncrementVersionNumber(boolean incrementversionnumber) { + this.incrementversionnumber = incrementversionnumber + } + + setfilter(String filter) { + this.filter = filter.trim() + } + + setexcludes(String excludes) { + this.excludes = excludes.trim() + } + + setfingerprint(boolean fingerprint) { + this.fingerprint = fingerprint + } + + setnested(boolean nested) { + this.nested = nested + } + + setappendtoparentmeta(boolean appendtoparentmeta) { + this.appendtoparentmeta = appendtoparentmeta + } + + jenkinsjob(String jenkinsjob, buildnumberorselector) { + this.jenkinsjob = jenkinsjob.trim() + this.buildnumberorselector = buildnumberorselector.trim() + setsource('Jenkins job artifact') + } + + releaserepo(String repo, String revision) { + this.repo = repo.trim() + this.revision = revision.trim() + setsource('Release repository') + } + + source(String source, String jenkinsjob, buildnumberorselector, String repo, String revision) { + jenkinsjob(String jenkinsjob, buildnumberorselector) + releaserepo(String repo, String revision) + setsource(source) } - return importedmeta } -def artifactimport(meta, String jenkinsjob, String buildselector, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { +ImportOptions getNewImportOptions(script) { + return new ImportOptions(script) +} + +def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpath) { + if (importoptions.source != 'Jenkins job artifact') { + error("Import options settings have not been set for: Jenkins job artifact") + return + } + copyArtifacts( - filter: filter, - excludes: excludes, + filter: importoptions.filter, + excludes: importoptions.excludes, fingerprintArtifacts: fingerprint, - projectName: jenkinsjob.trim(), + projectName: importoptions.jenkinsjob, selector: [ $class: 'ParameterizedBuildSelector', - parameterName: buildselector + parameterName: importoptions.buildselector ], target: destpath ) def importedmeta = meta.importrelated(destpath) - if (incrementversionnumber) { + if (importoptions.incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } return importedmeta @@ -42,13 +128,17 @@ def rewritemetafileasreleased(meta, String filepath) { meta.saveJsonSerialised(filepath) } -publisher = load("${autobuilder.commonscripts()}/publish/do.groovy") -def hierarchyartifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { - def rooturl = repo.trim() - def rootrevision = revision.trim() +def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { + if (importoptions.source != 'Release repository') { + error("Import options settings have not been set for: Release repository") + return + } + + def rooturl = importoptions.repo + def rootrevision = importoptions.revision echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) + def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) @@ -76,18 +166,23 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d echo "Marking root meta as released and rewriting meta file: ${metafilepath}" rewritemetafileasreleased(importedmeta, metafilepath) - if (incrementversionnumber) { + if (importoptions.incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } return importedmeta } -def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) { - def rooturl = repo.trim() - def rootrevision = revision.trim() +def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { + if (importoptions.source != 'Release repository') { + error("Import options settings have not been set for: Release repository") + return + } + + def rooturl = importoptions.repo + def rootrevision = importoptions.revision echo "Cloning release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) + def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) @@ -97,26 +192,71 @@ def artifactimportfromrepo(meta, String repo, String revision, String destpath, echo "Marking meta as released and rewriting meta file: ${metafilepath}" rewritemetafileasreleased(importedmeta, metafilepath) - if (incrementversionnumber) { + if (importoptions.incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } return importedmeta } -def artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false, boolean nested = false) { - switch (source) { - case "Jenkins job artifact": - case "Jenkins job artefact": - return artifactimport(meta, jenkinsjob, buildnumberorselector, destpath, incrementversionnumber, filter, excludes, fingerprint) - case "Release repository": - if (nested) { - return hierarchyartifactimportfromrepo(meta, repo, revision, destpath, incrementversionnumber, filter, excludes, fingerprint) +def artifactimport(meta, ImportOptions importoptions, String destpath) { + switch (importoptions.source) { + case 'Jenkins job artifact': + case 'Jenkins job artefact': + return artifactimportfrombuildjob(meta, importoptions, destpath) + case 'Release repository': + if (importoptions.nested) { + return hierarchyartifactimportfromrepo(meta, importoptions, destpath) } - return artifactimportfromrepo(meta, repo, revision, destpath, incrementversionnumber, filter, excludes, fingerprint) + return artifactimportfromrepo(meta, importoptions, destpath) default: error("Unknown type of artifact source: ${source}") } return meta } +// Deprecated (use above) +def artifactimport(meta, + String source, + String jenkinsjob, + buildnumberorselector, + String repo, + String revision, + String destpath, + boolean incrementversionnumber = true, + String filter = '', + String excludes = '', + boolean fingerprint = false, + boolean nested = false) { + importoptions = getNewImportOptions(this) + + importoptions.source(source, 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 jenkinsjob, + int buildnumber, + String destpath, + boolean incrementversionnumber = true, + String filter = '**', + String excludes = '', + boolean fingerprint = false) { + importoptions = getNewImportOptions(this) + + importoptions.source(jenkinsjob, specific(buildnumber.toString()) + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(filter) + importoptions.setexcludes(excludes) + importoptions.setfingerprint(fingerprint) + + return artifactimport(meta, importoptions, destpath) +} + return this; From 2590912804b3fd354dc3367b434368ff70457c9d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:07:29 +0000 Subject: [PATCH 1247/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 666f389..fc844fb 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -19,7 +19,7 @@ class ImportOptions { String revision ImportOptions(script, - String source = 'Jenkins job artifact' + String source = 'Jenkins job artifact', boolean incrementversionnumber = true, String filter = '', String excludes = '', From 6b6a6fb8e7df309cb3b59b3dc01af73e89e8e649 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:09:24 +0000 Subject: [PATCH 1248/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index fc844fb..6ca3c53 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -36,7 +36,7 @@ class ImportOptions { setappendtoparentmeta(appendtoparentmeta) } - setsource(String source) { + void setsource(String source) { source = source.trim() switch (source) { case 'Jenkins job artefact': @@ -51,43 +51,43 @@ class ImportOptions { } } - setIncrementVersionNumber(boolean incrementversionnumber) { + void setIncrementVersionNumber(boolean incrementversionnumber) { this.incrementversionnumber = incrementversionnumber } - setfilter(String filter) { + void setfilter(String filter) { this.filter = filter.trim() } - setexcludes(String excludes) { + void setexcludes(String excludes) { this.excludes = excludes.trim() } - setfingerprint(boolean fingerprint) { + void setfingerprint(boolean fingerprint) { this.fingerprint = fingerprint } - setnested(boolean nested) { + void setnested(boolean nested) { this.nested = nested } - setappendtoparentmeta(boolean appendtoparentmeta) { + void setappendtoparentmeta(boolean appendtoparentmeta) { this.appendtoparentmeta = appendtoparentmeta } - jenkinsjob(String jenkinsjob, buildnumberorselector) { + void jenkinsjob(String jenkinsjob, buildnumberorselector) { this.jenkinsjob = jenkinsjob.trim() this.buildnumberorselector = buildnumberorselector.trim() setsource('Jenkins job artifact') } - releaserepo(String repo, String revision) { + void releaserepo(String repo, String revision) { this.repo = repo.trim() this.revision = revision.trim() setsource('Release repository') } - source(String source, String jenkinsjob, buildnumberorselector, String repo, String revision) { + void source(String source, String jenkinsjob, buildnumberorselector, String repo, String revision) { jenkinsjob(String jenkinsjob, buildnumberorselector) releaserepo(String repo, String revision) setsource(source) From 1156a90c2d7406e98b61b6890503d0834d2725e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:10:53 +0000 Subject: [PATCH 1249/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 6ca3c53..7f787dc 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -250,7 +250,7 @@ def artifactimport(meta, boolean fingerprint = false) { importoptions = getNewImportOptions(this) - importoptions.source(jenkinsjob, specific(buildnumber.toString()) + importoptions.source(jenkinsjob, specific(buildnumber.toString())) importoptions.setincrementversionnumber(incrementversionnumber) importoptions.setfilter(filter) importoptions.setexcludes(excludes) From f6f42b5f1bd00b6a2030d798ee678ee1c1f8b4a5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:11:55 +0000 Subject: [PATCH 1250/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 7f787dc..e1ef7c5 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -88,8 +88,8 @@ class ImportOptions { } void source(String source, String jenkinsjob, buildnumberorselector, String repo, String revision) { - jenkinsjob(String jenkinsjob, buildnumberorselector) - releaserepo(String repo, String revision) + jenkinsjob(jenkinsjob, buildnumberorselector) + releaserepo(repo, revision) setsource(source) } } From 9f0f554db7c6ac0b389dfdec796320d8361909d0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:20:16 +0000 Subject: [PATCH 1251/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/import/importer.groovy b/import/importer.groovy index e1ef7c5..d51379a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -36,6 +36,7 @@ class ImportOptions { setappendtoparentmeta(appendtoparentmeta) } + @NonCPS void setsource(String source) { source = source.trim() switch (source) { From ec153471ea774d4d91d0e271c0b8ab563f052043 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:26:26 +0000 Subject: [PATCH 1252/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index d51379a..2c9daee 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -52,42 +52,51 @@ class ImportOptions { } } + @NonCPS void setIncrementVersionNumber(boolean incrementversionnumber) { this.incrementversionnumber = incrementversionnumber } + @NonCPS void setfilter(String filter) { this.filter = filter.trim() } + @NonCPS void setexcludes(String excludes) { this.excludes = excludes.trim() } + @NonCPS void setfingerprint(boolean fingerprint) { this.fingerprint = fingerprint } + @NonCPS void setnested(boolean nested) { this.nested = nested } - + + @NonCPS void setappendtoparentmeta(boolean appendtoparentmeta) { this.appendtoparentmeta = appendtoparentmeta } + @NonCPS void jenkinsjob(String jenkinsjob, buildnumberorselector) { this.jenkinsjob = jenkinsjob.trim() this.buildnumberorselector = buildnumberorselector.trim() setsource('Jenkins job artifact') } + @NonCPS void releaserepo(String repo, String revision) { this.repo = repo.trim() this.revision = revision.trim() setsource('Release repository') } + @NonCPS void source(String source, String jenkinsjob, buildnumberorselector, String repo, String revision) { jenkinsjob(jenkinsjob, buildnumberorselector) releaserepo(repo, revision) From fb87ab631e7d7164253e79acf531ed483acc9605 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:31:35 +0000 Subject: [PATCH 1253/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 2c9daee..75c4412 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -83,7 +83,7 @@ class ImportOptions { } @NonCPS - void jenkinsjob(String jenkinsjob, buildnumberorselector) { + void jenkinsjob(String jenkinsjob, String buildnumberorselector) { this.jenkinsjob = jenkinsjob.trim() this.buildnumberorselector = buildnumberorselector.trim() setsource('Jenkins job artifact') @@ -97,7 +97,7 @@ class ImportOptions { } @NonCPS - void source(String source, String jenkinsjob, buildnumberorselector, String repo, String revision) { + void source(String source, String jenkinsjob, String buildnumberorselector, String repo, String revision) { jenkinsjob(jenkinsjob, buildnumberorselector) releaserepo(repo, revision) setsource(source) From ecb225bff71552e2ac210a22a952b21f486837fa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:35:26 +0000 Subject: [PATCH 1254/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 75c4412..2ceb9f0 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -12,7 +12,7 @@ class ImportOptions { boolean appendtoparentmeta // Append to parent meta String source // Where are the artifacts coming from - String jenkinsjob + String jobname def buildnumberorselector String repo @@ -83,8 +83,8 @@ class ImportOptions { } @NonCPS - void jenkinsjob(String jenkinsjob, String buildnumberorselector) { - this.jenkinsjob = jenkinsjob.trim() + void jenkinsjob(String jobname, String buildnumberorselector) { + this.jobname = jobname.trim() this.buildnumberorselector = buildnumberorselector.trim() setsource('Jenkins job artifact') } @@ -97,8 +97,8 @@ class ImportOptions { } @NonCPS - void source(String source, String jenkinsjob, String buildnumberorselector, String repo, String revision) { - jenkinsjob(jenkinsjob, buildnumberorselector) + void source(String source, String jobname, String buildnumberorselector, String repo, String revision) { + jenkinsjob(jobname, buildnumberorselector) releaserepo(repo, revision) setsource(source) } @@ -118,7 +118,7 @@ def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpat filter: importoptions.filter, excludes: importoptions.excludes, fingerprintArtifacts: fingerprint, - projectName: importoptions.jenkinsjob, + projectName: importoptions.jobname, selector: [ $class: 'ParameterizedBuildSelector', parameterName: importoptions.buildselector From b303e3f1455a37c85df20d5b4aa6c81338a8bab6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:37:03 +0000 Subject: [PATCH 1255/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 2ceb9f0..2a6d095 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -28,7 +28,7 @@ class ImportOptions { appendtoparentmeta = true) { this.script = script setsource(source) - setIncrementVersionNumber(incrementversionnumber) + setincrementversionnumber(incrementversionnumber) setfilter(filter) setexcludes(excludes) setfingerprint(fingerprint) @@ -53,7 +53,7 @@ class ImportOptions { } @NonCPS - void setIncrementVersionNumber(boolean incrementversionnumber) { + void setincrementversionnumber(boolean incrementversionnumber) { this.incrementversionnumber = incrementversionnumber } From 26e471b6970dbffd032779b33d18cc4f2710482f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:38:33 +0000 Subject: [PATCH 1256/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 2a6d095..d1dcd61 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -117,7 +117,7 @@ def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpat copyArtifacts( filter: importoptions.filter, excludes: importoptions.excludes, - fingerprintArtifacts: fingerprint, + fingerprintArtifacts: importoptions.fingerprint, projectName: importoptions.jobname, selector: [ $class: 'ParameterizedBuildSelector', From 44e69930c8602f109fa4f5cc04b9009cbee58930 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 16:40:02 +0000 Subject: [PATCH 1257/1971] GIS-1621 - Import for version numbering but don't append to meta data --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index d1dcd61..21c701e 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -121,7 +121,7 @@ def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpat projectName: importoptions.jobname, selector: [ $class: 'ParameterizedBuildSelector', - parameterName: importoptions.buildselector + parameterName: importoptions.buildnumberorselector ], target: destpath ) From 7af31083e02b6f691d765555194a6270f069489a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 20 Dec 2019 17:31:14 +0000 Subject: [PATCH 1258/1971] GIS-1621 - Import for version numbering but don't append to meta data --- differences/dometahierarchy.groovy | 4 ++-- import/importer.groovy | 9 +++------ meta/folder.groovy | 6 ++++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 2e94820..3642ced 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -720,8 +720,8 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin echo "Comparing product meta hierarchy from folders: ${earlymetafolder} and ${latermetafolder} to a depth of ${md}. Exporting summary to ${summaryfolder}" - def earlymeta = meta.importrelated(earlymetafolder) - def latermeta = meta.importrelated(latermetafolder) + def earlymeta = meta.importrelated(true, earlymetafolder) + def latermeta = meta.importrelated(true, latermetafolder) def earlymetaitems = earlymeta.releasewalkerunique(md) def latermetaitems = latermeta.releasewalkerunique(md) diff --git a/import/importer.groovy b/import/importer.groovy index 21c701e..8998ab5 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -82,21 +82,18 @@ class ImportOptions { this.appendtoparentmeta = appendtoparentmeta } - @NonCPS void jenkinsjob(String jobname, String buildnumberorselector) { this.jobname = jobname.trim() this.buildnumberorselector = buildnumberorselector.trim() setsource('Jenkins job artifact') } - @NonCPS void releaserepo(String repo, String revision) { this.repo = repo.trim() this.revision = revision.trim() setsource('Release repository') } - @NonCPS void source(String source, String jobname, String buildnumberorselector, String repo, String revision) { jenkinsjob(jobname, buildnumberorselector) releaserepo(repo, revision) @@ -125,7 +122,7 @@ def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpat ], target: destpath ) - def importedmeta = meta.importrelated(destpath) + def importedmeta = meta.importrelated(importoptions.appendtoparentmeta, destpath) if (importoptions.incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } @@ -151,7 +148,7 @@ def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String de def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) - def importedmeta = meta.importrelated(destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) + def importedmeta = meta.importrelated(importoptions.appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) relatedimportinfo = importedmeta.getassociated() echo "Cloning associated repos" @@ -195,7 +192,7 @@ def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) - def importedmeta = meta.importrelated(destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) + def importedmeta = meta.importrelated(importoptions.appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) gh.stripgithistory(destpath) def metafilepath = "${destpath}/${meta.metafilepath()}" diff --git a/meta/folder.groovy b/meta/folder.groovy index 40f03aa..78286fe 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -605,7 +605,7 @@ class MetaInfo extends GISJsonSerialised { return METAFOLDERNAME + "/" + METAFILENAME } - MetaInfo importrelated(String destpath, String givenRepo = 'Unknown', String givenRevision = 'Unknown', String givenSHA = 'Unknown') { + 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) @@ -618,7 +618,9 @@ class MetaInfo extends GISJsonSerialised { } RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi) - associatedmeta.add(rmi) + if (appendtoparentmeta) { + associatedmeta.add(rmi) + } return mi } From 0d53bf9f5852cf153caaea6d3efbf74873e62a0f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 21 Dec 2019 20:00:54 +0000 Subject: [PATCH 1259/1971] GIS-1621 - Use new form of importer method --- install/installhelper.groovy | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 6fcdc6c..34a33d8 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -35,7 +35,16 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { for (artifactKey in artifactKeys) { (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { - def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy) + + def importoptions = importer.getNewImportOptions(this) + + importoptions.jenkinsjob(sourceProject, sourceselector) + + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(toCopy) + importoptions.setexcludes(notToCopy) + + def importmeta = importer.artifactimport(meta, importoptions, destFolder) artifactFetched.put(artifactKey, importmeta) } } From 48dabad8f81b56e7ceb3a2f5cb75b802224f983f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 21 Dec 2019 20:09:02 +0000 Subject: [PATCH 1260/1971] GIS-1621 - Make the importoptions class CPS compliant by not calling methods from the constructor --- import/importer.groovy | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 8998ab5..898ee96 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -27,16 +27,15 @@ class ImportOptions { boolean nested = false, appendtoparentmeta = true) { this.script = script - setsource(source) - setincrementversionnumber(incrementversionnumber) - setfilter(filter) - setexcludes(excludes) - setfingerprint(fingerprint) - setnested(nested) - setappendtoparentmeta(appendtoparentmeta) + this.source = source.trim() + this.incrementversionnumber = incrementversionnumber + this.filter = filter.trim() + this.excludes = excludes.trim() + this.fingerprint = fingerprint + this.nested = nested + this.appendtoparentmeta = appendtoparentmeta } - @NonCPS void setsource(String source) { source = source.trim() switch (source) { @@ -52,32 +51,26 @@ class ImportOptions { } } - @NonCPS void setincrementversionnumber(boolean incrementversionnumber) { this.incrementversionnumber = incrementversionnumber } - @NonCPS void setfilter(String filter) { this.filter = filter.trim() } - @NonCPS void setexcludes(String excludes) { this.excludes = excludes.trim() } - @NonCPS void setfingerprint(boolean fingerprint) { this.fingerprint = fingerprint } - @NonCPS void setnested(boolean nested) { this.nested = nested } - @NonCPS void setappendtoparentmeta(boolean appendtoparentmeta) { this.appendtoparentmeta = appendtoparentmeta } @@ -234,7 +227,7 @@ def artifactimport(meta, String excludes = '', boolean fingerprint = false, boolean nested = false) { - importoptions = getNewImportOptions(this) + def importoptions = getNewImportOptions(this) importoptions.source(source, jenkinsjob, buildnumberorselector, repo, revision) importoptions.setincrementversionnumber(incrementversionnumber) @@ -255,7 +248,7 @@ def artifactimport(meta, String filter = '**', String excludes = '', boolean fingerprint = false) { - importoptions = getNewImportOptions(this) + def importoptions = getNewImportOptions(this) importoptions.source(jenkinsjob, specific(buildnumber.toString())) importoptions.setincrementversionnumber(incrementversionnumber) From 390492bc53594836b70ef428f79969b6d92443a3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 21 Dec 2019 21:24:15 +0000 Subject: [PATCH 1261/1971] GIS-1621 - Import importer from a different scope --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 34a33d8..10c7827 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -1,3 +1,4 @@ +importer = load("${autobuilder.commonscripts()}/import/importer.groovy") import hudson.FilePath // Transfer file from intermediate position to final position; @@ -26,7 +27,6 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin def Map artifactsImporter(meta, artifactDetails, installerDetails) { artifactFetched = [:] - def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") for (installer in toBuild) { def artifactKeys = installerDetails.get(installer)[1] if (artifactKeys instanceof java.lang.String) { From 7e72b0522faeac82d82243c9d0bb14e0ffb48b71 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 21 Dec 2019 21:33:11 +0000 Subject: [PATCH 1262/1971] GIS-1621 - Import importer from a different scope --- import/importer.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 898ee96..10d51b6 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -94,10 +94,6 @@ class ImportOptions { } } -ImportOptions getNewImportOptions(script) { - return new ImportOptions(script) -} - def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpath) { if (importoptions.source != 'Jenkins job artifact') { error("Import options settings have not been set for: Jenkins job artifact") @@ -259,4 +255,8 @@ def artifactimport(meta, return artifactimport(meta, importoptions, destpath) } +ImportOptions getNewImportOptions() { + return new ImportOptions(this) +} + return this; From f1c17a385f2c715772c11c350acd634dacf2f788 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 21 Dec 2019 21:40:29 +0000 Subject: [PATCH 1263/1971] GIS-1621 - Don't supply the script object to the importer --- import/importer.groovy | 4 ++-- install/installhelper.groovy | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 10d51b6..61f0daa 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -223,7 +223,7 @@ def artifactimport(meta, String excludes = '', boolean fingerprint = false, boolean nested = false) { - def importoptions = getNewImportOptions(this) + def importoptions = getNewImportOptions() importoptions.source(source, jenkinsjob, buildnumberorselector, repo, revision) importoptions.setincrementversionnumber(incrementversionnumber) @@ -244,7 +244,7 @@ def artifactimport(meta, String filter = '**', String excludes = '', boolean fingerprint = false) { - def importoptions = getNewImportOptions(this) + def importoptions = getNewImportOptions() importoptions.source(jenkinsjob, specific(buildnumber.toString())) importoptions.setincrementversionnumber(incrementversionnumber) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 10c7827..e02a066 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -36,7 +36,7 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { - def importoptions = importer.getNewImportOptions(this) + def importoptions = importer.getNewImportOptions() importoptions.jenkinsjob(sourceProject, sourceselector) From 6621b2c402699136d90e993bcaa2a644755dc2c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 09:56:05 +0000 Subject: [PATCH 1264/1971] GIS-1621 - Try to stop jenkins crash --- install/installhelper.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index e02a066..67578d7 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -27,6 +27,7 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin def Map artifactsImporter(meta, artifactDetails, installerDetails) { artifactFetched = [:] + def importoptions = importer.getNewImportOptions() for (installer in toBuild) { def artifactKeys = installerDetails.get(installer)[1] if (artifactKeys instanceof java.lang.String) { @@ -35,11 +36,7 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) { for (artifactKey in artifactKeys) { (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { - - def importoptions = importer.getNewImportOptions() - importoptions.jenkinsjob(sourceProject, sourceselector) - importoptions.setincrementversionnumber(incrementversionnumber) importoptions.setfilter(toCopy) importoptions.setexcludes(notToCopy) From c6ef2c58ad729202abd3a06f97a3a8f1fa26d496 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 10:02:20 +0000 Subject: [PATCH 1265/1971] GIS-1621 - Try to stop jenkins crash - member names --- import/importer.groovy | 130 ++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 61f0daa..3333cb4 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -2,21 +2,21 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") class ImportOptions { - def script // Script to use if wanting to execute script commands (eg. echo -> script.echo) + def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) - boolean incrementversionnumber // If true, increment the parent's (4th) version number with the (4th) version number of this object being imported - String filter // Only import files/paths/folders that match the filter - String excludes // Exclude files/paths/folders that match the exclude filter - boolean fingerprint // Do Jenkins fingerprinting on imported artifacts - boolean nested // Import all child artifacts too (identified in the related meta info - boolean appendtoparentmeta // Append to parent meta - String source // Where are the artifacts coming from + 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_appendtoparentmeta // Append to parent meta + String m_source // Where are the artifacts coming from - String jobname - def buildnumberorselector + String m_jobname + def m_buildnumberorselector - String repo - String revision + String m_repo + String m_revision ImportOptions(script, String source = 'Jenkins job artifact', @@ -26,25 +26,25 @@ class ImportOptions { boolean fingerprint = false, boolean nested = false, appendtoparentmeta = true) { - this.script = script - this.source = source.trim() - this.incrementversionnumber = incrementversionnumber - this.filter = filter.trim() - this.excludes = excludes.trim() - this.fingerprint = fingerprint - this.nested = nested - this.appendtoparentmeta = appendtoparentmeta + m_script = script + m_source = source.trim() + m_incrementversionnumber = incrementversionnumber + m_filter = filter.trim() + m_excludes = excludes.trim() + m_fingerprint = fingerprint + m_nested = nested + m_appendtoparentmeta = appendtoparentmeta } void setsource(String source) { source = source.trim() switch (source) { case 'Jenkins job artefact': - this.source = 'Jenkins job artifact' + m_source = 'Jenkins job artifact' break case 'Jenkins job artifact': case 'Release repository': - this.source = source + m_source = source break default: error("Unknown type of artifact source: ${source}") @@ -52,38 +52,38 @@ class ImportOptions { } void setincrementversionnumber(boolean incrementversionnumber) { - this.incrementversionnumber = incrementversionnumber + m_incrementversionnumber = incrementversionnumber } void setfilter(String filter) { - this.filter = filter.trim() + m_filter = filter.trim() } void setexcludes(String excludes) { - this.excludes = excludes.trim() + m_excludes = excludes.trim() } void setfingerprint(boolean fingerprint) { - this.fingerprint = fingerprint + m_fingerprint = fingerprint } void setnested(boolean nested) { - this.nested = nested + m_nested = nested } void setappendtoparentmeta(boolean appendtoparentmeta) { - this.appendtoparentmeta = appendtoparentmeta + m_appendtoparentmeta = appendtoparentmeta } void jenkinsjob(String jobname, String buildnumberorselector) { - this.jobname = jobname.trim() - this.buildnumberorselector = buildnumberorselector.trim() + m_jobname = jobname.trim() + m_buildnumberorselector = buildnumberorselector.trim() setsource('Jenkins job artifact') } void releaserepo(String repo, String revision) { - this.repo = repo.trim() - this.revision = revision.trim() + m_repo = repo.trim() + m_revision = revision.trim() setsource('Release repository') } @@ -95,24 +95,24 @@ class ImportOptions { } def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpath) { - if (importoptions.source != 'Jenkins job artifact') { + if (importoptions.m_source != 'Jenkins job artifact') { error("Import options settings have not been set for: Jenkins job artifact") return } copyArtifacts( - filter: importoptions.filter, - excludes: importoptions.excludes, - fingerprintArtifacts: importoptions.fingerprint, - projectName: importoptions.jobname, + filter: importoptions.m_filter, + excludes: importoptions.m_excludes, + fingerprintArtifacts: importoptions.m_fingerprint, + projectName: importoptions.m_jobname, selector: [ $class: 'ParameterizedBuildSelector', - parameterName: importoptions.buildnumberorselector + parameterName: importoptions.m_buildnumberorselector ], target: destpath ) - def importedmeta = meta.importrelated(importoptions.appendtoparentmeta, destpath) - if (importoptions.incrementversionnumber) { + 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 @@ -125,19 +125,19 @@ def rewritemetafileasreleased(meta, String filepath) { } def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { - if (importoptions.source != 'Release repository') { + if (importoptions.m_source != 'Release repository') { error("Import options settings have not been set for: Release repository") return } - def rooturl = importoptions.repo - def rootrevision = importoptions.revision + def rooturl = importoptions.m_repo + def rootrevision = importoptions.m_revision echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.filter) + def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.m_filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) - def importedmeta = meta.importrelated(importoptions.appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) + def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) relatedimportinfo = importedmeta.getassociated() echo "Cloning associated repos" @@ -162,45 +162,45 @@ def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String de echo "Marking root meta as released and rewriting meta file: ${metafilepath}" rewritemetafileasreleased(importedmeta, metafilepath) - if (importoptions.incrementversionnumber) { + if (importoptions.m_incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } return importedmeta } def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { - if (importoptions.source != 'Release repository') { + if (importoptions.m_source != 'Release repository') { error("Import options settings have not been set for: Release repository") return } - def rooturl = importoptions.repo - def rootrevision = importoptions.revision + 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(importoptions.filter) + def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.m_filter) gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) - def importedmeta = meta.importrelated(importoptions.appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) + 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.incrementversionnumber) { + if (importoptions.m_incrementversionnumber) { meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision)) } return importedmeta } def artifactimport(meta, ImportOptions importoptions, String destpath) { - switch (importoptions.source) { + switch (importoptions.m_source) { case 'Jenkins job artifact': case 'Jenkins job artefact': return artifactimportfrombuildjob(meta, importoptions, destpath) case 'Release repository': - if (importoptions.nested) { + if (importoptions.m_nested) { return hierarchyartifactimportfromrepo(meta, importoptions, destpath) } return artifactimportfromrepo(meta, importoptions, destpath) @@ -225,12 +225,12 @@ def artifactimport(meta, boolean nested = false) { def importoptions = getNewImportOptions() - importoptions.source(source, jenkinsjob, buildnumberorselector, repo, revision) - importoptions.setincrementversionnumber(incrementversionnumber) - importoptions.setfilter(filter) - importoptions.setexcludes(excludes) - importoptions.setfingerprint(fingerprint) - importoptions.setnested(nested) + importoptions.m_source(source, jenkinsjob, buildnumberorselector, repo, revision) + importoptions.m_setincrementversionnumber(incrementversionnumber) + importoptions.m_setfilter(filter) + importoptions.m_setexcludes(excludes) + importoptions.m_setfingerprint(fingerprint) + importoptions.m_setnested(nested) return artifactimport(meta, importoptions, destpath) } @@ -246,11 +246,11 @@ def artifactimport(meta, boolean fingerprint = false) { def importoptions = getNewImportOptions() - importoptions.source(jenkinsjob, specific(buildnumber.toString())) - importoptions.setincrementversionnumber(incrementversionnumber) - importoptions.setfilter(filter) - importoptions.setexcludes(excludes) - importoptions.setfingerprint(fingerprint) + importoptions.m_source(jenkinsjob, specific(buildnumber.toString())) + importoptions.m_setincrementversionnumber(incrementversionnumber) + importoptions.m_setfilter(filter) + importoptions.m_setexcludes(excludes) + importoptions.m_setfingerprint(fingerprint) return artifactimport(meta, importoptions, destpath) } From faccc705336a5891d467cbffbb9766525a6942fc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 10:19:40 +0000 Subject: [PATCH 1266/1971] GIS-1621 - Try to stop jenkins crash - member names --- import/importer.groovy | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 3333cb4..0068257 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -225,12 +225,12 @@ def artifactimport(meta, boolean nested = false) { def importoptions = getNewImportOptions() - importoptions.m_source(source, jenkinsjob, buildnumberorselector, repo, revision) - importoptions.m_setincrementversionnumber(incrementversionnumber) - importoptions.m_setfilter(filter) - importoptions.m_setexcludes(excludes) - importoptions.m_setfingerprint(fingerprint) - importoptions.m_setnested(nested) + importoptions.source(source, jenkinsjob, buildnumberorselector, repo, revision) + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(filter) + importoptions.setexcludes(excludes) + importoptions.setfingerprint(fingerprint) + importoptions.setnested(nested) return artifactimport(meta, importoptions, destpath) } @@ -246,11 +246,11 @@ def artifactimport(meta, boolean fingerprint = false) { def importoptions = getNewImportOptions() - importoptions.m_source(jenkinsjob, specific(buildnumber.toString())) - importoptions.m_setincrementversionnumber(incrementversionnumber) - importoptions.m_setfilter(filter) - importoptions.m_setexcludes(excludes) - importoptions.m_setfingerprint(fingerprint) + importoptions.source(jenkinsjob, specific(buildnumber.toString())) + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(filter) + importoptions.setexcludes(excludes) + importoptions.setfingerprint(fingerprint) return artifactimport(meta, importoptions, destpath) } From d2a67a28dba92e567063ccf5a0da5be1e80bd970 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 17:47:36 +0000 Subject: [PATCH 1267/1971] GIS-1621 - Try to stop jenkins crash - move importer definition after update to JDK 11.0.5 indicated duplicate definition --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 67578d7..317faac 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -1,4 +1,3 @@ -importer = load("${autobuilder.commonscripts()}/import/importer.groovy") import hudson.FilePath // Transfer file from intermediate position to final position; @@ -27,6 +26,7 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin def Map artifactsImporter(meta, artifactDetails, installerDetails) { artifactFetched = [:] + def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def importoptions = importer.getNewImportOptions() for (installer in toBuild) { def artifactKeys = installerDetails.get(installer)[1] From 63be27007d20d30c030b8e0dce4bbf3f4931ddbd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 22:18:51 +0000 Subject: [PATCH 1268/1971] GIS-1621 - Try to stop jenkins crash - Seperate importoptions class into its own file --- import/importer.groovy | 96 +---------------------------------------- import/options.groovy | 98 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 94 deletions(-) create mode 100644 import/options.groovy diff --git a/import/importer.groovy b/import/importer.groovy index 0068257..4169671 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,98 +1,6 @@ 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_appendtoparentmeta // Append to parent meta - String m_source // Where are the artifacts coming from - - String m_jobname - def m_buildnumberorselector - - String m_repo - String m_revision - - ImportOptions(script, - String source = 'Jenkins job artifact', - boolean incrementversionnumber = true, - String filter = '', - String excludes = '', - boolean fingerprint = false, - boolean nested = false, - appendtoparentmeta = true) { - m_script = script - m_source = source.trim() - m_incrementversionnumber = incrementversionnumber - m_filter = filter.trim() - m_excludes = excludes.trim() - m_fingerprint = fingerprint - m_nested = nested - m_appendtoparentmeta = appendtoparentmeta - } - - void setsource(String source) { - source = source.trim() - switch (source) { - case 'Jenkins job artefact': - m_source = 'Jenkins job artifact' - break - case 'Jenkins job artifact': - case 'Release repository': - m_source = source - break - default: - error("Unknown type of artifact source: ${source}") - } - } - - void setincrementversionnumber(boolean incrementversionnumber) { - m_incrementversionnumber = incrementversionnumber - } - - void setfilter(String filter) { - m_filter = filter.trim() - } - - void setexcludes(String excludes) { - m_excludes = excludes.trim() - } - - void setfingerprint(boolean fingerprint) { - m_fingerprint = fingerprint - } - - void setnested(boolean nested) { - m_nested = nested - } - - void setappendtoparentmeta(boolean appendtoparentmeta) { - m_appendtoparentmeta = appendtoparentmeta - } - - void jenkinsjob(String jobname, String buildnumberorselector) { - m_jobname = jobname.trim() - m_buildnumberorselector = buildnumberorselector.trim() - setsource('Jenkins job artifact') - } - - void releaserepo(String repo, String revision) { - m_repo = repo.trim() - m_revision = revision.trim() - setsource('Release repository') - } - - void source(String source, String jobname, String buildnumberorselector, String repo, String revision) { - jenkinsjob(jobname, buildnumberorselector) - releaserepo(repo, revision) - setsource(source) - } -} +io = load("${autobuilder.commonscripts()}/import/options.groovy") def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpath) { if (importoptions.m_source != 'Jenkins job artifact') { @@ -256,7 +164,7 @@ def artifactimport(meta, } ImportOptions getNewImportOptions() { - return new ImportOptions(this) + return io.getNewImportOptions() } return this; diff --git a/import/options.groovy b/import/options.groovy new file mode 100644 index 0000000..8a478ec --- /dev/null +++ b/import/options.groovy @@ -0,0 +1,98 @@ +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_appendtoparentmeta // Append to parent meta + String m_source // Where are the artifacts coming from + + String m_jobname + def m_buildnumberorselector + + String m_repo + String m_revision + + ImportOptions(script, + String source = 'Jenkins job artifact', + boolean incrementversionnumber = true, + String filter = '', + String excludes = '', + boolean fingerprint = false, + boolean nested = false, + appendtoparentmeta = true) { + m_script = script + m_source = source.trim() + m_incrementversionnumber = incrementversionnumber + m_filter = filter.trim() + m_excludes = excludes.trim() + m_fingerprint = fingerprint + m_nested = nested + m_appendtoparentmeta = appendtoparentmeta + } + + void setsource(String source) { + source = source.trim() + switch (source) { + case 'Jenkins job artefact': + m_source = 'Jenkins job artifact' + break + case 'Jenkins job artifact': + case 'Release repository': + m_source = source + break + default: + error("Unknown type of artifact source: ${source}") + } + } + + void setincrementversionnumber(boolean incrementversionnumber) { + m_incrementversionnumber = incrementversionnumber + } + + void setfilter(String filter) { + m_filter = filter.trim() + } + + void setexcludes(String excludes) { + m_excludes = excludes.trim() + } + + void setfingerprint(boolean fingerprint) { + m_fingerprint = fingerprint + } + + void setnested(boolean nested) { + m_nested = nested + } + + void setappendtoparentmeta(boolean appendtoparentmeta) { + m_appendtoparentmeta = appendtoparentmeta + } + + void jenkinsjob(String jobname, String buildnumberorselector) { + m_jobname = jobname.trim() + m_buildnumberorselector = buildnumberorselector.trim() + setsource('Jenkins job artifact') + } + + void releaserepo(String repo, String revision) { + m_repo = repo.trim() + m_revision = revision.trim() + setsource('Release repository') + } + + void source(String source, String jobname, String buildnumberorselector, String repo, String revision) { + jenkinsjob(jobname, buildnumberorselector) + releaserepo(repo, revision) + setsource(source) + } +} + +ImportOptions getNewImportOptions() { + return new ImportOptions(this) +} + +return this; \ No newline at end of file From ab0d0d5ae08d3ddb20b9432762ba1413e754895d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 22:24:27 +0000 Subject: [PATCH 1269/1971] GIS-1621 - Try to stop jenkins crash - Seperate importoptions class into its own file --- import/importer.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 4169671..1824c93 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -32,7 +32,7 @@ def rewritemetafileasreleased(meta, String filepath) { meta.saveJsonSerialised(filepath) } -def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { +def hierarchyartifactimportfromrepo(meta, io.ImportOptions importoptions, String destpath) { if (importoptions.m_source != 'Release repository') { error("Import options settings have not been set for: Release repository") return @@ -76,7 +76,7 @@ def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String de return importedmeta } -def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { +def artifactimportfromrepo(meta, io.ImportOptions importoptions, String destpath) { if (importoptions.m_source != 'Release repository') { error("Import options settings have not been set for: Release repository") return @@ -102,7 +102,7 @@ def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { return importedmeta } -def artifactimport(meta, ImportOptions importoptions, String destpath) { +def artifactimport(meta, io.ImportOptions importoptions, String destpath) { switch (importoptions.m_source) { case 'Jenkins job artifact': case 'Jenkins job artefact': From 5a3483b950c338194ade5d9965a28185c33f3e85 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 22:31:31 +0000 Subject: [PATCH 1270/1971] GIS-1621 - Try to stop jenkins crash - Seperate importoptions class into its own file --- import/importer.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 1824c93..ef15c91 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -2,7 +2,7 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") io = load("${autobuilder.commonscripts()}/import/options.groovy") -def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpath) { +def artifactimportfrombuildjob(meta, importoptions, String destpath) { if (importoptions.m_source != 'Jenkins job artifact') { error("Import options settings have not been set for: Jenkins job artifact") return @@ -32,7 +32,7 @@ def rewritemetafileasreleased(meta, String filepath) { meta.saveJsonSerialised(filepath) } -def hierarchyartifactimportfromrepo(meta, io.ImportOptions importoptions, String destpath) { +def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { if (importoptions.m_source != 'Release repository') { error("Import options settings have not been set for: Release repository") return @@ -76,7 +76,7 @@ def hierarchyartifactimportfromrepo(meta, io.ImportOptions importoptions, String return importedmeta } -def artifactimportfromrepo(meta, io.ImportOptions importoptions, String destpath) { +def artifactimportfromrepo(meta, importoptions, String destpath) { if (importoptions.m_source != 'Release repository') { error("Import options settings have not been set for: Release repository") return @@ -102,7 +102,7 @@ def artifactimportfromrepo(meta, io.ImportOptions importoptions, String destpath return importedmeta } -def artifactimport(meta, io.ImportOptions importoptions, String destpath) { +def artifactimport(meta, importoptions, String destpath) { switch (importoptions.m_source) { case 'Jenkins job artifact': case 'Jenkins job artefact': @@ -163,7 +163,7 @@ def artifactimport(meta, return artifactimport(meta, importoptions, destpath) } -ImportOptions getNewImportOptions() { +def getNewImportOptions() { return io.getNewImportOptions() } From be5bb5fa77f9e62f52ab743bf0276b33236e5acd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 22:47:06 +0000 Subject: [PATCH 1271/1971] GIS-1621 - Try to stop jenkins crash - Attempt to eliminate double load of importer --- install/installhelper.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 317faac..96a8b2e 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -23,10 +23,9 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin } // Given details about artifacts to import and details of installers to build, import artifacts that are required -def Map artifactsImporter(meta, artifactDetails, installerDetails) { +def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) { artifactFetched = [:] - def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def importoptions = importer.getNewImportOptions() for (installer in toBuild) { def artifactKeys = installerDetails.get(installer)[1] From aaa96f26d9d685c61e5a9f598e274ddac9e10e5b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 22 Dec 2019 22:56:33 +0000 Subject: [PATCH 1272/1971] GIS-1621 - Try to stop jenkins crash - Move importer options class back into importer --- import/importer.groovy | 102 +++++++++++++++++++++++++++++++++++++++-- import/options.groovy | 98 --------------------------------------- 2 files changed, 97 insertions(+), 103 deletions(-) delete mode 100644 import/options.groovy diff --git a/import/importer.groovy b/import/importer.groovy index ef15c91..784e1f5 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -1,6 +1,102 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") -io = load("${autobuilder.commonscripts()}/import/options.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_appendtoparentmeta // Append to parent meta + String m_source // Where are the artifacts coming from + + String m_jobname + def m_buildnumberorselector + + String m_repo + String m_revision + + ImportOptions(script, + String source = 'Jenkins job artifact', + boolean incrementversionnumber = true, + String filter = '', + String excludes = '', + boolean fingerprint = false, + boolean nested = false, + appendtoparentmeta = true) { + m_script = script + m_source = source.trim() + m_incrementversionnumber = incrementversionnumber + m_filter = filter.trim() + m_excludes = excludes.trim() + m_fingerprint = fingerprint + m_nested = nested + m_appendtoparentmeta = appendtoparentmeta + } + + void setsource(String source) { + source = source.trim() + switch (source) { + case 'Jenkins job artefact': + m_source = 'Jenkins job artifact' + break + case 'Jenkins job artifact': + case 'Release repository': + m_source = source + break + default: + error("Unknown type of artifact source: ${source}") + } + } + + void setincrementversionnumber(boolean incrementversionnumber) { + m_incrementversionnumber = incrementversionnumber + } + + void setfilter(String filter) { + m_filter = filter.trim() + } + + void setexcludes(String excludes) { + m_excludes = excludes.trim() + } + + void setfingerprint(boolean fingerprint) { + m_fingerprint = fingerprint + } + + void setnested(boolean nested) { + m_nested = nested + } + + void setappendtoparentmeta(boolean appendtoparentmeta) { + m_appendtoparentmeta = appendtoparentmeta + } + + void jenkinsjob(String jobname, String buildnumberorselector) { + m_jobname = jobname.trim() + m_buildnumberorselector = buildnumberorselector.trim() + setsource('Jenkins job artifact') + } + + void releaserepo(String repo, String revision) { + m_repo = repo.trim() + m_revision = revision.trim() + setsource('Release repository') + } + + void source(String source, String jobname, String buildnumberorselector, String repo, String revision) { + jenkinsjob(jobname, buildnumberorselector) + releaserepo(repo, revision) + setsource(source) + } +} + +ImportOptions getNewImportOptions() { + return new ImportOptions(this) +} def artifactimportfrombuildjob(meta, importoptions, String destpath) { if (importoptions.m_source != 'Jenkins job artifact') { @@ -163,8 +259,4 @@ def artifactimport(meta, return artifactimport(meta, importoptions, destpath) } -def getNewImportOptions() { - return io.getNewImportOptions() -} - return this; diff --git a/import/options.groovy b/import/options.groovy deleted file mode 100644 index 8a478ec..0000000 --- a/import/options.groovy +++ /dev/null @@ -1,98 +0,0 @@ -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_appendtoparentmeta // Append to parent meta - String m_source // Where are the artifacts coming from - - String m_jobname - def m_buildnumberorselector - - String m_repo - String m_revision - - ImportOptions(script, - String source = 'Jenkins job artifact', - boolean incrementversionnumber = true, - String filter = '', - String excludes = '', - boolean fingerprint = false, - boolean nested = false, - appendtoparentmeta = true) { - m_script = script - m_source = source.trim() - m_incrementversionnumber = incrementversionnumber - m_filter = filter.trim() - m_excludes = excludes.trim() - m_fingerprint = fingerprint - m_nested = nested - m_appendtoparentmeta = appendtoparentmeta - } - - void setsource(String source) { - source = source.trim() - switch (source) { - case 'Jenkins job artefact': - m_source = 'Jenkins job artifact' - break - case 'Jenkins job artifact': - case 'Release repository': - m_source = source - break - default: - error("Unknown type of artifact source: ${source}") - } - } - - void setincrementversionnumber(boolean incrementversionnumber) { - m_incrementversionnumber = incrementversionnumber - } - - void setfilter(String filter) { - m_filter = filter.trim() - } - - void setexcludes(String excludes) { - m_excludes = excludes.trim() - } - - void setfingerprint(boolean fingerprint) { - m_fingerprint = fingerprint - } - - void setnested(boolean nested) { - m_nested = nested - } - - void setappendtoparentmeta(boolean appendtoparentmeta) { - m_appendtoparentmeta = appendtoparentmeta - } - - void jenkinsjob(String jobname, String buildnumberorselector) { - m_jobname = jobname.trim() - m_buildnumberorselector = buildnumberorselector.trim() - setsource('Jenkins job artifact') - } - - void releaserepo(String repo, String revision) { - m_repo = repo.trim() - m_revision = revision.trim() - setsource('Release repository') - } - - void source(String source, String jobname, String buildnumberorselector, String repo, String revision) { - jenkinsjob(jobname, buildnumberorselector) - releaserepo(repo, revision) - setsource(source) - } -} - -ImportOptions getNewImportOptions() { - return new ImportOptions(this) -} - -return this; \ No newline at end of file From 697afbb7e31005f0c0742b10e1c41a19cfa9ed6d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 13:14:36 +0000 Subject: [PATCH 1273/1971] GIS-1621 - Create another deprecated overload of artifactimport --- import/importer.groovy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/import/importer.groovy b/import/importer.groovy index 784e1f5..bdb7faa 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -259,4 +259,24 @@ def artifactimport(meta, 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) { + 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; From 106f6b92a1981ae55c0cfbfc34e14c66d91f6dbf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 13:15:11 +0000 Subject: [PATCH 1274/1971] GIS-1621 - Remove redundant declaration --- differences/dometahierarchy.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 3642ced..199bd2c 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -140,7 +140,6 @@ def String getcomponent(meta) { } def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) { - def differencerecords = [] def String releaseexpression if (tripledot) { releaseexpression = earlyrevision + "..." + laterrevision From 8aa50af0558c10e51904ba59fc253c7c7493b69f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 13:20:09 +0000 Subject: [PATCH 1275/1971] GIS-1621 - Echo deprecated methods --- import/importer.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/import/importer.groovy b/import/importer.groovy index bdb7faa..418079e 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -227,6 +227,7 @@ def artifactimport(meta, 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(source, jenkinsjob, buildnumberorselector, repo, revision) @@ -248,6 +249,7 @@ def artifactimport(meta, String filter = '**', String excludes = '', boolean fingerprint = false) { + echo "DEPRECATED method: artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, ...)" def importoptions = getNewImportOptions() importoptions.source(jenkinsjob, specific(buildnumber.toString())) @@ -268,6 +270,7 @@ def artifactimport(meta, String filter = '', String excludes = '', boolean fingerprint = false) { + echo "DEPRECATED method: artifactimport(meta, String buildjob, buildnumberorselector, String destpath, ...)" def importoptions = getNewImportOptions() importoptions.jenkinsjob(buildjob, buildnumberorselector) From efaa302b544bfbf8c545d1803e20b5f4b863c490 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 14:31:18 +0000 Subject: [PATCH 1276/1971] GIS-1621 - Extract differences from squashed commits --- differences/dometahierarchy.groovy | 84 +++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 19 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 199bd2c..d484949 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -166,6 +166,16 @@ def extractsha(String line) { 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) @@ -302,7 +312,35 @@ def extractreverts(String line) { return [false, [], line] } -def DifferenceRecord fillrecord(meta, 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 DifferenceRecord dr = fillrecord(meta, line.trim(), sourcepath) + differencerecords.add(dr) + //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 @@ -316,41 +354,49 @@ def DifferenceRecord fillrecord(meta, line) { (sha, line2) = extractsha(line) dr.sha = sha - - (result, mergeinfo) = extractmerges(line2) + + (result, squashinfo) = extractsquashes(line2) if (result) { - dr.type = "Merge" - dr.mergeinfo = mergeinfo + dr.type = "Squash" + dr.squashinfo = squashinfo + squashrecords = fillsquashrecords(sourcepath, sha) + differencerecords.addAll(squashrecords) } else { - (result, jiraticketinfo, comment) = extractreverts(line2) + (result, mergeinfo) = extractmerges(line2) if (result) { - dr.type = "Revert" - dr.jiraticketinfo = jiraticketinfo - dr.comment = comment + dr.type = "Merge" + dr.mergeinfo = mergeinfo } else { - (result, jiraticketinfo, comment) = extractjiraticketinfo(line2) + (result, jiraticketinfo, comment) = extractreverts(line2) if (result) { - dr.type = "Ticketed" + dr.type = "Revert" dr.jiraticketinfo = jiraticketinfo dr.comment = comment } else { - dr.type = "Unticketed" - dr.comment = line2 + (result, jiraticketinfo, comment) = extractjiraticketinfo(line2) + if (result) { + dr.type = "Ticketed" + dr.jiraticketinfo = jiraticketinfo + dr.comment = comment + } else { + dr.type = "Unticketed" + dr.comment = line2 + } } } } - - return dr + differencerecords.add(dr) + return differencerecords } -def List processtext(meta, String text) { +def List processtext(meta, String text, String sourcepath) { def List differencerecords = [] text.split('\n').each { def line = it if (line?.trim()) { - def DifferenceRecord dr = fillrecord(meta, line.trim()) - differencerecords.add(dr) + def List drs = fillrecord(meta, line.trim(), sourcepath) + differencerecords.addAll(drs) //echo "${dr.dump()}" } } @@ -370,7 +416,7 @@ def getdifferencerecords(earlymeta, latermeta, String sourcepath) { 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) + differencerecords = processtext(earlymeta, differencetext, sourcepath) if (earlyrevision == laterrevision) { summaryappend(" No change") } From 12c938887f6eed209f165004254611b8b588f623 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 15:17:57 +0000 Subject: [PATCH 1277/1971] GIS-1621 - Add squash info --- differences/dometahierarchy.groovy | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index d484949..eb7d6bb 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -35,6 +35,7 @@ class DifferenceRecord { String sha String type String mergeinfo + String squashinfo List jiraticketinfo String comment @@ -47,6 +48,7 @@ class DifferenceRecord { sha = "" type = "" mergeinfo = "" + squashinfo = "" jiraticketinfo = [] comment = "" } @@ -440,6 +442,28 @@ def addedcomponent(latermetaitems, key) { 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 += "${m.comment} (${m.duplicates})\n" + } + writeFile(file: "mergelist.txt", text: squashlist) + } +} + class MergeReportRecord { String comment int duplicates @@ -592,12 +616,25 @@ def differencerecordsreport(String reportsubfolder, String title, differencereco 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)) { @@ -710,6 +747,7 @@ def boolean report(meta, title, differencerecords, boolean iscomponent = true) { 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) From 1f65877a5bb05593f3fc376495e4ae542660fb0d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 15:22:12 +0000 Subject: [PATCH 1278/1971] GIS-1621 - Add squash info --- differences/dometahierarchy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index eb7d6bb..16c78f3 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -331,8 +331,8 @@ def List fillsquashrecords(String sourcepath, String sha) { if (count > 0) { // Ignore first line def line = it if (line?.trim()) { - def DifferenceRecord dr = fillrecord(meta, line.trim(), sourcepath) - differencerecords.add(dr) + def List drs = fillrecord(meta, line.trim(), sourcepath) + differencerecords.addAll(drs) //echo "${dr.dump()}" } } From 5c27f561b856eb655ea769496f365db6734a9737 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 15:27:29 +0000 Subject: [PATCH 1279/1971] GIS-1621 - Add squash info --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 16c78f3..05f08de 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -458,7 +458,7 @@ def squashreport(String reportsubfolder, String title, LinkedHashMap Date: Mon, 23 Dec 2019 16:03:00 +0000 Subject: [PATCH 1280/1971] GIS-1621 - Add squash info --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 05f08de..2475f36 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -460,7 +460,7 @@ def squashreport(String reportsubfolder, String title, LinkedHashMap Date: Mon, 23 Dec 2019 16:32:33 +0000 Subject: [PATCH 1281/1971] GIS-1621 - metaexport must not import to importer --- artifacts/metaexport.groovy | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 043c4de..67d13c3 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,8 +1,6 @@ // 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, subJobs) { - def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - +def combineSubjobArtifacts(meta, importer, subJobs) { def ArrayList artifactFolders = new ArrayList() for (subJob in subJobs) { def subJobObject = subJob[0] From 39516d4c4ba2fbc6f012f48b4dce443d775858c2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 17:12:07 +0000 Subject: [PATCH 1282/1971] GIS-1621 - Make source method unique --- import/importer.groovy | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 418079e..7bf9b7d 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -10,7 +10,7 @@ class ImportOptions { 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_appendtoparentmeta // Append to parent meta - String m_source // Where are the artifacts coming from + String m_sourceselect // Where are the artifacts coming from String m_jobname def m_buildnumberorselector @@ -19,7 +19,7 @@ class ImportOptions { String m_revision ImportOptions(script, - String source = 'Jenkins job artifact', + String sourceselect = 'Jenkins job artifact', boolean incrementversionnumber = true, String filter = '', String excludes = '', @@ -27,7 +27,7 @@ class ImportOptions { boolean nested = false, appendtoparentmeta = true) { m_script = script - m_source = source.trim() + m_sourceselect = sourceselect.trim() m_incrementversionnumber = incrementversionnumber m_filter = filter.trim() m_excludes = excludes.trim() @@ -36,18 +36,18 @@ class ImportOptions { m_appendtoparentmeta = appendtoparentmeta } - void setsource(String source) { - source = source.trim() - switch (source) { + void setsourceselect(String sourceselect) { + sourceselect = sourceselect.trim() + switch (sourceselect) { case 'Jenkins job artefact': - m_source = 'Jenkins job artifact' + m_sourceselect = 'Jenkins job artifact' break case 'Jenkins job artifact': case 'Release repository': - m_source = source + m_sourceselect = sourceselect break default: - error("Unknown type of artifact source: ${source}") + error("Unknown type of artifact source select: ${m_sourceselect}") } } @@ -78,19 +78,19 @@ class ImportOptions { void jenkinsjob(String jobname, String buildnumberorselector) { m_jobname = jobname.trim() m_buildnumberorselector = buildnumberorselector.trim() - setsource('Jenkins job artifact') + setsourceselect('Jenkins job artifact') } void releaserepo(String repo, String revision) { m_repo = repo.trim() m_revision = revision.trim() - setsource('Release repository') + setsourceselect('Release repository') } - void source(String source, String jobname, String buildnumberorselector, String repo, String revision) { + void source(String sourceselect, String jobname, String buildnumberorselector, String repo, String revision) { jenkinsjob(jobname, buildnumberorselector) releaserepo(repo, revision) - setsource(source) + setsourceselect(sourceselect) } } @@ -99,7 +99,7 @@ ImportOptions getNewImportOptions() { } def artifactimportfrombuildjob(meta, importoptions, String destpath) { - if (importoptions.m_source != 'Jenkins job artifact') { + if (importoptions.m_sourceselect != 'Jenkins job artifact') { error("Import options settings have not been set for: Jenkins job artifact") return } @@ -129,7 +129,7 @@ def rewritemetafileasreleased(meta, String filepath) { } def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { - if (importoptions.m_source != 'Release repository') { + if (importoptions.m_sourceselect != 'Release repository') { error("Import options settings have not been set for: Release repository") return } @@ -173,7 +173,7 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { } def artifactimportfromrepo(meta, importoptions, String destpath) { - if (importoptions.m_source != 'Release repository') { + if (importoptions.m_sourceselect != 'Release repository') { error("Import options settings have not been set for: Release repository") return } @@ -199,7 +199,7 @@ def artifactimportfromrepo(meta, importoptions, String destpath) { } def artifactimport(meta, importoptions, String destpath) { - switch (importoptions.m_source) { + switch (importoptions.m_sourceselect) { case 'Jenkins job artifact': case 'Jenkins job artefact': return artifactimportfrombuildjob(meta, importoptions, destpath) @@ -216,7 +216,7 @@ def artifactimport(meta, importoptions, String destpath) { // Deprecated (use above) def artifactimport(meta, - String source, + String sourceselect, String jenkinsjob, buildnumberorselector, String repo, @@ -230,7 +230,7 @@ def artifactimport(meta, echo "DEPRECATED method: artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath ...)" def importoptions = getNewImportOptions() - importoptions.source(source, jenkinsjob, buildnumberorselector, repo, revision) + importoptions.source(sourceselect, jenkinsjob, buildnumberorselector, repo, revision) importoptions.setincrementversionnumber(incrementversionnumber) importoptions.setfilter(filter) importoptions.setexcludes(excludes) From 5319643bf47d2d34e943331e7a46553a0c697031 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 17:53:23 +0000 Subject: [PATCH 1283/1971] GIS-1621 - Correct deprecated method --- import/importer.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 7bf9b7d..87dca7c 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -242,17 +242,17 @@ def artifactimport(meta, // Deprecated (use above) def artifactimport(meta, - String jenkinsjob, + String buildjob, int buildnumber, String destpath, boolean incrementversionnumber = true, String filter = '**', String excludes = '', boolean fingerprint = false) { - echo "DEPRECATED method: artifactimport(meta, String jenkinsjob, int buildnumber, String destpath, ...)" + echo "DEPRECATED method: artifactimport(meta, String buildjob, int buildnumber, String destpath, ...)" def importoptions = getNewImportOptions() - importoptions.source(jenkinsjob, specific(buildnumber.toString())) + importoptions.jenkinsjob(buildjob, specific(buildnumber.toString())) importoptions.setincrementversionnumber(incrementversionnumber) importoptions.setfilter(filter) importoptions.setexcludes(excludes) From bdfa7aecbcc0d578c2a87b62bb99c3cd02452a9d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 21:04:00 +0000 Subject: [PATCH 1284/1971] GIS-1621 - Correct deprecated method --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 87dca7c..41f5118 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -252,7 +252,7 @@ def artifactimport(meta, echo "DEPRECATED method: artifactimport(meta, String buildjob, int buildnumber, String destpath, ...)" def importoptions = getNewImportOptions() - importoptions.jenkinsjob(buildjob, specific(buildnumber.toString())) + importoptions.jenkinsjob(buildjob, " ${buildnumber}") importoptions.setincrementversionnumber(incrementversionnumber) importoptions.setfilter(filter) importoptions.setexcludes(excludes) From e2dac1558f2640ed4c57073f2ce33287a65e77ce Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 23:32:23 +0000 Subject: [PATCH 1285/1971] GIS-1621 - Remove redundant parameters; Deprecate old APIs --- autobuilder.groovy | 19 +++++++++++-------- meta/folder.groovy | 9 ++------- release/registerrepo.groovy | 2 +- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 63ca2de..35b9f6f 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -1,10 +1,8 @@ // Assume that WORKSPACE environment variable is set -autobuildroot = "${WORKSPACE}/autobuild" - -commonscriptsroot = "${autobuildroot}/Common_scripts" - -metafolderscript = null +String autobuildroot = "${WORKSPACE}/autobuild" +String commonscriptsroot = "${autobuildroot}/Common_scripts" +def metafolderscript = null def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { @@ -32,7 +30,7 @@ def getmetafolderscript() { } // Start up boilderplate -def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, releaserepo = RELEASE_REPO, String repoRootSuffix = "", autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) { +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 @@ -42,13 +40,13 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA conditionalclean() def meta = getmetafolderscript().metareset(script) - meta.productinfo.set(productname, subcomponentname, jirakey) + 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") - rr.registerrepo(meta, releaserepo, repoRootSuffix) + rr.registerrepo(meta, releaserepo) def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) @@ -56,6 +54,11 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA 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...." diff --git a/meta/folder.groovy b/meta/folder.groovy index 78286fe..96c9626 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -22,16 +22,14 @@ abstract class GISJsonSerialised implements Serializable { class ProductInfo extends GISJsonSerialised { String productname String subcomponentname - String jirakey - ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") { + ProductInfo(script, productname = "", subcomponentname = "") { super(script) this.productname = productname this.subcomponentname = subcomponentname - this.jirakey = jirakey } - void set(String productname, String subcomponentname, String jirakey) { + void set(String productname, String subcomponentname) { // Make sure the fields can be used in git tags def int pstatus = 0 if (script.isUnix()) { @@ -55,20 +53,17 @@ class ProductInfo extends GISJsonSerialised { } this.productname = productname this.subcomponentname = subcomponentname - this.jirakey = jirakey } void deserialiseJson(rawmeta) { productname = rawmeta['productname'] subcomponentname = rawmeta['subcomponentname'] - jirakey = rawmeta['jirakey'] } LinkedHashMap serialisationdata() { def data = [ 'productname' : productname, 'subcomponentname' : subcomponentname, - 'jirakey' : jirakey, ] return data } diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy index bd6a528..f565706 100644 --- a/release/registerrepo.groovy +++ b/release/registerrepo.groovy @@ -2,7 +2,7 @@ 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, String repoRootSuffix = "") { +def registerrepo(meta, String releaserepo) { if (releaserepo?.trim()) { vc.checkRepoExists(releaserepo) } From c5b293d4b61808ad615ac69c8f17dd2c06732f77 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 23 Dec 2019 23:41:36 +0000 Subject: [PATCH 1286/1971] GIS-1621 - Remove redundant parameters; Deprecate old APIs --- autobuilder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 35b9f6f..25fe486 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -1,8 +1,8 @@ // Assume that WORKSPACE environment variable is set -String autobuildroot = "${WORKSPACE}/autobuild" -String commonscriptsroot = "${autobuildroot}/Common_scripts" -def metafolderscript = null +autobuildroot = "${WORKSPACE}/autobuild" +commonscriptsroot = "${autobuildroot}/Common_scripts" +metafolderscript = null def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { if (doclean) { From 13a6534fac7267ab8196e0613827882f5d8db143 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 24 Dec 2019 08:09:30 +0000 Subject: [PATCH 1287/1971] GIS-1621 - Remove redundant parameters; Deprecate old APIs --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 25fe486..1256394 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -70,7 +70,7 @@ def startnonbuild(script, autobuildpath = autobuildroot, commonscriptspath = com conditionalclean() def meta = getmetafolderscript().metareset(script) - meta.productinfo.set("Non-build-product", "Non-build-subcomponent", "Non-build-jira-key") + 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()) From 4ee6c594506da1bd0ea6e1d3958b0baeaa653635 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 29 Dec 2019 12:42:00 +0000 Subject: [PATCH 1288/1971] GIS-1621 - Remove further references to jirakey field; Remove redundant script --- differences/dometahierarchy.groovy | 5 +- differences/show_release_differences.py | 225 ------------------------ 2 files changed, 1 insertion(+), 229 deletions(-) delete mode 100644 differences/show_release_differences.py diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 2475f36..6280960 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -29,7 +29,6 @@ class JiraTicketInfo { class DifferenceRecord { String productname String subcomponentname - String jirakey String rawdifferencetext String sha @@ -42,7 +41,6 @@ class DifferenceRecord { DifferenceRecord() { productname = "" subcomponentname = "" - jirakey = "" rawdifferencetext = "" sha = "" @@ -58,7 +56,7 @@ class DifferenceRecord { for (j in jiraticketinfo) { jiraticketstring += j.dump() + " " } - return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\njirakey: ${jirakey}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketstring}\ncomment: ${comment}" + return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketstring}\ncomment: ${comment}" } } @@ -347,7 +345,6 @@ def List fillrecord(meta, line, String sourcepath) { dr.productname = meta.productinfo.productname dr.subcomponentname = meta.productinfo.subcomponentname - dr.jirakey = meta.productinfo.jirakey dr.rawdifferencetext = line diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py deleted file mode 100644 index 5c0f15d..0000000 --- a/differences/show_release_differences.py +++ /dev/null @@ -1,225 +0,0 @@ -''' -showreleasedifferences -- shortdesc - -showreleasedifferences generates a version folder with a common set of version information files in it - -@author: dan - -@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. -''' -import subprocess -import os -import sys -import re - -from argparse import ArgumentParser -from argparse import RawDescriptionHelpFormatter - -__all__ = [] -__version__ = 0.1 -__date__ = '2017-11-29' -__updated__ = '2017-11-29' - -gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") - -class GitException(Exception): - def __init__(self, message): - self.message = message - - def __repr__(self): - return self.message - -def printDivider(outfh, times = 1, length = 100): - for _ in range(times): - outfh.write("{0}\n".format("*" * length)) - -TABSIZE = 4 -def printTabbed(outfh, string, tabs = 0): - outfh.write("{0}{1}\n".format(" " * (TABSIZE * tabs), string)) - -def getGitLogDifferences(outfh, gitrootfolder, previousRelease, currentRelease, tripledot = False): - if tripledot: - releaseExpression = previousRelease + "..." + currentRelease - else: - releaseExpression = previousRelease + ".." + currentRelease - currentdir = os.getcwd() - os.chdir(gitrootfolder) - gitlog = [] - printTabbed(outfh, "Executing: {0} {1} {2} {3}".format(gitExecutable, "log", "--oneline", releaseExpression)) - proc = subprocess.Popen([gitExecutable, "log", "--oneline", releaseExpression], stdout=subprocess.PIPE) - while True: - line = proc.stdout.readline() - if line: - linestring = line.decode('utf-8').rstrip() - gitlog.append(linestring) - #printTabbed(outfh, linestring, 1) - else: - break - proc.wait() - if proc.returncode > 0: - raise GitException("Git executable returned an error") - os.chdir(currentdir) - return gitlog - -jiraprojectpattern = { - 'GIS' : ( re.compile("^.* +(?:[gG][iI][sS][ _-]*|[tT]rac \#*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *GIS-(\d+):* (.*)"$'), - ), - 'IMB': ( re.compile("^.* +(?:[Ii][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *IMB-(\d+):* (.*)"$'), - ), - 'HMBXR5601': ( re.compile("^.* +(?:[Hh][Mm][Bb][Xx][Rr]5601[ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *HMBXR5601-(\d+):* (.*)"$'), - ), - 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), - ), - 'MCS': ( re.compile("^.* +(?:[Mm][Cc][Ss][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *MCS-(\d+):* (.*)"$'), - ), - 'HMBFDHV': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Hh][Vv][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *HMBFDHV-(\d+):* (.*)"$'), - ), - 'HMBFDGMA': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Gg][Mm][Aa][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *HMBFDGMA-(\d+):* (.*)"$'), - ), - } - -mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") - -def processLog(gitlog, jirakeyprefix): - reverts = [] - merges = {} - other = [] - numbered = {} - (expectedpattern, revertpattern) = jiraprojectpattern[jirakeyprefix] - for line in gitlog: - expectedmatch = expectedpattern.match(line) - revertmatch = revertpattern.match(line) - mergematch = mergepattern.match(line) - if expectedmatch == None and revertmatch == None and mergematch == None: - other.append(line) - if revertmatch: - gisnumber = jirakeyprefix + "-" + revertmatch.group(2) - description = revertmatch.group(3) - reverts.append("Revert: {0} {1}".format(gisnumber, description)) - if mergematch: - merge = mergematch.group(2) - if not merge in merges: - merges[merge] = 1 - else: - merges[merge] += 1 - if expectedmatch: - gisnumber = jirakeyprefix + "-" + expectedmatch.group(1) - description = expectedmatch.group(2) - if not gisnumber in numbered: - numbered[gisnumber] = [] - numbered[gisnumber].append(description) - return (reverts, merges, other, numbered) - -def showDifferences(differences, jirakeyprefix, outfh): - (revertslog, mergeslog, otherlog, numberedlog) = differences - printDivider(outfh) - printTabbed(outfh, jirakeyprefix + "-Numbers Log:") - for (gisnumber, descriptions) in sorted(numberedlog.items()): - printTabbed(outfh, gisnumber, 1) - descriptions = numberedlog[gisnumber]; - for description in descriptions: - printTabbed(outfh, description, 2) - printDivider(outfh) - printTabbed(outfh, "Revert log:") - for reversion in sorted(revertslog): - printTabbed(outfh, reversion, 1) - printDivider(outfh) - printTabbed(outfh, "Merges log:") - for merge in sorted(mergeslog): - printTabbed(outfh, merge, 1) - printDivider(outfh) - printTabbed(outfh, "Other log:") - for other in sorted(otherlog): - printTabbed(outfh, other, 1) - -def main(argv=None): # IGNORE:C0111 - '''Command line options.''' - - if argv is None: - argv = sys.argv - else: - sys.argv.extend(argv) - - program_name = os.path.basename(sys.argv[0]) - program_version = "v%s" % __version__ - program_build_date = str(__updated__) - program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) - program_shortdesc = __import__('__main__').__doc__.split("\n")[1] - program_license = '''%s - - Created by dan on %s. - Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. - - Distributed on an "AS IS" basis without warranties - or conditions of any kind, either express or implied. - -USAGE -''' % (program_shortdesc, str(__date__)) - - try: - # Setup argument parser - parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) - parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") - parser.add_argument("-s", "--sourceversion", dest="sourceversion", action="store", default="origin/master", help="source version branch or tag to discover compare against [default: %(default)s]") - parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") - parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") - parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") - parser.add_argument("-f", "--difffile", dest="difffile", action="store", default="", help="file where differences file stored [default: %(default)s]") - - # Process arguments - args = parser.parse_args() - - try: - gitrootfolder = args.gitrootfolder - sourceversion = args.sourceversion - previousversion = args.previousversion - jirakeyprefix = args.jirakeyprefix - outputoptions = args.outputoptions - difffile = args.difffile - - print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) - print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) - - if difffile: - os.makedirs(os.path.dirname(difffile), exist_ok=True) - outfh = open(difffile, 'w') - else: - outfh = sys.stdout - - printDivider(outfh, times = 4) - printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, previousversion, sourceversion)) - gitlog = getGitLogDifferences(outfh, gitrootfolder, previousversion, sourceversion) - showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if 'opposite' in outputoptions.lower(): - printDivider(outfh, times = 4) - printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, sourceversion, previousversion)) - gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion) - showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if 'notcommon' in outputoptions.lower(): - printDivider(outfh, times = 4) - printTabbed(outfh, "Looking for changes that are not common to {1} or {2} at path: {0}".format(gitrootfolder, sourceversion, previousversion)) - gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) - showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - - if difffile: - outfh.close() - return 0 - except Exception as e: - print("Error while determining differences:", e.__repr__()) - return 1 - - except Exception as e: - indent = len(program_name) * " " - print(program_name + ": " + repr(e) + "\n") - print(indent + " for help use --help") - return 2 - -if __name__ == "__main__": - sys.exit(main()) From 4a9546d7d4710d76bc672883669279a42940dc5e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 Jan 2020 09:11:38 +0000 Subject: [PATCH 1289/1971] GIS-1621 - Bring EMB build into line with SM --- differences/show_release_differences.py | 225 ------------------------ 1 file changed, 225 deletions(-) delete mode 100644 differences/show_release_differences.py diff --git a/differences/show_release_differences.py b/differences/show_release_differences.py deleted file mode 100644 index 5c0f15d..0000000 --- a/differences/show_release_differences.py +++ /dev/null @@ -1,225 +0,0 @@ -''' -showreleasedifferences -- shortdesc - -showreleasedifferences generates a version folder with a common set of version information files in it - -@author: dan - -@copyright: 2017 Global Inkjet Systems Ltd. All rights reserved. -''' -import subprocess -import os -import sys -import re - -from argparse import ArgumentParser -from argparse import RawDescriptionHelpFormatter - -__all__ = [] -__version__ = 0.1 -__date__ = '2017-11-29' -__updated__ = '2017-11-29' - -gitExecutable = os.getenv("GIT_EXECUTABLE", default="git") - -class GitException(Exception): - def __init__(self, message): - self.message = message - - def __repr__(self): - return self.message - -def printDivider(outfh, times = 1, length = 100): - for _ in range(times): - outfh.write("{0}\n".format("*" * length)) - -TABSIZE = 4 -def printTabbed(outfh, string, tabs = 0): - outfh.write("{0}{1}\n".format(" " * (TABSIZE * tabs), string)) - -def getGitLogDifferences(outfh, gitrootfolder, previousRelease, currentRelease, tripledot = False): - if tripledot: - releaseExpression = previousRelease + "..." + currentRelease - else: - releaseExpression = previousRelease + ".." + currentRelease - currentdir = os.getcwd() - os.chdir(gitrootfolder) - gitlog = [] - printTabbed(outfh, "Executing: {0} {1} {2} {3}".format(gitExecutable, "log", "--oneline", releaseExpression)) - proc = subprocess.Popen([gitExecutable, "log", "--oneline", releaseExpression], stdout=subprocess.PIPE) - while True: - line = proc.stdout.readline() - if line: - linestring = line.decode('utf-8').rstrip() - gitlog.append(linestring) - #printTabbed(outfh, linestring, 1) - else: - break - proc.wait() - if proc.returncode > 0: - raise GitException("Git executable returned an error") - os.chdir(currentdir) - return gitlog - -jiraprojectpattern = { - 'GIS' : ( re.compile("^.* +(?:[gG][iI][sS][ _-]*|[tT]rac \#*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *GIS-(\d+):* (.*)"$'), - ), - 'IMB': ( re.compile("^.* +(?:[Ii][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *IMB-(\d+):* (.*)"$'), - ), - 'HMBXR5601': ( re.compile("^.* +(?:[Hh][Mm][Bb][Xx][Rr]5601[ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *HMBXR5601-(\d+):* (.*)"$'), - ), - 'SMB': ( re.compile("^.* +(?:[Ss][Mm][Bb][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *SMB-(\d+):* (.*)"$'), - ), - 'MCS': ( re.compile("^.* +(?:[Mm][Cc][Ss][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *MCS-(\d+):* (.*)"$'), - ), - 'HMBFDHV': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Hh][Vv][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *HMBFDHV-(\d+):* (.*)"$'), - ), - 'HMBFDGMA': ( re.compile("^.* +(?:[Hh][Mm][Bb][Ff][Dd][Gg][Mm][Aa][ _-]*|\#\s*)(\d+):*(.*)$"), - re.compile('^(\S*) Revert " *HMBFDGMA-(\d+):* (.*)"$'), - ), - } - -mergepattern = re.compile("^(.*)((?:Merge branch '.*'|Merge remote-tracking branch '.*'|Merge commit '.*'|Add '.*' from commit).*)$") - -def processLog(gitlog, jirakeyprefix): - reverts = [] - merges = {} - other = [] - numbered = {} - (expectedpattern, revertpattern) = jiraprojectpattern[jirakeyprefix] - for line in gitlog: - expectedmatch = expectedpattern.match(line) - revertmatch = revertpattern.match(line) - mergematch = mergepattern.match(line) - if expectedmatch == None and revertmatch == None and mergematch == None: - other.append(line) - if revertmatch: - gisnumber = jirakeyprefix + "-" + revertmatch.group(2) - description = revertmatch.group(3) - reverts.append("Revert: {0} {1}".format(gisnumber, description)) - if mergematch: - merge = mergematch.group(2) - if not merge in merges: - merges[merge] = 1 - else: - merges[merge] += 1 - if expectedmatch: - gisnumber = jirakeyprefix + "-" + expectedmatch.group(1) - description = expectedmatch.group(2) - if not gisnumber in numbered: - numbered[gisnumber] = [] - numbered[gisnumber].append(description) - return (reverts, merges, other, numbered) - -def showDifferences(differences, jirakeyprefix, outfh): - (revertslog, mergeslog, otherlog, numberedlog) = differences - printDivider(outfh) - printTabbed(outfh, jirakeyprefix + "-Numbers Log:") - for (gisnumber, descriptions) in sorted(numberedlog.items()): - printTabbed(outfh, gisnumber, 1) - descriptions = numberedlog[gisnumber]; - for description in descriptions: - printTabbed(outfh, description, 2) - printDivider(outfh) - printTabbed(outfh, "Revert log:") - for reversion in sorted(revertslog): - printTabbed(outfh, reversion, 1) - printDivider(outfh) - printTabbed(outfh, "Merges log:") - for merge in sorted(mergeslog): - printTabbed(outfh, merge, 1) - printDivider(outfh) - printTabbed(outfh, "Other log:") - for other in sorted(otherlog): - printTabbed(outfh, other, 1) - -def main(argv=None): # IGNORE:C0111 - '''Command line options.''' - - if argv is None: - argv = sys.argv - else: - sys.argv.extend(argv) - - program_name = os.path.basename(sys.argv[0]) - program_version = "v%s" % __version__ - program_build_date = str(__updated__) - program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date) - program_shortdesc = __import__('__main__').__doc__.split("\n")[1] - program_license = '''%s - - Created by dan on %s. - Copyright 2017 Global Inkjet Systems Ltd. All rights reserved. - - Distributed on an "AS IS" basis without warranties - or conditions of any kind, either express or implied. - -USAGE -''' % (program_shortdesc, str(__date__)) - - try: - # Setup argument parser - parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) - parser.add_argument("-g", "--gitroot", dest="gitrootfolder", action="store", default="GitRepository", help="root path of source files [default: %(default)s]") - parser.add_argument("-s", "--sourceversion", dest="sourceversion", action="store", default="origin/master", help="source version branch or tag to discover compare against [default: %(default)s]") - parser.add_argument("-p", "--previousversion", dest="previousversion", action="store", default="origin/master", help="source branch or tag to compare with [default: %(default)s]") - parser.add_argument("-j", "--jirakeyprefix", dest="jirakeyprefix", action="store", default="GIS", help="jira key prefix [default: %(default)s]") - parser.add_argument("-o", "--outputoptions", dest="outputoptions", action="store", default="", help="output options: Can be: opposite notcommon [default: %(default)s]") - parser.add_argument("-f", "--difffile", dest="difffile", action="store", default="", help="file where differences file stored [default: %(default)s]") - - # Process arguments - args = parser.parse_args() - - try: - gitrootfolder = args.gitrootfolder - sourceversion = args.sourceversion - previousversion = args.previousversion - jirakeyprefix = args.jirakeyprefix - outputoptions = args.outputoptions - difffile = args.difffile - - print("Git root:", gitrootfolder, "Source version:", sourceversion, "Previous source version:", previousversion) - print("Jira key prefix:", jirakeyprefix, "Output options:", outputoptions, "Diff file:", difffile) - - if difffile: - os.makedirs(os.path.dirname(difffile), exist_ok=True) - outfh = open(difffile, 'w') - else: - outfh = sys.stdout - - printDivider(outfh, times = 4) - printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, previousversion, sourceversion)) - gitlog = getGitLogDifferences(outfh, gitrootfolder, previousversion, sourceversion) - showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if 'opposite' in outputoptions.lower(): - printDivider(outfh, times = 4) - printTabbed(outfh, "Looking for changes in {2} that are not in {1} of the repository at path: {0}".format(gitrootfolder, sourceversion, previousversion)) - gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion) - showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - if 'notcommon' in outputoptions.lower(): - printDivider(outfh, times = 4) - printTabbed(outfh, "Looking for changes that are not common to {1} or {2} at path: {0}".format(gitrootfolder, sourceversion, previousversion)) - gitlog = getGitLogDifferences(outfh, gitrootfolder, sourceversion, previousversion, tripledot = True) - showDifferences(processLog(gitlog, jirakeyprefix), jirakeyprefix, outfh) - - if difffile: - outfh.close() - return 0 - except Exception as e: - print("Error while determining differences:", e.__repr__()) - return 1 - - except Exception as e: - indent = len(program_name) * " " - print(program_name + ": " + repr(e) + "\n") - print(indent + " for help use --help") - return 2 - -if __name__ == "__main__": - sys.exit(main()) From 6d884873efdf811f822ca97b93a8b1dda4985012 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 6 Jan 2020 15:54:48 +0000 Subject: [PATCH 1290/1971] GIS-1621 - Stop showing long git status messages --- versioncontrol/git.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 751d1c8..f5b2ebd 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -80,7 +80,8 @@ def String checkouttoreporoot(String gitURL) { submoduleCfg: [], ]) } else { - echo "Found ${gitURL} checked out at ${reporootsubfolder} ... checking status" + echo "Found ${gitURL} checked out at ${reporootsubfolder}" +/* dir(reporootsubfolder) { if (isUnix()) { sh """ @@ -94,6 +95,7 @@ def String checkouttoreporoot(String gitURL) { """ } } +*/ } } return reporootsubfolder From 264d434404ca68ca93e1d64e6ff0b2ca1defcebc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 7 Jan 2020 14:32:24 +0000 Subject: [PATCH 1291/1971] GIS-1621 - SMB -> EMB --- copy/logic.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/copy/logic.groovy b/copy/logic.groovy index 4d5291c..d1ece6d 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -36,6 +36,8 @@ pipeline { 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}" From 78973161434389f8a1b424f35b4e31910b0c1400 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 9 Jan 2020 15:34:13 +0000 Subject: [PATCH 1292/1971] CORE-76 - Change version numbers from 1.xxxxx to 0.xxxxx --- meta/folder.groovy | 2 +- versionnumbering/generate.groovy | 6 +++--- versionstamping/versionstamper.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 96c9626..f600155 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -157,7 +157,7 @@ class BuildStampInfo extends GISJsonSerialised { int revision String buildstamp - BuildStampInfo(script, buildstampprefix = "1.30000.0.", revision = 0, buildstamp = "1.30000.0.0") { + BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { super(script) this.buildstampprefix = buildstampprefix this.revision = revision diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index de60b66..71d7bf6 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -67,14 +67,14 @@ def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) { echo "Determining version number prefix from source branch name: ${sourcebranch}" sourcebranch = sourcebranch.toLowerCase() - def defaultversionprefix = "1.30000.0." + 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 = "1.20000.0." + 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}" @@ -83,7 +83,7 @@ def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) { def splits2 = sourcebranch.split('\\.') if (splits2.size() < 1) { - def thirdpartyversionprefix = "1.25000.0." + def thirdpartyversionprefix = "0.25000.0." echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}" return thirdpartyversionprefix } diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 1a65e6d..441ad06 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -8,7 +8,7 @@ def main(argv): # Call once arguments to allow or disallow something parser.add_argument('-f', '--filetoconvert', help='The file to convert') - parser.add_argument('-p', '--pattern', default='1.30000.0.0', help='The pattern to search for and replace') + 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) From afd724a91f779203a9267f311a2d1a136b122b67 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Jan 2020 17:04:41 +0000 Subject: [PATCH 1293/1971] Output repositories associated with sub-components --- release/do.groovy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/release/do.groovy b/release/do.groovy index a9f0a3e..817fd5f 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -4,6 +4,8 @@ unstablereason = "" summaryfolder = "${WORKSPACE}/summary" summaryfile = "${summaryfolder}/summary.txt" summarystring = "" +repoandtagsfile = "${summaryfolder}/repoandtags.txt" +repoandtagsstring = "" releaserepofolder = "${WORKSPACE}/releaserepos" sourcerepofolder = "${WORKSPACE}/sourcerepos" tempfolder = "${WORKSPACE}/temp" @@ -28,6 +30,8 @@ def preconditions() { unstablereason = "" summarystring = "" writeFile(file: summaryfile, text: "Release summary: \n") + repoandtagsstring = "" + writeFile(file: repoandtagsfile, text: "Repository summary: \n") } def setunstable(String reason) { @@ -42,6 +46,12 @@ def summaryappend(String 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 @@ -55,6 +65,7 @@ def getpreviousreleasemeta(buildmeta, String checkoutfolder) { 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}") @@ -70,6 +81,7 @@ def checkoutreleaserepo(buildmeta, String checkoutfolder) { 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) { @@ -89,6 +101,8 @@ def checkoutsourcerepo(buildmeta, String checkoutfolder) { sh("git clone ${sourcerepo} ${checkoutfolder}") } } + } else { + repoandtagsappend(" Source repo: None") } } @@ -365,6 +379,7 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri 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) @@ -374,6 +389,7 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri } summaryappend("\n") + repoandtagsappend("\n") } def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) { From b94b0cba262c9d19fbbd503b5efefa1056163557 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Jan 2020 23:18:20 +0000 Subject: [PATCH 1294/1971] Remove redundant parameter --- release/release.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/release/release.groovy b/release/release.groovy index 79c0234..26250ac 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -4,8 +4,7 @@ pipeline { stage('Initial setup') { steps { script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, RELEASE_REPO) + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) } } } From d7e2e117916a498a0dc4cb1ed190ed8be6d5bace Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Jan 2020 23:24:21 +0000 Subject: [PATCH 1295/1971] Autobuilderscript definition is needed later --- release/release.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/release.groovy b/release/release.groovy index 26250ac..a265c5b 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -4,7 +4,8 @@ pipeline { stage('Initial setup') { steps { script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) } } } From 09154e93c2e349d862e1ae65b5b1c4509b50c929 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Jan 2020 10:53:36 +0000 Subject: [PATCH 1296/1971] Make release script use new API --- release/release.groovy | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/release/release.groovy b/release/release.groovy index 79c0234..88c4e7b 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -4,8 +4,7 @@ pipeline { stage('Initial setup') { steps { script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, RELEASE_REPO) + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) } } } @@ -86,4 +85,3 @@ pipeline { } } } - From d8b38d9d0c4633bccba3fd8ae493c3f26e062156 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Jan 2020 11:04:14 +0000 Subject: [PATCH 1297/1971] Make release script use new API --- release/release.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/release.groovy b/release/release.groovy index 88c4e7b..e51a174 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -4,7 +4,8 @@ pipeline { stage('Initial setup') { steps { script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) } } } From 25496a4c747d36ef45c2dc0799fd16223551d611 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Jan 2020 16:36:16 +0000 Subject: [PATCH 1298/1971] Remove redundant parameter; Use latest api --- publish/publish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publish.groovy b/publish/publish.groovy index 5750275..7beb134 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -5,7 +5,7 @@ pipeline { steps { script { autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, RELEASE_REPO) + meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) } } } From d48825be597273ee8e3ff2208ef4ce401d19801c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 22 Jan 2020 14:48:32 +0000 Subject: [PATCH 1299/1971] Use non-deprecated API --- publish/publish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/publish.groovy b/publish/publish.groovy index 5750275..7beb134 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -5,7 +5,7 @@ pipeline { steps { script { autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, RELEASE_REPO) + meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) } } } From 0285f044100a81f4215253ad09796d5fc6f29f84 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 29 Jan 2020 17:21:37 +0000 Subject: [PATCH 1300/1971] Up the timeout protecting eclipse project opening --- 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 3e58e4f..9225100 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: 2, unit: 'MINUTES') { + timeout(time: 5, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } From 9f00d3420bdb0468288f238548769fa74c99adc8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 5 Feb 2020 20:46:06 +0000 Subject: [PATCH 1301/1971] Stop using deprecated API --- publish/publish.groovy | 2 +- release/release.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/publish.groovy b/publish/publish.groovy index 5750275..7beb134 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -5,7 +5,7 @@ pipeline { steps { script { autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, RELEASE_REPO) + meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) } } } diff --git a/release/release.groovy b/release/release.groovy index 79c0234..a265c5b 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.start(this, PRODUCT_NAME, SUBCOMPONENT_NAME, JIRA_KEY, RELEASE_REPO) + meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) } } } From c017cd21c1a81c711f39988226dc7533a8089ef2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 7 Feb 2020 15:27:53 +0000 Subject: [PATCH 1302/1971] Omit BASEBUILDNUMBER so it defaults to 0 --- staticanalysis/ccm.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 865e5fa..f0e5b80 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -54,7 +54,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) } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 21b8a5e..2bd12d9 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -73,7 +73,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) } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 59323c1..bdc6a2a 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -48,7 +48,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 44b189c724a028ac71da0ca1b5857ad672ac4094 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 21 Feb 2020 05:52:17 +0000 Subject: [PATCH 1303/1971] Add filtered copy --- copy/filtered.groovy | 70 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 copy/filtered.groovy diff --git a/copy/filtered.groovy b/copy/filtered.groovy new file mode 100644 index 0000000..feaa2ab --- /dev/null +++ b/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' + } + } +} From fbbabf9ffc71f4b7d813b86e8f42ebcaffb981ed Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 25 Feb 2020 08:56:26 +0000 Subject: [PATCH 1304/1971] Give out sha code info during release to git errors --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 817fd5f..9e04208 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -213,7 +213,7 @@ def boolean releasegittag(String postcommitshacode, String tag) { if (existingshacode) { // Tag exists if (existingshacode != postcommitshacode) { // 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 release tag ${tag} has been used at another commit other than HEAD - You must decide what to do with it - Not good practice to delete it or move it") + setunstable("The release tag ${tag} has been used at another commit other than HEAD - 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)") @@ -247,7 +247,7 @@ def boolean sourcegittag(String shacode, String tag) { 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") + 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 { From c1e89e5739ee2eefb5ca9ca2ba78ff4312dfde80 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 25 Feb 2020 11:20:32 +0000 Subject: [PATCH 1305/1971] Alter warning message --- release/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 9e04208..3221d25 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -211,9 +211,9 @@ def boolean releasegittag(String postcommitshacode, String tag) { // 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 HEAD + 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 HEAD - 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})") + 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)") From e5d12351bd80493ac89733f1a9208312fafb7abb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 26 Feb 2020 08:52:29 +0000 Subject: [PATCH 1306/1971] Display build parameters --- autobuilder.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autobuilder.groovy b/autobuilder.groovy index 1256394..ccc32c1 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -40,12 +40,14 @@ def startbuild(script, String productname = PRODUCT_NAME, String subcomponentnam 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") From 701621af722d74310ff3d6e4ce7f45089886308e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 1 Mar 2020 11:57:14 +0000 Subject: [PATCH 1307/1971] Remove @Grab command as it is causing the ftpclient jobs to explode --- remoteaccess/ftp.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/remoteaccess/ftp.groovy b/remoteaccess/ftp.groovy index bdc441f..25b9143 100644 --- a/remoteaccess/ftp.groovy +++ b/remoteaccess/ftp.groovy @@ -1,4 +1,3 @@ -@Grab(group='commons-net', module='commons-net', version='2.0') import org.apache.commons.net.ftp.FTPClient class FTPSiteInfo { @@ -30,4 +29,4 @@ FTPClient createFTPClient(FTPSiteInfo ftpsiteinfo) { return ftpclient } -return this; \ No newline at end of file +return this; From dc35fbbff6320cd927c9beba6ce595c2fcf7612b Mon Sep 17 00:00:00 2001 From: Christos Spirotis Date: Fri, 20 Mar 2020 07:38:56 +0000 Subject: [PATCH 1308/1971] 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 253025093e58bdfab2330ba1481f9659d8ac6d95 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 1 Apr 2020 13:09:34 +0100 Subject: [PATCH 1309/1971] Start converting autobuild for fx3 --- textutils/subst.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textutils/subst.groovy b/textutils/subst.groovy index 055a269..c0207a3 100644 --- a/textutils/subst.groovy +++ b/textutils/subst.groovy @@ -1,5 +1,5 @@ -def substitute(String filepath, String pattern, String subst) { +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') From ef343d40872aaca9649cccd9809b8002dc9c2c08 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 6 Apr 2020 10:04:59 +0100 Subject: [PATCH 1310/1971] GIS-7336 - Bring in FX3 into PS pipeline --- copy/all.groovy | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 copy/all.groovy diff --git a/copy/all.groovy b/copy/all.groovy new file mode 100644 index 0000000..c492b60 --- /dev/null +++ b/copy/all.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) + } + } + } + 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") + importer.artifactimport(meta, SOURCE_ARTIFACT_LOCATION, SOURCE_ARTIFACT_BUILD_JOB, SOURCE_ARTIFACT_BUILD_SELECTOR, SOURCE_ARTIFACT_RELEASE_REPO, SOURCE_ARTIFACT_RELEASE_REVISION, IMPORTS) + } + } + } + stage('Copy source artifacts') { + steps { + script { + dir(IMPORTS) { + fileOperations([ + fileCopyOperation(excludes: '', + flattenFiles: false, + includes: '**/*', + targetLocation: WORKSPACE) + ]) + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + archiveArtifacts( + artifacts: '**/*', + excludes: "${IMPORTS}/*,autobuild/*" + ) + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} \ No newline at end of file From b68652a3085caa30b23b27d75d597601806c2034 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 6 Apr 2020 10:24:01 +0100 Subject: [PATCH 1311/1971] GIS-7336 - Bring in FX3 into PS pipeline --- copy/all.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index c492b60..260a0a1 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -45,10 +45,7 @@ pipeline { stage('Archiving artifacts') { steps { script { - archiveArtifacts( - artifacts: '**/*', - excludes: "${IMPORTS}/*,autobuild/*" - ) + archiveArtifacts artifacts: '**/*', excludes: "${IMPORTS}/*" } } } From de89ba93597c7d2bf321a26f072b53f4fdd94d72 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 6 Apr 2020 10:29:05 +0100 Subject: [PATCH 1312/1971] GIS-7336 - Bring in FX3 into PS pipeline --- copy/all.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index 260a0a1..a185570 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -45,7 +45,10 @@ pipeline { stage('Archiving artifacts') { steps { script { - archiveArtifacts artifacts: '**/*', excludes: "${IMPORTS}/*" + def includes = '**/*' + def excludes = "${IMPORTS}/*" + echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" + archiveArtifacts artifacts: includes, excludes: excludes } } } From d7182ae51c86f9554de7d68e16c16fb361bb52d1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 6 Apr 2020 10:35:33 +0100 Subject: [PATCH 1313/1971] GIS-7336 - Bring in FX3 into PS pipeline --- copy/all.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index a185570..30317a7 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -48,7 +48,10 @@ pipeline { def includes = '**/*' def excludes = "${IMPORTS}/*" echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" - archiveArtifacts artifacts: includes, excludes: excludes + // This does not work: archiveArtifacts artifacts: includes, excludes: excludes + // so + cleaner.clean(cleanfolders) + archiveArtifacts artifacts: includes } } } From 2d53c1761ae0a505589e4e151612515aa3499df8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 6 Apr 2020 10:37:36 +0100 Subject: [PATCH 1314/1971] GIS-7336 - Bring in FX3 into PS pipeline --- copy/all.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/copy/all.groovy b/copy/all.groovy index 30317a7..a3c6c32 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -50,6 +50,10 @@ pipeline { 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 } From 7120ea56ce93dd429ed548391a32bfe56dfaed99 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 13:45:52 +0100 Subject: [PATCH 1315/1971] Add flatten option to job artifact option --- import/importer.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/import/importer.groovy b/import/importer.groovy index 41f5118..a4f3224 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -25,6 +25,7 @@ class ImportOptions { String excludes = '', boolean fingerprint = false, boolean nested = false, + boolean flatten = false, appendtoparentmeta = true) { m_script = script m_sourceselect = sourceselect.trim() @@ -33,6 +34,7 @@ class ImportOptions { m_excludes = excludes.trim() m_fingerprint = fingerprint m_nested = nested + m_flatten = flatten m_appendtoparentmeta = appendtoparentmeta } @@ -71,6 +73,10 @@ class ImportOptions { m_nested = nested } + void flattenimports(boolean flatten) { + m_flatten = flatten + } + void setappendtoparentmeta(boolean appendtoparentmeta) { m_appendtoparentmeta = appendtoparentmeta } @@ -113,6 +119,7 @@ def artifactimportfrombuildjob(meta, importoptions, String destpath) { $class: 'ParameterizedBuildSelector', parameterName: importoptions.m_buildnumberorselector ], + flatten: importoptions.m_flatten, target: destpath ) def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath) From bfa48433b643418c9b65bc396278a6a3b67d2182 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 14:31:12 +0100 Subject: [PATCH 1316/1971] Correct workspace clean when autobuild scripts in a custom position --- autobuilder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index ccc32c1..d78eab0 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -1,14 +1,14 @@ // Assume that WORKSPACE environment variable is set -autobuildroot = "${WORKSPACE}/autobuild" +autobuildroot = 'autobuild' commonscriptsroot = "${autobuildroot}/Common_scripts" metafolderscript = null def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") { - if (doclean) { + if (doclean) { echo "Cleaning workspace" // Save any script files that were loaded into the workspace at first and are required after cleaning the workspace - stash allowEmpty: true, includes: 'autobuild/**', name: 'Clean workspace stash', useDefaultExcludes: false + stash allowEmpty: true, includes: "${autobuildroot}/**', name: 'Clean workspace stash', useDefaultExcludes: false cleanWs() unstash name: 'Clean workspace stash' } From 0e9186fc4a362fb024521a622aa970b3c9a08692 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 14:35:05 +0100 Subject: [PATCH 1317/1971] Correct workspace clean when autobuild scripts in a custom position --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index d78eab0..4ad6acc 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -8,7 +8,7 @@ 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 - stash allowEmpty: true, includes: "${autobuildroot}/**', name: 'Clean workspace stash', useDefaultExcludes: false + stash allowEmpty: true, includes: "${autobuildroot}/**", name: 'Clean workspace stash', useDefaultExcludes: false cleanWs() unstash name: 'Clean workspace stash' } From 9698d245fceeea9c49f12400d9dacff950441c71 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 15:14:25 +0100 Subject: [PATCH 1318/1971] Cleanws stash is not saving .git folder --- autobuilder.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 4ad6acc..71d9b6a 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -8,9 +8,14 @@ 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 - stash allowEmpty: true, includes: "${autobuildroot}/**", name: 'Clean workspace stash', useDefaultExcludes: false + def stashname = 'Clean workspace stash' + stash(allowEmpty: true, + includes: "${autobuildroot}/**,${autobuildroot}/.git/**", + name: stashname, + useDefaultExcludes: false + ) cleanWs() - unstash name: 'Clean workspace stash' + unstash name: stashname } else { echo "Not cleaning workspace" From b131bc7218547b71f8598b2db56deff0f39deeba Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 15:21:16 +0100 Subject: [PATCH 1319/1971] Correct import flattenning --- import/importer.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/import/importer.groovy b/import/importer.groovy index a4f3224..650a7a8 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -9,6 +9,7 @@ class ImportOptions { 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_appendtoparentmeta // Append to parent meta String m_sourceselect // Where are the artifacts coming from From e8258c9b283c9af2b785fff5a74c4e96e36452a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 17:59:47 +0100 Subject: [PATCH 1320/1971] Correct import flattenning --- import/importer.groovy | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 650a7a8..bad2f5a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -10,6 +10,7 @@ class ImportOptions { 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_appendtoparentmeta // Append to parent meta String m_sourceselect // Where are the artifacts coming from @@ -27,6 +28,7 @@ class ImportOptions { boolean fingerprint = false, boolean nested = false, boolean flatten = false, + boolean includemetainfilter = true, appendtoparentmeta = true) { m_script = script m_sourceselect = sourceselect.trim() @@ -36,6 +38,7 @@ class ImportOptions { m_fingerprint = fingerprint m_nested = nested m_flatten = flatten + m_includemetainfilter = includemetainfilter m_appendtoparentmeta = appendtoparentmeta } @@ -77,6 +80,10 @@ class ImportOptions { void flattenimports(boolean flatten) { m_flatten = flatten } + + void includemetainfilter(boolean includemetainfilter) { + m_includemetainfilter = includemetainfilter + } void setappendtoparentmeta(boolean appendtoparentmeta) { m_appendtoparentmeta = appendtoparentmeta @@ -105,6 +112,14 @@ ImportOptions getNewImportOptions() { return new ImportOptions(this) } +def formFilter(ImportOptions importoptions) { + String filter = importoptions.m_filter + if (importoptions.m_includemetainfilter) { + filter = 'info/**,' + filter + } + return filter +} + 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") @@ -112,7 +127,7 @@ def artifactimportfrombuildjob(meta, importoptions, String destpath) { } copyArtifacts( - filter: importoptions.m_filter, + filter: formFilter(importoptions), excludes: importoptions.m_excludes, fingerprintArtifacts: importoptions.m_fingerprint, projectName: importoptions.m_jobname, @@ -146,7 +161,7 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { def rootrevision = importoptions.m_revision echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.m_filter) + 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)) @@ -190,7 +205,7 @@ def artifactimportfromrepo(meta, importoptions, String destpath) { def rootrevision = importoptions.m_revision echo "Cloning release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" - def ArrayList sparseitemlist = gh.convertSparseItemsString(importoptions.m_filter) + 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)) From e0f0ea2e1db7d4cec4c34b023f1ce1357d117395 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 18:06:01 +0100 Subject: [PATCH 1321/1971] Correct import flattenning --- import/importer.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index bad2f5a..1836b1d 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -115,8 +115,9 @@ ImportOptions getNewImportOptions() { def formFilter(ImportOptions importoptions) { String filter = importoptions.m_filter if (importoptions.m_includemetainfilter) { - filter = 'info/**,' + filter + filter = 'meta/**,' + filter } + echo "Import options filter is: ${filter}" return filter } From bb3a79b92232270eec86f9f18afd532ad8974c8c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 21:09:39 +0100 Subject: [PATCH 1322/1971] Correct import filter --- import/importer.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 1836b1d..adef629 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -113,9 +113,11 @@ ImportOptions getNewImportOptions() { } def formFilter(ImportOptions importoptions) { - String filter = importoptions.m_filter - if (importoptions.m_includemetainfilter) { - filter = 'meta/**,' + filter + def String filter = importoptions.m_filter + if (filter != '') { + if (importoptions.m_includemetainfilter) { + filter = 'meta/**,' + filter + } } echo "Import options filter is: ${filter}" return filter From a5cfe14f9b5db5cce4d0c2c5404b76beb3543fa5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Apr 2020 21:25:05 +0100 Subject: [PATCH 1323/1971] Clean folders before importing by default --- import/importer.groovy | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index adef629..8624421 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -11,6 +11,7 @@ class ImportOptions { 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 @@ -29,6 +30,7 @@ class ImportOptions { boolean nested = false, boolean flatten = false, boolean includemetainfilter = true, + boolean clean = true, appendtoparentmeta = true) { m_script = script m_sourceselect = sourceselect.trim() @@ -39,6 +41,7 @@ class ImportOptions { m_nested = nested m_flatten = flatten m_includemetainfilter = includemetainfilter + m_clean = clean m_appendtoparentmeta = appendtoparentmeta } @@ -57,7 +60,7 @@ class ImportOptions { } } - void setincrementversionnumber(boolean incrementversionnumber) { + void setincrementversionnumber(boolean incrementversionnumber = true) { m_incrementversionnumber = incrementversionnumber } @@ -69,22 +72,26 @@ class ImportOptions { m_excludes = excludes.trim() } - void setfingerprint(boolean fingerprint) { + void setfingerprint(boolean fingerprint = true) { m_fingerprint = fingerprint } - void setnested(boolean nested) { + void setnested(boolean nested = true) { m_nested = nested } - void flattenimports(boolean flatten) { + void flattenimports(boolean flatten = true) { m_flatten = flatten } - void includemetainfilter(boolean includemetainfilter) { + void includemetainfilter(boolean includemetainfilter = true) { m_includemetainfilter = includemetainfilter } + void clean(boolean clean = true) { + m_clean = clean + } + void setappendtoparentmeta(boolean appendtoparentmeta) { m_appendtoparentmeta = appendtoparentmeta } @@ -123,12 +130,23 @@ def formFilter(ImportOptions importoptions) { 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, @@ -164,6 +182,8 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { 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) @@ -204,6 +224,8 @@ def artifactimportfromrepo(meta, importoptions, String destpath) { return } + conditionalClean(importoptions, destpath) + def rooturl = importoptions.m_repo def rootrevision = importoptions.m_revision echo "Cloning release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}" From d147e91fd31c01455c2d8178858d040c0d7b1b0f Mon Sep 17 00:00:00 2001 From: Christos Spirotis Date: Wed, 22 Apr 2020 19:14:29 +0100 Subject: [PATCH 1324/1971] 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 bdd72825fc9dfc2aa4ba8b1172dd4e1ae13b0265 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 24 Apr 2020 15:05:03 +0100 Subject: [PATCH 1325/1971] Add parameter to do nested copies --- copy/all.groovy | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index a3c6c32..2ed24c0 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -24,7 +24,16 @@ pipeline { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - importer.artifactimport(meta, SOURCE_ARTIFACT_LOCATION, SOURCE_ARTIFACT_BUILD_JOB, SOURCE_ARTIFACT_BUILD_SELECTOR, SOURCE_ARTIFACT_RELEASE_REPO, SOURCE_ARTIFACT_RELEASE_REVISION, IMPORTS) + def copyoptions = importer.ImportOptions(this) + 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' ? true : false)) + importer.artifactimport(meta, copyoptions, IMPORTS) } } } From 869f9d895ac917da101cbc429b2a816f47126142 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 24 Apr 2020 15:06:41 +0100 Subject: [PATCH 1326/1971] Add parameter to do nested copies --- copy/all.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index 2ed24c0..7300a64 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -24,7 +24,7 @@ pipeline { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - def copyoptions = importer.ImportOptions(this) + def copyoptions = importer.getNewImportOptions() copyoptions.source( SOURCE_ARTIFACT_LOCATION, SOURCE_ARTIFACT_BUILD_JOB, From 84eb2c5af8a1d072bcb43be019dfd0134df28984 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 24 Apr 2020 15:08:19 +0100 Subject: [PATCH 1327/1971] Add parameter to do nested copies --- copy/all.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index 7300a64..b7c4607 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -32,7 +32,7 @@ pipeline { SOURCE_ARTIFACT_RELEASE_REPO, SOURCE_ARTIFACT_RELEASE_REVISION) echo "Nested: ${NESTED_COPY}" - copyoptions.setnested((NESTED_COPY == 'True' ? true : false)) + copyoptions.setnested(NESTED_COPY == 'true') importer.artifactimport(meta, copyoptions, IMPORTS) } } From 7515aadc46267c14609a9c12dca7d660373597d7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 10 May 2020 22:03:12 +0100 Subject: [PATCH 1328/1971] 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 82d62ce93f2ef11fd41ad759598b1df243955964 Mon Sep 17 00:00:00 2001 From: Anna Matczak Date: Fri, 22 May 2020 12:41:18 +0000 Subject: [PATCH 1329/1971] testing --- artifacts/metaexport.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 67d13c3..5a43292 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,6 +1,5 @@ - // 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 combineSubjobArtifacts(meta, subJobs) { def ArrayList artifactFolders = new ArrayList() for (subJob in subJobs) { def subJobObject = subJob[0] @@ -12,7 +11,7 @@ def combineSubjobArtifacts(meta, importer, subJobs) { dir(destFolder) { deleteDir() } - importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) + //importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) artifactFolders.add("${destFolder}/**") } } From e8489e716781323ccfd08a6f143ebc72ba3606e4 Mon Sep 17 00:00:00 2001 From: Anna Matczak Date: Tue, 26 May 2020 15:15:17 +0000 Subject: [PATCH 1330/1971] Revert temporary changes --- artifacts/metaexport.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 5a43292..f082d3a 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -11,7 +11,7 @@ def combineSubjobArtifacts(meta, subJobs) { dir(destFolder) { deleteDir() } - //importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) + importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) artifactFolders.add("${destFolder}/**") } } From 5ae85f47accd66747ad67654cd3f6fcf7393f9ba Mon Sep 17 00:00:00 2001 From: Anna Matczak Date: Tue, 26 May 2020 15:15:50 +0000 Subject: [PATCH 1331/1971] Update metaexport.groovy --- artifacts/metaexport.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index f082d3a..4d93cc5 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -1,5 +1,5 @@ // 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, subJobs) { +def combineSubjobArtifacts(meta, importer, subJobs) { def ArrayList artifactFolders = new ArrayList() for (subJob in subJobs) { def subJobObject = subJob[0] From b77403c92f93fcf6f729751cc39b3de5086d2ed3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Jun 2020 11:16:28 +0100 Subject: [PATCH 1332/1971] 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 1333/1971] 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 1334/1971] 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 1335/1971] 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 1336/1971] 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 1337/1971] 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 1338/1971] 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 1339/1971] 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 1340/1971] 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 1341/1971] 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 1342/1971] 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 1343/1971] 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 1344/1971] 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 1345/1971] 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 1346/1971] 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 1347/1971] 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 1348/1971] 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 1349/1971] 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 1350/1971] 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 1351/1971] 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 1352/1971] 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 1353/1971] 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 1354/1971] 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 1355/1971] 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 1356/1971] 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 1357/1971] 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 1358/1971] 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 1359/1971] 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 1360/1971] 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 1361/1971] 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 1362/1971] 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 1363/1971] 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 1364/1971] 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 1365/1971] 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 1366/1971] 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 1367/1971] 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 1368/1971] 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 1369/1971] 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 1370/1971] 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 1371/1971] 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 1372/1971] 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 1373/1971] 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 1374/1971] 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 1375/1971] 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 1376/1971] 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 1377/1971] 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 1378/1971] 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 1379/1971] 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 1380/1971] 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 1381/1971] 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 1382/1971] 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 1383/1971] 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 1384/1971] 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 1385/1971] 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 1386/1971] 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 1387/1971] 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 1388/1971] 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 1389/1971] 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 1390/1971] 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 1391/1971] 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 1392/1971] 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 1393/1971] 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 1394/1971] 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 1395/1971] 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 1396/1971] 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 1397/1971] 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 1398/1971] 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 1399/1971] 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 1400/1971] 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 1401/1971] 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 1402/1971] 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 1403/1971] 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 1404/1971] 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 1405/1971] 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 1406/1971] 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 1407/1971] 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 1408/1971] 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 1409/1971] 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 1410/1971] 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 1411/1971] 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 1412/1971] 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 1413/1971] 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 1414/1971] 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 1415/1971] 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 1416/1971] 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 1417/1971] 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 1418/1971] 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 1419/1971] 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 1420/1971] 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 1421/1971] 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 1422/1971] 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 1423/1971] 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 1424/1971] 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 1425/1971] 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 1426/1971] 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 1427/1971] 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 1428/1971] 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 1429/1971] 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 1430/1971] 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 1431/1971] 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 1432/1971] 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 1433/1971] 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 1434/1971] 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 1435/1971] 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 1436/1971] 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 1437/1971] 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 1438/1971] 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 f251bb6b96914017bbd8d9cd784a9def97238d7c Mon Sep 17 00:00:00 2001 From: "george.linsdell" Date: Fri, 8 Jan 2021 17:21:48 +0000 Subject: [PATCH 1439/1971] more patchy patchy by extending the timeout for fetch as the repo is apparently huge. --- versioncontrol/git.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index f5b2ebd..de9e244 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -195,8 +195,8 @@ def docheckout(String gitURL, String revision, int cloneDepth, String reporootpa ], doGenerateSubmoduleConfigurations: false, extensions: [ - [$class: 'GitLFSPull'], - [$class: 'CleanBeforeCheckout'], + [$class: 'GitLFSPull',timeout: 25], + [$class: 'CleanBeforeCheckout',timeout: 20], [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], From d8cb596e22371b05e57ece000c22be23c62e316d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 26 Feb 2021 17:47:38 +0000 Subject: [PATCH 1440/1971] 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 1441/1971] 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 1442/1971] 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 1443/1971] 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 1444/1971] 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 From 67c272f5c38905d285992ce0d6a1ec20239fd23c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 13:10:51 +0100 Subject: [PATCH 1445/1971] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/differences/json.groovy b/differences/json.groovy index 5ac37f2..6417d04 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -8,7 +8,27 @@ def comparefiles(importedjsonfile, currentjsonfile) { """ } else { - error "Windows not currently supporting json file comparison" + // Jq and diffutils can be installed on windows with chocolatey + sh """ + where jq + if errorlevel 1 EXIT /b 1 + where diff + if errorlevel 1 EXIT /b 1 + + # jq -S sorts json output + jq -S . "${importedjsonfile}" > temp1.txt + if errorlevel 1 EXIT /b 1 + jq -S . "${importedjsonfile}" > temp2.txt + if errorlevel 1 EXIT /b 1 + + diff -c temp1.txt temp2.txt + set el=%errorlevel% + + del temp1.txt + del temp2.txt + + if el GEQ 1 EXIT /b 1 + """ } } From 9e742eae89eadd4ee470bd64efb2ef6a11726510 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 13:21:16 +0100 Subject: [PATCH 1446/1971] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/differences/json.groovy b/differences/json.groovy index 6417d04..e5c1328 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -1,4 +1,5 @@ def comparefiles(importedjsonfile, currentjsonfile) { + echo "Comparing file: ${importedjsonfile} with: ${currentjsonfile}" if (isUnix()) { sh """ which jq From 7fabd5e1c3cf18a52b56928a1ee9b56e0d47a322 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 13:30:49 +0100 Subject: [PATCH 1447/1971] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index e5c1328..08e5054 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -10,8 +10,8 @@ def comparefiles(importedjsonfile, currentjsonfile) { } else { // Jq and diffutils can be installed on windows with chocolatey - sh """ - where jq + bat """ + where jq if errorlevel 1 EXIT /b 1 where diff if errorlevel 1 EXIT /b 1 From bf53ffd821ccdb1b6f1d2d7ad6bcacc35fa73722 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 16:25:18 +0100 Subject: [PATCH 1448/1971] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/differences/json.groovy b/differences/json.groovy index 08e5054..aef9501 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -11,23 +11,27 @@ def comparefiles(importedjsonfile, currentjsonfile) { else { // Jq and diffutils can be installed on windows with chocolatey bat """ + echo Checking utilities exist where jq if errorlevel 1 EXIT /b 1 where diff if errorlevel 1 EXIT /b 1 + echo Sorting json in files to compare # jq -S sorts json output jq -S . "${importedjsonfile}" > temp1.txt if errorlevel 1 EXIT /b 1 jq -S . "${importedjsonfile}" > temp2.txt if errorlevel 1 EXIT /b 1 + echo Diffing sorted json files diff -c temp1.txt temp2.txt set el=%errorlevel% del temp1.txt del temp2.txt + echo Diffing result: %el% if el GEQ 1 EXIT /b 1 """ } From a791e223f4fe3a752fd9b3b938b1e55d910ae335 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 16:33:24 +0100 Subject: [PATCH 1449/1971] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/differences/json.groovy b/differences/json.groovy index aef9501..3ff6e1e 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -12,6 +12,8 @@ def comparefiles(importedjsonfile, currentjsonfile) { // Jq and diffutils can be installed on windows with chocolatey bat """ echo Checking utilities exist + set + echo %PATH% where jq if errorlevel 1 EXIT /b 1 where diff From 24e0140582eccff7b56f9678963c63e37e25afb5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 16:43:37 +0100 Subject: [PATCH 1450/1971] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/json.groovy b/differences/json.groovy index 3ff6e1e..38b3b40 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -20,7 +20,7 @@ def comparefiles(importedjsonfile, currentjsonfile) { if errorlevel 1 EXIT /b 1 echo Sorting json in files to compare - # jq -S sorts json output + REM jq -S sorts json output jq -S . "${importedjsonfile}" > temp1.txt if errorlevel 1 EXIT /b 1 jq -S . "${importedjsonfile}" > temp2.txt From a3da4772ff1fcc8874b1938399e9162972b59970 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 16:53:19 +0100 Subject: [PATCH 1451/1971] AHBKM1024A-88 - Compare json files in windows --- versionnumbering/do.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index 666aee3..9f45f70 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -4,9 +4,9 @@ def stamp(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}" + 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}" + echo "Using python: ${PYTHON} and script: ${stampscript}" if (isUnix()) { sh """ "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" From 7ecd4c754adb68e20a9601669106e0adab8fa5b9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 17:11:33 +0100 Subject: [PATCH 1452/1971] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 38b3b40..48c419c 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -1,4 +1,4 @@ -def comparefiles(importedjsonfile, currentjsonfile) { +ddef comparefiles(importedjsonfile, currentjsonfile) { echo "Comparing file: ${importedjsonfile} with: ${currentjsonfile}" if (isUnix()) { sh """ @@ -11,30 +11,30 @@ def comparefiles(importedjsonfile, currentjsonfile) { else { // Jq and diffutils can be installed on windows with chocolatey bat """ - echo Checking utilities exist - set - echo %PATH% + REM echo Checking utilities exist + REM set + REM echo %PATH% where jq if errorlevel 1 EXIT /b 1 where diff if errorlevel 1 EXIT /b 1 - echo Sorting json in files to compare + REM echo Sorting json in files to compare REM jq -S sorts json output jq -S . "${importedjsonfile}" > temp1.txt if errorlevel 1 EXIT /b 1 jq -S . "${importedjsonfile}" > temp2.txt if errorlevel 1 EXIT /b 1 - echo Diffing sorted json files + REM echo Diffing sorted json files diff -c temp1.txt temp2.txt set el=%errorlevel% del temp1.txt del temp2.txt - echo Diffing result: %el% - if el GEQ 1 EXIT /b 1 + REM echo Diffing result: %el% + if %el% GEQ 1 EXIT /b 1 """ } } From 1057c1a7bf24a0a4db7c22c76941c3af06b2a347 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 17:25:41 +0100 Subject: [PATCH 1453/1971] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/json.groovy b/differences/json.groovy index 48c419c..78df0bd 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -1,4 +1,4 @@ -ddef comparefiles(importedjsonfile, currentjsonfile) { +def comparefiles(importedjsonfile, currentjsonfile) { echo "Comparing file: ${importedjsonfile} with: ${currentjsonfile}" if (isUnix()) { sh """ From e8e5a862c0d7ae1267edadc8c732fd9d3f6515c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 17:56:11 +0100 Subject: [PATCH 1454/1971] AHBKM1024A-88 - Compare json files in windows --- differences/file.groovy | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/differences/file.groovy b/differences/file.groovy index ab4102f..bfb8407 100644 --- a/differences/file.groovy +++ b/differences/file.groovy @@ -1,15 +1,22 @@ def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { + def wsparameter = "-w" + if (!ignorewhitespace) { + wsparameter = "" + } if (isUnix()) { - def wsparameter = "-w" - if (!ignorewhitespace) { - wsparameter = "" - } sh """ diff -c ${wsparameter} "${importedfile}" "${currentfile}" """ } else { - error "Windows not currently supporting file comparison" + // diffutils can be installed on windows with chocolatey + bat """ + REM echo Checking utilities exist + where diff + if errorlevel 1 EXIT /b 1 + + diff -c ${wsparameter} "${importedfile}" "${currentfile}" + """ } } From 8309234b3e5c5a0a45ec8b9cc9a37d4a4cae15fb Mon Sep 17 00:00:00 2001 From: "george.linsdell" Date: Wed, 14 Apr 2021 16:52:20 +0100 Subject: [PATCH 1455/1971] GTS-694: Fix syntax in HMB Test Build --- autobuilder.groovy | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 2879f11..a91a46c 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -44,7 +44,15 @@ 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 productvariant = '', 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 @@ -72,13 +80,27 @@ def startbuild(script, String productname = PRODUCT_NAME, String subcomponentnam 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) { +// DEPRECATED Metod, Use StartBuild Instead. +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) { +def startnonbuild( + script, + autobuildpath = autobuildroot, + commonscriptspath = commonscriptsroot + ) { echo "Starting non-build job...." autobuildroot = autobuildpath From 77c41b862d2b1f75ac8fcf331afc8ac2e903cf71 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 21 Apr 2021 15:50:48 +0100 Subject: [PATCH 1456/1971] Whitespace; Spelling mistake in comment --- autobuilder.groovy | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index a91a46c..a8d418d 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -43,16 +43,16 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { return altered } -// Start up boilderplate +// Start up boilerplate def startbuild( - script, - String productname = PRODUCT_NAME, - String subcomponentname = SUBCOMPONENT_NAME, - String releaserepo = RELEASE_REPO, - String productvariant = '', - String autobuildpath = autobuildroot, - String commonscriptspath = commonscriptsroot - ) { + 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 @@ -82,25 +82,25 @@ def startbuild( // DEPRECATED Metod, Use StartBuild Instead. 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 - ) { + 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 - ) { + script, + autobuildpath = autobuildroot, + commonscriptspath = commonscriptsroot + ) { echo "Starting non-build job...." autobuildroot = autobuildpath From cfad76f287a4c34426dc2d774af4cb0b09ab7954 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 6 May 2021 13:31:19 +0100 Subject: [PATCH 1457/1971] Add checksumming log line --- checksum/utils.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/checksum/utils.groovy b/checksum/utils.groovy index c2503cd..be7569d 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -5,6 +5,7 @@ def generatelist(meta, checksummable) { def checksumset = meta.checksuminfo.addChecksumSet(filepath) def files = findFiles(glob: filepath) for (file in files) { + echo "Checksumming: ${file.path}" def sum = sha1(file: file.path).trim() checksumset.addChecksumPair(file.path, sum) } From 1e531aba349325a2b631474e4cf0ae264a07b896 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 27 May 2021 14:25:37 +0100 Subject: [PATCH 1458/1971] CORE-368 - Place binaries according to associated confluence page --- packaging/debian.groovy | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index ead24fa..fae18ab 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -27,7 +27,7 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix @@ -38,23 +38,23 @@ class DebRootDefinition { 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_KERNEL = "${DEBPATH}/opt/gis/kernel" - GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" - GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + ETC = "${DEBPATH}/etc" + inpackagepathsuffix + GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + inpackagepathsuffix + GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + inpackagepathsuffix + GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + inpackagepathsuffix + GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + inpackagepathsuffix + GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" + inpackagepathsuffix + GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + inpackagepathsuffix + GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + inpackagepathsuffix + GIS_OPT_KERNEL = "${DEBPATH}/opt/gis/kernel" + inpackagepathsuffix + GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + inpackagepathsuffix + GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + inpackagepathsuffix - 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" + USR_BIN = "${DEBPATH}/usr/bin" + inpackagepathsuffix + USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + inpackagepathsuffix + LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + inpackagepathsuffix + HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + inpackagepathsuffix + LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + inpackagepathsuffix } } From 648fc2124b080903b7926166c510b23c4d53466c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 27 May 2021 22:25:14 +0100 Subject: [PATCH 1459/1971] CORE-368 - Place binaries according to associated confluence page --- packaging/debian.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index fae18ab..65d3731 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -27,7 +27,7 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') { + DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix @@ -58,8 +58,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) { - return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp) +def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') { + return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) } def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { From 0a7297eaeb7ec1dd2f48909396c4f3655a922d9b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 10 Jun 2021 13:45:17 +0100 Subject: [PATCH 1460/1971] Debugging why parameter is not making it into script --- copy/logic.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/copy/logic.groovy b/copy/logic.groovy index 7ae0fe1..24bc069 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -26,6 +26,7 @@ pipeline { stage('Copying logic artifacts') { steps { script { + bat('set') 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 6059f5157206e07c70c93fdc385aa2f63829c8ca Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 10 Jun 2021 13:47:35 +0100 Subject: [PATCH 1461/1971] Debugging why parameter is not making it into script --- copy/logic.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/logic.groovy b/copy/logic.groovy index 24bc069..43ebd9c 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -26,7 +26,7 @@ pipeline { stage('Copying logic artifacts') { steps { script { - bat('set') + sh('env') 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 5830e6172da4dadb31c3ccf91e1a3bfce45fff7f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 20 Jun 2021 16:34:32 +0100 Subject: [PATCH 1462/1971] Print out git checkout options --- versioncontrol/git.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index f5b2ebd..2ac2f82 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -185,6 +185,7 @@ def showsparseitemlist(ArrayList sparseitemlist = new ArrayList( } def docheckout(String gitURL, String revision, int cloneDepth, String reporootpath, boolean shallowClone, String targetDir, sparseitemlist) { + echo "Git: Checking out: URL: ${gitURL} Revision: ${revision} to: ${targetDir}" checkout([ $class: 'GitSCM', userRemoteConfigs: [ From 1c9c8d1744259fecb358c4395eac40824b43d766 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 11:57:04 +0100 Subject: [PATCH 1463/1971] Debug northey --- versioncontrol/git.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 2ac2f82..addf2da 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -102,6 +102,7 @@ def String checkouttoreporoot(String gitURL) { } def checkgitlfsinstall() { + echo "I am here" if (isUnix()) { sh """ git lfs install @@ -110,10 +111,13 @@ def checkgitlfsinstall() { } else { bat """ + set + git lfs install if errorlevel 1 EXIT /b 1 """ } + echo "I am here 3" } //No credentials specified From 1ca22a8f34e2768e2bdded8fe29116ebb0cfa6a4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 12:04:22 +0100 Subject: [PATCH 1464/1971] Debug northey --- versioncontrol/git.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index addf2da..6e618a3 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -110,6 +110,7 @@ def checkgitlfsinstall() { """ } else { + echo "I am here 2" bat """ set From 2342841709e513a71cd67ad8fd08fd2dee009b58 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 13:40:59 +0100 Subject: [PATCH 1465/1971] Debug northey --- versioncontrol/git.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 6e618a3..eb63f46 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -111,11 +111,11 @@ def checkgitlfsinstall() { } else { echo "I am here 2" - bat """ - set - + powershell """ + echo "I am here 2.5" + git lfs install - if errorlevel 1 EXIT /b 1 + if ($lastexitcode -ge 1) { exit 1 } """ } echo "I am here 3" From 3ca45690fbb9660caf2655640d839c6cff11106b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 14:04:45 +0100 Subject: [PATCH 1466/1971] Debug northey --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index eb63f46..872480c 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -115,7 +115,7 @@ def checkgitlfsinstall() { echo "I am here 2.5" git lfs install - if ($lastexitcode -ge 1) { exit 1 } + if (\$lastexitcode -ge 1) { exit 1 } """ } echo "I am here 3" From 6cef1ceb84e75433486509d7c6ca18dc031966af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 15:57:50 +0100 Subject: [PATCH 1467/1971] Remove debug for northey --- versioncontrol/git.groovy | 5 ----- 1 file changed, 5 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 872480c..24aa094 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -102,7 +102,6 @@ def String checkouttoreporoot(String gitURL) { } def checkgitlfsinstall() { - echo "I am here" if (isUnix()) { sh """ git lfs install @@ -110,15 +109,11 @@ def checkgitlfsinstall() { """ } else { - echo "I am here 2" powershell """ - echo "I am here 2.5" - git lfs install if (\$lastexitcode -ge 1) { exit 1 } """ } - echo "I am here 3" } //No credentials specified From 149ece23042c851afe3450013165956a8cabe06b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 17:41:19 +0100 Subject: [PATCH 1468/1971] Debugging northey --- versioncontrol/git.groovy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 24aa094..1732cff 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -12,7 +12,7 @@ def boolean isShallowClonedRepo(String gitrootpath) { 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() + isshallowclone = powershell(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() } echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" } @@ -89,9 +89,9 @@ def String checkouttoreporoot(String gitURL) { if [ \$? -ne 0 ]; then exit 1; fi """ } else { - bat """ + powershell """ git status - if errorlevel 1 EXIT /b 1 + if (\$lastexitcode -ge 1) { exit 1 } """ } } @@ -222,7 +222,7 @@ def gitinit(String targetDir, String reporootpath) { git init "${targetDir}" """ } else { - bat """ + powershell """ git init "${targetDir}" """ } @@ -246,7 +246,7 @@ def setlfsfetchinclude(String targetDir, ArrayList sparseitemlist) { git config lfs.fetchinclude "${sparseitemliststring}" """ } else { - bat """ + powershell """ git config lfs.fetchinclude "${sparseitemliststring}" """ } @@ -264,7 +264,7 @@ def gitsparserestore(String targetDir) { git reset --hard > /dev/null """ } else { - bat """ + powershell """ git rm -rf . 2> nul git clean -fxd 2> nul git reset --hard 2> nul @@ -312,7 +312,7 @@ def checkRepoExists(String gitURL) { returnStatus: true ) } else { - result = bat( script: """ + result = powershell( script: """ @git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY """, returnStatus: true From 4c74502b7557d6d12c534cf5511338ea25d28b0c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 17:43:04 +0100 Subject: [PATCH 1469/1971] Debugging northey --- versioncontrol/git.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 1732cff..5bcb0ba 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -12,7 +12,7 @@ def boolean isShallowClonedRepo(String gitrootpath) { isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() } else { - isshallowclone = powershell(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() + isshallowclone = powershell(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() } echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" } @@ -313,7 +313,7 @@ def checkRepoExists(String gitURL) { ) } else { result = powershell( script: """ - @git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY + git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY """, returnStatus: true ) From 07464ef1b17296f25c7e6f3b8d835ba004aa9408 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 21:37:41 +0100 Subject: [PATCH 1470/1971] Convert from bat to powershell --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a2fd4e1..f35919a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -38,7 +38,7 @@ class ProductInfo extends GISJsonSerialised { 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) + pstatus = script.powershell(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") @@ -48,7 +48,7 @@ class ProductInfo extends GISJsonSerialised { 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) + sstatus = script.powershell(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") @@ -59,7 +59,7 @@ class ProductInfo extends GISJsonSerialised { vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - vstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) + vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) } if (vstatus > 0) { script.error("The subcomponent name: ${variant} needs to be renamed as it cannot be used in a git tag name") From 18addad030ec7724930f4d84db1e647b387135df Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 21:44:23 +0100 Subject: [PATCH 1471/1971] Convert from bat to powershell --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f35919a..704bfc8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -38,7 +38,7 @@ class ProductInfo extends GISJsonSerialised { pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true) + pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" 2>&1>\$null", , 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") @@ -48,7 +48,7 @@ class ProductInfo extends GISJsonSerialised { sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - sstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true) + sstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" 2>&1>\$null", , 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") @@ -59,7 +59,7 @@ class ProductInfo extends GISJsonSerialised { vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) + vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" 2>&1>\$null", , returnStatus: true) } if (vstatus > 0) { script.error("The subcomponent name: ${variant} needs to be renamed as it cannot be used in a git tag name") From 662e2b7526741d1239b06e8af8f1e941be317c3d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 22:00:02 +0100 Subject: [PATCH 1472/1971] Debugging --- configuration/configuration.groovy | 6 ++++++ meta/folder.groovy | 1 + 2 files changed, 7 insertions(+) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 2a7f1ab..b06c931 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,6 +1,7 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { + echo "I am here 2" meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) } @@ -12,7 +13,12 @@ def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, St def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) + echo "I am here 1" + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) + + echo("I am here 4") + } return this diff --git a/meta/folder.groovy b/meta/folder.groovy index 704bfc8..0fbcc8d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -526,6 +526,7 @@ class MetaInfo extends GISJsonSerialised { } void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { + script.echo("I am here 3") 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) From d2e5ef51ba87b11f5b4ae607352387a4b94a4399 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 22:10:09 +0100 Subject: [PATCH 1473/1971] Debugging --- commandline/commandline.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/commandline/commandline.groovy b/commandline/commandline.groovy index df99a75..38f80fa 100644 --- a/commandline/commandline.groovy +++ b/commandline/commandline.groovy @@ -2,8 +2,7 @@ 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 + return powershell(returnStdout: true, script: """ ${cmd} """ ).trim() From efc2ce75ed08d164fd02a3ee61b007ec5b68e642 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 23:04:07 +0100 Subject: [PATCH 1474/1971] Convert bat to powershell; Remove debug --- configuration/configuration.groovy | 6 ---- differences/json.groovy | 46 ++++++++++++++++++------------ meta/folder.groovy | 1 - versionnumbering/do.groovy | 2 +- versionnumbering/generate.groovy | 8 +++--- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index b06c931..2a7f1ab 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,7 +1,6 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { - echo "I am here 2" meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) } @@ -13,12 +12,7 @@ def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, St def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) - echo "I am here 1" - registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) - - echo("I am here 4") - } return this diff --git a/differences/json.groovy b/differences/json.groovy index 78df0bd..7f2b662 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -10,31 +10,41 @@ def comparefiles(importedjsonfile, currentjsonfile) { } else { // Jq and diffutils can be installed on windows with chocolatey - bat """ - REM echo Checking utilities exist - REM set - REM echo %PATH% - where jq - if errorlevel 1 EXIT /b 1 - where diff - if errorlevel 1 EXIT /b 1 + powershell """ + # echo Checking utilities exist + # set + # echo %PATH% + try { + if (Get-Command jq) {} + } + catch { + echo "jq is unavailable" + exit $false + } + try { + if (Get-Command diff) {} + } + catch { + echo "diff is unavailable" + exit $false + } - REM echo Sorting json in files to compare - REM jq -S sorts json output + # echo Sorting json in files to compare + # jq -S sorts json output jq -S . "${importedjsonfile}" > temp1.txt - if errorlevel 1 EXIT /b 1 + if (\$lastexitcode -ge 1) { exit 1 } jq -S . "${importedjsonfile}" > temp2.txt - if errorlevel 1 EXIT /b 1 + if (\$lastexitcode -ge 1) { exit 1 } - REM echo Diffing sorted json files + # echo Diffing sorted json files diff -c temp1.txt temp2.txt - set el=%errorlevel% + \$el = \$lastexitcode - del temp1.txt - del temp2.txt + Remove-Item temp1.txt + Remove-Item temp2.txt - REM echo Diffing result: %el% - if %el% GEQ 1 EXIT /b 1 + # echo Diffing result: \$el + if (\$el -ge 1) { exit 1 } """ } } diff --git a/meta/folder.groovy b/meta/folder.groovy index 0fbcc8d..704bfc8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -526,7 +526,6 @@ class MetaInfo extends GISJsonSerialised { } void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) { - script.echo("I am here 3") 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) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index 9f45f70..f2a64ca 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -13,7 +13,7 @@ def stamp(convertdetails) { """ } else { - bat """ + powershell """ "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 71d7bf6..405b7be 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -28,7 +28,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { 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() + changecount = powershell(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger() } echo "Change count: ${changecount}" def int mvnp1 = maxversionnumber() + 1 @@ -39,21 +39,21 @@ def getGitRevision(String gitrootpath, int basebuildnumber) { gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim() } else { - gitrevision = bat(returnStdout: true, script: "@git rev-parse HEAD").trim() + gitrevision = powershell(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() + remoteinfo = powershell(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() + remoteurl = powershell(returnStdout: true, script: "git config --get remote.origin.url").trim() } echo "Remote URL: ${remoteurl}" } From b8b6848c9635c60b6c2582305374284d756eadd6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 23:10:19 +0100 Subject: [PATCH 1475/1971] Convert bat to powershell; Remove debug --- differences/json.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 7f2b662..7e9b7c3 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -19,14 +19,14 @@ def comparefiles(importedjsonfile, currentjsonfile) { } catch { echo "jq is unavailable" - exit $false + exit \$false } try { if (Get-Command diff) {} } catch { echo "diff is unavailable" - exit $false + exit \$false } # echo Sorting json in files to compare From 564ed643ca64e67f104c0b2dd86d7489f1fd183c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 00:07:24 +0100 Subject: [PATCH 1476/1971] Convert bat to powershell; Remove debug --- differences/json.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 7e9b7c3..1b95c7b 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -37,14 +37,17 @@ def comparefiles(importedjsonfile, currentjsonfile) { if (\$lastexitcode -ge 1) { exit 1 } # echo Diffing sorted json files - diff -c temp1.txt temp2.txt - \$el = \$lastexitcode + $str1 = Get-Content "temp1.txt" + $str2 = Get-Content "temp2.txt" + $diff = Compare-Object $str1 $str2 + if ($diff -ne '') { + echo "Difference between JSON files:" + echo $diff + exit 1 + } Remove-Item temp1.txt Remove-Item temp2.txt - - # echo Diffing result: \$el - if (\$el -ge 1) { exit 1 } """ } } From fa9fb620a74ed966ced1728ed6d37afe9e176e56 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 00:11:43 +0100 Subject: [PATCH 1477/1971] Convert bat to powershell; Remove debug --- differences/json.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 1b95c7b..800f62c 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -37,12 +37,12 @@ def comparefiles(importedjsonfile, currentjsonfile) { if (\$lastexitcode -ge 1) { exit 1 } # echo Diffing sorted json files - $str1 = Get-Content "temp1.txt" - $str2 = Get-Content "temp2.txt" - $diff = Compare-Object $str1 $str2 - if ($diff -ne '') { + \$str1 = Get-Content "temp1.txt" + \$str2 = Get-Content "temp2.txt" + \$diff = Compare-Object \$str1 \$str2 + if (\$diff -ne '') { echo "Difference between JSON files:" - echo $diff + echo \$diff exit 1 } From 9f884b1b53aebbff9a03e5dcea463a8630553270 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 00:24:03 +0100 Subject: [PATCH 1478/1971] Convert bat to powershell; Remove debug --- differences/json.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 800f62c..82b5293 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -41,8 +41,7 @@ def comparefiles(importedjsonfile, currentjsonfile) { \$str2 = Get-Content "temp2.txt" \$diff = Compare-Object \$str1 \$str2 if (\$diff -ne '') { - echo "Difference between JSON files:" - echo \$diff + echo "Difference between JSON files: \$diff" exit 1 } From 0e5d7b898f7a639813cf818baf6fdcacfcd407e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 07:26:20 +0100 Subject: [PATCH 1479/1971] Convert bat to powershell: diffing --- differences/json.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 82b5293..b195883 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -39,9 +39,9 @@ def comparefiles(importedjsonfile, currentjsonfile) { # echo Diffing sorted json files \$str1 = Get-Content "temp1.txt" \$str2 = Get-Content "temp2.txt" - \$diff = Compare-Object \$str1 \$str2 - if (\$diff -ne '') { - echo "Difference between JSON files: \$diff" + \$diffed = Compare-Object \$str1 \$str2 + if (\$diffed -ne '') { + Write-Output "Difference between JSON files: \$diffed" exit 1 } From 055270addc35ceab27d791e350e76aec5bee4560 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 07:31:15 +0100 Subject: [PATCH 1480/1971] Convert bat to powershell: diffing --- differences/json.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/json.groovy b/differences/json.groovy index b195883..853e0e0 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -41,7 +41,7 @@ def comparefiles(importedjsonfile, currentjsonfile) { \$str2 = Get-Content "temp2.txt" \$diffed = Compare-Object \$str1 \$str2 if (\$diffed -ne '') { - Write-Output "Difference between JSON files: \$diffed" + Write-Host "Difference between JSON files: " \$diffed exit 1 } From 8811df27c9a63c9217420fe72b2eb85793b765a7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:13:00 +0100 Subject: [PATCH 1481/1971] Convert bat to powershell: diffing --- differences/json.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 853e0e0..e3ce38e 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -39,9 +39,9 @@ def comparefiles(importedjsonfile, currentjsonfile) { # echo Diffing sorted json files \$str1 = Get-Content "temp1.txt" \$str2 = Get-Content "temp2.txt" - \$diffed = Compare-Object \$str1 \$str2 - if (\$diffed -ne '') { - Write-Host "Difference between JSON files: " \$diffed + if (\$str1 -ne \$str2) { + Write-Host "Difference between JSON files: " + Compare-Object \$str1 \$str2 exit 1 } From 4339d74109a86e632224ac3b14650e05d88d559a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:37:51 +0100 Subject: [PATCH 1482/1971] Convert bat to powershell: diffing --- differences/json.groovy | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index e3ce38e..d61ed26 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -33,20 +33,17 @@ def comparefiles(importedjsonfile, currentjsonfile) { # jq -S sorts json output jq -S . "${importedjsonfile}" > temp1.txt if (\$lastexitcode -ge 1) { exit 1 } - jq -S . "${importedjsonfile}" > temp2.txt + jq -S . "${currentjsonfile}" > temp2.txt if (\$lastexitcode -ge 1) { exit 1 } # echo Diffing sorted json files - \$str1 = Get-Content "temp1.txt" - \$str2 = Get-Content "temp2.txt" - if (\$str1 -ne \$str2) { - Write-Host "Difference between JSON files: " - Compare-Object \$str1 \$str2 - exit 1 - } - + diff.exe -c .\temp1.txt .\temp2.txt + \$lec = \$lastexitcode + Remove-Item temp1.txt Remove-Item temp2.txt + + if (\$lec -ge 1) { exit 1 } """ } } From 35e62958b99a198c857b91524e8916126e6292a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:41:01 +0100 Subject: [PATCH 1483/1971] Convert bat to powershell: diffing --- differences/json.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/json.groovy b/differences/json.groovy index d61ed26..0556188 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -37,7 +37,7 @@ def comparefiles(importedjsonfile, currentjsonfile) { if (\$lastexitcode -ge 1) { exit 1 } # echo Diffing sorted json files - diff.exe -c .\temp1.txt .\temp2.txt + diff.exe -c temp1.txt temp2.txt \$lec = \$lastexitcode Remove-Item temp1.txt From f0b0a3a0c1c6bc74efc62d399e6feb756c0d27c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:45:14 +0100 Subject: [PATCH 1484/1971] Convert bat to powershell: diffing --- differences/file.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/differences/file.groovy b/differences/file.groovy index bfb8407..dd48440 100644 --- a/differences/file.groovy +++ b/differences/file.groovy @@ -10,10 +10,10 @@ def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { } else { // diffutils can be installed on windows with chocolatey - bat """ - REM echo Checking utilities exist - where diff - if errorlevel 1 EXIT /b 1 + powershell """ + # echo Checking utilities exist + # where diff + # if errorlevel 1 EXIT /b 1 diff -c ${wsparameter} "${importedfile}" "${currentfile}" """ From 339d0b57bb3bc27a1c60ddf9cc368b465a2355cb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:51:54 +0100 Subject: [PATCH 1485/1971] Convert bat to powershell: diffing --- differences/file.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/file.groovy b/differences/file.groovy index dd48440..aa4814a 100644 --- a/differences/file.groovy +++ b/differences/file.groovy @@ -15,7 +15,7 @@ def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { # where diff # if errorlevel 1 EXIT /b 1 - diff -c ${wsparameter} "${importedfile}" "${currentfile}" + diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}" """ } } From eed40f2192dfc4b9542f0f0c08471a21154c49ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 14:10:37 +0100 Subject: [PATCH 1486/1971] Convert bat to powershell: diffing --- versionnumbering/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index f2a64ca..dfbe440 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -13,6 +13,7 @@ def stamp(convertdetails) { """ } else { + echo """${PYTHON}" -u ""${stampscript}"" -f ""${filetoconvert}"" -p ""${pattern}"" -s ""${replacement""}" powershell """ "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ From efa3011edc83d62f876c7e3a5d3c6f99a833c2da Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 14:13:14 +0100 Subject: [PATCH 1487/1971] Convert bat to powershell: diffing --- versionnumbering/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index dfbe440..81ba939 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -13,7 +13,7 @@ def stamp(convertdetails) { """ } else { - echo """${PYTHON}" -u ""${stampscript}"" -f ""${filetoconvert}"" -p ""${pattern}"" -s ""${replacement""}" + echo "\"${PYTHON}\" -u \"${stampscript}\" -f \"${filetoconvert}\" -p \"${pattern}\" -s \"${replacement}\"" powershell """ "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ From 18368ff7377f1fb906710f853ee702775ed67ca7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 14:21:53 +0100 Subject: [PATCH 1488/1971] Convert bat to powershell: diffing --- versionnumbering/do.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index 81ba939..208a60f 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -13,9 +13,8 @@ def stamp(convertdetails) { """ } else { - echo "\"${PYTHON}\" -u \"${stampscript}\" -f \"${filetoconvert}\" -p \"${pattern}\" -s \"${replacement}\"" powershell """ - "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + & "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ } } From 57f0e61667b5d88f25fd205b6008a74aae884b33 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 8 Aug 2021 07:06:41 +0000 Subject: [PATCH 1489/1971] 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..aeac840 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# HMB_SE_D3000_autobuild_scripts + +hmb_se_d3000_autobuild_scripts repo \ No newline at end of file From 72b6f55963265c036095ec0cc8455f621cf2ce3a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 8 Aug 2021 08:10:33 +0100 Subject: [PATCH 1490/1971] Use ahb-km-1024a autobuild scripts as 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 | 131 ++ Common_scripts/check/build_meta.groovy | 86 + Common_scripts/check/do_meta.groovy | 77 + Common_scripts/checksum/utils.groovy | 15 + Common_scripts/clean/clean.groovy | 10 + Common_scripts/commandline/commandline.groovy | 12 + .../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 | 64 + Common_scripts/differences/.project | 17 + Common_scripts/differences/.pydevproject | 8 + .../differences/dometahierarchy.groovy | 836 ++++++++ Common_scripts/differences/file.groovy | 23 + Common_scripts/differences/json.groovy | 51 + .../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 | 793 ++++++++ Common_scripts/packaging/debian.groovy | 107 + 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 | 442 +++++ 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 | 377 ++++ 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 | 407 ++++ buildimage/init.groovy | 403 ++++ buildimage/main.groovy | 729 +++++++ cloning/cloning.groovy | 174 ++ .../altera_soc_build_scripts/build_boot.sh | 97 + .../build_device_tree_blob.sh | 35 + .../build_device_tree_blob_from_source.sh | 30 + .../build_uboot_images.sh | 17 + compile/compile.groovy | 325 ++++ compile/compile_boot.groovy | 223 +++ compile/compile_kernel.groovy | 173 ++ compile/compile_simulator.groovy | 267 +++ compile/compile_stm8.groovy | 155 ++ compile/doxygenconfig | 383 ++++ compile/esw_doxygen.conf | 114 ++ compile/html/bc_s.png | Bin 0 -> 663 bytes compile/html/bdwn.png | Bin 0 -> 143 bytes compile/html/closed.png | Bin 0 -> 133 bytes compile/html/doc.png | Bin 0 -> 798 bytes compile/html/doxygen.css | 1730 +++++++++++++++++ compile/html/doxygen.svg | 26 + compile/html/dynsections.js | 121 ++ compile/html/folderclosed.png | Bin 0 -> 636 bytes compile/html/folderopen.png | Bin 0 -> 651 bytes compile/html/index.html | 97 + compile/html/jquery.js | 35 + compile/html/menu.js | 51 + compile/html/menudata.js | 26 + compile/html/nav_f.png | Bin 0 -> 170 bytes compile/html/nav_g.png | Bin 0 -> 95 bytes compile/html/nav_h.png | Bin 0 -> 99 bytes compile/html/navtree.css | 146 ++ compile/html/navtree.js | 546 ++++++ compile/html/navtreedata.js | 36 + compile/html/navtreeindex0.js | 5 + compile/html/open.png | Bin 0 -> 117 bytes compile/html/resize.js | 140 ++ compile/html/search/close.svg | 31 + compile/html/search/mag_sel.svg | 74 + compile/html/search/nomatches.html | 12 + compile/html/search/search.css | 255 +++ compile/html/search/search.js | 814 ++++++++ compile/html/search/search_l.png | Bin 0 -> 567 bytes compile/html/search/search_m.png | Bin 0 -> 158 bytes compile/html/search/search_r.png | Bin 0 -> 553 bytes compile/html/search/searchdata.js | 12 + compile/html/splitbar.png | Bin 0 -> 301 bytes compile/html/sync_off.png | Bin 0 -> 846 bytes compile/html/sync_on.png | Bin 0 -> 825 bytes compile/html/tab_a.png | Bin 0 -> 134 bytes compile/html/tab_b.png | Bin 0 -> 183 bytes compile/html/tab_h.png | Bin 0 -> 177 bytes compile/html/tab_s.png | Bin 0 -> 188 bytes compile/html/tabs.css | 1 + documentation/api.groovy | 121 ++ documentation/release_note.groovy | 120 ++ mark/core.groovy | 94 + packaging/build.groovy | 315 +++ packaging/buildcontrol.groovy | 169 ++ static_analysis/static_analysis.groovy | 104 + subtrees.txt | 2 + test/main.groovy | 260 +++ 119 files changed, 15030 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 buildimage/init.groovy create mode 100644 buildimage/main.groovy create mode 100644 cloning/cloning.groovy create mode 100755 compile/altera_soc_build_scripts/build_boot.sh create mode 100755 compile/altera_soc_build_scripts/build_device_tree_blob.sh create mode 100755 compile/altera_soc_build_scripts/build_device_tree_blob_from_source.sh create mode 100755 compile/altera_soc_build_scripts/build_uboot_images.sh create mode 100644 compile/compile.groovy create mode 100644 compile/compile_boot.groovy create mode 100644 compile/compile_kernel.groovy create mode 100644 compile/compile_simulator.groovy create mode 100644 compile/compile_stm8.groovy create mode 100644 compile/doxygenconfig create mode 100644 compile/esw_doxygen.conf create mode 100644 compile/html/bc_s.png create mode 100644 compile/html/bdwn.png create mode 100644 compile/html/closed.png create mode 100644 compile/html/doc.png create mode 100644 compile/html/doxygen.css create mode 100644 compile/html/doxygen.svg create mode 100644 compile/html/dynsections.js create mode 100644 compile/html/folderclosed.png create mode 100644 compile/html/folderopen.png create mode 100644 compile/html/index.html create mode 100644 compile/html/jquery.js create mode 100644 compile/html/menu.js create mode 100644 compile/html/menudata.js create mode 100644 compile/html/nav_f.png create mode 100644 compile/html/nav_g.png create mode 100644 compile/html/nav_h.png create mode 100644 compile/html/navtree.css create mode 100644 compile/html/navtree.js create mode 100644 compile/html/navtreedata.js create mode 100644 compile/html/navtreeindex0.js create mode 100644 compile/html/open.png create mode 100644 compile/html/resize.js create mode 100644 compile/html/search/close.svg create mode 100644 compile/html/search/mag_sel.svg create mode 100644 compile/html/search/nomatches.html create mode 100644 compile/html/search/search.css create mode 100644 compile/html/search/search.js create mode 100644 compile/html/search/search_l.png create mode 100644 compile/html/search/search_m.png create mode 100644 compile/html/search/search_r.png create mode 100644 compile/html/search/searchdata.js create mode 100644 compile/html/splitbar.png create mode 100644 compile/html/sync_off.png create mode 100644 compile/html/sync_on.png create mode 100644 compile/html/tab_a.png create mode 100644 compile/html/tab_b.png create mode 100644 compile/html/tab_h.png create mode 100644 compile/html/tab_s.png create mode 100644 compile/html/tabs.css create mode 100644 documentation/api.groovy create mode 100644 documentation/release_note.groovy create mode 100644 mark/core.groovy create mode 100644 packaging/build.groovy create mode 100644 packaging/buildcontrol.groovy create mode 100644 static_analysis/static_analysis.groovy create mode 100644 subtrees.txt create mode 100644 test/main.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..a8d418d --- /dev/null +++ b/Common_scripts/autobuilder.groovy @@ -0,0 +1,131 @@ +// 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 +} + +def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { + def String altered = releaserepo.trim() + + if (releaserepovariantsuffix?.trim()) { + altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", releaserepovariantsuffix) + } + return altered +} + +// Start up boilerplate +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 + 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, 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, productvariant) + + echo "Release repo: ${alteredreleaserepo}" + rr.registerrepo(meta, alteredreleaserepo) + + def ch = load("${commonscripts()}/configuration/configuration.groovy") + ch.registerPipelineScriptConfiguration(meta) + + return meta +} + +// DEPRECATED Metod, Use StartBuild Instead. +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..be7569d --- /dev/null +++ b/Common_scripts/checksum/utils.groovy @@ -0,0 +1,15 @@ + +// 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) { + echo "Checksumming: ${file.path}" + 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..38f80fa --- /dev/null +++ b/Common_scripts/commandline/commandline.groovy @@ -0,0 +1,12 @@ +String getCommandOutput(String cmd) { + if (isUnix()) { + return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim() + } else { + return powershell(returnStdout: true, script: """ + ${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..7ae0fe1 --- /dev/null +++ b/Common_scripts/copy/logic.groovy @@ -0,0 +1,64 @@ +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 { + 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) + } + } + } + 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..aa4814a --- /dev/null +++ b/Common_scripts/differences/file.groovy @@ -0,0 +1,23 @@ +def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { + def wsparameter = "-w" + if (!ignorewhitespace) { + wsparameter = "" + } + if (isUnix()) { + sh """ + diff -c ${wsparameter} "${importedfile}" "${currentfile}" + """ + } + else { + // diffutils can be installed on windows with chocolatey + powershell """ + # echo Checking utilities exist + # where diff + # if errorlevel 1 EXIT /b 1 + + diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}" + """ + } +} + +return this; diff --git a/Common_scripts/differences/json.groovy b/Common_scripts/differences/json.groovy new file mode 100644 index 0000000..0556188 --- /dev/null +++ b/Common_scripts/differences/json.groovy @@ -0,0 +1,51 @@ +def comparefiles(importedjsonfile, currentjsonfile) { + echo "Comparing file: ${importedjsonfile} with: ${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 { + // Jq and diffutils can be installed on windows with chocolatey + powershell """ + # echo Checking utilities exist + # set + # echo %PATH% + try { + if (Get-Command jq) {} + } + catch { + echo "jq is unavailable" + exit \$false + } + try { + if (Get-Command diff) {} + } + catch { + echo "diff is unavailable" + exit \$false + } + + # echo Sorting json in files to compare + # jq -S sorts json output + jq -S . "${importedjsonfile}" > temp1.txt + if (\$lastexitcode -ge 1) { exit 1 } + jq -S . "${currentjsonfile}" > temp2.txt + if (\$lastexitcode -ge 1) { exit 1 } + + # echo Diffing sorted json files + diff.exe -c temp1.txt temp2.txt + \$lec = \$lastexitcode + + Remove-Item temp1.txt + Remove-Item temp2.txt + + if (\$lec -ge 1) { exit 1 } + """ + } +} + +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..704bfc8 --- /dev/null +++ b/Common_scripts/meta/folder.groovy @@ -0,0 +1,793 @@ +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 + String variant + + ProductInfo(script, productname = "", subcomponentname = "", variant = "") { + super(script) + this.productname = productname + this.subcomponentname = subcomponentname + this.variant = variant + } + + 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()) { + pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) + } + else { + pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" 2>&1>\$null", , 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.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" 2>&1>\$null", , 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") + } + if (variant) { + def int vstatus = 0 + if (script.isUnix()) { + vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) + } + else { + vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" 2>&1>\$null", , returnStatus: true) + } + if (vstatus > 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 + } +} + +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 + } + + void set(BuildStampInfo other) { + set(other.buildstampprefix, other.revision, other.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..65d3731 --- /dev/null +++ b/Common_scripts/packaging/debian.groovy @@ -0,0 +1,107 @@ +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_KERNEL + 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, String inpackagepathsuffix) { + 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" + inpackagepathsuffix + GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + inpackagepathsuffix + GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + inpackagepathsuffix + GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + inpackagepathsuffix + GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + inpackagepathsuffix + GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" + inpackagepathsuffix + GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + inpackagepathsuffix + GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + inpackagepathsuffix + GIS_OPT_KERNEL = "${DEBPATH}/opt/gis/kernel" + inpackagepathsuffix + GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + inpackagepathsuffix + GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + inpackagepathsuffix + + USR_BIN = "${DEBPATH}/usr/bin" + inpackagepathsuffix + USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + inpackagepathsuffix + LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + inpackagepathsuffix + HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + inpackagepathsuffix + LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + inpackagepathsuffix + } +} + +def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') { + return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) +} + +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 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..9148572 --- /dev/null +++ b/Common_scripts/release/do.groovy @@ -0,0 +1,442 @@ +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + +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 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}" + + 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..4220f3b --- /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.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( + 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..5bcb0ba --- /dev/null +++ b/Common_scripts/versioncontrol/git.groovy @@ -0,0 +1,377 @@ +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 = powershell(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 { + powershell """ + git status + if (\$lastexitcode -ge 1) { exit 1 } + """ + } + } +*/ + } + } + return reporootsubfolder +} + +def checkgitlfsinstall() { + if (isUnix()) { + sh """ + git lfs install + if [ \$? -ne 0 ]; then exit 1; fi + """ + + } else { + powershell """ + git lfs install + if (\$lastexitcode -ge 1) { exit 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) { + echo "Git: Checking out: URL: ${gitURL} Revision: ${revision} to: ${targetDir}" + 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 { + powershell """ + 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 { + powershell """ + 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 { + powershell """ + 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 = powershell( 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..208a60f --- /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 { + powershell """ + & "${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..405b7be --- /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 = powershell(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 = powershell(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 = powershell(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 = powershell(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..9243aa4 --- /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 instances 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..dadbf8d --- /dev/null +++ b/build/build_all.groovy @@ -0,0 +1,407 @@ +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() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + BOOTSOURCEURL = 'git@hydra:gis-embedded-linux/gis_preloader_uboot.git' + BOOTSOURCEREVISION = BOOT_SOURCE_REVISION.trim() + BOOTSOURCEDIR = "${WORKSPACE}/boot" + configurationhelper.gitCheckoutAndRegister(meta, 'boot', BOOTSOURCEURL, BOOTSOURCEREVISION, BOOTSOURCEDIR, '', 0, false) + + KERNELSOURCEURL = KERNEL_URL.trim() + KERNELSOURCEREVISION = KERNEL_REVISION.trim() + KERNELSOURCEDIR = "${WORKSPACE}/kernel" + configurationhelper.gitCheckoutAndRegister(meta, 'kernel', KERNELSOURCEURL, KERNELSOURCEREVISION, KERNELSOURCEDIR, '', 0, false) + + STM8SOURCEURL = 'git@hydra:gis/stm8-embedded.git' + STM8SOURCEREVISION = STM8_SOURCE_REVISION.trim() + STM8SOURCEDIR = "${WORKSPACE}/stm8-embedded" + configurationhelper.gitCheckoutAndRegister(meta, 'stm8-embedded', STM8SOURCEURL, STM8SOURCEREVISION, STM8SOURCEDIR, '', 0, false) + + SOURCEURL = "git@hydra:ahb-km-1024a-source/ahb-km-1024a-embedded-software-subtree.git" + SOURCEREVISION = SOURCE_REVISION.trim() + SOURCEDIR = "${WORKSPACE}/esw" + configurationhelper.gitCheckoutAndRegister(meta, 'esw', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + + CORESOURCEURL = "git@hydra:core-presto/core-presto-embedded-software-subtree.git" + CORESOURCEREVISION = CORE_SOURCE_REVISION.trim() + CORESOURCEDIR = "${WORKSPACE}/core" + configurationhelper.gitCheckoutAndRegister(meta, 'core', CORESOURCEURL, CORESOURCEREVISION, CORESOURCEDIR, '', 0, false) + + ROOTFILESYSTEMURL = 'git@hydra:gis-embedded-linux/gis_root_fs.git' + ROOTFILESYSTEMREVISION = ROOTFS_REVISION.trim() + ROOTFILESYSTEMDIR = "${WORKSPACE}/rootfs" + configurationhelper.gitCheckoutAndRegister(meta, 'rootfs', ROOTFILESYSTEMURL, ROOTFILESYSTEMREVISION, ROOTFILESYSTEMDIR, '', 0, false) + + APTLYURL = 'git@hydra:gis-embedded-linux/gis_aptly_config.git' + APTLYREVISION = APTLY_REVISION.trim() + APTLYDIR = "${WORKSPACE}/aptly" + configurationhelper.gitCheckoutAndRegister(meta, 'aptly', APTLYURL, APTLYREVISION, APTLYDIR, '', 0, false) + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCEREVISION, SOURCEDIR) + } + } + } + stage('Build stage') { + failFast true + parallel { + stage('Arm') { + stages { + stage('Boot, Kernel and STM8') { + steps { + script { + parallel([ + 'Compile Preloader/U-Boot': { + boot_build_job = build job: BOOTLOADER_COMPILE_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: BOOTSOURCEREVISION), + string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION), + string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT), + string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + 'Compile Init Preloader/U-Boot': { + init_boot_build_job = build job: INIT_BOOTLOADER_COMPILE_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: BOOTSOURCEREVISION), + string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION), + string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT), + string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + 'Compile Kernel': { + kernel_build_job = build job: KERNEL_BUILD_JOB, + parameters: [ + string(name: 'SOURCE_URL', value: KERNELSOURCEURL), + string(name: 'SOURCE_REVISION', value: KERNELSOURCEREVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + 'Compile STM8 code': { + stm8_build_job = build job: STM8_BUILD_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: STM8SOURCEREVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + 'Mark core': { + core_mark_job = build job: CORE_MARK_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: CORESOURCEREVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + ]) + } + } + } + stage('Application and control') { + steps { + script { + parallel([ + 'Application compile': { + app_build_job = build job: APPLICATION_COMPILE_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'CORE_SOURCE_REVISION', value: CORESOURCEREVISION), + string(name: 'ARM_GCC_REVISION', value: ARM_GCC_REVISION), + string(name: 'ARM_GCC_NAME', value: ARM_GCC_NAME), + string(name: 'BOOST_VERSION', value: BOOST_VERSION), + string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION), + string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT), + string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION), + string(name: 'BUILD_METHOD', value: BUILD_METHOD), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + 'Control package create': { + control_package_create_job = build job: CONTROL_PACKAGE_CREATE_JOB, + parameters: [ + string(name: 'SOURCE_REPO', value: SOURCEURL), + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + ]) + } + } + } + stage('Package create') { + steps { + script { + parallel([ + 'Application package': { + app_package_create_job = build job: APP_PACKAGE_CREATE_JOB, + parameters: [ + string(name: 'ESW_ARTIFACT_JOB', value: app_build_job.getProjectName()), + string(name: 'ESW_ARTIFACT_JOB_SELECTOR', value: " ${app_build_job.getNumber()}"), + string(name: 'KERNEL_ARTIFACT_JOB', value: kernel_build_job.getProjectName()), + string(name: 'KERNEL_ARTIFACT_JOB_NUMBER', value: " ${kernel_build_job.getNumber()}"), + string(name: 'SOURCE_REPO', value: SOURCEURL), + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'BA4_LOGIC_ARTIFACT_LOCATION', value: BA4_LOGIC_ARTIFACT_LOCATION), + string(name: 'BA4_LOGIC_ARTIFACT_PROJECT', value: BA4_LOGIC_ARTIFACT_PROJECT), + string(name: 'BA4_LOGIC_ARTIFACT_BUILD_SELECTOR', value: BA4_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'BA4_LOGIC_ARTIFACT_RELEASE_REPO', value: BA4_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'BA4_LOGIC_ARTIFACT_RELEASE_REVISION', value: BA4_LOGIC_ARTIFACT_RELEASE_REVISION), + string(name: 'BA6_LOGIC_ARTIFACT_LOCATION', value: BA6_LOGIC_ARTIFACT_LOCATION), + string(name: 'BA6_LOGIC_ARTIFACT_PROJECT', value: BA6_LOGIC_ARTIFACT_PROJECT), + string(name: 'BA6_LOGIC_ARTIFACT_BUILD_SELECTOR', value: BA6_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'BA6_LOGIC_ARTIFACT_RELEASE_REPO', value: BA6_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'BA6_LOGIC_ARTIFACT_RELEASE_REVISION', value: BA6_LOGIC_ARTIFACT_RELEASE_REVISION), + string(name: 'FC5_LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION), + string(name: 'FC5_LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT), + string(name: 'FC5_LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'FC5_LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'FC5_LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION), + string(name: 'BOOTLOADER_ARTIFACT_JOB', value: boot_build_job.getProjectName()), + string(name: 'BOOTLOADER_ARTIFACT_JOB_SELECTOR', value: " ${boot_build_job.getNumber()}"), + string(name: 'STM8_BUILD_JOB', value: stm8_build_job.getProjectName()), + string(name: 'STM8_BUILD_SELECTOR', value: " ${stm8_build_job.getNumber()}"), + string(name: 'CONTROL_PACKAGE_CREATE_JOB', value: control_package_create_job.getProjectName()), + string(name: 'CONTROL_PACKAGE_CREATE_JOB_SELECTOR', value: " ${control_package_create_job.getNumber()}"), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + ]) + } + } + } + stage('Package publish') { + steps { + script { + parallel([ + 'Application package publish': { + app_publish_package_job = build job: APP_PUBLISH_PACKAGE_JOB, + parameters: [ + string(name: 'REPO_NAME', value: REPO_NAME), + string(name: 'SNAPSHOT_NAME', value: SNAPSHOT_NAME), + string(name: 'PUBLISH_PATH_PREFIX', value: PUBLISH_PATH_PREFIX), + string(name: 'DISTRIBUTION', value: DISTRIBUTION), + string(name: 'COMPONENT', value: COMPONENT), + string(name: 'PACKAGE_CREATE_JOB', value: app_package_create_job.getProjectName()), + string(name: 'PACKAGE_CREATE_JOB_SELECTOR', value: " ${app_package_create_job.getNumber()}"), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + 'Control package publish': { + control_publish_package_job = build job: CONTROL_PUBLISH_PACKAGE_JOB, + parameters: [ + string(name: 'REPO_NAME', value: REPO_NAME), + string(name: 'SNAPSHOT_NAME', value: SNAPSHOT_NAME), + string(name: 'PUBLISH_PATH_PREFIX', value: PUBLISH_PATH_PREFIX), + string(name: 'DISTRIBUTION', value: DISTRIBUTION), + string(name: 'COMPONENT', value: COMPONENT), + string(name: 'PACKAGE_CREATE_JOB', value: control_package_create_job.getProjectName()), + string(name: 'PACKAGE_CREATE_JOB_SELECTOR', value: " ${control_package_create_job.getNumber()}"), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + }, + ]) + } + } + } + stage('Image create') { + steps { + script { + image_create_job = build job: IMAGE_CREATE_JOB, + parameters: [ + string(name: 'KERNEL_ARTIFACT_JOB', value: kernel_build_job.getProjectName()), + string(name: 'KERNEL_ARTIFACT_JOB_NUMBER', value: " ${kernel_build_job.getNumber()}"), + string(name: 'SOURCE_REVISION', value: ROOTFS_REVISION), + string(name: 'BOOTLOADER_ARTIFACT_JOB', value: boot_build_job.getProjectName()), + string(name: 'BOOTLOADER_ARTIFACT_JOB_SELECTOR', value: " ${boot_build_job.getNumber()}"), + string(name: 'PACKAGE_CREATE_JOB', value: app_package_create_job.getProjectName()), + string(name: 'PACKAGE_CREATE_JOB_SELECTOR', value: " ${app_package_create_job.getNumber()}"), + string(name: 'CONTROL_PACKAGE_CREATE_JOB', value: control_package_create_job.getProjectName()), + string(name: 'CONTROL_PACKAGE_CREATE_JOB_SELECTOR', value: " ${control_package_create_job.getNumber()}"), + string(name: 'MIRROR_PREFIX', value: DISTRIBUTION), + string(name: 'UBUNTU_DISTRIBUTION', value: DISTRIBUTION), + string(name: 'GIS_PACKAGE_MIRROR_PREFIX', value: PUBLISH_PATH_PREFIX), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('Init Image create') { + steps { + script { + init_image_create_job = build job: INIT_IMAGE_CREATE_JOB, + parameters: [ + string(name: 'BOOTLOADER_ARTIFACT_JOB', value: init_boot_build_job.getProjectName()), + string(name: 'BOOTLOADER_ARTIFACT_JOB_SELECTOR', value: " ${init_boot_build_job.getNumber()}"), + string(name: 'MAIN_IMAGE_JOB', value: image_create_job.getProjectName()), + string(name: 'MAIN_IMAGE_JOB_SELECTOR', value: " ${image_create_job.getNumber()}"), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + } + } + stage('x86') { + stages { + stage('Simulator compile') { + steps { + script { + simulator_build_job = build job: SIMULATOR_COMPILE_JOB, + parameters: [ + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'CORE_SOURCE_REVISION', value: CORESOURCEREVISION), + string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION), + string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT), + string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + } + } + stage('Release Documentation') { + steps { + script { + release_notes_job = build job: RELEASE_NOTES_JOB, + parameters: [ + string(name: 'SOURCE_REPO', value: SOURCEURL), + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('BA4 logic copy') { + steps { + script { + ba4_logic_copy_job = build job: "AHB_KM_1024a_logic_copy", + parameters: [ + string(name: 'LOGIC_ARTIFACT_LOCATION', value: BA4_LOGIC_ARTIFACT_LOCATION), + string(name: 'LOGIC_ARTIFACT_PROJECT', value: BA4_LOGIC_ARTIFACT_PROJECT), + string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: BA4_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: BA4_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: BA4_LOGIC_ARTIFACT_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('BA6 logic copy') { + steps { + script { + ba6_logic_copy_job = build job: "AHB_KM_1024a_logic_copy", + parameters: [ + string(name: 'LOGIC_ARTIFACT_LOCATION', value: BA6_LOGIC_ARTIFACT_LOCATION), + string(name: 'LOGIC_ARTIFACT_PROJECT', value: BA6_LOGIC_ARTIFACT_PROJECT), + string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: BA6_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: BA6_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: BA6_LOGIC_ARTIFACT_RELEASE_REVISION), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('FC5 logic copy') { + steps { + script { + fc5_logic_copy_job = build job: "AHB_KM_1024a_logic_copy", + parameters: [ + string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION), + string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT), + string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR), + string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO), + string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_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 + [ boot_build_job, "boot", true, ], + [ init_boot_build_job, "init_boot", false, ], + [ kernel_build_job, "kernel", true, ], + [ stm8_build_job, "stm8", true, ], + [ core_mark_job, "core", true, ], + [ app_build_job, "app", true, ], + [ simulator_build_job, "simulator", false, ], + [ control_package_create_job, "control_package", false, ], + [ app_package_create_job, "app_package", false, ], + [ init_image_create_job, "init_image", false, ], + [ image_create_job, "image", true, ], + [ ba4_logic_copy_job, "ba4_logic", false, ], + [ ba6_logic_copy_job, "ba6_logic", false, ], + [ fc5_logic_copy_job, "fc5_logic", false, ], + [ release_notes_job, "release_notes", false, ], + ] + artifactFolders = artifacthelper.combineSubjobArtifacts(meta, importer, subJobs) + } + } + } + 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/buildimage/init.groovy b/buildimage/init.groovy new file mode 100644 index 0000000..0276c1b --- /dev/null +++ b/buildimage/init.groovy @@ -0,0 +1,403 @@ +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() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + } + } + } + stage('Clean exports') { + steps { + script { + versioninfo = "${WORKSPACE}/versioninfo" + IMAGEDIR = "image" + IMAGEROOT = "${WORKSPACE}/${IMAGEDIR}" + BOOTLOADERDEST = "${WORKSPACE}/boot" + MAINIMAGEDEST = "${WORKSPACE}/mainimage" + sdcard = "sdcard" + cleanfolders = [ + versioninfo, + IMAGEROOT, + BOOTLOADERDEST, + MAINIMAGEDEST, + sdcard, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Main image artifacts') { + steps { + script { + if (MAIN_IMAGE_ARTIFACT_LOCATION == "Jenkins job artifact") { + mainimagemeta = importer.artifactimport(meta, MAIN_IMAGE_JOB, MAIN_IMAGE_JOB_SELECTOR, MAINIMAGEDEST) + } + dir("${MAINIMAGEDEST}/sdcard") { + sh """#!/bin/bash + md5sum -c "${MAIN_IMAGE_BOARD_NAME}".zip.md5 + if [ \$? -ne 0 ]; then exit 1; fi + + unzip "${MAIN_IMAGE_BOARD_NAME}".zip + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + env.MAINIMAGEUNZIPPEDDEST = "${MAINIMAGEDEST}/sdcard/image/${MAIN_IMAGE_BOARD_NAME}.img" + env.MAINIMAGESPLIT = "${MAINIMAGEDEST}/sdcard/image/split" + + // The following makes a set of files of exactly the given size - In this case, the app image is split into equal ram buffer size chunks + // (as the bootloader that receives them cannot read their size) + dir(MAINIMAGESPLIT) { + sh """#!/bin/bash + split --verbose -d -b ${SPLITSIZE} "${MAINIMAGEUNZIPPEDDEST}" app_img + if [ \$? -ne 0 ]; then exit 1; fi + + filecount=0 + for f in `pwd`/*; do + echo "Making sure file: \$f is exactly ${SPLITSIZE}" + crc32 \$f + if [ \$? -ne 0 ]; then exit 1; fi + + truncate -s ${SPLITSIZE} \$f + if [ \$? -ne 0 ]; then exit 1; fi + + crc32 \$f + if [ \$? -ne 0 ]; then exit 1; fi + + filecrc=`crc32 \$f` + if [ \$? -ne 0 ]; then exit 1; fi + + printf "0: %s" \$filecrc | sed -E 's/0: (..)(..)(..)(..)/0: \\4\\3\\2\\1/' | xxd -r -g0 > \$f.crc + if [ \$? -ne 0 ]; then exit 1; fi + + xxd \$f.crc + if [ \$? -ne 0 ]; then exit 1; fi + + filecount=\$((filecount+1)) + done + # Output the number of files as a single byte + printf "0: %.2x" \$filecount | xxd -r -g0 > appfilescount + if [ \$? -ne 0 ]; then exit 1; fi + + ls -ls + """ + } + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.copyfrom(meta, mainimagemeta) + } + } + } + stage('Copying bootloader artifacts') { + steps { + script { + bootloadermeta = importer.artifactimport(meta, BOOTLOADER_ARTIFACT_JOB, BOOTLOADER_ARTIFACT_JOB_SELECTOR, BOOTLOADERDEST) + } + } + } + stage('Setup environment') { + steps { + echo 'Setting up environment' + script { + TOOLS_SCRIPTS = "${WORKSPACE}/buildimage/tools" + + IMAGEFILE="${IMAGEROOT}/${BOARD_NAME}.img" + + PASSWORD = "ramshorn42" + + if (isUnix()) { + sh """#!/bin/bash -v + rm -v -rf "${IMAGEROOT}" + mkdir -v "${IMAGEROOT}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Setup loop device') { + steps { + script { + LOOPDEVICEUSED = "${WORKSPACE}/loopdeviceused" + if (isUnix()) { + sh """#!/bin/bash -v + rm "${LOOPDEVICEUSED}" + + echo "Image name is: ${IMAGEFILE}" + + # Create null partition of 7GB + dd if=/dev/zero of="${IMAGEFILE}" bs=1M count=7168 + if [ \$? -ne 0 ]; then exit 1; fi + + # Configure the image as a loopback device + echo "${PASSWORD}" | sudo -S echo + sudo losetup --find --show "${IMAGEFILE}" > "${LOOPDEVICEUSED}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + VIRTUALDISK = readFile "${LOOPDEVICEUSED}" + VIRTUALDISK = "${VIRTUALDISK}".trim() + FAT32PARTITION = "${VIRTUALDISK}p1" + PRELOADERUBOOTPARTITION = "${VIRTUALDISK}p2" + + echo "Loop device used: ${VIRTUALDISK}" + } + } + } + stage('Create partitions') { + steps { + script { + env.SFDISKSCRIPT = """label: dos +device: ${VIRTUALDISK} + +${PRELOADERUBOOTPARTITION} : start=1M, size=1M, type=a2 +${FAT32PARTITION} : start=2M, size=5G, type=c +""" + + if (isUnix()) { + sh """#!/bin/bash + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + echo -e "Using sfdisk script: ${SFDISKSCRIPT}" + echo "${SFDISKSCRIPT}" > "${IMAGEROOT}/sfdiskscript" + echo "${SFDISKSCRIPT}" | sudo sfdisk "${VIRTUALDISK}" + if [ \$? -ne 0 ]; then exit 1; fi + + sync + + sudo partprobe "${VIRTUALDISK}" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo mkfs.fat -F 32 "${FAT32PARTITION}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Populate Boot partition') { + steps { + script { + if (isUnix()) { + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + # Copy the boot partition + sudo dd if="${BOOTLOADERDEST}/bin/preloader/preloader-mkpimage.bin" of="${PRELOADERUBOOTPARTITION}" bs=64k seek=0 + if [ \$? -ne 0 ]; then exit 1; fi + sudo dd if="${BOOTLOADERDEST}/bin/uboot/u-boot.img" of="${PRELOADERUBOOTPARTITION}" bs=64k seek=4 + if [ \$? -ne 0 ]; then exit 1; fi + sync + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Populate FAT partition') { + steps { + script { + env.MOUNTEDFATFILESYSTEM = "${WORKSPACE}/fatfs" + if (isUnix()) { + try { + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + sudo rm -v -rf "${MOUNTEDFATFILESYSTEM}" + mkdir -v "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "Mounting FAT32 partition ${FAT32PARTITION} to ${MOUNTEDFATFILESYSTEM}" + sudo mount -v "${FAT32PARTITION}" "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo cp -v --preserve=timestamps "${BOOTLOADERDEST}/device_tree/top_system.dtb" "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + sudo cp -v --preserve=timestamps "${BOOTLOADERDEST}/uboot_images/top_system.scr" "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + for f in "${MAINIMAGESPLIT}"/*; do + sudo cp -v --preserve=timestamps "\$f" "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + done + + sudo umount -v "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + catch (Exception e) { + echo "Caught exception: ${e.getMessage()}" + + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + + sudo umount "${MOUNTEDFATFILESYSTEM}" + exit 1 + """ + } + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Export preparation') { + steps { + script { + if (isUnix()) { + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + # Save the boot partition image for export + # sudo dd if="${PRELOADERUBOOTPARTITION}" of="${IMAGEDIR}/preloaderbootpart.img" bs=1M + # if [ \$? -ne 0 ]; then exit 1; fi + + # Save the FAT32 partition image for export + # sudo dd if="${FAT32PARTITION}" of="${IMAGEDIR}/fat32part.img" bs=1M + # if [ \$? -ne 0 ]; then exit 1; fi + + sync + + sudo rm -v "${sdcard}" + mkdir -v "${sdcard}" + if [ \$? -ne 0 ]; then exit 1; fi + sudo zip -r "${sdcard}/${BOARD_NAME}.zip" "${IMAGEDIR}" + if [ \$? -ne 0 ]; then exit 1; fi + pushd "${sdcard}" + if [ \$? -ne 0 ]; then exit 1; fi + md5sum "${BOARD_NAME}.zip" > "${BOARD_NAME}.zip.md5" + if [ \$? -ne 0 ]; then exit 1; fi + sha256sum "${BOARD_NAME}.zip" > "${BOARD_NAME}.zip.sha256" + if [ \$? -ne 0 ]; then exit 1; fi + popd + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + "${sdcard}/${BOARD_NAME}.zip", + "${sdcard}/${BOARD_NAME}.zip.md5", + "${sdcard}/${BOARD_NAME}.zip.sha256", + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + "${sdcard}/**" + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["${sdcard}/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + echo 'Cleaning Loopback Devices' + script { + if (isUnix()) { + if ("${CLEANUP_LOOP_DEVICES}" == "true") { + sh """ + echo "${PASSWORD}" | sudo -S pwd + sudo losetup -d "${VIRTUALDISK}" + """ + } + // Clear up workspace by changing ownership to the running user - for clear up purposes + sh """#!/bin/bash + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + sudo chown -R "${USER}": "${WORKSPACE}"/ + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/buildimage/main.groovy b/buildimage/main.groovy new file mode 100644 index 0000000..231bb79 --- /dev/null +++ b/buildimage/main.groovy @@ -0,0 +1,729 @@ +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() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + APTLYURL = 'git@hydra:gis-embedded-linux/gis_aptly_config.git' + APTLYREVISION = APTLY_REVISION.trim() + APTLYDIR = "${WORKSPACE}/aptly" + configurationhelper.gitCheckoutAndRegister(meta, 'aptly', APTLYURL, APTLYREVISION, APTLYDIR, '', 0, false) + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = 'git@hydra:gis-embedded-linux/gis_root_fs.git' + SOURCEREVISION = "${SOURCE_REVISION}".trim() + SOURCEDIR = "${WORKSPACE}/gis_root_fs" + configurationhelper.gitCheckoutAndRegister(meta, 'gis_root_fs', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + echo "Source path is ${SOURCE_PATH}" + } + } + } + stage('Clean exports') { + steps { + script { + versioninfo = "${WORKSPACE}/versioninfo" + IMAGEDIR = "image" + IMAGEROOT = "${WORKSPACE}/${IMAGEDIR}" + BOOTLOADERDEST = "${WORKSPACE}/boot" + KERNELDEST = "${WORKSPACE}/kernel" + CONTROL_PACKAGE_APP = "${WORKSPACE}/package_control" + PACKAGE_APP = "${WORKSPACE}/package_app" + sdcard = "sdcard" + cleanfolders = [ + versioninfo, + IMAGEROOT, + BOOTLOADERDEST, + KERNELDEST, + CONTROL_PACKAGE_APP, + PACKAGE_APP, + sdcard, + ] + 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('Copying bootloader artifacts') { + steps { + script { + bootloadermeta = importer.artifactimport(meta, BOOTLOADER_ARTIFACT_JOB, BOOTLOADER_ARTIFACT_JOB_SELECTOR, BOOTLOADERDEST) + } + } + } + stage('Copying Linux kernel artifacts') { + steps { + script { + kernelmeta = importer.artifactimport(meta, KERNEL_ARTIFACT_JOB, KERNEL_ARTIFACT_JOB_SELECTOR, KERNELDEST) + } + } + } + stage('Copying control package artifacts') { + steps { + script { + controlpackagemeta = importer.artifactimport(meta, CONTROL_PACKAGE_CREATE_JOB, CONTROL_PACKAGE_CREATE_JOB_SELECTOR, CONTROL_PACKAGE_APP) + } + } + } + stage('Copying package artifacts') { + steps { + script { + apppackagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGE_APP) + } + } + } + stage('Setup environment') { + steps { + echo 'Setting up environment' + echo "Rootfs path is ${SOURCE_PATH}" + script { + TOOLS_SCRIPTS = "${WORKSPACE}/buildimage/tools" + + IMAGEFILE="${IMAGEROOT}/${BOARD_NAME}.img" + + PASSWORD = "ramshorn42" + + if (isUnix()) { + sh """#!/bin/bash -v + rm -v -rf "${IMAGEROOT}" + mkdir -v "${IMAGEROOT}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Setup loop device') { + steps { + script { + LOOPDEVICEUSED = "${WORKSPACE}/loopdeviceused" + if (isUnix()) { + sh """#!/bin/bash -v + rm "${LOOPDEVICEUSED}" + + echo "Image name is: ${IMAGEFILE}" + + # Create null partition of 3GB + dd if=/dev/zero of="${IMAGEFILE}" bs=1M count=4096 + if [ \$? -ne 0 ]; then exit 1; fi + + # Configure the image as a loopback device + echo "${PASSWORD}" | sudo -S echo + sudo losetup --find --show "${IMAGEFILE}" > "${LOOPDEVICEUSED}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + VIRTUALDISK = readFile "${LOOPDEVICEUSED}" + VIRTUALDISK = "${VIRTUALDISK}".trim() + FAT32PARTITION = "${VIRTUALDISK}p1" + ROOTFSPARTITION = "${VIRTUALDISK}p2" + PRELOADERUBOOTPARTITION = "${VIRTUALDISK}p3" + BOARDINFOPARTITION = "${VIRTUALDISK}p4" + + echo "Loop device used: ${VIRTUALDISK}" + } + } + } + stage('Create partitions') { + steps { + script { + env.SFDISKSCRIPT = """label: dos +device: ${VIRTUALDISK} + +${PRELOADERUBOOTPARTITION} : start=1M, size=1M, type=a2 +${FAT32PARTITION} : start=2M, size=256M, type=c +${ROOTFSPARTITION} : start=258M, size=3.2G, type=83 +${BOARDINFOPARTITION} : start=3.5G, size=100M, type=83 +""" + + if (isUnix()) { + sh """#!/bin/bash + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + echo -e "Using sfdisk script: ${SFDISKSCRIPT}" + echo "${SFDISKSCRIPT}" > "${IMAGEROOT}/sfdiskscript" + echo "${SFDISKSCRIPT}" | sudo sfdisk "${VIRTUALDISK}" + if [ \$? -ne 0 ]; then exit 1; fi + + sync + + sudo partprobe "${VIRTUALDISK}" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo mkfs.fat -F 32 "${FAT32PARTITION}" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo mkfs -F -t ext3 "${ROOTFSPARTITION}" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo mkfs -F -t ext3 "${BOARDINFOPARTITION}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Populate Boot partition') { + steps { + script { + if (isUnix()) { + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + # Copy the boot partition + sudo dd if="${BOOTLOADERDEST}/bin/preloader/preloader-mkpimage.bin" of="${PRELOADERUBOOTPARTITION}" bs=64k seek=0 + if [ \$? -ne 0 ]; then exit 1; fi + sudo dd if="${BOOTLOADERDEST}/bin/uboot/u-boot.img" of="${PRELOADERUBOOTPARTITION}" bs=64k seek=4 + if [ \$? -ne 0 ]; then exit 1; fi + sync + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Populate FAT partition') { + steps { + script { + env.MOUNTEDFATFILESYSTEM = "${WORKSPACE}/fatfs" + if (isUnix()) { + try { + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + sudo rm -v -rf "${MOUNTEDFATFILESYSTEM}" + mkdir -v "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "Mounting FAT32 partition ${FAT32PARTITION} to ${MOUNTEDFATFILESYSTEM}" + sudo mount -v "${FAT32PARTITION}" "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo cp -v --preserve=timestamps "${BOOTLOADERDEST}/device_tree/top_system.dtb" "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + sudo cp -v --preserve=timestamps "${BOOTLOADERDEST}/uboot_images/top_system.scr" "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo cp -v --preserve=timestamps "${KERNELDEST}/bin/zImage" "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo umount -v "${MOUNTEDFATFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + catch (Exception e) { + echo "Caught exception: ${e.getMessage()}" + + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + + sudo umount "${MOUNTEDFATFILESYSTEM}" + exit 1 + """ + } + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Generate version info folder for image') { + steps { + script { + def metamap = [ + [ "${versioninfo}/rootfs_bootloader", bootloadermeta ], + [ "${versioninfo}/rootfs_kernel", kernelmeta ], + [ "${versioninfo}/rootfs_controlpackage", controlpackagemeta ], + [ "${versioninfo}/rootfs_apppackage", apppackagemeta ], + [ "${versioninfo}/rootfs_image", meta ], // Incomplete until this job ends + ] + for (metaitem in metamap) { + (destfolder, componentmeta) = metaitem + dir(destfolder) { + componentmeta.saveJsonSerialised("meta.json") + } + } + } + } + } + stage('Populate Root partition') { + steps { + script { + def MOUNTEDROOTFILESYSTEM = "${WORKSPACE}/virtualrootfs" + def CONTROL_SERVICE_PACKAGE_NAME = 'gis-ahb-km-1024a-control-service_armhf' + def ESW_EL_PACKAGE_NAME = 'gis-ahb-km-1024a-esw-el_armhf' + def PACKAGES_ROOT_DESTINATION = "/opt/gis/packages" + def PACKAGES_DESTINATION = "${SOURCE_PATH}/rootfs${PACKAGES_ROOT_DESTINATION}" + def MIRROR_SOURCE_LIST = [ + "deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}/ ${UBUNTU_DISTRIBUTION} main restricted", + "deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}/ ${UBUNTU_DISTRIBUTION} universe", + "deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}_updates/ ${UBUNTU_DISTRIBUTION}-updates main restricted", + "deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}_updates/ ${UBUNTU_DISTRIBUTION}-updates universe", + "deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}_security/ ${UBUNTU_DISTRIBUTION}-security main restricted", + "deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}_security/ ${UBUNTU_DISTRIBUTION}-security universe", + ].join('\n') + def GIS_PACKAGE_SOURCE_LIST = [ + "deb ${MIRROR_BASE_URL}/${GIS_PACKAGE_MIRROR_PREFIX}/ ${UBUNTU_DISTRIBUTION} testing", + ].join('\n') + def ETH0_INITIAL_CONFIG = [ + "allow-hotplug eth0", + "iface eth0 inet dhcp", + ].join('\n') + def ETH1_INITIAL_CONFIG = [ + "allow-hotplug eth1", + "iface eth1 inet dhcp", + ].join('\n') + def DHCP_SERVER_CONFIG = [ + "subnet 192.168.79.0 netmask 255.255.255.0 {", + "authoritative;", + "option routers 192.168.79.2;", + "option subnet-mask 255.255.255.0;", + "", + 'option domain-search \\\"gislocal.net\\\";', + "option domain-name-servers 192.168.79.2, 9.9.9.9;", + "option ntp-servers 192.168.79.2;", + "default-lease-time 604800;", + "max-lease-time 1036800;", + "", + "range 192.168.79.128 192.168.79.254;", + "}", + ].join('\n') + def LO_INITIAL_CONFIG = [ + "auto lo", + "iface lo inet loopback", + ].join('\n') + def HOSTNAME_CONFIG = [ // Needs to be parameterised + "hmb", + ].join('\n') + def HOSTS_CONFIG = [ // Needs to be parameterised + "127.0.0.1 ahb ahbkm1024a", + "192.168.17.253 remoteupdate remoteupdate.gisapps.co.uk", + ].join('\n') + def DHCLIENT_CONFIG = [ + "timeout 15;", + "retry 10;", + "reboot 10;", + ].join('\n') + def JOURNAL_CONFIG = [ + "Storage=volatile", + "RunTimeMaxUse=50M", + "RunTimeMaxFileSize=2M", + ].join('\n') + if (isUnix()) { + try { + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + sudo rm -rf "${MOUNTEDROOTFILESYSTEM}" + sudo mkdir -v "${MOUNTEDROOTFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "Mounting Root partition ${ROOTFSPARTITION} at ${MOUNTEDROOTFILESYSTEM}" + sudo mount -v "${ROOTFSPARTITION}" "${MOUNTEDROOTFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "Moving all Root fs files from ${SOURCE_PATH}/rootfs to ${MOUNTEDROOTFILESYSTEM}" + sudo mv -v "${SOURCE_PATH}/rootfs"/* "${MOUNTEDROOTFILESYSTEM}"/ + if [ \$? -ne 0 ]; then exit 1; fi + + sudo rmdir -v "${SOURCE_PATH}/rootfs/" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo ln -v -s "${MOUNTEDROOTFILESYSTEM}" "${SOURCE_PATH}/rootfs" + if [ \$? -ne 0 ]; then exit 1; fi + + pushd "${SOURCE_PATH}" + if [ \$? -ne 0 ]; then exit 1; fi + + # Construct root file system with original permissions, empty folders, /dev folder + sudo ./git-cache-meta --apply + if [ \$? -ne 0 ]; then exit 1; fi + + popd + if [ \$? -ne 0 ]; then exit 1; fi + + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + echo "Installing packages and public key into rootfs" + sudo mkdir -v -p "${PACKAGES_DESTINATION}" + if [ \$? -ne 0 ]; then exit 1; fi + sudo cp "${APTLYDIR}/gpg/autobuild_public.key" "${PACKAGES_DESTINATION}" + if [ \$? -ne 0 ]; then exit 1; fi + sudo cp "${CONTROL_PACKAGE_APP}/package/${CONTROL_SERVICE_PACKAGE_NAME}.deb" "${PACKAGES_DESTINATION}" + if [ \$? -ne 0 ]; then exit 1; fi + sudo cp "${PACKAGE_APP}/package/${ESW_EL_PACKAGE_NAME}.deb" "${PACKAGES_DESTINATION}" + if [ \$? -ne 0 ]; then exit 1; fi + + # Set the package source + echo "${MIRROR_SOURCE_LIST}" | sudo tee "${SOURCE_PATH}/rootfs/etc/apt/sources.list.d/gismirror.list" + if [ \$? -ne 0 ]; then exit 1; fi + + # Set the GIS Presto package source + echo "${GIS_PACKAGE_SOURCE_LIST}" | sudo tee "${SOURCE_PATH}/rootfs/etc/apt/sources.list.d/gis.list" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "Installing packages and keys on root fs" + pushd "${SOURCE_PATH}/rootfs" + + sudo "${SOURCE_PATH}/prechrootmount.sh" + if [ \$? -ne 0 ]; then popd; exit 1; fi + + sudo chroot . ls "${PACKAGES_ROOT_DESTINATION}" + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Prepare for package updates and installation (from GIS mirror) + sudo chroot . /bin/bash -c "apt-key add ${PACKAGES_ROOT_DESTINATION}/autobuild_public.key" + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Do package updates (from GIS mirror) + sudo chroot . /bin/bash -c 'apt -yq update' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Install packages (from GIS mirror) + sudo chroot . /bin/bash -c 'apt -yq install systemd udev sudo network-manager psmisc python3 python3-zeroconf python3-pip dosfstools dialog' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + if [ "${UBUNTU_DISTRIBUTION}" != "xenial" ]; then + sudo chroot . /bin/bash -c 'apt -yq install netplan.io python3-ifaddr' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + fi + + # Install packages (from GIS mirror) + sudo chroot . /bin/bash -c 'apt -yq install isc-dhcp-client tcpdump isc-dhcp-server apt-transport-https openssh-client openssh-server openssh-sftp-server apache2' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Install packages (from GIS mirror) + sudo chroot . /bin/bash -c 'apt -yq install inetutils-ping inetutils-telnet inetutils-traceroute wget curl ethtool iperf iperf3 tmux nmap nload zip' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + if [ "${UBUNTU_DISTRIBUTION}" != "xenial" ]; then + sudo chroot . /bin/bash -c 'apt -yq install ncat' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + fi + + # Install packages (from GIS mirror) + sudo chroot . /bin/bash -c 'apt -yq install avahi-discover avahi-utils less net-tools' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Install packages (from GIS mirror) + sudo chroot . /bin/bash -c 'apt -yq install ifupdown apt-utils vim nano aptitude diffutils htop locate mc gkrellm gkrellmd lshw usbutils elfutils binutils gdbserver rsync' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Install packages (from GIS mirror) + sudo chroot . /bin/bash -c 'apt -yq install libasan6 valgrind' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Do package upgrades + sudo chroot . /bin/bash -c 'apt list --upgradable' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'apt -yq upgrade' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'apt list --installed' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Upgrade python modules + sudo chroot . /bin/bash -c 'pip3 list' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'pip3 install "zeroconf>=0.28.8"' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'pip3 list' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Remove default apache site + sudo chroot . /bin/bash -c 'a2dissite 000-default' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Install GIS packages (which have package dependencies) + sudo chroot . /bin/bash -c 'autobuild=1 apt -yq install ${PACKAGES_ROOT_DESTINATION}/${CONTROL_SERVICE_PACKAGE_NAME}.deb' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'autobuild=1 apt -yq install ${PACKAGES_ROOT_DESTINATION}/${ESW_EL_PACKAGE_NAME}.deb' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Create gis user and set password + sudo chroot . /bin/bash -c 'mkdir -p /home/gis' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'useradd -d /home/gis -s /bin/bash -G users,sudo gis' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'chown gis: /home/gis' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'echo -e "Presto42\\nPresto42" | passwd gis' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Set up file system + sudo chroot . /bin/bash -c 'echo -e "/dev/mmcblk0p1 /mnt/gisdata vfat uid=gis,gid=gis,umask=017 0 1" > /etc/fstab' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Setup gis user password-less login + sudo mkdir -pv "${SOURCE_PATH}/rootfs/home/gis/.ssh" + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo cp "${SOURCE_PATH}/ssh_login_keys/id_rsa_hmb.pub" "${SOURCE_PATH}/rootfs/home/gis/.ssh/authorized_keys" + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'chown -R gis: /home/gis/.ssh' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'chmod 0600 /home/gis/.ssh/authorized_keys' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Setup root password-less login + sudo mkdir -pv "${SOURCE_PATH}/rootfs/root/.ssh" + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo cp "${SOURCE_PATH}/ssh_login_keys/id_rsa_hmb_root.pub" "${SOURCE_PATH}/rootfs/root/.ssh/authorized_keys" + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + sudo chroot . /bin/bash -c 'chmod 0600 /root/.ssh/authorized_keys' + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + # Set the package source + echo "${MIRROR_SOURCE_LIST}" | sudo tee "${SOURCE_PATH}/rootfs/etc/apt/sources.list.d/gismirror.list" + if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi + + sudo "${SOURCE_PATH}/postchrootumount.sh" + if [ \$? -ne 0 ]; then popd; exit 1; fi + + popd + if [ \$? -ne 0 ]; then exit 1; fi + + # Set initial networking configuration + echo "${ETH0_INITIAL_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/network/interfaces.d/eth0" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "${ETH1_INITIAL_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/network/interfaces.d/eth1" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "${LO_INITIAL_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/network/interfaces.d/lo" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "${DHCP_SERVER_CONFIG}" | sudo tee -a "${SOURCE_PATH}/rootfs/etc/dhcp/dhcpd.conf" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "${HOSTNAME_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/hostname" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "${HOSTS_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/hosts" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "${DHCLIENT_CONFIG}" | sudo tee -a "${SOURCE_PATH}/rootfs/etc/dhcp/dhclient.conf" + if [ \$? -ne 0 ]; then exit 1; fi + + # Deal with the DHCP server settings + sudo sed -i 's/INTERFACESv4=""/INTERFACESv4="eth0"/g' "${SOURCE_PATH}/rootfs/etc/default/isc-dhcp-server" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "${JOURNAL_CONFIG}" | sudo tee -a "${SOURCE_PATH}/rootfs/etc/systemd/journald.conf" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo rm -v -rf "${PACKAGES_DESTINATION}/autobuild_public.key" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo mkdir -v -p "${MOUNTEDROOTFILESYSTEM}/opt/gis/other" + if [ \$? -ne 0 ]; then exit 1; fi + sudo cp -rv "${versioninfo}" "${MOUNTEDROOTFILESYSTEM}/opt/gis/other" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo mkdir -v -p "${MOUNTEDROOTFILESYSTEM}/home/gis" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "Changing permissions on gis folder content" + sudo chmod -v -R 775 "${MOUNTEDROOTFILESYSTEM}/home/gis" + if [ \$? -ne 0 ]; then exit 1; fi + + echo "Assign gis content to correct group." + sudo chown -v -R 1000:1000 "${MOUNTEDROOTFILESYSTEM}/home/gis" + if [ \$? -ne 0 ]; then exit 1; fi + + sudo umount -v "${MOUNTEDROOTFILESYSTEM}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + catch (Exception e) { + echo "Exception occurred: ${e.getMessage()}" + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + + unlink "${SOURCE_PATH}/rootfs" + + sudo umount -v "${MOUNTEDROOTFILESYSTEM}" + exit 1 + """ + } + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Export preparation') { + steps { + script { + if (isUnix()) { + sh """#!/bin/bash -v + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + # Save the boot partition image for export + # sudo dd if="${PRELOADERUBOOTPARTITION}" of="${IMAGEDIR}/preloaderbootpart.img" bs=1M + # if [ \$? -ne 0 ]; then exit 1; fi + + # Save the FAT32 partition image for export + # sudo dd if="${FAT32PARTITION}" of="${IMAGEDIR}/fat32part.img" bs=1M + # if [ \$? -ne 0 ]; then exit 1; fi + + # Save the Root FS partition image for export + # sudo dd if="${ROOTFSPARTITION}" of="${IMAGEDIR}/rootfspart.img" bs=1M + # if [ \$? -ne 0 ]; then exit 1; fi + + sync + + sudo rm -v "${sdcard}" + mkdir -v "${sdcard}" + if [ \$? -ne 0 ]; then exit 1; fi + sudo zip -r "${sdcard}/${BOARD_NAME}.zip" "${IMAGEDIR}" + if [ \$? -ne 0 ]; then exit 1; fi + pushd "${sdcard}" + if [ \$? -ne 0 ]; then exit 1; fi + md5sum "${BOARD_NAME}.zip" > "${BOARD_NAME}.zip.md5" + if [ \$? -ne 0 ]; then exit 1; fi + sha256sum "${BOARD_NAME}.zip" > "${BOARD_NAME}.zip.sha256" + if [ \$? -ne 0 ]; then exit 1; fi + popd + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + "${sdcard}/${BOARD_NAME}.zip", + "${sdcard}/${BOARD_NAME}.zip.md5", + "${sdcard}/${BOARD_NAME}.zip.sha256", + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + "${sdcard}/**", + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["${sdcard}/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + echo 'Cleaning Loopback Devices' + script { + if (isUnix()) { + if ("${CLEANUP_LOOP_DEVICES}" == "true") { + sh """ + echo "${PASSWORD}" | sudo -S pwd + sudo losetup -d "${VIRTUALDISK}" + """ + } + // Clear up workspace by changing ownership to the running user - for clear up purposes + sh """#!/bin/bash + echo "${PASSWORD}" | sudo -S echo + if [ \$? -ne 0 ]; then exit 1; fi + + sudo chown -R "${USER}": "${WORKSPACE}"/ + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + bat """ + echo "Cannot be built on windows at the moment" + exit 1 + """ + } + } + } + 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..32cab7d --- /dev/null +++ b/cloning/cloning.groovy @@ -0,0 +1,174 @@ +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 templatefolder = '' + if (BRANCH_TO_COPY == "1.0.x") { + templates = [ // AHB_KM_1024A jobs + "AHB_KM_1024A_1.0.x_build", + "AHB_KM_1024A_1.0.x_image_create", + "AHB_KM_1024A_Init_1.0.x_image_create", + "AHB_KM_1024A_1.0.x_release_notes", + "AHB_KM_1024A_app_1.0.x_debpackage", + "AHB_KM_1024A_app_1.0.x_publish_package", + "AHB_KM_1024A_Boot_1.0.x_compile", + "AHB_KM_1024A_Init_Boot_1.0.x_compile", + "AHB_KM_1024A_control_1.0.x_debpackage", + "AHB_KM_1024A_control_1.0.x_publish_package", + "AHB_KM_1024A_ESW_1.0.x_compile", + "AHB_KM_1024A_ESW_simulator_1.0.x_compile", + "AHB_KM_1024A_ESW_Core_1.0.x_mark", + "AHB_KM_1024A_kernel_1.0.x_compile", + "AHB_KM_1024A_STM8_1.0.x_compile", + "AHB_KM_1024A_1.0.x_doxygen_deploy", + // AHB_KM_1024A test jobs + "AHB_KM_1024A_1.0.x_run_tests" + ] + stringreplace = [ "1.0.x" ] + templatefolder = TEMPLATE_FOLDER_1_0_x.trim() + } + def destfoldername = templatefolder ? templatefolder.replaceAll(BRANCH_TO_COPY, versionprefix) : '' + def destfolder + if (destfoldername) { + destfolder = hudson.model.Hudson.instance.getItemByFullName(destfoldername, com.cloudbees.hudson.plugins.folder.Folder) + if (!destfolder) { + echo "Creating destination folder: ${destfoldername}" + destfolder = Jenkins.instance.createProject(com.cloudbees.hudson.plugins.folder.Folder, destfoldername) + } else { + echo "Destination folder already exists: ${destfoldername}" + } + } + for (templatejobname in templates) { + def templatefolderjobname = templatefolder ? templatefolder + '/' + templatejobname : templatejobname + //def job = hudson.model.Hudson.instance.getItem(templatejobname) + def job = hudson.model.Hudson.instance.getItemByFullName(templatefolderjobname) + def newjobname = templatejobname.replaceAll(BRANCH_TO_COPY, versionprefix) + echo "Creating new job name: ${newjobname} from: ${templatejobname}" + + //def alreadyexistingjob = hudson.model.Hudson.instance.getItem(newjobname) + def alreadyexistingjob = hudson.model.Hudson.instance.getItemByFullName(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}") + + for (replacement in stringreplace) { + echo "Changing instances of: ${replacement} with: ${versionprefix}" + configXMLString = configXMLString.replaceAll(replacement, versionprefix) + } + 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 + if (destfolder) { + newjob = destfolder.createProjectFromXML(newjobname, is) + } else { + 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/altera_soc_build_scripts/build_boot.sh b/compile/altera_soc_build_scripts/build_boot.sh new file mode 100755 index 0000000..8a59b80 --- /dev/null +++ b/compile/altera_soc_build_scripts/build_boot.sh @@ -0,0 +1,97 @@ +#!/bin/bash -v +set -x + +PRODUCT_NAME=AHB-KM-1024A + +echo SOURCE_PATH is ${SOURCE_PATH} + +BSP_ROOT=${SOURCE_PATH}/saved_bsp +echo BSP_ROOT is ${BSP_ROOT} +BSP_DIR=${BSP_ROOT}/software/spl_bsp +echo BSP_DIR is ${BSP_DIR} + +ARTIFACT_HANDOFF_DIR=${LOGICDEST}/embedded_logic/hps_isw_handoff/${LOGIC_TOP_BLOCK_NAME}_hps_0 + +# Generate BSP from handoff held in source +GEN_DIR=${SOURCE_PATH}/generated_bsp + +rm -rf ${GEN_DIR} +mkdir ${GEN_DIR} + +BSP_SETTINGS_FILENAME=settings.bsp +BSP_SETTINGS=${WORKSPACE}/${BSP_SETTINGS_FILENAME} +bsp-create-settings --type spl --bsp-dir "${GEN_DIR}" --settings "${BSP_SETTINGS}" --preloader-settings-dir "${ARTIFACT_HANDOFF_DIR}" +if [ $? -ne 0 ]; then exit 1; fi + +bsp-query-settings --settings "${BSP_SETTINGS}" --get-all --show-names +if [ $? -ne 0 ]; then exit 1; fi + +echo BOARD_CONFIGURATION_CHOOSER is ${BOARD_CONFIGURATION_CHOOSER} + +case "${BOARD_CONFIGURATION_CHOOSER}" in + gis_ahbkm1024a) + GIS_BOARD_DIR=${BSP_DIR}/uboot-socfpga/board/gis/ahbkm1024a + ;; + + gis_ahbkm1024a_production_bootloader) + GIS_BOARD_DIR=${BSP_DIR}/uboot-socfpga/board/gis/ahbkm1024a_production_bootloader + ;; + + *) + echo "Unsupported board configuration: ${BOARD_CONFIGURATION_CHOOSER}" + exit 1 + ;; +esac + +echo GIS_BOARD_DIR is ${GIS_BOARD_DIR} +echo PRELOADER_UPDATE_DIR is ${GIS_BOARD_DIR} +echo PRELOADER_SETTINGS_DIR is ${ARTIFACT_HANDOFF_DIR} + +cp -rv ${GEN_DIR}/generated/* ${GIS_BOARD_DIR} +if [ $? -ne 0 ]; then exit 1; fi +cp -rv ${ARTIFACT_HANDOFF_DIR}/* ${GIS_BOARD_DIR}/sdram +if [ $? -ne 0 ]; then exit 1; fi + +echo Making Preloader and Bootloader at ${BSP_DIR} +pushd "${BSP_DIR}" +if [ $? -ne 0 ]; then exit 1; fi + +which make +if [ $? -ne 0 ]; then exit 1; fi + +#make clean +#if [ $? -ne 0 ]; then exit 1; fi + + +# Preloader +make SOCFPGA_BOARD_CONFIG=${BOARD_CONFIGURATION_CHOOSER} +if [ $? -ne 0 ]; then exit 1; fi + +# U-Boot +make uboot SOCFPGA_BOARD_CONFIG=${BOARD_CONFIGURATION_CHOOSER} +if [ $? -ne 0 ]; then exit 1; fi + +popd +if [ $? -ne 0 ]; then exit 1; fi + +OUTPUT_DIR=${WORKSPACE}/bin + +PRELOADER_OUTPUT_DIR=${OUTPUT_DIR}/preloader +rm -rf "${PRELOADER_OUTPUT_DIR}" +mkdir -p "${PRELOADER_OUTPUT_DIR}" +if [ $? -ne 0 ]; then exit 1; fi + +BUILD_OUTPUT_ROOT=${BSP_DIR} + +cp "${BUILD_OUTPUT_ROOT}/preloader-mkpimage.bin" "${PRELOADER_OUTPUT_DIR}" +if [ $? -ne 0 ]; then exit 1; fi + +UBOOT_OUTPUT_DIR=${OUTPUT_DIR}/uboot +rm -rf "${UBOOT_OUTPUT_DIR}" +mkdir -p "${UBOOT_OUTPUT_DIR}" +if [ $? -ne 0 ]; then exit 1; fi + +cp "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot" "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot.img" "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot.srec" "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot.bin" "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot.map" "${UBOOT_OUTPUT_DIR}" +if [ $? -ne 0 ]; then exit 1; fi + +exit 0 diff --git a/compile/altera_soc_build_scripts/build_device_tree_blob.sh b/compile/altera_soc_build_scripts/build_device_tree_blob.sh new file mode 100755 index 0000000..fade6a4 --- /dev/null +++ b/compile/altera_soc_build_scripts/build_device_tree_blob.sh @@ -0,0 +1,35 @@ +#!/bin/bash -x +# +# Script to convert a sopcinfo file with board xml files into a device tree blob using sopc2dts command +# + +DTB_ROOT=${WORKSPACE}/device_tree + +rm -rf "${DTB_ROOT}" +mkdir "${DTB_ROOT}" +if [ $? -ne 0 ]; then exit 1; fi + +ELOGIC_DIR=${LOGICDEST}/embedded_logic +BOARD_INFO_ROOT=${WORKSPACE}/gis_preloader_uboot/device_tree/${BOARD_CONFIGURATION_CHOOSER} + +sopc2dts --input "${ELOGIC_DIR}/${LOGIC_SOPCINFO_NAME_PREFIX}.sopcinfo" --output "${DTB_ROOT}/top_system.dts" --type dts --board "${BOARD_INFO_ROOT}/soc_system_board_info.xml" --board "${BOARD_INFO_ROOT}/hps_common_board_info.xml" --bridge-removal all --clocks +if [ $? -ne 0 ]; then exit 1; fi + +# We should use dtc to build the dtb file from the dts. +# This is because dtc has the -@ option to keep symbols, which we need for device tree overlays +# It is also stricter than sopc2dts, which will help us catch errors. + +#sopc2dts --input "${ELOGIC_DIR}/${LOGIC_SOPCINFO_NAME_PREFIX}.sopcinfo" --output "${DTB_ROOT}/top_system.dtb" --type dtb --board "${BOARD_INFO_ROOT}/soc_system_board_info.xml" --board "${BOARD_INFO_ROOT}/hps_common_board_info.xml" --bridge-removal all --clocks + +# Need to force output, as pll drivers are missing +which dtc +echo workspace is +echo ${WORKSPACE} +chmod 775 ${WORKSPACE}/dtc/dtc +${WORKSPACE}/dtc/dtc -f -@ -I dts -O dtb -o "${DTB_ROOT}/top_system.dtb" "${DTB_ROOT}/top_system.dts" + +if [ $? -ne 0 ]; then exit 1; fi + +exit 0 + + diff --git a/compile/altera_soc_build_scripts/build_device_tree_blob_from_source.sh b/compile/altera_soc_build_scripts/build_device_tree_blob_from_source.sh new file mode 100755 index 0000000..16baab1 --- /dev/null +++ b/compile/altera_soc_build_scripts/build_device_tree_blob_from_source.sh @@ -0,0 +1,30 @@ +#!/bin/bash -x +# +# Script to convert board-specific hierarchical device tree source into a device tree blob +# + +DTB_ROOT=${WORKSPACE}/device_tree + +rm -rf "${DTB_ROOT}" +mkdir "${DTB_ROOT}" +if [ $? -ne 0 ]; then exit 1; fi + +ALL_BOARD_ROOT=${WORKSPACE}/gis_preloader_uboot/device_tree +BOARD_INFO_ROOT=${ALL_BOARD_ROOT}/${BOARD_CONFIGURATION_CHOOSER} +BOARD_DTS=${BOARD_INFO_ROOT}/altsource/${BOARD_CONFIGURATION_CHOOSER}.dts +BOARD_FLAT_DTS=${BOARD_INFO_ROOT}/altsource/${BOARD_CONFIGURATION_CHOOSER}.flat.dts +SOCFPGA_DTS_DEFINITIONS_ROOT=${ALL_BOARD_ROOT}/socfpga + +# First convert hierarchical device tree source into flat device tree source +cpp -nostdinc -I "${SOCFPGA_DTS_DEFINITIONS_ROOT}" -I "${SOCFPGA_DTS_DEFINITIONS_ROOT}/include" -undef -x assembler-with-cpp "${BOARD_DTS}" > "${BOARD_FLAT_DTS}" +if [ $? -ne 0 ]; then exit 1; fi + +# Convert flat device tree file into dtc-processed device tree source +dtc -I dts -O dts -o "${DTB_ROOT}/top_system.dts" "${BOARD_FLAT_DTS}" +if [ $? -ne 0 ]; then exit 1; fi + +# Convert flat device tree file into device tree blob +dtc -I dts -O dtb -o "${DTB_ROOT}/top_system.dtb" "${BOARD_FLAT_DTS}" +if [ $? -ne 0 ]; then exit 1; fi + +exit 0 diff --git a/compile/altera_soc_build_scripts/build_uboot_images.sh b/compile/altera_soc_build_scripts/build_uboot_images.sh new file mode 100755 index 0000000..737ef41 --- /dev/null +++ b/compile/altera_soc_build_scripts/build_uboot_images.sh @@ -0,0 +1,17 @@ +#!/bin/bash -x +# +# Script to convert a text file into a u-boot script +# +# Note that the text input file should be saved with Linux line endings to avoid lots of warnings at boot time +# + +UBOOT_IMAGE_ROOT=${WORKSPACE}/uboot_images + +rm -rf "${UBOOT_IMAGE_ROOT}" +mkdir "${UBOOT_IMAGE_ROOT}" +if [ $? -ne 0 ]; then exit 1; fi + +mkimage -A arm -O linux -T script -C none -n "GIS u-boot script" -d "${WORKSPACE}/gis_preloader_uboot/uboot_script/${BOARD_CONFIGURATION_CHOOSER}/gis-u-boot.txt" "${UBOOT_IMAGE_ROOT}/top_system.scr" +if [ $? -ne 0 ]; then exit 1; fi + +exit 0 diff --git a/compile/compile.groovy b/compile/compile.groovy new file mode 100644 index 0000000..7dfbbc8 --- /dev/null +++ b/compile/compile.groovy @@ -0,0 +1,325 @@ +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() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + XMLCOREUTILSURL = 'git@hydra:tools/xml-coreutils.git' + XMLCOREUTILSREVISION = "origin/master" + XMLCOREUTILSDIR = "${WORKSPACE}/xmlcoreutils" + configurationhelper.gitCheckoutAndRegister( + meta, + 'xmlcoreutils', + XMLCOREUTILSURL, + XMLCOREUTILSREVISION, + XMLCOREUTILSDIR + ) + env.PATH = "${XMLCOREUTILSDIR}/ver/src" + ":" + env.PATH + + ALTERASOCEDSURL = 'git@hydra:tools/altera_soc_eds.git' + if (isUnix()) { + ALTERASOCEDSBRANCH = "origin/17.1.0.240-linux" + } + else { + ALTERASOCEDSBRANCH = "origin/17.1.0.240-windows" + } + ALTERASOCEDSDIR = "${WORKSPACE}/altera_soc_eds" + configurationhelper.gitCheckoutAndRegister(meta, 'altera_soc_eds', ALTERASOCEDSURL, ALTERASOCEDSBRANCH, ALTERASOCEDSDIR) + env.ALTERA_SOC_EDS = ALTERASOCEDSDIR + + 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) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + + ARMGCCURL = 'git@hydra:tools/arm-gcc.git' + ARMGCCREVISION = ARM_GCC_REVISION.trim() + ARMGCCDIR = "${WORKSPACE}/arm-gcc" + ARMGCCNAME = ARM_GCC_NAME.trim() + configurationhelper.gitCheckoutAndRegister(meta, 'arm-gcc', ARMGCCURL, ARMGCCREVISION, ARMGCCDIR) + if (isUnix()) { + env.TOOLCHAIN_FOLDER = "${ARMGCCDIR}/x86_64_arm-linux-gnueabihf/ver/bin" + env.ARMGCCSTDLIB_FOLDER = "${ARMGCCDIR}/x86_64_arm-linux-gnueabihf/ver/arm-linux-gnueabihf/libc/lib" + } + else { + env.TOOLCHAIN_FOLDER = "${ARMGCCDIR}/i686-mingw32_arm-linux-gnueabihf/ver/bin" + env.ARMGCCSTDLIB_FOLDER = "${ARMGCCDIR}/i686-mingw32_arm-linux-gnueabihf/ver/arm-linux-gnueabihf/libc/lib" + } + env.ARM_GCC = ARMGCCDIR + + CMAKEURL = 'git@hydra:tools/cmake.git' + CMAKEREVISION = "origin/3.19.3" + CMAKEDIR = "${WORKSPACE}/cmake" + configurationhelper.gitCheckoutAndRegister(meta, 'cmake', CMAKEURL, CMAKEREVISION, CMAKEDIR) + if (isUnix()) { + env.PATH = "${CMAKEDIR}/Linux-x86_64/ver/bin" + ":" + env.PATH + } else { + env.PATH = "${CMAKEDIR}/win64-x64/ver/bin" + ";" + env.PATH + } + + CDSURL = 'git@hydra:core-presto/core-developer-scripts.git' + CDSREVISION = "origin/master" + CDSDIR = "${WORKSPACE}/cds" + configurationhelper.gitCheckoutAndRegister(meta, 'core-developer-scripts', CDSURL, CDSREVISION, CDSDIR) + env.CDS = CDSDIR + + DOXYGENEXE = 'doxygen' + } + } + } + stage('Checkout source') { + steps { + script { + ESWDIR = 'esw' + SOURCEURL = "git@hydra:ahb-km-1024a-source/ahb-km-1024a-embedded-software-subtree.git" + SOURCEREVISION = SOURCE_REVISION.trim() + SOURCENAME = 'ahb-km-1024a' + hs = "${ESWDIR}/${SOURCENAME}" + configurationhelper.gitCheckoutAndRegister(meta, SOURCENAME, SOURCEURL, SOURCEREVISION, hs, '', 0, false) + env.SOURCE_PATH = hs + } + } + } + stage('Clean exports') { + steps { + script { + STATICANALYSIS = 'staticanalysis' + env.LOGICDEST = "${WORKSPACE}/logic" + DOXYGENOUT_FOLDER_NAME = 'doxygen_out' + env.DOXYGENOUT = "${WORKSPACE}/${DOXYGENOUT_FOLDER_NAME}" + env.EXPORT = "${WORKSPACE}/export" + cleanfolders = [ + EXPORT, + LOGICDEST, + STATICANALYSIS, + DOXYGENOUT + ] + 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('Checkout core source') { + steps { + script { + CORESOURCEURL = "git@hydra:core-presto/core-presto-embedded-software-subtree.git" + CORESOURCEREVISION = CORE_SOURCE_REVISION.trim() + CORESOURCENAME = 'core' + cs = "${ESWDIR}/${CORESOURCENAME}" + configurationhelper.gitCheckoutAndRegister(meta, CORESOURCENAME, CORESOURCEURL, CORESOURCEREVISION, cs, '', 0, false) + } + } + } + stage('Copying logic artifacts') { + steps { + script { + 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) + } + } + } + stage('Checking for logic handover change') { + steps { + script { + def jsondifferenceshelper = load("${autobuilder.commonscripts()}/differences/json.groovy") + + // Fails build if there is a difference + IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/combined_auto.json" + CURRENT_JSON="${hs}/HAL_Generator/combined_auto.json" + jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON) + + IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/ahb_fpga.json" + CURRENT_JSON="${hs}/HAL_Generator/ahb_fpga.json" + jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON) + + IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/hmb_fpga.json" + CURRENT_JSON="${hs}/HAL_Generator/hmb_fpga.json" + jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON) + + IMPORTED_HPS0="${LOGICDEST}/embedded_logic/hps_0.h" + CURRENT_HPS0="${hs}/src/model/logic_adapters/hps_0.h" + def filedifferenceshelper = load("${autobuilder.commonscripts()}/differences/file.groovy") + filedifferenceshelper.comparefiles(IMPORTED_HPS0, CURRENT_HPS0) + } + } + } + stage('Version stamp files') { + steps { + script { + convertdetails = [ + // File to convert Pattern to replace New string + [ "${cs}/presto_hal/src/prestohal/Common/Generic4Version.cpp", "0,30000,0,0", meta.buildstampinfo.buildstampcommasep() ], + [ "${cs}/presto/src_embedded/HMB/src/presto/RestApi/productinfo/ProductInfoJView.cpp", "0.30000.0.0", meta.buildstampinfo.buildstamp ], + ] + versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy") + versionnumbering.stamp(convertdetails) + } + } + } + stage('Build') { + steps { + script { + dir(SOURCE_PATH) { + toBuild = [] + def toBuildUntrimmed = BUILD_VARIANTS.split(',') + toBuildUntrimmed.each { + toBuild.add(it.trim()) + } + env.TARGET_HOST_IP = 'localhost' + env.GDB_PORT = '12345' + for (variant in toBuild) { + sh """#!/bin/bash + cmake -v -S . -Bbuild/${variant} -DCMAKE_TOOLCHAIN_FILE="${CDS}/cmake/arm_cross_compiler.cmake" -DCMAKE_BUILD_TYPE=${variant} --build . + if [ \$? -ne 0 ]; then exit 1; fi + + cmake --build build/${variant} --parallel \$(nproc) -v --target KM1024a + if [ \$? -ne 0 ]; then exit 1; fi + + cmake --install build/${variant} --prefix "${EXPORT}/${variant}" --component APPLICATION_AUTOBUILD + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues( + enabledForFailure: true, + tools: [ + gcc(reportEncoding: 'UTF-8') + ] + ) + } + } + } + stage('Produce doxygen output') { + when { + expression { + PRODUCE_DOXYGEN_OUTPUT == 'true' + } + } + steps { + script { + DOXYGENCONFIG = "${WORKSPACE}/autobuild/compile/${DOXYGEN_CONFIG_FILENAME.trim()}" + dir(DOXYGENOUT) { + } + echo "Running doxygen in folder: ${ESWDIR} using executable: ${DOXYGENEXE} and config: ${DOXYGENCONFIG} Expecting output at: ${DOXYGENOUT}" + dir(ESWDIR) { + if (isUnix()) { + sh """#!/bin/bash + "${DOXYGENEXE}" "${DOXYGENCONFIG}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } else { + error "Windows not supported for building at the moment" + } + } + } + } + } + stage('Create compressed export (preserving links)') { + steps { + script { + if (isUnix()) { + sh """#!/bin/bash + rm export.tgz + tar zcvf export.tgz export + if [ \$? -ne 0 ]; then exit 1; fi + """ + } else { + error "Windows not supported for building at the moment" + } + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + 'export/**', + 'export.tgz', + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + ] + if (PRODUCE_DOXYGEN_OUTPUT == 'true') { + publishable.add("${DOXYGENOUT_FOLDER_NAME}/**") + } + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifacts = ['export/**','export.tgz'] + if (PRODUCE_DOXYGEN_OUTPUT == 'true') { + artifacts.add("${DOXYGENOUT_FOLDER_NAME}/**") + } + def artifactlist = meta.generateartifacts(artifacts) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/compile/compile_boot.groovy b/compile/compile_boot.groovy new file mode 100644 index 0000000..9f214ce --- /dev/null +++ b/compile/compile_boot.groovy @@ -0,0 +1,223 @@ +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() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + ALTERASOCEDSURL = 'git@hydra:tools/altera_soc_eds.git' + ALTERASOCEDSDIR = "${WORKSPACE}/altera_soc_eds" + configurationhelper.gitCheckoutAndRegister(meta, 'altera_soc_eds', ALTERASOCEDSURL, ALTERA_SOC_EDS_REVISION, ALTERASOCEDSDIR) + env.ALTERA_SOC_EDS = ALTERASOCEDSDIR + + DTCURL = 'git@hydra:tools/dtc.git' + DTCREVISION = "origin/1.4.5" + DTCDIR = "${WORKSPACE}/dtc" + configurationhelper.gitCheckoutAndRegister(meta, 'dtc', DTCURL, DTCREVISION, DTCDIR) + + 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) + 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-embedded-linux/gis_preloader_uboot.git' + SOURCEREVISION = "${SOURCE_REVISION}".trim() + SOURCEDIR = "${WORKSPACE}/gis_preloader_uboot" + configurationhelper.gitCheckoutAndRegister(meta, 'gis_preloader_uboot', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + } + } + } + stage('Clean exports') { + steps { + script { + env.LOGICDEST = "${WORKSPACE}/logic" + cleanfolders = [ + "${WORKSPACE}/bin", + LOGICDEST, + "${WORKSPACE}/version", + ] + 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('Copying logic artifacts') { + steps { + script { + 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) + } + } + } + stage('Version stamp files') { + steps { + script { + convertdetails = [ + // File to convert Pattern to replace New string + ] + versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy") + versionnumbering.stamp(convertdetails) + } + } + } + stage('Build preloader and u-boot') { + steps { + script { + env.COMPILE_SCRIPTS = "${autobuilder.getautobuildpath()}/compile" + echo "Compile scripts at ${COMPILE_SCRIPTS}" + if (isUnix()) { + sh ''' + "${ALTERA_SOC_EDS}/ver/embedded/embedded_command_shell.sh" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_boot.sh" + ''' + } + else { + bat ''' + "%ALTERA_SOC_EDS%/ver/embedded/embedded_command_shell.bat" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_boot.sh" + ''' + } + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues( + enabledForFailure: true, + tools: [ + gcc(reportEncoding: 'UTF-8'), + ] + ) + } + } + } + stage('Build u-boot script') { + steps { + script { + echo "Compile scripts at ${COMPILE_SCRIPTS}" + if (isUnix()) { + sh ''' + "${ALTERA_SOC_EDS}/ver/embedded/embedded_command_shell.sh" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_uboot_images.sh" + ''' + } + else { + bat ''' + "%ALTERA_SOC_EDS%/ver/embedded/embedded_command_shell.bat" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_uboot_images.sh" + ''' + } + } + } + } + stage('Build device tree blob') { + steps { + script { + echo "Compile scripts at ${COMPILE_SCRIPTS}" + if ("${BUILD_DEVICE_TREE_FROM_SOPCINFO}" == "true") { + if (isUnix()) { + sh ''' + "${ALTERA_SOC_EDS}/ver/embedded/embedded_command_shell.sh" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_device_tree_blob.sh" + ''' + } + else { + bat ''' + "%ALTERA_SOC_EDS%/ver/embedded/embedded_command_shell.bat" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_device_tree_blob.sh" + ''' + } + } + else + { + if (isUnix()) { + sh ''' + "${ALTERA_SOC_EDS}/ver/embedded/embedded_command_shell.sh" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_device_tree_blob_from_source.sh" + ''' + } + else { + bat ''' + "%ALTERA_SOC_EDS%/ver/embedded/embedded_command_shell.bat" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_device_tree_blob_from_source.sh" + ''' + } + } + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + 'bin/**', + 'uboot_script/**', + 'device_tree/**', + ] + 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/**","uboot_images/**","device_tree/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/compile/compile_kernel.groovy b/compile/compile_kernel.groovy new file mode 100644 index 0000000..209ebf4 --- /dev/null +++ b/compile/compile_kernel.groovy @@ -0,0 +1,173 @@ +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" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + + ARMGCCURL = 'git@hydra:tools/arm-gcc.git' + ARMGCCREVISION = "${ARM_GCC_REVISION}" + ARMGCCDIR = "${WORKSPACE}/arm-gcc" + configurationhelper.gitCheckoutAndRegister(meta, 'arm-gcc', ARMGCCURL, ARMGCCREVISION, ARMGCCDIR) + if (isUnix()) { + env.TOOLCHAIN_FOLDER = "${WORKSPACE}/arm-gcc/x86_64_arm-linux-gnueabihf/ver/bin" + } + else { + env.TOOLCHAIN_FOLDER = "${WORKSPACE}/arm-gcc/i686-mingw32_arm-linux-gnueabihf/ver/bin" + } + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = SOURCE_URL.trim() + SOURCEREVISION = SOURCE_REVISION.trim() + SOURCEDIR = "${WORKSPACE}/kernel" + configurationhelper.gitCheckoutAndRegister(meta, 'kernel', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + } + } + } + stage('Clean exports') { + steps { + script { + cleanfolders = [ + "${WORKSPACE}/bin", + "${WORKSPACE}/version", + ] + 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('Build') { + steps { + script { + // Setting environment + env.CROSS_COMPILE = "${TOOLCHAIN_FOLDER}/arm-linux-gnueabihf-" + env.ARCH = 'arm' + if (isUnix()) { + sh """#!/bin/bash -v + CORES=\$(getconf _NPROCESSORS_ONLN) + + # Build the kernel using the socfpga default config (that comes with the kernel) + pushd "${SOURCE_PATH}" + if [ \$? -ne 0 ]; then exit 1; fi + + echo Building kernel in folder: `pwd` + + make socfpga_defconfig + if [ \$? -ne 0 ]; then exit 1; fi + + make -j\${CORES} zImage + if [ \$? -ne 0 ]; then exit 1; fi + + # Create an artifacts directory and copy the kernel to it + mkdir "${WORKSPACE}/bin" + if [ \$? -ne 0 ]; then exit 1; fi + + cp "${SOURCE_PATH}/arch/arm/boot/zImage" "${WORKSPACE}/bin/zImage" + if [ \$? -ne 0 ]; then exit 1; fi + cp "${SOURCE_PATH}/.config" "${WORKSPACE}/bin/config" + if [ \$? -ne 0 ]; then exit 1; fi + + popd + + """ + } + else { + error "Windows not currently supported" + } + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues( + enabledForFailure: true, + tools: [ + gcc(reportEncoding: 'UTF-8'), + ] + ) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + 'bin/**', + ] + 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/compile/compile_simulator.groovy b/compile/compile_simulator.groovy new file mode 100644 index 0000000..17e85b7 --- /dev/null +++ b/compile/compile_simulator.groovy @@ -0,0 +1,267 @@ +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() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + XMLCOREUTILSURL = 'git@hydra:tools/xml-coreutils.git' + XMLCOREUTILSREVISION = "origin/master" + XMLCOREUTILSDIR = "${WORKSPACE}/xmlcoreutils" + configurationhelper.gitCheckoutAndRegister( + meta, + 'xmlcoreutils', + XMLCOREUTILSURL, + XMLCOREUTILSREVISION, + XMLCOREUTILSDIR + ) + env.PATH = "${XMLCOREUTILSDIR}/ver/src" + ":" + env.PATH + + ALTERASOCEDSURL = 'git@hydra:tools/altera_soc_eds.git' + if (isUnix()) { + ALTERASOCEDSBRANCH = "origin/17.1.0.240-linux" + } + else { + ALTERASOCEDSBRANCH = "origin/17.1.0.240-windows" + } + ALTERASOCEDSDIR = "${WORKSPACE}/altera_soc_eds" + configurationhelper.gitCheckoutAndRegister(meta, 'altera_soc_eds', ALTERASOCEDSURL, ALTERASOCEDSBRANCH, ALTERASOCEDSDIR) + env.ALTERA_SOC_EDS = ALTERASOCEDSDIR + + 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) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + + CYGWIN64URL = 'git@hydra:gis/cygwin64.git' + CYGWIN64REVISION = "origin/master" + CYGWIN64DIR = "${WORKSPACE}/cygwin64" + configurationhelper.gitCheckoutAndRegister(meta, 'cygwin64', CYGWIN64URL, CYGWIN64REVISION, CYGWIN64DIR) + + CMAKEURL = 'git@hydra:tools/cmake.git' + CMAKEREVISION = "origin/3.19.3" + CMAKEDIR = "${WORKSPACE}/cmake" + configurationhelper.gitCheckoutAndRegister(meta, 'cmake', CMAKEURL, CMAKEREVISION, CMAKEDIR) + if (isUnix()) { + env.PATH = "${CMAKEDIR}/Linux-x86_64/ver/bin" + ":" + env.PATH + } else { + env.PATH = "${CMAKEDIR}/win64-x64/ver/bin" + ";" + env.PATH + } + + CDSURL = 'git@hydra:core-presto/core-developer-scripts.git' + CDSREVISION = "origin/master" + CDSDIR = "${WORKSPACE}/cds" + configurationhelper.gitCheckoutAndRegister(meta, 'core-developer-scripts', CDSURL, CDSREVISION, CDSDIR) + env.CDS = CDSDIR + + } + } + } + stage('Checkout source') { + steps { + script { + ESWDIR = 'esw' + SOURCEURL = "git@hydra:ahb-km-1024a-source/ahb-km-1024a-embedded-software-subtree.git" + SOURCEREVISION = SOURCE_REVISION.trim() + SOURCENAME = 'ahb-km-1024a' + hs = "${ESWDIR}/${SOURCENAME}" + configurationhelper.gitCheckoutAndRegister(meta, SOURCENAME, SOURCEURL, SOURCEREVISION, hs, '', 0, false) + env.SOURCE_PATH = hs + } + } + } + stage('Clean exports') { + steps { + script { + STATICANALYSIS = 'staticanalysis' + env.LOGICDEST = "${WORKSPACE}/logic" + DOXYGENOUT_FOLDER_NAME = 'doxygen_out' + env.DOXYGENOUT = "${WORKSPACE}/${DOXYGENOUT_FOLDER_NAME}" + env.EXPORT = "${WORKSPACE}/export" + cleanfolders = [ + EXPORT, + LOGICDEST, + STATICANALYSIS, + DOXYGENOUT + ] + 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('Checkout core source') { + steps { + script { + CORESOURCEURL = "git@hydra:core-presto/core-presto-embedded-software-subtree.git" + CORESOURCEREVISION = CORE_SOURCE_REVISION.trim() + CORESOURCENAME = 'core' + cs = "${ESWDIR}/${CORESOURCENAME}" + configurationhelper.gitCheckoutAndRegister(meta, CORESOURCENAME, CORESOURCEURL, CORESOURCEREVISION, cs, '', 0, false) + } + } + } + stage('Copying logic artifacts') { + steps { + script { + 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) + } + } + } + stage('Checking for logic handover change') { + steps { + script { + def jsondifferenceshelper = load("${autobuilder.commonscripts()}/differences/json.groovy") + + // Fails build if there is a difference + IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/combined_auto.json" + CURRENT_JSON="${hs}/HAL_Generator/combined_auto.json" + jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON) + + IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/ahb_fpga.json" + CURRENT_JSON="${hs}/HAL_Generator/ahb_fpga.json" + jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON) + + IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/hmb_fpga.json" + CURRENT_JSON="${hs}/HAL_Generator/hmb_fpga.json" + jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON) + + IMPORTED_HPS0="${LOGICDEST}/embedded_logic/hps_0.h" + CURRENT_HPS0="${hs}/src/model/logic_adapters/hps_0.h" + def filedifferenceshelper = load("${autobuilder.commonscripts()}/differences/file.groovy") + filedifferenceshelper.comparefiles(IMPORTED_HPS0, CURRENT_HPS0) + } + } + } + stage('Version stamp files') { + steps { + script { + convertdetails = [ + // File to convert Pattern to replace New string + [ "${cs}/presto_hal/src/prestohal/Common/Generic4Version.cpp", "0,30000,0,0", meta.buildstampinfo.buildstampcommasep() ], + [ "${cs}/presto/src_embedded/HMB/src/presto/RestApi/productinfo/ProductInfoJView.cpp", "0.30000.0.0", meta.buildstampinfo.buildstamp ], + ] + versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy") + versionnumbering.stamp(convertdetails) + } + } + } + stage('Build') { + steps { + script { + dir(SOURCE_PATH) { + toBuild = [] + def toBuildUntrimmed = BUILD_VARIANTS.split(',') + toBuildUntrimmed.each { + toBuild.add(it.trim()) + } + env.TARGET_HOST_IP = 'localhost' + env.GDB_PORT = '12345' + for (variant in toBuild) { + powershell """ + & cmake -v -S . -B "build/${variant}" -G "Visual Studio 16 2019" -A Win32 -D_WIN32_WINNT_WIN10=0x0A00 -DCMAKE_BUILD_TYPE=${variant} + if (\$lastexitcode -ge 1) { exit 1 } + + & cmake --build "build/${variant}" --config "${variant}" --parallel \$env:NUMBER_OF_PROCESSORS -v --target ALL_BUILD + if (\$lastexitcode -ge 1) { exit 1 } + + & cmake --install "build/${variant}" --config "${variant}" --prefix "${EXPORT}/${variant}" --component SIMULATION_AUTOBUILD + if (\$lastexitcode -ge 1) { exit 1 } + """ + } + } + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues( + enabledForFailure: true, + tools: [ + msBuild(reportEncoding: 'UTF-8') + ] + ) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + 'export/**' + ] + 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 artifacts = ['export/**'] + def artifactlist = meta.generateartifacts(artifacts) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/compile/compile_stm8.groovy b/compile/compile_stm8.groovy new file mode 100644 index 0000000..8a62239 --- /dev/null +++ b/compile/compile_stm8.groovy @@ -0,0 +1,155 @@ +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" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + 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/stm8-embedded.git' + SOURCEREVISION = "${SOURCE_REVISION}".trim() + SOURCEDIR = "${WORKSPACE}/esw" + configurationhelper.gitCheckoutAndRegister(meta, 'esw', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + env.SOURCE_PATH = SOURCEDIR + } + } + } + stage('Clean exports') { + steps { + script { + cleanfolders = [ + "${WORKSPACE}/bin", + "${WORKSPACE}/version", + ] + 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('Version stamp files') { + steps { + script { + convertdetails = [ + // File to convert Pattern to replace New string + ] + versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy") + versionnumbering.stamp(convertdetails) + } + } + } + stage('Build') { + steps { + script { + // Copying files for now + if (isUnix()) { + sh """ + mkdir -p "${WORKSPACE}/bin" + cp "${WORKSPACE}/esw/stm_projects/Project/som_adc_monitor/STVD/Cosmic/Release/hostA_adc_monitor.stm8bin" "${WORKSPACE}/bin" + if [ \$? -ne 0 ]; then exit 1; fi + cp "${WORKSPACE}/esw/stm_projects/Project/som_adc_monitor/STVD/Cosmic/Release/hostB_adc_monitor.stm8bin" "${WORKSPACE}/bin" + if [ \$? -ne 0 ]; then exit 1; fi + cp "${WORKSPACE}/esw/stm_projects/Project/som_adc_monitor/STVD/Cosmic/Release/som_adc_monitor.stm8bin" "${WORKSPACE}/bin" + if [ \$? -ne 0 ]; then exit 1; fi + cp "${WORKSPACE}/esw/stm_projects/Project/cleanworm/Release/cleanworm.stm8bin" "${WORKSPACE}/bin" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + else { + error "Windows not currently supported" + } + } + } + } + stage('Static analysis') { + steps { + script { + recordIssues( + enabledForFailure: true, + tools: [ + gcc(reportEncoding: 'UTF-8'), + ] + ) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + 'bin/**', + ] + 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/compile/doxygenconfig b/compile/doxygenconfig new file mode 100644 index 0000000..bff117c --- /dev/null +++ b/compile/doxygenconfig @@ -0,0 +1,383 @@ +# Doxyfile 1.8.19 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "My Project" +PROJECT_NUMBER = +PROJECT_BRIEF = +PROJECT_LOGO = +OUTPUT_DIRECTORY = +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +OUTPUT_TEXT_DIRECTION = None +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +JAVADOC_BANNER = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +OPTIMIZE_OUTPUT_SLICE = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +TOC_INCLUDE_HEADINGS = 5 +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +NUM_PROC_THREADS = 1 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_PRIV_VIRTUAL = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +HIDE_COMPOUND_REFERENCE= NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_AS_ERROR = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.doc \ + *.txt \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f18 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = +HTML_EXTRA_FILES = +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = NO +HTML_DYNAMIC_MENUS = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = NO +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +HTML_FORMULA_FORMAT = png +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +FORMULA_MACROFILE = +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = +#--------------------------------------------------------------------------- +# Configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = +MAKEINDEX_CMD_NAME = makeindex +LATEX_MAKEINDEX_CMD = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4 +EXTRA_PACKAGES = +LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +LATEX_BIB_STYLE = plain +LATEX_TIMESTAMP = NO +LATEX_EMOJI_DIRECTORY = +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +RTF_SOURCE_CODE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_SUBDIR = +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_PROGRAMLISTING = YES +XML_NS_MEMB_FILE_SCOPE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +DOCBOOK_PROGRAMLISTING = NO +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +DIA_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_PATH = +DOTFILE_DIRS = +MSCFILE_DIRS = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_CFG_FILE = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/compile/esw_doxygen.conf b/compile/esw_doxygen.conf new file mode 100644 index 0000000..d5ec675 --- /dev/null +++ b/compile/esw_doxygen.conf @@ -0,0 +1,114 @@ +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = GIS-EmbeddedSoftware +INPUT = . +OUTPUT_DIRECTORY = $(DOXYGENOUT) +INCLUDE_PATH = . +EXCLUDE = ./core/presto/gis_rest_tools_subtree ./html +STRIP_FROM_PATH = . +TAGFILES = esw.tag +WARNINGS = YES +SEARCHENGINE = YES +RECURSIVE = YES +ALPHABETICAL_INDEX = YES +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXTRACT_ALL = YES +EXTENSION_MAPPING = h=C++ +EXTRACT_STATIC = YES +TEMPLATE_RELATIONS = YES +SEARCH_INCLUDES = YES +GENERATE_TODOLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST = YES +GENERATE_TREEVIEW = YES +DISABLE_INDEX = NO +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 2 +SUBGROUPING = YES +EXTRACT_LOCAL_CLASSES = YES +SORT_MEMBER_DOCS = YES +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +COLS_IN_ALPHA_INDEX = 3 +UML_LIMIT_NUM_FIELDS = 50 +LOOKUP_CACHE_SIZE = 1 +NUM_PROC_THREADS = 4 +CLASS_DIAGRAMS = YES +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.C \ + *.CC \ + *.C++ \ + *.H \ + *.HH \ + *.H++ \ + *.CS + + +## HTML +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_COLORSTYLE_HUE = 189 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 69 +HTML_ALIGN_MEMBERS = YES +HTML_DYNAMIC_SECTIONS = YES + +HIDE_UNDOC_RELATIONS = NO + +## DOT +HAVE_DOT = NO +# DOT_IMAGE_FORMAT = png +# DOT_PATH = +# DOT_GRAPH_MAX_NODES = 100 +# MAX_DOT_GRAPH_DEPTH = 0 +# DOT_TRANSPARENT = YES +# DOT_NUM_THREADS = 4 + + +## GRAPHs +UML_LOOK = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +CALLER_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES + + +## // LATEX & PDF generation +## IF (GENERATE LATEX == FALSE) +GENERATE_LATEX = NO +## ELSE +## GENERATE_LATEX = YES +## LATEX_OUTPUT = latex +## USE_PDFLATEX = YES +## PDF_HYPERLINKS = YES +## LATEX_CMD_NAME = lualatex +## LATEX_BATCHMODE = YES + + +# GENERATE_TAGFILE = esw_doxygen.tag + +STRIP_CODE_COMMENTS = NO +LOOKUP_CACHE_SIZE = 1 diff --git a/compile/html/bc_s.png b/compile/html/bc_s.png new file mode 100644 index 0000000000000000000000000000000000000000..87473f89bd75c779c14c25ac495591a134453128 GIT binary patch literal 663 zcmeAS@N?(olHy`uVBq!ia0y~yVBlb2V36ZrV_;wqY>4M&U|@>#ba4!+V0=5*J6kwV z=A)lDf2BNj%um@9QWNM88DiA7NN zqQb5fdAo#Me0z?yWk@g1To|^*W8sCF3zlxVX3bpb^E%w(5C8K!)pf=1_8$JpFk^<# znk7F(1YYZ&5u3)~px(2;!@j3&aiRI+bK?6&*E2TwNzCtfzj)0Rm!j~Z-Zjcg*DvLj zRj{3WB|;#1(P5{^bJMb)KEKQG)aqH#<5`C^HN{^~5}Ph|yj1qr{BNr#Iv#0dENoab z(Jwq}Y7~3LBF0s*MI3$1j%GjBS;g93W&D(Tpxy0{Qs*VLlg-BS)5A<0&UD^&e|C3L zbb-{|@2{`^%H{2_?I>l=yyf@&2gm>AhF1mtv9AdG$os3xhwbvoou}@oe7pOanPKjx zHT|{^zgF!(Km9rX;)3wkS8`>7eq7#sJXyitZ&5+I^nzQVeoroy&HgLumhZ~Qu@%=Oc)8q=zJFG}CGy1|fm&@AP08jJFEWrhWpGq0WJ+pM@v zasSkQh5A-@hPif;-=lOh4n1b6=zMtk;k!oylJkx~YpD#?J8|oC#t&`=*;GmW&)nA@ z24>4Ui#xAfH2Keh$m~n2o*C{`$!6|Z$eo)orDkp-b53mK`jlIr1uWz literal 0 HcmV?d00001 diff --git a/compile/html/bdwn.png b/compile/html/bdwn.png new file mode 100644 index 0000000000000000000000000000000000000000..e4504c642149bd823c817f77734f6117999e7238 GIT binary patch literal 143 zcmeAS@N?(olHy`uVBq!ia0y~yU|?rpVBp|jV_;w~WqAss!aQ9ZLn;{G&gB+tP!MpD zpVcU^Wkbs~##a#?7N@LMn4fWIy}fh$_nSNi;ve!%|H^&9<8x}S7sFnY>*;U!XZ5eX xzgKw6zP)5S5Qg7NL#^WM^# zGRN$VXQq6zmP%e^cr5oq(~VU(9j?lFEoA?A<+75KVATs(7RL_{7S3o2oE5a<_#B%K zaqpEk>=#V2z0xYjv^4LuQ|qfuH>ENc{=2o-v+UmV&YPQhN2VS;%|%m*Apsh;k?1*@>Rn# ze-h*W2Bw5o-N`2z{LZS=yJ7rx z-M8HgX)~+}R`3-H_+DHQqFoWfKg-!UG-TJ_yCUDXe75+U*xP;7RqNQgg%2jI6b@!T zZ)bbDWQX;VhD92mx{q!Z2UMB5r|t6i%e zhuvL%y>52=HXT8)3*U?7S6&slJp1yLeN!s-{+C+7=FPtMUR>nYWB=I7uIg#mmVfC> zb2pxDGu?wl=tq;C(zlL1`Z0WL?AbCi(h43q$VA;Cb!61h% zt`-#={x-aEn|3Fx?_&7kJ5|-)6PGKe+)qFGf8zATIW4Che@e41>3Ep%uH90sN^C~v z?1zQtlYj2}cX?ON&8-JarM9pcIx;Ma;9Bv2o%(M79otL$Cz>nYsiM{VQA z`^RSdNOkfH-y6oC(3N^3ZgzNEwP`_UT=~x3D`M6>2#PhjF#F-`7ju7w|4z_UP(QiC zFXh9cA5AG1o)425*I)L2d0ptG{N+#WW^%IZ8;)3|EdH-9X|w0g1nZC1%OpFLj@U66 z`>^({KK?1-W`y4C?z;N@HC0`ip1&{O5RuM3XZG`ewWiw~MvLyH4j;S(;+y&FH~*iq zYsJS9Qx3Q0NynzSIrS<&VlIqiI1uS$d_uLz>s>0}gZj^Z|EK literal 0 HcmV?d00001 diff --git a/compile/html/doxygen.css b/compile/html/doxygen.css new file mode 100644 index 0000000..478166c --- /dev/null +++ b/compile/html/doxygen.css @@ -0,0 +1,1730 @@ +/* The standard CSS for doxygen 1.8.19 */ + +body, table, div, p, dl { + font: 400 14px/22px Roboto,sans-serif; +} + +p.reference, p.definition { + font: 400 14px/22px Roboto,sans-serif; +} + +/* @group Heading Levels */ + +h1.groupheader { + font-size: 150%; +} + +.title { + font: 400 14px/28px Roboto,sans-serif; + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h2.groupheader { + border-bottom: 1px solid #2EBE2E; + color: #0D380D; + font-size: 150%; + font-weight: normal; + margin-top: 1.75em; + padding-top: 8px; + padding-bottom: 4px; + width: 100%; +} + +h3.groupheader { + font-size: 100%; +} + +h1, h2, h3, h4, h5, h6 { + -webkit-transition: text-shadow 0.5s linear; + -moz-transition: text-shadow 0.5s linear; + -ms-transition: text-shadow 0.5s linear; + -o-transition: text-shadow 0.5s linear; + transition: text-shadow 0.5s linear; + margin-right: 15px; +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px cyan; +} + +dt { + font-weight: bold; +} + +ul.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; + column-count: 3; +} + +p.startli, p.startdd { + margin-top: 2px; +} + +th p.starttd, th p.intertd, th p.endtd { + font-size: 100%; + font-weight: 700; +} + +p.starttd { + margin-top: 0px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +p.interli { +} + +p.interdd { +} + +p.intertd { +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #D6F5D6; + border: 1px solid #50D450; + text-align: center; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #114811; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #175E17; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #44D144; + color: #FFFFFF; + border: 1px double #2EBC2E; +} + +.contents a.qindexHL:visited { + color: #FFFFFF; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code, a.code:visited, a.line, a.line:visited { + color: #175E17; +} + +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { + color: #175E17; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +ul { + overflow: hidden; /*Fixed: list item bullets overlap floating elements*/ +} + +#side-nav ul { + overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ +} + +#main-nav ul { + overflow: visible; /* reset ul rule for the navigation bar drop down lists */ +} + +.fragment { + text-align: left; + direction: ltr; + overflow-x: auto; /*Fixed: fragment lines overlap floating elements*/ + overflow-y: hidden; +} + +pre.fragment { + border: 1px solid #8AE28A; + background-color: #F7FDF7; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%; +} + +div.fragment { + padding: 0 0 1px 0; /*Fixed: last line underline overlap border*/ + margin: 4px 8px 4px 2px; + background-color: #F7FDF7; + border: 1px solid #8AE28A; +} + +div.line { + font-family: monospace, fixed; + font-size: 13px; + min-height: 13px; + line-height: 1.0; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line:after { + content:"\000A"; + white-space: pre; +} + +div.line.glow { + background-color: cyan; + box-shadow: 0 0 10px cyan; +} + + +span.lineno { + padding-right: 4px; + text-align: right; + border-right: 2px solid #0F0; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a { + background-color: #D8D8D8; +} + +span.lineno a:hover { + background-color: #C8C8C8; +} + +.lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.ah, span.ah { + background-color: black; + font-weight: bold; + color: #FFFFFF; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); +} + +div.classindex ul { + list-style: none; + padding-left: 0; +} + +div.classindex span.ai { + display: inline-block; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background-color: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 12px; + margin-right: 8px; +} + +td.indexkey { + background-color: #D6F5D6; + font-weight: bold; + border: 1px solid #8AE28A; + margin: 2px 0px 2px 0; + padding: 2px 10px; + white-space: nowrap; + vertical-align: top; +} + +td.indexvalue { + background-color: #D6F5D6; + border: 1px solid #8AE28A; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #DBF6DB; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl, img.inline { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +blockquote { + background-color: #EEFAEE; + border-left: 2px solid #44D144; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + +blockquote.DocNodeRTL { + border-left: 0; + border-right: 2px solid #44D144; + margin: 0 4px 0 24px; + padding: 0 16px 0 12px; +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #50D450; +} + +th.dirtab { + background: #D6F5D6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #196719; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.memberdecls td, .fieldtable tr { + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: cyan; + box-shadow: 0 0 15px cyan; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F3FCF3; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memSeparator { + border-bottom: 1px solid #BBEEBB; + line-height: 1px; + margin: 0px; + padding: 0px; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight, .memTemplItemRight { + width: 100%; +} + +.memTemplParams { + color: #175E17; + white-space: nowrap; + font-size: 80%; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtitle { + padding: 8px; + border-top: 1px solid #58D658; + border-left: 1px solid #58D658; + border-right: 1px solid #58D658; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + margin-bottom: -1px; + background-image: url('nav_f.png'); + background-repeat: repeat-x; + background-color: #C4F0C4; + line-height: 1.25; + font-weight: 300; + float:left; +} + +.permalink +{ + font-size: 65%; + display: inline-block; + vertical-align: middle; +} + +.memtemplate { + font-size: 80%; + color: #175E17; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #D6F5D6; + border: 1px solid #50D450; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; + -webkit-transition: box-shadow 0.5s linear; + -moz-transition: box-shadow 0.5s linear; + -ms-transition: box-shadow 0.5s linear; + -o-transition: box-shadow 0.5s linear; + transition: box-shadow 0.5s linear; + display: table !important; + width: 100%; +} + +.memitem.glow { + box-shadow: 0 0 15px cyan; +} + +.memname { + font-weight: 400; + margin-left: 6px; +} + +.memname td { + vertical-align: bottom; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #58D658; + border-left: 1px solid #58D658; + border-right: 1px solid #58D658; + padding: 6px 0px 6px 0px; + color: #061C06; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + background-color: #BDEEBD; + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 4px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 4px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 4px; + +} + +.overload { + font-family: "courier new",courier,monospace; + font-size: 65%; +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #58D658; + border-left: 1px solid #58D658; + border-right: 1px solid #58D658; + padding: 6px 10px 2px 10px; + background-color: #F7FDF7; + border-top-width: 0; + background-image:url('nav_g.png'); + background-repeat:repeat-x; + background-color: #FFFFFF; + /* opera specific markup */ + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} +.paramname code { + line-height: 14px; +} + +.params, .retval, .exception, .tparams { + margin-left: 0px; + padding-left: 0px; +} + +.params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype, .tparams .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir, .tparams .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: #269F26; + border-top:1px solid #1D771D; + border-left:1px solid #1D771D; + border-right:1px solid #8AE28A; + border-bottom:1px solid #8AE28A; + text-shadow: none; + color: white; + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} + + + +/* @end */ + +/* these are for tree view inside a (index) page */ + +div.directory { + margin: 10px 0px; + border-top: 1px solid #44D144; + border-bottom: 1px solid #44D144; + width: 100%; +} + +.directory table { + border-collapse:collapse; +} + +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; +} + +.directory td.entry { + white-space: nowrap; + padding-right: 6px; + padding-top: 3px; +} + +.directory td.entry a { + outline:none; +} + +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + border-left: 1px solid rgba(0,0,0,0.05); +} + +.directory tr.even { + padding-left: 6px; + background-color: #EEFAEE; +} + +.directory img { + vertical-align: -30%; +} + +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; +} + +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: #114811; +} + +.arrow { + color: #44D144; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #269F26; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +address { + font-style: normal; + color: #082408; +} + +table.doxtable caption { + caption-side: top; +} + +table.doxtable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #0A290A; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #0E3C0E; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +table.fieldtable { + /*width: 100%;*/ + margin-bottom: 10px; + border: 1px solid #58D658; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #58D658; + border-bottom: 1px solid #58D658; + vertical-align: top; +} + +.fieldtable td.fieldname { + padding-top: 3px; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #58D658; + /*width: 100%;*/ +} + +.fieldtable td.fielddoc p:first-child { + margin-top: 0px; +} + +.fieldtable td.fielddoc p:last-child { + margin-bottom: 2px; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #C4F0C4; + font-size: 90%; + color: #061C06; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + font-weight: 400; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #58D658; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + background-position: 0 -5px; + height:30px; + line-height:30px; + color:#2FC22F; + border:solid 1px #86E186; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#0E390E; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; + color: #082108; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; +} + +.navpath li.navelem a:hover +{ + color:#239123; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#0E390E; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + +div.ingroups +{ + font-size: 8pt; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F3FCF3; + margin: 0px; + border-bottom: 1px solid #8AE28A; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +.PageDocRTL-title div.headertitle { + text-align: right; + direction: rtl; +} + +dl { + padding: 0 0 0 0; +} + +/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug, dl.examples */ +dl.section { + margin-left: 0px; + padding-left: 0px; +} + +dl.section.DocNodeRTL { + margin-right: 0px; + padding-right: 0px; +} + +dl.note { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #D0C000; +} + +dl.note.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #D0C000; +} + +dl.warning, dl.attention { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #FF0000; +} + +dl.warning.DocNodeRTL, dl.attention.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00D000; +} + +dl.pre.DocNodeRTL, dl.post.DocNodeRTL, dl.invariant.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #00D000; +} + +dl.deprecated { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #505050; +} + +dl.deprecated.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #505050; +} + +dl.todo { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00C0E0; +} + +dl.todo.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #00C0E0; +} + +dl.test { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #3030E0; +} + +dl.test.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #3030E0; +} + +dl.bug { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #C08050; +} + +dl.bug.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #C08050; +} + +dl.section dd { + margin-bottom: 6px; +} + + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectalign +{ + vertical-align: middle; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #1D771D; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.plantumlgraph +{ + text-align: center; +} + +.diagraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #31CB31; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#0C330C; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd { + margin:2px 0; + padding:5px 0; +} + +div.toc { + padding: 14px 25px; + background-color: #E9F9E9; + border: 1px solid #AFEBAF; + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 8px 10px 10px; + width: 200px; +} + +.PageDocRTL-title div.toc { + float: left !important; + text-align: right; +} + +div.toc li { + background: url("bdwn.png") no-repeat scroll 0 5px transparent; + font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +.PageDocRTL-title div.toc li { + background-position-x: right !important; + padding-left: 0 !important; + padding-right: 10px; +} + +div.toc h3 { + font: bold 12px/1.2 Arial,FreeSans,sans-serif; + color: #175E17; + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.level2 { + margin-left: 15px; +} + +div.toc li.level3 { + margin-left: 30px; +} + +div.toc li.level4 { + margin-left: 45px; +} + +.PageDocRTL-title div.toc li.level1 { + margin-left: 0 !important; + margin-right: 0; +} + +.PageDocRTL-title div.toc li.level2 { + margin-left: 0 !important; + margin-right: 15px; +} + +.PageDocRTL-title div.toc li.level3 { + margin-left: 0 !important; + margin-right: 30px; +} + +.PageDocRTL-title div.toc li.level4 { + margin-left: 0 !important; + margin-right: 45px; +} + +.inherit_header { + font-weight: bold; + color: gray; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0px 2px 5px; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 4px; +} + +/* tooltip related style info */ + +.ttc { + position: absolute; + display: none; +} + +#powerTip { + cursor: default; + white-space: nowrap; + background-color: white; + border: 1px solid gray; + border-radius: 4px 4px 4px 4px; + box-shadow: 1px 1px 7px gray; + display: none; + font-size: smaller; + max-width: 80%; + opacity: 0.9; + padding: 1ex 1em 1em; + position: absolute; + z-index: 2147483647; +} + +#powerTip div.ttdoc { + color: grey; + font-style: italic; +} + +#powerTip div.ttname a { + font-weight: bold; +} + +#powerTip div.ttname { + font-weight: bold; +} + +#powerTip div.ttdeci { + color: #006318; +} + +#powerTip div { + margin: 0px; + padding: 0px; + font: 12px/16px Roboto,sans-serif; +} + +#powerTip:before, #powerTip:after { + content: ""; + position: absolute; + margin: 0px; +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.s:after, #powerTip.s:before, +#powerTip.w:after, #powerTip.w:before, +#powerTip.e:after, #powerTip.e:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.nw:after, #powerTip.nw:before, +#powerTip.sw:after, #powerTip.sw:before { + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; +} + +#powerTip.n:after, #powerTip.s:after, +#powerTip.w:after, #powerTip.e:after, +#powerTip.nw:after, #powerTip.ne:after, +#powerTip.sw:after, #powerTip.se:after { + border-color: rgba(255, 255, 255, 0); +} + +#powerTip.n:before, #powerTip.s:before, +#powerTip.w:before, #powerTip.e:before, +#powerTip.nw:before, #powerTip.ne:before, +#powerTip.sw:before, #powerTip.se:before { + border-color: rgba(128, 128, 128, 0); +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.nw:after, #powerTip.nw:before { + top: 100%; +} + +#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { + border-top-color: #FFFFFF; + border-width: 10px; + margin: 0px -10px; +} +#powerTip.n:before { + border-top-color: #808080; + border-width: 11px; + margin: 0px -11px; +} +#powerTip.n:after, #powerTip.n:before { + left: 50%; +} + +#powerTip.nw:after, #powerTip.nw:before { + right: 14px; +} + +#powerTip.ne:after, #powerTip.ne:before { + left: 14px; +} + +#powerTip.s:after, #powerTip.s:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.sw:after, #powerTip.sw:before { + bottom: 100%; +} + +#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { + border-bottom-color: #FFFFFF; + border-width: 10px; + margin: 0px -10px; +} + +#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { + border-bottom-color: #808080; + border-width: 11px; + margin: 0px -11px; +} + +#powerTip.s:after, #powerTip.s:before { + left: 50%; +} + +#powerTip.sw:after, #powerTip.sw:before { + right: 14px; +} + +#powerTip.se:after, #powerTip.se:before { + left: 14px; +} + +#powerTip.e:after, #powerTip.e:before { + left: 100%; +} +#powerTip.e:after { + border-left-color: #FFFFFF; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.e:before { + border-left-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +#powerTip.w:after, #powerTip.w:before { + right: 100%; +} +#powerTip.w:after { + border-right-color: #FFFFFF; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.w:before { + border-right-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } +} + +/* @group Markdown */ + +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #0A290A; + padding: 3px 7px 2px; +} + +table.markdownTable tr { +} + +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { + background-color: #0E3C0E; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft, td.markdownTableBodyLeft { + text-align: left +} + +th.markdownTableHeadRight, td.markdownTableBodyRight { + text-align: right +} + +th.markdownTableHeadCenter, td.markdownTableBodyCenter { + text-align: center +} + +.DocNodeRTL { + text-align: right; + direction: rtl; +} + +.DocNodeLTR { + text-align: left; + direction: ltr; +} + +table.DocNodeRTL { + width: auto; + margin-right: 0; + margin-left: auto; +} + +table.DocNodeLTR { + width: auto; + margin-right: auto; + margin-left: 0; +} + +tt, code, kbd, samp +{ + display: inline-block; + direction:ltr; +} +/* @end */ + +u { + text-decoration: underline; +} + diff --git a/compile/html/doxygen.svg b/compile/html/doxygen.svg new file mode 100644 index 0000000..7afd4cd --- /dev/null +++ b/compile/html/doxygen.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/compile/html/dynsections.js b/compile/html/dynsections.js new file mode 100644 index 0000000..3174bd7 --- /dev/null +++ b/compile/html/dynsections.js @@ -0,0 +1,121 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +function toggleVisibility(linkObj) +{ + var base = $(linkObj).attr('id'); + var summary = $('#'+base+'-summary'); + var content = $('#'+base+'-content'); + var trigger = $('#'+base+'-trigger'); + var src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.hide(); + summary.show(); + $(linkObj).addClass('closed').removeClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + content.show(); + summary.hide(); + $(linkObj).removeClass('closed').addClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); + } + return false; +} + +function updateStripes() +{ + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); +} + +function toggleLevel(level) +{ + $('table.directory tr').each(function() { + var l = this.id.split('_').length-1; + var i = $('#img'+this.id.substring(3)); + var a = $('#arr'+this.id.substring(3)); + if (lEakt!T2_Ix1Y45 zi0y91B@^6TMO6EyItW@urAAh(Dhs5gatpX|aPC}iQhtK}f&wY6BjHb&gA~kLnyQps z7jSq8E@hCCQaN(i@ZQWfvhOSAD>-&`ix?N1=%2U!KF``Z&s33x;R}xy!xtf2^%u+y z7Gd@4y3RiKWpJEbZ`i-}p(!uJyQUB(qjxsNO$Mg2y^q-h84k={aCCCaJ>Blh^2-hG z&)C;ywIlrdzW1ekFQiz+H}Q){NmrS+$Y!f=DqJ78o|)s;ujyZZxn(kcQz$ZvU}wl5v`kCbJjF(JR_lIB&=blzi5VLl96@i+x*)RC)d{eSnT4yzi-L)kR1<# zlwRroOf_GW{XOd4c2{ZLi-#82aWHVIaN6une`}oSA{p#r{>ZH_de77US61J%x~g5r z%D}nA%^_~0p;Cu*(C@4_T-&YL8Z3l7&FmzTEcf@Q<+C|f9$P7p*>WU)`n;^#8@KKr zs>`*X^u&ebkf>~@lbp7*iTYu$T^5c}3M(yl6zK1gYb$oNRSoeJuN2zTJ;80l1dZ>8 z>OFfdew@Ph^S+afc%sm(U>5dx{(>LxK9qH?nDCE9NkPeK&AQc-e7uC}um1B=T0dv^ z^PsK`{}_~fC$;JDePCqpP%vdzpYPAaYx+Kup%dKmdKI;Vst00Tb)Eakt!T2_IfA(z$ zk$)=x9f~@iuE=W|DOLNyBpyyh?|*GUCoULHP&_+Db@8s}{wE>~mR!hDP2Tiv zSBc?5lQt)&rMhaId`pg93sv{-Ou3oIeKx3S-}&z)%YWaizQ1>KcwZ0~!*@10hIhjM zH#9HqR^D~_&cfTvZ?5Dn6T(|jpWP0|R z)X$MJ_Lh99LMIcx-(9!$PlaSu)ZsNI-7~-Nn0Pj8tqd^Yy5dtm<+9PH$&ntCoG(wB zJZU#NH~aYw6Eo+TJhsiN?@iV2U2mEld#iM5(&B9E&->1vTa;b?ev_Q~#Gl8ORND5d z%>Q!g%*{6wzFggOaijJ2zMA9zDsJv^d7P=N5_rV%Yw1)i)uU${CK?;rPgW?r@U3}= z-CnoHkvAMel-k$d&2A38pvyQpLE%wCG5^e?AFYKX*YjwJxfU3%kJ`ia(w>2%WZSWi z_p1F|@7C-)c=Ge)`1FMG8{rS;vA=ChUmkJzGecAD6JI{TJ_UZkz8@DQUoH5%kN3ek zW67JWpP$O4Z8lt}!l2M{!c}-#i+gu*_mZ%+6T1QxTZf_JfZik-cG*pjK+lZ_+7ug5bSxPRz>y$ORv_xvSCnD0L^f6L3j Pz`)??>gTe~DWM4f+p#hB literal 0 HcmV?d00001 diff --git a/compile/html/index.html b/compile/html/index.html new file mode 100644 index 0000000..5aa4a3f --- /dev/null +++ b/compile/html/index.html @@ -0,0 +1,97 @@ + + + + + + + +GIS_embedded_SW: Main Page + + + + + + + + + + + + + +
+
+ + + + + + +
+
GIS_embedded_SW +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
GIS_embedded_SW Documentation
+
+
+
+
+ + + + diff --git a/compile/html/jquery.js b/compile/html/jquery.js new file mode 100644 index 0000000..103c32d --- /dev/null +++ b/compile/html/jquery.js @@ -0,0 +1,35 @@ +/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),h=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(h=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):h=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element +},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),m&&(p-=l),g&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable});/** + * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler + * Licensed under MIT + * @author Ariel Flesler + * @version 2.1.2 + */ +;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1=f[g]?0:Math.min(f[g],n));!a&&1-1){targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if(session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)}closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if(session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE,function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList,finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight()));return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")}function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(),elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight,viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 + * http://www.smartmenus.org/ + * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)),mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend($.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy(this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?(this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for(var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if((!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&(this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]")||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"),a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i,downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2))&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0),canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})}return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$}); \ No newline at end of file diff --git a/compile/html/menu.js b/compile/html/menu.js new file mode 100644 index 0000000..2fe2214 --- /dev/null +++ b/compile/html/menu.js @@ -0,0 +1,51 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { + function makeTree(data,relPath) { + var result=''; + if ('children' in data) { + result+=''; + } + return result; + } + + $('#main-nav').append(makeTree(menudata,relPath)); + $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); + if (searchEnabled) { + if (serverSide) { + $('#main-menu').append('
  • '); + } else { + $('#main-menu').append('
  • '); + } + } + $('#main-menu').smartmenus(); +} +/* @license-end */ diff --git a/compile/html/menudata.js b/compile/html/menudata.js new file mode 100644 index 0000000..d1ece13 --- /dev/null +++ b/compile/html/menudata.js @@ -0,0 +1,26 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file +*/ +var menudata={children:[ +{text:"Main Page",url:"index.html"}]} diff --git a/compile/html/nav_f.png b/compile/html/nav_f.png new file mode 100644 index 0000000000000000000000000000000000000000..8d6c747181ce9a55e1ec161439aa5913c9a1a1a9 GIT binary patch literal 170 zcmeAS@N?(olHy`uVBq!ia0y~yU|?imV6fm|Vqjp{%*48zfq|jW)5S5Qg7NKLU#?~c zp0e8HRzy1y5uB_LqM7j1l&U5{-?+H(l4PQyPiT3S%8=p;8)jyM& z=5;x{;%zHzP9;4pa1=O c{j~7m&vHwiSZ&$Cz`(%Z>FVdQ&MBb@0BmYSng9R* literal 0 HcmV?d00001 diff --git a/compile/html/nav_g.png b/compile/html/nav_g.png new file mode 100644 index 0000000000000000000000000000000000000000..2093a237a94f6c83e19ec6e5fd42f7ddabdafa81 GIT binary patch literal 95 zcmeAS@N?(olHy`uVBq!ia0y~yU|?imU|{25V_;xl68K`sz`&s9>Eakt!T9#BAuj_1 z2lGLH5An2?hw;3+c6B?R`YL3e_I+`nnVp?Km|^dqCL2};1_lOCS3j3^P6Eakt!T9#BqacF; z50hijjh_Bf%U^yGlxJV<=0 ? varName.substring(i+1) : varName; + return eval(n.replace(/\-/g,'_')); +} + +function stripPath(uri) +{ + return uri.substring(uri.lastIndexOf('/')+1); +} + +function stripPath2(uri) +{ + var i = uri.lastIndexOf('/'); + var s = uri.substring(i+1); + var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); + return m ? uri.substring(i-6) : s; +} + +function hashValue() +{ + return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,''); +} + +function hashUrl() +{ + return '#'+hashValue(); +} + +function pathName() +{ + return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, ''); +} + +function localStorageSupported() +{ + try { + return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem; + } + catch(e) { + return false; + } +} + +function storeLink(link) +{ + if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) { + window.localStorage.setItem('navpath',link); + } +} + +function deleteLink() +{ + if (localStorageSupported()) { + window.localStorage.setItem('navpath',''); + } +} + +function cachedLink() +{ + if (localStorageSupported()) { + return window.localStorage.getItem('navpath'); + } else { + return ''; + } +} + +function getScript(scriptName,func,show) +{ + var head = document.getElementsByTagName("head")[0]; + var script = document.createElement('script'); + script.id = scriptName; + script.type = 'text/javascript'; + script.onload = func; + script.src = scriptName+'.js'; + head.appendChild(script); +} + +function createIndent(o,domNode,node,level) +{ + var level=-1; + var n = node; + while (n.parentNode) { level++; n=n.parentNode; } + if (node.childrenData) { + var imgNode = document.createElement("span"); + imgNode.className = 'arrow'; + imgNode.style.paddingLeft=(16*level).toString()+'px'; + imgNode.innerHTML=arrowRight; + node.plus_img = imgNode; + node.expandToggle = document.createElement("a"); + node.expandToggle.href = "javascript:void(0)"; + node.expandToggle.onclick = function() { + if (node.expanded) { + $(node.getChildrenUL()).slideUp("fast"); + node.plus_img.innerHTML=arrowRight; + node.expanded = false; + } else { + expandNode(o, node, false, false); + } + } + node.expandToggle.appendChild(imgNode); + domNode.appendChild(node.expandToggle); + } else { + var span = document.createElement("span"); + span.className = 'arrow'; + span.style.width = 16*(level+1)+'px'; + span.innerHTML = ' '; + domNode.appendChild(span); + } +} + +var animationInProgress = false; + +function gotoAnchor(anchor,aname,updateLocation) +{ + var pos, docContent = $('#doc-content'); + var ancParent = $(anchor.parent()); + if (ancParent.hasClass('memItemLeft') || + ancParent.hasClass('memtitle') || + ancParent.hasClass('fieldname') || + ancParent.hasClass('fieldtype') || + ancParent.is(':header')) + { + pos = ancParent.position().top; + } else if (anchor.position()) { + pos = anchor.position().top; + } + if (pos) { + var dist = Math.abs(Math.min( + pos-docContent.offset().top, + docContent[0].scrollHeight- + docContent.height()-docContent.scrollTop())); + animationInProgress=true; + docContent.animate({ + scrollTop: pos + docContent.scrollTop() - docContent.offset().top + },Math.max(50,Math.min(500,dist)),function(){ + if (updateLocation) window.location.href=aname; + animationInProgress=false; + }); + } +} + +function newNode(o, po, text, link, childrenData, lastNode) +{ + var node = new Object(); + node.children = Array(); + node.childrenData = childrenData; + node.depth = po.depth + 1; + node.relpath = po.relpath; + node.isLast = lastNode; + + node.li = document.createElement("li"); + po.getChildrenUL().appendChild(node.li); + node.parentNode = po; + + node.itemDiv = document.createElement("div"); + node.itemDiv.className = "item"; + + node.labelSpan = document.createElement("span"); + node.labelSpan.className = "label"; + + createIndent(o,node.itemDiv,node,0); + node.itemDiv.appendChild(node.labelSpan); + node.li.appendChild(node.itemDiv); + + var a = document.createElement("a"); + node.labelSpan.appendChild(a); + node.label = document.createTextNode(text); + node.expanded = false; + a.appendChild(node.label); + if (link) { + var url; + if (link.substring(0,1)=='^') { + url = link.substring(1); + link = url; + } else { + url = node.relpath+link; + } + a.className = stripPath(link.replace('#',':')); + if (link.indexOf('#')!=-1) { + var aname = '#'+link.split('#')[1]; + var srcPage = stripPath(pathName()); + var targetPage = stripPath(link.split('#')[0]); + a.href = srcPage!=targetPage ? url : "javascript:void(0)"; + a.onclick = function(){ + storeLink(link); + if (!$(a).parent().parent().hasClass('selected')) + { + $('.item').removeClass('selected'); + $('.item').removeAttr('id'); + $(a).parent().parent().addClass('selected'); + $(a).parent().parent().attr('id','selected'); + } + var anchor = $(aname); + gotoAnchor(anchor,aname,true); + }; + } else { + a.href = url; + a.onclick = function() { storeLink(link); } + } + } else { + if (childrenData != null) + { + a.className = "nolink"; + a.href = "javascript:void(0)"; + a.onclick = node.expandToggle.onclick; + } + } + + node.childrenUL = null; + node.getChildrenUL = function() { + if (!node.childrenUL) { + node.childrenUL = document.createElement("ul"); + node.childrenUL.className = "children_ul"; + node.childrenUL.style.display = "none"; + node.li.appendChild(node.childrenUL); + } + return node.childrenUL; + }; + + return node; +} + +function showRoot() +{ + var headerHeight = $("#top").height(); + var footerHeight = $("#nav-path").height(); + var windowHeight = $(window).height() - headerHeight - footerHeight; + (function (){ // retry until we can scroll to the selected item + try { + var navtree=$('#nav-tree'); + navtree.scrollTo('#selected',100,{offset:-windowHeight/2}); + } catch (err) { + setTimeout(arguments.callee, 0); + } + })(); +} + +function expandNode(o, node, imm, showRoot) +{ + if (node.childrenData && !node.expanded) { + if (typeof(node.childrenData)==='string') { + var varName = node.childrenData; + getScript(node.relpath+varName,function(){ + node.childrenData = getData(varName); + expandNode(o, node, imm, showRoot); + }, showRoot); + } else { + if (!node.childrenVisited) { + getNode(o, node); + } + $(node.getChildrenUL()).slideDown("fast"); + node.plus_img.innerHTML = arrowDown; + node.expanded = true; + } + } +} + +function glowEffect(n,duration) +{ + n.addClass('glow').delay(duration).queue(function(next){ + $(this).removeClass('glow');next(); + }); +} + +function highlightAnchor() +{ + var aname = hashUrl(); + var anchor = $(aname); + if (anchor.parent().attr('class')=='memItemLeft'){ + var rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); + glowEffect(rows.children(),300); // member without details + } else if (anchor.parent().attr('class')=='fieldname'){ + glowEffect(anchor.parent().parent(),1000); // enum value + } else if (anchor.parent().attr('class')=='fieldtype'){ + glowEffect(anchor.parent().parent(),1000); // struct field + } else if (anchor.parent().is(":header")) { + glowEffect(anchor.parent(),1000); // section header + } else { + glowEffect(anchor.next(),1000); // normal member + } +} + +function selectAndHighlight(hash,n) +{ + var a; + if (hash) { + var link=stripPath(pathName())+':'+hash.substring(1); + a=$('.item a[class$="'+link+'"]'); + } + if (a && a.length) { + a.parent().parent().addClass('selected'); + a.parent().parent().attr('id','selected'); + highlightAnchor(); + } else if (n) { + $(n.itemDiv).addClass('selected'); + $(n.itemDiv).attr('id','selected'); + } + if ($('#nav-tree-contents .item:first').hasClass('selected')) { + $('#nav-sync').css('top','30px'); + } else { + $('#nav-sync').css('top','5px'); + } + showRoot(); +} + +function showNode(o, node, index, hash) +{ + if (node && node.childrenData) { + if (typeof(node.childrenData)==='string') { + var varName = node.childrenData; + getScript(node.relpath+varName,function(){ + node.childrenData = getData(varName); + showNode(o,node,index,hash); + },true); + } else { + if (!node.childrenVisited) { + getNode(o, node); + } + $(node.getChildrenUL()).css({'display':'block'}); + node.plus_img.innerHTML = arrowDown; + node.expanded = true; + var n = node.children[o.breadcrumbs[index]]; + if (index+11) hash = '#'+parts[1].replace(/[^\w\-]/g,''); + else hash=''; + } + if (hash.match(/^#l\d+$/)) { + var anchor=$('a[name='+hash.substring(1)+']'); + glowEffect(anchor.parent(),1000); // line number + hash=''; // strip line number anchors + } + var url=root+hash; + var i=-1; + while (NAVTREEINDEX[i+1]<=url) i++; + if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash,relpath) + } else { + getScript(relpath+'navtreeindex'+i,function(){ + navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash,relpath); + } + },true); + } +} + +function showSyncOff(n,relpath) +{ + n.html(''); +} + +function showSyncOn(n,relpath) +{ + n.html(''); +} + +function toggleSyncButton(relpath) +{ + var navSync = $('#nav-sync'); + if (navSync.hasClass('sync')) { + navSync.removeClass('sync'); + showSyncOff(navSync,relpath); + storeLink(stripPath2(pathName())+hashUrl()); + } else { + navSync.addClass('sync'); + showSyncOn(navSync,relpath); + deleteLink(); + } +} + +var loadTriggered = false; +var readyTriggered = false; +var loadObject,loadToRoot,loadUrl,loadRelPath; + +$(window).on('load',function(){ + if (readyTriggered) { // ready first + navTo(loadObject,loadToRoot,loadUrl,loadRelPath); + showRoot(); + } + loadTriggered=true; +}); + +function initNavTree(toroot,relpath) +{ + var o = new Object(); + o.toroot = toroot; + o.node = new Object(); + o.node.li = document.getElementById("nav-tree-contents"); + o.node.childrenData = NAVTREE; + o.node.children = new Array(); + o.node.childrenUL = document.createElement("ul"); + o.node.getChildrenUL = function() { return o.node.childrenUL; }; + o.node.li.appendChild(o.node.childrenUL); + o.node.depth = 0; + o.node.relpath = relpath; + o.node.expanded = false; + o.node.isLast = true; + o.node.plus_img = document.createElement("span"); + o.node.plus_img.className = 'arrow'; + o.node.plus_img.innerHTML = arrowRight; + + if (localStorageSupported()) { + var navSync = $('#nav-sync'); + if (cachedLink()) { + showSyncOff(navSync,relpath); + navSync.removeClass('sync'); + } else { + showSyncOn(navSync,relpath); + } + navSync.click(function(){ toggleSyncButton(relpath); }); + } + + if (loadTriggered) { // load before ready + navTo(o,toroot,hashUrl(),relpath); + showRoot(); + } else { // ready before load + loadObject = o; + loadToRoot = toroot; + loadUrl = hashUrl(); + loadRelPath = relpath; + readyTriggered=true; + } + + $(window).bind('hashchange', function(){ + if (window.location.hash && window.location.hash.length>1){ + var a; + if ($(location).attr('hash')){ + var clslink=stripPath(pathName())+':'+hashValue(); + a=$('.item a[class$="'+clslink.replace(/puoYr zKJTy--%F>S#RvO41@HZ{@R-eQ%@%n!5n`Q!R VGs9+vFfcGMc)I$ztaD0e0st~WC20Tv literal 0 HcmV?d00001 diff --git a/compile/html/resize.js b/compile/html/resize.js new file mode 100644 index 0000000..e1ad0fe --- /dev/null +++ b/compile/html/resize.js @@ -0,0 +1,140 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +function initResizable() +{ + var cookie_namespace = 'doxygen'; + var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight; + + function readCookie(cookie) + { + var myCookie = cookie_namespace+"_"+cookie+"="; + if (document.cookie) { + var index = document.cookie.indexOf(myCookie); + if (index != -1) { + var valStart = index + myCookie.length; + var valEnd = document.cookie.indexOf(";", valStart); + if (valEnd == -1) { + valEnd = document.cookie.length; + } + var val = document.cookie.substring(valStart, valEnd); + return val; + } + } + return 0; + } + + function writeCookie(cookie, val, expiration) + { + if (val==undefined) return; + if (expiration == null) { + var date = new Date(); + date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week + expiration = date.toGMTString(); + } + document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; + } + + function resizeWidth() + { + var windowWidth = $(window).width() + "px"; + var sidenavWidth = $(sidenav).outerWidth(); + content.css({marginLeft:parseInt(sidenavWidth)+"px"}); + writeCookie('width',sidenavWidth-barWidth, null); + } + + function restoreWidth(navWidth) + { + var windowWidth = $(window).width() + "px"; + content.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); + sidenav.css({width:navWidth + "px"}); + } + + function resizeHeight() + { + var headerHeight = header.outerHeight(); + var footerHeight = footer.outerHeight(); + var windowHeight = $(window).height() - headerHeight - footerHeight; + content.css({height:windowHeight + "px"}); + navtree.css({height:windowHeight + "px"}); + sidenav.css({height:windowHeight + "px"}); + var width=$(window).width(); + if (width!=collapsedWidth) { + if (width=desktop_vp) { + if (!collapsed) { + collapseExpand(); + } + } else if (width>desktop_vp && collapsedWidth0) { + restoreWidth(0); + collapsed=true; + } + else { + var width = readCookie('width'); + if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); } + collapsed=false; + } + } + + header = $("#top"); + sidenav = $("#side-nav"); + content = $("#doc-content"); + navtree = $("#nav-tree"); + footer = $("#nav-path"); + $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); + $(sidenav).resizable({ minWidth: 0 }); + $(window).resize(function() { resizeHeight(); }); + var device = navigator.userAgent.toLowerCase(); + var touch_device = device.match(/(iphone|ipod|ipad|android)/); + if (touch_device) { /* wider split bar for touch only devices */ + $(sidenav).css({ paddingRight:'20px' }); + $('.ui-resizable-e').css({ width:'20px' }); + $('#nav-sync').css({ right:'34px' }); + barWidth=20; + } + var width = readCookie('width'); + if (width) { restoreWidth(width); } else { resizeWidth(); } + resizeHeight(); + var url = location.href; + var i=url.indexOf("#"); + if (i>=0) window.location.hash=url.substr(i); + var _preventDefault = function(evt) { evt.preventDefault(); }; + $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); + $(".ui-resizable-handle").dblclick(collapseExpand); + $(window).on('load',resizeHeight); +} +/* @license-end */ diff --git a/compile/html/search/close.svg b/compile/html/search/close.svg new file mode 100644 index 0000000..a933eea --- /dev/null +++ b/compile/html/search/close.svg @@ -0,0 +1,31 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/compile/html/search/mag_sel.svg b/compile/html/search/mag_sel.svg new file mode 100644 index 0000000..03626f6 --- /dev/null +++ b/compile/html/search/mag_sel.svg @@ -0,0 +1,74 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/compile/html/search/nomatches.html b/compile/html/search/nomatches.html new file mode 100644 index 0000000..4377320 --- /dev/null +++ b/compile/html/search/nomatches.html @@ -0,0 +1,12 @@ + + + + + + + +
    +
    No Matches
    +
    + + diff --git a/compile/html/search/search.css b/compile/html/search/search.css new file mode 100644 index 0000000..e45fb90 --- /dev/null +++ b/compile/html/search/search.css @@ -0,0 +1,255 @@ +/*---------------- Search Box */ + +#MSearchBox { + white-space : nowrap; + background: white; + border-radius: 0.65em; + box-shadow: inset 0.5px 0.5px 3px 0px #555; + z-index: 102; +} + +#MSearchBox .left { + display: inline-block; + vertical-align: middle; + height: 1.4em; +} + +#MSearchSelect { + display: inline-block; + vertical-align: middle; + height: 1.4em; + padding: 0 0 0 0.3em; + margin: 0; +} + +#MSearchField { + display: inline-block; + vertical-align: middle; + width: 7.5em; + height: 1.1em; + margin: 0 0.15em; + padding: 0; + line-height: 1em; + border:none; + color: #909090; + outline: none; + font-family: Arial, Verdana, sans-serif; + -webkit-border-radius: 0px; + border-radius: 0px; + background: none; +} + + +#MSearchBox .right { + display: inline-block; + vertical-align: middle; + width: 1.4em; + height: 1.4em; +} + +#MSearchClose { + display: none; + font-size: inherit; + background : none; + border: none; + margin: 0; + padding: 0; + outline: none; + +} + +#MSearchCloseImg { + height: 1.4em; + padding: 0.3em; + margin: 0; +} + +.MSearchBoxActive #MSearchField { + color: #000000; +} + +#main-menu > li:last-child { + /* This
  • object is the parent of the search bar */ + display: flex; + justify-content: center; + align-items: center; + height: 36px; + margin-right: 1em; +} + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #31CB31; + background-color: #F3FCF3; + z-index: 10001; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial, Verdana, sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: monospace; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: #000000; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: #000000; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: #FFFFFF; + background-color: #114811; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + width: 60ex; + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000; + background-color: #DBF6DB; + z-index:10000; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; + padding-bottom: 15px; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +body.SRPage { + margin: 5px 2px; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #145314; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #145314; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +span.SRScope { + padding-left: 4px; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; +} + +.SRResult { + display: none; +} + +DIV.searchresults { + margin-left: 10px; + margin-right: 10px; +} + +/*---------------- External search page results */ + +.searchresult { + background-color: #E0F7E0; +} + +.pages b { + color: white; + padding: 5px 5px 3px 5px; + background-image: url("../tab_a.png"); + background-repeat: repeat-x; + text-shadow: 0 1px 1px #000000; +} + +.pages { + line-height: 17px; + margin-left: 4px; + text-decoration: none; +} + +.hl { + font-weight: bold; +} + +#searchresults { + margin-bottom: 20px; +} + +.searchpages { + margin-top: 10px; +} + diff --git a/compile/html/search/search.js b/compile/html/search/search.js new file mode 100644 index 0000000..92b6094 --- /dev/null +++ b/compile/html/search/search.js @@ -0,0 +1,814 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +function convertToId(search) +{ + var result = ''; + for (i=0;i do a search + { + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex0) // Up + { + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==13 || e.keyCode==27) + { + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() + { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + var code = searchValue.toLowerCase().charCodeAt(0); + var idxChar = searchValue.substr(0, 1).toLowerCase(); + if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair + { + idxChar = searchValue.substr(0, 2); + } + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); + if (idx!=-1) + { + var hexCode=idx.toString(16); + resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else // nothing available for this search term + { + resultsPage = this.resultsPath + '/nomatches.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + } + + window.frames.MSearchResults.location = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline-block'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) + { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) + { + this.DOMSearchBox().className = 'MSearchBoxActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == this.searchLabel) // clear "Search" term upon entry + { + searchField.value = ''; + this.searchActive = true; + } + } + else if (!isActive) // directly remove the panel + { + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.DOMSearchField().value = this.searchLabel; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults(name) +{ + // The number of matches from the last run of . + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) + { + var parentElement = document.getElementById(id); + var element = parentElement.firstChild; + + while (element && element!=parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'SRChildren') + { + return element; + } + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { + element = element.firstChild; + } + else if (element.nextSibling) + { + element = element.nextSibling; + } + else + { + do + { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) + { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) + { + var element = this.FindChildElement(id); + if (element) + { + if (element.style.display == 'block') + { + element.style.display = 'none'; + } + else + { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) + { + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) + { + if (e.type == "keydown") + { + this.repeatOn = false; + this.lastKey = e.keyCode; + } + else if (e.type == "keypress") + { + if (!this.repeatOn) + { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } + else if (e.type == "keyup") + { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + var newIndex = itemIndex-1; + var focusItem = this.NavPrev(newIndex); + if (focusItem) + { + var child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') // children visible + { + var n=0; + var tmpElem; + while (1) // search for last child + { + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) + { + focusItem = tmpElem; + } + else // found it! + { + break; + } + n++; + } + } + } + if (focusItem) + { + focusItem.focus(); + } + else // return focus to search field + { + parent.document.getElementById("MSearchField").focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = itemIndex+1; + var focusItem; + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') // children visible + { + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } + else if (this.lastKey==39) // Right + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } + else if (this.lastKey==37) // Left + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + if (childIndex>0) + { + var newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } + else // already at first child, jump to parent + { + document.getElementById('Item'+itemIndex).focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = childIndex+1; + var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) // last child, jump to parent next parent + { + elem = this.NavNext(itemIndex+1); + } + if (elem) + { + elem.focus(); + } + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } +} + +function setKeyActions(elem,action) +{ + elem.setAttribute('onkeydown',action); + elem.setAttribute('onkeypress',action); + elem.setAttribute('onkeyup',action); +} + +function setClassAttr(elem,attr) +{ + elem.setAttribute('class',attr); + elem.setAttribute('className',attr); +} + +function createResults() +{ + var results = document.getElementById("SRResults"); + for (var e=0; e%fP_El;rL1 z!tlSn|IB^{1_sUokH}&M25w;xW@MN(M}mQYfxX1j*OmPd4?DMvp#R(O`wR?>TAnVB zAsXjbVg0nnS(2=L@r;~l zr?>pSBd5hyc0cgJos0Yb+{jy4*fpd0WYu5$q!Ohmr;-;YF461QSrMtZNG48H#U?lJ zSiF6Su&qM2PSsmhPU(j;FMrKYbe?E+w(;%Dvv>dU^|n7dzb#2W{Qh^XOWFBt>K?i-XJBAp@O1Ta JS?83{1OS@7FGc_W literal 0 HcmV?d00001 diff --git a/compile/html/search/search_r.png b/compile/html/search/search_r.png new file mode 100644 index 0000000000000000000000000000000000000000..1af5d21ee13e070d7600f1c4657fde843b953a69 GIT binary patch literal 553 zcmeAS@N?(olHy`uVBq!ia0y~yU=U(pU=ZeDVPIe|pFOpbfq{V~-O<;Pfnj4m_n$;o z1_lO&WRDO zXjy3{7_xwG25(c}=Vx=p7C&ftd}p)m_oAKOg=hb``65qxj`xqKR2ILXHzXz`u_PB50j!uU5reQmC1^U6F-*NbqVxnwl4CYZLT-x zNSvlo*e92Ev-2uZw}KY1blLId-PydBQ%J)qB=l1ZgGJ+{v+Z80>V8b^YA^2!cwTx^ zWLt7+`k8etI(eUy(w;e~be~#jCR()ods?351Kq>j*LRn*-!gHkkTrXC|9w@>>EGG8 zg(|G?Jh-YNuH4O9J>il#TV>VJ{)57)t0Q(qopxh|S{Yeb8JcSw7+4t?=-NBqM$wR)pOTqYiCaTV T((iNz1_lOCS3j3^P6@Vhig||; zWZFKqPx3i`MZ~C6@uuReOOq!kK6_=sxNbLtx#CON8FON$y?V*HZBjy)^z{4GTZf+~-a7mH*kVry6*ACY=laP{?2X+SBup6? P7#KWV{an^LB{Ts5&<}H4 literal 0 HcmV?d00001 diff --git a/compile/html/sync_off.png b/compile/html/sync_off.png new file mode 100644 index 0000000000000000000000000000000000000000..d97cd7b6db9628efebaa5df36fe9ea30453f9e26 GIT binary patch literal 846 zcmeAS@N?(olHy`uVBq!ia0y~yV2}V|4mJh`h6m-gKNuL8MLk^{Ln;{G-i`H`5-D-u zvm(+Sv)?XviGJbQD?U+KC~Qk&TH|TI4*BZPs^E+TN=FVkHNI&Tmkyg2 zx0bv6?Jf-;w+)H%;gROiEiMAwt=guuZ+-6hd~VNYD`lyB^DOP3&8fU^dEWB5?R(4Z z+ZLU6Wmx&7(`ciAjdD?o^B%GOqcbD~&ofNgxRhf<*c|cYi&7gx{t27APXEE~al((G zyWvNq2$PQEE(_(puFa2T{ahq#@cir2~5M-R6z9K%}|NKX} zOI(*3*7#*MwCL^nzC+T&=)lQ0lNr2&UTLPT$m!Vnk9EDzPQMRvi?{tfP*%15%cH`o zr1C2%*B`9@@^H&p`|f@Be<|I+I`wLfPq+QHJ^G(G-f~@>aqq;7w-;|*x+<8Gtyy7m z;z8fRmSd)}r)*rp9mU`NeEa6~1=(b~Qn8Yt?d$kD(x=~bJ-Y6>ixa_YpeLgs<$q><^T6^Z)niF z?EcSv;-@QTL=G-@JoaD8{QjqiYFX6l_DuS~E8&VS>tbh}{q&N7fq}u( L)z4*}Q$iB}4|Sg+ literal 0 HcmV?d00001 diff --git a/compile/html/sync_on.png b/compile/html/sync_on.png new file mode 100644 index 0000000000000000000000000000000000000000..b1790f6aa69ca73b49358146ca3003b4e615eabb GIT binary patch literal 825 zcmeAS@N?(olHy`uVBq!ia0y~yV2}V|4mJh`h6m-gKNuL889ZGaLn;{G-u3knNtZbA z@&CIwQCiX~v<0Gm8cevQq1b!%faCNd%XEaCOtV(#sC85|JXm?a(bs@+QKpa2ts`GH zw5MhJa4(OG3NjT4lEQpC3k{Y2F%&#LdBI_yg?`ke>kKn(1n+lxKk`2y zXxCtp_;ITSb3}Vip_`1@{O;G^+T#w$sUPWIAFy-plg@nC@?~sxg7;G-L=RNO3aYP_ zciUi>v2~s8eWneJTQ=Kw>|ZMwBcRHVS95S{^QV1t?RGn8F)fN0pZIUJ#}=kF4^x*u z_F!MQN}$0xp}gT;@?D9WyRsOsS!k7IF_-2AKR*BY^8G9C-)g-|QryV!V8Rc5$KTa& zUHV;5YMo{(xV(sW&C9q1|AvLm&L-j}%zHw7^LP($J^Z9SX1n)XvklklmOpyTb!^q~ z6=&AP>=oDSxNzl$%ah9;FDo7wT9ubB+x9#9=n?y#;s*~H4+vKN`o^_p`n9m@$97IC zX5izEmiA$o`D1V0BI`v*ijrdXRsNj+w0?SNC0hxL+~+d}HaX{S@qKXPG8cXHv0ChH z`o*4_`VCf@UrS@E|4U8idfA#OXH%=t{p#qYn2G)u#Ftntm-0Az;4ov7{n3hlZ+4cx z*3W%Vz4OPJf5&r8Z%f=U&G_c#{n|&nJpUeR(8AMS>R#-tw4FcW`Iq<0XYR4(v`F&W zUBX^)WbqH>LyHsDo~fO=KfCuV1K+h@*Dto#@$L*=_q4CiVfl0Owd@5g6O%7Q-#`81 zj>Y!2e8!b0?#}m)&y=@Sw$-tXV=4$veadY6B#d9f{m_TXX@8^t?pqp}uIhHc;CWSQ zA?ty&E7Y`CHwG;f{>68I?ZUkmZ2yj0ZItWU%pkoaT-*PAhWU}*CqK(PD6Li9R}txF zr@HP{HA@BSuAO?fw709vRPUVbWA`gzxpx$+$M@n*$-9;}gzV@&5clOswou~2<4e_q oatq=%Pwi0GHhnIwaQFYliK`vY%=z<^fq{X+)78&qol`;+0CuH|#{d8T literal 0 HcmV?d00001 diff --git a/compile/html/tab_a.png b/compile/html/tab_a.png new file mode 100644 index 0000000000000000000000000000000000000000..e8735967b7599cb669b45756d6388b19e60e14eb GIT binary patch literal 134 zcmeAS@N?(olHy`uVBq!ia0y~yU|?imU{K*;Vqjo6E_OVcfq}u-)5S5Qg7NL#i@XgE zJWkQK)Wje6pL_7nm@DqB#FInZs&}}ig)^}Slq;TVn0{ErykbJ{ndeug=l6YGQ~STV psPx6*SKo3Ys`uLO{>#2uJS~h-_`|UW;S3B644$rjF6*2UngA1cGGzb& literal 0 HcmV?d00001 diff --git a/compile/html/tab_b.png b/compile/html/tab_b.png new file mode 100644 index 0000000000000000000000000000000000000000..286ebf50dc35349171e0a0628000b167133ab782 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0y~yU|?imU{K*;Vqjo6E_OVcfq|jU)5S5Qg7NL#jl72p zL|EU}mpM+?s&(_2DLN@)TFefQE|bg&0<2{{5}j9PFg0gHJbGDDW!_q~Z{DR_VN#bj z*q3eleJm<$+9m;S6}gE8EKYns-h4dyc++9k<8#uM-99qIEzs*?e3hWC(yC9!v-YQL p5nTQDy1ZZMSK}D=UB%zosxFARXT1M#oq>UY!PC{xWt~$(69A#4NX`HN literal 0 HcmV?d00001 diff --git a/compile/html/tab_h.png b/compile/html/tab_h.png new file mode 100644 index 0000000000000000000000000000000000000000..0969c531eabf97f00954ff17d9ab1d451aef8255 GIT binary patch literal 177 zcmeAS@N?(olHy`uVBq!ia0y~yU|?imU{K*;Vqjo6E_OVcfq|jI)5S5Qg7NL$vz&(w z1Y90o?PEH~{`wK$AN74*VZl}DN8OZlv%8*Z=k)%) j9UC0DKWj((Z^lQN{7%*>f@>HU7#KWV{an^LB{Ts5{#iw8 literal 0 HcmV?d00001 diff --git a/compile/html/tab_s.png b/compile/html/tab_s.png new file mode 100644 index 0000000000000000000000000000000000000000..4961893d5483abb549745111419aa97fbb4779b0 GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0y~yU|?imU{K*;Vqjo6E_OVcfq|jf)5S5Qg7NKLN3JFZ z35SRCE5!rSW;i;!2nd!q@CR<`;)uGUl(BeO*@JgMfnMxCD?a!s-rc;oc8f`I^L(4S zZ&!kSO+%+7dm4&8`Cc=XSMueANnbbva?Sh3*lv!p!;I5r7{v__Bn*{>{1B0ilpUXO@geCx_{Ypy! literal 0 HcmV?d00001 diff --git a/compile/html/tabs.css b/compile/html/tabs.css new file mode 100644 index 0000000..85a0cd5 --- /dev/null +++ b/compile/html/tabs.css @@ -0,0 +1 @@ +.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace!important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0!important;-webkit-border-radius:0;border-radius:0!important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px!important;-webkit-border-radius:5px;border-radius:5px!important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0!important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px!important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} \ No newline at end of file diff --git a/documentation/api.groovy b/documentation/api.groovy new file mode 100644 index 0000000..fafd4f2 --- /dev/null +++ b/documentation/api.groovy @@ -0,0 +1,121 @@ +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/inksystem.git' + SOURCEREVISION = "${SOURCE_REVISION}".trim() + SOURCEDIR = "${WORKSPACE}/inksystem" + SOURCEROOTDIR = 'inksystem' + configurationhelper.gitCheckoutAndRegister(meta, 'inksystem', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) + env.SOURCE_PATH = SOURCEDIR + } + } + } + stage('Clean exports') { + steps { + script { + env.API_DOCS = "api_docs" + cleanfolders = [ + API_DOCS, + ] + 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('Copy api docs') { + steps { + script { + dir("${SOURCEDIR}/documents/api/public") { + fileOperations([fileCopyOperation(targetLocation: "${WORKSPACE}/${API_DOCS}", includes: '*.docx,*.pptx')]) + } + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + "${API_DOCS}/**", + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + "${API_DOCS}/**", + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["${API_DOCS}/**"]) + 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..4c0b6f2 --- /dev/null +++ b/documentation/release_note.groovy @@ -0,0 +1,120 @@ +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" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = SOURCE_REPO.trim() + SOURCEREVISION = "${SOURCE_REVISION}".trim() + ESWDIR = 'esw' + SOURCEDIR = "${WORKSPACE}/${ESWDIR}" + configurationhelper.gitCheckoutAndRegister(meta, ESWDIR, SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + hs = SOURCEDIR + } + } + } + stage('Clean exports') { + steps { + script { + env.RELEASE_NOTES = "release_notes" + cleanfolders = [ + RELEASE_NOTES, + ] + 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, SOURCEDIR) + } + } + } + stage('Copy release notes') { + steps { + script { + dir("${hs}/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/mark/core.groovy b/mark/core.groovy new file mode 100644 index 0000000..abd1ec0 --- /dev/null +++ b/mark/core.groovy @@ -0,0 +1,94 @@ +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() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + } + } + } + stage('Checkout source') { + steps { + script { + ESWDIR = 'esw' + SOURCEURL = "git@hydra:core-presto/core-presto-embedded-software-subtree.git" + SOURCEREVISION = SOURCE_REVISION.trim() + SOURCENAME = 'core' + hs = "${ESWDIR}/${SOURCENAME}" + configurationhelper.gitCheckoutAndRegister(meta, SOURCENAME, SOURCEURL, SOURCEREVISION, hs, '', 0, false) + env.SOURCE_PATH = hs + } + } + } + stage('Clean exports') { + steps { + script { + cleanfolders = [ + ] + 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('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 artifacts = [] + def artifactlist = meta.generateartifacts(artifacts) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/packaging/build.groovy b/packaging/build.groovy new file mode 100644 index 0000000..2743be0 --- /dev/null +++ b/packaging/build.groovy @@ -0,0 +1,315 @@ +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() + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + 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) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = SOURCE_REPO.trim() + SOURCEREVISION = SOURCE_REVISION.trim() + SOURCEDIR = "${WORKSPACE}/ahb-km-1024a-embedded-software" + configurationhelper.gitCheckoutAndRegister(meta, 'ahb-km-1024a-embedded-software', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = SOURCEDIR + PROD_SPECIFIC_SOURCE = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + versioninfo = "${WORKSPACE}/versioninfo" + packaging = "packaging" + packageout = "package" + uniquepackageout = "uniquepackage" + BOOTLOADERDEST = "${WORKSPACE}/boot" + KERNELDEST = "${WORKSPACE}/kernel" + env.BA4_LOGICDEST = "${WORKSPACE}/ba4_logic" + env.BA6_LOGICDEST = "${WORKSPACE}/ba6_logic" + env.FC5_LOGICDEST = "${WORKSPACE}/fc5_logic" + env.STM8_ARTIFACTS_DIR = "${WORKSPACE}/stm8" + CONTROL_PACKAGE = "${WORKSPACE}/control_package" + cleanfolders = [ + "${WORKSPACE}/esw", + BA4_LOGICDEST, + BA6_LOGICDEST, + FC5_LOGICDEST, + STM8_ARTIFACTS_DIR, + BOOTLOADERDEST, + KERNELDEST, + CONTROL_PACKAGE, + versioninfo, + packaging, + packageout, + uniquepackageout, + ] + 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('Copying bootloader artifacts') { + steps { + script { + bootloadermeta = importer.artifactimport(meta, BOOTLOADER_ARTIFACT_JOB, BOOTLOADER_ARTIFACT_JOB_SELECTOR, BOOTLOADERDEST) + } + } + } + stage('Copying Linux kernel artifacts') { + steps { + script { + kernelmeta = importer.artifactimport(meta, KERNEL_ARTIFACT_JOB, KERNEL_ARTIFACT_JOB_SELECTOR, KERNELDEST) + } + } + } + stage('Copying logic artifacts') { + steps { + script { + def ba4logicoptions = importer.getNewImportOptions() + ba4logicoptions.source(BA4_LOGIC_ARTIFACT_LOCATION, BA4_LOGIC_ARTIFACT_PROJECT, BA4_LOGIC_ARTIFACT_BUILD_SELECTOR, BA4_LOGIC_ARTIFACT_RELEASE_REPO, BA4_LOGIC_ARTIFACT_RELEASE_REVISION) + ba4logicmeta = importer.artifactimport(meta, ba4logicoptions, BA4_LOGICDEST) + + def ba6logicoptions = importer.getNewImportOptions() + ba6logicoptions.source(BA6_LOGIC_ARTIFACT_LOCATION, BA6_LOGIC_ARTIFACT_PROJECT, BA6_LOGIC_ARTIFACT_BUILD_SELECTOR, BA6_LOGIC_ARTIFACT_RELEASE_REPO, BA6_LOGIC_ARTIFACT_RELEASE_REVISION) + ba6logicmeta = importer.artifactimport(meta, ba6logicoptions, BA6_LOGICDEST) + + def fc5logicoptions = importer.getNewImportOptions() + fc5logicoptions.source(FC5_LOGIC_ARTIFACT_LOCATION, FC5_LOGIC_ARTIFACT_PROJECT, FC5_LOGIC_ARTIFACT_BUILD_SELECTOR, FC5_LOGIC_ARTIFACT_RELEASE_REPO, FC5_LOGIC_ARTIFACT_RELEASE_REVISION) + fc5logicmeta = importer.artifactimport(meta, fc5logicoptions, FC5_LOGICDEST) + } + } + } + stage('Copying STM8 artifacts') { + steps { + script { + stm8meta = importer.artifactimport(meta, STM8_BUILD_JOB, STM8_BUILD_SELECTOR, STM8_ARTIFACTS_DIR) + } + } + } + stage('Copying embedded software artifacts') { + steps { + script { + ESW = "${WORKSPACE}/esw" + eswmeta = importer.artifactimport(meta, ESW_ARTIFACT_JOB, ESW_ARTIFACT_JOB_SELECTOR, ESW) + ESWEXPORT = "${ESW}/export" + ESWEXPORTTGZ = "${ESW}/export.tgz" + ESWEXPORTEXPANDED = "${ESW}/expanded" + dir(ESWEXPORTEXPANDED) { + if (isUnix()) { + sh """#!/bin/bash + # Exit if any command fails + set -e + + tar zxvf "${ESWEXPORTTGZ}" + """ + } else { + error "This job does not support Windows at the moment" + } + } + ESWEXPORTEXPANDED_FOLDER = "${ESWEXPORTEXPANDED}/export" + } + } + } + stage('Copying control package artifacts') { + steps { + script { + controlpackagemeta = importer.artifactimport(meta, CONTROL_PACKAGE_CREATE_JOB, CONTROL_PACKAGE_CREATE_JOB_SELECTOR, CONTROL_PACKAGE) + } + } + } + stage('Generate version info folder for image') { + steps { + script { + def metamap = [ + [ "${versioninfo}/ba4logic", ba4logicmeta ], + [ "${versioninfo}/ba6logic", ba6logicmeta ], + [ "${versioninfo}/fc5logic", fc5logicmeta ], + [ "${versioninfo}/stm8meta", stm8meta ], + [ "${versioninfo}/bootloader", bootloadermeta ], + [ "${versioninfo}/kernel", kernelmeta ], + [ "${versioninfo}/esw", eswmeta ], + [ "${versioninfo}/control_package", controlpackagemeta ], + [ "${versioninfo}/app_package", meta ], // Incomplete until this job ends + ] + for (metaitem in metamap) { + (destfolder, componentmeta) = metaitem + dir(destfolder) { + componentmeta.saveJsonSerialised("meta.json") + } + } + } + } + } + stage('Create common definitions') { + steps { + script { + PASSWORD = "ramshorn42" + + debianpackage = load("${autobuilder.commonscripts()}/packaging/debian.groovy") + } + } + } + stage('Create ESW and EL definitions') { + steps { + script { + def ESW_EL_PACKAGE_NAME = 'gis-ahb-km-1024a-esw-el' + esw_el_debroot = debianpackage.debDefinition(packaging, PROD_SPECIFIC_SOURCE, ESW_EL_PACKAGE_NAME, meta.releasetagfordebpackage()) + } + } + } + stage('Version stamp ESW and EL package file') { + steps { + script { + convertdetails = [ + // File to convert Pattern to replace New string + [ "${PROD_SPECIFIC_SOURCE}/${esw_el_debroot.PACKAGE_SOURCE_FOLDER_NAME}/DEBIAN/control", "0.30000.0.0", meta.releasetagfordebpackage() ], + [ "${PROD_SPECIFIC_SOURCE}/${esw_el_debroot.PACKAGE_SOURCE_FOLDER_NAME}/DEBIAN/control", "0.30001.0.0", controlpackagemeta.releasetagfordebpackage() ], + ] + versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy") + versionnumbering.stamp(convertdetails) + } + } + } + stage('Create ESW and EL package') { + steps { + script { + gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + + sh """#!/bin/bash + # Exit if any command fails + set -e + + echo "${PASSWORD}" | sudo -S echo + + mkdir -v -p "${esw_el_debroot.ETC}" + cp -v -r "${PROD_SPECIFIC_SOURCE}/boardetc/app"/* "${esw_el_debroot.ETC}" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_BIN}" + cp -v --no-dereference --preserve=links "${ESWEXPORTEXPANDED_FOLDER}/Release/bin"/* "${esw_el_debroot.GIS_OPT_BIN}" + chmod -v -R u+x "${esw_el_debroot.GIS_OPT_BIN}" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_LIB}" + cp -v -r --no-dereference --preserve=links "${ESWEXPORTEXPANDED_FOLDER}/Release/lib"/* "${esw_el_debroot.GIS_OPT_LIB}" + cp -v -r "${PROD_SPECIFIC_SOURCE}/boardlib/app"/* "${esw_el_debroot.GIS_OPT_LIB}" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_SCRIPTS_APP}" + cp -v -r "${PROD_SPECIFIC_SOURCE}/boardscripts/scripts/app"/* "${esw_el_debroot.GIS_OPT_SCRIPTS_APP}" + chmod -v -R u+x "${esw_el_debroot.GIS_OPT_SCRIPTS_APP}" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_WWW}" + cp -v -r "${PROD_SPECIFIC_SOURCE}/devjsclient" "${esw_el_debroot.GIS_OPT_WWW}" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_OTHER}" + cp -v -r "${versioninfo}" "${esw_el_debroot.GIS_OPT_OTHER}" + + mkdir -v -p "${esw_el_debroot.LIB_FIRMWARE}" + mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/ba4" + cp -v "${BA4_LOGICDEST}/embedded_logic/top_encrypted.rbf" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/ba4/logic.rbf" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/ba6" + cp -v "${BA6_LOGICDEST}/embedded_logic/top_encrypted.rbf" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/ba6/logic.rbf" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/fc5" + cp -v "${FC5_LOGICDEST}/embedded_logic/top_encrypted.rbf" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/fc5/logic.rbf" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/hmbdg/fpga/any" + cp -v "${BA4_LOGICDEST}/embedded_logic/hmb_fpga_top.rbf" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/hmbdg/fpga/any/logic.rbf" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/ahb/fpga/any" + cp -v "${BA4_LOGICDEST}/embedded_logic/ahb_fpga_top.jbc" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/ahb/fpga/any/logic.jbc" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/any/stm8/any" + cp -v "${STM8_ARTIFACTS_DIR}/bin"/* "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/any/stm8/any" + + mkdir -v -p "${esw_el_debroot.GIS_OPT_KERNEL}" + cp -v "${KERNELDEST}/bin/zImage" "${esw_el_debroot.GIS_OPT_KERNEL}" + """ + debianpackage.buildPackage(packageout, uniquepackageout, esw_el_debroot, PASSWORD) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + "${packageout}/**", + "${uniquepackageout}/**", + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + "${packageout}/**", + "${uniquepackageout}/**", + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["${packageout}/**","${uniquepackageout}/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/packaging/buildcontrol.groovy b/packaging/buildcontrol.groovy new file mode 100644 index 0000000..c068ed2 --- /dev/null +++ b/packaging/buildcontrol.groovy @@ -0,0 +1,169 @@ +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" + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEURL = SOURCE_REPO.trim() + SOURCEREVISION = SOURCE_REVISION.trim() + SOURCEDIR = "${WORKSPACE}/ahb-km-1024a-embedded-software" + configurationhelper.gitCheckoutAndRegister(meta, 'ahb-km-1024a-embedded-software', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = SOURCEDIR + PROD_SPECIFIC_SOURCE = SOURCE_PATH + } + } + } + stage('Clean exports') { + steps { + script { + packaging = "packaging" + packageout = "package" + uniquepackageout = "uniquepackage" + cleanfolders = [ + packaging, + packageout, + uniquepackageout, + ] + 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('Create common definitions') { + steps { + script { + PASSWORD = "ramshorn42" + + debianpackage = load("${autobuilder.commonscripts()}/packaging/debian.groovy") + } + } + } + stage('Create control service definitions') { + steps { + script { + def CONTROL_SERVICE_PACKAGE_NAME = 'gis-ahb-km-1024a-control-service' + control_service_debroot = debianpackage.debDefinition(packaging, PROD_SPECIFIC_SOURCE, CONTROL_SERVICE_PACKAGE_NAME, meta.releasetagfordebpackage()) + } + } + } + stage('Version stamp control service files') { + steps { + script { + convertdetails = [ + // File to convert Pattern to replace New string + [ "${PROD_SPECIFIC_SOURCE}/${control_service_debroot.PACKAGE_SOURCE_FOLDER_NAME}/DEBIAN/control", "0.30000.0.0", meta.releasetagfordebpackage() ], + ] + versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy") + versionnumbering.stamp(convertdetails) + } + } + } + stage('Create control service package') { + steps { + script { + sh """#!/bin/bash + # Exit if any command fails + set -e + + echo "${PASSWORD}" | sudo -S echo + + # mkdir -v -p "${control_service_debroot.ETC}" + # cp -v -r "${PROD_SPECIFIC_SOURCE}/boardetc/control"/* "${control_service_debroot.ETC}" + + mkdir -v -p "${control_service_debroot.GIS_OPT_LIB}" + cp -v -r "${PROD_SPECIFIC_SOURCE}/boardlib/control"/* "${control_service_debroot.GIS_OPT_LIB}" + + mkdir -v -p "${control_service_debroot.GIS_OPT_SCRIPTS_CONTROL}" + cp -v -r "${PROD_SPECIFIC_SOURCE}/boardscripts/scripts/control"/* "${control_service_debroot.GIS_OPT_SCRIPTS_CONTROL}" + chmod -v -R u+x "${control_service_debroot.GIS_OPT_SCRIPTS_CONTROL}" + """ + debianpackage.buildPackage(packageout, uniquepackageout, control_service_debroot, PASSWORD) + } + } + } + stage('Checksum artifacts') { + steps { + script { + def checksummable = [ + "${packageout}/**", + "${uniquepackageout}/**", + ] + checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") + checksumutils.generatelist(meta, checksummable) + } + } + } + stage('Classifying publishable artifacts') { + steps { + script { + def publishable = [ + "${packageout}/**", + "${uniquepackageout}/**", + ] + publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") + publishutils.generatelist(meta, publishable) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["${packageout}/**","${uniquepackageout}/**"]) + 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..bac8b00 --- /dev/null +++ b/static_analysis/static_analysis.groovy @@ -0,0 +1,104 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + } + } + } + stage('Checkout source') { + steps { + script { + SOURCEREVISION = "${SOURCE_REVISION}" + SOURCEDIR = "${WORKSPACE}\\source" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) + SOURCE_PATH = "${SOURCEDIR}" + } + } + } + stage('Generating version info') { + steps { + script { + version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") + version.generate(meta, SOURCE_REVISION, SOURCE_PATH) + } + } + } + stage('Print server static analysis') { + parallel { + stage('Measure Print Server code complexity') { + steps { + script { + build job: CCM_ANALYSIS_JOB, + parameters: [ + string(name: 'SOURCEURL', value: SOURCEURL), + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'SOURCE_OFFSET_PATH', value: SOURCE_OFFSET_PATH), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('Perform Print Server C++ static analysis') { + steps { + script { + build job: CPPCHECK_ANALYSIS_JOB, + parameters: [ + string(name: 'SOURCEURL', value: SOURCEURL), + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'SOURCE_OFFSET_PATH', value: SOURCE_OFFSET_PATH), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + stage('Perform Print Server DRY static analysis') { + steps { + script { + build job: CPD_ANALYSIS_JOB, + parameters: [ + string(name: 'SOURCEURL', value: SOURCEURL), + string(name: 'SOURCE_REVISION', value: SOURCEREVISION), + string(name: 'SOURCE_OFFSET_PATH', value: SOURCE_OFFSET_PATH), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + ArrayList itemsForRelease = [] + 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/subtrees.txt b/subtrees.txt new file mode 100644 index 0000000..fbf1dfa --- /dev/null +++ b/subtrees.txt @@ -0,0 +1,2 @@ +Local folder: Remote repo: Revision: +Common_scripts git@hydra:jenkinsautobuild/Common_scripts.git (push) master diff --git a/test/main.groovy b/test/main.groovy new file mode 100644 index 0000000..c120e8f --- /dev/null +++ b/test/main.groovy @@ -0,0 +1,260 @@ +pipeline { + agent { label "${AGENT_LABEL}"} + stages { + stage ("STAGE: Initial Setup") { + steps{ + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild( + this, + PRODUCT_NAME, + SUBCOMPONENT_NAME, + RELEASE_REPO + ) + } + } + } + stage ("STAGE: Checkout dependencies") { + steps { + script{ + echo "BUILDSTEP: Creating configuration helper" + configurationhelper = autobuilder.configurationhelper() + + echo "BUILDSTEP: Checking out test content repository" + TEST_SOURCE_URL = "git@hydra:hmb_regression/hmb_fd_hv_tests.git" + TEST_SOURCE_REVISION = "${TEST_SOURCE_REVISION}" + TEST_SOURCE_DIR = "${WORKSPACE}/TestSuite" + + echo "url: ${TEST_SOURCE_URL}/nrevision: ${TEST_SOURCE_REVISION}/ndirectory: ${TEST_SOURCE_DIR}" + configurationhelper.gitCheckoutAndRegister( + meta, + "run_test", + TEST_SOURCE_URL, + TEST_SOURCE_REVISION, + TEST_SOURCE_DIR + ) + echo "BUILDSTEP: Checking out test content repository" + RESULT_SOURCE_URL = "git@hydra:gistestresults/ahb_km_1024a_results.git" + RESULT_SOURCE_REVISION = "origin/master" + RESULT_SOURCE_DIR = "${WORKSPACE}/${HISTORY_FOLDER}" + echo "url: ${TEST_SOURCE_URL}/nrevision: ${RESULT_SOURCE_REVISION}/ndirectory: ${RESULT_SOURCE_DIR}" + configurationhelper.gitCheckoutAndRegister( + meta, + "TestResults", + RESULT_SOURCE_URL, + RESULT_SOURCE_REVISION, + RESULT_SOURCE_DIR, + "", + 0, + false + ) + + echo "BUILDSTEP: checking out core test repository" + CORE_SOURCE_URL = "git@hydra:gistest/giscorelite.git" + CORE_SOURCE_REVISION = "${CORE_SOURCE_REVISION}" + CORE_SOURCE_DIR = "${WORKSPACE}/GisCore" + + echo "url: ${CORE_SOURCE_URL}/nrevision: ${CORE_SOURCE_REVISION}/ndirectory: ${CORE_SOURCE_DIR}" + configurationhelper.gitCheckoutAndRegister( + meta, + "run_test", + CORE_SOURCE_URL, + CORE_SOURCE_REVISION, + CORE_SOURCE_DIR + ) + + echo "BUILDSTEP: Checking out FTDI Relay control tools." + FTDI_SOURCE_URL = "git@hydra:python_scripts/ftdi_relay.git" + FTDI_SOURCE_REVISION = "origin/Core-98" + FTDI_SOURCE_DIR = "${WORKSPACE}/PowerController" + configurationhelper.gitCheckoutAndRegister( + meta, + "run_test", + FTDI_SOURCE_URL, + FTDI_SOURCE_REVISION, + FTDI_SOURCE_DIR + ) + } + } + } + stage ("STAGE: Force clean artifacts"){ + steps { + script{ + bat """ + set TEST_SOURCE_DIR=%WORKSPACE%/TestSuite + set GIS_TEST_OUTPUT_LOGGING_ROOT=%WORKSPACE%/%LOG_FOLDER% + echo "Using Python script to make sure the import and logging folders are clean." + echo "Logging Folder = %GIS_TEST_OUTPUT_LOGGING_ROOT%" + %python3% "${TEST_SOURCE_DIR}/autobuild/cleanEnvironment.py" + """ + } + } + } + stage("Copy artifacts") { + steps { + script{ + POWER_CONTROL_HOME = "${WORKSPACE}/PowerController" + POWER_CONTROL_DEVICE = "${FTDI_RELAY_DEVICE_KM1024A}" + POWER_CYCLE_HARDWARE = "${POWER_CYCLE_HARDWARE}" + echo "DEBUG: POWER_CYCLE_HARDWARE is ${POWER_CYCLE_HARDWARE}" + if (POWER_CYCLE_HARDWARE == "true"){ + bat """ + pushd ${POWER_CONTROL_HOME} + + ${python3} ${POWER_CONTROL_HOME}/RegressionPower.py -d ${POWER_CONTROL_DEVICE} -o True + + popd + + if %errorlevel% neq 0 ( exit /b 1) + exit /b 0 + """ + } + else{ + echo "DEBUG: Skipping Power Cycle update" + } + } + } + } + stage("STAGE: Copy artifacts") { + + steps { + script { + UPDATE_HARDWARE = "${UPDATE_HARDWARE}" + if (UPDATE_HARDWARE == "true" ){ + echo "BUILDSTEP: Take the artifacts from the selected build job." + APPLICATION_ARTIFACT_PROJECT = "${APPLICATION_ARTIFACT_PROJECT}" + APPLICATION_ARTIFACT_FOLDER = "${WORKSPACE}/hmbbuild" + APPLICATION_ARTIFACT_SELECTOR = "${APPLICATION_ARTIFACT_SELECTOR}" + APPLICATION_ARTIFACT_FILTER = "app_package/**,control_package/**" + + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + APPLICATION = importer.artifactimport(meta, APPLICATION_ARTIFACT_PROJECT, APPLICATION_ARTIFACT_SELECTOR, APPLICATION_ARTIFACT_FOLDER, true, APPLICATION_ARTIFACT_FILTER) + echo "BUILDSTEP: Copied Control and App packages" + + } + else{ + echo "DEBUG: Skipping Copy Artifaces" + } + } + } + } + stage("STAGE: Update target hardware") { + steps { + script { + if (UPDATE_HARDWARE == "true" ){ + PACKAGE_FOLDER = "${WORKSPACE}/hmbbuild" + HMB_ADDRESS = "${HMB_KM_1024A_IP}" + GIS_TEST_SUITE_CORE = "${WORKSPACE}/GisCore" + bat """ + echo "TODO: Determine the hardeware to target" + + echo "pushd ${GIS_TEST_SUITE_CORE}" + pushd "${GIS_TEST_SUITE_CORE}" + + echo "Updating ESW only" + ${python3} "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbPackageDeployer.py" -p "${PACKAGE_FOLDER}" -t "${HMB_ADDRESS}" + echo "Exiting from ${GIS_TEST_SUITE_CORE}" + + popd + ) + if %errorlevel% neq 0 ( exit /b 1) + exit /b 0 + """ + } + else{ + echo "DEBUG: Skipping remote update" + } + } + } + } + stage ("Inspect hardware state") { + + steps{ + script{ + if (UPDATE_HARDWARE == "true" ){ + echo "Inspecting the state of the hardware" + rc =bat (script:""" + set GIS_TEST_SUITE_CORE="${WORKSPACE}/TestSuite/GisCore" + ${python3} "${WORKSPACE}/TestSuite/GisCore/HMBCommon/hmbinspectstate.py" + if %errorlevel% neq 0 ( + echo "ERROR: Unable to detect hardware" + exit /b 1 + ) + """, + returnStatus: true) + if (rc == 1){ + currentBuild.result = 'UNSTABLE' + } + } + else{ + echo "DEBUG: Skipping Inspect Hardware State" + } + } + } + } + stage("STAGE: Run tests"){ + steps{ + script{ + if (DO_TEST == "true" ){ + GIS_TEST_SUITE_CORE = "${WORKSPACE}/GisCore" + rc =bat (script:""" + set TestFail=0 + set GIS_TEST_SUITE_CORE="${WORKSPACE}/GisCore" + set GIS_TEST_SUITE_HOME="${WORKSPACE}/TestSuite" + set GIS_TEST_OUTPUT_LOGGING_ROOT="${WORKSPACE}/%LOG_FOLDER%" + ${python3} "${GIS_TEST_SUITE_CORE}/GISTestMaster.py" -w --hmbkm1024a INSTALLED -fl --include ${TEST_INCLUDE_FILTER} + if %errorlevel% neq 0 (set TestFail=1) + echo "TODO: Do some history or sorting stuff at this point" + if %TestFail% neq 0 ( + exit /b 1 + ) + """, + returnStatus: true + ) + if (rc == 1){ + currentBuild.result = 'UNSTABLE' + } + } + } + } + } + + stage("STAGE: Archive Test History"){ + steps{ + script{ + rc =bat (script:""" + set HistoryFail=0 + pushd %HISTORY_FOLDER% + %python3% 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{ + if (UPDATE_HARDWARE == "true" ){ + def artifactlist = meta.generateartifacts(["TestSuite/**","${PACKAGE_FOLDER}/meta/**","${LOG_FOLDER}/**"]) + archiveArtifacts "${artifactlist}" + } + else{ + def artifactlist = meta.generateartifacts(["TestSuite/**","/meta/**","${LOG_FOLDER}/**"]) + archiveArtifacts "${artifactlist}" + } + } + } + } + } +} + + + From 6f51ee81e9caedff6103c051214bc9be29f6b92e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 8 Aug 2021 08:11:30 +0100 Subject: [PATCH 1491/1971] Remove Common_scripts as this is going to be replaced by a subtree --- Common_scripts/.project | 17 - Common_scripts/.pydevproject | 8 - .../org.eclipse.core.resources.prefs | 2 - Common_scripts/artifacts/metaexport.groovy | 22 - Common_scripts/autobuilder.groovy | 131 --- Common_scripts/check/build_meta.groovy | 86 -- Common_scripts/check/do_meta.groovy | 77 -- Common_scripts/checksum/utils.groovy | 15 - Common_scripts/clean/clean.groovy | 10 - Common_scripts/commandline/commandline.groovy | 12 - .../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 | 64 -- Common_scripts/differences/.project | 17 - Common_scripts/differences/.pydevproject | 8 - .../differences/dometahierarchy.groovy | 836 ------------------ Common_scripts/differences/file.groovy | 23 - Common_scripts/differences/json.groovy | 51 -- .../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 | 793 ----------------- Common_scripts/packaging/debian.groovy | 107 --- 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 | 442 --------- 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 | 377 -------- 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, 6155 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 a8d418d..0000000 --- a/Common_scripts/autobuilder.groovy +++ /dev/null @@ -1,131 +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 -} - -def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { - def String altered = releaserepo.trim() - - if (releaserepovariantsuffix?.trim()) { - altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", releaserepovariantsuffix) - } - return altered -} - -// Start up boilerplate -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 - 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, 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, productvariant) - - echo "Release repo: ${alteredreleaserepo}" - rr.registerrepo(meta, alteredreleaserepo) - - def ch = load("${commonscripts()}/configuration/configuration.groovy") - ch.registerPipelineScriptConfiguration(meta) - - return meta -} - -// DEPRECATED Metod, Use StartBuild Instead. -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 be7569d..0000000 --- a/Common_scripts/checksum/utils.groovy +++ /dev/null @@ -1,15 +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) { - echo "Checksumming: ${file.path}" - 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 38f80fa..0000000 --- a/Common_scripts/commandline/commandline.groovy +++ /dev/null @@ -1,12 +0,0 @@ -String getCommandOutput(String cmd) { - if (isUnix()) { - return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim() - } else { - return powershell(returnStdout: true, script: """ - ${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 7ae0fe1..0000000 --- a/Common_scripts/copy/logic.groovy +++ /dev/null @@ -1,64 +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 { - 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) - } - } - } - 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 aa4814a..0000000 --- a/Common_scripts/differences/file.groovy +++ /dev/null @@ -1,23 +0,0 @@ -def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { - def wsparameter = "-w" - if (!ignorewhitespace) { - wsparameter = "" - } - if (isUnix()) { - sh """ - diff -c ${wsparameter} "${importedfile}" "${currentfile}" - """ - } - else { - // diffutils can be installed on windows with chocolatey - powershell """ - # echo Checking utilities exist - # where diff - # if errorlevel 1 EXIT /b 1 - - diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}" - """ - } -} - -return this; diff --git a/Common_scripts/differences/json.groovy b/Common_scripts/differences/json.groovy deleted file mode 100644 index 0556188..0000000 --- a/Common_scripts/differences/json.groovy +++ /dev/null @@ -1,51 +0,0 @@ -def comparefiles(importedjsonfile, currentjsonfile) { - echo "Comparing file: ${importedjsonfile} with: ${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 { - // Jq and diffutils can be installed on windows with chocolatey - powershell """ - # echo Checking utilities exist - # set - # echo %PATH% - try { - if (Get-Command jq) {} - } - catch { - echo "jq is unavailable" - exit \$false - } - try { - if (Get-Command diff) {} - } - catch { - echo "diff is unavailable" - exit \$false - } - - # echo Sorting json in files to compare - # jq -S sorts json output - jq -S . "${importedjsonfile}" > temp1.txt - if (\$lastexitcode -ge 1) { exit 1 } - jq -S . "${currentjsonfile}" > temp2.txt - if (\$lastexitcode -ge 1) { exit 1 } - - # echo Diffing sorted json files - diff.exe -c temp1.txt temp2.txt - \$lec = \$lastexitcode - - Remove-Item temp1.txt - Remove-Item temp2.txt - - if (\$lec -ge 1) { exit 1 } - """ - } -} - -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 704bfc8..0000000 --- a/Common_scripts/meta/folder.groovy +++ /dev/null @@ -1,793 +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 - String variant - - ProductInfo(script, productname = "", subcomponentname = "", variant = "") { - super(script) - this.productname = productname - this.subcomponentname = subcomponentname - this.variant = variant - } - - 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()) { - pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) - } - else { - pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" 2>&1>\$null", , 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.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" 2>&1>\$null", , 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") - } - if (variant) { - def int vstatus = 0 - if (script.isUnix()) { - vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) - } - else { - vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" 2>&1>\$null", , returnStatus: true) - } - if (vstatus > 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 - } -} - -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 - } - - void set(BuildStampInfo other) { - set(other.buildstampprefix, other.revision, other.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 65d3731..0000000 --- a/Common_scripts/packaging/debian.groovy +++ /dev/null @@ -1,107 +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_KERNEL - 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, String inpackagepathsuffix) { - 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" + inpackagepathsuffix - GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + inpackagepathsuffix - GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + inpackagepathsuffix - GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + inpackagepathsuffix - GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + inpackagepathsuffix - GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" + inpackagepathsuffix - GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + inpackagepathsuffix - GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + inpackagepathsuffix - GIS_OPT_KERNEL = "${DEBPATH}/opt/gis/kernel" + inpackagepathsuffix - GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + inpackagepathsuffix - GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + inpackagepathsuffix - - USR_BIN = "${DEBPATH}/usr/bin" + inpackagepathsuffix - USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + inpackagepathsuffix - LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + inpackagepathsuffix - HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + inpackagepathsuffix - LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + inpackagepathsuffix - } -} - -def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') { - return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) -} - -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 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 9148572..0000000 --- a/Common_scripts/release/do.groovy +++ /dev/null @@ -1,442 +0,0 @@ -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - -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 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}" - - 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 4220f3b..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.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( - 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 5bcb0ba..0000000 --- a/Common_scripts/versioncontrol/git.groovy +++ /dev/null @@ -1,377 +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 = powershell(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 { - powershell """ - git status - if (\$lastexitcode -ge 1) { exit 1 } - """ - } - } -*/ - } - } - return reporootsubfolder -} - -def checkgitlfsinstall() { - if (isUnix()) { - sh """ - git lfs install - if [ \$? -ne 0 ]; then exit 1; fi - """ - - } else { - powershell """ - git lfs install - if (\$lastexitcode -ge 1) { exit 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) { - echo "Git: Checking out: URL: ${gitURL} Revision: ${revision} to: ${targetDir}" - 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 { - powershell """ - 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 { - powershell """ - 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 { - powershell """ - 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 = powershell( 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 208a60f..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 { - powershell """ - & "${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 405b7be..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 = powershell(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 = powershell(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 = powershell(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 = powershell(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 9243aa4..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 instances 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 26d4aa2ff8f9f84463706d883d45662ee2358bfc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 8 Sep 2021 13:24:09 +0100 Subject: [PATCH 1492/1971] Correct powershell redirection to null --- versioncontrol/git.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 9a72e9d..50f4025 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -265,9 +265,9 @@ def gitsparserestore(String targetDir) { """ } else { powershell """ - git rm -rf . 2> nul - git clean -fxd 2> nul - git reset --hard 2> nul + git rm -rf . > \$null + git clean -fxd > \$null + git reset --hard > \$null """ } } From 676122557aadf45c3e6d1b314b00df1e03edd8aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 10 Sep 2021 16:18:26 +0100 Subject: [PATCH 1493/1971] Show which files are being compared --- differences/file.groovy | 1 + differences/json.groovy | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/differences/file.groovy b/differences/file.groovy index aa4814a..ee1b8b3 100644 --- a/differences/file.groovy +++ b/differences/file.groovy @@ -1,4 +1,5 @@ def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { + echo "Comparing file: ${importedfile} with: ${currentfile} option: ${ignorewhitespace}" def wsparameter = "-w" if (!ignorewhitespace) { wsparameter = "" diff --git a/differences/json.groovy b/differences/json.groovy index 0556188..dbf47b8 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -1,5 +1,5 @@ def comparefiles(importedjsonfile, currentjsonfile) { - echo "Comparing file: ${importedjsonfile} with: ${currentjsonfile}" + echo "Comparing json file: ${importedjsonfile} with: ${currentjsonfile}" if (isUnix()) { sh """ which jq From fa5a9493efdc83a42d1dfbcb37b07713aac04fa1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 16 Sep 2021 16:01:32 +0100 Subject: [PATCH 1494/1971] Handle misspelling --- publish/promptingpublish.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 4af0d62..21de708 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -62,6 +62,7 @@ pipeline { echo("Showing filtered releases") for (release in allreleases) { if (!release.toLowerCase().startsWith("superceded") && + !release.toLowerCase().startsWith("superseded") && !release.toLowerCase().startsWith("erroneous") && !release.toLowerCase().startsWith("faulty") && !release.toLowerCase().startsWith("ignore") && From 13b84aa6d36c8097c5e70b94206c5e1434caf3f0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 11 Oct 2021 21:33:50 +0100 Subject: [PATCH 1495/1971] Import bootloader binaries into app package --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 65d3731..c0a4dbb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -20,6 +20,7 @@ class DebRootDefinition { String GIS_OPT_KERNEL String GIS_OPT_LOGIC String GIS_OPT_PRINTHEAD + String GIS_OPT_BOOT String USR_BIN String USR_LIB_ARCH @@ -49,6 +50,7 @@ class DebRootDefinition { GIS_OPT_KERNEL = "${DEBPATH}/opt/gis/kernel" + inpackagepathsuffix GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + inpackagepathsuffix GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + inpackagepathsuffix + GIS_OPT_BOOT = "${DEBPATH}/opt/gis/boot" + inpackagepathsuffix USR_BIN = "${DEBPATH}/usr/bin" + inpackagepathsuffix USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + inpackagepathsuffix From 349d1407f79597bbf21862ecd0f8d9a83105551e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 14 Oct 2021 20:11:43 +0100 Subject: [PATCH 1496/1971] Allow quick builds --- autobuilder.groovy | 16 ++++++++++++++++ meta/folder.groovy | 21 +++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index a8d418d..9101eac 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -43,6 +43,22 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { return altered } +def setBuildType(meta, boolean dofullbuild = true, boolean userquickbuild = false) { + def doquickbuild = false + + if (dofullbuild) { + echo "Doing full build" + } else if (userquickbuild) { + echo "Marking as quick build" + doquickbuild = true + } else if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause')) { + echo "Marking as quick build as it was triggered by a commit" + doquickbuild = true + } + meta.jenkinsbuildinfo.set(!doquickbuild) + return doquickbuild +} + // Start up boilerplate def startbuild( script, diff --git a/meta/folder.groovy b/meta/folder.groovy index 704bfc8..5c71003 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -135,20 +135,31 @@ class JenkinsBuildInfo extends GISJsonSerialised { int buildnumber private String buildmachine private String builddate + boolean isfullbuild - JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "") { + JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "", boolean isfullbuild = true) { super(script) this.buildjobname = buildjobname this.buildnumber = buildnumber this.buildmachine = buildmachine this.builddate = builddate + this.isfullbuild = isfullbuild } - void set(String buildjobname, int buildnumber, String buildmachine, String builddate) { + void set(String buildjobname, int buildnumber, String buildmachine, String builddate, boolean isfullbuild = true) { this.buildjobname = buildjobname this.buildnumber = buildnumber this.buildmachine = buildmachine this.builddate = builddate + this.isfullbuild = isfullbuild + } + + void set(boolean isfullbuild) { + this.isfullbuild = isfullbuild + } + + boolean isFullBuild() { + return isfullbuild } void deserialiseJson(rawmeta) { @@ -156,6 +167,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { buildnumber = rawmeta['buildnumber'] buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] + isfullbuild = rawmeta['isfullbuild'] ?: true } LinkedHashMap serialisationdata() { @@ -164,6 +176,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { 'buildnumber' : buildnumber, 'buildmachine' : buildmachine, 'builddate' : builddate, + 'isfullbuild' : isfullbuild ] return data } @@ -539,6 +552,10 @@ class MetaInfo extends GISJsonSerialised { return custominfo.getAt(customId.trim()) } + def isFullBuild() { + return jenkinsbuildinfo.isFullBuild() + } + List publishableinfoserialised() { def publishable = [] for (publishableitem in publishableinfo) { From eec1b4a5b7331bf3735902c523ecacdb358178e3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 14 Oct 2021 20:34:56 +0100 Subject: [PATCH 1497/1971] Allow quick builds --- autobuilder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/autobuilder.groovy b/autobuilder.groovy index 9101eac..656d29b 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -55,6 +55,7 @@ def setBuildType(meta, boolean dofullbuild = true, boolean userquickbuild = fals echo "Marking as quick build as it was triggered by a commit" doquickbuild = true } + echo "Build type is ${dobuildtype ? "quick" : "full"}" meta.jenkinsbuildinfo.set(!doquickbuild) return doquickbuild } From a21106ce3b9ee3952257e03781bf8dc4e1931f0c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 14 Oct 2021 20:36:12 +0100 Subject: [PATCH 1498/1971] Allow quick builds --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 656d29b..d181f21 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -55,7 +55,7 @@ def setBuildType(meta, boolean dofullbuild = true, boolean userquickbuild = fals echo "Marking as quick build as it was triggered by a commit" doquickbuild = true } - echo "Build type is ${dobuildtype ? "quick" : "full"}" + echo "Build type is ${doquickbuild ? "quick" : "full"}" meta.jenkinsbuildinfo.set(!doquickbuild) return doquickbuild } From e3a212896f4f8d0a8971d192b301a362b2e1c0ca Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 14 Oct 2021 20:49:46 +0100 Subject: [PATCH 1499/1971] Allow quick builds --- autobuilder.groovy | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index d181f21..d622d9e 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -43,17 +43,23 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { return altered } -def setBuildType(meta, boolean dofullbuild = true, boolean userquickbuild = false) { +def setBuildType(meta, boolean dofullbuild = true) { def doquickbuild = false - if (dofullbuild) { - echo "Doing full build" - } else if (userquickbuild) { - echo "Marking as quick build" - doquickbuild = true - } else if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause')) { - echo "Marking as quick build as it was triggered by a commit" - doquickbuild = true + if (currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')) { + echo "Build triggered by user" + if (!dofullbuild) { + echo "Marking as quick build as user wanted one" + doquickbuild = true + } + } else { + echo "Build triggered automatically" + if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause')) { + echo "Marking as quick build as it was triggered by a commit" + doquickbuild = true + } else if (currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')) { + echo "Marking as full build as it was triggered by timer" + } } echo "Build type is ${doquickbuild ? "quick" : "full"}" meta.jenkinsbuildinfo.set(!doquickbuild) From 4d468c373d6e34ba5f5ada7efe29b8195ba305f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 14 Oct 2021 22:43:37 +0100 Subject: [PATCH 1500/1971] Allow quick builds; Make quick builds unstable --- autobuilder.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index d622d9e..8108690 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -61,7 +61,10 @@ def setBuildType(meta, boolean dofullbuild = true) { echo "Marking as full build as it was triggered by timer" } } - echo "Build type is ${doquickbuild ? "quick" : "full"}" + echo "Build type is ${doquickbuild ? "quick" : "full"}" + if (doquickbuild) { + unstable('This not a full build - a subset of the artifacts is not being generated') + } meta.jenkinsbuildinfo.set(!doquickbuild) return doquickbuild } From 8332da3c943728d662c409f55d823c29f00b3158 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 10:04:32 +0100 Subject: [PATCH 1501/1971] Allow quick builds; Don't let releases proceed if a component is missing artifacts because it is not a full build --- release/do.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 9148572..d7f62a3 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -420,7 +420,13 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String 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?" + error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct? (If you ignore this issue, you will get an error much later because the system cannot tag 2 different commits of the associated source code with the same label)" + } + for (key in componentReleaseInfo.keySet()) { + def buildinfo = componentReleaseInfo[key] + if (!buildinfo.jenkinsbuildinfo.isFullBuild()) { + error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" + } } } From 7d21209abf011dec41bb1fb64213048e1e38b652 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 11:29:43 +0100 Subject: [PATCH 1502/1971] Display cause of build trigger - as the condition for an SCM change is not working --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 8108690..4c0a267 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -53,7 +53,7 @@ def setBuildType(meta, boolean dofullbuild = true) { doquickbuild = true } } else { - echo "Build triggered automatically" + echo "Build triggered automatically: ${currentBuild.getBuildCauses()}" if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause')) { echo "Marking as quick build as it was triggered by a commit" doquickbuild = true From 8906c79103ec4f429b5b0bc58eb70a0cd172eccb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 11:31:43 +0100 Subject: [PATCH 1503/1971] Display cause of build trigger - as the condition for an SCM change is not working --- autobuilder.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 4c0a267..9fa5952 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -46,6 +46,7 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { def setBuildType(meta, boolean dofullbuild = true) { def doquickbuild = false + echo "Build trigger cause: ${currentBuild.getBuildCauses()}" if (currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')) { echo "Build triggered by user" if (!dofullbuild) { @@ -53,7 +54,7 @@ def setBuildType(meta, boolean dofullbuild = true) { doquickbuild = true } } else { - echo "Build triggered automatically: ${currentBuild.getBuildCauses()}" + echo "Build triggered automatically" if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause')) { echo "Marking as quick build as it was triggered by a commit" doquickbuild = true From 29f72a2feb91e46a1dad15c1b4cfa52811519c26 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 11:54:19 +0100 Subject: [PATCH 1504/1971] Display cause of build trigger - as the condition for an SCM change is not working --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 9fa5952..e3bc4d1 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -55,7 +55,7 @@ def setBuildType(meta, boolean dofullbuild = true) { } } else { echo "Build triggered automatically" - if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause')) { + if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause') || currentBuild.getBuildCauses('hudson.triggers.SCMTrigger$SCMTriggerCause')) { echo "Marking as quick build as it was triggered by a commit" doquickbuild = true } else if (currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')) { From 7b036676b6194eb4317127a76b4c87cbb1249ef9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 12:29:55 +0100 Subject: [PATCH 1505/1971] Check for incomplete builds when releasing --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index d7f62a3..6417cec 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -424,6 +424,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String } for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] + echo "${key}: ${buildinfo.jenkinsbuildinfo.isFullBuild()}" if (!buildinfo.jenkinsbuildinfo.isFullBuild()) { error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" } From 1d5c4c44fcd48852004830e0ad341cee54869235 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 12:38:05 +0100 Subject: [PATCH 1506/1971] Check for incomplete builds when releasing --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 6417cec..ab68292 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -424,7 +424,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String } for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] - echo "${key}: ${buildinfo.jenkinsbuildinfo.isFullBuild()}" + echo "${key}: ${buildinfo.jenkinsbuildinfo.builddate} ${buildinfo.jenkinsbuildinfo.isFullBuild()}" if (!buildinfo.jenkinsbuildinfo.isFullBuild()) { error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" } From 4925740073e8d855abfd97d7ba283c49f00f7a40 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 12:40:52 +0100 Subject: [PATCH 1507/1971] Check for incomplete builds when releasing --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index ab68292..e538512 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -424,7 +424,7 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String } for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] - echo "${key}: ${buildinfo.jenkinsbuildinfo.builddate} ${buildinfo.jenkinsbuildinfo.isFullBuild()}" + echo "${key}: ${buildinfo.jenkinsbuildinfo.builddate} ${buildinfo.jenkinsbuildinfo.isfullbuild} ${buildinfo.jenkinsbuildinfo} ${buildinfo.jenkinsbuildinfo.isFullBuild()}" if (!buildinfo.jenkinsbuildinfo.isFullBuild()) { error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" } From 21dbda07afd005c89b32e8938bb60840ec94faeb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 12:50:16 +0100 Subject: [PATCH 1508/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 6 ++++++ release/do.groovy | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 5c71003..5d630a9 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -603,6 +603,12 @@ class MetaInfo extends GISJsonSerialised { def deserialiseJson(String filepath) { script.echo("Deserialising JSON at file: ${filepath}") + File jsonfile = new File(filepath) + def jsonfiletext = jsonfile.getText() + + echo "File contents: ${jsonfiletext}" + + def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } diff --git a/release/do.groovy b/release/do.groovy index e538512..c4a389a 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -422,12 +422,13 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) { error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct? (If you ignore this issue, you will get an error much later because the system cannot tag 2 different commits of the associated source code with the same label)" } - for (key in componentReleaseInfo.keySet()) { - def buildinfo = componentReleaseInfo[key] - echo "${key}: ${buildinfo.jenkinsbuildinfo.builddate} ${buildinfo.jenkinsbuildinfo.isfullbuild} ${buildinfo.jenkinsbuildinfo} ${buildinfo.jenkinsbuildinfo.isFullBuild()}" - if (!buildinfo.jenkinsbuildinfo.isFullBuild()) { - error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" - } + } + + for (key in componentReleaseInfo.keySet()) { + def buildinfo = componentReleaseInfo[key] + echo "${key}: ${buildinfo.jenkinsbuildinfo.builddate} ${buildinfo.jenkinsbuildinfo.isfullbuild} ${buildinfo.jenkinsbuildinfo.isFullBuild()}" + if (!buildinfo.jenkinsbuildinfo.isFullBuild()) { + error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" } } From 4715baa3e555923e5a5ce24b5f28bd9fe8eb0d3e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 12:58:05 +0100 Subject: [PATCH 1509/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 5d630a9..eb43aef 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -167,6 +167,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { buildnumber = rawmeta['buildnumber'] buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] + script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']}") isfullbuild = rawmeta['isfullbuild'] ?: true } From 2a2b2faca24a85dbb976621c55d9d35aaec76fc7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 12:59:47 +0100 Subject: [PATCH 1510/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index eb43aef..5647c56 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -607,7 +607,7 @@ class MetaInfo extends GISJsonSerialised { File jsonfile = new File(filepath) def jsonfiletext = jsonfile.getText() - echo "File contents: ${jsonfiletext}" + script.echo("File contents: ${jsonfiletext}") def rawmeta = script.readJSON(file: filepath) From 006332071cdb397a153a30b1d2605ca66de7784f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 13:03:39 +0100 Subject: [PATCH 1511/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 5647c56..9e66ef3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -167,8 +167,8 @@ class JenkinsBuildInfo extends GISJsonSerialised { buildnumber = rawmeta['buildnumber'] buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] - script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']}") isfullbuild = rawmeta['isfullbuild'] ?: true + script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']} ${isfullbuild}") } LinkedHashMap serialisationdata() { From 6ed4c5d2e9dd46bc7c87863542f77bc8976f4160 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 13:11:43 +0100 Subject: [PATCH 1512/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9e66ef3..dc957db 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -167,8 +167,9 @@ class JenkinsBuildInfo extends GISJsonSerialised { buildnumber = rawmeta['buildnumber'] buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] - isfullbuild = rawmeta['isfullbuild'] ?: true - script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']} ${isfullbuild}") + isfullbuild = rawmeta['isfullbuild'] + blah = rawmeta['blah'] + script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']} ${isfullbuild} ${blah}") } LinkedHashMap serialisationdata() { From 76ff71a851033cde628f67a768b96fbac36d5169 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 13:14:01 +0100 Subject: [PATCH 1513/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index dc957db..d24ed27 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -168,7 +168,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] isfullbuild = rawmeta['isfullbuild'] - blah = rawmeta['blah'] + def blah = rawmeta['blah'] script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']} ${isfullbuild} ${blah}") } @@ -605,12 +605,6 @@ class MetaInfo extends GISJsonSerialised { def deserialiseJson(String filepath) { script.echo("Deserialising JSON at file: ${filepath}") - File jsonfile = new File(filepath) - def jsonfiletext = jsonfile.getText() - - script.echo("File contents: ${jsonfiletext}") - - def rawmeta = script.readJSON(file: filepath) deserialiseJson(rawmeta) } From da0ffefae8518470f66fe7ace6fb451513d7c9f7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 13:18:10 +0100 Subject: [PATCH 1514/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d24ed27..03698f0 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -167,8 +167,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { buildnumber = rawmeta['buildnumber'] buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] - isfullbuild = rawmeta['isfullbuild'] - def blah = rawmeta['blah'] + isfullbuild = (rawmeta['isfullbuild'] == null) ? true : rawmeta['isfullbuild'] script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']} ${isfullbuild} ${blah}") } From d86017c979c2a12c48f9100964d99108714b94ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 13:19:36 +0100 Subject: [PATCH 1515/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 03698f0..77ccf06 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -168,7 +168,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] isfullbuild = (rawmeta['isfullbuild'] == null) ? true : rawmeta['isfullbuild'] - script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']} ${isfullbuild} ${blah}") + script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']} ${isfullbuild}") } LinkedHashMap serialisationdata() { From 9177787fd425d22f7ea0797af127b011b8b66094 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 15 Oct 2021 13:21:25 +0100 Subject: [PATCH 1516/1971] Check for incomplete builds when releasing --- meta/folder.groovy | 1 - release/do.groovy | 1 - 2 files changed, 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 77ccf06..6b5f8bc 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -168,7 +168,6 @@ class JenkinsBuildInfo extends GISJsonSerialised { buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] isfullbuild = (rawmeta['isfullbuild'] == null) ? true : rawmeta['isfullbuild'] - script.echo("rawmeta['isfullbuild'] is ${rawmeta['isfullbuild']} ${isfullbuild}") } LinkedHashMap serialisationdata() { diff --git a/release/do.groovy b/release/do.groovy index c4a389a..649e279 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -426,7 +426,6 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] - echo "${key}: ${buildinfo.jenkinsbuildinfo.builddate} ${buildinfo.jenkinsbuildinfo.isfullbuild} ${buildinfo.jenkinsbuildinfo.isFullBuild()}" if (!buildinfo.jenkinsbuildinfo.isFullBuild()) { error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" } From 56951ba7d07ad92e6289a7b2290ffe350b5604fc Mon Sep 17 00:00:00 2001 From: Tamas Csillag Date: Fri, 22 Oct 2021 13:40:59 +0100 Subject: [PATCH 1517/1971] CORE-348: Trying to resolve a git error in the autobuild. --- versioncontrol/git.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 5bcb0ba..c2f7046 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -104,13 +104,13 @@ def String checkouttoreporoot(String gitURL) { def checkgitlfsinstall() { if (isUnix()) { sh """ - git lfs install + git lfs install --skip-repo if [ \$? -ne 0 ]; then exit 1; fi """ } else { powershell """ - git lfs install + git lfs install --skip-repo if (\$lastexitcode -ge 1) { exit 1 } """ } From 37bf1354b98ea2496749c2111bdc76fea838fd6a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 30 Oct 2021 11:27:56 +0100 Subject: [PATCH 1518/1971] Remove redundant condition - try with short unstable builds --- autobuilder.groovy | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index e3bc4d1..a587c70 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -107,22 +107,12 @@ def startbuild( return meta } -// DEPRECATED Metod, Use StartBuild Instead. +// DEPRECATED Method, Use StartBuild Instead. 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) + error "DEPRECATED method - deleted - start(script, String productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, ...)" } -// Start up boilderplate +// Start up boilerplate def startnonbuild( script, autobuildpath = autobuildroot, From e4bc007e7d26f3203a70327952364953201d7ae4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 30 Oct 2021 11:30:33 +0100 Subject: [PATCH 1519/1971] Remove deprecated method --- autobuilder.groovy | 5 ----- 1 file changed, 5 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index a587c70..2c6c4c4 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -107,11 +107,6 @@ def startbuild( return meta } -// DEPRECATED Method, Use StartBuild Instead. -def start( - error "DEPRECATED method - deleted - start(script, String productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, ...)" -} - // Start up boilerplate def startnonbuild( script, From 7fda62fc3dbd924a7b1270d9d6378a03e1c66ddf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 31 Oct 2021 08:38:09 +0000 Subject: [PATCH 1520/1971] Move post build actions to Common scripts --- build/postactions.groovy | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 build/postactions.groovy diff --git a/build/postactions.groovy b/build/postactions.groovy new file mode 100644 index 0000000..5a9ea09 --- /dev/null +++ b/build/postactions.groovy @@ -0,0 +1,55 @@ + +def performSuccessfulBuildActions() { + if (DOXYGEN_DEPLOY_JOB) { + build( + wait: false, + job: DOXYGEN_DEPLOY_JOB, + parameters: [ + string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME), + string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } + if (STATIC_ANALYSIS_JOB) { + build( + wait: false, + job: STATIC_ANALYSIS_JOB, + parameters: [ + string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } + if (UNIT_TEST_JOB) { + build( + wait: false, + job: UNIT_TEST_JOB, + parameters: [ + string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } + if (REGRESSION_TEST_JOB) { + build( + wait: false, + job: REGRESSION_TEST_JOB, + parameters: [ + string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } + if (RELEASE_TO_GIT_JOB) { + build( + wait: false, + job: RELEASE_TO_GIT_JOB, + parameters: [ + string(name: 'BUILD_JOB', value: JOB_NAME), + string(name: 'BUILD_JOB_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } +} + +return this; From 9711fd7b237ce6a62646c1afc00e91427a262a14 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 1 Nov 2021 07:35:25 +0000 Subject: [PATCH 1521/1971] Handle disabled post action jobs; Handle lack of FULLBUILD parameter --- build/postactions.groovy | 90 ++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 5a9ea09..b7b027f 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -1,54 +1,64 @@ def performSuccessfulBuildActions() { if (DOXYGEN_DEPLOY_JOB) { - build( - wait: false, - job: DOXYGEN_DEPLOY_JOB, - parameters: [ - string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME), - string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: " ${BUILD_NUMBER}"), - ] - ) + if (Jenkins.instance.getItem(DOXYGEN_DEPLOY_JOB).isBuildable()) { + build( + wait: false, + job: DOXYGEN_DEPLOY_JOB, + parameters: [ + string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME), + string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } } if (STATIC_ANALYSIS_JOB) { - build( - wait: false, - job: STATIC_ANALYSIS_JOB, - parameters: [ - string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), - ] - ) + if (Jenkins.instance.getItem(STATIC_ANALYSIS_JOB).isBuildable()) { + build( + wait: false, + job: STATIC_ANALYSIS_JOB, + parameters: [ + string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } } if (UNIT_TEST_JOB) { - build( - wait: false, - job: UNIT_TEST_JOB, - parameters: [ - string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), - ] - ) + if (Jenkins.instance.getItem(UNIT_TEST_JOB).isBuildable()) { + build( + wait: false, + job: UNIT_TEST_JOB, + parameters: [ + string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } } if (REGRESSION_TEST_JOB) { - build( - wait: false, - job: REGRESSION_TEST_JOB, - parameters: [ - string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), - ] - ) + if (Jenkins.instance.getItem(REGRESSION_TEST_JOB).isBuildable()) { + build( + wait: false, + job: REGRESSION_TEST_JOB, + parameters: [ + string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } } if (RELEASE_TO_GIT_JOB) { - build( - wait: false, - job: RELEASE_TO_GIT_JOB, - parameters: [ - string(name: 'BUILD_JOB', value: JOB_NAME), - string(name: 'BUILD_JOB_SELECTOR', value: " ${BUILD_NUMBER}"), - ] - ) + if (Jenkins.instance.getItem(RELEASE_TO_GIT_JOB).isBuildable()) { + build( + wait: false, + job: RELEASE_TO_GIT_JOB, + parameters: [ + string(name: 'BUILD_JOB', value: JOB_NAME), + string(name: 'BUILD_JOB_SELECTOR', value: " ${BUILD_NUMBER}"), + ] + ) + } } } From 88a4a3b41df407a8f0bbd3687451174bc4158334 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 1 Nov 2021 07:39:10 +0000 Subject: [PATCH 1522/1971] Handle disabled post action jobs; Handle lack of FULLBUILD parameter --- build/postactions.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index b7b027f..6bac803 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -1,6 +1,6 @@ def performSuccessfulBuildActions() { - if (DOXYGEN_DEPLOY_JOB) { + if (params.DOXYGEN_DEPLOY_JOB != null && DOXYGEN_DEPLOY_JOB) { if (Jenkins.instance.getItem(DOXYGEN_DEPLOY_JOB).isBuildable()) { build( wait: false, @@ -12,7 +12,7 @@ def performSuccessfulBuildActions() { ) } } - if (STATIC_ANALYSIS_JOB) { + if (params.STATIC_ANALYSIS_JOB != null && STATIC_ANALYSIS_JOB) { if (Jenkins.instance.getItem(STATIC_ANALYSIS_JOB).isBuildable()) { build( wait: false, @@ -25,7 +25,7 @@ def performSuccessfulBuildActions() { } } if (UNIT_TEST_JOB) { - if (Jenkins.instance.getItem(UNIT_TEST_JOB).isBuildable()) { + if (params.UNIT_TEST_JOB != null && Jenkins.instance.getItem(UNIT_TEST_JOB).isBuildable()) { build( wait: false, job: UNIT_TEST_JOB, @@ -37,7 +37,7 @@ def performSuccessfulBuildActions() { } } if (REGRESSION_TEST_JOB) { - if (Jenkins.instance.getItem(REGRESSION_TEST_JOB).isBuildable()) { + if (params.REGRESSION_TEST_JOB != null && Jenkins.instance.getItem(REGRESSION_TEST_JOB).isBuildable()) { build( wait: false, job: REGRESSION_TEST_JOB, @@ -48,7 +48,7 @@ def performSuccessfulBuildActions() { ) } } - if (RELEASE_TO_GIT_JOB) { + if (params.RELEASE_TO_GIT_JOB != null && RELEASE_TO_GIT_JOB) { if (Jenkins.instance.getItem(RELEASE_TO_GIT_JOB).isBuildable()) { build( wait: false, From 0ae743b16fdabbbd9266cc47411e68ec17364ae9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 2 Nov 2021 22:18:49 +0000 Subject: [PATCH 1523/1971] Check status of jobs --- build/postactions.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 6bac803..d0c10e5 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -1,7 +1,7 @@ def performSuccessfulBuildActions() { if (params.DOXYGEN_DEPLOY_JOB != null && DOXYGEN_DEPLOY_JOB) { - if (Jenkins.instance.getItem(DOXYGEN_DEPLOY_JOB).isBuildable()) { + if (Jenkins.instance.getItemByFullName(DOXYGEN_DEPLOY_JOB).isBuildable()) { build( wait: false, job: DOXYGEN_DEPLOY_JOB, @@ -13,7 +13,7 @@ def performSuccessfulBuildActions() { } } if (params.STATIC_ANALYSIS_JOB != null && STATIC_ANALYSIS_JOB) { - if (Jenkins.instance.getItem(STATIC_ANALYSIS_JOB).isBuildable()) { + if (Jenkins.instance.getItemByFullName(STATIC_ANALYSIS_JOB).isBuildable()) { build( wait: false, job: STATIC_ANALYSIS_JOB, @@ -25,7 +25,7 @@ def performSuccessfulBuildActions() { } } if (UNIT_TEST_JOB) { - if (params.UNIT_TEST_JOB != null && Jenkins.instance.getItem(UNIT_TEST_JOB).isBuildable()) { + if (params.UNIT_TEST_JOB != null && Jenkins.instance.getItemByFullName(UNIT_TEST_JOB).isBuildable()) { build( wait: false, job: UNIT_TEST_JOB, @@ -37,7 +37,7 @@ def performSuccessfulBuildActions() { } } if (REGRESSION_TEST_JOB) { - if (params.REGRESSION_TEST_JOB != null && Jenkins.instance.getItem(REGRESSION_TEST_JOB).isBuildable()) { + if (params.REGRESSION_TEST_JOB != null && Jenkins.instance.getItemByFullName(REGRESSION_TEST_JOB).isBuildable()) { build( wait: false, job: REGRESSION_TEST_JOB, @@ -49,7 +49,7 @@ def performSuccessfulBuildActions() { } } if (params.RELEASE_TO_GIT_JOB != null && RELEASE_TO_GIT_JOB) { - if (Jenkins.instance.getItem(RELEASE_TO_GIT_JOB).isBuildable()) { + if (Jenkins.instance.getItemByFullName(RELEASE_TO_GIT_JOB).isBuildable()) { build( wait: false, job: RELEASE_TO_GIT_JOB, From c9e0ee6b7ecbdd4d763da9f9ed0fb6af13abc29b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 3 Nov 2021 08:16:53 +0000 Subject: [PATCH 1524/1971] Show new tags and their sha code before pushing during release process --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index 649e279..e0b9471 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -235,6 +235,7 @@ def boolean releasegittags(String postcommitshacode, ArrayList taglist) summaryappend("Rel Tag ") for (tag in taglist) { if (releasegittag(postcommitshacode, tag)) { + echo "Tag added: ${tag} with sha: ${postcommitshacode}" tagadded = true } } From d52de4b8cd6974fba4f5698d874eb6cdeec4b268 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 4 Nov 2021 07:27:52 +0000 Subject: [PATCH 1525/1971] Trigger various optional processes after a successful build --- build/postactions.groovy | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index d0c10e5..48ca297 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -1,7 +1,7 @@ def performSuccessfulBuildActions() { - if (params.DOXYGEN_DEPLOY_JOB != null && DOXYGEN_DEPLOY_JOB) { - if (Jenkins.instance.getItemByFullName(DOXYGEN_DEPLOY_JOB).isBuildable()) { + if (params.DOXYGEN_DEPLOY_JOB != null) { + if (DOXYGEN_DEPLOY_JOB && Jenkins.instance.getItemByFullName(DOXYGEN_DEPLOY_JOB).isBuildable()) { build( wait: false, job: DOXYGEN_DEPLOY_JOB, @@ -12,8 +12,8 @@ def performSuccessfulBuildActions() { ) } } - if (params.STATIC_ANALYSIS_JOB != null && STATIC_ANALYSIS_JOB) { - if (Jenkins.instance.getItemByFullName(STATIC_ANALYSIS_JOB).isBuildable()) { + if (params.STATIC_ANALYSIS_JOB != null) { + if (STATIC_ANALYSIS_JOB && Jenkins.instance.getItemByFullName(STATIC_ANALYSIS_JOB).isBuildable()) { build( wait: false, job: STATIC_ANALYSIS_JOB, @@ -24,8 +24,8 @@ def performSuccessfulBuildActions() { ) } } - if (UNIT_TEST_JOB) { - if (params.UNIT_TEST_JOB != null && Jenkins.instance.getItemByFullName(UNIT_TEST_JOB).isBuildable()) { + if (params.UNIT_TEST_JOB != null) { + if (UNIT_TEST_JOB && Jenkins.instance.getItemByFullName(UNIT_TEST_JOB).isBuildable()) { build( wait: false, job: UNIT_TEST_JOB, @@ -36,8 +36,8 @@ def performSuccessfulBuildActions() { ) } } - if (REGRESSION_TEST_JOB) { - if (params.REGRESSION_TEST_JOB != null && Jenkins.instance.getItemByFullName(REGRESSION_TEST_JOB).isBuildable()) { + if (params.REGRESSION_TEST_JOB != null) { + if (REGRESSION_TEST_JOB && Jenkins.instance.getItemByFullName(REGRESSION_TEST_JOB).isBuildable()) { build( wait: false, job: REGRESSION_TEST_JOB, @@ -48,8 +48,8 @@ def performSuccessfulBuildActions() { ) } } - if (params.RELEASE_TO_GIT_JOB != null && RELEASE_TO_GIT_JOB) { - if (Jenkins.instance.getItemByFullName(RELEASE_TO_GIT_JOB).isBuildable()) { + if (params.RELEASE_TO_GIT_JOB != null) { + if (RELEASE_TO_GIT_JOB && Jenkins.instance.getItemByFullName(RELEASE_TO_GIT_JOB).isBuildable()) { build( wait: false, job: RELEASE_TO_GIT_JOB, From 718ebaa4183845682542a364045093962d3f5117 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Nov 2021 18:06:02 +0000 Subject: [PATCH 1526/1971] Refactor groovy calling test script using newer common script apis; Transfer info across from build; Provide new interface for getting tools --- configuration/configuration.groovy | 81 ++++++++++++++++++++++++++++-- meta/folder.groovy | 14 ++++++ 2 files changed, 90 insertions(+), 5 deletions(-) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 2a7f1ab..9067018 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,18 +1,89 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") +String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '' + + configurationhelper.gitCheckoutAndRegister( + meta, + 'xmlcoreutils', + XMLCOREUTILSURL, + XMLCOREUTILSREVISION, + XMLCOREUTILSDIR + ) + +class ToolOptions { + def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) + + String m_toolName + + String m_gitURL + String m_revision + String m_repoRoot + int m_cloneDepth + boolean m_shallowClone + + ToolOptions(script) { + m_script = script + m_gitURL = '-' + m_revision = '-' + m_repoRoot = '' + m_cloneDepth = 1 + m_shallowClone = true + } + + void toolName(String name) { + m_toolName = name.trim() + } + + void toolRepo(String repo, String revision) { + m_repo = repo.trim() + m_revision = revision.trim() + } + + void repoRoot(String root) { + m_repoRoot = root.trim() + } + + void clonedepth(int depth) { + m_cloneDepth = depth + } + + void shallowclone(boolean shallow) { + m_shallowClone = shallow + } +} + +ToolOptions getNewToolOptions() { + return new ToolOptions(this) +} + def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) } def registerPipelineScriptConfiguration(meta) { - registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo(autobuilder.getautobuildpath())) + def options = getNewToolOptions() + + options.toolName('pipeline script'); + registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(autobuilder.getautobuildpath())) } -def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') { - def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) - gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) +def getTool(meta, ToolOptions options, String targetDir) { + gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone) - registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) + registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir)) +} + +def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = '', int cloneDepth = 1, boolean shallowClone = true, String filter = '') { + echo "DEPRECATED method: gitCheckoutAndRegister(meta,, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, ...)" + def options = getNewToolOptions() + + options.toolName(tool); + options.toolRepo(gitURL, revision) + options.repoRoot(repoRoot) + options.clonedepth(cloneDepth) + options.shallowclone(shallowClone) + + getTool(meta, options, targetDir) } return this diff --git a/meta/folder.groovy b/meta/folder.groovy index 6b5f8bc..7a85338 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -70,6 +70,12 @@ class ProductInfo extends GISJsonSerialised { this.variant = variant } + void set(ProductInfo otherinfo) { + this.productname = otherinfo.productname + this.subcomponentname = otherinfo.subcomponentname + this.variant = otherinfo.variant + } + void deserialiseJson(rawmeta) { productname = rawmeta['productname'] subcomponentname = rawmeta['subcomponentname'] @@ -110,6 +116,14 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } + void set(GitInfo otherinfo) { + this.sourcepath = otherinfo.sourcepath + this.sourcerevision = otherinfo.sourcerevision + this.gitrevision = otherinfo.gitrevision + this.remoteurl = otherinfo.remoteurl + this.remoteinfo = otherinfo.remoteinfo + } + void deserialiseJson(rawmeta) { sourcepath = rawmeta['sourcepath'] sourcerevision = rawmeta['sourcerevision'] From a7f2de8b8695b543368a20f87a2736b579cfd2dc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Nov 2021 18:13:37 +0000 Subject: [PATCH 1527/1971] Refactor groovy calling test script using newer common script apis; Correct history folder --- configuration/configuration.groovy | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 9067018..ba03d31 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,15 +1,5 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '' - - configurationhelper.gitCheckoutAndRegister( - meta, - 'xmlcoreutils', - XMLCOREUTILSURL, - XMLCOREUTILSREVISION, - XMLCOREUTILSDIR - ) - class ToolOptions { def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) From fbd0c169d9c8c1ea2a4a00df6af25e5fa6c9e2fd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Nov 2021 18:47:38 +0000 Subject: [PATCH 1528/1971] Refactor groovy calling test script using newer common script apis; Seperate scripts --- configuration/configuration.groovy | 71 +++--------------------------- configuration/tools.groovy | 59 +++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 66 deletions(-) create mode 100644 configuration/tools.groovy diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index ba03d31..2a7f1ab 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,79 +1,18 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -class ToolOptions { - def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) - - String m_toolName - - String m_gitURL - String m_revision - String m_repoRoot - int m_cloneDepth - boolean m_shallowClone - - ToolOptions(script) { - m_script = script - m_gitURL = '-' - m_revision = '-' - m_repoRoot = '' - m_cloneDepth = 1 - m_shallowClone = true - } - - void toolName(String name) { - m_toolName = name.trim() - } - - void toolRepo(String repo, String revision) { - m_repo = repo.trim() - m_revision = revision.trim() - } - - void repoRoot(String root) { - m_repoRoot = root.trim() - } - - void clonedepth(int depth) { - m_cloneDepth = depth - } - - void shallowclone(boolean shallow) { - m_shallowClone = shallow - } -} - -ToolOptions getNewToolOptions() { - return new ToolOptions(this) -} - def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) } def registerPipelineScriptConfiguration(meta) { - def options = getNewToolOptions() - - options.toolName('pipeline script'); - registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(autobuilder.getautobuildpath())) + registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo(autobuilder.getautobuildpath())) } -def getTool(meta, ToolOptions options, String targetDir) { - gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone) +def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') { + def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) + gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) - registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir)) -} - -def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = '', int cloneDepth = 1, boolean shallowClone = true, String filter = '') { - echo "DEPRECATED method: gitCheckoutAndRegister(meta,, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, ...)" - def options = getNewToolOptions() - - options.toolName(tool); - options.toolRepo(gitURL, revision) - options.repoRoot(repoRoot) - options.clonedepth(cloneDepth) - options.shallowclone(shallowClone) - - getTool(meta, options, targetDir) + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) } return this diff --git a/configuration/tools.groovy b/configuration/tools.groovy new file mode 100644 index 0000000..fbd34a6 --- /dev/null +++ b/configuration/tools.groovy @@ -0,0 +1,59 @@ +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + +class ToolOptions { + def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) + + String m_toolName + + String m_gitURL + String m_revision + String m_repoRoot + int m_cloneDepth + boolean m_shallowClone + + ToolOptions(script) { + m_script = script + m_gitURL = '-' + m_revision = '-' + m_repoRoot = '' + m_cloneDepth = 1 + m_shallowClone = true + } + + void toolName(String name) { + m_toolName = name.trim() + } + + void toolRepo(String repo, String revision) { + m_repo = repo.trim() + m_revision = revision.trim() + } + + void repoRoot(String root) { + m_repoRoot = root.trim() + } + + void clonedepth(int depth) { + m_cloneDepth = depth + } + + void shallowclone(boolean shallow) { + m_shallowClone = shallow + } +} + +ToolOptions getNewToolOptions() { + return new ToolOptions(this) +} + +def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { + meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) +} + +def getTool(meta, ToolOptions options, String targetDir) { + gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone) + + registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir)) +} + +return this From 0c350d89588a2c96c77abf6e8c4a2a95a39d1224 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Nov 2021 18:51:45 +0000 Subject: [PATCH 1529/1971] Refactor groovy calling test script using newer common script apis; Seperate scripts --- configuration/tools.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/tools.groovy b/configuration/tools.groovy index fbd34a6..dbaeedb 100644 --- a/configuration/tools.groovy +++ b/configuration/tools.groovy @@ -24,8 +24,8 @@ class ToolOptions { m_toolName = name.trim() } - void toolRepo(String repo, String revision) { - m_repo = repo.trim() + void toolRepo(String gitURL, String revision) { + m_gitURL = gitURL.trim() m_revision = revision.trim() } From ea94dfa39e9b2c2c509c971fe86ee2999427f36f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Nov 2021 19:52:17 +0000 Subject: [PATCH 1530/1971] Refactor groovy calling test script using newer common script apis; Capture build parameters --- autobuilder.groovy | 26 ++++++++++++--------- meta/folder.groovy | 56 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 2c6c4c4..59d1448 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -70,6 +70,19 @@ def setBuildType(meta, boolean dofullbuild = true) { return doquickbuild } +def setupmeta(String productname, String subcomponentname, String productvariant = '') { + def meta = getmetafolderscript().metareset(script) + echo "Product name: ${productname} Subcomponent name: ${subcomponentname} Variant: ${productvariant}" + 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()) + for (p in params) { + meta.jenkinsbuildinfo.addParameter(p.key, p.value) + } + return meta +} + // Start up boilerplate def startbuild( script, @@ -88,12 +101,7 @@ def startbuild( conditionalclean() - def meta = getmetafolderscript().metareset(script) - echo "Product name: ${productname} Subcomponent name: ${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 meta = setupmeta(productname, subcomponentname, productvariant) { def rr = load("${commonscripts()}/release/registerrepo.groovy") def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant) @@ -121,11 +129,7 @@ def startnonbuild( 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 meta = setupmeta("Non-build-product", "Non-build-subcomponent") { def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7a85338..e2b3015 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -144,11 +144,41 @@ class GitInfo extends GISJsonSerialised { } } +class JenkinsBuildParameter extends GISJsonSerialised { + private String name + private String value + + JenkinsBuildParameter(script, String name = '', String value = '') { + super(script) + this.name = name + this.value = value + } + + void set(String name, String value) { + this.name = name + this.value = value + } + + void deserialiseJson(rawmeta) { + name = rawmeta['name'] + value = rawmeta['value'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'name' : name, + 'value' : value, + ] + return data + } +} + class JenkinsBuildInfo extends GISJsonSerialised { String buildjobname int buildnumber private String buildmachine private String builddate + ArrayList parameters boolean isfullbuild JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "", boolean isfullbuild = true) { @@ -158,6 +188,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { this.buildmachine = buildmachine this.builddate = builddate this.isfullbuild = isfullbuild + parameters = new ArrayList() } void set(String buildjobname, int buildnumber, String buildmachine, String builddate, boolean isfullbuild = true) { @@ -176,12 +207,34 @@ class JenkinsBuildInfo extends GISJsonSerialised { return isfullbuild } + void addParameter(String name, String value) { + def p = new JenkinsBuildParameter(script, name, value) + parameters.add(p) + return p + } + void deserialiseJson(rawmeta) { buildjobname = rawmeta['buildjobname'] buildnumber = rawmeta['buildnumber'] buildmachine = rawmeta['buildmachine'] builddate = rawmeta['builddate'] isfullbuild = (rawmeta['isfullbuild'] == null) ? true : rawmeta['isfullbuild'] + parameters = new ArrayList() + if (rawmeta['isfullbuild'] != null) { + for (rawparameter in rawmeta['parameters']) { + def p = new JenkinsBuildParameter(script) + p.deserialiseJson(rawparameter) + parameters.add(p) + } + } + } + + List parametersserialised() { + def associated = [] + for (p in parameters) { + associated.add(p.serialisationdata()) + } + return associated } LinkedHashMap serialisationdata() { @@ -190,7 +243,8 @@ class JenkinsBuildInfo extends GISJsonSerialised { 'buildnumber' : buildnumber, 'buildmachine' : buildmachine, 'builddate' : builddate, - 'isfullbuild' : isfullbuild + 'isfullbuild' : isfullbuild, + 'parameters' : parametersserialised(), ] return data } From baacfdb417489eeaae368bff594e3af59412c20c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Nov 2021 19:59:46 +0000 Subject: [PATCH 1531/1971] Refactor groovy calling test script using newer common script apis; Capture build parameters --- autobuilder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 59d1448..8e7eb27 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -101,7 +101,7 @@ def startbuild( conditionalclean() - def meta = setupmeta(productname, subcomponentname, productvariant) { + def meta = setupmeta(productname, subcomponentname, productvariant) def rr = load("${commonscripts()}/release/registerrepo.groovy") def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant) @@ -129,7 +129,7 @@ def startnonbuild( conditionalclean() - def meta = setupmeta("Non-build-product", "Non-build-subcomponent") { + def meta = setupmeta("Non-build-product", "Non-build-subcomponent") def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From 6299b7e7153271dc16b7985209bf7e3760b0f5da Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Nov 2021 20:01:37 +0000 Subject: [PATCH 1532/1971] Refactor groovy calling test script using newer common script apis; Capture build parameters --- autobuilder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 8e7eb27..667f89a 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -70,7 +70,7 @@ def setBuildType(meta, boolean dofullbuild = true) { return doquickbuild } -def setupmeta(String productname, String subcomponentname, String productvariant = '') { +def setupmeta(script, String productname, String subcomponentname, String productvariant = '') { def meta = getmetafolderscript().metareset(script) echo "Product name: ${productname} Subcomponent name: ${subcomponentname} Variant: ${productvariant}" meta.productinfo.set(productname, subcomponentname, productvariant) @@ -101,7 +101,7 @@ def startbuild( conditionalclean() - def meta = setupmeta(productname, subcomponentname, productvariant) + def meta = setupmeta(script, productname, subcomponentname, productvariant) def rr = load("${commonscripts()}/release/registerrepo.groovy") def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant) @@ -129,7 +129,7 @@ def startnonbuild( conditionalclean() - def meta = setupmeta("Non-build-product", "Non-build-subcomponent") + def meta = setupmeta(script, "Non-build-product", "Non-build-subcomponent") def ch = load("${commonscripts()}/configuration/configuration.groovy") ch.registerPipelineScriptConfiguration(meta) From a89688e44fa57a27b5389176cc1c7794b464f81b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 5 Nov 2021 20:07:18 +0000 Subject: [PATCH 1533/1971] Refactor groovy calling test script using newer common script apis; Capture build parameters --- autobuilder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 667f89a..1a071e5 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -78,7 +78,7 @@ def setupmeta(script, String productname, String subcomponentname, String produc now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) for (p in params) { - meta.jenkinsbuildinfo.addParameter(p.key, p.value) + meta.jenkinsbuildinfo.addParameter(p.key, p.value.toString()) } return meta } From e7dace6cb0378fb5d6bf77ddf4d106f975d76f71 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 11:10:16 +0000 Subject: [PATCH 1534/1971] Add a new meta walker and test it --- build/integrity.groovy | 17 +++++++++++++++++ meta/folder.groovy | 14 ++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 build/integrity.groovy diff --git a/build/integrity.groovy b/build/integrity.groovy new file mode 100644 index 0000000..3f658a8 --- /dev/null +++ b/build/integrity.groovy @@ -0,0 +1,17 @@ + +def check(buildmeta) { + def results = [ + 'good': true, + 'comment': '', + ] + + // Walk the meta looking for different versions of the same components + def allmeta = buildmeta.allrelatedmeta() + echo "All meta:" + for (meta in allmeta) { + echo meta.componentversionuniqueidentifier() + } + return results +} + +return this \ No newline at end of file diff --git a/meta/folder.groovy b/meta/folder.groovy index e2b3015..63e2fa5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -847,6 +847,20 @@ class MetaInfo extends GISJsonSerialised { return releasemetaversionuniquecollection } + ArrayList walkrelated(ArrayList metacollection) { + metacollection.add(this) + for (relatedmetainfo in associatedmeta) { + MetaInfo othermeta = relatedmetainfo.meta + metacollection = othermeta.walkrelated(metacollection) + } + return metacollection + } + + ArrayList allrelatedmeta() { + ArrayList metacollection = new ArrayList() + return walkrelated(metacollection) + } + MetaInfo getNewMetaObject(script) { return new MetaInfo(script) } From 04067e214d15eebdf574b58cb4f44f0cfb6f0990 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 11:49:23 +0000 Subject: [PATCH 1535/1971] Add a new meta walker and test it --- build/integrity.groovy | 4 ++-- meta/folder.groovy | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index 3f658a8..6fb9985 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -7,8 +7,8 @@ def check(buildmeta) { // Walk the meta looking for different versions of the same components def allmeta = buildmeta.allrelatedmeta() - echo "All meta:" - for (meta in allmeta) { + echo "All meta:\n${allmeta.comment}" + for (meta in allmeta.metacollection) { echo meta.componentversionuniqueidentifier() } return results diff --git a/meta/folder.groovy b/meta/folder.groovy index 63e2fa5..be4ac9f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -847,16 +847,17 @@ class MetaInfo extends GISJsonSerialised { return releasemetaversionuniquecollection } - ArrayList walkrelated(ArrayList metacollection) { + def walkrelated(ArrayList metacollection, String comment = '', int level = 0) { metacollection.add(this) + comment += ''.padright(level) + componentversionuniqueidentifier() + '\n' for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta - metacollection = othermeta.walkrelated(metacollection) + results = othermeta.walkrelated(metacollection, comment, level + 1) } - return metacollection + return [ 'metacollection' : results.metacollection, 'comment': results.comment] } - ArrayList allrelatedmeta() { + def allrelatedmeta() { ArrayList metacollection = new ArrayList() return walkrelated(metacollection) } From b8a0c9641f0f61987da85de0b89072a1afcae117 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 12:41:40 +0000 Subject: [PATCH 1536/1971] Add a new meta walker and test it --- build/integrity.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index 6fb9985..dd97e2b 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -7,7 +7,7 @@ def check(buildmeta) { // Walk the meta looking for different versions of the same components def allmeta = buildmeta.allrelatedmeta() - echo "All meta:\n${allmeta.comment}" + echo "All meta:\n${allmeta.comment}" for (meta in allmeta.metacollection) { echo meta.componentversionuniqueidentifier() } From 11d53250bffd1884e76010b9678f4167e46e9272 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 12:43:44 +0000 Subject: [PATCH 1537/1971] Add a new meta walker and test it --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index be4ac9f..d2e2ef8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -849,7 +849,7 @@ class MetaInfo extends GISJsonSerialised { def walkrelated(ArrayList metacollection, String comment = '', int level = 0) { metacollection.add(this) - comment += ''.padright(level) + componentversionuniqueidentifier() + '\n' + comment += ''.padRight(level) + componentversionuniqueidentifier() + '\n' for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta results = othermeta.walkrelated(metacollection, comment, level + 1) From 9b773dd0c5eab71dc978a72103d1268227bea893 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 13:08:19 +0000 Subject: [PATCH 1538/1971] Add a new meta walker and test it --- meta/folder.groovy | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d2e2ef8..ced61c3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -848,13 +848,17 @@ class MetaInfo extends GISJsonSerialised { } def walkrelated(ArrayList metacollection, String comment = '', int level = 0) { - metacollection.add(this) - comment += ''.padRight(level) + componentversionuniqueidentifier() + '\n' + def results = [ + 'metacollection' : metacollection, + 'comment': comment + ] + results.metacollection.add(this) + results.comment += ''.padRight(level) + componentversionuniqueidentifier() + '\n' for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta - results = othermeta.walkrelated(metacollection, comment, level + 1) + results = othermeta.walkrelated(results.metacollection, results.comment, level + 1) } - return [ 'metacollection' : results.metacollection, 'comment': results.comment] + return [ 'metacollection' : results.metacollection, 'comment': results.comment ] } def allrelatedmeta() { From e21cbf4d0369b573b776d28011c00dd5f37d9e7b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 15:54:30 +0000 Subject: [PATCH 1539/1971] Add a new meta walker and test it --- build/integrity.groovy | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index dd97e2b..161c503 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -8,8 +8,30 @@ def check(buildmeta) { // Walk the meta looking for different versions of the same components def allmeta = buildmeta.allrelatedmeta() echo "All meta:\n${allmeta.comment}" + + def productcomponents = [:] for (meta in allmeta.metacollection) { - echo meta.componentversionuniqueidentifier() + def key = meta.componentidentifier() + + if (!productcomponents.containsKey(key)) { + productcomponents[key] = [:] + } + def buildstampnumber = meta.releasetag() + if (!productcomponents[key].containsKey(buildstampnumber)) { + productcomponents[key][buildstampnumber] = 1 + } else { + productcomponents[key][buildstampnumber] += 1 + } + } + for (pc in productcomponents.keySet()) { + bsns = productcomponents[pc] + if (bsns.size() > 1) { + results.good = false + results.comment += "There is more than one version of Product component: ${pc} being used in this build:\n" + for (bsn in bsns.keySet()) { + comment += "${bsn}\n" + } + } } return results } From 670ade815d6c24488e83fe6bbdab779abd399e5d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 16:00:24 +0000 Subject: [PATCH 1540/1971] Add a new meta walker and test it --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ced61c3..c7ea7e3 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -853,7 +853,7 @@ class MetaInfo extends GISJsonSerialised { 'comment': comment ] results.metacollection.add(this) - results.comment += ''.padRight(level) + componentversionuniqueidentifier() + '\n' + results.comment += ''.padRight(level) + releasetag() + '\n' for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta results = othermeta.walkrelated(results.metacollection, results.comment, level + 1) From 7aa361b93dd156f682802b4b94e3e8fdde77d8ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 16:04:58 +0000 Subject: [PATCH 1541/1971] Add a new meta walker and test it --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index c7ea7e3..9672294 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -853,7 +853,7 @@ class MetaInfo extends GISJsonSerialised { 'comment': comment ] results.metacollection.add(this) - results.comment += ''.padRight(level) + releasetag() + '\n' + results.comment += ''.padRight(level) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta results = othermeta.walkrelated(results.metacollection, results.comment, level + 1) From ee7c6e95de11d89c8e87bcf9b137a20b645bdee1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 16:09:38 +0000 Subject: [PATCH 1542/1971] Add a new meta walker and test it --- build/integrity.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/build/integrity.groovy b/build/integrity.groovy index 161c503..739abce 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -23,6 +23,7 @@ def check(buildmeta) { productcomponents[key][buildstampnumber] += 1 } } + echo productcomponents.toString() for (pc in productcomponents.keySet()) { bsns = productcomponents[pc] if (bsns.size() > 1) { From 0073dc73bc7249e71e40005a7674ee508a0884ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 16:17:06 +0000 Subject: [PATCH 1543/1971] Add a new meta walker and test it --- build/integrity.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index 739abce..fa7594f 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -1,4 +1,5 @@ - +import static groovy.json.JsonOutput.* + def check(buildmeta) { def results = [ 'good': true, @@ -23,7 +24,7 @@ def check(buildmeta) { productcomponents[key][buildstampnumber] += 1 } } - echo productcomponents.toString() + echo prettyPrint(toJson(productcomponents)) for (pc in productcomponents.keySet()) { bsns = productcomponents[pc] if (bsns.size() > 1) { From 0f9d832f5c93ab50b73a32beda61a1e877b353ff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 16:31:50 +0000 Subject: [PATCH 1544/1971] Add a new meta walker and test it --- build/integrity.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index fa7594f..73d5d46 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -31,7 +31,7 @@ def check(buildmeta) { results.good = false results.comment += "There is more than one version of Product component: ${pc} being used in this build:\n" for (bsn in bsns.keySet()) { - comment += "${bsn}\n" + results.comment += "${bsn}\n" } } } From fe46dfeee60b3c95c6e2adf24d22ca4031fcff36 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 17:16:29 +0000 Subject: [PATCH 1545/1971] Add a new meta walker and test it --- autobuilder.groovy | 2 +- meta/folder.groovy | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/autobuilder.groovy b/autobuilder.groovy index 1a071e5..667f89a 100644 --- a/autobuilder.groovy +++ b/autobuilder.groovy @@ -78,7 +78,7 @@ def setupmeta(script, String productname, String subcomponentname, String produc now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC')) meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString()) for (p in params) { - meta.jenkinsbuildinfo.addParameter(p.key, p.value.toString()) + meta.jenkinsbuildinfo.addParameter(p.key, p.value) } return meta } diff --git a/meta/folder.groovy b/meta/folder.groovy index 9672294..46622cb 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -148,25 +148,29 @@ class JenkinsBuildParameter extends GISJsonSerialised { private String name private String value - JenkinsBuildParameter(script, String name = '', String value = '') { + JenkinsBuildParameter(script, String name = '', String valuetype = '', String value = '') { super(script) this.name = name + this.valuetype = valuetype this.value = value } - void set(String name, String value) { + void set(String name, String valuetype, String value) { this.name = name + this.valuetype = valuetype this.value = value } void deserialiseJson(rawmeta) { name = rawmeta['name'] + valuetype = rawmeta['valuetype'] value = rawmeta['value'] } LinkedHashMap serialisationdata() { def data = [ 'name' : name, + 'valuetype' : valuetype, 'value' : value, ] return data @@ -207,8 +211,8 @@ class JenkinsBuildInfo extends GISJsonSerialised { return isfullbuild } - void addParameter(String name, String value) { - def p = new JenkinsBuildParameter(script, name, value) + void addParameter(String name, value) { + def p = new JenkinsBuildParameter(script, name, value.getClass(), value.toString()) parameters.add(p) return p } From b9b69d2b8f65c071b190a6cdf75eb7b9cbb606c7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 17:22:58 +0000 Subject: [PATCH 1546/1971] Add a new meta walker and test it --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 46622cb..b59e284 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -212,7 +212,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { } void addParameter(String name, value) { - def p = new JenkinsBuildParameter(script, name, value.getClass(), value.toString()) + def p = new JenkinsBuildParameter(script, name, value.getClass().toString(), value.toString()) parameters.add(p) return p } From 00857de6c601e5600da200fc161ea9b9073e7329 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 17:24:35 +0000 Subject: [PATCH 1547/1971] Add a new meta walker and test it --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index b59e284..ae772c5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -146,6 +146,7 @@ class GitInfo extends GISJsonSerialised { class JenkinsBuildParameter extends GISJsonSerialised { private String name + private String valuetype private String value JenkinsBuildParameter(script, String name = '', String valuetype = '', String value = '') { From 0c80b055fa60b072cd192fc392eb297781a850e9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 20:36:54 +0000 Subject: [PATCH 1548/1971] Do build integrity check and post build actions --- check/build_meta.groovy | 2 +- copy/all.groovy | 2 +- copy/esw.groovy | 2 +- copy/logic.groovy | 2 +- differences/metahierarchy.groovy | 2 +- documentation/doxygen_deploy.groovy | 2 +- publish/package.groovy | 2 +- publish/promptingpublish.groovy | 2 +- publish/publish.groovy | 2 +- release/release.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/check/build_meta.groovy b/check/build_meta.groovy index 34eed98..6e669bc 100644 --- a/check/build_meta.groovy +++ b/check/build_meta.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/all.groovy b/copy/all.groovy index b7c4607..6d09903 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/esw.groovy b/copy/esw.groovy index 2a63171..0a5a804 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/logic.groovy b/copy/logic.groovy index 43ebd9c..8092220 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 4bcdcdc..10b24a0 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 6642256..5054c02 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/package.groovy b/publish/package.groovy index 3bd9565..958a614 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 21de708..9d51915 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/publish.groovy b/publish/publish.groovy index 7beb134..82a32ad 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/release/release.groovy b/release/release.groovy index 4220f3b..351985d 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index f0e5b80..f3213d9 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index bdc6a2a..5ffa681 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { From 52987df69618da7ba697641392fbb1ae8fcd7281 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 20:49:19 +0000 Subject: [PATCH 1549/1971] Remove redundant escapes --- copy/esw.groovy | 2 +- copy/filtered.groovy | 2 +- copy/logic.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/copy/esw.groovy b/copy/esw.groovy index 0a5a804..c6c0147 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -41,7 +41,7 @@ pipeline { rm -v -rf meta mv -v "${ESW}"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index feaa2ab..7fd87b6 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -48,7 +48,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["filtered/**"]) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 8092220..9585f01 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -43,7 +43,7 @@ pipeline { rm -v -rf diff mv -v "logic"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index f3213d9..5a7c6f5 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -97,7 +97,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 6f3a33f..5a77cab 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -129,7 +129,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 5ffa681..9455b0b 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -91,7 +91,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } From 10a79af9cea9ff860495b1b87851bb18b346cf7e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 20:52:03 +0000 Subject: [PATCH 1550/1971] Remove redundant escapes --- copy/esw.groovy | 2 +- copy/filtered.groovy | 2 +- copy/logic.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/copy/esw.groovy b/copy/esw.groovy index 2a63171..f53e0fe 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -41,7 +41,7 @@ pipeline { rm -v -rf meta mv -v "${ESW}"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index feaa2ab..7fd87b6 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -48,7 +48,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["filtered/**"]) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 43ebd9c..b880046 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -43,7 +43,7 @@ pipeline { rm -v -rf diff mv -v "logic"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index f0e5b80..68afa48 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -97,7 +97,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 6f3a33f..5a77cab 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -129,7 +129,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index bdc6a2a..46744f7 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -91,7 +91,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } From 11757204e472ff49591914c44a71ade50d8f33a5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 20:52:53 +0000 Subject: [PATCH 1551/1971] Remove redundant escapes --- check/build_meta.groovy | 2 +- copy/all.groovy | 2 +- copy/esw.groovy | 2 +- copy/logic.groovy | 2 +- differences/metahierarchy.groovy | 2 +- documentation/doxygen_deploy.groovy | 2 +- publish/package.groovy | 2 +- publish/promptingpublish.groovy | 2 +- publish/publish.groovy | 2 +- release/release.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/check/build_meta.groovy b/check/build_meta.groovy index 34eed98..6e669bc 100644 --- a/check/build_meta.groovy +++ b/check/build_meta.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/all.groovy b/copy/all.groovy index b7c4607..6d09903 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/esw.groovy b/copy/esw.groovy index f53e0fe..c6c0147 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/logic.groovy b/copy/logic.groovy index b880046..9585f01 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 4bcdcdc..10b24a0 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 6642256..5054c02 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/package.groovy b/publish/package.groovy index 3bd9565..958a614 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 21de708..9d51915 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/publish.groovy b/publish/publish.groovy index 7beb134..82a32ad 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/release/release.groovy b/release/release.groovy index 4220f3b..351985d 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 68afa48..5a7c6f5 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 46744f7..9455b0b 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { From 36c56b19de9a5fa441bf2c2d565b99c9494ab2af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 20:54:31 +0000 Subject: [PATCH 1552/1971] Remove redundant escapes --- check/build_meta.groovy | 2 +- copy/all.groovy | 2 +- copy/esw.groovy | 2 +- copy/logic.groovy | 2 +- differences/metahierarchy.groovy | 2 +- documentation/doxygen_deploy.groovy | 2 +- publish/package.groovy | 2 +- publish/promptingpublish.groovy | 2 +- publish/publish.groovy | 2 +- release/release.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/check/build_meta.groovy b/check/build_meta.groovy index 34eed98..6e669bc 100644 --- a/check/build_meta.groovy +++ b/check/build_meta.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/all.groovy b/copy/all.groovy index b7c4607..6d09903 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/esw.groovy b/copy/esw.groovy index 2a63171..0a5a804 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/logic.groovy b/copy/logic.groovy index 43ebd9c..8092220 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 4bcdcdc..10b24a0 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 6642256..5054c02 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/package.groovy b/publish/package.groovy index 3bd9565..958a614 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 21de708..9d51915 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/publish.groovy b/publish/publish.groovy index 7beb134..82a32ad 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/release/release.groovy b/release/release.groovy index 4220f3b..351985d 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index f0e5b80..f3213d9 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index bdc6a2a..5ffa681 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { From 8e99ad23001937e409e9fbcce189f5ca713230d5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 20:54:55 +0000 Subject: [PATCH 1553/1971] Remove redundant escapes --- copy/esw.groovy | 2 +- copy/filtered.groovy | 2 +- copy/logic.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/copy/esw.groovy b/copy/esw.groovy index 0a5a804..c6c0147 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -41,7 +41,7 @@ pipeline { rm -v -rf meta mv -v "${ESW}"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index feaa2ab..7fd87b6 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -48,7 +48,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["filtered/**"]) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 8092220..9585f01 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -43,7 +43,7 @@ pipeline { rm -v -rf diff mv -v "logic"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index f3213d9..5a7c6f5 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -97,7 +97,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 6f3a33f..5a77cab 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -129,7 +129,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 5ffa681..9455b0b 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -91,7 +91,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } From 3b0b793fcb9751e6894aec15d9673682341276f6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 20:55:54 +0000 Subject: [PATCH 1554/1971] Remove redundant escapes --- copy/esw.groovy | 2 +- copy/filtered.groovy | 2 +- copy/logic.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/copy/esw.groovy b/copy/esw.groovy index 2a63171..f53e0fe 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -41,7 +41,7 @@ pipeline { rm -v -rf meta mv -v "${ESW}"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index feaa2ab..7fd87b6 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -48,7 +48,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["filtered/**"]) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 43ebd9c..b880046 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -43,7 +43,7 @@ pipeline { rm -v -rf diff mv -v "logic"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index f0e5b80..68afa48 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -97,7 +97,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 6f3a33f..5a77cab 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -129,7 +129,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index bdc6a2a..46744f7 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -91,7 +91,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } From 9b99cb14b21688b49b7b7d8885c1a583d2999fb9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 20:56:05 +0000 Subject: [PATCH 1555/1971] Remove redundant escapes --- check/build_meta.groovy | 2 +- copy/all.groovy | 2 +- copy/esw.groovy | 2 +- copy/logic.groovy | 2 +- differences/metahierarchy.groovy | 2 +- documentation/doxygen_deploy.groovy | 2 +- publish/package.groovy | 2 +- publish/promptingpublish.groovy | 2 +- publish/publish.groovy | 2 +- release/release.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/check/build_meta.groovy b/check/build_meta.groovy index 34eed98..6e669bc 100644 --- a/check/build_meta.groovy +++ b/check/build_meta.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/all.groovy b/copy/all.groovy index b7c4607..6d09903 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/esw.groovy b/copy/esw.groovy index f53e0fe..c6c0147 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/logic.groovy b/copy/logic.groovy index b880046..9585f01 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 4bcdcdc..10b24a0 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 6642256..5054c02 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/package.groovy b/publish/package.groovy index 3bd9565..958a614 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 21de708..9d51915 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/publish.groovy b/publish/publish.groovy index 7beb134..82a32ad 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/release/release.groovy b/release/release.groovy index 4220f3b..351985d 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 68afa48..5a7c6f5 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 46744f7..9455b0b 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { From 118a2e283a4c4883868c432354512246b72585a3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 21:00:21 +0000 Subject: [PATCH 1556/1971] Remove redundant escapes --- copy/esw.groovy | 2 +- copy/filtered.groovy | 2 +- copy/logic.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/copy/esw.groovy b/copy/esw.groovy index 2a63171..f53e0fe 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -41,7 +41,7 @@ pipeline { rm -v -rf meta mv -v "${ESW}"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index feaa2ab..7fd87b6 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -48,7 +48,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["filtered/**"]) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 43ebd9c..b880046 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -43,7 +43,7 @@ pipeline { rm -v -rf diff mv -v "logic"/* . """ - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index f0e5b80..68afa48 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -97,7 +97,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 6f3a33f..5a77cab 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -129,7 +129,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index bdc6a2a..46744f7 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -91,7 +91,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" + archiveArtifacts artifactlist } } } From 58a0ba8ed512048fe8c01cd544cbb8d826185eb8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 6 Nov 2021 21:00:43 +0000 Subject: [PATCH 1557/1971] Remove redundant escapes --- check/build_meta.groovy | 2 +- copy/all.groovy | 2 +- copy/esw.groovy | 2 +- copy/logic.groovy | 2 +- differences/metahierarchy.groovy | 2 +- documentation/doxygen_deploy.groovy | 2 +- publish/package.groovy | 2 +- publish/promptingpublish.groovy | 2 +- publish/publish.groovy | 2 +- release/release.groovy | 2 +- staticanalysis/ccm.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/check/build_meta.groovy b/check/build_meta.groovy index 34eed98..6e669bc 100644 --- a/check/build_meta.groovy +++ b/check/build_meta.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/all.groovy b/copy/all.groovy index b7c4607..6d09903 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/esw.groovy b/copy/esw.groovy index f53e0fe..c6c0147 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/copy/logic.groovy b/copy/logic.groovy index b880046..9585f01 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 4bcdcdc..10b24a0 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 6642256..5054c02 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/package.groovy b/publish/package.groovy index 3bd9565..958a614 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 21de708..9d51915 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/publish/publish.groovy b/publish/publish.groovy index 7beb134..82a32ad 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/release/release.groovy b/release/release.groovy index 4220f3b..351985d 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 68afa48..5a7c6f5 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 46744f7..9455b0b 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label "${AGENT_LABEL}" } + agent { label AGENT_LABEL } stages { stage('Initial setup') { steps { From ad46491fe433740c8945bd2bc7d5494f10402754 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Nov 2021 08:09:49 +0000 Subject: [PATCH 1558/1971] Do build integrity check and post build actions --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ae772c5..98be8c1 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -858,7 +858,7 @@ class MetaInfo extends GISJsonSerialised { 'comment': comment ] results.metacollection.add(this) - results.comment += ''.padRight(level) + globalreleasetag() + '\n' + results.comment += ''.padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta results = othermeta.walkrelated(results.metacollection, results.comment, level + 1) From fa6343607616351f255d865e2481979f2d7b2c68 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 7 Nov 2021 08:35:27 +0000 Subject: [PATCH 1559/1971] Do build integrity check and post build actions --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 98be8c1..3c9f98f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -858,7 +858,7 @@ class MetaInfo extends GISJsonSerialised { 'comment': comment ] results.metacollection.add(this) - results.comment += ''.padRight(level * 4) + globalreleasetag() + '\n' + results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { MetaInfo othermeta = relatedmetainfo.meta results = othermeta.walkrelated(results.metacollection, results.comment, level + 1) From 222a2374d0d3b88b75830f6b97729c382ce9d90c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Nov 2021 12:22:54 +0000 Subject: [PATCH 1560/1971] Move ethernet product script to common scripts area so it can be easily reused --- test/testethernetproduct.groovy | 196 ++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 test/testethernetproduct.groovy diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy new file mode 100644 index 0000000..4cbde8e --- /dev/null +++ b/test/testethernetproduct.groovy @@ -0,0 +1,196 @@ +import jenkins.model.Jenkins + +pipeline { + agent { label AGENT_LABEL } + stages { + stage ("Initial Setup") { + steps{ + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage ("Checkout test environment") { + steps { + script { + toolsimporter = load("${autobuilder.commonscripts()}/configuration/tools.groovy") + + def TEST_ENVIRONMENT_URL = 'git@hydra:gistest/jenkins-ethernet-test-environment.git' + def TEST_ENVIRONMENT_DIR = 'TestEnvironmentDir' + def TEST_ENVIRONMENT_REVISION = 'origin/master' + + def environmentoptions = toolsimporter.getNewToolOptions() + environmentoptions.toolName('Ethernet product test environment') + environmentoptions.toolRepo(TEST_ENVIRONMENT_URL, TEST_SOURCE_REVISION) + toolsimporter.getTool(meta, environmentoptions, TEST_ENVIRONMENT_DIR) + + TEST_ENVIRONMENT_FILE = "${TEST_ENVIRONMENT_DIR}/environment.json" + def alltestenvironment = readJSON(file: "${TEST_ENVIRONMENT_FILE}") + TEST_ENVIRONMENT = alltestenvironment[ETHERNET_PRODUCT_TO_RUN_TEST] + echo "Selected environment:\n${TEST_ENVIRONMENT}" + } + } + } + stage ('Setup') { + agent { label TEST_ENVIRONMENT['FTDI_AGENT'] } + stages { + stage ("Checkout dependencies") { + steps { + script { + def PYTHON_URL = 'git@hydra:tools/python.git' + if (isUnix()) { + PYTHON_REVISION = 'origin/3.6.3_linux' + } + else { + PYTHON_REVISION = 'origin/3.8.10_windows_for_test' + } + PYTHONDIR = "${WORKSPACE}/python" + + def pythonimportoptions = toolsimporter.getNewToolOptions() + pythonimportoptions.toolName('Python') + pythonimportoptions.toolRepo(PYTHON_URL, PYTHON_REVISION) + toolsimporter.getTool(meta, pythonimportoptions, PYTHONDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + + def TEST_SOURCE_URL = 'git@hydra:hmb_regression/hmb_fd_hv_tests.git' + TEST_SUITE_DIR = 'TestSuiteDir' + env.GIS_TEST_SUITE_HOME = "${WORKSPACE}/${TEST_SUITE_DIR}" + + def regressiontestimportoptions = toolsimporter.getNewToolOptions() + regressiontestimportoptions.toolName('Tests') + regressiontestimportoptions.toolRepo(TEST_SOURCE_URL, TEST_SOURCE_REVISION) + toolsimporter.getTool(meta, regressiontestimportoptions, GIS_TEST_SUITE_HOME) + + env.HISTORY_FOLDER = "${WORKSPACE}/testhistory" + + def resultimportoptions = toolsimporter.getNewToolOptions() + resultimportoptions.toolName('Test history') + resultimportoptions.toolRepo(HISTORY_REPO, HISTORY_REVISION) + toolsimporter.getTool(meta, resultimportoptions, HISTORY_FOLDER) + + def CORE_SOURCE_URL = 'git@hydra:gistest/giscorelite.git' + env.GIS_TEST_SUITE_CORE = "${WORKSPACE}/GisCore" + + def coreimportoptions = toolsimporter.getNewToolOptions() + coreimportoptions.toolName('Test core') + coreimportoptions.toolRepo(CORE_SOURCE_URL, CORE_SOURCE_REVISION) + toolsimporter.getTool(meta, coreimportoptions, GIS_TEST_SUITE_CORE) + + def FTDI_SOURCE_URL = 'git@hydra:python_scripts/ftdi_relay.git' + def FTDI_SOURCE_REVISION = 'origin/Core-98' + FTDI_SOURCE_DIR = "${WORKSPACE}/PowerController" + + def ftdiimportoptions = toolsimporter.getNewToolOptions() + ftdiimportoptions.toolName('FTDI relay driver') + ftdiimportoptions.toolRepo(FTDI_SOURCE_URL, FTDI_SOURCE_REVISION) + toolsimporter.getTool(meta, ftdiimportoptions, FTDI_SOURCE_DIR) + + } + } + } + stage ("Import application to test") { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + APPLICATION_UNDER_TEST = 'application_under_test' + env.APPLICATION_ARTIFACT_FOLDER = "${WORKSPACE}/${APPLICATION_UNDER_TEST}" + + def applicationimportoptions = importer.getNewImportOptions() + applicationimportoptions.jenkinsjob(APPLICATION_ARTIFACT_PROJECT, APPLICATION_ARTIFACT_SELECTOR) + applicationimportoptions.setfilter('app_package/**,control_package/**') + applicationmeta = importer.artifactimport(meta, applicationimportoptions, APPLICATION_ARTIFACT_FOLDER) + + meta.productinfo.set(applicationmeta.productinfo) + meta.productinfo.subcomponentname = "${applicationmeta.productinfo.subcomponentname}_TEST" + meta.gitinfo.set(applicationmeta.gitinfo) + meta.buildstampinfo.set(applicationmeta.buildstampinfo) + } + } + } + stage("Clean") { + steps { + script { + LOGGING_ROOT = 'Logging' + env.GIS_TEST_OUTPUT_LOGGING_ROOT = "${WORKSPACE}/${LOGGING_ROOT}" + cleanfolders = [ + GIS_TEST_OUTPUT_LOGGING_ROOT, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage ('Test') { + steps { + script { + lock(TEST_ENVIRONMENT['RESOURCE_LOCK']) { + if (POWER_CYCLE_HARDWARE == 'true') { + dir(FTDI_SOURCE_DIR) { + bat """ + "${PYTHON}" "${FTDI_SOURCE_DIR}/RegressionPower.py" -d ${TEST_ENVIRONMENT['FTDI_RELAY_DEVICE']} -o True + """ + } + } + if (UPDATE_HARDWARE == 'true') { + dir(GIS_TEST_SUITE_CORE) { + bat """ + "${PYTHON}" "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbPackageDeployer.py" -p "${APPLICATION_ARTIFACT_FOLDER}" -t "${TEST_ENVIRONMENT['IP_ADDRESS']}" + """ + rc = bat (script:""" + "${PYTHON}" "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbinspectstate.py" + """, + returnStatus: true) + if (rc == 1) { + unstable('FAILED while inspecting state of hardware') + } + } + } + if (DO_TEST == 'true') { + rc = bat(script:""" + ${PYTHON} "${GIS_TEST_SUITE_CORE}/GISTestMaster.py" -w ${PRODUCT_LOCATION_UNDER_TEST} -fl --include ${TEST_INCLUDE_FILTER} + """, + returnStatus: true + ) + if (rc == 1) { + unstable('FAILED while running tests') + } + } + } + } + } + } + } + } + stage("Archive Test History") { + steps{ + script { + dir(HISTORY_FOLDER) { + rc = bat (script:""" + "${PYTHON}" "GitCyclicPush.py" + """, + returnStatus: true + ) + if (rc == 1) { + unstable('FAILED to process history') + } + } + } + } + } + stage("Archive test artifacts"){ + steps{ + script { + def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) + archiveArtifacts artifactlist + } + } + } + } +} + From 058bfbbc401f54bbf27f6cdf0b86ea1ca9fa4402 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Nov 2021 14:49:06 +0000 Subject: [PATCH 1561/1971] Seperate history processing from results --- test/testethernetproduct.groovy | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index 4cbde8e..7314343 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -90,6 +90,13 @@ pipeline { ftdiimportoptions.toolRepo(FTDI_SOURCE_URL, FTDI_SOURCE_REVISION) toolsimporter.getTool(meta, ftdiimportoptions, FTDI_SOURCE_DIR) + def HISTORY_PROCESSING_REPO = 'git@hydra:python_scripts/hmb_results_history_processing.git' + HISTORY_PROCESSING_DIR = "${WORKSPACE}/HistoryProcessing" + + def resultprocessingoptions = toolsimporter.getNewToolOptions() + resultprocessingoptions.toolName('History processing') + resultprocessingoptions.toolRepo(HISTORY_PROCESSING_REPO, HISTORY_PROCESSING_REVISION) + toolsimporter.getTool(meta, resultprocessingoptions, HISTORY_PROCESSING_DIR) } } } @@ -165,19 +172,19 @@ pipeline { } } } - } - } - stage("Archive Test History") { - steps{ - script { - dir(HISTORY_FOLDER) { - rc = bat (script:""" - "${PYTHON}" "GitCyclicPush.py" - """, - returnStatus: true - ) - if (rc == 1) { - unstable('FAILED to process history') + stage("Archive Test History") { + steps{ + script { + dir(HISTORY_FOLDER) { + rc = bat (script:""" + "${PYTHON}" "${HISTORY_PROCESSING_DIR}/GitCyclicPush.py" + """, + returnStatus: true + ) + if (rc == 1) { + unstable('FAILED to process history') + } + } } } } From df5d9938e24484fe5c6f1975124b28a51834c67b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Nov 2021 14:57:27 +0000 Subject: [PATCH 1562/1971] Seperate history processing from results --- test/testethernetproduct.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index 7314343..21f89db 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -90,7 +90,7 @@ pipeline { ftdiimportoptions.toolRepo(FTDI_SOURCE_URL, FTDI_SOURCE_REVISION) toolsimporter.getTool(meta, ftdiimportoptions, FTDI_SOURCE_DIR) - def HISTORY_PROCESSING_REPO = 'git@hydra:python_scripts/hmb_results_history_processing.git' + def HISTORY_PROCESSING_REPO = 'git@hydra:gistestresults/ethernet-products-history-processing.git' HISTORY_PROCESSING_DIR = "${WORKSPACE}/HistoryProcessing" def resultprocessingoptions = toolsimporter.getNewToolOptions() From c6d435c1570a73abb4d7021178195f24eaa17b00 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Nov 2021 15:33:55 +0000 Subject: [PATCH 1563/1971] Change name of repo as its current name is misleading --- test/testethernetproduct.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index 21f89db..564fd5b 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -57,7 +57,7 @@ pipeline { env.PYTHON = "${PYTHONDIR}/ver/python.exe" } - def TEST_SOURCE_URL = 'git@hydra:hmb_regression/hmb_fd_hv_tests.git' + def TEST_SOURCE_URL = 'git@hydra:hmb_regression/hmb_tests.git' TEST_SUITE_DIR = 'TestSuiteDir' env.GIS_TEST_SUITE_HOME = "${WORKSPACE}/${TEST_SUITE_DIR}" From a14d8b94b7519f7340e4b2deda7497c0048eda35 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Nov 2021 18:14:32 +0000 Subject: [PATCH 1564/1971] Submit logging artifacts in the relevant agent environment --- test/testethernetproduct.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index 564fd5b..bcea28a 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -189,12 +189,12 @@ pipeline { } } } - } - stage("Archive test artifacts"){ - steps{ - script { - def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) - archiveArtifacts artifactlist + stage("Archive test artifacts"){ + steps{ + script { + def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) + archiveArtifacts artifactlist + } } } } From bc6a637c5907ab534d9a220268aa56676be07d17 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 8 Nov 2021 18:17:12 +0000 Subject: [PATCH 1565/1971] Submit logging artifacts in the relevant agent environment --- test/testethernetproduct.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index bcea28a..92d6414 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -188,12 +188,12 @@ pipeline { } } } - } - stage("Archive test artifacts"){ - steps{ - script { - def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) - archiveArtifacts artifactlist + stage("Archive test artifacts"){ + steps{ + script { + def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) + archiveArtifacts artifactlist + } } } } From e8ea9a29325af9f421560eefb97dc540a0fac420 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Nov 2021 12:07:09 +0000 Subject: [PATCH 1566/1971] Perform a deep copy of version objects --- meta/folder.groovy | 16 ++++++++++++++++ versionnumbering/generate.groovy | 8 ++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 3c9f98f..aee84f6 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -108,6 +108,15 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } + GitInfo(GitInfo another) { + super(another.script) + this.sourcepath = another.sourcepath + this.sourcerevision = another.sourcerevision + this.gitrevision = another.gitrevision + this.remoteurl = another.remoteurl + this.remoteinfo = another.remoteinfo + } + void set(String sourcepath, String sourcerevision, String gitrevision, String remoteurl, String remoteinfo) { this.sourcepath = sourcepath this.sourcerevision = sourcerevision @@ -267,6 +276,13 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstamp = buildstamp } + BuildStampInfo(BuildStampInfo another) { + super(another.script) + this.buildstampprefix = another.buildstampprefix + this.revision = another.revision + this.buildstamp = another.buildstamp + } + void set(String buildstampprefix, int revision, String buildstamp) { this.buildstampprefix = buildstampprefix this.revision = revision diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 405b7be..a1ab40f 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -160,8 +160,12 @@ String generate(meta, String sourcerevision, String sourcepath, String basebuild } String copyfrom(meta, othermeta) { - meta.gitinfo = othermeta.gitinfo - meta.buildstampinfo = othermeta.buildstampinfo + // Deep copy + def newgitinfo = othermeta.gitinfo.getClass().newInstance(othermeta.gitinfo) + def newbuildstampinfo = othermeta.buildstampinfo.getClass().newInstance(othermeta.buildstampinfo) + + meta.gitinfo = newgitinfo + meta.buildstampinfo = newbuildstampinfo return meta.buildstampinfo.buildstamp } From b6c8034e227213a6b66617bbcd94718e01aa6571 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Nov 2021 15:08:56 +0000 Subject: [PATCH 1567/1971] Perform a deep copy of version objects --- versionnumbering/generate.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index a1ab40f..3c087c4 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -161,8 +161,8 @@ String generate(meta, String sourcerevision, String sourcepath, String basebuild String copyfrom(meta, othermeta) { // Deep copy - def newgitinfo = othermeta.gitinfo.getClass().newInstance(othermeta.gitinfo) - def newbuildstampinfo = othermeta.buildstampinfo.getClass().newInstance(othermeta.buildstampinfo) + def newgitinfo = othermeta.gitinfo.getClass().newInstance([othermeta.gitinfo]) + def newbuildstampinfo = othermeta.buildstampinfo.getClass().newInstance([othermeta.buildstampinfo]) meta.gitinfo = newgitinfo meta.buildstampinfo = newbuildstampinfo From 1bf6056e6c08c9143a25f05e5f13ec0ad0daf1e1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Nov 2021 16:55:51 +0000 Subject: [PATCH 1568/1971] Perform a deep copy of version objects --- versionnumbering/generate.groovy | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 3c087c4..6e0db11 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -161,11 +161,8 @@ String generate(meta, String sourcerevision, String sourcepath, String basebuild String copyfrom(meta, othermeta) { // Deep copy - def newgitinfo = othermeta.gitinfo.getClass().newInstance([othermeta.gitinfo]) - def newbuildstampinfo = othermeta.buildstampinfo.getClass().newInstance([othermeta.buildstampinfo]) - - meta.gitinfo = newgitinfo - meta.buildstampinfo = newbuildstampinfo + meta.gitinfo.set(othermeta.gitinfo.sourcepath, othermeta.gitinfo.sourcerevision, othermeta.gitinfo.gitrevision, othermeta.gitinfo.remoteurl, othermeta.gitinfo.remoteinfo) + meta.buildstampinfo.set(othermeta.buildstampinfo.buildstampprefix, othermeta.buildstampinfo.revision, othermeta.buildstampinfo.buildstamp) return meta.buildstampinfo.buildstamp } From ec0b7d77d8ccf21ded0427add902cad5b0b0c709 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 12 Nov 2021 13:17:14 +0000 Subject: [PATCH 1569/1971] Use the version of print server that atlas services is using - so that there are less build configuration issues --- meta/folder.groovy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index aee84f6..a084220 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -890,6 +890,23 @@ class MetaInfo extends GISJsonSerialised { MetaInfo getNewMetaObject(script) { return new MetaInfo(script) } + + def findAssociatedMeta(String productname, String subcomponentname) { + def results = [ + 'matchedmeta' : getNewMetaObject(this), + 'matchfound' : false + ] + def results = allrelatedmeta() + for (dependentmeta in results.metacollection) { + if (dependentmeta.productinfo.productname == productname && + dependentmeta.productinfo.subcomponentname == componentname) { + results.matchedmeta = dependentmeta + results.matchfound = true + break + } + } + return results + } } MetaInfo metareset(script) { From 904f3c4c6dc419ae1b5adc451788995d17f0ee51 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 12 Nov 2021 13:19:52 +0000 Subject: [PATCH 1570/1971] Use the version of print server that atlas services is using - so that there are less build configuration issues --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a084220..884c8c4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -896,8 +896,8 @@ class MetaInfo extends GISJsonSerialised { 'matchedmeta' : getNewMetaObject(this), 'matchfound' : false ] - def results = allrelatedmeta() - for (dependentmeta in results.metacollection) { + def walkresults = allrelatedmeta() + for (dependentmeta in walkresults.metacollection) { if (dependentmeta.productinfo.productname == productname && dependentmeta.productinfo.subcomponentname == componentname) { results.matchedmeta = dependentmeta From 458a2e2b19b5ae93e097cc2d57d21adee255c13a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 12 Nov 2021 13:26:08 +0000 Subject: [PATCH 1571/1971] Use the version of print server that atlas services is using - so that there are less build configuration issues --- import/importer.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 8624421..4d0b313 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -276,7 +276,7 @@ def artifactimport(meta, 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() + def importoptions = importer.getNewImportOptions() importoptions.source(sourceselect, jenkinsjob, buildnumberorselector, repo, revision) importoptions.setincrementversionnumber(incrementversionnumber) @@ -298,7 +298,7 @@ def artifactimport(meta, String excludes = '', boolean fingerprint = false) { echo "DEPRECATED method: artifactimport(meta, String buildjob, int buildnumber, String destpath, ...)" - def importoptions = getNewImportOptions() + def importoptions = importer.getNewImportOptions() importoptions.jenkinsjob(buildjob, " ${buildnumber}") importoptions.setincrementversionnumber(incrementversionnumber) @@ -319,7 +319,7 @@ def artifactimport(meta, String excludes = '', boolean fingerprint = false) { echo "DEPRECATED method: artifactimport(meta, String buildjob, buildnumberorselector, String destpath, ...)" - def importoptions = getNewImportOptions() + def importoptions = importer.getNewImportOptions() importoptions.jenkinsjob(buildjob, buildnumberorselector) importoptions.setincrementversionnumber(incrementversionnumber) From 68422e3026aa24872feced8fcb4303553aee961c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 12 Nov 2021 13:28:30 +0000 Subject: [PATCH 1572/1971] Use the version of print server that atlas services is using - so that there are less build configuration issues --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 884c8c4..a908ab1 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -899,7 +899,7 @@ class MetaInfo extends GISJsonSerialised { def walkresults = allrelatedmeta() for (dependentmeta in walkresults.metacollection) { if (dependentmeta.productinfo.productname == productname && - dependentmeta.productinfo.subcomponentname == componentname) { + dependentmeta.productinfo.subcomponentname == subcomponentname) { results.matchedmeta = dependentmeta results.matchfound = true break From 6a8d736299a7ce65d84d70fb16b525327e6f806f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 12 Nov 2021 13:33:49 +0000 Subject: [PATCH 1573/1971] Use the version of print server that atlas services is using - so that there are less build configuration issues --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index a908ab1..694a40c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -900,6 +900,7 @@ class MetaInfo extends GISJsonSerialised { for (dependentmeta in walkresults.metacollection) { if (dependentmeta.productinfo.productname == productname && dependentmeta.productinfo.subcomponentname == subcomponentname) { + script.echo("Found matching component: ${dependentmeta.globalreleasetag()}") results.matchedmeta = dependentmeta results.matchfound = true break From 5ee449e22b1f9f4a2e63249745c47afc68f90224 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 00:02:28 +0000 Subject: [PATCH 1574/1971] Handle different types of build selector parameter --- import/importer.groovy | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 4d0b313..9820ab1 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -96,9 +96,18 @@ class ImportOptions { m_appendtoparentmeta = appendtoparentmeta } - void jenkinsjob(String jobname, String buildnumberorselector) { + void jenkinsjob(String jobname, buildnumberorselector) { m_jobname = jobname.trim() - m_buildnumberorselector = buildnumberorselector.trim() + m_buildnumberorselector = [ + $class: 'ParameterizedBuildSelector', + parameterName: buildnumberorselector + ] + setsourceselect('Jenkins job artifact') + } + + void jenkinsjob(String jobname, int buildnumberorselector) { + m_jobname = jobname.trim() + m_buildnumberorselector = specific("${buildnumberorselector}") setsourceselect('Jenkins job artifact') } @@ -147,15 +156,14 @@ def artifactimportfrombuildjob(meta, importoptions, String destpath) { conditionalClean(importoptions, destpath) + echo "Build selector type: ${importoptions.m_buildnumberorselector.getClass()}" + copyArtifacts( filter: formFilter(importoptions), excludes: importoptions.m_excludes, fingerprintArtifacts: importoptions.m_fingerprint, projectName: importoptions.m_jobname, - selector: [ - $class: 'ParameterizedBuildSelector', - parameterName: importoptions.m_buildnumberorselector - ], + selector: importoptions.m_buildnumberorselector, flatten: importoptions.m_flatten, target: destpath ) From ec9f9e9d474958c0f8af3235be8158f83b73ff1f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 00:24:12 +0000 Subject: [PATCH 1575/1971] Handle different types of build selector parameter --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 9820ab1..d90bafd 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -107,7 +107,7 @@ class ImportOptions { void jenkinsjob(String jobname, int buildnumberorselector) { m_jobname = jobname.trim() - m_buildnumberorselector = specific("${buildnumberorselector}") + m_buildnumberorselector = specific(buildnumberorselector.toString()) setsourceselect('Jenkins job artifact') } From fe32259717702bb65cf1e8e3fd4f3944cf1ffdcf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 00:30:44 +0000 Subject: [PATCH 1576/1971] Handle different types of build selector parameter --- import/importer.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index d90bafd..818f0b7 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -107,7 +107,10 @@ class ImportOptions { void jenkinsjob(String jobname, int buildnumberorselector) { m_jobname = jobname.trim() - m_buildnumberorselector = specific(buildnumberorselector.toString()) + m_buildnumberorselector = [ + $class: 'ParameterizedBuildSelector', + parameterName: "${buildnumberorselector}" + ] setsourceselect('Jenkins job artifact') } From 7db1c3a4b18faf509712e5ae3cd3face1435b10e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 09:52:48 +0000 Subject: [PATCH 1577/1971] Add a diff post build action --- build/postactions.groovy | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 48ca297..1619a8f 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -1,5 +1,6 @@ def performSuccessfulBuildActions() { + def String buildselector = "${BUILD_NUMBER}" if (params.DOXYGEN_DEPLOY_JOB != null) { if (DOXYGEN_DEPLOY_JOB && Jenkins.instance.getItemByFullName(DOXYGEN_DEPLOY_JOB).isBuildable()) { build( @@ -7,7 +8,7 @@ def performSuccessfulBuildActions() { job: DOXYGEN_DEPLOY_JOB, parameters: [ string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME), - string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: " ${BUILD_NUMBER}"), + string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: buildselector), ] ) } @@ -19,7 +20,7 @@ def performSuccessfulBuildActions() { job: STATIC_ANALYSIS_JOB, parameters: [ string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), ] ) } @@ -31,7 +32,7 @@ def performSuccessfulBuildActions() { job: UNIT_TEST_JOB, parameters: [ string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), ] ) } @@ -43,7 +44,20 @@ def performSuccessfulBuildActions() { job: REGRESSION_TEST_JOB, parameters: [ string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: " ${BUILD_NUMBER}"), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector, + ] + ) + } + } + if (params.DIFF_JOB != null) { + if (DIFF_JOB && Jenkins.instance.getItemByFullName(DIFF_JOB).isBuildable()) { + build( + wait: false, + job: DIFF_JOB, + parameters: [ + string(name: 'LATER_SOURCE', 'Jenkins job artifact'), + string(name: 'LATER_BUILD_JOB', value: JOB_NAME), + string(name: 'LATER_BUILD_SELECTOR', value: buildselector), ] ) } @@ -55,7 +69,7 @@ def performSuccessfulBuildActions() { job: RELEASE_TO_GIT_JOB, parameters: [ string(name: 'BUILD_JOB', value: JOB_NAME), - string(name: 'BUILD_JOB_SELECTOR', value: " ${BUILD_NUMBER}"), + string(name: 'BUILD_JOB_SELECTOR', value: buildselector), ] ) } From c87c3bbb94eddf9070107444bf9c8e85b759ef4e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 11:29:12 +0000 Subject: [PATCH 1578/1971] Add a diff post build action --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 1619a8f..4059da7 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -44,7 +44,7 @@ def performSuccessfulBuildActions() { job: REGRESSION_TEST_JOB, parameters: [ string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector, + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), ] ) } From a86ca86b3ee55a2c08c5e76f83618f1c69615899 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 11:59:15 +0000 Subject: [PATCH 1579/1971] Update parameter usage on git checkout --- versioncontrol/git.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 50f4025..a22054b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -194,14 +194,14 @@ def docheckout(String gitURL, String revision, int cloneDepth, String reporootpa branches: [ [name: revision] ], - doGenerateSubmoduleConfigurations: false, extensions: [ - [$class: 'GitLFSPull',timeout: 25], - [$class: 'CleanBeforeCheckout',timeout: 20], + [$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)], + [$class: 'PruneStaleBranch'], ], submoduleCfg: [], ]) From 0ac129bc90340112a32bafcc65578b0b3d6820f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 15:48:55 +0000 Subject: [PATCH 1580/1971] Resurrect ccm --- staticanalysis/ccm.groovy | 46 ++++++++++----------------------------- 1 file changed, 11 insertions(+), 35 deletions(-) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 5a7c6f5..0be80fa 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -13,12 +13,6 @@ pipeline { 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" @@ -41,9 +35,9 @@ pipeline { stage("Clean exports") { steps { script { - STATICANALYSIS = 'staticanalysis' + RESULTS = 'results' cleanfolders = [ - STATICANALYSIS, + RESULTS, ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -61,18 +55,19 @@ pipeline { stage('Static analysis') { steps { script { - def CCMOLDER = "${STATICANALYSIS}/ccm" - dir(CCMOLDER) { - echo "Executing: ${CCM} ${SRC} /xml /nummetrics=100 > ccm.xml" + def ccmconfigurationfile = "${WORKSPACE}/ccm.xml" + writeFile(file: ccmconfigurationfile, text: CCM_CONFIGURATION) + echo "Configuration file: ${ccmconfigurationfile} contains:\n${CCM_CONFIGURATION}" + + dir(RESULTS) { + echo "Executing: ${CCM} ${ccmconfigurationfile} > 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 + ${CCM}" "${ccmconfigurationfile}" > ccm.xml """ } else { - bat """ - "${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml + powershell """ + "${CCM}" "${ccmconfigurationfile}" > ccm.xml """ } } @@ -82,25 +77,6 @@ pipeline { } } } - 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 { From ca5436bfafa668911f63ad84faac4924c7332fba Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 15:57:15 +0000 Subject: [PATCH 1581/1971] Resurrect ccm --- staticanalysis/ccm.groovy | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 0be80fa..6fa2b82 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -24,11 +24,8 @@ pipeline { 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}" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCE_REVISION, SOURCEDIR, '', 0, false) } } } @@ -44,14 +41,6 @@ pipeline { } } } - 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 { From 5d8860f95166872aa9afd1a43dadea04764d9042 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 16:18:59 +0000 Subject: [PATCH 1582/1971] Resurrect ccm --- staticanalysis/ccm.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 6fa2b82..46e0dac 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -55,7 +55,7 @@ pipeline { ${CCM}" "${ccmconfigurationfile}" > ccm.xml """ } else { - powershell """ + bat """ "${CCM}" "${ccmconfigurationfile}" > ccm.xml """ } From 2d3aa7f462b54d1807f744d10274515f1be98843 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 16:47:01 +0000 Subject: [PATCH 1583/1971] Resurrect ccm --- staticanalysis/ccm.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy index 46e0dac..ae91cb0 100644 --- a/staticanalysis/ccm.groovy +++ b/staticanalysis/ccm.groovy @@ -55,8 +55,9 @@ pipeline { ${CCM}" "${ccmconfigurationfile}" > ccm.xml """ } else { + echo "Executing: ${WINDOWS_COMMANDLINE_ENVIRONMENT} \"${CCM}\" \"${ccmconfigurationfile}\" > ccm.xml" bat """ - "${CCM}" "${ccmconfigurationfile}" > ccm.xml + ${WINDOWS_COMMANDLINE_ENVIRONMENT} "${CCM}" "${ccmconfigurationfile}" > ccm.xml """ } } From b04f5b063300d7fd0d8089ca7c41c87b63247c23 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 13 Nov 2021 18:33:23 +0000 Subject: [PATCH 1584/1971] Add a diff post build action --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 4059da7..90fcc15 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -55,7 +55,7 @@ def performSuccessfulBuildActions() { wait: false, job: DIFF_JOB, parameters: [ - string(name: 'LATER_SOURCE', 'Jenkins job artifact'), + string(name: 'LATER_SOURCE', value: 'Jenkins job artifact'), string(name: 'LATER_BUILD_JOB', value: JOB_NAME), string(name: 'LATER_BUILD_SELECTOR', value: buildselector), ] From 92e165bdc53fddffa4e338bd46886371aa154837 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 14 Nov 2021 16:44:23 +0000 Subject: [PATCH 1585/1971] Check for product components using the same release git url --- build/integrity.groovy | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index 73d5d46..7c0f66f 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -10,6 +10,7 @@ def check(buildmeta) { def allmeta = buildmeta.allrelatedmeta() echo "All meta:\n${allmeta.comment}" + // Store build stamps associated with each product component; Store a counter against each product component version def productcomponents = [:] for (meta in allmeta.metacollection) { def key = meta.componentidentifier() @@ -24,9 +25,13 @@ def check(buildmeta) { productcomponents[key][buildstampnumber] += 1 } } + + // Show what was collected echo prettyPrint(toJson(productcomponents)) + + // Look for product components with more than one build stamp for (pc in productcomponents.keySet()) { - bsns = productcomponents[pc] + def bsns = productcomponents[pc] if (bsns.size() > 1) { results.good = false results.comment += "There is more than one version of Product component: ${pc} being used in this build:\n" @@ -35,6 +40,38 @@ def check(buildmeta) { } } } + + // Store product components associated with each release git url + def releasegiturls = [:] + for (meta in allmeta.metacollection) { + def key = meta.gitinfo.remoteurl + + if (!releasegiturls.containsKey(key)) { + releasegiturls[key] = [:] + } + def componentidentifier = meta.componentidentifier() + if (!releasegiturls[key].containsKey(componentidentifier)) { + releasegiturls[key][componentidentifier] = 1 + } else { + releasegiturls[key][componentidentifier] += 1 + } + } + + // Show what was collected + echo prettyPrint(toJson(releasegiturls)) + + // Look for product components with more than one build stamp + for (rgu in releasegiturls.keySet()) { + def cis = releasegiturls[rgu] + if (cis.size() > 1) { + results.good = false + results.comment += "There is more than one product component associated with a release git url: ${rgu} being used in this build:\n" + for (ci in cis.keySet()) { + results.comment += "${ci}\n" + } + } + } + return results } From c8373c6f8917bf82f305155342daa1bc07f4cd09 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 14 Nov 2021 17:23:08 +0000 Subject: [PATCH 1586/1971] Check for product components using the same release git url --- build/integrity.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index 7c0f66f..435e0e8 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -44,7 +44,7 @@ def check(buildmeta) { // Store product components associated with each release git url def releasegiturls = [:] for (meta in allmeta.metacollection) { - def key = meta.gitinfo.remoteurl + def key = meta.releaseinfo.releaserepoURL if (!releasegiturls.containsKey(key)) { releasegiturls[key] = [:] From 3d2a10386fd57d4bcc1c20e2410fe30328e54588 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 14 Nov 2021 18:07:06 +0000 Subject: [PATCH 1587/1971] Check for product components using the same release git url --- build/integrity.groovy | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index 435e0e8..51370e4 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -44,16 +44,18 @@ def check(buildmeta) { // Store product components associated with each release git url def releasegiturls = [:] for (meta in allmeta.metacollection) { - def key = meta.releaseinfo.releaserepoURL + def String key = meta.releaseinfo.releaserepoURL - if (!releasegiturls.containsKey(key)) { - releasegiturls[key] = [:] - } - def componentidentifier = meta.componentidentifier() - if (!releasegiturls[key].containsKey(componentidentifier)) { - releasegiturls[key][componentidentifier] = 1 - } else { - releasegiturls[key][componentidentifier] += 1 + if (key) { + if (!releasegiturls.containsKey(key)) { + releasegiturls[key] = [:] + } + def componentidentifier = meta.componentidentifier() + if (!releasegiturls[key].containsKey(componentidentifier)) { + releasegiturls[key][componentidentifier] = 1 + } else { + releasegiturls[key][componentidentifier] += 1 + } } } From ee2348896d154396249528fe697bbeb6e5caeb78 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 14 Nov 2021 18:51:50 +0000 Subject: [PATCH 1588/1971] Check for more than one commit associated with source git urls --- build/integrity.groovy | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/build/integrity.groovy b/build/integrity.groovy index 51370e4..e93c00f 100644 --- a/build/integrity.groovy +++ b/build/integrity.groovy @@ -62,7 +62,7 @@ def check(buildmeta) { // Show what was collected echo prettyPrint(toJson(releasegiturls)) - // Look for product components with more than one build stamp + // Look for release git urls being used by more than one product component for (rgu in releasegiturls.keySet()) { def cis = releasegiturls[rgu] if (cis.size() > 1) { @@ -74,6 +74,39 @@ def check(buildmeta) { } } + // Store git commit shas associated with each source git url + def sourcegiturls = [:] + for (meta in allmeta.metacollection) { + def String key = meta.gitinfo.remoteurl + + if (key) { + if (!sourcegiturls.containsKey(key)) { + sourcegiturls[key] = [:] + } + def commitsha = meta.gitinfo.gitrevision + if (!sourcegiturls[key].containsKey(commitsha)) { + sourcegiturls[key][commitsha] = 1 + } else { + sourcegiturls[key][commitsha] += 1 + } + } + } + + // Show what was collected + echo prettyPrint(toJson(sourcegiturls)) + + // Look for source git urls associated with more than one sha code + for (sgu in sourcegiturls.keySet()) { + def cs = sourcegiturls[sgu] + if (cs.size() > 1) { + results.good = false + results.comment += "There is more than one source commit sha associated with a source git url: ${sgu} being used in this build:\n" + for (c in cs.keySet()) { + results.comment += "${c}\n" + } + } + } + return results } From 037f00fab6233f83e189a2977f0ed4328ba20117 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 16 Nov 2021 17:40:47 +0000 Subject: [PATCH 1589/1971] Add a JSON object passing mechanism --- hardware/sominfo.groovy | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 hardware/sominfo.groovy diff --git a/hardware/sominfo.groovy b/hardware/sominfo.groovy new file mode 100644 index 0000000..b5a9028 --- /dev/null +++ b/hardware/sominfo.groovy @@ -0,0 +1,22 @@ +def sominfo = null + +def String asJsonText() { + return writeJSON(returnText: true, json: sominfo, pretty: 1) +} + +def boolean isSet() { + return (sominfo != null) +} + +def set(String jsontext) { + sominfo = readJSON(text: jsontext) + + def som_support_json_text = writeJSON(returnText: true, json: sominfo, pretty: 1) + echo "Som support info:\n${asJsonText()}" +} + +def get() { + return sominfo +} + +return this \ No newline at end of file From 2f65f299fbab1b59500b60c4dd3559c371d12580 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 16 Nov 2021 17:50:25 +0000 Subject: [PATCH 1590/1971] Add a JSON object passing mechanism --- hardware/sominfo.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hardware/sominfo.groovy b/hardware/sominfo.groovy index b5a9028..41f3656 100644 --- a/hardware/sominfo.groovy +++ b/hardware/sominfo.groovy @@ -1,22 +1,22 @@ -def sominfo = null +def sominfostore = null def String asJsonText() { - return writeJSON(returnText: true, json: sominfo, pretty: 1) + return writeJSON(returnText: true, json: sominfostore, pretty: 1) } def boolean isSet() { - return (sominfo != null) + return (sominfostore != null) } def set(String jsontext) { - sominfo = readJSON(text: jsontext) + sominfostore = readJSON(text: jsontext) - def som_support_json_text = writeJSON(returnText: true, json: sominfo, pretty: 1) + def som_support_json_text = writeJSON(returnText: true, json: sominfostore, pretty: 1) echo "Som support info:\n${asJsonText()}" } def get() { - return sominfo + return sominfostore } return this \ No newline at end of file From ba2fa8cd05d006dac2314af53cf67eb64edffef5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 16 Nov 2021 23:09:30 +0000 Subject: [PATCH 1591/1971] Add a JSON object passing mechanism --- hardware/sominfo.groovy | 62 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/hardware/sominfo.groovy b/hardware/sominfo.groovy index 41f3656..fa745d1 100644 --- a/hardware/sominfo.groovy +++ b/hardware/sominfo.groovy @@ -1,10 +1,35 @@ def sominfostore = null +/* Example expected JSON +{ + "SomType": { + "Som_BA4": { + "Artifact info": { + "Location": "Jenkins job artifact", + "Job": "HMB_FD_HV_0.9.6/0.9.6_SG1024_EL_syn_ba4", + "Job selector": "true", + "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_logic_ba4.git", + "Release repo revision": "" + } + }, + "Som_FC5": { + "Artifact info": { + "Location": "Jenkins job artifact", + "Job": "HMB_FD_HV_0.9.6/0.9.6_SG1024_EL_syn_fc5", + "Job selector": "true", + "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_logic_fc5.git", + "Release repo revision": "" + } + } + } +} +*/ + def String asJsonText() { return writeJSON(returnText: true, json: sominfostore, pretty: 1) } -def boolean isSet() { +def boolean exists() { return (sominfostore != null) } @@ -19,4 +44,39 @@ def get() { return sominfostore } +def somtypes() { + return sominfostore['SomType'] +} + +def artifactinfo(somtype) { + return somtype['Artifact info'] +} + +def artifactlocation(artifactinfo) { + return artifactinfo['Location'] +} + +def boolean isjoblocation(artifactinfo) { + return (artifactinfo['Location'] == 'Jenkins job artifact' || + artifactinfo['Location'] == 'Jenkins job artefact') +} + +def boolean isreleaserepolocation(artifactinfo) { + return artifactinfo['Location'] == 'Release repository' +} + +def artifactjob(artifactinfo) { + return [ + "name": artifactinfo['Job'], + "selector": "${artifactinfo['Job selector']}" + ] +} + +def releaserepo(artifactinfo) { + return [ + "repo": artifactinfo['Release repo'], + "revision": artifactinfo['Release repo revision'] + ] +} + return this \ No newline at end of file From 535076b3e3dc1a4d609ca3337ac517e79c938ff9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 18:32:55 +0000 Subject: [PATCH 1592/1971] Add use of post build info json --- build/postactions.groovy | 164 ++++++++++++++++++++--------------- build/postactionstest.groovy | 36 ++++++++ hardware/sominfo.groovy | 2 - 3 files changed, 129 insertions(+), 73 deletions(-) create mode 100644 build/postactionstest.groovy diff --git a/build/postactions.groovy b/build/postactions.groovy index 90fcc15..c9b9a81 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -1,79 +1,101 @@ +/* Example post build info +{ + "Build outcomes": { + "Success": { + "Actions": { + "Deploy doxygen": { + "Description": "Can be empty - Name of doxygen deploy job to run if this build is successful", + "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_doxygen_deploy" + }, + "Static analysis": { + "Description": "Can be empty - Static analysis job to run when this build is successful", + "Job": "" + }, + "Unit test": { + "Description": "Can be empty - Unit test job to run when this build is successful", + "Job": "" + }, + "Regression test": { + "Description": "Can be empty - Regression test job to run when this build is successful", + "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_run_tests" + }, + "Update differences": { + "Description": "Can be empty - Update differences job to run when this build is successful", + "Job": "HMB_FD_HV_diff_releases" + }, + "Release to git": { + "Description": "Can be empty - Name of release to git job to run if this build is successful", + "Job": "HMB_FD_HV_release_to_git" + } + } + } + } +} +*/ -def performSuccessfulBuildActions() { - def String buildselector = "${BUILD_NUMBER}" - if (params.DOXYGEN_DEPLOY_JOB != null) { - if (DOXYGEN_DEPLOY_JOB && Jenkins.instance.getItemByFullName(DOXYGEN_DEPLOY_JOB).isBuildable()) { - build( - wait: false, - job: DOXYGEN_DEPLOY_JOB, - parameters: [ - string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME), - string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: buildselector), - ] - ) - } +def getActionJobName(postbuildactions, String action, String alternativeparamname) { + def String jobname + if (postbuildactions) { + jobname = postbuildactions[action]['Job'] + } else { + if (params[alternativeparam] != null) { + if (params[alternativeparam]) { + jobname = params[alternativeparam] + } + } } - if (params.STATIC_ANALYSIS_JOB != null) { - if (STATIC_ANALYSIS_JOB && Jenkins.instance.getItemByFullName(STATIC_ANALYSIS_JOB).isBuildable()) { - build( - wait: false, - job: STATIC_ANALYSIS_JOB, - parameters: [ - string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), - ] - ) + def jobitem = Jenkins.instance.getItemByFullName(jobname) + if (jobitem) { + if (!jobitem.isBuildable()) { + jobname = '' } + } else { + jobname = '' } - if (params.UNIT_TEST_JOB != null) { - if (UNIT_TEST_JOB && Jenkins.instance.getItemByFullName(UNIT_TEST_JOB).isBuildable()) { - build( - wait: false, - job: UNIT_TEST_JOB, - parameters: [ - string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), - ] - ) - } - } - if (params.REGRESSION_TEST_JOB != null) { - if (REGRESSION_TEST_JOB && Jenkins.instance.getItemByFullName(REGRESSION_TEST_JOB).isBuildable()) { - build( - wait: false, - job: REGRESSION_TEST_JOB, - parameters: [ - string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), - ] - ) - } - } - if (params.DIFF_JOB != null) { - if (DIFF_JOB && Jenkins.instance.getItemByFullName(DIFF_JOB).isBuildable()) { - build( - wait: false, - job: DIFF_JOB, - parameters: [ - string(name: 'LATER_SOURCE', value: 'Jenkins job artifact'), - string(name: 'LATER_BUILD_JOB', value: JOB_NAME), - string(name: 'LATER_BUILD_SELECTOR', value: buildselector), - ] - ) - } - } - if (params.RELEASE_TO_GIT_JOB != null) { - if (RELEASE_TO_GIT_JOB && Jenkins.instance.getItemByFullName(RELEASE_TO_GIT_JOB).isBuildable()) { - build( - wait: false, - job: RELEASE_TO_GIT_JOB, - parameters: [ - string(name: 'BUILD_JOB', value: JOB_NAME), - string(name: 'BUILD_JOB_SELECTOR', value: buildselector), - ] - ) - } + return jobname +} + + +def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname) { + def jobname = getActionJobName(postbuildactions, action, alternativeparamname) + if (jobname) { + build( + wait: false, + job: jobname, + parameters: [ + // For most jobs + string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), + string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), + // For diff jobs + string(name: 'LATER_SOURCE', value: 'Jenkins job artifact'), + string(name: 'LATER_BUILD_JOB', value: JOB_NAME), + string(name: 'LATER_BUILD_SELECTOR', value: buildselector), + // For regression jobs + string(name: 'BUILD_JOB', value: JOB_NAME), + string(name: 'BUILD_JOB_SELECTOR', value: buildselector), + ] + ) } } + + +def performSuccessfulBuildActions() { + def postbuildactions + if (params.POST_BUILD_INFO != null) { + def postbuildinfo = readJSON(text: POST_BUILD_INFO) + def postbuildjsontext = writeJSON(returnText: true, json: postbuildinfo, pretty: 1) + echo "Post build info:\n${postbuildjsontext}" + postbuildactions = postbuildinfo['Build outcomes']['Success']['Action'] + postbuildinfoavailable = true + } + def String buildselector = "${BUILD_NUMBER}" + deployjob(buildselector, postbuildactions, 'Deploy doxygen', 'DOXYGEN_DEPLOY_JOB') + deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB') + deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB') + deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB') + deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB') + deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB') +} + return this; diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy new file mode 100644 index 0000000..553fcec --- /dev/null +++ b/build/postactionstest.groovy @@ -0,0 +1,36 @@ +pipeline { + agent { label AGENT_LABEL } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Dummy build job') { + steps { + script { + echo "Execute dummy build job" + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + script { + load("${autobuilder.commonscripts()}/build/postactions.groovy").performSuccessfulBuildActions() + } + } + } +} diff --git a/hardware/sominfo.groovy b/hardware/sominfo.groovy index fa745d1..72a3ca9 100644 --- a/hardware/sominfo.groovy +++ b/hardware/sominfo.groovy @@ -35,8 +35,6 @@ def boolean exists() { def set(String jsontext) { sominfostore = readJSON(text: jsontext) - - def som_support_json_text = writeJSON(returnText: true, json: sominfostore, pretty: 1) echo "Som support info:\n${asJsonText()}" } From 2cbe8f345a5d459454afc5dd6c4c02a9f1b528eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 18:39:38 +0000 Subject: [PATCH 1593/1971] Add use of post build info json --- build/postactionstest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy index 553fcec..63d1bd1 100644 --- a/build/postactionstest.groovy +++ b/build/postactionstest.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label AGENT_LABEL } + agent { label master } stages { stage('Initial setup') { steps { From e90a2174561a46eb75c8777a3151a3f210bde2c7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 18:40:14 +0000 Subject: [PATCH 1594/1971] Add use of post build info json --- build/postactionstest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy index 63d1bd1..f691d40 100644 --- a/build/postactionstest.groovy +++ b/build/postactionstest.groovy @@ -1,5 +1,5 @@ pipeline { - agent { label master } + agent { label 'master' } stages { stage('Initial setup') { steps { From 458d9605fedd04cb441dd4fd8a7adb7651f02d63 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 18:42:44 +0000 Subject: [PATCH 1595/1971] Add use of post build info json --- build/postactionstest.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy index f691d40..f155b94 100644 --- a/build/postactionstest.groovy +++ b/build/postactionstest.groovy @@ -4,6 +4,7 @@ pipeline { stage('Initial setup') { steps { script { + CLEAN_WORKSPACE = false meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) } } From fa3340487dd6fe31403407f8f84e8b4b32e4ef20 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 18:46:40 +0000 Subject: [PATCH 1596/1971] Add use of post build info json --- build/postactions.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index c9b9a81..8a876de 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -38,9 +38,9 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam if (postbuildactions) { jobname = postbuildactions[action]['Job'] } else { - if (params[alternativeparam] != null) { - if (params[alternativeparam]) { - jobname = params[alternativeparam] + if (params[alternativeparamname] != null) { + if (params[alternativeparamname]) { + jobname = params[alternativeparamname] } } } From 951d6940513a04c1a5dc60ab83ba7a48a644d49d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 21:25:47 +0000 Subject: [PATCH 1597/1971] Add use of post build info json --- build/postactions.groovy | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 8a876de..fbc71a4 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -44,13 +44,15 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam } } } - def jobitem = Jenkins.instance.getItemByFullName(jobname) - if (jobitem) { - if (!jobitem.isBuildable()) { + if (!jobname) { + def jobitem = Jenkins.instance.getItemByFullName(jobname) + if (jobitem) { + if (!jobitem.isBuildable()) { + jobname = '' + } + } else { jobname = '' } - } else { - jobname = '' } return jobname } @@ -86,7 +88,7 @@ def performSuccessfulBuildActions() { def postbuildinfo = readJSON(text: POST_BUILD_INFO) def postbuildjsontext = writeJSON(returnText: true, json: postbuildinfo, pretty: 1) echo "Post build info:\n${postbuildjsontext}" - postbuildactions = postbuildinfo['Build outcomes']['Success']['Action'] + postbuildactions = postbuildinfo['Build outcomes']['Success']['Actions'] postbuildinfoavailable = true } def String buildselector = "${BUILD_NUMBER}" From a5b06d79a9f514b642887f86f545f5d3737facfe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 21:41:53 +0000 Subject: [PATCH 1598/1971] Add use of post build info json --- build/postactions.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index fbc71a4..0092f44 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -34,9 +34,13 @@ */ def getActionJobName(postbuildactions, String action, String alternativeparamname) { - def String jobname + def String jobname = '' if (postbuildactions) { - jobname = postbuildactions[action]['Job'] + try { + jobname = postbuildactions[action]['Job'] + } catch(Exception ex) { + jobname = '' + } } else { if (params[alternativeparamname] != null) { if (params[alternativeparamname]) { From ec8ad9095325e46ae2d5dab9446d9d0aa32872d4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 21:47:57 +0000 Subject: [PATCH 1599/1971] Add use of post build info json --- build/postactions.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 0092f44..b5662c7 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -92,8 +92,13 @@ def performSuccessfulBuildActions() { def postbuildinfo = readJSON(text: POST_BUILD_INFO) def postbuildjsontext = writeJSON(returnText: true, json: postbuildinfo, pretty: 1) echo "Post build info:\n${postbuildjsontext}" - postbuildactions = postbuildinfo['Build outcomes']['Success']['Actions'] - postbuildinfoavailable = true + try { + postbuildactions = postbuildinfo['Build outcomes']['Success']['Actions'] + postbuildinfoavailable = true + } catch(Exception ex) { + postbuildinfoavailable = false + postbuildactions = null + } } def String buildselector = "${BUILD_NUMBER}" deployjob(buildselector, postbuildactions, 'Deploy doxygen', 'DOXYGEN_DEPLOY_JOB') From dc894e9d280726cf9891ccd56418d1f669ea9c53 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 21:52:35 +0000 Subject: [PATCH 1600/1971] Add use of post build info json --- build/postactions.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/postactions.groovy b/build/postactions.groovy index b5662c7..728765f 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -39,6 +39,7 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam try { jobname = postbuildactions[action]['Job'] } catch(Exception ex) { + echo "No post build actions found for action: ${action}" jobname = '' } } else { @@ -58,6 +59,7 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam jobname = '' } } + echo "Job name for action: ${action}: ${jobname}" return jobname } @@ -96,6 +98,7 @@ def performSuccessfulBuildActions() { postbuildactions = postbuildinfo['Build outcomes']['Success']['Actions'] postbuildinfoavailable = true } catch(Exception ex) { + echo "Post build info did not contain: Build outcomes/Success/Actions" postbuildinfoavailable = false postbuildactions = null } From 0486d41096026d0a5ce08903e5e66b828a329794 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 22:00:24 +0000 Subject: [PATCH 1601/1971] Add use of post build info json --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 728765f..0895d27 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -49,7 +49,7 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam } } } - if (!jobname) { + if (jobname) { def jobitem = Jenkins.instance.getItemByFullName(jobname) if (jobitem) { if (!jobitem.isBuildable()) { From 0aeadaaed2a556504d8419511eae39e1d08eefb8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 22:08:44 +0000 Subject: [PATCH 1602/1971] Add use of post build info json --- build/postactions.groovy | 3 --- 1 file changed, 3 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 0895d27..2e91b04 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -63,7 +63,6 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam return jobname } - def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname) { def jobname = getActionJobName(postbuildactions, action, alternativeparamname) if (jobname) { @@ -86,8 +85,6 @@ def deployjob(String buildselector, postbuildactions, String action, String alte } } - - def performSuccessfulBuildActions() { def postbuildactions if (params.POST_BUILD_INFO != null) { From 3f5001a7c2cf4cf33cae47a447a4e829213b457c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 17 Nov 2021 22:12:03 +0000 Subject: [PATCH 1603/1971] Add use of post build info json --- build/postactions.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/postactions.groovy b/build/postactions.groovy index 2e91b04..fbf98b6 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -73,6 +73,9 @@ def deployjob(String buildselector, postbuildactions, String action, String alte // For most jobs string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), + // For doxygen jobs + string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME), + string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: buildselector), // For diff jobs string(name: 'LATER_SOURCE', value: 'Jenkins job artifact'), string(name: 'LATER_BUILD_JOB', value: JOB_NAME), From 607232dd23f5924d221e0851993a45f76eaa7936 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Nov 2021 23:45:34 +0000 Subject: [PATCH 1604/1971] Add failed build action --- build/postactions.groovy | 109 ++++++++++++++++++++++++++++----------- 1 file changed, 79 insertions(+), 30 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index fbf98b6..ac5eabd 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -1,35 +1,45 @@ /* Example post build info { - "Build outcomes": { - "Success": { - "Actions": { - "Deploy doxygen": { - "Description": "Can be empty - Name of doxygen deploy job to run if this build is successful", - "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_doxygen_deploy" + "Build outcomes": { + "Success": { + "Actions": { + "Deploy doxygen": { + "Description": "Can be empty - Name of doxygen deploy job to run if this build is successful", + "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_doxygen_deploy" + }, + "Static analysis": { + "Description": "Can be empty - Static analysis job to run when this build is successful", + "Job": "" + }, + "Unit test": { + "Description": "Can be empty - Unit test job to run when this build is successful", + "Job": "" + }, + "Regression test": { + "Description": "Can be empty - Regression test job to run when this build is successful", + "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_run_tests" + }, + "Update differences": { + "Description": "Can be empty - Update differences job to run when this build is successful", + "Job": "HMB_FD_HV_diff_releases" + }, + "Release to git": { + "Description": "Can be empty - Name of release to git job to run if this build is successful", + "Job": "HMB_FD_HV_release_to_git" + } + } }, - "Static analysis": { - "Description": "Can be empty - Static analysis job to run when this build is successful", - "Job": "" - }, - "Unit test": { - "Description": "Can be empty - Unit test job to run when this build is successful", - "Job": "" - }, - "Regression test": { - "Description": "Can be empty - Regression test job to run when this build is successful", - "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_run_tests" - }, - "Update differences": { - "Description": "Can be empty - Update differences job to run when this build is successful", - "Job": "HMB_FD_HV_diff_releases" - }, - "Release to git": { - "Description": "Can be empty - Name of release to git job to run if this build is successful", - "Job": "HMB_FD_HV_release_to_git" + "Failed": { + "Actions": { + "Email": { + "Description": "Can be empty - Name of release to git job to run if this build is successful", + "To": [ + "dan.hawkins@globalinkjetsystems.com" + ] + } + } } - } } - } } */ @@ -88,12 +98,18 @@ def deployjob(String buildselector, postbuildactions, String action, String alte } } +def readPostBuildInfo() { + def postbuildinfo = readJSON(text: POST_BUILD_INFO) + def postbuildjsontext = writeJSON(returnText: true, json: postbuildinfo, pretty: 1) + echo "Post build info:\n${postbuildjsontext}" + + return postbuildinfo +} + def performSuccessfulBuildActions() { def postbuildactions if (params.POST_BUILD_INFO != null) { - def postbuildinfo = readJSON(text: POST_BUILD_INFO) - def postbuildjsontext = writeJSON(returnText: true, json: postbuildinfo, pretty: 1) - echo "Post build info:\n${postbuildjsontext}" + def postbuildinfo = readPostBuildInfo() try { postbuildactions = postbuildinfo['Build outcomes']['Success']['Actions'] postbuildinfoavailable = true @@ -112,4 +128,37 @@ def performSuccessfulBuildActions() { deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB') } +def sendemails(emailtolist) { + def emailbody = """ + Failed build: ${JOBNAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} + """ + + for(emailto in emailtolist) { + mail( + subject: "Failed build: ${JOBNAME} ${BUILD_DISPLAY_NAME}", + body: emailbody, + to: emailto + ) + } +} + +def performFailedBuildActions() { + def postbuildactions = null + if (params.POST_BUILD_INFO != null) { + def postbuildinfo = readPostBuildInfo() + try { + postbuildactions = postbuildinfo['Build outcomes']['Failed']['Actions'] + } catch(Exception ex) { + echo "Post build info did not contain: Build outcomes/Failed/Actions" + postbuildactions = null + } + } + if (postbuildactions) { + def emailtolist = postbuildactions['Email']['To'] + if (emailtolist) { + sendemails(emailtolist) + } + } +} + return this; From 8b0c194b4771bf3cdac5414f2e623cf0e2bdefd2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Nov 2021 23:45:49 +0000 Subject: [PATCH 1605/1971] Add failed build action --- build/postactions.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index ac5eabd..c5cc90c 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -112,10 +112,8 @@ def performSuccessfulBuildActions() { def postbuildinfo = readPostBuildInfo() try { postbuildactions = postbuildinfo['Build outcomes']['Success']['Actions'] - postbuildinfoavailable = true } catch(Exception ex) { echo "Post build info did not contain: Build outcomes/Success/Actions" - postbuildinfoavailable = false postbuildactions = null } } From 1b4e670855cb857491b351c792e86075452163bf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Nov 2021 23:48:28 +0000 Subject: [PATCH 1606/1971] Add failed build action --- build/postactionstest.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy index f155b94..885bc25 100644 --- a/build/postactionstest.groovy +++ b/build/postactionstest.groovy @@ -13,6 +13,9 @@ pipeline { steps { script { echo "Execute dummy build job" + if (CAUSE_ERROR) { + error("Causing error") + } } } } @@ -23,6 +26,9 @@ pipeline { } failure { echo 'Failed build' + script { + load("${autobuilder.commonscripts()}/build/postactions.groovy").performFailedBuildActions() + } } unstable { echo 'Unstable build' From 12c6b71a8ffe0d7ddb449900ee3dd25e9907feec Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 19 Nov 2021 23:55:48 +0000 Subject: [PATCH 1607/1971] Add failed build action --- build/postactions.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index c5cc90c..3007acf 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -128,12 +128,12 @@ def performSuccessfulBuildActions() { def sendemails(emailtolist) { def emailbody = """ - Failed build: ${JOBNAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} + Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} """ for(emailto in emailtolist) { mail( - subject: "Failed build: ${JOBNAME} ${BUILD_DISPLAY_NAME}", + subject: "Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", body: emailbody, to: emailto ) From 1a67b16fcdf870fe710081d4b08d02f994a972a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:00:01 +0000 Subject: [PATCH 1608/1971] Add failed build action --- build/postactions.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/build/postactions.groovy b/build/postactions.groovy index 3007acf..73c8f43 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -153,6 +153,7 @@ def performFailedBuildActions() { } if (postbuildactions) { def emailtolist = postbuildactions['Email']['To'] + echo "emailtolist: ${emailtolist}" if (emailtolist) { sendemails(emailtolist) } From 3b9ba8bfcdb5ea0f7cb1460de48700dcfa69e20c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:03:08 +0000 Subject: [PATCH 1609/1971] Add failed build action --- build/postactions.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 73c8f43..773ae7e 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -129,7 +129,9 @@ def performSuccessfulBuildActions() { def sendemails(emailtolist) { def emailbody = """ Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} - """ + + Console output: ${BUILD_URL}/console +""" for(emailto in emailtolist) { mail( @@ -137,6 +139,7 @@ def sendemails(emailtolist) { body: emailbody, to: emailto ) + echo "Send email to: ${emailto}" } } @@ -153,7 +156,6 @@ def performFailedBuildActions() { } if (postbuildactions) { def emailtolist = postbuildactions['Email']['To'] - echo "emailtolist: ${emailtolist}" if (emailtolist) { sendemails(emailtolist) } From 0ec730804cd5b1eec42beea93d3d1a0b8ad17883 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:04:02 +0000 Subject: [PATCH 1610/1971] Add failed build action --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 773ae7e..6503e1b 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -130,7 +130,7 @@ def sendemails(emailtolist) { def emailbody = """ Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} - Console output: ${BUILD_URL}/console + Console output: ${BUILD_URL}console """ for(emailto in emailtolist) { From ee1ad67d5cf3e3e8c9a8ccfebc7fba7e0e4f11fb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:10:25 +0000 Subject: [PATCH 1611/1971] Add failed build action --- build/postactions.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build/postactions.groovy b/build/postactions.groovy index 6503e1b..e789d97 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -131,6 +131,18 @@ def sendemails(emailtolist) { Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} Console output: ${BUILD_URL}console + + ${GIT_COMMIT} + ${GIT_PREVIOUS_COMMIT} + ${GIT_PREVIOUS_SUCCESSFUL_COMMIT} + ${GIT_BRANCH} + ${GIT_LOCAL_BRANCH} + ${GIT_CHECKOUT_DIR} + ${GIT_URL} + ${GIT_COMMITTER_NAME} + ${GIT_AUTHOR_NAME} + ${GIT_COMMITTER_EMAIL} + ${GIT_AUTHOR_EMAIL} """ for(emailto in emailtolist) { From 1ad79a3443cc2a3d653210b2c2191307f9db2f57 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:11:49 +0000 Subject: [PATCH 1612/1971] Add failed build action --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index e789d97..6033328 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -136,7 +136,7 @@ def sendemails(emailtolist) { ${GIT_PREVIOUS_COMMIT} ${GIT_PREVIOUS_SUCCESSFUL_COMMIT} ${GIT_BRANCH} - ${GIT_LOCAL_BRANCH} + no GIT_LOCAL_BRANCH ${GIT_CHECKOUT_DIR} ${GIT_URL} ${GIT_COMMITTER_NAME} From bb477a289d202e7f5238899e9c7c6c9262fb37e0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:12:33 +0000 Subject: [PATCH 1613/1971] Add failed build action --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 6033328..5c22a27 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -139,7 +139,7 @@ def sendemails(emailtolist) { no GIT_LOCAL_BRANCH ${GIT_CHECKOUT_DIR} ${GIT_URL} - ${GIT_COMMITTER_NAME} + no GIT_COMMITTER_NAME ${GIT_AUTHOR_NAME} ${GIT_COMMITTER_EMAIL} ${GIT_AUTHOR_EMAIL} From f7b0a223121058c58e09c6626a460877fd45371a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:13:15 +0000 Subject: [PATCH 1614/1971] Add failed build action --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 5c22a27..46e2f50 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -140,7 +140,7 @@ def sendemails(emailtolist) { ${GIT_CHECKOUT_DIR} ${GIT_URL} no GIT_COMMITTER_NAME - ${GIT_AUTHOR_NAME} + no GIT_AUTHOR_NAME ${GIT_COMMITTER_EMAIL} ${GIT_AUTHOR_EMAIL} """ From 61a519d406861bdda92c14c3e640f50622232e62 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:13:55 +0000 Subject: [PATCH 1615/1971] Add failed build action --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 46e2f50..a03deb8 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -141,7 +141,7 @@ def sendemails(emailtolist) { ${GIT_URL} no GIT_COMMITTER_NAME no GIT_AUTHOR_NAME - ${GIT_COMMITTER_EMAIL} + no GIT_COMMITTER_EMAIL ${GIT_AUTHOR_EMAIL} """ From 33208a4a1e90cf646b978bcd810f79d1e833bb7e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:14:33 +0000 Subject: [PATCH 1616/1971] Add failed build action --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index a03deb8..3aeff8f 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -142,7 +142,7 @@ def sendemails(emailtolist) { no GIT_COMMITTER_NAME no GIT_AUTHOR_NAME no GIT_COMMITTER_EMAIL - ${GIT_AUTHOR_EMAIL} + no GIT_AUTHOR_EMAIL """ for(emailto in emailtolist) { From c681874522bf7e121e88146458424ce078c4cb4b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 00:17:07 +0000 Subject: [PATCH 1617/1971] Add failed build action --- build/postactions.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 3aeff8f..fb0fc93 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -132,6 +132,8 @@ def sendemails(emailtolist) { Console output: ${BUILD_URL}console +""" +/* ${GIT_COMMIT} ${GIT_PREVIOUS_COMMIT} ${GIT_PREVIOUS_SUCCESSFUL_COMMIT} @@ -143,8 +145,7 @@ def sendemails(emailtolist) { no GIT_AUTHOR_NAME no GIT_COMMITTER_EMAIL no GIT_AUTHOR_EMAIL -""" - +*/ for(emailto in emailtolist) { mail( subject: "Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", From d7fae344ef13a1eb26ab5dfb47b1a02f5fbb413c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 18:57:02 +0000 Subject: [PATCH 1618/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/build/postactions.groovy b/build/postactions.groovy index fb0fc93..dca6672 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -36,6 +36,9 @@ "To": [ "dan.hawkins@globalinkjetsystems.com" ] + }, + "ExtEmail": { + "Description": "Send an email using Extended Email plugin" } } } @@ -156,6 +159,26 @@ def sendemails(emailtolist) { } } +def sendextemail() { + emailext( + subject: "Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + body: """ + ${JELLY_SCRIPT,template="html"} + """, + attachLog: true, + attachmentsPattern: '', + compressLog: false, + // from : '', + // mimeType: '', + // postsendScript: '', + // presendScript: '', + recipientProviders: [culprits(), requestor(), developers()], // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers + // replyTo: '', + // saveOutput: true, + // to: '', + ) +} + def performFailedBuildActions() { def postbuildactions = null if (params.POST_BUILD_INFO != null) { @@ -172,6 +195,9 @@ def performFailedBuildActions() { if (emailtolist) { sendemails(emailtolist) } + if (postbuildactions['ExtEmail']) { + sendextemail() + } } } From efa290011bf9e8c7fd366f76f50136c5cbd1a549 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 19:07:52 +0000 Subject: [PATCH 1619/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index dca6672..8a880f2 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -151,7 +151,7 @@ def sendemails(emailtolist) { */ for(emailto in emailtolist) { mail( - subject: "Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", body: emailbody, to: emailto ) @@ -161,15 +161,13 @@ def sendemails(emailtolist) { def sendextemail() { emailext( - subject: "Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", - body: """ - ${JELLY_SCRIPT,template="html"} - """, + subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + body: '''${JELLY_SCRIPT,template="html"}''', attachLog: true, attachmentsPattern: '', compressLog: false, // from : '', - // mimeType: '', + mimeType: 'text/html', // postsendScript: '', // presendScript: '', recipientProviders: [culprits(), requestor(), developers()], // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers From ece760f599ad96fb5af48302cca267b2a2e13be4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 19:10:45 +0000 Subject: [PATCH 1620/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 8a880f2..4314efe 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -173,7 +173,7 @@ def sendextemail() { recipientProviders: [culprits(), requestor(), developers()], // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers // replyTo: '', // saveOutput: true, - // to: '', + to: 'dan.hawkins@globalinkjetsystems.com', ) } From 0469b404b190e5d0c92feb6d796bd2e04e4a59a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 20:34:47 +0000 Subject: [PATCH 1621/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 4314efe..3bcb29d 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -164,15 +164,15 @@ def sendextemail() { subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", body: '''${JELLY_SCRIPT,template="html"}''', attachLog: true, - attachmentsPattern: '', + // attachmentsPattern: '', compressLog: false, // from : '', mimeType: 'text/html', // postsendScript: '', // presendScript: '', - recipientProviders: [culprits(), requestor(), developers()], // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers + recipientProviders: [culprits(), requestor(), developers(), upstreamDevelopers()], // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers // replyTo: '', - // saveOutput: true, + saveOutput: false, to: 'dan.hawkins@globalinkjetsystems.com', ) } From 7cfd3f2eb89b84f3aa766f462c0349a6b8a476d7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 21:11:14 +0000 Subject: [PATCH 1622/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 3bcb29d..eaa63b4 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -3,8 +3,8 @@ "Build outcomes": { "Success": { "Actions": { - "Deploy doxygen": { - "Description": "Can be empty - Name of doxygen deploy job to run if this build is successful", + "Deploy documentation": { + "Description": "Can be empty - Name of documentation/doxygen deploy job to run if this build is successful", "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_doxygen_deploy" }, "Static analysis": { @@ -121,7 +121,7 @@ def performSuccessfulBuildActions() { } } def String buildselector = "${BUILD_NUMBER}" - deployjob(buildselector, postbuildactions, 'Deploy doxygen', 'DOXYGEN_DEPLOY_JOB') + deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB') deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB') deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB') deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB') @@ -134,21 +134,7 @@ def sendemails(emailtolist) { Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} Console output: ${BUILD_URL}console - -""" -/* - ${GIT_COMMIT} - ${GIT_PREVIOUS_COMMIT} - ${GIT_PREVIOUS_SUCCESSFUL_COMMIT} - ${GIT_BRANCH} - no GIT_LOCAL_BRANCH - ${GIT_CHECKOUT_DIR} - ${GIT_URL} - no GIT_COMMITTER_NAME - no GIT_AUTHOR_NAME - no GIT_COMMITTER_EMAIL - no GIT_AUTHOR_EMAIL -*/ + """ for(emailto in emailtolist) { mail( subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", From 1bf41f1af00de121885c0511aa4b462d08462228 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 21:15:57 +0000 Subject: [PATCH 1623/1971] Use extended email to send emails on failed build --- build/postactionstest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy index 885bc25..62f5cd4 100644 --- a/build/postactionstest.groovy +++ b/build/postactionstest.groovy @@ -12,7 +12,7 @@ pipeline { stage('Dummy build job') { steps { script { - echo "Execute dummy build job" + echo "Execute dummy build job: ${CAUSE_ERROR}" if (CAUSE_ERROR) { error("Causing error") } From f41825d4b4a30037be8ffa1d834154884711ec70 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 20 Nov 2021 21:17:53 +0000 Subject: [PATCH 1624/1971] Use extended email to send emails on failed build --- build/postactionstest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy index 62f5cd4..e02d91f 100644 --- a/build/postactionstest.groovy +++ b/build/postactionstest.groovy @@ -13,7 +13,7 @@ pipeline { steps { script { echo "Execute dummy build job: ${CAUSE_ERROR}" - if (CAUSE_ERROR) { + if (CAUSE_ERROR == true) { error("Causing error") } } From 66ffedf35992435cab1d49ea368aa69b38b234c7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 08:55:07 +0000 Subject: [PATCH 1625/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 56 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index eaa63b4..657f1e8 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -38,7 +38,16 @@ ] }, "ExtEmail": { - "Description": "Send an email using Extended Email plugin" + "Description": "Send an email using Extended Email plugin", + "To": [ + "dan.hawkins@globalinkjetsystems.com" + ], + "Recipient providers": [ + "culprits", + "requestor", + "developers", + "upstreamDevelopers" + ] } } } @@ -145,7 +154,44 @@ def sendemails(emailtolist) { } } -def sendextemail() { +def getRecipientProviders(recipientProviderInfo) { + def recipientProviders = [] + + if (recipientProviderInfo) { + def recipientProviderInfoList = recipientProviderInfo['Recipient providers'] + if (recipientProviderInfoList) { + for(rp in recipientProviderInfoList) { + if (rp == 'culprits') { + recipientProviders.append(culprits()) + } + if (rp == 'requestor') { + recipientProviders.append(requestor()) + } + if (rp == 'developers') { + recipientProviders.append(developers()) + } + if (rp == 'upstreamDevelopers') { + recipientProviders.append(upstreamDevelopers()) + } + } + } + } + return recipientProviders; +} + +def String getToList(toListInfo) { + def String toList + + if (toListInfo) { + toList = toListInfo.join(',') + } + return toList +} + +def sendextemail(extmailinfo) { + def recipientProviders = getRecipientProviders(extmailinfo['Recipient providers']) + def toList = getToList(extmailinfo['To']) + emailext( subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", body: '''${JELLY_SCRIPT,template="html"}''', @@ -156,10 +202,10 @@ def sendextemail() { mimeType: 'text/html', // postsendScript: '', // presendScript: '', - recipientProviders: [culprits(), requestor(), developers(), upstreamDevelopers()], // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers + recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers // replyTo: '', saveOutput: false, - to: 'dan.hawkins@globalinkjetsystems.com', + to: toList, ) } @@ -180,7 +226,7 @@ def performFailedBuildActions() { sendemails(emailtolist) } if (postbuildactions['ExtEmail']) { - sendextemail() + sendextemail(postbuildactions['ExtEmail']) } } } From 404cdef36b425cb8e196772d23976291a450e984 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:33:50 +0000 Subject: [PATCH 1626/1971] Use extended email to send emails on failed build --- build/postactionstest.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy index e02d91f..7db1fdc 100644 --- a/build/postactionstest.groovy +++ b/build/postactionstest.groovy @@ -12,6 +12,7 @@ pipeline { stage('Dummy build job') { steps { script { + echo "Params:\n${params.toString()}" echo "Execute dummy build job: ${CAUSE_ERROR}" if (CAUSE_ERROR == true) { error("Causing error") From f93acc5de94727da3572574959b6927327ac80af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:35:44 +0000 Subject: [PATCH 1627/1971] Use extended email to send emails on failed build --- build/postactionstest.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy index 7db1fdc..150f5d1 100644 --- a/build/postactionstest.groovy +++ b/build/postactionstest.groovy @@ -12,9 +12,8 @@ pipeline { stage('Dummy build job') { steps { script { - echo "Params:\n${params.toString()}" echo "Execute dummy build job: ${CAUSE_ERROR}" - if (CAUSE_ERROR == true) { + if (CAUSE_ERROR == 'true') { error("Causing error") } } From 90e8e6763acbe731a2ae9f01d2a19233adbf75af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:40:05 +0000 Subject: [PATCH 1628/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 47 +++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 657f1e8..bca4454 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -192,21 +192,38 @@ def sendextemail(extmailinfo) { def recipientProviders = getRecipientProviders(extmailinfo['Recipient providers']) def toList = getToList(extmailinfo['To']) - emailext( - subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", - body: '''${JELLY_SCRIPT,template="html"}''', - attachLog: true, - // attachmentsPattern: '', - compressLog: false, - // from : '', - mimeType: 'text/html', - // postsendScript: '', - // presendScript: '', - recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers - // replyTo: '', - saveOutput: false, - to: toList, - ) + if (toList.size() == 0) { + emailext( + subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + body: '''${JELLY_SCRIPT,template="html"}''', + attachLog: true, + // attachmentsPattern: '', + compressLog: false, + // from : '', + mimeType: 'text/html', + // postsendScript: '', + // presendScript: '', + recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers + // replyTo: '', + saveOutput: false, + // to: toList, + ) + } else { + emailext( + subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + body: '''${JELLY_SCRIPT,template="html"}''', + attachLog: true, + // attachmentsPattern: '', + compressLog: false, + // from : '', + mimeType: 'text/html', + // postsendScript: '', + // presendScript: '', + // recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers + // replyTo: '', + saveOutput: false, + to: toList, + } } def performFailedBuildActions() { From 6779041a90cc43af25b5d8752d6ec6453699e412 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:40:56 +0000 Subject: [PATCH 1629/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/build/postactions.groovy b/build/postactions.groovy index bca4454..a7b0d7d 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -223,6 +223,7 @@ def sendextemail(extmailinfo) { // replyTo: '', saveOutput: false, to: toList, + ) } } From 5053f377f795cbf6173b1bc7be20d34fa6cc37de Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:44:35 +0000 Subject: [PATCH 1630/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index a7b0d7d..27a843e 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -192,7 +192,7 @@ def sendextemail(extmailinfo) { def recipientProviders = getRecipientProviders(extmailinfo['Recipient providers']) def toList = getToList(extmailinfo['To']) - if (toList.size() == 0) { + if (!toList) { emailext( subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", body: '''${JELLY_SCRIPT,template="html"}''', From 941d5b31b31f4ce0b6ef63b516250dff1162c824 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:45:51 +0000 Subject: [PATCH 1631/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 27a843e..5846d01 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -192,7 +192,7 @@ def sendextemail(extmailinfo) { def recipientProviders = getRecipientProviders(extmailinfo['Recipient providers']) def toList = getToList(extmailinfo['To']) - if (!toList) { + if (toList.length() <= 0) { emailext( subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", body: '''${JELLY_SCRIPT,template="html"}''', From 944b95be8a8259dafa88e0212effc60b92af5310 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:47:51 +0000 Subject: [PATCH 1632/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/postactions.groovy b/build/postactions.groovy index 5846d01..51219fc 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -176,6 +176,7 @@ def getRecipientProviders(recipientProviderInfo) { } } } + echo "recipientProviders: ${recipientProviders.toString()}" return recipientProviders; } @@ -185,6 +186,7 @@ def String getToList(toListInfo) { if (toListInfo) { toList = toListInfo.join(',') } + echo "toList: ${toList}" return toList } From 7b58c8c8dcc726c97d836f49a7a1806c52a37b91 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:48:52 +0000 Subject: [PATCH 1633/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 51219fc..1d90d6f 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -181,7 +181,7 @@ def getRecipientProviders(recipientProviderInfo) { } def String getToList(toListInfo) { - def String toList + def String toList = '' if (toListInfo) { toList = toListInfo.join(',') From b2a9f194a08ffe877ed7971bae75986161820bf6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 09:53:53 +0000 Subject: [PATCH 1634/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 51 ++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 1d90d6f..13c3634 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -176,6 +176,9 @@ def getRecipientProviders(recipientProviderInfo) { } } } + if (recipientProviders.size() == 0) { + recipientProviders = [culprits(), requestor(), developers(), upstreamDevelopers()] + } echo "recipientProviders: ${recipientProviders.toString()}" return recipientProviders; } @@ -194,39 +197,21 @@ def sendextemail(extmailinfo) { def recipientProviders = getRecipientProviders(extmailinfo['Recipient providers']) def toList = getToList(extmailinfo['To']) - if (toList.length() <= 0) { - emailext( - subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", - body: '''${JELLY_SCRIPT,template="html"}''', - attachLog: true, - // attachmentsPattern: '', - compressLog: false, - // from : '', - mimeType: 'text/html', - // postsendScript: '', - // presendScript: '', - recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers - // replyTo: '', - saveOutput: false, - // to: toList, - ) - } else { - emailext( - subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", - body: '''${JELLY_SCRIPT,template="html"}''', - attachLog: true, - // attachmentsPattern: '', - compressLog: false, - // from : '', - mimeType: 'text/html', - // postsendScript: '', - // presendScript: '', - // recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers - // replyTo: '', - saveOutput: false, - to: toList, - ) - } + emailext( + subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + body: '''${JELLY_SCRIPT,template="html"}''', + attachLog: true, + // attachmentsPattern: '', + compressLog: false, + // from : '', + mimeType: 'text/html', + // postsendScript: '', + // presendScript: '', + recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers + // replyTo: '', + saveOutput: false, + to: toList, + ) } def performFailedBuildActions() { From 752ed5410ea2747409f520b87b0544ed3ffabe08 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 14:40:19 +0000 Subject: [PATCH 1635/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 13c3634..97f065d 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -154,6 +154,13 @@ def sendemails(emailtolist) { } } +def recipientProviderMap = { + 'culprits': culprits(), + 'requestor': requestor(), + 'developers': developers(), + 'upstreamDevelopers': upstreamDevelopers(), +} + def getRecipientProviders(recipientProviderInfo) { def recipientProviders = [] @@ -161,17 +168,8 @@ def getRecipientProviders(recipientProviderInfo) { def recipientProviderInfoList = recipientProviderInfo['Recipient providers'] if (recipientProviderInfoList) { for(rp in recipientProviderInfoList) { - if (rp == 'culprits') { - recipientProviders.append(culprits()) - } - if (rp == 'requestor') { - recipientProviders.append(requestor()) - } - if (rp == 'developers') { - recipientProviders.append(developers()) - } - if (rp == 'upstreamDevelopers') { - recipientProviders.append(upstreamDevelopers()) + if (recipientProviderMap.containsKey(rp)) { + recipientProviders.append(recipientProviderMap[rp]) } } } From 804929b5621530aac7ec9301c4f8dea4a96b5bc9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 14:44:18 +0000 Subject: [PATCH 1636/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 97f065d..39f92d2 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -161,16 +161,13 @@ def recipientProviderMap = { 'upstreamDevelopers': upstreamDevelopers(), } -def getRecipientProviders(recipientProviderInfo) { +def getRecipientProviders(recipientProviderInfoList) { def recipientProviders = [] - if (recipientProviderInfo) { - def recipientProviderInfoList = recipientProviderInfo['Recipient providers'] - if (recipientProviderInfoList) { - for(rp in recipientProviderInfoList) { - if (recipientProviderMap.containsKey(rp)) { - recipientProviders.append(recipientProviderMap[rp]) - } + if (recipientProviderInfoList) { + for(rp in recipientProviderInfoList) { + if (recipientProviderMap.containsKey(rp)) { + recipientProviders.append(recipientProviderMap[rp]) } } } From 39fcf5e79421baae68708b7dfae0aaebc96c8bc8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 14:46:24 +0000 Subject: [PATCH 1637/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 39f92d2..aeb50d1 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -154,12 +154,12 @@ def sendemails(emailtolist) { } } -def recipientProviderMap = { +def recipientProviderMap = [ 'culprits': culprits(), 'requestor': requestor(), 'developers': developers(), 'upstreamDevelopers': upstreamDevelopers(), -} +] def getRecipientProviders(recipientProviderInfoList) { def recipientProviders = [] From ae2c51512de132d6de69b69f73c55a1716ffcbad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 15:02:21 +0000 Subject: [PATCH 1638/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index aeb50d1..1fb322b 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -155,10 +155,10 @@ def sendemails(emailtolist) { } def recipientProviderMap = [ - 'culprits': culprits(), - 'requestor': requestor(), - 'developers': developers(), - 'upstreamDevelopers': upstreamDevelopers(), + culprits: culprits(), + requestor: requestor(), + developers: developers(), + upstreamDevelopers: upstreamDevelopers(), ] def getRecipientProviders(recipientProviderInfoList) { From eb7eed4e8800a6ab84803da14026085a16ec8fbb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 15:16:05 +0000 Subject: [PATCH 1639/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 1fb322b..76bbbd4 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -154,14 +154,13 @@ def sendemails(emailtolist) { } } -def recipientProviderMap = [ - culprits: culprits(), - requestor: requestor(), - developers: developers(), - upstreamDevelopers: upstreamDevelopers(), -] - def getRecipientProviders(recipientProviderInfoList) { + def recipientProviderMap = [ + culprits: culprits(), + requestor: requestor(), + developers: developers(), + upstreamDevelopers: upstreamDevelopers(), + ] def recipientProviders = [] if (recipientProviderInfoList) { From 414a85fcea0b82864cb9ccc80ce42b485ec8a139 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 16:29:50 +0000 Subject: [PATCH 1640/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 76bbbd4..7699c5b 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -156,10 +156,10 @@ def sendemails(emailtolist) { def getRecipientProviders(recipientProviderInfoList) { def recipientProviderMap = [ - culprits: culprits(), - requestor: requestor(), - developers: developers(), - upstreamDevelopers: upstreamDevelopers(), + culprits: [$class: 'CulpritsRecipientProvider'], + requestor: [$class: 'RequesterRecipientProvider'], + developers: [$class: 'DevelopersRecipientProvider'], + upstreamDevelopers: [$class: 'UpstreamComitterRecipientProvider'], ] def recipientProviders = [] From c4ea96adcc1c5f620cb3d36c69a656598c88c1b5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 16:40:32 +0000 Subject: [PATCH 1641/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 7699c5b..f9e0b72 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -166,7 +166,7 @@ def getRecipientProviders(recipientProviderInfoList) { if (recipientProviderInfoList) { for(rp in recipientProviderInfoList) { if (recipientProviderMap.containsKey(rp)) { - recipientProviders.append(recipientProviderMap[rp]) + recipientProviders.add(recipientProviderMap[rp]) } } } From 724179c07a8dac811d8a0e0dbbdc2da20c530c0a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 17:16:36 +0000 Subject: [PATCH 1642/1971] Use extended email to send emails on failed build --- build/postactions.groovy | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index f9e0b72..740bc0a 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -138,19 +138,23 @@ def performSuccessfulBuildActions() { deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB') } -def sendemails(emailtolist) { - def emailbody = """ - Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} +def sendemails(emailinfo) { + def emailtolist = emailinfo['To'] - Console output: ${BUILD_URL}console - """ - for(emailto in emailtolist) { - mail( - subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", - body: emailbody, - to: emailto - ) - echo "Send email to: ${emailto}" + if (emailtolist) { + def emailbody = """ + Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} + + Console output: ${BUILD_URL}console + """ + for(emailto in emailtolist) { + mail( + subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + body: emailbody, + to: emailto + ) + echo "Send email to: ${emailto}" + } } } @@ -220,9 +224,8 @@ def performFailedBuildActions() { } } if (postbuildactions) { - def emailtolist = postbuildactions['Email']['To'] - if (emailtolist) { - sendemails(emailtolist) + if (postbuildactions['Email']) { + sendemails(postbuildactions['Email']) } if (postbuildactions['ExtEmail']) { sendextemail(postbuildactions['ExtEmail']) From 4f57c1c19b0fb39b956667ccdd59c83ad18c9f71 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 21 Nov 2021 20:34:52 +0000 Subject: [PATCH 1643/1971] Remove some post build log --- build/postactions.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 740bc0a..06ad8ad 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -81,7 +81,7 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam jobname = '' } } - echo "Job name for action: ${action}: ${jobname}" + // echo "Job name for action: ${action}: ${jobname}" return jobname } @@ -113,7 +113,7 @@ def deployjob(String buildselector, postbuildactions, String action, String alte def readPostBuildInfo() { def postbuildinfo = readJSON(text: POST_BUILD_INFO) def postbuildjsontext = writeJSON(returnText: true, json: postbuildinfo, pretty: 1) - echo "Post build info:\n${postbuildjsontext}" + // echo "Post build info:\n${postbuildjsontext}" return postbuildinfo } @@ -153,7 +153,7 @@ def sendemails(emailinfo) { body: emailbody, to: emailto ) - echo "Send email to: ${emailto}" + // echo "Send email to: ${emailto}" } } } @@ -177,7 +177,7 @@ def getRecipientProviders(recipientProviderInfoList) { if (recipientProviders.size() == 0) { recipientProviders = [culprits(), requestor(), developers(), upstreamDevelopers()] } - echo "recipientProviders: ${recipientProviders.toString()}" + // echo "recipientProviders: ${recipientProviders.toString()}" return recipientProviders; } @@ -187,7 +187,7 @@ def String getToList(toListInfo) { if (toListInfo) { toList = toListInfo.join(',') } - echo "toList: ${toList}" + // echo "toList: ${toList}" return toList } From df17c095ae03a24c245c9f45a0a173c8a175c5e1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 25 Nov 2021 14:30:03 +0000 Subject: [PATCH 1644/1971] Correct import of print server binaries --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 818f0b7..2562693 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -160,7 +160,7 @@ def artifactimportfrombuildjob(meta, importoptions, String destpath) { conditionalClean(importoptions, destpath) echo "Build selector type: ${importoptions.m_buildnumberorselector.getClass()}" - + echo "Importing artifacts from job: ${importoptions.m_jobname} selector: ${importoptions.m_buildnumberorselector.toString()}" copyArtifacts( filter: formFilter(importoptions), excludes: importoptions.m_excludes, From 94ba8c77a4319a7e5c226ffc13968d70255d8d0d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 30 Nov 2021 21:20:31 +0000 Subject: [PATCH 1645/1971] Provide specific parameter names appropriate to type of post build job being called --- build/postactions.groovy | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 06ad8ad..2a0b0fd 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -85,26 +85,15 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam return jobname } -def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname) { +def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername) { def jobname = getActionJobName(postbuildactions, action, alternativeparamname) if (jobname) { build( wait: false, job: jobname, parameters: [ - // For most jobs - string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME), - string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: buildselector), - // For doxygen jobs - string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME), - string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: buildselector), - // For diff jobs - string(name: 'LATER_SOURCE', value: 'Jenkins job artifact'), - string(name: 'LATER_BUILD_JOB', value: JOB_NAME), - string(name: 'LATER_BUILD_SELECTOR', value: buildselector), - // For regression jobs - string(name: 'BUILD_JOB', value: JOB_NAME), - string(name: 'BUILD_JOB_SELECTOR', value: buildselector), + string(name: jobnameparametername, value: JOB_NAME), + string(name: jobselectorparametername, value: buildselector), ] ) } @@ -130,12 +119,12 @@ def performSuccessfulBuildActions() { } } def String buildselector = "${BUILD_NUMBER}" - deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB') - deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB') - deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB') - deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB') - deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB') - deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB') + deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR') + deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' ) + deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TEST_SELECTOR') + deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TEST_SELECTOR') + deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR') + deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR') } def sendemails(emailinfo) { From a1340ea0eb50d5515a52ddc380258c1073b05c76 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 30 Nov 2021 21:23:58 +0000 Subject: [PATCH 1646/1971] Provide specific parameter names appropriate to type of post build job being called --- build/postactions.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 2a0b0fd..8b18908 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -121,8 +121,8 @@ def performSuccessfulBuildActions() { def String buildselector = "${BUILD_NUMBER}" deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR') deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' ) - deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TEST_SELECTOR') - deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TEST_SELECTOR') + deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') + deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR') deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR') } From 793c9798e82175e460ca52db6c33aa0cb67280be Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 1 Dec 2021 16:22:50 +0000 Subject: [PATCH 1647/1971] Remove ACM from Vertical stack (as it is using different versions of Atlas); Import the MCS version that was used to build Atlas UI --- import/importer.groovy | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/import/importer.groovy b/import/importer.groovy index 2562693..d40c52f 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -341,4 +341,25 @@ def artifactimport(meta, return artifactimport(meta, importoptions, destpath) } +// Import the artifacts of a named child component found below parent meta's hierarchy +def artifactimport(meta, parentmeta, String childproduct, String childsubcomponent, importoptions, String destinationfolder) { + // Import from parent meta + def childmeta = meta.getNewMetaObject() + def childmeta2 + echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" + def findresults = parentmeta.findAssociatedMeta(childproduct, childsubcomponent) + if (findresults.matchfound) { + childmeta = findresults.matchedmeta + if (childmeta.releaseinfo.released) { + importoptions.releaserepo(childmeta.releaseinfo.releaserepoURL, childmeta.releasetag()) + } else { + importoptions.jenkinsjob(childmeta.jenkinsbuildinfo.buildjobname, childmeta.jenkinsbuildinfo.buildnumber) + } + childmeta2 = importer.artifactimport(meta, importoptions, destinationfolder) + } else { + error("Could not find meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" + } + return childmeta2 +} + return this; From 815a9e9d88098f530fb2a7db4cd67530be0cf17e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 1 Dec 2021 16:36:29 +0000 Subject: [PATCH 1648/1971] Remove ACM from Vertical stack (as it is using different versions of Atlas); Import the MCS version that was used to build Atlas UI --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index d40c52f..0e2ca17 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -357,7 +357,7 @@ def artifactimport(meta, parentmeta, String childproduct, String childsubcompone } childmeta2 = importer.artifactimport(meta, importoptions, destinationfolder) } else { - error("Could not find meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" + error("Could not find meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}") } return childmeta2 } From f7cc2163c965a0691a2e6df66578adbbd11f2e03 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 2 Dec 2021 14:46:22 +0000 Subject: [PATCH 1649/1971] Pass the parent build stamp to child jobs; Use the same Atlas services source code commit in all child jobs --- configuration/configuration.groovy | 4 ++-- meta/folder.groovy | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 2a7f1ab..7a89975 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,7 +1,7 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { - meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) + return meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) } def registerPipelineScriptConfiguration(meta) { @@ -12,7 +12,7 @@ def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, St def ArrayList sparseitemlist = gh.convertSparseItemsString(filter) gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) - registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) + return registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) } return this diff --git a/meta/folder.groovy b/meta/folder.groovy index 694a40c..e144897 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -293,6 +293,12 @@ class BuildStampInfo extends GISJsonSerialised { set(other.buildstampprefix, other.revision, other.buildstamp) } + // Override the buildstamp + void override(String buildstamp) { + this.buildstamp = buildstamp + script.echo("Build stamp overridden to: ${this.buildstamp}") + } + String buildstampcommasep() { def String buildstampcommasep = buildstamp.replace(".", ",") return buildstampcommasep @@ -631,6 +637,7 @@ class MetaInfo extends GISJsonSerialised { 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) + return configurationinfo } void addCustomInfo(String customId, String customValue) { From 76b05afd70c94b2be4718118ad4962e77c580c77 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 2 Dec 2021 15:04:00 +0000 Subject: [PATCH 1650/1971] Pass the parent build stamp to child jobs; Use the same Atlas services source code commit in all child jobs --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index e144897..3217fd9 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -637,7 +637,7 @@ class MetaInfo extends GISJsonSerialised { 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) - return configurationinfo + return ci } void addCustomInfo(String customId, String customValue) { From d261eb27d51b937a599b9d0661f93146f7e05d2e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 2 Dec 2021 22:20:47 +0000 Subject: [PATCH 1651/1971] Handle pre-generated buildnumber --- versionnumbering/generate.groovy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 6e0db11..c3e1837 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -154,6 +154,22 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum return buildstamp } +String pregenerated(meta, String sourcerevision, String sourcepath, String pregeneratedbuildstamp, int basebuildnumber = 1000) { + def int gitrevisioncount + def String gitrevision + def String remoteinfo + def String remoteurl + + (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) + + echo "Build stamp is: ${pregeneratedbuildstamp}" + + meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) + meta.buildstampinfo.override(pregeneratedbuildstamp) + + return pregeneratedbuildstamp +} + String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) { def int bbn = basebuildnumber.trim().toInteger() return generate(meta, sourcerevision, sourcepath, bbn) From 9246812fbfa9185db78e1b67b8aa3ee0b9fdb84f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 2 Dec 2021 22:27:44 +0000 Subject: [PATCH 1652/1971] Handle pre-generated buildnumber --- versionnumbering/generate.groovy | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index c3e1837..7b435c4 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -155,16 +155,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum } String pregenerated(meta, String sourcerevision, String sourcepath, String pregeneratedbuildstamp, int basebuildnumber = 1000) { - def int gitrevisioncount - def String gitrevision - def String remoteinfo - def String remoteurl - - (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) - - echo "Build stamp is: ${pregeneratedbuildstamp}" - - meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) + generate(meta, sourcerevision, sourcepath, basebuildnumber) meta.buildstampinfo.override(pregeneratedbuildstamp) return pregeneratedbuildstamp From 7b1eb1142ff32ebf9cd54c3c636cf133d033ab2d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 2 Dec 2021 23:16:35 +0000 Subject: [PATCH 1653/1971] Handle pre-generated buildnumber --- meta/folder.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 3217fd9..7a8c020 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -295,6 +295,12 @@ class BuildStampInfo extends GISJsonSerialised { // Override the buildstamp void override(String buildstamp) { + def s = buildstamp.split('\\.') + if (s.size() != 4) { + script.error("Overriding build stamp: ${buildstamp} is not of the format: 1.2.3.4") + } + this.stampprefix = "${s[0]}.${s[1]}.${s[2]}" + this.revision = "${s[3]}".toInteger() this.buildstamp = buildstamp script.echo("Build stamp overridden to: ${this.buildstamp}") } From 79d92bf4820e420941c181ab6f10ec1a0edd7a5f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 Dec 2021 10:04:46 +0000 Subject: [PATCH 1654/1971] Handle pre-generated buildnumber --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7a8c020..c5a5309 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -300,7 +300,7 @@ class BuildStampInfo extends GISJsonSerialised { script.error("Overriding build stamp: ${buildstamp} is not of the format: 1.2.3.4") } this.stampprefix = "${s[0]}.${s[1]}.${s[2]}" - this.revision = "${s[3]}".toInteger() + this.revision = s[3].toInteger() this.buildstamp = buildstamp script.echo("Build stamp overridden to: ${this.buildstamp}") } From 603e13cb818ff91a271a2028981d33bd9889b463 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 Dec 2021 10:12:01 +0000 Subject: [PATCH 1655/1971] Handle pre-generated buildnumber --- meta/folder.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index c5a5309..9951485 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -295,14 +295,16 @@ class BuildStampInfo extends GISJsonSerialised { // Override the buildstamp void override(String buildstamp) { - def s = buildstamp.split('\\.') + this.buildstamp = buildstamp + script.echo("Build stamp overridden to: ${this.buildstamp}") + def s = this.buildstamp.split('\\.') if (s.size() != 4) { script.error("Overriding build stamp: ${buildstamp} is not of the format: 1.2.3.4") } this.stampprefix = "${s[0]}.${s[1]}.${s[2]}" + script.echo("Stamp prefix overridden to: ${this.stampprefix}") this.revision = s[3].toInteger() - this.buildstamp = buildstamp - script.echo("Build stamp overridden to: ${this.buildstamp}") + script.echo("Revision overridden to: ${this.revision}") } String buildstampcommasep() { From 710557d84c46b5c3f858beeae6eb76531fcf00bd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 3 Dec 2021 11:02:34 +0000 Subject: [PATCH 1656/1971] Handle pre-generated buildnumber --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9951485..d67389f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -301,8 +301,8 @@ class BuildStampInfo extends GISJsonSerialised { if (s.size() != 4) { script.error("Overriding build stamp: ${buildstamp} is not of the format: 1.2.3.4") } - this.stampprefix = "${s[0]}.${s[1]}.${s[2]}" - script.echo("Stamp prefix overridden to: ${this.stampprefix}") + this.buildstampprefix = "${s[0]}.${s[1]}.${s[2]}" + script.echo("Stamp prefix overridden to: ${this.buildstampprefix}") this.revision = s[3].toInteger() script.echo("Revision overridden to: ${this.revision}") } From 721375a968a1879cdb4e184d27ec13b03852dc7f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 21:28:24 +0000 Subject: [PATCH 1657/1971] Defer archiving artifacts to a loaded script --- check/build_meta.groovy | 3 ++- copy/all.groovy | 6 ++++-- copy/esw.groovy | 3 ++- copy/filtered.groovy | 3 ++- copy/logic.groovy | 3 ++- differences/metahierarchy.groovy | 3 ++- publish/promptingpublish.groovy | 3 ++- publish/publish.groovy | 3 ++- release/release.groovy | 3 ++- staticanalysis/cpd.groovy | 3 ++- staticanalysis/cppcheck.groovy | 3 ++- test/testethernetproduct.groovy | 3 ++- 12 files changed, 26 insertions(+), 13 deletions(-) diff --git a/check/build_meta.groovy b/check/build_meta.groovy index 6e669bc..5258740 100644 --- a/check/build_meta.groovy +++ b/check/build_meta.groovy @@ -53,7 +53,8 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - archiveArtifacts "summary/**,${artifactlist}" + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") } } } diff --git a/copy/all.groovy b/copy/all.groovy index 6d09903..5a7e424 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -57,14 +57,16 @@ pipeline { def includes = '**/*' def excludes = "${IMPORTS}/*" echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" - // This does not work: archiveArtifacts artifacts: includes, excludes: excludes + // This does not work: artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + // This does not work: artifactarchiver.archiveArtifacts(artifacts: includes, excludes: excludes) // so cleanfolders = [ IMPORTS, 'autobuild', ] cleaner.clean(cleanfolders) - archiveArtifacts artifacts: includes + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts(artifacts: includes) } } } diff --git a/copy/esw.groovy b/copy/esw.groovy index c6c0147..a3f1b23 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -41,7 +41,8 @@ pipeline { rm -v -rf meta mv -v "${ESW}"/* . """ - archiveArtifacts artifactlist + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts(artifactlist) } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index 7fd87b6..f0f6f6a 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -48,7 +48,8 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["filtered/**"]) - archiveArtifacts artifactlist + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts(artifactlist) } } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 9585f01..1663904 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -43,7 +43,8 @@ pipeline { rm -v -rf diff mv -v "logic"/* . """ - archiveArtifacts artifactlist + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts(artifactlist) } } } diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 10b24a0..f7251dc 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -58,7 +58,8 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - archiveArtifacts "summary/**,reports/**,${artifactlist}" + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts("summary/**,reports/**,${artifactlist}") } } } diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 9d51915..8d4b702 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -147,7 +147,8 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - archiveArtifacts "summary/**,${artifactlist}" + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") } } } diff --git a/publish/publish.groovy b/publish/publish.groovy index 82a32ad..38ee12e 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -58,7 +58,8 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - archiveArtifacts "summary/**,${artifactlist}" + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") } } } diff --git a/release/release.groovy b/release/release.groovy index 351985d..5be1ccd 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -56,7 +56,8 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - archiveArtifacts "summary/**,${artifactlist}" + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 5a77cab..476734e 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -129,7 +129,8 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts artifactlist + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts(artifactlist) } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 9455b0b..fc9345e 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -91,7 +91,8 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts artifactlist + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts(artifactlist) } } } diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index 92d6414..79c9ba7 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -192,7 +192,8 @@ pipeline { steps{ script { def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) - archiveArtifacts artifactlist + artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver.archiveArtifacts(artifactlist) } } } From 276381321fcdbcc554a66e4590e2976a916ca3fd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 21:48:27 +0000 Subject: [PATCH 1658/1971] Add a default archiver --- artifacts/archiver.groovy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 artifacts/archiver.groovy diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy new file mode 100644 index 0000000..d3c05c0 --- /dev/null +++ b/artifacts/archiver.groovy @@ -0,0 +1,16 @@ + +enum ArchiverStore { + JENKINS, + ARTIFACTSERVER, +} + +def archiveArtifacts(artifactlist, ArchiverStore store = JENKINS ) { + if (store == JENKINS) { + archiveArtifacts(artifactlist) + } +} + +this.JENKINS = JENKINS +this.ARTIFACTSERVER = ARTIFACTSERVER + +return this \ No newline at end of file From a91d0d5ff516bbc700d85f2c8ccdbdd0b659eacb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 22:08:17 +0000 Subject: [PATCH 1659/1971] Add a default archiver --- check/build_meta.groovy | 2 +- copy/all.groovy | 4 ++-- copy/esw.groovy | 2 +- copy/filtered.groovy | 2 +- copy/logic.groovy | 2 +- differences/metahierarchy.groovy | 2 +- publish/promptingpublish.groovy | 2 +- publish/publish.groovy | 2 +- release/release.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- test/testethernetproduct.groovy | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/check/build_meta.groovy b/check/build_meta.groovy index 5258740..04f5d3f 100644 --- a/check/build_meta.groovy +++ b/check/build_meta.groovy @@ -53,7 +53,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") } } diff --git a/copy/all.groovy b/copy/all.groovy index 5a7e424..686ec26 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -57,7 +57,7 @@ pipeline { def includes = '**/*' def excludes = "${IMPORTS}/*" echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" - // This does not work: artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + // This does not work: artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") // This does not work: artifactarchiver.archiveArtifacts(artifacts: includes, excludes: excludes) // so cleanfolders = [ @@ -65,7 +65,7 @@ pipeline { 'autobuild', ] cleaner.clean(cleanfolders) - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts(artifacts: includes) } } diff --git a/copy/esw.groovy b/copy/esw.groovy index a3f1b23..1ccc52d 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -41,7 +41,7 @@ pipeline { rm -v -rf meta mv -v "${ESW}"/* . """ - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts(artifactlist) } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index f0f6f6a..6ae8257 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -48,7 +48,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts(["filtered/**"]) - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts(artifactlist) } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 1663904..98e26ca 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -43,7 +43,7 @@ pipeline { rm -v -rf diff mv -v "logic"/* . """ - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts(artifactlist) } } diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index f7251dc..78d0641 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -58,7 +58,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts("summary/**,reports/**,${artifactlist}") } } diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 8d4b702..57cb1a1 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -147,7 +147,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") } } diff --git a/publish/publish.groovy b/publish/publish.groovy index 38ee12e..9c26d06 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -58,7 +58,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") } } diff --git a/release/release.groovy b/release/release.groovy index 5be1ccd..aa074a1 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -56,7 +56,7 @@ pipeline { steps { script { def artifactlist = meta.generateartifacts() - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 476734e..508c726 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -129,7 +129,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts(artifactlist) } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index fc9345e..2847cac 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -91,7 +91,7 @@ pipeline { script { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts(artifactlist) } } diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index 79c9ba7..9ff1229 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -192,7 +192,7 @@ pipeline { steps{ script { def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) - artifactarchiver = load(${autobuilder.commonscripts()}/artifacts/archiver.groovy) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archiveArtifacts(artifactlist) } } From 0f217b8ae2218131dd51f70d893dc8d8f3f460d3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 22:33:40 +0000 Subject: [PATCH 1660/1971] Add a default archiver --- artifacts/archiver.groovy | 3 --- 1 file changed, 3 deletions(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index d3c05c0..5278eb3 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -10,7 +10,4 @@ def archiveArtifacts(artifactlist, ArchiverStore store = JENKINS ) { } } -this.JENKINS = JENKINS -this.ARTIFACTSERVER = ARTIFACTSERVER - return this \ No newline at end of file From 0602daedfab5e061fa22e6390ab862ef94230e6b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 22:45:04 +0000 Subject: [PATCH 1661/1971] Add a default archiver --- artifacts/archiver.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index 5278eb3..f7dc583 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -4,7 +4,7 @@ enum ArchiverStore { ARTIFACTSERVER, } -def archiveArtifacts(artifactlist, ArchiverStore store = JENKINS ) { +def archiveArtifacts(artifactlist, ArchiverStore store = ArchiverStore.JENKINS ) { if (store == JENKINS) { archiveArtifacts(artifactlist) } From a301529e377ff0c47f3fbd2a144aa652c827f4b4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 22:51:02 +0000 Subject: [PATCH 1662/1971] Add a default archiver --- artifacts/archiver.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index f7dc583..bd2d241 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -5,7 +5,7 @@ enum ArchiverStore { } def archiveArtifacts(artifactlist, ArchiverStore store = ArchiverStore.JENKINS ) { - if (store == JENKINS) { + if (store == ArchiverStore.JENKINS) { archiveArtifacts(artifactlist) } } From 8d3afbb8cbae10d92e5dfe70482cb7c5421e39fc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 22:57:45 +0000 Subject: [PATCH 1663/1971] Add a default archiver --- artifacts/archiver.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index bd2d241..ee36f24 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -4,8 +4,11 @@ enum ArchiverStore { ARTIFACTSERVER, } -def archiveArtifacts(artifactlist, ArchiverStore store = ArchiverStore.JENKINS ) { - if (store == ArchiverStore.JENKINS) { +this.JENKINS = ArchiverStore.JENKINS +this.ARTIFACTSERVER = ArchiverStore.JENKINS + +def archiveArtifacts(artifactlist, ArchiverStore store = JENKINS ) { + if (store == JENKINS) { archiveArtifacts(artifactlist) } } From 8c2b3ab93a38574921595f030fb450d4a146f1af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 22:59:59 +0000 Subject: [PATCH 1664/1971] Add a default archiver --- artifacts/archiver.groovy | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index ee36f24..bc365af 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -1,13 +1,8 @@ -enum ArchiverStore { - JENKINS, - ARTIFACTSERVER, -} +JENKINS = 0 +ARTIFACTSERVER = 1 -this.JENKINS = ArchiverStore.JENKINS -this.ARTIFACTSERVER = ArchiverStore.JENKINS - -def archiveArtifacts(artifactlist, ArchiverStore store = JENKINS ) { +def archiveArtifacts(artifactlist, store = JENKINS ) { if (store == JENKINS) { archiveArtifacts(artifactlist) } From cb65d2b730d60e50b07125420101ccce20ba5874 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 23:24:51 +0000 Subject: [PATCH 1665/1971] Add a default archiver --- artifacts/archiver.groovy | 10 +++++++--- check/build_meta.groovy | 2 +- copy/all.groovy | 4 ++-- copy/esw.groovy | 2 +- copy/filtered.groovy | 2 +- copy/logic.groovy | 2 +- differences/metahierarchy.groovy | 2 +- publish/promptingpublish.groovy | 2 +- publish/publish.groovy | 2 +- release/release.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- test/testethernetproduct.groovy | 2 +- 13 files changed, 20 insertions(+), 16 deletions(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index bc365af..30360d0 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -1,8 +1,12 @@ +enum Store { + JENKINS, + ARTIFACTSERVER, +} -JENKINS = 0 -ARTIFACTSERVER = 1 +this.JENKINS = Store.JENKINS +this.ARTIFACTSERVER = Store.JENKINS -def archiveArtifacts(artifactlist, store = JENKINS ) { +def archive(artifactlist, ArchiverStore store = JENKINS ) { if (store == JENKINS) { archiveArtifacts(artifactlist) } diff --git a/check/build_meta.groovy b/check/build_meta.groovy index 04f5d3f..fb8a75d 100644 --- a/check/build_meta.groovy +++ b/check/build_meta.groovy @@ -54,7 +54,7 @@ pipeline { script { def artifactlist = meta.generateartifacts() artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") + artifactarchiver.archive("summary/**,${artifactlist}") } } } diff --git a/copy/all.groovy b/copy/all.groovy index 686ec26..9b95eb6 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -58,7 +58,7 @@ pipeline { def excludes = "${IMPORTS}/*" echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" // This does not work: artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - // This does not work: artifactarchiver.archiveArtifacts(artifacts: includes, excludes: excludes) + // This does not work: artifactarchiver.archive(artifacts: includes, excludes: excludes) // so cleanfolders = [ IMPORTS, @@ -66,7 +66,7 @@ pipeline { ] cleaner.clean(cleanfolders) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts(artifacts: includes) + artifactarchiver.archive(artifacts: includes) } } } diff --git a/copy/esw.groovy b/copy/esw.groovy index 1ccc52d..6ccb53e 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -42,7 +42,7 @@ pipeline { mv -v "${ESW}"/* . """ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts(artifactlist) + artifactarchiver.archive(artifactlist) } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index 6ae8257..251de93 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -49,7 +49,7 @@ pipeline { script { def artifactlist = meta.generateartifacts(["filtered/**"]) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts(artifactlist) + artifactarchiver.archive(artifactlist) } } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 98e26ca..7b20935 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -44,7 +44,7 @@ pipeline { mv -v "logic"/* . """ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts(artifactlist) + artifactarchiver.archive(artifactlist) } } } diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 78d0641..60d9835 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -59,7 +59,7 @@ pipeline { script { def artifactlist = meta.generateartifacts() artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts("summary/**,reports/**,${artifactlist}") + artifactarchiver.archive("summary/**,reports/**,${artifactlist}") } } } diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 57cb1a1..58c72eb 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -148,7 +148,7 @@ pipeline { script { def artifactlist = meta.generateartifacts() artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") + artifactarchiver.archive("summary/**,${artifactlist}") } } } diff --git a/publish/publish.groovy b/publish/publish.groovy index 9c26d06..ad33df9 100644 --- a/publish/publish.groovy +++ b/publish/publish.groovy @@ -59,7 +59,7 @@ pipeline { script { def artifactlist = meta.generateartifacts() artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") + artifactarchiver.archive("summary/**,${artifactlist}") } } } diff --git a/release/release.groovy b/release/release.groovy index aa074a1..42357fc 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -57,7 +57,7 @@ pipeline { script { def artifactlist = meta.generateartifacts() artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts("summary/**,${artifactlist}") + artifactarchiver.archive("summary/**,${artifactlist}") } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index 508c726..f9ddfcb 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -130,7 +130,7 @@ pipeline { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts(artifactlist) + artifactarchiver.archive(artifactlist) } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 2847cac..696f11d 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -92,7 +92,7 @@ pipeline { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts(artifactlist) + artifactarchiver.archive(artifactlist) } } } diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index 9ff1229..f45cf19 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -193,7 +193,7 @@ pipeline { script { def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archiveArtifacts(artifactlist) + artifactarchiver.archive(artifactlist) } } } From c98990423a6215d77df106987dd95232ab0679d2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 4 Dec 2021 23:27:31 +0000 Subject: [PATCH 1666/1971] Add a default archiver --- artifacts/archiver.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index 30360d0..d7b69d0 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -6,7 +6,7 @@ enum Store { this.JENKINS = Store.JENKINS this.ARTIFACTSERVER = Store.JENKINS -def archive(artifactlist, ArchiverStore store = JENKINS ) { +def archive(artifactlist, Store store = JENKINS ) { if (store == JENKINS) { archiveArtifacts(artifactlist) } From e75eb96a20cc8b2b449e56bfd1bc8be8bda4c7f3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 5 Dec 2021 20:40:53 +0000 Subject: [PATCH 1667/1971] Handle long version number strings eg. in sha codes --- versionnumbering/generate.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 7b435c4..5e974e2 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -98,6 +98,9 @@ def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) { def integerstrings = sourcebranch.findAll(/\d+/) def integers = [] for (integerstring in integerstrings) { + if (integerstring.length() > 6) { + integerstring = integerstring.substring(0, 5) + } int integer = integerstring.toInteger() integer = integer % (maxversionnumber() + 1) integers.add(integer) From 74ad66b19964a07c2b14ea0a727234db1446dd49 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 10 Dec 2021 17:10:24 +0000 Subject: [PATCH 1668/1971] Start writing format version into meta data file --- meta/folder.groovy | 49 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d67389f..70d024a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -20,12 +20,14 @@ abstract class GISJsonSerialised implements Serializable { } class ProductInfo extends GISJsonSerialised { + private static String FORMAT = '0.1' String productname String subcomponentname String variant ProductInfo(script, productname = "", subcomponentname = "", variant = "") { super(script) + this.format = FORMAT this.productname = productname this.subcomponentname = subcomponentname this.variant = variant @@ -77,6 +79,7 @@ class ProductInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] productname = rawmeta['productname'] subcomponentname = rawmeta['subcomponentname'] variant = rawmeta['variant'] ?: "" @@ -84,6 +87,7 @@ class ProductInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'productname' : productname, 'subcomponentname' : subcomponentname, 'variant' : variant, @@ -93,6 +97,7 @@ class ProductInfo extends GISJsonSerialised { } class GitInfo extends GISJsonSerialised { + private static String FORMAT = '0.1' private String sourcepath private String sourcerevision private String gitrevision @@ -101,6 +106,7 @@ class GitInfo extends GISJsonSerialised { GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") { super(script) + this.format = FORMAT this.sourcepath = sourcepath this.sourcerevision = sourcerevision this.gitrevision = gitrevision @@ -134,6 +140,7 @@ class GitInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] sourcepath = rawmeta['sourcepath'] sourcerevision = rawmeta['sourcerevision'] gitrevision = rawmeta['gitrevision'] @@ -143,6 +150,7 @@ class GitInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'sourcepath' : sourcepath, 'sourcerevision' : sourcerevision, 'gitrevision' : gitrevision, @@ -154,12 +162,14 @@ class GitInfo extends GISJsonSerialised { } class JenkinsBuildParameter extends GISJsonSerialised { + private static String FORMAT = '0.1' private String name private String valuetype private String value JenkinsBuildParameter(script, String name = '', String valuetype = '', String value = '') { super(script) + this.format = FORMAT this.name = name this.valuetype = valuetype this.value = value @@ -172,6 +182,7 @@ class JenkinsBuildParameter extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] name = rawmeta['name'] valuetype = rawmeta['valuetype'] value = rawmeta['value'] @@ -179,6 +190,7 @@ class JenkinsBuildParameter extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'name' : name, 'valuetype' : valuetype, 'value' : value, @@ -188,6 +200,7 @@ class JenkinsBuildParameter extends GISJsonSerialised { } class JenkinsBuildInfo extends GISJsonSerialised { + private static String FORMAT = '0.1' String buildjobname int buildnumber private String buildmachine @@ -197,6 +210,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "", boolean isfullbuild = true) { super(script) + this.format = FORMAT this.buildjobname = buildjobname this.buildnumber = buildnumber this.buildmachine = buildmachine @@ -228,6 +242,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] buildjobname = rawmeta['buildjobname'] buildnumber = rawmeta['buildnumber'] buildmachine = rawmeta['buildmachine'] @@ -253,6 +268,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'buildjobname' : buildjobname, 'buildnumber' : buildnumber, 'buildmachine' : buildmachine, @@ -265,12 +281,14 @@ class JenkinsBuildInfo extends GISJsonSerialised { } class BuildStampInfo extends GISJsonSerialised { + private static String FORMAT = '0.1' String buildstampprefix int revision String buildstamp BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { super(script) + this.format = FORMAT this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp @@ -333,6 +351,7 @@ class BuildStampInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] buildstampprefix = rawmeta['buildstampprefix'] revision = rawmeta['revision'] buildstamp = rawmeta['buildstamp'] @@ -340,6 +359,7 @@ class BuildStampInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'buildstampprefix' : buildstampprefix, 'revision' : revision, 'buildstamp' : buildstamp, @@ -349,12 +369,14 @@ class BuildStampInfo extends GISJsonSerialised { } class ReleaseInfo extends GISJsonSerialised { + private static String FORMAT = '0.1' String releaserepoURL ArrayList releaseitems boolean released ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { super(script) + this.format = FORMAT this.releaserepoURL = releaserepoURL this.releaseitems = new ArrayList() this.released = released @@ -382,6 +404,7 @@ class ReleaseInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] releaserepoURL = rawmeta['releaserepoURL'] releaseitems = new ArrayList() for (rawreleaseitem in rawmeta['releaseitems']) { @@ -392,6 +415,7 @@ class ReleaseInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'releaserepoURL' : releaserepoURL, 'releaseitems' : releaseitemssserialised(), 'released' : released @@ -401,6 +425,7 @@ class ReleaseInfo extends GISJsonSerialised { } class ConfigurationInfo extends GISJsonSerialised { + private static String FORMAT = '0.1' private String configurationname private String configurationURL private String configurationversion @@ -408,6 +433,7 @@ class ConfigurationInfo extends GISJsonSerialised { ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") { super(script) + this.format = FORMAT this.configurationname = configurationname this.configurationURL = configurationURL this.configurationversion = configurationversion @@ -415,6 +441,7 @@ class ConfigurationInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] configurationname = rawmeta['configurationname'] configurationURL = rawmeta['configurationURL'] configurationversion = rawmeta['configurationversion'] @@ -423,6 +450,7 @@ class ConfigurationInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'configurationname' : configurationname, 'configurationURL' : configurationURL, 'configurationversion' : configurationversion, @@ -457,11 +485,13 @@ class ChecksumPair extends GISJsonSerialised { } class ChecksumSet extends GISJsonSerialised { + private static String FORMAT = '0.1' private String artifactpath private ArrayList checksumpairs ChecksumSet(script, artifactpath = "") { super(script) + this.format = FORMAT this.artifactpath = artifactpath checksumpairs = new ArrayList() } @@ -481,6 +511,7 @@ class ChecksumSet extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] artifactpath = rawmeta['artifactpath'] checksumpairs = new ArrayList() for (rawchecksumpair in rawmeta['checksumpairs']) { @@ -492,6 +523,7 @@ class ChecksumSet extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'artifactpath' : artifactpath, 'checksumpairs' : checksumpairsserialised(), ] @@ -500,10 +532,12 @@ class ChecksumSet extends GISJsonSerialised { } class ChecksumInfo extends GISJsonSerialised { + private static String FORMAT = '0.1' private ArrayList checksumsets ChecksumInfo(script) { super(script) + this.format = FORMAT checksumsets = new ArrayList() } @@ -522,6 +556,7 @@ class ChecksumInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] checksumsets = new ArrayList() for (rawchecksumset in rawmeta['checksumsets']) { def cs = new ChecksumSet(script) @@ -532,6 +567,7 @@ class ChecksumInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'checksumsets' : checksumsetsserialised(), ] return data @@ -539,19 +575,23 @@ class ChecksumInfo extends GISJsonSerialised { } class PublishableInfo extends GISJsonSerialised { + private static String FORMAT = '0.1' private String filepath PublishableInfo(script, String filepath = "") { super(script) + this.format = FORMAT this.filepath = filepath } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] filepath = rawmeta['filepath'] } LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'filepath' : filepath, ] return data @@ -559,9 +599,9 @@ class PublishableInfo extends GISJsonSerialised { } class MetaInfo extends GISJsonSerialised { - private static String FORMAT = "0.1" - private static String METAFOLDERNAME = "meta" - private static String METAFILENAME = "info.json" + 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 { @@ -570,11 +610,13 @@ class MetaInfo extends GISJsonSerialised { RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) { super(script) + this.format = FORMAT this.offsetpath = offsetpath this.meta = meta } void deserialiseJson(rawmeta) { + //format = rawmeta['format'] offsetpath = rawmeta['offsetpath'] meta = new MetaInfo(script) meta.deserialiseJson(rawmeta['meta']) @@ -582,6 +624,7 @@ class MetaInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ + 'format' : format, 'offsetpath' : offsetpath, 'meta' : meta.serialisationdata(), ] From c66149252d3ceb2370c99ce34f10ed61c9ee2bfe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 10 Dec 2021 17:26:02 +0000 Subject: [PATCH 1669/1971] Start writing format version into meta data file --- meta/folder.groovy | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 70d024a..9b4452a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -20,14 +20,13 @@ abstract class GISJsonSerialised implements Serializable { } class ProductInfo extends GISJsonSerialised { - private static String FORMAT = '0.1' String productname String subcomponentname String variant ProductInfo(script, productname = "", subcomponentname = "", variant = "") { super(script) - this.format = FORMAT + this.format = '0.1' this.productname = productname this.subcomponentname = subcomponentname this.variant = variant @@ -97,7 +96,6 @@ class ProductInfo extends GISJsonSerialised { } class GitInfo extends GISJsonSerialised { - private static String FORMAT = '0.1' private String sourcepath private String sourcerevision private String gitrevision @@ -106,7 +104,7 @@ class GitInfo extends GISJsonSerialised { GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") { super(script) - this.format = FORMAT + this.format = '0.1' this.sourcepath = sourcepath this.sourcerevision = sourcerevision this.gitrevision = gitrevision @@ -162,14 +160,13 @@ class GitInfo extends GISJsonSerialised { } class JenkinsBuildParameter extends GISJsonSerialised { - private static String FORMAT = '0.1' private String name private String valuetype private String value JenkinsBuildParameter(script, String name = '', String valuetype = '', String value = '') { super(script) - this.format = FORMAT + this.format = '0.1' this.name = name this.valuetype = valuetype this.value = value @@ -200,7 +197,6 @@ class JenkinsBuildParameter extends GISJsonSerialised { } class JenkinsBuildInfo extends GISJsonSerialised { - private static String FORMAT = '0.1' String buildjobname int buildnumber private String buildmachine @@ -210,7 +206,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "", boolean isfullbuild = true) { super(script) - this.format = FORMAT + this.format = '0.1' this.buildjobname = buildjobname this.buildnumber = buildnumber this.buildmachine = buildmachine @@ -281,14 +277,13 @@ class JenkinsBuildInfo extends GISJsonSerialised { } class BuildStampInfo extends GISJsonSerialised { - private static String FORMAT = '0.1' String buildstampprefix int revision String buildstamp BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { super(script) - this.format = FORMAT + this.format = '0.1' this.buildstampprefix = buildstampprefix this.revision = revision this.buildstamp = buildstamp @@ -369,14 +364,13 @@ class BuildStampInfo extends GISJsonSerialised { } class ReleaseInfo extends GISJsonSerialised { - private static String FORMAT = '0.1' String releaserepoURL ArrayList releaseitems boolean released ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { super(script) - this.format = FORMAT + this.format = '0.1' this.releaserepoURL = releaserepoURL this.releaseitems = new ArrayList() this.released = released @@ -425,7 +419,6 @@ class ReleaseInfo extends GISJsonSerialised { } class ConfigurationInfo extends GISJsonSerialised { - private static String FORMAT = '0.1' private String configurationname private String configurationURL private String configurationversion @@ -433,7 +426,7 @@ class ConfigurationInfo extends GISJsonSerialised { ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") { super(script) - this.format = FORMAT + this.format = '0.1' this.configurationname = configurationname this.configurationURL = configurationURL this.configurationversion = configurationversion @@ -485,13 +478,12 @@ class ChecksumPair extends GISJsonSerialised { } class ChecksumSet extends GISJsonSerialised { - private static String FORMAT = '0.1' private String artifactpath private ArrayList checksumpairs ChecksumSet(script, artifactpath = "") { super(script) - this.format = FORMAT + this.format = '0.1' this.artifactpath = artifactpath checksumpairs = new ArrayList() } @@ -532,12 +524,11 @@ class ChecksumSet extends GISJsonSerialised { } class ChecksumInfo extends GISJsonSerialised { - private static String FORMAT = '0.1' private ArrayList checksumsets ChecksumInfo(script) { super(script) - this.format = FORMAT + this.format = '0.1' checksumsets = new ArrayList() } @@ -575,12 +566,11 @@ class ChecksumInfo extends GISJsonSerialised { } class PublishableInfo extends GISJsonSerialised { - private static String FORMAT = '0.1' private String filepath PublishableInfo(script, String filepath = "") { super(script) - this.format = FORMAT + this.format = '0.1' this.filepath = filepath } @@ -599,7 +589,6 @@ class PublishableInfo extends GISJsonSerialised { } 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}/**" @@ -610,7 +599,7 @@ class MetaInfo extends GISJsonSerialised { RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) { super(script) - this.format = FORMAT + this.format = '0.1' this.offsetpath = offsetpath this.meta = meta } @@ -632,7 +621,7 @@ class MetaInfo extends GISJsonSerialised { } } - private String format = FORMAT + private String format = '0.1' ProductInfo productinfo GitInfo gitinfo JenkinsBuildInfo jenkinsbuildinfo @@ -720,7 +709,7 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - if (rawmeta['format'] != FORMAT) { + if (rawmeta['format'] != '0.1') { script.error("Unsupported meta format found at ${filepath}") return } @@ -969,9 +958,9 @@ class MetaInfo extends GISJsonSerialised { } MetaInfo metareset(script) { - echo "Resetting meta folder" def mi = new MetaInfo(script) + echo "Resetting meta folder" dir(mi.folder()) { deleteDir() } From df492c865a00124636569d39180756641abc0ff4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 10 Dec 2021 17:31:21 +0000 Subject: [PATCH 1670/1971] Start writing format version into meta data file --- meta/folder.groovy | 53 ++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9b4452a..806b6ff 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -20,9 +20,10 @@ abstract class GISJsonSerialised implements Serializable { } class ProductInfo extends GISJsonSerialised { - String productname - String subcomponentname - String variant + private String format + private String productname + private String subcomponentname + private String variant ProductInfo(script, productname = "", subcomponentname = "", variant = "") { super(script) @@ -96,6 +97,7 @@ class ProductInfo extends GISJsonSerialised { } class GitInfo extends GISJsonSerialised { + private String format private String sourcepath private String sourcerevision private String gitrevision @@ -160,6 +162,7 @@ class GitInfo extends GISJsonSerialised { } class JenkinsBuildParameter extends GISJsonSerialised { + private String format private String name private String valuetype private String value @@ -197,12 +200,13 @@ class JenkinsBuildParameter extends GISJsonSerialised { } class JenkinsBuildInfo extends GISJsonSerialised { - String buildjobname - int buildnumber + private String format + private String buildjobname + private int buildnumber private String buildmachine private String builddate - ArrayList parameters - boolean isfullbuild + private ArrayList parameters + private boolean isfullbuild JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "", boolean isfullbuild = true) { super(script) @@ -277,9 +281,10 @@ class JenkinsBuildInfo extends GISJsonSerialised { } class BuildStampInfo extends GISJsonSerialised { - String buildstampprefix - int revision - String buildstamp + private String format + private String buildstampprefix + private int revision + private String buildstamp BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { super(script) @@ -364,9 +369,10 @@ class BuildStampInfo extends GISJsonSerialised { } class ReleaseInfo extends GISJsonSerialised { - String releaserepoURL - ArrayList releaseitems - boolean released + private String format + private String releaserepoURL + private ArrayList releaseitems + private boolean released ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { super(script) @@ -419,6 +425,7 @@ class ReleaseInfo extends GISJsonSerialised { } class ConfigurationInfo extends GISJsonSerialised { + private String format private String configurationname private String configurationURL private String configurationversion @@ -478,6 +485,7 @@ class ChecksumPair extends GISJsonSerialised { } class ChecksumSet extends GISJsonSerialised { + private String format private String artifactpath private ArrayList checksumpairs @@ -524,6 +532,7 @@ class ChecksumSet extends GISJsonSerialised { } class ChecksumInfo extends GISJsonSerialised { + private String format private ArrayList checksumsets ChecksumInfo(script) { @@ -566,6 +575,7 @@ class ChecksumInfo extends GISJsonSerialised { } class PublishableInfo extends GISJsonSerialised { + private String format private String filepath PublishableInfo(script, String filepath = "") { @@ -594,8 +604,9 @@ class MetaInfo extends GISJsonSerialised { private static String METAARTIFACTS = "${METAFOLDERNAME}/**" class RelatedMetaInfo extends GISJsonSerialised { - String offsetpath - MetaInfo meta + private String format + private String offsetpath + private MetaInfo meta RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) { super(script) @@ -622,12 +633,12 @@ class MetaInfo extends GISJsonSerialised { } private String format = '0.1' - ProductInfo productinfo - GitInfo gitinfo - JenkinsBuildInfo jenkinsbuildinfo - BuildStampInfo buildstampinfo - ReleaseInfo releaseinfo - ChecksumInfo checksuminfo + private ProductInfo productinfo + private GitInfo gitinfo + private JenkinsBuildInfo jenkinsbuildinfo + private BuildStampInfo buildstampinfo + private ReleaseInfo releaseinfo + private ChecksumInfo checksuminfo private ArrayList configurationinfo private ArrayList publishableinfo private LinkedHashMap custominfo From 0701945bab8ac31fdc2080f81e5c89e63a8f6c2a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 10 Dec 2021 17:41:14 +0000 Subject: [PATCH 1671/1971] Start writing format version into meta data file --- meta/folder.groovy | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 806b6ff..4efb0d2 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -162,14 +162,12 @@ class GitInfo extends GISJsonSerialised { } class JenkinsBuildParameter extends GISJsonSerialised { - private String format private String name private String valuetype private String value JenkinsBuildParameter(script, String name = '', String valuetype = '', String value = '') { super(script) - this.format = '0.1' this.name = name this.valuetype = valuetype this.value = value @@ -182,7 +180,6 @@ class JenkinsBuildParameter extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - //format = rawmeta['format'] name = rawmeta['name'] valuetype = rawmeta['valuetype'] value = rawmeta['value'] @@ -190,7 +187,6 @@ class JenkinsBuildParameter extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ - 'format' : format, 'name' : name, 'valuetype' : valuetype, 'value' : value, @@ -425,7 +421,6 @@ class ReleaseInfo extends GISJsonSerialised { } class ConfigurationInfo extends GISJsonSerialised { - private String format private String configurationname private String configurationURL private String configurationversion @@ -433,7 +428,6 @@ class ConfigurationInfo extends GISJsonSerialised { ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") { super(script) - this.format = '0.1' this.configurationname = configurationname this.configurationURL = configurationURL this.configurationversion = configurationversion @@ -441,7 +435,6 @@ class ConfigurationInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - //format = rawmeta['format'] configurationname = rawmeta['configurationname'] configurationURL = rawmeta['configurationURL'] configurationversion = rawmeta['configurationversion'] @@ -450,7 +443,6 @@ class ConfigurationInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ - 'format' : format, 'configurationname' : configurationname, 'configurationURL' : configurationURL, 'configurationversion' : configurationversion, @@ -532,12 +524,10 @@ class ChecksumSet extends GISJsonSerialised { } class ChecksumInfo extends GISJsonSerialised { - private String format private ArrayList checksumsets ChecksumInfo(script) { super(script) - this.format = '0.1' checksumsets = new ArrayList() } @@ -556,7 +546,6 @@ class ChecksumInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - //format = rawmeta['format'] checksumsets = new ArrayList() for (rawchecksumset in rawmeta['checksumsets']) { def cs = new ChecksumSet(script) @@ -567,7 +556,6 @@ class ChecksumInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ - 'format' : format, 'checksumsets' : checksumsetsserialised(), ] return data From 19d7103f315d9ce1aa5348ddc907231dad6668c9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 10 Dec 2021 18:20:14 +0000 Subject: [PATCH 1672/1971] Don't serialise associated meta data --- meta/folder.groovy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 4efb0d2..fe8b565 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -593,12 +593,14 @@ class MetaInfo extends GISJsonSerialised { class RelatedMetaInfo extends GISJsonSerialised { private String format + private String fullpath private String offsetpath private MetaInfo meta - RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) { + RelatedMetaInfo(script, fullpath = "", offsetpath = "", MetaInfo meta = null) { super(script) - this.format = '0.1' + this.format = '0.2' + this.fullpath = fullpath this.offsetpath = offsetpath this.meta = meta } @@ -614,7 +616,7 @@ class MetaInfo extends GISJsonSerialised { def data = [ 'format' : format, 'offsetpath' : offsetpath, - 'meta' : meta.serialisationdata(), + //'meta' : meta.serialisationdata(), ] return data } @@ -779,13 +781,14 @@ class MetaInfo extends GISJsonSerialised { def String adjustedpath = relativize(destpath) def importedmetafile = adjustedpath + "/" + metafilepath() if (script.fileExists(importedmetafile)) { + script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})") 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) + RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, adjustedpath, mi) if (appendtoparentmeta) { associatedmeta.add(rmi) } From dfcbbf1fa6fc9166754dedce9398c24867a9947f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Dec 2021 16:02:22 +0000 Subject: [PATCH 1673/1971] Record the import path of meta data --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index fe8b565..d3b17c4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -593,14 +593,14 @@ class MetaInfo extends GISJsonSerialised { class RelatedMetaInfo extends GISJsonSerialised { private String format - private String fullpath + private String importpath private String offsetpath private MetaInfo meta - RelatedMetaInfo(script, fullpath = "", offsetpath = "", MetaInfo meta = null) { + RelatedMetaInfo(script, importpath = "", offsetpath = "", MetaInfo meta = null) { super(script) this.format = '0.2' - this.fullpath = fullpath + this.importpath = importpath this.offsetpath = offsetpath this.meta = meta } @@ -788,7 +788,7 @@ class MetaInfo extends GISJsonSerialised { mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA) } - RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, adjustedpath, mi) + RelatedMetaInfo rmi = new RelatedMetaInfo(script, importedmetafile, adjustedpath, mi) if (appendtoparentmeta) { associatedmeta.add(rmi) } From f98f9e9565dc0d5e4e486b105c0903ebf9e10cc2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Dec 2021 16:30:20 +0000 Subject: [PATCH 1674/1971] Relay input meta files to output meta folders --- artifacts/archiver.groovy | 3 ++- meta/folder.groovy | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index d7b69d0..0ac3a72 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -6,7 +6,8 @@ enum Store { this.JENKINS = Store.JENKINS this.ARTIFACTSERVER = Store.JENKINS -def archive(artifactlist, Store store = JENKINS ) { +def archive(meta, artifactlist, Store store = JENKINS ) { + meta.copyrelatedmeta() if (store == JENKINS) { archiveArtifacts(artifactlist) } diff --git a/meta/folder.groovy b/meta/folder.groovy index d3b17c4..d1cec10 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -795,6 +795,18 @@ class MetaInfo extends GISJsonSerialised { return mi } + + def copyrelatedmeta() { + for (relatedmetainfo in associatedmeta) { + def srcpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" + def destpath = "${METAFOLDERNAME}/${relatedmetainfo.offsetpath}" + script.echo("Copying related meta folder: ${srcpath} to meta output folder: ${destpath} recursively") + fileOperations([ + folderCreateOperation(folderPath: destpath), + folderCopyOperation(sourceFolderPath: srcpath, destinationFolderPath: destpath) + ]) + } + } LinkedHashMap serialisationdata() { def data = [ From e466480d24574ba30159a5ccff0682e0fa99dcad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Dec 2021 16:37:06 +0000 Subject: [PATCH 1675/1971] Relay input meta files to output meta folders --- artifacts/archiver.groovy | 1 + meta/folder.groovy | 1 + 2 files changed, 2 insertions(+) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index 0ac3a72..5497106 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -7,6 +7,7 @@ this.JENKINS = Store.JENKINS this.ARTIFACTSERVER = Store.JENKINS def archive(meta, artifactlist, Store store = JENKINS ) { + echo "Archiving artifacts to store: ${store}" meta.copyrelatedmeta() if (store == JENKINS) { archiveArtifacts(artifactlist) diff --git a/meta/folder.groovy b/meta/folder.groovy index d1cec10..c0c3620 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -797,6 +797,7 @@ class MetaInfo extends GISJsonSerialised { } def copyrelatedmeta() { + script.echo("Copying related input meta data to output meta") for (relatedmetainfo in associatedmeta) { def srcpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" def destpath = "${METAFOLDERNAME}/${relatedmetainfo.offsetpath}" From 450f38e6fe62e9e8928bbc81ddd4b9df74915958 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Dec 2021 16:58:20 +0000 Subject: [PATCH 1676/1971] Relay input meta files to output meta folders --- artifacts/archiver.groovy | 2 +- meta/folder.groovy | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index 5497106..78bee55 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -10,7 +10,7 @@ def archive(meta, artifactlist, Store store = JENKINS ) { echo "Archiving artifacts to store: ${store}" meta.copyrelatedmeta() if (store == JENKINS) { - archiveArtifacts(artifactlist) + archiveArtifacts(artifacts: artifactlist) } } diff --git a/meta/folder.groovy b/meta/folder.groovy index c0c3620..efd48da 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -802,9 +802,9 @@ class MetaInfo extends GISJsonSerialised { def srcpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" def destpath = "${METAFOLDERNAME}/${relatedmetainfo.offsetpath}" script.echo("Copying related meta folder: ${srcpath} to meta output folder: ${destpath} recursively") - fileOperations([ - folderCreateOperation(folderPath: destpath), - folderCopyOperation(sourceFolderPath: srcpath, destinationFolderPath: destpath) + script.fileOperations([ + script.folderCreateOperation(folderPath: destpath), + script.folderCopyOperation(sourceFolderPath: srcpath, destinationFolderPath: destpath) ]) } } From b397a0722b4ed9694e438edc9fdf789c8af158f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Dec 2021 19:52:11 +0000 Subject: [PATCH 1677/1971] Remove python checkout when it is not used --- packaging/debian.groovy | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index c0a4dbb..4f779bf 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -64,14 +64,12 @@ def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, S return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) } -def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { +def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs) { 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 chown -v -R root: "${packagedefs.DEBPATH}" @@ -97,8 +95,6 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p catch (Exception e) { echo "Exception occurred" sh """#!/bin/bash -v - echo "${password}" | sudo -S echo - sudo chown -R ${USER}: "${packagedefs.DEBPATH}" exit 1 From 36b9f2e187f087b4a85c149b944d4ab3bced7e08 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Dec 2021 20:31:37 +0000 Subject: [PATCH 1678/1971] Use credential agent to supply password --- packaging/debian.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 4f779bf..c0a4dbb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -64,12 +64,14 @@ def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, S return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) } -def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs) { +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 chown -v -R root: "${packagedefs.DEBPATH}" @@ -95,6 +97,8 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p catch (Exception e) { echo "Exception occurred" sh """#!/bin/bash -v + echo "${password}" | sudo -S echo + sudo chown -R ${USER}: "${packagedefs.DEBPATH}" exit 1 From c7ff7598600835012ffec28f2bfebe46aa8ac518 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 11 Dec 2021 20:58:52 +0000 Subject: [PATCH 1679/1971] Use credential agent to supply password --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index efd48da..5edde8f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -608,8 +608,8 @@ class MetaInfo extends GISJsonSerialised { void deserialiseJson(rawmeta) { //format = rawmeta['format'] offsetpath = rawmeta['offsetpath'] - meta = new MetaInfo(script) - meta.deserialiseJson(rawmeta['meta']) + //meta = new MetaInfo(script) + //meta.deserialiseJson(rawmeta['meta']) } LinkedHashMap serialisationdata() { @@ -710,7 +710,7 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - if (rawmeta['format'] != '0.1') { + if (rawmeta['format'] != '0.1' ) { script.error("Unsupported meta format found at ${filepath}") return } From c39aac83b5125a3364d0af8de156b0e5ecf509ff Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 12 Dec 2021 17:14:51 +0000 Subject: [PATCH 1680/1971] Use credential manager to perform sudo operations --- packaging/debian.groovy | 64 +++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index c0a4dbb..9f2f4d3 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -64,45 +64,47 @@ def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, S return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) } -def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) { - try { - sh """#!/bin/bash - # Exit if any command fails - set -xe +def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String credentials_id) { + withCredentials([usernamePassword(credentialsId: credentials_id, + usernameVariable: 'SUDO_USERNAME', + passwordVariable: 'SUDO_PASSWORD')]) { + def sudo_S = "echo ${SUDO_PASSWORD} | sudo -S" + def sudo_Sk = "echo ${SUDO_PASSWORD} | sudo -S -k" + 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}" - cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + ${sudo_Sk} chown -v -R root: "${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 "${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}" - 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:" - 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 - echo "Showing package lintian output:" - lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true + ${sudo_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}" + """ + } + catch (Exception e) { + echo "Exception occurred" + sh """#!/bin/bash -v + ${sudo_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}" - 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 - """ + exit 1 + """ + } } } From 4132c4d470a21475f32a8e0d23a60236f00a4a6d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 22:56:07 +0000 Subject: [PATCH 1681/1971] Walk a tree of imported meta --- meta/folder.groovy | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 5edde8f..bf14e60 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -930,7 +930,36 @@ class MetaInfo extends GISJsonSerialised { return releasemetaversionuniquecollection } - def walkrelated(ArrayList metacollection, String comment = '', int level = 0) { + def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) { + MetaInfo mi = new MetaInfot(script) + + String nextpath + if (gatheredpath) { + nextpath = relatedmetainfo.offsetpath + } else { + nextpath = gatheredpath + '/' + relatedmetainfo.offsetpath + } + def importedmetafile = nextpath + '/' + METAFILENAME + def boolean next + if (script.fileExists(importedmetafile)) { + script.echo("Deserialising meta at file: ${importedmetafile}") + mi.deserialiseJson(importedmetafile) + next = true + } else { + script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist") + next = false + } + + def childmetainfo = [ + next: next + nextpath: nextpath, + childmeta: mi + ] + + return childmetainfo + } + + def walkrelated(ArrayList metacollection, String comment = '', int level = 0, String gatheredpath = '') { def results = [ 'metacollection' : metacollection, 'comment': comment @@ -938,8 +967,10 @@ class MetaInfo extends GISJsonSerialised { results.metacollection.add(this) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { - MetaInfo othermeta = relatedmetainfo.meta - results = othermeta.walkrelated(results.metacollection, results.comment, level + 1) + def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) + if (childmetainfo.next) { + results = childmetainfo.mi.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) + } } return [ 'metacollection' : results.metacollection, 'comment': results.comment ] } From 71349d97bfcf42292051f505c5c8e26a8d748ce4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 22:58:22 +0000 Subject: [PATCH 1682/1971] Walk a tree of imported meta --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index bf14e60..a937d74 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -933,7 +933,7 @@ class MetaInfo extends GISJsonSerialised { def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) { MetaInfo mi = new MetaInfot(script) - String nextpath + def String nextpath if (gatheredpath) { nextpath = relatedmetainfo.offsetpath } else { @@ -951,9 +951,9 @@ class MetaInfo extends GISJsonSerialised { } def childmetainfo = [ - next: next - nextpath: nextpath, - childmeta: mi + 'next': next + 'nextpath': nextpath, + 'childmeta': mi ] return childmetainfo From a87cb8b649c88183a216c59933879b54c437e426 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 22:59:06 +0000 Subject: [PATCH 1683/1971] Walk a tree of imported meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a937d74..7d800cc 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -951,7 +951,7 @@ class MetaInfo extends GISJsonSerialised { } def childmetainfo = [ - 'next': next + 'next': next, 'nextpath': nextpath, 'childmeta': mi ] From 0d396e02853735141b646ab4e62d4b9e8f4e2d21 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 22:59:50 +0000 Subject: [PATCH 1684/1971] Walk a tree of imported meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7d800cc..0473de6 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -931,7 +931,7 @@ class MetaInfo extends GISJsonSerialised { } def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) { - MetaInfo mi = new MetaInfot(script) + MetaInfo mi = new MetaInfo(script) def String nextpath if (gatheredpath) { From 3447179c59fa2a38594b907be633c57502b761ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 23:06:28 +0000 Subject: [PATCH 1685/1971] Walk a tree of imported meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0473de6..6e4fd51 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -934,7 +934,7 @@ class MetaInfo extends GISJsonSerialised { MetaInfo mi = new MetaInfo(script) def String nextpath - if (gatheredpath) { + if (gatheredpath == '') { nextpath = relatedmetainfo.offsetpath } else { nextpath = gatheredpath + '/' + relatedmetainfo.offsetpath From 62005036425f2ed68057e73f872fcb4dc6a51e8d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 23:18:28 +0000 Subject: [PATCH 1686/1971] Walk a tree of imported meta --- meta/folder.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 6e4fd51..4ffb125 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -931,15 +931,17 @@ class MetaInfo extends GISJsonSerialised { } def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) { - MetaInfo mi = new MetaInfo(script) + def MetaInfo mi = new MetaInfo(script) def String nextpath + def importedmetafile if (gatheredpath == '') { nextpath = relatedmetainfo.offsetpath + importedmetafile = nextpath + '/' + metafilepath() } else { nextpath = gatheredpath + '/' + relatedmetainfo.offsetpath + importedmetafile = nextpath + '/' + METAFILENAME } - def importedmetafile = nextpath + '/' + METAFILENAME def boolean next if (script.fileExists(importedmetafile)) { script.echo("Deserialising meta at file: ${importedmetafile}") From 3b446d07bdf79015cb83321d7bb571653c47916c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 23:25:42 +0000 Subject: [PATCH 1687/1971] Walk a tree of imported meta --- meta/folder.groovy | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 4ffb125..a717654 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -942,21 +942,22 @@ class MetaInfo extends GISJsonSerialised { nextpath = gatheredpath + '/' + relatedmetainfo.offsetpath importedmetafile = nextpath + '/' + METAFILENAME } - def boolean next + def boolean imported if (script.fileExists(importedmetafile)) { script.echo("Deserialising meta at file: ${importedmetafile}") mi.deserialiseJson(importedmetafile) - next = true + imported = true } else { script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist") - next = false + imported = false } def childmetainfo = [ - 'next': next, + 'imported': imported, 'nextpath': nextpath, 'childmeta': mi ] + script.echo("Child meta results: ${childmetainfo}") return childmetainfo } From 84c313a8b1842b1ec9c9f906a14bf545ddbd7963 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 23:29:26 +0000 Subject: [PATCH 1688/1971] Walk a tree of imported meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a717654..a4f27c4 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -971,7 +971,7 @@ class MetaInfo extends GISJsonSerialised { results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) - if (childmetainfo.next) { + if (childmetainfo.imported) { results = childmetainfo.mi.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) } } From 04d17c1b683d4822ab2a6adce9c646c86379d6f9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 13 Dec 2021 23:40:03 +0000 Subject: [PATCH 1689/1971] Walk a tree of imported meta --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a4f27c4..38ecdff 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -957,8 +957,6 @@ class MetaInfo extends GISJsonSerialised { 'nextpath': nextpath, 'childmeta': mi ] - script.echo("Child meta results: ${childmetainfo}") - return childmetainfo } @@ -969,8 +967,10 @@ class MetaInfo extends GISJsonSerialised { ] results.metacollection.add(this) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' + script.echo("Partial results: ${results.comment}") for (relatedmetainfo in associatedmeta) { def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) + script.echo("Child meta results: ${childmetainfo}") if (childmetainfo.imported) { results = childmetainfo.mi.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) } From af5f19b4ef0fad336b758d923ccc2d5ec2166950 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 09:11:19 +0000 Subject: [PATCH 1690/1971] Walk a tree of imported meta --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 38ecdff..c2caaa1 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -961,6 +961,7 @@ class MetaInfo extends GISJsonSerialised { } def walkrelated(ArrayList metacollection, String comment = '', int level = 0, String gatheredpath = '') { + script.echo("walkrelated: metacollection: ${metacollection}\nComment: ${comment}\nLevel: ${level}\nGathered path: ${gatheredpath}") def results = [ 'metacollection' : metacollection, 'comment': comment From 035977333b644c62082af72c5d1c06c0e7102411 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 09:16:02 +0000 Subject: [PATCH 1691/1971] Walk a tree of imported meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index c2caaa1..7a6ba4e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -973,7 +973,7 @@ class MetaInfo extends GISJsonSerialised { def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) script.echo("Child meta results: ${childmetainfo}") if (childmetainfo.imported) { - results = childmetainfo.mi.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) + results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) } } return [ 'metacollection' : results.metacollection, 'comment': results.comment ] From 6bf8b5886c912526f7db8f09e13183cd4094afe9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 09:43:38 +0000 Subject: [PATCH 1692/1971] Walk a tree of imported meta --- meta/folder.groovy | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7a6ba4e..71514fb 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -934,17 +934,14 @@ class MetaInfo extends GISJsonSerialised { def MetaInfo mi = new MetaInfo(script) def String nextpath - def importedmetafile if (gatheredpath == '') { - nextpath = relatedmetainfo.offsetpath - importedmetafile = nextpath + '/' + metafilepath() + nextpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" } else { - nextpath = gatheredpath + '/' + relatedmetainfo.offsetpath - importedmetafile = nextpath + '/' + METAFILENAME + nextpath = "${gatheredpath}/${relatedmetainfo.offsetpath}" } + def importedmetafile = "${nextpath}/${METAFILENAME}" def boolean imported if (script.fileExists(importedmetafile)) { - script.echo("Deserialising meta at file: ${importedmetafile}") mi.deserialiseJson(importedmetafile) imported = true } else { From a64688112a8a5690a2bebc281bc3957e8b0ff5d8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 12:02:01 +0000 Subject: [PATCH 1693/1971] Remove debug; RelatedMetaInfo does not store meta info anymore --- meta/folder.groovy | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 71514fb..045c866 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -595,28 +595,23 @@ class MetaInfo extends GISJsonSerialised { private String format private String importpath private String offsetpath - private MetaInfo meta - - RelatedMetaInfo(script, importpath = "", offsetpath = "", MetaInfo meta = null) { + + RelatedMetaInfo(script, importpath = "", offsetpath = "") { super(script) this.format = '0.2' this.importpath = importpath this.offsetpath = offsetpath - this.meta = meta } void deserialiseJson(rawmeta) { //format = rawmeta['format'] offsetpath = rawmeta['offsetpath'] - //meta = new MetaInfo(script) - //meta.deserialiseJson(rawmeta['meta']) } LinkedHashMap serialisationdata() { def data = [ 'format' : format, 'offsetpath' : offsetpath, - //'meta' : meta.serialisationdata(), ] return data } @@ -788,7 +783,7 @@ class MetaInfo extends GISJsonSerialised { mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA) } - RelatedMetaInfo rmi = new RelatedMetaInfo(script, importedmetafile, adjustedpath, mi) + RelatedMetaInfo rmi = new RelatedMetaInfo(script, importedmetafile, adjustedpath) if (appendtoparentmeta) { associatedmeta.add(rmi) } @@ -958,17 +953,14 @@ class MetaInfo extends GISJsonSerialised { } def walkrelated(ArrayList metacollection, String comment = '', int level = 0, String gatheredpath = '') { - script.echo("walkrelated: metacollection: ${metacollection}\nComment: ${comment}\nLevel: ${level}\nGathered path: ${gatheredpath}") def results = [ 'metacollection' : metacollection, 'comment': comment ] results.metacollection.add(this) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' - script.echo("Partial results: ${results.comment}") for (relatedmetainfo in associatedmeta) { def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) - script.echo("Child meta results: ${childmetainfo}") if (childmetainfo.imported) { results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) } From 2ba37172e4138a643a9f95975f11f15a37a6d225 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 13:54:14 +0000 Subject: [PATCH 1694/1971] Handle v0.1 and v0.2 formats simultaneously --- meta/folder.groovy | 91 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 13 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 045c866..4f4cb52 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -590,15 +590,52 @@ class MetaInfo extends GISJsonSerialised { private static String METAFOLDERNAME = 'meta' private static String METAFILENAME = 'info.json' private static String METAARTIFACTS = "${METAFOLDERNAME}/**" + private static String format = '0.2' - class RelatedMetaInfo extends GISJsonSerialised { + trait RelatedMetaInfo extends GISJsonSerialised { private String format + + RelatedMetaInfo(script, format) { + super(script) + this.format = format + } + + abstract void deserialiseJson(rawmeta) + abstract LinkedHashMap serialisationdata() + } + + class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { + String offsetpath + MetaInfo meta + + RelatedMetaInfo_v0_1(script, offsetpath = "", MetaInfo meta = null) { + super(script, '0.1') + this.offsetpath = offsetpath + this.meta = meta + } + + void deserialiseJson(rawmeta) { + offsetpath = rawmeta['offsetpath'] + meta = new MetaInfo(script) + meta.deserialiseJson(rawmeta['meta']) + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'offsetpath' : offsetpath, + 'meta' : meta.serialisationdata(), + ] + return data + } + } + + class RelatedMetaInfo_v0_2 extends RelatedMetaInfo { private String importpath private String offsetpath - RelatedMetaInfo(script, importpath = "", offsetpath = "") { - super(script) - this.format = '0.2' + RelatedMetaInfo_v0_2(script, importpath = "", offsetpath = "") { + super(script, '0.2') this.importpath = importpath this.offsetpath = offsetpath } @@ -617,7 +654,6 @@ class MetaInfo extends GISJsonSerialised { } } - private String format = '0.1' private ProductInfo productinfo private GitInfo gitinfo private JenkinsBuildInfo jenkinsbuildinfo @@ -705,7 +741,7 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - if (rawmeta['format'] != '0.1' ) { + if (rawmeta['format'] != '0.1' || rawmeta['format'] != '0.2' ) { script.error("Unsupported meta format found at ${filepath}") return } @@ -727,9 +763,15 @@ class MetaInfo extends GISJsonSerialised { } custominfo = rawmeta['custominfo'] for (rawrelatedmeta in rawmeta['associatedmeta']) { - def rm = new RelatedMetaInfo(script) - rm.deserialiseJson(rawrelatedmeta) - associatedmeta.add(rm) + if (rawrelatedmeta['format'] == nul || rawrelatedmeta['format'] == '0.1') { + def rm = new RelatedMetaInfo_v0_1(script) + rm.deserialiseJson(rawrelatedmeta) + associatedmeta.add(rm) + } else if (rawrelatedmeta['format'] == '0.2') { + def rm = new RelatedMetaInfo_v0_2(script) + rm.deserialiseJson(rawrelatedmeta) + associatedmeta.add(rm) + } } } @@ -783,7 +825,7 @@ class MetaInfo extends GISJsonSerialised { mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA) } - RelatedMetaInfo rmi = new RelatedMetaInfo(script, importedmetafile, adjustedpath) + RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath) if (appendtoparentmeta) { associatedmeta.add(rmi) } @@ -952,6 +994,24 @@ class MetaInfo extends GISJsonSerialised { return childmetainfo } + def walkrelated_v0_1(ArrayList metacollection, String comment = '', int level = 0) { + def results = [ + 'metacollection' : metacollection, + 'comment': comment + ] + results.metacollection.add(this) + results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' + for (relatedmetainfo in associatedmeta) { + if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { + def MetaInfo othermeta = relatedmetainfo.meta + results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1) + } else { + script.error("There is non v0.1 format related meta info under v0.1 related meta info") + } + } + return [ 'metacollection' : results.metacollection, 'comment': results.comment ] + } + def walkrelated(ArrayList metacollection, String comment = '', int level = 0, String gatheredpath = '') { def results = [ 'metacollection' : metacollection, @@ -960,9 +1020,14 @@ class MetaInfo extends GISJsonSerialised { results.metacollection.add(this) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { - def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) - if (childmetainfo.imported) { - results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) + if (relatedmetainfo.format == '0.2') { + def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) + if (childmetainfo.imported) { + results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) + } + } else if (relatedmetainfo.format == '0.1') { + def MetaInfo othermeta = relatedmetainfo.meta + results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1) } } return [ 'metacollection' : results.metacollection, 'comment': results.comment ] From f31914d43b355effb283763335302a9628688ca6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 14:10:28 +0000 Subject: [PATCH 1695/1971] Make sure all jobs are using the new archiver --- copy/esw.groovy | 2 +- copy/filtered.groovy | 2 +- copy/logic.groovy | 2 +- staticanalysis/cpd.groovy | 2 +- staticanalysis/cppcheck.groovy | 2 +- test/testethernetproduct.groovy | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/copy/esw.groovy b/copy/esw.groovy index 6ccb53e..5d9af25 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -42,7 +42,7 @@ pipeline { mv -v "${ESW}"/* . """ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(artifactlist) + artifactarchiver.archive(meta, artifactlist) } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index 251de93..555ce8d 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -49,7 +49,7 @@ pipeline { script { def artifactlist = meta.generateartifacts(["filtered/**"]) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(artifactlist) + artifactarchiver.archive(meta, artifactlist) } } } diff --git a/copy/logic.groovy b/copy/logic.groovy index 7b20935..0a28a22 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -44,7 +44,7 @@ pipeline { mv -v "logic"/* . """ artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(artifactlist) + artifactarchiver.archive(meta, artifactlist) } } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy index f9ddfcb..c04649c 100644 --- a/staticanalysis/cpd.groovy +++ b/staticanalysis/cpd.groovy @@ -130,7 +130,7 @@ pipeline { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(artifactlist) + artifactarchiver.archive(meta, artifactlist) } } } diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy index 696f11d..d959770 100644 --- a/staticanalysis/cppcheck.groovy +++ b/staticanalysis/cppcheck.groovy @@ -92,7 +92,7 @@ pipeline { ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] def artifactlist = meta.generateartifacts(itemsForRelease) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(artifactlist) + artifactarchiver.archive(meta, artifactlist) } } } diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy index f45cf19..5e2ce53 100644 --- a/test/testethernetproduct.groovy +++ b/test/testethernetproduct.groovy @@ -193,7 +193,7 @@ pipeline { script { def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(artifactlist) + artifactarchiver.archive(meta, artifactlist) } } } From 9e0fe09f0efc16bfb4be0a8e70282aa897f41757 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 15:15:58 +0000 Subject: [PATCH 1696/1971] Make sure all jobs are using the new archiver --- meta/folder.groovy | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 4f4cb52..cd5fe35 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -592,7 +592,13 @@ class MetaInfo extends GISJsonSerialised { private static String METAARTIFACTS = "${METAFOLDERNAME}/**" private static String format = '0.2' - trait RelatedMetaInfo extends GISJsonSerialised { + interface IRelatedMetaInfo { + abstract void deserialiseJson(rawmeta) + abstract LinkedHashMap serialisationdata() + abstract String format() + } + + class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { private String format RelatedMetaInfo(script, format) { @@ -602,6 +608,10 @@ class MetaInfo extends GISJsonSerialised { abstract void deserialiseJson(rawmeta) abstract LinkedHashMap serialisationdata() + + String format() { + return format + } } class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { From 0406350f78410b11eb7041b2406f55e1c473cdec Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 15:19:35 +0000 Subject: [PATCH 1697/1971] Make sure all jobs are using the new archiver --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index cd5fe35..4262a1c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -598,7 +598,7 @@ class MetaInfo extends GISJsonSerialised { abstract String format() } - class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { + abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { private String format RelatedMetaInfo(script, format) { From 6502cf749245ed689c1d3366a205e2d3bdbe4d3a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 15:25:32 +0000 Subject: [PATCH 1698/1971] Make sure all jobs are using the new archiver --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 4262a1c..1b409ff 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -898,7 +898,7 @@ class MetaInfo extends GISJsonSerialised { private ArrayList releasewalkerp(int maxdepth, ArrayList releasemetacollection, String pathsofar) { if (maxdepth > 0) { if (releaseinfo.releaserepoURL) { - RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this) + RelatedMetaInfo rmi = new RelatedMetaInfo_v0_1(script, pathsofar, this) releasemetacollection.add(rmi) } if (pathsofar) { From e57708a515daa4840eb46156102fc71f8aa7cb88 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 15:44:01 +0000 Subject: [PATCH 1699/1971] Make sure all jobs are using the new archiver --- meta/folder.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1b409ff..143d29b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -751,8 +751,9 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { + script.echo("Format: ${rawmeta['format']}") if (rawmeta['format'] != '0.1' || rawmeta['format'] != '0.2' ) { - script.error("Unsupported meta format found at ${filepath}") + script.error("Unsupported meta format found") return } productinfo.deserialiseJson(rawmeta['productinfo']) From e9157c3b63e2cf10ca99e12d78602c1207dce3c1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 15:48:35 +0000 Subject: [PATCH 1700/1971] Make sure all jobs are using the new archiver --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 143d29b..2651e70 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -751,8 +751,8 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - script.echo("Format: ${rawmeta['format']}") - if (rawmeta['format'] != '0.1' || rawmeta['format'] != '0.2' ) { + script.echo("Format: ${rawmeta['format']} ${rawmeta['format'].getClass()}") + if (rawmeta['format'].toString() != '0.1' || rawmeta['format'].toString() != '0.2' ) { script.error("Unsupported meta format found") return } From 149e1fd8f4e2fdb41535f9d3203dc6102b9c3184 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 16:01:30 +0000 Subject: [PATCH 1701/1971] Make sure all jobs are using the new archiver --- meta/folder.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2651e70..ad88d7c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -751,8 +751,7 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - script.echo("Format: ${rawmeta['format']} ${rawmeta['format'].getClass()}") - if (rawmeta['format'].toString() != '0.1' || rawmeta['format'].toString() != '0.2' ) { + if (rawmeta['format'].toString() != '0.1' && rawmeta['format'].toString() != '0.2' ) { script.error("Unsupported meta format found") return } From 523407f68fa9dcba0f2813f62471eb2c79f51ba2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 16:04:59 +0000 Subject: [PATCH 1702/1971] Make sure all jobs are using the new archiver --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ad88d7c..dd3a1b7 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -773,7 +773,7 @@ class MetaInfo extends GISJsonSerialised { } custominfo = rawmeta['custominfo'] for (rawrelatedmeta in rawmeta['associatedmeta']) { - if (rawrelatedmeta['format'] == nul || rawrelatedmeta['format'] == '0.1') { + if (!rawrelatedmeta['format'] || rawrelatedmeta['format'] == '0.1') { def rm = new RelatedMetaInfo_v0_1(script) rm.deserialiseJson(rawrelatedmeta) associatedmeta.add(rm) From c985dcb55234f492d5b945d85c791656815745a0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 17:20:28 +0000 Subject: [PATCH 1703/1971] Use non-deprecated methods for importing --- artifacts/metaexport.groovy | 7 ++++++- copy/esw.groovy | 5 ++++- copy/filtered.groovy | 4 +++- differences/metahierarchy.groovy | 14 ++++++++++++-- publish/package.groovy | 7 ++++++- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 4d93cc5..8e5e56e 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -11,7 +11,12 @@ def combineSubjobArtifacts(meta, importer, subJobs) { dir(destFolder) { deleteDir() } - importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber) + + def importoptions = importer.getNewImportOptions() + importoptions.jenkinsjob(subJobName, subJobNumber) + importoptions.setincrementversionnumber(incrementversionnumber) + importer.artifactimport(meta, importoptions, destFolder) + artifactFolders.add("${destFolder}/**") } } diff --git a/copy/esw.groovy b/copy/esw.groovy index 5d9af25..b9eb737 100644 --- a/copy/esw.groovy +++ b/copy/esw.groovy @@ -28,7 +28,10 @@ pipeline { 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) + def eswimportoptions = importer.getNewImportOptions() + eswimportoptions.source(ESW_ARTIFACT_LOCATION, ESW_ARTIFACT_BUILD_JOB, ESW_ARTIFACT_BUILD_SELECTOR, ESW_ARTIFACT_RELEASE_REPO, ESW_ARTIFACT_RELEASE_REVISION) + eswimportoptions.setincrementversionnumber(true) + importer.artifactimport(meta, eswimportoptions, ESWDEST) } } } diff --git a/copy/filtered.groovy b/copy/filtered.groovy index 555ce8d..3ad24cd 100644 --- a/copy/filtered.groovy +++ b/copy/filtered.groovy @@ -27,7 +27,9 @@ pipeline { stage('Import artifacts') { steps { script { - importer.artifactimport(meta, ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION, IMPORT) + def importoptions = importer.getNewImportOptions() + importoptions.source(ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION) + importer.artifactimport(meta, importoptions, IMPORT) } } } diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy index 60d9835..01c1890 100644 --- a/differences/metahierarchy.groovy +++ b/differences/metahierarchy.groovy @@ -37,8 +37,18 @@ pipeline { 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/**') + + def earlyimportoptions = importer.getNewImportOptions() + earlyimportoptions.source(EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION) + earlyimportoptions.setincrementversionnumber(false) + earlyimportoptions.setfilter('meta/**') + importer.artifactimport(meta, earlyimportoptions, EARLYROOTDIR) + + def laterimportoptions = importer.getNewImportOptions() + laterimportoptions.source(LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION) + laterimportoptions.setincrementversionnumber(false) + laterimportoptions.setfilter('meta/**') + importer.artifactimport(meta, laterimportoptions, LATERROOTDIR) } } } diff --git a/publish/package.groovy b/publish/package.groovy index 958a614..68c41f3 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -48,7 +48,12 @@ pipeline { steps { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + + def packageimportoptions = importer.getNewImportOptions() + packageimportoptions.jenkinsjob(PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR) + packageimportoptions.setincrementversionnumber(true) + packagemeta = importer.artifactimport(meta, packageimportoptions, PACKAGEDEST) + PACKAGE_FOLDER = "${PACKAGEDEST}/package" UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage" } From 9b2752021245f9a3cfdfbc531eab2176d891240d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 14 Dec 2021 21:59:26 +0000 Subject: [PATCH 1704/1971] Make all walkers use a walker that understand v0.1 and v0.2 formats --- meta/folder.groovy | 137 ++++++++++++++++++--------------------------- 1 file changed, 54 insertions(+), 83 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index dd3a1b7..adf124a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -893,31 +893,6 @@ class MetaInfo extends GISJsonSerialised { 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_v0_1(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 @@ -939,44 +914,6 @@ class MetaInfo extends GISJsonSerialised { 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 - } - def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) { def MetaInfo mi = new MetaInfo(script) @@ -1004,40 +941,44 @@ class MetaInfo extends GISJsonSerialised { return childmetainfo } - def walkrelated_v0_1(ArrayList metacollection, String comment = '', int level = 0) { + def walkrelated_v0_1(ArrayList metacollection, String comment = '', int level = 0, boolean limiteddepth = false, int maxdepth = 0) { def results = [ 'metacollection' : metacollection, 'comment': comment ] - results.metacollection.add(this) - results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' - for (relatedmetainfo in associatedmeta) { - if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { - def MetaInfo othermeta = relatedmetainfo.meta - results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1) - } else { - script.error("There is non v0.1 format related meta info under v0.1 related meta info") + if (!limiteddepth || maxdepth > 0) { + results.metacollection.add(this) + results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' + for (relatedmetainfo in associatedmeta) { + if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { + def MetaInfo othermeta = relatedmetainfo.meta + results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, limiteddepth, maxdepth - 1) + } else { + script.error("There is non v0.1 format related meta info under v0.1 related meta info") + } } } return [ 'metacollection' : results.metacollection, 'comment': results.comment ] } - def walkrelated(ArrayList metacollection, String comment = '', int level = 0, String gatheredpath = '') { + def walkrelated(ArrayList metacollection, String comment = '', int level = 0, String gatheredpath = '', boolean limiteddepth = false, int maxdepth = 0) { def results = [ 'metacollection' : metacollection, 'comment': comment ] - results.metacollection.add(this) - results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' - for (relatedmetainfo in associatedmeta) { - if (relatedmetainfo.format == '0.2') { - def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) - if (childmetainfo.imported) { - results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath) + if (!limiteddepth || maxdepth > 0) { + results.metacollection.add(this) + results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' + for (relatedmetainfo in associatedmeta) { + if (relatedmetainfo.format == '0.2') { + def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) + if (childmetainfo.imported) { + results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath, limiteddepth, maxdepth - 1) + } + } else if (relatedmetainfo.format == '0.1') { + def MetaInfo othermeta = relatedmetainfo.meta + results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, limiteddepth, maxdepth - 1) } - } else if (relatedmetainfo.format == '0.1') { - def MetaInfo othermeta = relatedmetainfo.meta - results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1) } } return [ 'metacollection' : results.metacollection, 'comment': results.comment ] @@ -1048,6 +989,36 @@ class MetaInfo extends GISJsonSerialised { return walkrelated(metacollection) } + ArrayList releasewalker(int maxdepth, String startpath = '') { + def ArrayList metacollection = new ArrayList() + def results = walkrelated(metacollection, '', 0, startpath, true, maxdepth) + return results.metacollection + } + + Map releasewalkerversionunique(int maxdepth, String startpath = '') { + def ArrayList metacollection = releasewalker(maxdepth, startpath) + + def Map versionuniquecollection = new LinkedHashMap() + for (metainfo in metacollection) { + def String uniquestring = metainfo.componentversionuniqueidentifier() + versionuniquecollection.put(uniquestring, metainfo) + } + + return versionuniquecollection + } + + Map releasewalkerunique(int maxdepth, String startpath = '') { + def ArrayList metacollection = releasewalker(maxdepth, startpath) + + def Map uniquecollection = new LinkedHashMap() + for (metainfo in metacollection) { + def String uniquestring = metainfo.componentidentifier() + uniquecollection.put(uniquestring, metainfo) + } + + return uniquecollection + } + MetaInfo getNewMetaObject(script) { return new MetaInfo(script) } From 1ee2be62fff8ed870aee9433252fa30800d2bd40 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:11:39 +0000 Subject: [PATCH 1705/1971] Use importer to get build artifacts to release --- release/release.groovy | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/release/release.groovy b/release/release.groovy index 42357fc..5c9925e 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -23,18 +23,15 @@ pipeline { stage('Get build artifact meta') { steps { script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + 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) + + def importoptions = importer.getNewImportOptions() + importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) + importoptions.setincrementversionnumber(false) + importoptions.setfilter('meta/**') + buildmeta = importer.artifactimport(meta, controlimportoptions, BUILD_ARTIFACTS) } } } From 7d8e910d202e2ee029d7d5dc91cdf48afb10575b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:12:47 +0000 Subject: [PATCH 1706/1971] Use importer to get build artifacts to release --- release/release.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.groovy b/release/release.groovy index 5c9925e..918c386 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -31,7 +31,7 @@ pipeline { importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) importoptions.setincrementversionnumber(false) importoptions.setfilter('meta/**') - buildmeta = importer.artifactimport(meta, controlimportoptions, BUILD_ARTIFACTS) + buildmeta = importer.artifactimport(meta, importoptions, BUILD_ARTIFACTS) } } } From 96621af758c19411cdd68230ac773f140b76c511 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:27:21 +0000 Subject: [PATCH 1707/1971] Use importer to get build artifacts to release --- release/release.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.groovy b/release/release.groovy index 918c386..17f5185 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -25,7 +25,7 @@ pipeline { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts" + BUILD_ARTIFACTS = "${WORKSPACE}" def importoptions = importer.getNewImportOptions() importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) From aff9e3e106c195703501e06f633fe178503cb7aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:31:46 +0000 Subject: [PATCH 1708/1971] Use importer to get build artifacts to release --- release/release.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.groovy b/release/release.groovy index 17f5185..8f7d129 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -25,7 +25,7 @@ pipeline { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - BUILD_ARTIFACTS = "${WORKSPACE}" + BUILD_ARTIFACTS = '.' def importoptions = importer.getNewImportOptions() importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) From f3a0f9fcc95a886543e22e0611c6c188484b423f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:35:17 +0000 Subject: [PATCH 1709/1971] Use importer to get build artifacts to release --- release/release.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/release.groovy b/release/release.groovy index 8f7d129..daf42aa 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -31,6 +31,7 @@ pipeline { importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) importoptions.setincrementversionnumber(false) importoptions.setfilter('meta/**') + importoptions.clean(false) buildmeta = importer.artifactimport(meta, importoptions, BUILD_ARTIFACTS) } } From fc34f642388f769ae727dd3c73bfe4bfd6e5009f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:37:12 +0000 Subject: [PATCH 1710/1971] Use importer to get build artifacts to release --- release/release.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/release/release.groovy b/release/release.groovy index daf42aa..2c168b9 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -25,13 +25,12 @@ pipeline { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - BUILD_ARTIFACTS = '.' + BUILD_ARTIFACTS = 'build' def importoptions = importer.getNewImportOptions() importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) importoptions.setincrementversionnumber(false) importoptions.setfilter('meta/**') - importoptions.clean(false) buildmeta = importer.artifactimport(meta, importoptions, BUILD_ARTIFACTS) } } From 135fddb356051307cf93e02d2e90bd47a0be84df Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:41:45 +0000 Subject: [PATCH 1711/1971] Use importer to get build artifacts to release --- release/release.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/release.groovy b/release/release.groovy index 2c168b9..20f520c 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -31,6 +31,7 @@ pipeline { importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) importoptions.setincrementversionnumber(false) importoptions.setfilter('meta/**') + importoptions.setappendtoparentmeta(false) buildmeta = importer.artifactimport(meta, importoptions, BUILD_ARTIFACTS) } } From e35826fb24014d77f52fae247010b775c190da5e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:45:18 +0000 Subject: [PATCH 1712/1971] Use importer to get build artifacts to release --- release/do.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index e0b9471..3430342 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -396,13 +396,16 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri repoandtagsappend("\n") } -def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) { +def releasehierarchy(buildfolder, 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) + def componentReleaseInfo + dir(buildfolder) { + componentReleaseInfo = buildmeta.releasewalkerunique(md) + } echo "Unique components:" def String versioncomponent = "" for (key in componentReleaseInfo.keySet()) { From b64672cc94017ad76223e26e9eaa9b801e1ab2fc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:47:28 +0000 Subject: [PATCH 1713/1971] Use importer to get build artifacts to release --- release/release.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.groovy b/release/release.groovy index 20f520c..2324b60 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -42,7 +42,7 @@ pipeline { 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) + (summarystring, markunstable, unstablereason) = releaser.releasehierarchy(BUILD_ARTIFACTS, buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' From f41768212cc3352a3e01e424d118253a5b31f870 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 14:56:32 +0000 Subject: [PATCH 1714/1971] Use importer to get build artifacts to release --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index adf124a..88e05e5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -991,7 +991,7 @@ class MetaInfo extends GISJsonSerialised { ArrayList releasewalker(int maxdepth, String startpath = '') { def ArrayList metacollection = new ArrayList() - def results = walkrelated(metacollection, '', 0, startpath, true, maxdepth) + def results = walkrelated(metacollection, 'meta', 0, startpath, true, maxdepth) return results.metacollection } From 82dc66da2f754714e99b91e9e29845ff7dcfb37b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 21:34:55 +0000 Subject: [PATCH 1715/1971] Use importer to get build artifacts to release --- meta/folder.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 88e05e5..499535a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -942,6 +942,7 @@ class MetaInfo extends GISJsonSerialised { } def walkrelated_v0_1(ArrayList metacollection, String comment = '', int level = 0, boolean limiteddepth = false, int maxdepth = 0) { + script.echo("walkrelated_v0_1 Iteration:\nLevel: ${level}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}") def results = [ 'metacollection' : metacollection, 'comment': comment @@ -962,6 +963,7 @@ class MetaInfo extends GISJsonSerialised { } def walkrelated(ArrayList metacollection, String comment = '', int level = 0, String gatheredpath = '', boolean limiteddepth = false, int maxdepth = 0) { + script.echo("walkrelated Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}") def results = [ 'metacollection' : metacollection, 'comment': comment From 5b350028ea1a0391199b6f014a389dc31e69cd04 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 22:02:04 +0000 Subject: [PATCH 1716/1971] Try to walk through build meta items --- release/do.groovy | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 3430342..563a49f 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -402,10 +402,7 @@ def releasehierarchy(buildfolder, buildmeta, String maxdepth, String otherreleas preconditions() // Walk the meta information to a max depth, looking for components to release - def componentReleaseInfo - dir(buildfolder) { - componentReleaseInfo = buildmeta.releasewalkerunique(md) - } + def componentReleaseInfo = buildmeta.releasewalkerunique(md, buildfolder) echo "Unique components:" def String versioncomponent = "" for (key in componentReleaseInfo.keySet()) { From 99aa54ae8e6908083bbf02a1f49e62ddb12f956b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 22:13:33 +0000 Subject: [PATCH 1717/1971] Try to walk through build meta items --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 499535a..3f60bfa 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -998,7 +998,7 @@ class MetaInfo extends GISJsonSerialised { } Map releasewalkerversionunique(int maxdepth, String startpath = '') { - def ArrayList metacollection = releasewalker(maxdepth, startpath) + def ArrayList metacollection = releasewalker(maxdepth, "${startpath}/${METAFOLDERNAME}") def Map versionuniquecollection = new LinkedHashMap() for (metainfo in metacollection) { @@ -1010,7 +1010,7 @@ class MetaInfo extends GISJsonSerialised { } Map releasewalkerunique(int maxdepth, String startpath = '') { - def ArrayList metacollection = releasewalker(maxdepth, startpath) + def ArrayList metacollection = releasewalker(maxdepth, "${startpath}/${METAFOLDERNAME}") def Map uniquecollection = new LinkedHashMap() for (metainfo in metacollection) { From b973208999feeea379038cc13a2297495fc02c5b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 15 Dec 2021 22:20:07 +0000 Subject: [PATCH 1718/1971] Try to walk through build meta items --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 563a49f..d131173 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -411,7 +411,7 @@ def releasehierarchy(buildfolder, buildmeta, String maxdepth, String otherreleas echo versioncomponent // Walk the meta information to a max depth, looking for components to release - def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md) + def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md, buildfolder) echo "Version unique components:" def String versionuniquecomponent = "" for (key in componentReleaseInfoVersionUnique.keySet()) { From ece26703656703826e0ab36307710b30d0181031 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 16 Dec 2021 15:39:32 +0000 Subject: [PATCH 1719/1971] Make the walkers carry more meta data --- meta/folder.groovy | 111 +++++++++++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 35 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 3f60bfa..fb10cbd 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -914,16 +914,32 @@ class MetaInfo extends GISJsonSerialised { return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber } - def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) { + class CollectedMeta { + private MetaInfo metainfo + private String accumulatedpath + + CollectedMeta(MetaInfo metainfo, String accumulatedpath = '') { + this.metainfo = metainfo + this.accumulatedpath = accumulatedpath + } + } + + def openchildmeta(String gatheredpath, String gatheredmetapath, RelatedMetaInfo relatedmetainfo) { def MetaInfo mi = new MetaInfo(script) - def String nextpath + def String nextgatheredpath if (gatheredpath == '') { - nextpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" + nextgatheredpath = "${relatedmetainfo.offsetpath}" } else { - nextpath = "${gatheredpath}/${relatedmetainfo.offsetpath}" + nextgatheredpath = "${gatheredpath}/${relatedmetainfo.offsetpath}" } - def importedmetafile = "${nextpath}/${METAFILENAME}" + def String nextgatheredmetapath + if (gatheredmetapath == '') { + nextgatheredmetapath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" + } else { + nextgatheredmetapath = "${gatheredmetapath}/${relatedmetainfo.offsetpath}" + } + def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}" def boolean imported if (script.fileExists(importedmetafile)) { mi.deserialiseJson(importedmetafile) @@ -935,25 +951,38 @@ class MetaInfo extends GISJsonSerialised { def childmetainfo = [ 'imported': imported, - 'nextpath': nextpath, + 'nextgatheredpath': nextgatheredpath, + 'nextgatheredmetapath': nextgatheredmetapath, 'childmeta': mi ] return childmetainfo } - def walkrelated_v0_1(ArrayList metacollection, String comment = '', int level = 0, boolean limiteddepth = false, int maxdepth = 0) { - script.echo("walkrelated_v0_1 Iteration:\nLevel: ${level}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}") + def walkrelated_v0_1(ArrayList metacollection, + String comment = '', + int level = 0, + String gatheredpath = '', + String gatheredmetapath = '', + boolean limiteddepth = false, + int maxdepth = 0) { + script.echo("walkrelated_v0_1 Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}") def results = [ 'metacollection' : metacollection, 'comment': comment ] if (!limiteddepth || maxdepth > 0) { - results.metacollection.add(this) + results.metacollection.add(new CollectedMeta(this, gatheredpath)) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta - results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, limiteddepth, maxdepth - 1) + results = othermeta.walkrelated_v0_1(results.metacollection, + results.comment, + level + 1, + "${gatheredpath}/${relatedmetainfo.offsetpath}", + "${gatheredmetapath}/${relatedmetainfo.offsetpath}", + limiteddepth, + maxdepth - 1) } else { script.error("There is non v0.1 format related meta info under v0.1 related meta info") } @@ -962,24 +991,36 @@ class MetaInfo extends GISJsonSerialised { return [ 'metacollection' : results.metacollection, 'comment': results.comment ] } - def walkrelated(ArrayList metacollection, String comment = '', int level = 0, String gatheredpath = '', boolean limiteddepth = false, int maxdepth = 0) { - script.echo("walkrelated Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}") + def walkrelated(ArrayList metacollection, + String comment = '', + int level = 0, + String gatheredpath = '', + String gatheredmetapath = '', + boolean limiteddepth = false, + int maxdepth = 0) { + script.echo("walkrelated Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}") def results = [ 'metacollection' : metacollection, 'comment': comment ] if (!limiteddepth || maxdepth > 0) { - results.metacollection.add(this) + results.metacollection.add(new CollectedMeta(this, gatheredpath)) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { if (relatedmetainfo.format == '0.2') { - def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo) + def childmetainfo = openchildmeta(gatheredpath, gatheredmetapath, relatedmetainfo) if (childmetainfo.imported) { - results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath, limiteddepth, maxdepth - 1) + results = childmetainfo.childmeta.walkrelated(results.metacollection, + results.comment, + level + 1, + childmetainfo.nextgatheredpath + childmetainfo.nextgatheredmetapath, + limiteddepth, + maxdepth - 1) } } else if (relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta - results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, limiteddepth, maxdepth - 1) + results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, gatheredpath, gatheredmetapath, limiteddepth, maxdepth - 1) } } } @@ -987,23 +1028,23 @@ class MetaInfo extends GISJsonSerialised { } def allrelatedmeta() { - ArrayList metacollection = new ArrayList() + ArrayList metacollection = new ArrayList() return walkrelated(metacollection) } - ArrayList releasewalker(int maxdepth, String startpath = '') { - def ArrayList metacollection = new ArrayList() - def results = walkrelated(metacollection, 'meta', 0, startpath, true, maxdepth) + ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { + def ArrayList metacollection = new ArrayList() + def results = walkrelated(metacollection, 'meta', 0, startpath, startmetapath, true, maxdepth) return results.metacollection } - Map releasewalkerversionunique(int maxdepth, String startpath = '') { - def ArrayList metacollection = releasewalker(maxdepth, "${startpath}/${METAFOLDERNAME}") + Map releasewalkerversionunique(int maxdepth, String startpath = '', String startmetapath = '') { + def ArrayList metacollection = releasewalker(maxdepth, "${startpath}/${METAFOLDERNAME}", startmetapath) - def Map versionuniquecollection = new LinkedHashMap() - for (metainfo in metacollection) { - def String uniquestring = metainfo.componentversionuniqueidentifier() - versionuniquecollection.put(uniquestring, metainfo) + def Map versionuniquecollection = new LinkedHashMap() + for (metaitem in metacollection) { + def String uniquestring = metaitem.metainfo.componentversionuniqueidentifier() + versionuniquecollection.put(uniquestring, metaitem) } return versionuniquecollection @@ -1013,9 +1054,9 @@ class MetaInfo extends GISJsonSerialised { def ArrayList metacollection = releasewalker(maxdepth, "${startpath}/${METAFOLDERNAME}") def Map uniquecollection = new LinkedHashMap() - for (metainfo in metacollection) { - def String uniquestring = metainfo.componentidentifier() - uniquecollection.put(uniquestring, metainfo) + for (metaitem in metacollection) { + def String uniquestring = metaitem.metainfo.componentidentifier() + uniquecollection.put(uniquestring, metaitem) } return uniquecollection @@ -1027,15 +1068,15 @@ class MetaInfo extends GISJsonSerialised { def findAssociatedMeta(String productname, String subcomponentname) { def results = [ - 'matchedmeta' : getNewMetaObject(this), + 'matchedmetaitem' : new CollectedMeta(this), 'matchfound' : false ] def walkresults = allrelatedmeta() - for (dependentmeta in walkresults.metacollection) { - if (dependentmeta.productinfo.productname == productname && - dependentmeta.productinfo.subcomponentname == subcomponentname) { - script.echo("Found matching component: ${dependentmeta.globalreleasetag()}") - results.matchedmeta = dependentmeta + for (dependentmetaitem in walkresults.metacollection) { + if (dependentmetaitem.metainfo.productinfo.productname == productname && + dependentmetaitem.metainfo.productinfo.subcomponentname == subcomponentname) { + script.echo("Found matching component: ${dependentmetaitem.metainfo.globalreleasetag()}") + results.matchedmetaitem = dependentmetaitem results.matchfound = true break } From 755bb994d0842fe3e52df721706c83b6a34efda9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 10:46:47 +0000 Subject: [PATCH 1720/1971] Wipe out an additional folder that the logic is now exporting --- copy/logic.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/copy/logic.groovy b/copy/logic.groovy index 9585f01..7bc94d1 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -17,6 +17,7 @@ pipeline { cleanfolders = [ LOGICDEST, "${WORKSPACE}/embedded_logic", + "${WORKSPACE}/el", ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) From 053b39b3df1bbf2f344cdc8ba7701f7fe94f038f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 11:23:05 +0000 Subject: [PATCH 1721/1971] Make the walkers carry more meta data --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index fb10cbd..0fd0d8e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1013,7 +1013,7 @@ class MetaInfo extends GISJsonSerialised { results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, - childmetainfo.nextgatheredpath + childmetainfo.nextgatheredpath, childmetainfo.nextgatheredmetapath, limiteddepth, maxdepth - 1) From 93ad1bea33bd4304e831232dca66af2ee683b69a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 11:50:07 +0000 Subject: [PATCH 1722/1971] Make the walkers carry more meta data --- meta/folder.groovy | 8 ++++---- release/do.groovy | 6 +++--- release/release.groovy | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0fd0d8e..1c6441b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1039,7 +1039,7 @@ class MetaInfo extends GISJsonSerialised { } Map releasewalkerversionunique(int maxdepth, String startpath = '', String startmetapath = '') { - def ArrayList metacollection = releasewalker(maxdepth, "${startpath}/${METAFOLDERNAME}", startmetapath) + def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}") def Map versionuniquecollection = new LinkedHashMap() for (metaitem in metacollection) { @@ -1050,10 +1050,10 @@ class MetaInfo extends GISJsonSerialised { return versionuniquecollection } - Map releasewalkerunique(int maxdepth, String startpath = '') { - def ArrayList metacollection = releasewalker(maxdepth, "${startpath}/${METAFOLDERNAME}") + Map releasewalkerunique(int maxdepth, String startpath = '', String startmetapath = '') { + def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}") - def Map uniquecollection = new LinkedHashMap() + def Map uniquecollection = new LinkedHashMap() for (metaitem in metacollection) { def String uniquestring = metaitem.metainfo.componentidentifier() uniquecollection.put(uniquestring, metaitem) diff --git a/release/do.groovy b/release/do.groovy index d131173..133d425 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -396,13 +396,13 @@ def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, Stri repoandtagsappend("\n") } -def releasehierarchy(buildfolder, buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) { +def releasehierarchy(String buildfolder, String metafolder, 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, buildfolder) + def componentReleaseInfo = buildmeta.releasewalkerunique(md, buildfolder, metafolder) echo "Unique components:" def String versioncomponent = "" for (key in componentReleaseInfo.keySet()) { @@ -411,7 +411,7 @@ def releasehierarchy(buildfolder, buildmeta, String maxdepth, String otherreleas echo versioncomponent // Walk the meta information to a max depth, looking for components to release - def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md, buildfolder) + def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md, buildfolder metafolder) echo "Version unique components:" def String versionuniquecomponent = "" for (key in componentReleaseInfoVersionUnique.keySet()) { diff --git a/release/release.groovy b/release/release.groovy index 2324b60..82af511 100644 --- a/release/release.groovy +++ b/release/release.groovy @@ -42,7 +42,7 @@ pipeline { 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(BUILD_ARTIFACTS, buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH) + (summarystring, markunstable, unstablereason) = releaser.releasehierarchy('', BUILD_ARTIFACTS, buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' From 61e2834a1b7c11a77eb0b7675579cb7e044ce073 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 11:58:52 +0000 Subject: [PATCH 1723/1971] Make the walkers carry more meta data --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 133d425..2f175ea 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -411,7 +411,7 @@ def releasehierarchy(String buildfolder, String metafolder, buildmeta, String ma echo versioncomponent // Walk the meta information to a max depth, looking for components to release - def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md, buildfolder metafolder) + def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md, buildfolder, metafolder) echo "Version unique components:" def String versionuniquecomponent = "" for (key in componentReleaseInfoVersionUnique.keySet()) { From 4b72bba43e0082fc7beca9399122248e9287771c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 12:29:11 +0000 Subject: [PATCH 1724/1971] Make the walkers carry more meta data --- meta/folder.groovy | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1c6441b..eef608d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -917,10 +917,12 @@ class MetaInfo extends GISJsonSerialised { class CollectedMeta { private MetaInfo metainfo private String accumulatedpath + private String accumulatedmetapath - CollectedMeta(MetaInfo metainfo, String accumulatedpath = '') { + CollectedMeta(MetaInfo metainfo, String accumulatedpath = '', String accumulatedmetapath = '') { this.metainfo = metainfo this.accumulatedpath = accumulatedpath + this.accumulatedmetapath = accumulatedmetapath } } @@ -971,7 +973,7 @@ class MetaInfo extends GISJsonSerialised { 'comment': comment ] if (!limiteddepth || maxdepth > 0) { - results.metacollection.add(new CollectedMeta(this, gatheredpath)) + results.metacollection.add(new CollectedMeta(this, gatheredpath, gatheredmetapath)) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { @@ -1004,7 +1006,7 @@ class MetaInfo extends GISJsonSerialised { 'comment': comment ] if (!limiteddepth || maxdepth > 0) { - results.metacollection.add(new CollectedMeta(this, gatheredpath)) + results.metacollection.add(new CollectedMeta(this, gatheredpath, gatheredmetapath)) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { if (relatedmetainfo.format == '0.2') { @@ -1038,13 +1040,25 @@ class MetaInfo extends GISJsonSerialised { return results.metacollection } + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) { + if (releasemetacollection.containsKey(uniquestring)) { + def existingentry = releasemetacollection[uniquestring] + if (existingentry.accumulatedpath.size() > metaitem.accumulatedpath.size()) { + releasemetacollection.put(uniquestring, metaitem) + } + } else { + releasemetacollection.put(uniquestring, metaitem) + } + return releasemetacollection + } + Map releasewalkerversionunique(int maxdepth, String startpath = '', String startmetapath = '') { def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}") def Map versionuniquecollection = new LinkedHashMap() for (metaitem in metacollection) { def String uniquestring = metaitem.metainfo.componentversionuniqueidentifier() - versionuniquecollection.put(uniquestring, metaitem) + versionuniquecollection = putwithshortestoffsetpath(uniquestring, metaitem) } return versionuniquecollection @@ -1056,7 +1070,7 @@ class MetaInfo extends GISJsonSerialised { def Map uniquecollection = new LinkedHashMap() for (metaitem in metacollection) { def String uniquestring = metaitem.metainfo.componentidentifier() - uniquecollection.put(uniquestring, metaitem) + versionuniquecollection = putwithshortestoffsetpath(uniquestring, metaitem) } return uniquecollection From dcd5fe6382f62202e124b296edb500c5d3b1e3ba Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 12:31:24 +0000 Subject: [PATCH 1725/1971] Make the walkers carry more meta data --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index eef608d..9934287 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1058,7 +1058,7 @@ class MetaInfo extends GISJsonSerialised { def Map versionuniquecollection = new LinkedHashMap() for (metaitem in metacollection) { def String uniquestring = metaitem.metainfo.componentversionuniqueidentifier() - versionuniquecollection = putwithshortestoffsetpath(uniquestring, metaitem) + versionuniquecollection = putwithshortestoffsetpath(versionuniquecollection, uniquestring, metaitem) } return versionuniquecollection @@ -1070,7 +1070,7 @@ class MetaInfo extends GISJsonSerialised { def Map uniquecollection = new LinkedHashMap() for (metaitem in metacollection) { def String uniquestring = metaitem.metainfo.componentidentifier() - versionuniquecollection = putwithshortestoffsetpath(uniquestring, metaitem) + versionuniquecollection = putwithshortestoffsetpath(versionuniquecollection, uniquestring, metaitem) } return uniquecollection From 55a087b237e35f3a0363bc0db933162ed88b34ad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 12:32:48 +0000 Subject: [PATCH 1726/1971] Make the walkers carry more meta data --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9934287..fb27e64 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1070,7 +1070,7 @@ class MetaInfo extends GISJsonSerialised { def Map uniquecollection = new LinkedHashMap() for (metaitem in metacollection) { def String uniquestring = metaitem.metainfo.componentidentifier() - versionuniquecollection = putwithshortestoffsetpath(versionuniquecollection, uniquestring, metaitem) + uniquecollection = putwithshortestoffsetpath(uniquecollection, uniquestring, metaitem) } return uniquecollection From a342a0f482410c9eb50f6729267e14baf9c60066 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 12:40:42 +0000 Subject: [PATCH 1727/1971] Alter release process to handle new meta walker info --- release/do.groovy | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 2f175ea..8a2ea61 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -112,10 +112,10 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde // Copy relevant artifacts to temp folder summaryappend("Artifacts: ") def boolean result = true - for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) { + for (artifactfilter in buildinfo.metainfo.releaseinfo.releaseitems) { def filterpath = artifactfilter - if (buildinfo.offsetpath) { - filterpath = buildinfo.offsetpath + '/' + artifactfilter + if (buildinfo.accumulatedpath) { + filterpath = buildinfo.accumulatedpath + '/' + artifactfilter } // Copy relevant artifacts to temp folder echo "Copying artifacts: ${filterpath} to ${tempfolder}" @@ -136,7 +136,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } if (result) { // Move relevant artifacts from temp folder to release position - def originalrootdir = tempfolder + "/" + buildinfo.offsetpath + def originalrootdir = tempfolder + "/" + buildinfo.accumulatedpath dir(originalrootdir) { sh("mv * ${repofolder}") } @@ -375,7 +375,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source } def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) { - def buildmeta = buildinfo.meta + def buildmeta = buildinfo.metainfo def uriconverted = gh.uniquereporootname(buildmeta.gitinfo.remoteurl) def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${uriconverted}" def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}" @@ -427,7 +427,7 @@ def releasehierarchy(String buildfolder, String metafolder, buildmeta, String ma for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] - if (!buildinfo.jenkinsbuildinfo.isFullBuild()) { + if (!buildinfo.metainfo.jenkinsbuildinfo.isFullBuild()) { error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" } } From 206e0f30a1849f87fe8b302e224a06dd25cc4e52 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 13:10:08 +0000 Subject: [PATCH 1728/1971] Alter release process to handle new meta walker info --- release/do.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index 8a2ea61..a521427 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -118,14 +118,14 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde filterpath = buildinfo.accumulatedpath + '/' + artifactfilter } // Copy relevant artifacts to temp folder - echo "Copying artifacts: ${filterpath} to ${tempfolder}" + echo "Copying artifacts: Filter path: ${filterpath} to ${tempfolder} from job: ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname} #${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" try { copyArtifacts( filter: filterpath, projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname, selector: [ $class: 'ParameterizedBuildSelector', - parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" + parameterName: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" ], target: tempfolder ) @@ -138,7 +138,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde // Move relevant artifacts from temp folder to release position def originalrootdir = tempfolder + "/" + buildinfo.accumulatedpath dir(originalrootdir) { - sh("mv * ${repofolder}") + sh("mv -v * ${repofolder}") } } summaryappend("${artifactfilter},") From 0b057d0a0e748898aa869ade3f03d3c762c3e349 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 13:26:48 +0000 Subject: [PATCH 1729/1971] Alter release process to handle new meta walker info --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index a521427..ca7b84e 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -134,6 +134,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde result = false summaryappend("Does not exist:") } + error("Debugging") if (result) { // Move relevant artifacts from temp folder to release position def originalrootdir = tempfolder + "/" + buildinfo.accumulatedpath From 2fe1414c19ccdbe105575df964dfc62b71d256ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 13:30:57 +0000 Subject: [PATCH 1730/1971] Alter release process to handle new meta walker info --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index ca7b84e..d5b43ed 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -134,7 +134,6 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde result = false summaryappend("Does not exist:") } - error("Debugging") if (result) { // Move relevant artifacts from temp folder to release position def originalrootdir = tempfolder + "/" + buildinfo.accumulatedpath @@ -143,6 +142,7 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } } summaryappend("${artifactfilter},") + error("Debugging") } return result } From af1c49958a82af57995d8e77b9d0723306ffad1a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 13:34:51 +0000 Subject: [PATCH 1731/1971] Alter release process to handle new meta walker info --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index d5b43ed..8c25fc2 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -142,8 +142,8 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } } summaryappend("${artifactfilter},") - error("Debugging") } + error("Debugging") return result } From 2f8ac675867242232ca2003c8866b3bf7c19743f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 13:41:50 +0000 Subject: [PATCH 1732/1971] Alter release process to handle new meta walker info --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 8c25fc2..e7d936d 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -143,7 +143,6 @@ def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolde } summaryappend("${artifactfilter},") } - error("Debugging") return result } @@ -359,6 +358,7 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source releasegitpush(dryrunpush) } } + error("Debugging") dir(sourcerepo) { def String srcbuildstamptag = buildmeta.globalreleasetag() def String buildsha = buildmeta.gitinfo.gitrevision From 8ccca6aa15ba6375c808f0c462a735a44162fac8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 13:57:54 +0000 Subject: [PATCH 1733/1971] Alter release process to handle new meta walker info --- release/do.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index e7d936d..a521427 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -358,7 +358,6 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source releasegitpush(dryrunpush) } } - error("Debugging") dir(sourcerepo) { def String srcbuildstamptag = buildmeta.globalreleasetag() def String buildsha = buildmeta.gitinfo.gitrevision From 236aa6fe68c8f94dbc235ff95da4b436f3593b5a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 14:11:41 +0000 Subject: [PATCH 1734/1971] Alter release process to handle new meta walker info --- release/do.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index a521427..87eb9ae 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -412,13 +412,18 @@ def releasehierarchy(String buildfolder, String metafolder, buildmeta, String ma // Walk the meta information to a max depth, looking for components to release def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md, buildfolder, metafolder) - echo "Version unique components:" - def String versionuniquecomponent = "" + def String versionuniquecomponent = '' + def String versionwithpathscomponent = '' for (key in componentReleaseInfoVersionUnique.keySet()) { versionuniquecomponent += "${key}\n" + versionwithpathscomponent = "${key}: path: ${componentReleaseInfoVersionUnique[key].accumulatedpath} meta path: ${componentReleaseInfoVersionUnique[key].accumulatedmetapath}\n" } + echo 'Version unique components:' echo versionuniquecomponent + echo 'Version unique components with paths:' + echo versionwithpathscomponent + 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? (If you ignore this issue, you will get an error much later because the system cannot tag 2 different commits of the associated source code with the same label)" From 9d4b6ecf836405b1e75247a29909f86cdddb98eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 14:13:12 +0000 Subject: [PATCH 1735/1971] Alter release process to handle new meta walker info --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 87eb9ae..c61f1dd 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -416,7 +416,7 @@ def releasehierarchy(String buildfolder, String metafolder, buildmeta, String ma def String versionwithpathscomponent = '' for (key in componentReleaseInfoVersionUnique.keySet()) { versionuniquecomponent += "${key}\n" - versionwithpathscomponent = "${key}: path: ${componentReleaseInfoVersionUnique[key].accumulatedpath} meta path: ${componentReleaseInfoVersionUnique[key].accumulatedmetapath}\n" + versionwithpathscomponent += "${key}: path: ${componentReleaseInfoVersionUnique[key].accumulatedpath} meta path: ${componentReleaseInfoVersionUnique[key].accumulatedmetapath}\n" } echo 'Version unique components:' echo versionuniquecomponent From 29f666075f68d3769ac2149952d8f74859683eee Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 14:22:30 +0000 Subject: [PATCH 1736/1971] Alter release process to handle new meta walker info --- meta/folder.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index fb27e64..39b8d85 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1043,7 +1043,9 @@ class MetaInfo extends GISJsonSerialised { Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] - if (existingentry.accumulatedpath.size() > metaitem.accumulatedpath.size()) { + def existingentrypathlength = existingentry.accumulatedpath.split('/').size() + def newentrypathlength = metaitem.accumulatedpath.split('/').size() + if (existingentrypathlength > newentrypathlength) { releasemetacollection.put(uniquestring, metaitem) } } else { From 5e1a008d8f043c3d0ad9309ed7a34734f742a078 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 15:12:33 +0000 Subject: [PATCH 1737/1971] Alter release process to handle new meta walker info --- check/do_meta.groovy | 6 +++--- differences/dometahierarchy.groovy | 8 ++++---- publish/do.groovy | 4 ++-- publish/publishitems.groovy | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/check/do_meta.groovy b/check/do_meta.groovy index 7bfe2d1..4b8a89e 100644 --- a/check/do_meta.groovy +++ b/check/do_meta.groovy @@ -52,8 +52,8 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { echo "All components:" def String componentinfo = "" for (entry in buildinfo) { - def name = entry.meta.componentversionuniqueidentifier() - def offsetpath = entry.offsetpath + def name = entry.metainfo.componentversionuniqueidentifier() + def offsetpath = entry.accumulatedpath def abspath = "${buildpathroot}/${offsetpath}" componentinfo += "Name: ${name} \t\t\t\tPath: ${offsetpath} \t\t\t\tFile exists in import: ${fileExists(abspath)}\n" } @@ -65,7 +65,7 @@ def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) { def String versioncomponent = "" for (key in componentReleaseInfo.keySet()) { def buildinfo2 = componentReleaseInfo[key] - def offsetpath = buildinfo2.offsetpath + def offsetpath = buildinfo2.accumulatedpath def abspath = "${buildpathroot}/${offsetpath}" versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n" } diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 6280960..40394d5 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -95,8 +95,8 @@ 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" + def accumulatedpath = relatedmetainfo.accumulatedpath + info += "Name: ${key}\t\t\t\tPath: ${accumulatedpath}\n" } echo info } @@ -768,8 +768,8 @@ 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 + def earlymeta = earlymetaitems[key].metainfo + def latermeta = latermetaitems[key].metainfo summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ") diff --git a/publish/do.groovy b/publish/do.groovy index 1b227f4..9f5bd21 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -60,7 +60,7 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) { summaryappend("Artifacts: ") - def releasemeta = releaseinfo.meta + def releasemeta = releaseinfo.metainfo def String componentURL = releasemeta.releaseinfo.releaserepoURL def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}" def publishableitems = releasemeta.publishableinfo @@ -113,7 +113,7 @@ def copydirectory(File dirFrom, File dirTo) { } def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) { - def releasemeta = releaseinfo.meta + def releasemeta = releaseinfo.metainfo def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta) summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 677970e..06e5fba 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -89,7 +89,7 @@ class PublishableItemsSelection { } def outputDescription(menuitems, releaseinfo) { - def meta = releaseinfo.meta + def meta = releaseinfo.metainfo for (publishableitem in meta.publishableinfo) { menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") @@ -97,7 +97,7 @@ class PublishableItemsSelection { } def outputSelection(menuitems, releaseinfo) { - def meta = releaseinfo.meta + def meta = releaseinfo.metainfo for (publishableitem in meta.publishableinfo) { menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}") From 2a7e94b301eccd0dd89c159bf457a75768e1c436 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 16:30:27 +0000 Subject: [PATCH 1738/1971] Debug components --- meta/folder.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 39b8d85..d5b6b7f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1089,6 +1089,7 @@ class MetaInfo extends GISJsonSerialised { ] def walkresults = allrelatedmeta() for (dependentmetaitem in walkresults.metacollection) { + script.echo("Comparing: ${dependentmetaitem.metainfo.productinfo.productname} ${dependentmetaitem.metainfo.productinfo.subcomponentname}") if (dependentmetaitem.metainfo.productinfo.productname == productname && dependentmetaitem.metainfo.productinfo.subcomponentname == subcomponentname) { script.echo("Found matching component: ${dependentmetaitem.metainfo.globalreleasetag()}") From d945efb8b76503a38d106fbe4f270e7b8c17c5ef Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 16:53:24 +0000 Subject: [PATCH 1739/1971] Help the meta walker find the meta data for a child --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d5b6b7f..c3db541 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1029,9 +1029,9 @@ class MetaInfo extends GISJsonSerialised { return [ 'metacollection' : results.metacollection, 'comment': results.comment ] } - def allrelatedmeta() { + def allrelatedmeta(String metapath) { ArrayList metacollection = new ArrayList() - return walkrelated(metacollection) + return walkrelated(metacollection, '', 0, '', metapath) } ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { @@ -1082,12 +1082,12 @@ class MetaInfo extends GISJsonSerialised { return new MetaInfo(script) } - def findAssociatedMeta(String productname, String subcomponentname) { + def findAssociatedMeta(String parentmetapath, String productname, String subcomponentname) { def results = [ 'matchedmetaitem' : new CollectedMeta(this), 'matchfound' : false ] - def walkresults = allrelatedmeta() + def walkresults = allrelatedmeta(parentmetapath) for (dependentmetaitem in walkresults.metacollection) { script.echo("Comparing: ${dependentmetaitem.metainfo.productinfo.productname} ${dependentmetaitem.metainfo.productinfo.subcomponentname}") if (dependentmetaitem.metainfo.productinfo.productname == productname && From f554d5bd6ce258ed2f8623efc8d470b2ce0ef528 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 17:01:19 +0000 Subject: [PATCH 1740/1971] Help the meta walker find the meta data for a child --- import/importer.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 0e2ca17..8ed4263 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -342,12 +342,12 @@ def artifactimport(meta, } // Import the artifacts of a named child component found below parent meta's hierarchy -def artifactimport(meta, parentmeta, String childproduct, String childsubcomponent, importoptions, String destinationfolder) { +def artifactimport(meta, parentmeta, String parentmetapath, String childproduct, String childsubcomponent, importoptions, String destinationfolder) { // Import from parent meta def childmeta = meta.getNewMetaObject() def childmeta2 echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" - def findresults = parentmeta.findAssociatedMeta(childproduct, childsubcomponent) + def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent) if (findresults.matchfound) { childmeta = findresults.matchedmeta if (childmeta.releaseinfo.released) { From 16061cfcc6950dcd5f1cd43e3afc8bef707efd3f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 17:11:49 +0000 Subject: [PATCH 1741/1971] Help the meta walker find the meta data for a child --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index c3db541..bffa75f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1031,7 +1031,7 @@ class MetaInfo extends GISJsonSerialised { def allrelatedmeta(String metapath) { ArrayList metacollection = new ArrayList() - return walkrelated(metacollection, '', 0, '', metapath) + return walkrelated(metacollection, '', 0, '', "${metapath}/${METAFOLDERNAME}") } ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { From 40054880d4ab1a4a9acbc54d3d60fca9f62c4c76 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 17:39:58 +0000 Subject: [PATCH 1742/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index bffa75f..2b84781 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1020,7 +1020,7 @@ class MetaInfo extends GISJsonSerialised { limiteddepth, maxdepth - 1) } - } else if (relatedmetainfo.format == '0.1') { + } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, gatheredpath, gatheredmetapath, limiteddepth, maxdepth - 1) } From d93eb4bc236d9be47c9082cc1fdcf17756d124fe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 18:03:19 +0000 Subject: [PATCH 1743/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 2b84781..1c85658 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -600,10 +600,12 @@ class MetaInfo extends GISJsonSerialised { abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { private String format + private String offsetpath - RelatedMetaInfo(script, format) { + RelatedMetaInfo(script, format, offsetpath) { super(script) this.format = format + this.offsetpath = offsetpath } abstract void deserialiseJson(rawmeta) @@ -612,15 +614,17 @@ class MetaInfo extends GISJsonSerialised { String format() { return format } + + String getoffsetpath() { + return offsetpath + } } class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { - String offsetpath - MetaInfo meta + private MetaInfo meta RelatedMetaInfo_v0_1(script, offsetpath = "", MetaInfo meta = null) { - super(script, '0.1') - this.offsetpath = offsetpath + super(script, '0.1', offsetpath) this.meta = meta } @@ -638,16 +642,16 @@ class MetaInfo extends GISJsonSerialised { ] return data } + + String get } class RelatedMetaInfo_v0_2 extends RelatedMetaInfo { private String importpath - private String offsetpath RelatedMetaInfo_v0_2(script, importpath = "", offsetpath = "") { - super(script, '0.2') + super(script, '0.2', offsetpath) this.importpath = importpath - this.offsetpath = offsetpath } void deserialiseJson(rawmeta) { @@ -1009,6 +1013,7 @@ class MetaInfo extends GISJsonSerialised { results.metacollection.add(new CollectedMeta(this, gatheredpath, gatheredmetapath)) results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { + script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}") if (relatedmetainfo.format == '0.2') { def childmetainfo = openchildmeta(gatheredpath, gatheredmetapath, relatedmetainfo) if (childmetainfo.imported) { From f09c84e5ec6404478eb92ae21c0ed0ad9e0d883e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 18:13:50 +0000 Subject: [PATCH 1744/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1c85658..7dd4521 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -600,7 +600,7 @@ class MetaInfo extends GISJsonSerialised { abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { private String format - private String offsetpath + protected String offsetpath RelatedMetaInfo(script, format, offsetpath) { super(script) From f44dc09dab4eb08b89c14298c0cc9032dd3ed355 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 18:28:34 +0000 Subject: [PATCH 1745/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7dd4521..cccc456 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -600,7 +600,7 @@ class MetaInfo extends GISJsonSerialised { abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { private String format - protected String offsetpath + private String offsetpath RelatedMetaInfo(script, format, offsetpath) { super(script) @@ -618,6 +618,10 @@ class MetaInfo extends GISJsonSerialised { String getoffsetpath() { return offsetpath } + + void setoffsetoffsetpath(String offsetpath) { + this.offsetpath = offsetpath + } } class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { @@ -629,7 +633,7 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - offsetpath = rawmeta['offsetpath'] + setoffsetoffsetpath(rawmeta['offsetpath']) meta = new MetaInfo(script) meta.deserialiseJson(rawmeta['meta']) } @@ -637,7 +641,7 @@ class MetaInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ 'format' : format, - 'offsetpath' : offsetpath, + 'offsetpath' : getoffsetpath(), 'meta' : meta.serialisationdata(), ] return data @@ -656,13 +660,13 @@ class MetaInfo extends GISJsonSerialised { void deserialiseJson(rawmeta) { //format = rawmeta['format'] - offsetpath = rawmeta['offsetpath'] + setoffsetoffsetpath(rawmeta['offsetpath']) } LinkedHashMap serialisationdata() { def data = [ 'format' : format, - 'offsetpath' : offsetpath, + 'offsetpath' : getoffsetpath(), ] return data } From cd43ecf33aba1e6c91e492ac0984cc1b4069620e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 17 Dec 2021 18:37:18 +0000 Subject: [PATCH 1746/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index cccc456..712795b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -600,7 +600,7 @@ class MetaInfo extends GISJsonSerialised { abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { private String format - private String offsetpath + String offsetpath RelatedMetaInfo(script, format, offsetpath) { super(script) From 6e3c993d3e0c3f49f6f768a585c4a9864b09d4aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 18 Dec 2021 18:02:11 +0000 Subject: [PATCH 1747/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 712795b..0b6128b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -600,32 +600,26 @@ class MetaInfo extends GISJsonSerialised { abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { private String format - String offsetpath RelatedMetaInfo(script, format, offsetpath) { super(script) this.format = format this.offsetpath = offsetpath } - - abstract void deserialiseJson(rawmeta) - abstract LinkedHashMap serialisationdata() String format() { return format } - String getoffsetpath() { - return offsetpath - } - - void setoffsetoffsetpath(String offsetpath) { - this.offsetpath = offsetpath - } + abstract void deserialiseJson(rawmeta) + abstract LinkedHashMap serialisationdata() + abstract String getoffsetpath() + abstract void setoffsetpath(String offsetpath) } class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { private MetaInfo meta + private String offsetpath RelatedMetaInfo_v0_1(script, offsetpath = "", MetaInfo meta = null) { super(script, '0.1', offsetpath) @@ -633,7 +627,7 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - setoffsetoffsetpath(rawmeta['offsetpath']) + setoffsetpath(rawmeta['offsetpath']) meta = new MetaInfo(script) meta.deserialiseJson(rawmeta['meta']) } @@ -647,11 +641,18 @@ class MetaInfo extends GISJsonSerialised { return data } - String get + String getoffsetpath() { + return offsetpath + } + + void setoffsetpath(String offsetpath) { + this.offsetpath = offsetpath + } } class RelatedMetaInfo_v0_2 extends RelatedMetaInfo { private String importpath + private String offsetpath RelatedMetaInfo_v0_2(script, importpath = "", offsetpath = "") { super(script, '0.2', offsetpath) @@ -660,7 +661,7 @@ class MetaInfo extends GISJsonSerialised { void deserialiseJson(rawmeta) { //format = rawmeta['format'] - setoffsetoffsetpath(rawmeta['offsetpath']) + setoffsetpath(rawmeta['offsetpath']) } LinkedHashMap serialisationdata() { @@ -670,6 +671,14 @@ class MetaInfo extends GISJsonSerialised { ] return data } + + String getoffsetpath() { + return offsetpath + } + + void setoffsetpath(String offsetpath) { + this.offsetpath = offsetpath + } } private ProductInfo productinfo From 7e63a317c07b99a77ac76e3f3875f9601ee78388 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 18 Dec 2021 18:21:30 +0000 Subject: [PATCH 1748/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 0b6128b..76dae26 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -599,16 +599,11 @@ class MetaInfo extends GISJsonSerialised { } abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { - private String format + String format - RelatedMetaInfo(script, format, offsetpath) { + RelatedMetaInfo(script, format) { super(script) this.format = format - this.offsetpath = offsetpath - } - - String format() { - return format } abstract void deserialiseJson(rawmeta) @@ -622,7 +617,8 @@ class MetaInfo extends GISJsonSerialised { private String offsetpath RelatedMetaInfo_v0_1(script, offsetpath = "", MetaInfo meta = null) { - super(script, '0.1', offsetpath) + super(script, '0.1') + this.offsetpath = offsetpath this.meta = meta } @@ -655,8 +651,9 @@ class MetaInfo extends GISJsonSerialised { private String offsetpath RelatedMetaInfo_v0_2(script, importpath = "", offsetpath = "") { - super(script, '0.2', offsetpath) + super(script, '0.2') this.importpath = importpath + this.offsetpath = offsetpath } void deserialiseJson(rawmeta) { From 95506b8d8a6f045ce727e5a6c6c1c85f33b63f3d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 18 Dec 2021 18:26:02 +0000 Subject: [PATCH 1749/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 76dae26..fc1e072 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -595,7 +595,8 @@ class MetaInfo extends GISJsonSerialised { interface IRelatedMetaInfo { abstract void deserialiseJson(rawmeta) abstract LinkedHashMap serialisationdata() - abstract String format() + abstract String getoffsetpath() + abstract void setoffsetpath(String offsetpath) } abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { From 25938cefe32f899ef876546625fe6688d7381d4c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 18 Dec 2021 18:34:36 +0000 Subject: [PATCH 1750/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 4 ---- 1 file changed, 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index fc1e072..7016b0b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -595,8 +595,6 @@ class MetaInfo extends GISJsonSerialised { interface IRelatedMetaInfo { abstract void deserialiseJson(rawmeta) abstract LinkedHashMap serialisationdata() - abstract String getoffsetpath() - abstract void setoffsetpath(String offsetpath) } abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { @@ -609,8 +607,6 @@ class MetaInfo extends GISJsonSerialised { abstract void deserialiseJson(rawmeta) abstract LinkedHashMap serialisationdata() - abstract String getoffsetpath() - abstract void setoffsetpath(String offsetpath) } class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { From c76a1d68e51ad427a8f55871f93d50a2f299656e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 18 Dec 2021 18:51:19 +0000 Subject: [PATCH 1751/1971] Handle v0.1 imported associated meta --- meta/folder.groovy | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7016b0b..1919d1b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -620,7 +620,7 @@ class MetaInfo extends GISJsonSerialised { } void deserialiseJson(rawmeta) { - setoffsetpath(rawmeta['offsetpath']) + offsetpath = rawmeta['offsetpath'] meta = new MetaInfo(script) meta.deserialiseJson(rawmeta['meta']) } @@ -628,19 +628,11 @@ class MetaInfo extends GISJsonSerialised { LinkedHashMap serialisationdata() { def data = [ 'format' : format, - 'offsetpath' : getoffsetpath(), + 'offsetpath' : offsetpath, 'meta' : meta.serialisationdata(), ] return data } - - String getoffsetpath() { - return offsetpath - } - - void setoffsetpath(String offsetpath) { - this.offsetpath = offsetpath - } } class RelatedMetaInfo_v0_2 extends RelatedMetaInfo { @@ -655,24 +647,16 @@ class MetaInfo extends GISJsonSerialised { void deserialiseJson(rawmeta) { //format = rawmeta['format'] - setoffsetpath(rawmeta['offsetpath']) + offsetpath = rawmeta['offsetpath'] } LinkedHashMap serialisationdata() { def data = [ 'format' : format, - 'offsetpath' : getoffsetpath(), + 'offsetpath' : offsetpath, ] return data } - - String getoffsetpath() { - return offsetpath - } - - void setoffsetpath(String offsetpath) { - this.offsetpath = offsetpath - } } private ProductInfo productinfo From 670d7b22abadc922ada2f8e80538c7a3ada56661 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 18 Dec 2021 19:22:20 +0000 Subject: [PATCH 1752/1971] Handle v0.1 imported associated meta --- import/importer.groovy | 2 +- meta/folder.groovy | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 8ed4263..39b31c6 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -349,7 +349,7 @@ def artifactimport(meta, parentmeta, String parentmetapath, String childproduct, echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent) if (findresults.matchfound) { - childmeta = findresults.matchedmeta + childmeta = findresults.matchedmetaitem.metainfo if (childmeta.releaseinfo.released) { importoptions.releaserepo(childmeta.releaseinfo.releaserepoURL, childmeta.releasetag()) } else { diff --git a/meta/folder.groovy b/meta/folder.groovy index 1919d1b..e2a4cbd 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1018,7 +1018,13 @@ class MetaInfo extends GISJsonSerialised { } } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta - results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, gatheredpath, gatheredmetapath, limiteddepth, maxdepth - 1) + results = othermeta.walkrelated_v0_1(results.metacollection, + results.comment, + level + 1, + gatheredpath, + gatheredmetapath, + limiteddepth, + maxdepth - 1) } } } From 8e53968fbdfa588507b4d93c5a7f96e30d6077b6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 18 Dec 2021 20:38:30 +0000 Subject: [PATCH 1753/1971] Type parameters to archive method --- artifacts/archiver.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy index 78bee55..bafba02 100644 --- a/artifacts/archiver.groovy +++ b/artifacts/archiver.groovy @@ -6,7 +6,7 @@ enum Store { this.JENKINS = Store.JENKINS this.ARTIFACTSERVER = Store.JENKINS -def archive(meta, artifactlist, Store store = JENKINS ) { +def archive(MetaInfo meta, String artifactlist, Store store = JENKINS) { echo "Archiving artifacts to store: ${store}" meta.copyrelatedmeta() if (store == JENKINS) { From 1a111411353902deb9fc6ba76824559c501a2a4e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 18 Dec 2021 21:03:34 +0000 Subject: [PATCH 1754/1971] Type parameters to archive method --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index e2a4cbd..9ddeb7c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -872,10 +872,10 @@ class MetaInfo extends GISJsonSerialised { 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 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) { From 0a0df4d88a2f7608002bb06ba2d21adc851017a7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 19 Dec 2021 13:23:20 +0000 Subject: [PATCH 1755/1971] Load module before cleaning --- copy/all.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index 9b95eb6..0b7d862 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -54,6 +54,7 @@ pipeline { stage('Archiving artifacts') { steps { script { + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") def includes = '**/*' def excludes = "${IMPORTS}/*" echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" @@ -65,7 +66,6 @@ pipeline { 'autobuild', ] cleaner.clean(cleanfolders) - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") artifactarchiver.archive(artifacts: includes) } } From ab0d724399e4f476f584af9bfab18b40ba60c184 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 19 Dec 2021 13:39:47 +0000 Subject: [PATCH 1756/1971] Load module before cleaning --- copy/all.groovy | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index 0b7d862..920c80b 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -54,19 +54,15 @@ pipeline { stage('Archiving artifacts') { steps { script { - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") def includes = '**/*' def excludes = "${IMPORTS}/*" echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" - // This does not work: artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - // This does not work: artifactarchiver.archive(artifacts: includes, excludes: excludes) - // so cleanfolders = [ IMPORTS, 'autobuild', ] cleaner.clean(cleanfolders) - artifactarchiver.archive(artifacts: includes) + archiveArtifacts(artifacts: includes) } } } From 07a8a9d6a3059f250b058b7cf1e41e97dae7e625 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 19 Dec 2021 18:21:23 +0000 Subject: [PATCH 1757/1971] Use indirect artifact archiver --- copy/all.groovy | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index 920c80b..518f593 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -54,15 +54,19 @@ pipeline { stage('Archiving artifacts') { steps { script { - def includes = '**/*' + def artifacts = ['**/*'] + def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + def artifactlist = meta.generateartifacts(artifacts) def excludes = "${IMPORTS}/*" - echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}" + echo "Archiving artifacts: Includes: ${artifacts} Excludes: ${excludes}" + cleanfolders = [ IMPORTS, 'autobuild', ] cleaner.clean(cleanfolders) - archiveArtifacts(artifacts: includes) + + artifactarchiver.archive(meta, artifactlist) } } } From 6b35583fd2565683a197829f481c5521aef0af11 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 19 Dec 2021 21:13:30 +0000 Subject: [PATCH 1758/1971] Use clean while moving imported info --- copy/all.groovy | 31 +++++++++++-------------------- copy/logic.groovy | 39 +++++++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index 518f593..aab479c 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -5,6 +5,8 @@ pipeline { steps { script { meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") } } } @@ -23,7 +25,6 @@ pipeline { stage('Import source artifacts') { steps { script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def copyoptions = importer.getNewImportOptions() copyoptions.source( SOURCE_ARTIFACT_LOCATION, @@ -37,9 +38,14 @@ pipeline { } } } - stage('Copy source artifacts') { + stage('Archiving artifacts') { steps { script { + def artifactlist = meta.generateartifacts(['**/*']) + def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + + cleaner.clean(['meta', 'autobuild']) + dir(IMPORTS) { fileOperations([ fileCopyOperation(excludes: '', @@ -48,23 +54,8 @@ pipeline { targetLocation: WORKSPACE) ]) } - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifacts = ['**/*'] - def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - def artifactlist = meta.generateartifacts(artifacts) - def excludes = "${IMPORTS}/*" - echo "Archiving artifacts: Includes: ${artifacts} Excludes: ${excludes}" - - cleanfolders = [ - IMPORTS, - 'autobuild', - ] - cleaner.clean(cleanfolders) + + cleaner.clean([IMPORTS]) artifactarchiver.archive(meta, artifactlist) } @@ -85,4 +76,4 @@ pipeline { echo 'Succeeded build' } } -} \ No newline at end of file +} diff --git a/copy/logic.groovy b/copy/logic.groovy index 0a28a22..bf90a71 100644 --- a/copy/logic.groovy +++ b/copy/logic.groovy @@ -13,22 +13,25 @@ pipeline { stage('Clean exports') { steps { script { - env.LOGICDEST = "${WORKSPACE}/logic" + LOGICDEST = 'logic' cleanfolders = [ LOGICDEST, - "${WORKSPACE}/embedded_logic", ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) } } } - stage('Copying logic artifacts') { + stage('Import source artifacts') { steps { script { - sh('env') def logicoptions = importer.getNewImportOptions() - logicoptions.source(LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_ARTIFACT_RELEASE_REPO, LOGIC_ARTIFACT_RELEASE_REVISION) + 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) } } @@ -36,14 +39,22 @@ pipeline { 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"/* . - """ - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + def artifactlist = meta.generateartifacts(['**/*']) + def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + + cleaner.clean(['meta', 'autobuild']) + + dir(LOGICDEST) { + fileOperations([ + fileCopyOperation(excludes: '', + flattenFiles: false, + includes: '**/*', + targetLocation: WORKSPACE) + ]) + } + + cleaner.clean([LOGICDEST]) + artifactarchiver.archive(meta, artifactlist) } } @@ -63,4 +74,4 @@ pipeline { echo 'Succeeded build' } } -} \ No newline at end of file +} From c3c7b802938939e255c81b15aa33c72fea169da0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 19 Dec 2021 21:43:27 +0000 Subject: [PATCH 1759/1971] Use clean while moving imported info --- copy/all.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/copy/all.groovy b/copy/all.groovy index aab479c..37a47e6 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -45,6 +45,8 @@ pipeline { def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") cleaner.clean(['meta', 'autobuild']) + + error('Debugging') dir(IMPORTS) { fileOperations([ From a06ac842b9a4ca4c03469eac9a7d56e3c6bbcf4d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 19 Dec 2021 21:45:33 +0000 Subject: [PATCH 1760/1971] Use clean while moving imported info --- copy/all.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index 37a47e6..486a627 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -45,8 +45,6 @@ pipeline { def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") cleaner.clean(['meta', 'autobuild']) - - error('Debugging') dir(IMPORTS) { fileOperations([ @@ -57,6 +55,7 @@ pipeline { ]) } + error('Debugging') cleaner.clean([IMPORTS]) artifactarchiver.archive(meta, artifactlist) From d7893d9160ac5b0388a7f56f55a447ff05b67021 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 19 Dec 2021 21:53:41 +0000 Subject: [PATCH 1761/1971] Use clean while moving imported info --- copy/all.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index 486a627..aab479c 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -55,7 +55,6 @@ pipeline { ]) } - error('Debugging') cleaner.clean([IMPORTS]) artifactarchiver.archive(meta, artifactlist) From c9eb0c698c80a7e8c3c20cc1f9b3b10bbdc5e0f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 13:52:31 +0000 Subject: [PATCH 1762/1971] Don't create folders for imported artifacts that don't have meta --- meta/folder.groovy | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 9ddeb7c..6e6767b 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -825,16 +825,15 @@ class MetaInfo extends GISJsonSerialised { if (script.fileExists(importedmetafile)) { script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})") mi.deserialiseJson(importedmetafile) + + RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath) + if (appendtoparentmeta) { + associatedmeta.add(rmi) + } } else { script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist") mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA) } - - RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath) - if (appendtoparentmeta) { - associatedmeta.add(rmi) - } - return mi } From 01d66c2d893609b513a78f7d75dedb7ac6820d99 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 14:47:22 +0000 Subject: [PATCH 1763/1971] Don't create folders for imported artifacts that don't have meta --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 6e6767b..f43237c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -832,7 +832,7 @@ class MetaInfo extends GISJsonSerialised { } } else { script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist") - mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA) + addConfigurationInfo('', givenRepo, givenRevision, givenSHA) } return mi } From d3e5eb91acf81b01723fbc42111e1321b6f92461 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 15:55:07 +0000 Subject: [PATCH 1764/1971] Correct build integrity checking --- meta/folder.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f43237c..96a37f8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1030,9 +1030,11 @@ class MetaInfo extends GISJsonSerialised { return [ 'metacollection' : results.metacollection, 'comment': results.comment ] } - def allrelatedmeta(String metapath) { + def allrelatedmeta(String metapath = '') { ArrayList metacollection = new ArrayList() - return walkrelated(metacollection, '', 0, '', "${metapath}/${METAFOLDERNAME}") + + def startmetapath = (metapath == '' ? METAFOLDERNAME : "${metapath}/${METAFOLDERNAME}") + return walkrelated(metacollection, '', 0, '', startmetapath) } ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { From 09b3c99bfe52c44397a813d8373cc80fa7d64bfd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 16:46:50 +0000 Subject: [PATCH 1765/1971] Correct initial gather paths --- meta/folder.groovy | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 96a37f8..e6bd3c5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -923,18 +923,8 @@ class MetaInfo extends GISJsonSerialised { def openchildmeta(String gatheredpath, String gatheredmetapath, RelatedMetaInfo relatedmetainfo) { def MetaInfo mi = new MetaInfo(script) - def String nextgatheredpath - if (gatheredpath == '') { - nextgatheredpath = "${relatedmetainfo.offsetpath}" - } else { - nextgatheredpath = "${gatheredpath}/${relatedmetainfo.offsetpath}" - } - def String nextgatheredmetapath - if (gatheredmetapath == '') { - nextgatheredmetapath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" - } else { - nextgatheredmetapath = "${gatheredmetapath}/${relatedmetainfo.offsetpath}" - } + def String nextgatheredpath = (gatheredpath == '' ? relatedmetainfo.offsetpath : "${gatheredpath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${gatheredmetapath}/${relatedmetainfo.offsetpath}" def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}" def boolean imported if (script.fileExists(importedmetafile)) { @@ -972,11 +962,13 @@ class MetaInfo extends GISJsonSerialised { for (relatedmetainfo in associatedmeta) { if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta + def String nextgatheredpath = (gatheredpath == '' ? relatedmetainfo.offsetpath : "${gatheredpath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (gatheredmetapath == '' ? gatheredmetapath : "${gatheredmetapath}/${relatedmetainfo.offsetpath}") results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, - "${gatheredpath}/${relatedmetainfo.offsetpath}", - "${gatheredmetapath}/${relatedmetainfo.offsetpath}", + nextgatheredpath, + nextgatheredmetapath, limiteddepth, maxdepth - 1) } else { @@ -1032,9 +1024,7 @@ class MetaInfo extends GISJsonSerialised { def allrelatedmeta(String metapath = '') { ArrayList metacollection = new ArrayList() - - def startmetapath = (metapath == '' ? METAFOLDERNAME : "${metapath}/${METAFOLDERNAME}") - return walkrelated(metacollection, '', 0, '', startmetapath) + return walkrelated(metacollection, '', 0, '', metapath) } ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { From f171e520b7685d35acfd605b3f96dd99dc0cc946 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 16:47:52 +0000 Subject: [PATCH 1766/1971] Correct initial gather paths --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index e6bd3c5..aa1d673 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -924,7 +924,7 @@ class MetaInfo extends GISJsonSerialised { def MetaInfo mi = new MetaInfo(script) def String nextgatheredpath = (gatheredpath == '' ? relatedmetainfo.offsetpath : "${gatheredpath}/${relatedmetainfo.offsetpath}") - def String nextgatheredmetapath = (gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${gatheredmetapath}/${relatedmetainfo.offsetpath}" + def String nextgatheredmetapath = (gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${gatheredmetapath}/${relatedmetainfo.offsetpath}") def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}" def boolean imported if (script.fileExists(importedmetafile)) { From 6053dbc4a93c847070dfde3524cdc10a95413956 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 17:27:32 +0000 Subject: [PATCH 1767/1971] Correct initial gather paths --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index aa1d673..883e690 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -963,7 +963,7 @@ class MetaInfo extends GISJsonSerialised { if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta def String nextgatheredpath = (gatheredpath == '' ? relatedmetainfo.offsetpath : "${gatheredpath}/${relatedmetainfo.offsetpath}") - def String nextgatheredmetapath = (gatheredmetapath == '' ? gatheredmetapath : "${gatheredmetapath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${gatheredmetapath}/${relatedmetainfo.offsetpath}") results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, From d5ecbe17d4948da2a8103046d68d269a938d7c8a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 23:01:03 +0000 Subject: [PATCH 1768/1971] Add log --- import/importer.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/import/importer.groovy b/import/importer.groovy index 39b31c6..0e88a21 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -347,6 +347,7 @@ def artifactimport(meta, parentmeta, String parentmetapath, String childproduct, def childmeta = meta.getNewMetaObject() def childmeta2 echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" + echo "From Parent meta identifier: ${parentmeta.componentidentifier} and parent meta path: ${parentmetapath}" def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent) if (findresults.matchfound) { childmeta = findresults.matchedmetaitem.metainfo From af70f7e083ecdec2812ce86b19d3245368b13612 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 23:04:05 +0000 Subject: [PATCH 1769/1971] Add log --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 0e88a21..a35598c 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -347,7 +347,7 @@ def artifactimport(meta, parentmeta, String parentmetapath, String childproduct, def childmeta = meta.getNewMetaObject() def childmeta2 echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" - echo "From Parent meta identifier: ${parentmeta.componentidentifier} and parent meta path: ${parentmetapath}" + echo "From Parent meta identifier: ${parentmeta.componentidentifier()} and parent meta path: ${parentmetapath}" def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent) if (findresults.matchfound) { childmeta = findresults.matchedmetaitem.metainfo From 4b3e84c72d851b2ed499558d02b72dc26aa41f23 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 20 Dec 2021 23:14:41 +0000 Subject: [PATCH 1770/1971] Alter path to start finding --- import/importer.groovy | 2 +- meta/folder.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index a35598c..8bb565a 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -347,7 +347,7 @@ def artifactimport(meta, parentmeta, String parentmetapath, String childproduct, def childmeta = meta.getNewMetaObject() def childmeta2 echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" - echo "From Parent meta identifier: ${parentmeta.componentidentifier()} and parent meta path: ${parentmetapath}" + echo "From parent meta identifier: ${parentmeta.componentidentifier()} and parent meta path: ${parentmetapath}" def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent) if (findresults.matchfound) { childmeta = findresults.matchedmetaitem.metainfo diff --git a/meta/folder.groovy b/meta/folder.groovy index 883e690..f72b502 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1080,7 +1080,7 @@ class MetaInfo extends GISJsonSerialised { 'matchedmetaitem' : new CollectedMeta(this), 'matchfound' : false ] - def walkresults = allrelatedmeta(parentmetapath) + def walkresults = allrelatedmeta("${parentmetapath}/${METAFOLDERNAME}") for (dependentmetaitem in walkresults.metacollection) { script.echo("Comparing: ${dependentmetaitem.metainfo.productinfo.productname} ${dependentmetaitem.metainfo.productinfo.subcomponentname}") if (dependentmetaitem.metainfo.productinfo.productname == productname && From ebb151dceaa14f4ab1f8c8d513d15f557a771c10 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 16:10:31 +0000 Subject: [PATCH 1771/1971] Add a unique id to each product --- meta/folder.groovy | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f72b502..071ec9d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -24,16 +24,18 @@ class ProductInfo extends GISJsonSerialised { private String productname private String subcomponentname private String variant + private String uniqueid - ProductInfo(script, productname = "", subcomponentname = "", variant = "") { + ProductInfo(script, String productname = '', String subcomponentname = '', String variant = '') { super(script) this.format = '0.1' this.productname = productname this.subcomponentname = subcomponentname this.variant = variant + this.uniqueid = UUID.randomUUID().toString() } - void set(String productname, String subcomponentname, String variant = '') { + 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()) { @@ -76,13 +78,15 @@ class ProductInfo extends GISJsonSerialised { this.productname = otherinfo.productname this.subcomponentname = otherinfo.subcomponentname this.variant = otherinfo.variant + this.uniqueid = otherinfo.uniqueid } void deserialiseJson(rawmeta) { //format = rawmeta['format'] productname = rawmeta['productname'] subcomponentname = rawmeta['subcomponentname'] - variant = rawmeta['variant'] ?: "" + variant = rawmeta['variant'] ?: '' + uniqueid = rawmeta['uniqueid'] ?: uniqueid } LinkedHashMap serialisationdata() { @@ -91,6 +95,7 @@ class ProductInfo extends GISJsonSerialised { 'productname' : productname, 'subcomponentname' : subcomponentname, 'variant' : variant, + 'uniqueid': uniqueid, ] return data } @@ -104,7 +109,7 @@ class GitInfo extends GISJsonSerialised { private String remoteurl private String remoteinfo - GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") { + GitInfo(script, sourcepath = '', sourcerevision = '', gitrevision = '', remoteurl = '', remoteinfo = '') { super(script) this.format = '0.1' this.sourcepath = sourcepath @@ -204,7 +209,7 @@ class JenkinsBuildInfo extends GISJsonSerialised { private ArrayList parameters private boolean isfullbuild - JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "", boolean isfullbuild = true) { + JenkinsBuildInfo(script, String buildjobname = '', int buildnumber = 0, String buildmachine = '', String builddate = '', boolean isfullbuild = true) { super(script) this.format = '0.1' this.buildjobname = buildjobname @@ -370,7 +375,7 @@ class ReleaseInfo extends GISJsonSerialised { private ArrayList releaseitems private boolean released - ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { + ReleaseInfo(script, String releaserepoURL = '', boolean released = false) { super(script) this.format = '0.1' this.releaserepoURL = releaserepoURL @@ -378,7 +383,7 @@ class ReleaseInfo extends GISJsonSerialised { this.released = released } - void set(String releaserepoURL = "") { + void set(String releaserepoURL = '') { this.releaserepoURL = releaserepoURL } @@ -426,7 +431,7 @@ class ConfigurationInfo extends GISJsonSerialised { private String configurationversion private String configurationSHA - ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") { + ConfigurationInfo(script, configurationname = '', configurationURL = '', configurationversion = '', configurationSHA = '') { super(script) this.configurationname = configurationname this.configurationURL = configurationURL @@ -456,7 +461,7 @@ class ChecksumPair extends GISJsonSerialised { private String filepath private String sum - ChecksumPair(script, String filepath = "", String sum = "") { + ChecksumPair(script, String filepath = '', String sum = '') { super(script) this.filepath = filepath this.sum = sum @@ -481,7 +486,7 @@ class ChecksumSet extends GISJsonSerialised { private String artifactpath private ArrayList checksumpairs - ChecksumSet(script, artifactpath = "") { + ChecksumSet(script, artifactpath = '') { super(script) this.format = '0.1' this.artifactpath = artifactpath @@ -566,7 +571,7 @@ class PublishableInfo extends GISJsonSerialised { private String format private String filepath - PublishableInfo(script, String filepath = "") { + PublishableInfo(script, String filepath = '') { super(script) this.format = '0.1' this.filepath = filepath @@ -613,7 +618,7 @@ class MetaInfo extends GISJsonSerialised { private MetaInfo meta private String offsetpath - RelatedMetaInfo_v0_1(script, offsetpath = "", MetaInfo meta = null) { + RelatedMetaInfo_v0_1(script, offsetpath = '', MetaInfo meta = null) { super(script, '0.1') this.offsetpath = offsetpath this.meta = meta @@ -639,7 +644,7 @@ class MetaInfo extends GISJsonSerialised { private String importpath private String offsetpath - RelatedMetaInfo_v0_2(script, importpath = "", offsetpath = "") { + RelatedMetaInfo_v0_2(script, importpath = '', offsetpath = '') { super(script, '0.2') this.importpath = importpath this.offsetpath = offsetpath @@ -1106,13 +1111,13 @@ MetaInfo metareset(script) { return mi } -MetaInfo metafromfolder(String folder = "") { +MetaInfo metafromfolder(String folder = '') { MetaInfo buildmeta = new MetaInfo(this) buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}") return buildmeta } -MetaInfo metafromfolderSlurper(String folder = "") { +MetaInfo metafromfolderSlurper(String folder = '') { MetaInfo buildmeta = new MetaInfo(this) buildmeta.deserialiseJsonSlurper("${folder}/${MetaInfo.metafilepath()}") return buildmeta From 71a3a926722ab833fe54cd9c5f73f04476f29c94 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 16:12:21 +0000 Subject: [PATCH 1772/1971] Add a unique id to each product --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 071ec9d..4193f7e 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -35,7 +35,7 @@ class ProductInfo extends GISJsonSerialised { this.uniqueid = UUID.randomUUID().toString() } - void set(String productname, String subcomponentname, String variant = '', ) { + 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()) { From 902ec6591ad3e778a04956124a7ae6f0408bc516 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 17:14:26 +0000 Subject: [PATCH 1773/1971] Use an iteration variable in walker --- meta/folder.groovy | 143 +++++++++++++++++++++++++-------------------- 1 file changed, 80 insertions(+), 63 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 4193f7e..163ff2a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -925,11 +925,41 @@ class MetaInfo extends GISJsonSerialised { } } - def openchildmeta(String gatheredpath, String gatheredmetapath, RelatedMetaInfo relatedmetainfo) { + class IterationInfo { + private ArrayList metacollection + private String comment + private int level + private String gatheredpath + private String gatheredmetapath + private boolean limiteddepth + private int maxdepth + + IterationInfo(ArrayList metacollection = new ArrayList(), + String comment = '', + int level = 0, + String gatheredpath = '', + String gatheredmetapath = '', + boolean limiteddepth = false, + int maxdepth = 0) { + this.metacollection = metacollection + this.comment = comment + this.level = level + this.gatheredpath = gatheredpath + this.gatheredmetapath = gatheredmetapath + this.limiteddepth = limiteddepth + this.maxdepth = maxdepth + } + + String show() { + return "Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}" + } + } + + def openchildmeta(IterationInfo ii, RelatedMetaInfo relatedmetainfo) { def MetaInfo mi = new MetaInfo(script) - def String nextgatheredpath = (gatheredpath == '' ? relatedmetainfo.offsetpath : "${gatheredpath}/${relatedmetainfo.offsetpath}") - def String nextgatheredmetapath = (gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${gatheredmetapath}/${relatedmetainfo.offsetpath}") + def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}" def boolean imported if (script.fileExists(importedmetafile)) { @@ -949,92 +979,79 @@ class MetaInfo extends GISJsonSerialised { return childmetainfo } - def walkrelated_v0_1(ArrayList metacollection, - String comment = '', - int level = 0, - String gatheredpath = '', - String gatheredmetapath = '', - boolean limiteddepth = false, - int maxdepth = 0) { - script.echo("walkrelated_v0_1 Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}") - def results = [ - 'metacollection' : metacollection, - 'comment': comment - ] - if (!limiteddepth || maxdepth > 0) { - results.metacollection.add(new CollectedMeta(this, gatheredpath, gatheredmetapath)) - results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' + def walkrelated_v0_1(IterationInfo ii) { + script.echo("Walk related v0.1: ${ii.show()}") + if (!ii.limiteddepth || ii.maxdepth > 0) { + ii.metacollection.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) + ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta - def String nextgatheredpath = (gatheredpath == '' ? relatedmetainfo.offsetpath : "${gatheredpath}/${relatedmetainfo.offsetpath}") - def String nextgatheredmetapath = (gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${gatheredmetapath}/${relatedmetainfo.offsetpath}") - results = othermeta.walkrelated_v0_1(results.metacollection, - results.comment, - level + 1, - nextgatheredpath, - nextgatheredmetapath, - limiteddepth, - maxdepth - 1) + def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") + def nextii = new IterationInfo(ii.metacollection, + ii.comment, + ii.level + 1, + nextgatheredpath, + nextgatheredmetapath, + ii.limiteddepth + ii.maxdepth - 1) + def results = othermeta.walkrelated_v0_1(nextii) + ii.metacollection = results.metacollection + ii.comment = results.comment } else { script.error("There is non v0.1 format related meta info under v0.1 related meta info") } } } - return [ 'metacollection' : results.metacollection, 'comment': results.comment ] + return [ 'metacollection' : ii.metacollection, 'comment': ii.comment ] } - def walkrelated(ArrayList metacollection, - String comment = '', - int level = 0, - String gatheredpath = '', - String gatheredmetapath = '', - boolean limiteddepth = false, - int maxdepth = 0) { - script.echo("walkrelated Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}") - def results = [ - 'metacollection' : metacollection, - 'comment': comment - ] - if (!limiteddepth || maxdepth > 0) { - results.metacollection.add(new CollectedMeta(this, gatheredpath, gatheredmetapath)) - results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n' + def walkrelated(IterationInfo ii) { + script.echo("Walk related: ${ii.show()}") + if (!ii.limiteddepth || ii.maxdepth > 0) { + ii.metacollection.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) + ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}") if (relatedmetainfo.format == '0.2') { - def childmetainfo = openchildmeta(gatheredpath, gatheredmetapath, relatedmetainfo) + def childmetainfo = openchildmeta(ii, relatedmetainfo) if (childmetainfo.imported) { - results = childmetainfo.childmeta.walkrelated(results.metacollection, - results.comment, - level + 1, - childmetainfo.nextgatheredpath, - childmetainfo.nextgatheredmetapath, - limiteddepth, - maxdepth - 1) + def nextii = new IterationInfo(ii.metacollection, + ii.comment, + ii.level + 1, + childmetainfo.nextgatheredpath, + childmetainfo.nextgatheredmetapath, + ii.limiteddepth + ii.maxdepth - 1) + def results = childmetainfo.childmeta.walkrelated(nextii) + ii.metacollection = results.metacollection + ii.comment = results.comment } } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta - results = othermeta.walkrelated_v0_1(results.metacollection, - results.comment, - level + 1, - gatheredpath, - gatheredmetapath, - limiteddepth, - maxdepth - 1) + def nextii = new IterationInfo(ii.metacollection, + ii.comment, + ii.level + 1, + ii.gatheredpath, + ii.gatheredmetapath, + ii.limiteddepth + ii.maxdepth - 1) + def results = othermeta.walkrelated_v0_1(nextii) + ii.metacollection = results.metacollection + ii.comment = results.comment } } } - return [ 'metacollection' : results.metacollection, 'comment': results.comment ] + return [ 'metacollection' : ii.metacollection, 'comment': ii.comment ] } def allrelatedmeta(String metapath = '') { - ArrayList metacollection = new ArrayList() - return walkrelated(metacollection, '', 0, '', metapath) + return walkrelated(new IterationInfo(metacollection, '', 0, '', metapath)) } ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { - def ArrayList metacollection = new ArrayList() - def results = walkrelated(metacollection, 'meta', 0, startpath, startmetapath, true, maxdepth) + def results = walkrelated(new IterationInfo(metacollection, 'meta', 0, startpath, startmetapath, true, maxdepth)) return results.metacollection } From bfb7d9fa4c96196dd7e532b4469bd4b149776656 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 17:17:36 +0000 Subject: [PATCH 1774/1971] Use an iteration variable in walker --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 163ff2a..71277e5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -994,7 +994,7 @@ class MetaInfo extends GISJsonSerialised { ii.level + 1, nextgatheredpath, nextgatheredmetapath, - ii.limiteddepth + ii.limiteddepth, ii.maxdepth - 1) def results = othermeta.walkrelated_v0_1(nextii) ii.metacollection = results.metacollection @@ -1022,7 +1022,7 @@ class MetaInfo extends GISJsonSerialised { ii.level + 1, childmetainfo.nextgatheredpath, childmetainfo.nextgatheredmetapath, - ii.limiteddepth + ii.limiteddepth, ii.maxdepth - 1) def results = childmetainfo.childmeta.walkrelated(nextii) ii.metacollection = results.metacollection @@ -1035,7 +1035,7 @@ class MetaInfo extends GISJsonSerialised { ii.level + 1, ii.gatheredpath, ii.gatheredmetapath, - ii.limiteddepth + ii.limiteddepth, ii.maxdepth - 1) def results = othermeta.walkrelated_v0_1(nextii) ii.metacollection = results.metacollection From 0122ee498c220a9213ab1cc4e038c946b5debdac Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 17:26:36 +0000 Subject: [PATCH 1775/1971] Use an iteration variable in walker --- meta/folder.groovy | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 71277e5..e29f8ff 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -927,6 +927,7 @@ class MetaInfo extends GISJsonSerialised { class IterationInfo { private ArrayList metacollection + private Map() metamap private String comment private int level private String gatheredpath @@ -935,6 +936,7 @@ class MetaInfo extends GISJsonSerialised { private int maxdepth IterationInfo(ArrayList metacollection = new ArrayList(), + Map metamap = new Map(), String comment = '', int level = 0, String gatheredpath = '', @@ -942,6 +944,7 @@ class MetaInfo extends GISJsonSerialised { boolean limiteddepth = false, int maxdepth = 0) { this.metacollection = metacollection + this.metamap = metamap this.comment = comment this.level = level this.gatheredpath = gatheredpath @@ -990,6 +993,7 @@ class MetaInfo extends GISJsonSerialised { def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") def nextii = new IterationInfo(ii.metacollection, + ii.metamap, ii.comment, ii.level + 1, nextgatheredpath, @@ -1018,6 +1022,7 @@ class MetaInfo extends GISJsonSerialised { def childmetainfo = openchildmeta(ii, relatedmetainfo) if (childmetainfo.imported) { def nextii = new IterationInfo(ii.metacollection, + ii.metamap, ii.comment, ii.level + 1, childmetainfo.nextgatheredpath, @@ -1031,6 +1036,7 @@ class MetaInfo extends GISJsonSerialised { } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta def nextii = new IterationInfo(ii.metacollection, + ii.metamap, ii.comment, ii.level + 1, ii.gatheredpath, @@ -1046,12 +1052,13 @@ class MetaInfo extends GISJsonSerialised { return [ 'metacollection' : ii.metacollection, 'comment': ii.comment ] } - def allrelatedmeta(String metapath = '') { - return walkrelated(new IterationInfo(metacollection, '', 0, '', metapath)) + def allrelatedmeta(String metapath = '') {, + Map metamap = + return walkrelated(new IterationInfo(new ArrayList(), new Map(), '', 0, '', metapath)) } ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { - def results = walkrelated(new IterationInfo(metacollection, 'meta', 0, startpath, startmetapath, true, maxdepth)) + def results = walkrelated(new IterationInfo(new ArrayList(), new Map(), 'meta', 0, startpath, startmetapath, true, maxdepth)) return results.metacollection } From 72b5f6de79a844fec715fba67bc3decc0e738253 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 17:30:16 +0000 Subject: [PATCH 1776/1971] Use an iteration variable in walker --- meta/folder.groovy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index e29f8ff..f8f7cd2 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -927,7 +927,7 @@ class MetaInfo extends GISJsonSerialised { class IterationInfo { private ArrayList metacollection - private Map() metamap + private Map metamap private String comment private int level private String gatheredpath @@ -1002,13 +1002,14 @@ class MetaInfo extends GISJsonSerialised { ii.maxdepth - 1) def results = othermeta.walkrelated_v0_1(nextii) ii.metacollection = results.metacollection + ii.metamap = results.metamap ii.comment = results.comment } else { script.error("There is non v0.1 format related meta info under v0.1 related meta info") } } } - return [ 'metacollection' : ii.metacollection, 'comment': ii.comment ] + return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ] } def walkrelated(IterationInfo ii) { @@ -1031,6 +1032,7 @@ class MetaInfo extends GISJsonSerialised { ii.maxdepth - 1) def results = childmetainfo.childmeta.walkrelated(nextii) ii.metacollection = results.metacollection + ii.metamap = results.metamap ii.comment = results.comment } } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { @@ -1045,11 +1047,12 @@ class MetaInfo extends GISJsonSerialised { ii.maxdepth - 1) def results = othermeta.walkrelated_v0_1(nextii) ii.metacollection = results.metacollection + ii.metamap = results.metamap ii.comment = results.comment } } } - return [ 'metacollection' : ii.metacollection, 'comment': ii.comment ] + return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ] } def allrelatedmeta(String metapath = '') {, From fd8a3824bd51dca279f02e37b5d703a42de9c150 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 17:35:42 +0000 Subject: [PATCH 1777/1971] Use an iteration variable in walker --- meta/folder.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f8f7cd2..7046bcf 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1056,7 +1056,6 @@ class MetaInfo extends GISJsonSerialised { } def allrelatedmeta(String metapath = '') {, - Map metamap = return walkrelated(new IterationInfo(new ArrayList(), new Map(), '', 0, '', metapath)) } From 345d6f2e8ce4f67d0108d972bfb720575cb017f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 17:36:45 +0000 Subject: [PATCH 1778/1971] Use an iteration variable in walker --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7046bcf..e1549fd 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1055,7 +1055,7 @@ class MetaInfo extends GISJsonSerialised { return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ] } - def allrelatedmeta(String metapath = '') {, + def allrelatedmeta(String metapath = '') { return walkrelated(new IterationInfo(new ArrayList(), new Map(), '', 0, '', metapath)) } From 904e2cc20fa6228c2cddd16d47c4b16f768a3eb5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 17:41:59 +0000 Subject: [PATCH 1779/1971] Use an iteration variable in walker --- meta/folder.groovy | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index e1549fd..ac8fa23 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -935,8 +935,8 @@ class MetaInfo extends GISJsonSerialised { private boolean limiteddepth private int maxdepth - IterationInfo(ArrayList metacollection = new ArrayList(), - Map metamap = new Map(), + IterationInfo(ArrayList metacollection, + Map metamap, String comment = '', int level = 0, String gatheredpath = '', @@ -1056,11 +1056,15 @@ class MetaInfo extends GISJsonSerialised { } def allrelatedmeta(String metapath = '') { - return walkrelated(new IterationInfo(new ArrayList(), new Map(), '', 0, '', metapath)) + def ArrayList metacollection = new ArrayList() + def Map metamap = new Map() + return walkrelated(new IterationInfo(metacollection, metamap, '', 0, '', metapath)) } ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { - def results = walkrelated(new IterationInfo(new ArrayList(), new Map(), 'meta', 0, startpath, startmetapath, true, maxdepth)) + def ArrayList metacollection = new ArrayList() + def Map metamap = new Map() + def results = walkrelated(new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth)) return results.metacollection } From 27298b99745681a7cc3ccd4b47620aeda8247b42 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 17:44:28 +0000 Subject: [PATCH 1780/1971] Use an iteration variable in walker --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ac8fa23..8325a89 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1057,13 +1057,13 @@ class MetaInfo extends GISJsonSerialised { def allrelatedmeta(String metapath = '') { def ArrayList metacollection = new ArrayList() - def Map metamap = new Map() + def Map metamap = new LinkedHashMap() return walkrelated(new IterationInfo(metacollection, metamap, '', 0, '', metapath)) } ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { def ArrayList metacollection = new ArrayList() - def Map metamap = new Map() + def Map metamap = new LinkedHashMap() def results = walkrelated(new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth)) return results.metacollection } From f21873bfcec1493c700023b7717a2186cef14014 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 18:21:37 +0000 Subject: [PATCH 1781/1971] Optimise reading in of meta from files --- meta/folder.groovy | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 8325a89..5861293 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -600,6 +600,7 @@ class MetaInfo extends GISJsonSerialised { interface IRelatedMetaInfo { abstract void deserialiseJson(rawmeta) abstract LinkedHashMap serialisationdata() + abstract String getuniqueid() } abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { @@ -612,20 +613,24 @@ class MetaInfo extends GISJsonSerialised { abstract void deserialiseJson(rawmeta) abstract LinkedHashMap serialisationdata() + abstract String getuniqueid() } class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { private MetaInfo meta private String offsetpath + private String uniqueid - RelatedMetaInfo_v0_1(script, offsetpath = '', MetaInfo meta = null) { + RelatedMetaInfo_v0_1(script, String offsetpath = '', MetaInfo meta = null, String uniqueid = UUID.randomUUID().toString()) { super(script, '0.1') this.offsetpath = offsetpath + this.uniqueid = uniqueid this.meta = meta } void deserialiseJson(rawmeta) { offsetpath = rawmeta['offsetpath'] + uniqueid = rawmata['uniqueid'] ?: uniqueid meta = new MetaInfo(script) meta.deserialiseJson(rawmeta['meta']) } @@ -634,34 +639,47 @@ class MetaInfo extends GISJsonSerialised { def data = [ 'format' : format, 'offsetpath' : offsetpath, + 'uniqueid' : uniqueid, 'meta' : meta.serialisationdata(), ] return data } + + String getuniqueid() { + return uniqueid; + } } class RelatedMetaInfo_v0_2 extends RelatedMetaInfo { private String importpath private String offsetpath + private String uniqueid - RelatedMetaInfo_v0_2(script, importpath = '', offsetpath = '') { + RelatedMetaInfo_v0_2(script, String importpath = '', String offsetpath = '', String uniqueid = UUID.randomUUID().toString()) { super(script, '0.2') this.importpath = importpath this.offsetpath = offsetpath + this.uniqueid = uniqueid } void deserialiseJson(rawmeta) { //format = rawmeta['format'] offsetpath = rawmeta['offsetpath'] + uniqueid = rawmata['uniqueid'] } LinkedHashMap serialisationdata() { def data = [ 'format' : format, 'offsetpath' : offsetpath, + 'uniqueid' : uniqueid ] return data } + + String getuniqueid() { + return uniqueid; + } } private ProductInfo productinfo @@ -831,7 +849,7 @@ class MetaInfo extends GISJsonSerialised { script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})") mi.deserialiseJson(importedmetafile) - RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath) + RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath, mi.productinfo.uniqueid) if (appendtoparentmeta) { associatedmeta.add(rmi) } @@ -956,6 +974,13 @@ class MetaInfo extends GISJsonSerialised { String show() { return "Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}" } + + void add(CollectedMeta item) { + metacollection.add(item) + metamap.put(item.metainfo.productinfo.uniqueid, item) + } + + CollectedMeta } def openchildmeta(IterationInfo ii, RelatedMetaInfo relatedmetainfo) { @@ -965,7 +990,11 @@ class MetaInfo extends GISJsonSerialised { def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}" def boolean imported - if (script.fileExists(importedmetafile)) { + // If this has already been read in from a file + if (relatedmetainfo.uniqueid() in ii.metamap) { + mi = metamap[relatedmetainfo.uniqueid()].metainfo + imported = true + } else if (script.fileExists(importedmetafile)) { mi.deserialiseJson(importedmetafile) imported = true } else { @@ -985,7 +1014,7 @@ class MetaInfo extends GISJsonSerialised { def walkrelated_v0_1(IterationInfo ii) { script.echo("Walk related v0.1: ${ii.show()}") if (!ii.limiteddepth || ii.maxdepth > 0) { - ii.metacollection.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) + ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { @@ -1015,7 +1044,7 @@ class MetaInfo extends GISJsonSerialised { def walkrelated(IterationInfo ii) { script.echo("Walk related: ${ii.show()}") if (!ii.limiteddepth || ii.maxdepth > 0) { - ii.metacollection.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) + ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}") From a2ebb9623443225c1ef60ee2060e0a966925de05 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 18:22:45 +0000 Subject: [PATCH 1782/1971] Optimise reading in of meta from files --- meta/folder.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 5861293..4dc8337 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -979,8 +979,6 @@ class MetaInfo extends GISJsonSerialised { metacollection.add(item) metamap.put(item.metainfo.productinfo.uniqueid, item) } - - CollectedMeta } def openchildmeta(IterationInfo ii, RelatedMetaInfo relatedmetainfo) { From cfa543970d6062177e2593db4e5dcf08dee0b86f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 18:32:13 +0000 Subject: [PATCH 1783/1971] Optimise reading in of meta from files --- meta/folder.groovy | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 4dc8337..1816835 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -597,13 +597,7 @@ class MetaInfo extends GISJsonSerialised { private static String METAARTIFACTS = "${METAFOLDERNAME}/**" private static String format = '0.2' - interface IRelatedMetaInfo { - abstract void deserialiseJson(rawmeta) - abstract LinkedHashMap serialisationdata() - abstract String getuniqueid() - } - - abstract class RelatedMetaInfo extends GISJsonSerialised implements IRelatedMetaInfo { + abstract class RelatedMetaInfo extends GISJsonSerialised { String format RelatedMetaInfo(script, format) { @@ -646,7 +640,7 @@ class MetaInfo extends GISJsonSerialised { } String getuniqueid() { - return uniqueid; + return uniqueid } } @@ -678,7 +672,7 @@ class MetaInfo extends GISJsonSerialised { } String getuniqueid() { - return uniqueid; + return uniqueid } } From d7965ea280c368a8cdb4de816f97ce2cb03c84d0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 21 Dec 2021 18:39:13 +0000 Subject: [PATCH 1784/1971] Optimise reading in of meta from files --- meta/folder.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 1816835..e28d28c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -607,7 +607,7 @@ class MetaInfo extends GISJsonSerialised { abstract void deserialiseJson(rawmeta) abstract LinkedHashMap serialisationdata() - abstract String getuniqueid() + abstract String getrelatedid() } class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { @@ -639,7 +639,7 @@ class MetaInfo extends GISJsonSerialised { return data } - String getuniqueid() { + String getrelatedid() { return uniqueid } } @@ -671,7 +671,7 @@ class MetaInfo extends GISJsonSerialised { return data } - String getuniqueid() { + String getrelatedid() { return uniqueid } } @@ -983,8 +983,8 @@ class MetaInfo extends GISJsonSerialised { def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}" def boolean imported // If this has already been read in from a file - if (relatedmetainfo.uniqueid() in ii.metamap) { - mi = metamap[relatedmetainfo.uniqueid()].metainfo + if (relatedmetainfo.getrelatedid() in ii.metamap) { + mi = metamap[relatedmetainfo.getrelatedid()].metainfo imported = true } else if (script.fileExists(importedmetafile)) { mi.deserialiseJson(importedmetafile) From 88ca474a706f0444c9751b1e947b0e9385fa8418 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 22 Dec 2021 09:44:35 +0000 Subject: [PATCH 1785/1971] Optimise reading in of meta from files --- meta/folder.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index e28d28c..112f3d6 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -624,7 +624,7 @@ class MetaInfo extends GISJsonSerialised { void deserialiseJson(rawmeta) { offsetpath = rawmeta['offsetpath'] - uniqueid = rawmata['uniqueid'] ?: uniqueid + uniqueid = rawmeta['uniqueid'] ?: uniqueid meta = new MetaInfo(script) meta.deserialiseJson(rawmeta['meta']) } @@ -659,7 +659,7 @@ class MetaInfo extends GISJsonSerialised { void deserialiseJson(rawmeta) { //format = rawmeta['format'] offsetpath = rawmeta['offsetpath'] - uniqueid = rawmata['uniqueid'] + uniqueid = rawmeta['uniqueid'] } LinkedHashMap serialisationdata() { From 984d996d88828f0db5ae9fbe032b13e7af3c03d9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 22 Dec 2021 11:57:56 +0000 Subject: [PATCH 1786/1971] Optimise reading in of meta from files --- meta/folder.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 112f3d6..faface8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -984,7 +984,8 @@ class MetaInfo extends GISJsonSerialised { def boolean imported // If this has already been read in from a file if (relatedmetainfo.getrelatedid() in ii.metamap) { - mi = metamap[relatedmetainfo.getrelatedid()].metainfo + script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist") + mi = ii.metamap[relatedmetainfo.getrelatedid()].metainfo imported = true } else if (script.fileExists(importedmetafile)) { mi.deserialiseJson(importedmetafile) From 85dd6534c6c4db549aaa3cf1ce86377e476b79ad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 22 Dec 2021 12:20:28 +0000 Subject: [PATCH 1787/1971] Optimise reading in of meta from files --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index faface8..8b3c22d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -984,7 +984,7 @@ class MetaInfo extends GISJsonSerialised { def boolean imported // If this has already been read in from a file if (relatedmetainfo.getrelatedid() in ii.metamap) { - script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist") + script.echo("Already read in meta associated with uniqueid: ${relatedmetainfo.getrelatedid()} - Using it") mi = ii.metamap[relatedmetainfo.getrelatedid()].metainfo imported = true } else if (script.fileExists(importedmetafile)) { From 466385016223c72f33a0f645291d44317c7186aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 Dec 2021 14:16:27 +0000 Subject: [PATCH 1788/1971] Correct walking through v0.1 associatedmeta --- meta/folder.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 8b3c22d..d63b84a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1059,12 +1059,14 @@ class MetaInfo extends GISJsonSerialised { } } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { def MetaInfo othermeta = relatedmetainfo.meta + def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") def nextii = new IterationInfo(ii.metacollection, ii.metamap, ii.comment, ii.level + 1, - ii.gatheredpath, - ii.gatheredmetapath, + nextgatheredpath, + nextgatheredmetapath, ii.limiteddepth, ii.maxdepth - 1) def results = othermeta.walkrelated_v0_1(nextii) From e8751753d50104874d49cbbdd64e26d785e1a017 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 23 Dec 2021 18:30:23 +0000 Subject: [PATCH 1789/1971] Correct diffing to use new meta hierarchy --- differences/dometahierarchy.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 40394d5..3b25798 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -803,8 +803,8 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin def earlymeta = meta.importrelated(true, earlymetafolder) def latermeta = meta.importrelated(true, latermetafolder) - def earlymetaitems = earlymeta.releasewalkerunique(md) - def latermetaitems = latermeta.releasewalkerunique(md) + def earlymetaitems = earlymeta.releasewalkerunique(md, '', earlymetafolder) + def latermetaitems = latermeta.releasewalkerunique(md, '', latermetafolder) echo "Early items:" showmetaitems(earlymetaitems) From bdbc579b38d51edbdeeb39a7071d85c9b6fa053a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 24 Dec 2021 09:13:57 +0000 Subject: [PATCH 1790/1971] Pass meta path to publisher walker --- publish/do.groovy | 8 ++++---- publish/promptingpublish.groovy | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/publish/do.groovy b/publish/do.groovy index 9f5bd21..ea090f0 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -140,14 +140,14 @@ def convertitemstopublish(String itemstopublishstring) { // Publish selected items from a release to the customer folder on the ftp site // itemstopublishstring is a comma-seperated set of strings in this format ## -def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) { +def publishhierarchy(hostedftpsiteinfo, releasemeta, String releasemetapath, 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) + def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md, '', releasemetapath) echo "Version unique components:" def String versionuniquecomponent = "" @@ -167,8 +167,8 @@ def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring return [summarystring, markunstable, unstablereason] } -def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) { - return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth) +def publishhierarchy(hostedftpsiteinfo, releasemeta, String releasemetapath, String customer, String softwarerelease, String maxdepth) { + return publishhierarchy(hostedftpsiteinfo, releasemeta, releasemetapath, '', customer, softwarerelease, maxdepth) } return this; diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 58c72eb..4cc0e24 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -135,7 +135,7 @@ pipeline { 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) + (summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, SOURCEDIR, selecteditems, customer, release, MAX_META_DEPTH) if (markunstable) { env.unstablereason = unstablereason currentBuild.result = 'UNSTABLE' From c8a66b7eb6b6fbac24daf65e00573a0228780afa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 24 Dec 2021 10:58:06 +0000 Subject: [PATCH 1791/1971] Exclude erroneous sub-component from release --- release/do.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/release/do.groovy b/release/do.groovy index c61f1dd..05f9d53 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -441,8 +441,10 @@ def releasehierarchy(String buildfolder, String metafolder, buildmeta, String ma // For each component for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] - if (toplevelid != key) { - releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) + if (buildinfo.metainfo.componentidentifier != '___') { + if (toplevelid != key) { + releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) + } } } // Do the top level last From fb35654c9ac71ec738fbd76c598fceda8289f553 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 24 Dec 2021 11:02:05 +0000 Subject: [PATCH 1792/1971] Exclude erroneous sub-component from release --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 05f9d53..09249ad 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -441,7 +441,7 @@ def releasehierarchy(String buildfolder, String metafolder, buildmeta, String ma // For each component for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] - if (buildinfo.metainfo.componentidentifier != '___') { + if (buildinfo.metainfo.componentidentifier() != '___') { if (toplevelid != key) { releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) } From 8297893901f91026893e94e802ff663dd570e6cb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 27 Dec 2021 21:15:08 +0000 Subject: [PATCH 1793/1971] Correct publish list --- publish/promptingpublish.groovy | 1 + publish/publishitems.groovy | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 4cc0e24..ce6a805 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -114,6 +114,7 @@ pipeline { 'Select software items', 'Software items', releasemeta, + SOURCEDIR, ITEMSDEFAULTLIST, MAX_META_DEPTH, '20', diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy index 06e5fba..9f6c368 100644 --- a/publish/publishitems.groovy +++ b/publish/publishitems.groovy @@ -18,6 +18,7 @@ class PublishableItemsSelection { String name, String description, releasemeta, + String releasemetapath, String preselectedext, String metalevelsstringext, String visibleItemCountExt, @@ -25,7 +26,7 @@ class PublishableItemsSelection { outputSelectionfromPreselect(preselectedmenuitems, preselectedext) def Integer metalevelsext = metalevelsstringext.toInteger() def Integer visibleItemCount = visibleItemCountExt.toInteger() - def metaitems = releasemeta.releasewalkerunique(metalevelsext) + def metaitems = releasemeta.releasewalkerunique(metalevelsext, '', releasemetapath) for (key in metaitems.keySet()) { def releaseinfo = metaitems[key] outputDescription(menuitemdescriptions, releaseinfo) @@ -113,13 +114,14 @@ PublishableItemsSelection createItemSelector( String name, String description, releasemeta, + String releasemetapath, 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) + pis.init(name, description, releasemeta, releasemetapath, preselectedext, metalevelsstringext, visibleItemCountExt, type) return pis } From 600d4584db6070fe88587a8505fce172f58c307d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 27 Dec 2021 22:59:14 +0000 Subject: [PATCH 1794/1971] Remove timeout warning --- versioncontrol/git.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 288d5db..a22054b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -195,8 +195,8 @@ def docheckout(String gitURL, String revision, int cloneDepth, String reporootpa [name: revision] ], extensions: [ - [$class: 'GitLFSPull',timeout: 25], - [$class: 'CleanBeforeCheckout',timeout: 20], + [$class: 'GitLFSPull'], + [$class: 'CleanBeforeCheckout'], [$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120], [$class: 'CheckoutOption', timeout: 120], [$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir], From 79c1928d730cd4afb9e476f538ea0f81c4eeae5e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 3 Jan 2022 09:47:40 +0000 Subject: [PATCH 1795/1971] Remove debug from console --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index d63b84a..b9e898c 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -984,7 +984,7 @@ class MetaInfo extends GISJsonSerialised { def boolean imported // If this has already been read in from a file if (relatedmetainfo.getrelatedid() in ii.metamap) { - script.echo("Already read in meta associated with uniqueid: ${relatedmetainfo.getrelatedid()} - Using it") + //script.echo("Already read in meta associated with uniqueid: ${relatedmetainfo.getrelatedid()} - Using it") mi = ii.metamap[relatedmetainfo.getrelatedid()].metainfo imported = true } else if (script.fileExists(importedmetafile)) { @@ -1005,7 +1005,7 @@ class MetaInfo extends GISJsonSerialised { } def walkrelated_v0_1(IterationInfo ii) { - script.echo("Walk related v0.1: ${ii.show()}") + //script.echo("Walk related v0.1: ${ii.show()}") if (!ii.limiteddepth || ii.maxdepth > 0) { ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' @@ -1035,12 +1035,12 @@ class MetaInfo extends GISJsonSerialised { } def walkrelated(IterationInfo ii) { - script.echo("Walk related: ${ii.show()}") + //script.echo("Walk related: ${ii.show()}") if (!ii.limiteddepth || ii.maxdepth > 0) { ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' for (relatedmetainfo in associatedmeta) { - script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}") + //script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}") if (relatedmetainfo.format == '0.2') { def childmetainfo = openchildmeta(ii, relatedmetainfo) if (childmetainfo.imported) { From bf60873908fd4b1c2e609ab55e7bac64b6e78b99 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 3 Jan 2022 10:00:09 +0000 Subject: [PATCH 1796/1971] Show which component is being released --- release/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/release/do.groovy b/release/do.groovy index 09249ad..6dcdd78 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -441,6 +441,7 @@ def releasehierarchy(String buildfolder, String metafolder, buildmeta, String ma // For each component for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] + echo "Releasing component: ${buildinfo.metainfo.componentidentifier()}" if (buildinfo.metainfo.componentidentifier() != '___') { if (toplevelid != key) { releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) From 6f0a4482be9cd4dec08d07b9e58dab1611fb5123 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 5 Jan 2022 07:55:36 +0000 Subject: [PATCH 1797/1971] Handle old components that have blank product and component names --- release/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/do.groovy b/release/do.groovy index 6dcdd78..4dcb091 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -442,7 +442,7 @@ def releasehierarchy(String buildfolder, String metafolder, buildmeta, String ma for (key in componentReleaseInfo.keySet()) { def buildinfo = componentReleaseInfo[key] echo "Releasing component: ${buildinfo.metainfo.componentidentifier()}" - if (buildinfo.metainfo.componentidentifier() != '___') { + if (buildinfo.metainfo.componentidentifier() != '___' && buildinfo.metainfo.componentidentifier() != '_') { if (toplevelid != key) { releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush) } From ae97402495fae74b7ebce71fcd8ac72a0cd70194 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 7 Jan 2022 17:53:32 +0000 Subject: [PATCH 1798/1971] CORE-348 - Build a som-only dependent FDHV package --- somsoftware/sominfo.groovy | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 somsoftware/sominfo.groovy diff --git a/somsoftware/sominfo.groovy b/somsoftware/sominfo.groovy new file mode 100644 index 0000000..a7fdc82 --- /dev/null +++ b/somsoftware/sominfo.groovy @@ -0,0 +1,31 @@ +def somsoftwareinfostore = null + +/* Example expected JSON +{ + "Artifact info": { + "Location": "Jenkins job artifact", + "Job": "SOM_GIS_master/SOM_GIS_master_build", + "Job selector": "true", + "Release repo": "git@hydra:som_gis-releases/som_gis_whole.git", + "Release repo revision": "" + } +}*/ + +def String asJsonText() { + return writeJSON(returnText: true, json: somsoftwareinfostore, pretty: 1) +} + +def boolean exists() { + return (somsoftwareinfostore != null) +} + +def set(String jsontext) { + somsoftwareinfostore = readJSON(text: jsontext) + echo "Som software support info:\n${asJsonText()}" +} + +def get() { + return somsoftwareinfostore +} + +return this \ No newline at end of file From ddd07b90e4fa111c00557826f86449d15c47115c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 16:35:51 +0000 Subject: [PATCH 1799/1971] CORE-348 - Provide a script that can obtain a package from a release repo --- publish/package.groovy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 68c41f3..83084bc 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -50,7 +50,15 @@ pipeline { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def packageimportoptions = importer.getNewImportOptions() - packageimportoptions.jenkinsjob(PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR) + // For backward compatibility - in case these parameters are not supplied + def packagelocation = params[PACKAGE_LOCATION] ?: 'Jenkins job artifact' + def packagereleaserepo = params[PACKAGE_RELEASE_REPO] ?: '' + def packagereleaserevision = params[PACKAGE_RELEASE_REVISION] ?: '' + packageimportoptions.source(packagelocation, + PACKAGE_CREATE_JOB, + PACKAGE_CREATE_JOB_SELECTOR, + packagereleaserepo, + packagereleaserevision) packageimportoptions.setincrementversionnumber(true) packagemeta = importer.artifactimport(meta, packageimportoptions, PACKAGEDEST) From 05f9c1b870ce2bd8d591f14506ae88540667f6f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 16:42:49 +0000 Subject: [PATCH 1800/1971] CORE-348 - Provide a script that can obtain a package from a release repo --- publish/package.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 83084bc..7b43221 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -51,9 +51,9 @@ pipeline { def packageimportoptions = importer.getNewImportOptions() // For backward compatibility - in case these parameters are not supplied - def packagelocation = params[PACKAGE_LOCATION] ?: 'Jenkins job artifact' - def packagereleaserepo = params[PACKAGE_RELEASE_REPO] ?: '' - def packagereleaserevision = params[PACKAGE_RELEASE_REVISION] ?: '' + def packagelocation = params['PACKAGE_LOCATION'] ?: 'Jenkins job artifact' + def packagereleaserepo = params['PACKAGE_RELEASE_REPO'] ?: '' + def packagereleaserevision = params['PACKAGE_RELEASE_REVISION'] ?: '' packageimportoptions.source(packagelocation, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, From aa124fab8ef4180410ce29ddfc2a1e62012f93af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 16:45:06 +0000 Subject: [PATCH 1801/1971] CORE-348 - Provide a script that can obtain a package from a release repo --- publish/package.groovy | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 7b43221..32d53e7 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -12,23 +12,6 @@ pipeline { 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" - } } } } @@ -59,7 +42,7 @@ pipeline { PACKAGE_CREATE_JOB_SELECTOR, packagereleaserepo, packagereleaserevision) - packageimportoptions.setincrementversionnumber(true) + packageimportoptions.setincrementversionnumber(false) packagemeta = importer.artifactimport(meta, packageimportoptions, PACKAGEDEST) PACKAGE_FOLDER = "${PACKAGEDEST}/package" From b0d92b011d470509ca0d5aa5959d62572ed06f51 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 16:46:23 +0000 Subject: [PATCH 1802/1971] CORE-348 - Provide a script that can obtain a package from a release repo --- publish/package.groovy | 7 ------- 1 file changed, 7 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 32d53e7..04236e0 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -8,13 +8,6 @@ pipeline { } } } - stage('Checkout dependencies') { - steps { - script { - configurationhelper = autobuilder.configurationhelper() - } - } - } stage('Clean exports') { steps { script { From 9285f75c774190f5487ef5153c7dc58eccb3b511 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 21:56:34 +0000 Subject: [PATCH 1803/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 174 +++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 publish/packagecollection.groovy diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy new file mode 100644 index 0000000..1d61414 --- /dev/null +++ b/publish/packagecollection.groovy @@ -0,0 +1,174 @@ +def packagecollection = null + +/* Example expected JSON +{ + "packages": { + "gis-hmb-fd-hv-esw-el-sg1024": { + "Location": "Jenkins job artifact", + "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_app_0.9.6_debpackage", + "Job selector": "1248", + "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_package.git", + "Release repo revision": "refs/tag/0.9.6.57669" + "Path": "package/gis-hmb-fd-hv-esw-el-sg1024_armhf.deb", + }, + "gis-hmb-fd-hv-esw-el-sg1024": { + "Location": "Jenkins job artifact", + "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_control_0.9.6_debpackage", + "Job selector": "1722", + "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_control_package.git", + "Release repo revision": "refs/tag/0.9.6.7964" + "Path": "package/gis-hmb-fd-hv-control-service-sg1024_armhf.deb", + } + } +} +*/ + +def String packagecollection_asJsonText() { + return writeJSON(returnText: true, json: packagecollection, pretty: 1) +} + +def boolean packagecollection_exists() { + return (packagecollection != null) +} + +def packagecollection_set(String jsontext) { + packagecollection = readJSON(text: jsontext) + echo "Package collection info:\n${asJsonText()}" +} + +def packagecollection_get() { + return packagecollection +} + +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 { + PACKAGEDEST = "${WORKSPACE}/package" + cleanfolders = [ + PACKAGEDEST, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Transfer packages') { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + packagecollection_set(PACKAGE_COLLECTION) + debpackagecollection = packagecollection_get() + + debpackagecollection.packages.each { debpackageinfo-> + def packagekey = debpackageinfo.key + echo "Processing package: ${packagekey}" + def packagedest = "${PACKAGEDEST}/packagekey" + + def packageimportoptions = importer.getNewImportOptions() + // For backward compatibility - in case these parameters are not supplied + packageimportoptions.source(debpackageinfo['Location'], + debpackageinfo['Job'], + debpackageinfo['Job selector'], + debpackageinfo['Release repo'], + debpackageinfo['Release repo revision']) + packageimportoptions.setincrementversionnumber(false) + packagemeta = importer.artifactimport(meta, packageimportoptions, packagedest) + + PACKAGE_FILE = "${packagedest}/package/${debpackageinfo['Path']}" + + echo "Aptly config file is ${APTLY_CONFIG_FILE}" + echo "Repo name is ${REPO_NAME}" + echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}" + + sh """#!/bin/bash -v + aptly config show + if [ \$? -ne 0 ]; then exit 1; fi + + 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 + + # 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 + + 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 + """ + + 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 + + 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' + } + } +} + From 97b31de1b803e043f824ae61b85cab0fb3252fd5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 22:03:52 +0000 Subject: [PATCH 1804/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 1d61414..1687728 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -72,8 +72,8 @@ pipeline { debpackagecollection.packages.each { debpackageinfo-> def packagekey = debpackageinfo.key - echo "Processing package: ${packagekey}" - def packagedest = "${PACKAGEDEST}/packagekey" + echo "Processing package: ${packagekey}\n${debpackageinfo}" + def packagedest = "${PACKAGEDEST}/${packagekey}" def packageimportoptions = importer.getNewImportOptions() // For backward compatibility - in case these parameters are not supplied @@ -85,7 +85,7 @@ pipeline { packageimportoptions.setincrementversionnumber(false) packagemeta = importer.artifactimport(meta, packageimportoptions, packagedest) - PACKAGE_FILE = "${packagedest}/package/${debpackageinfo['Path']}" + UNIQUE_PACKAGE_FOLDER = "${packagedest}/package" echo "Aptly config file is ${APTLY_CONFIG_FILE}" echo "Repo name is ${REPO_NAME}" From 1beb23e893e172679f998e8201f90d797d1c2e07 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 22:17:13 +0000 Subject: [PATCH 1805/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 1687728..7d64c94 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -8,16 +8,16 @@ def packagecollection = null "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_app_0.9.6_debpackage", "Job selector": "1248", "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_package.git", - "Release repo revision": "refs/tag/0.9.6.57669" - "Path": "package/gis-hmb-fd-hv-esw-el-sg1024_armhf.deb", + "Release repo revision": "refs/tag/0.9.6.57669", + "Path": "package/gis-hmb-fd-hv-esw-el-sg1024_armhf.deb" }, "gis-hmb-fd-hv-esw-el-sg1024": { "Location": "Jenkins job artifact", "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_control_0.9.6_debpackage", "Job selector": "1722", "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_control_package.git", - "Release repo revision": "refs/tag/0.9.6.7964" - "Path": "package/gis-hmb-fd-hv-control-service-sg1024_armhf.deb", + "Release repo revision": "refs/tag/0.9.6.7964", + "Path": "package/gis-hmb-fd-hv-control-service-sg1024_armhf.deb" } } } @@ -33,7 +33,7 @@ def boolean packagecollection_exists() { def packagecollection_set(String jsontext) { packagecollection = readJSON(text: jsontext) - echo "Package collection info:\n${asJsonText()}" + echo "Package collection info:\n${packagecollection_asJsonText()}" } def packagecollection_get() { From b72ddc8a0dbe538b9c1efe0608a55fd51789601f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 22:21:37 +0000 Subject: [PATCH 1806/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 7d64c94..e59566d 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -23,8 +23,8 @@ def packagecollection = null } */ -def String packagecollection_asJsonText() { - return writeJSON(returnText: true, json: packagecollection, pretty: 1) +def String asJsonText(somejson = packagecollection) { + return writeJSON(returnText: true, json: somejson, pretty: 1) } def boolean packagecollection_exists() { @@ -33,7 +33,7 @@ def boolean packagecollection_exists() { def packagecollection_set(String jsontext) { packagecollection = readJSON(text: jsontext) - echo "Package collection info:\n${packagecollection_asJsonText()}" + echo "Package collection info:\n${asJsonText(packagecollection)}" } def packagecollection_get() { @@ -72,7 +72,7 @@ pipeline { debpackagecollection.packages.each { debpackageinfo-> def packagekey = debpackageinfo.key - echo "Processing package: ${packagekey}\n${debpackageinfo}" + echo "Processing package: ${packagekey}\n${asJsonText(debpackageinfo)}" def packagedest = "${PACKAGEDEST}/${packagekey}" def packageimportoptions = importer.getNewImportOptions() From 46fc96980213fd21f604df229e2d197fa72b2119 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 22:26:22 +0000 Subject: [PATCH 1807/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index e59566d..0fbfe5d 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -70,9 +70,11 @@ pipeline { packagecollection_set(PACKAGE_COLLECTION) debpackagecollection = packagecollection_get() - debpackagecollection.packages.each { debpackageinfo-> - def packagekey = debpackageinfo.key + debpackagecollection['packages'].each { packageinfo-> + def packagekey = packageinfo.key + def debpackageinfo = packageinfo.value echo "Processing package: ${packagekey}\n${asJsonText(debpackageinfo)}" + def packagedest = "${PACKAGEDEST}/${packagekey}" def packageimportoptions = importer.getNewImportOptions() From f9c843817f6b1356dfb4f939f8c13e6aad17e057 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 22:30:01 +0000 Subject: [PATCH 1808/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 0fbfe5d..fd24b2e 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -70,9 +70,8 @@ pipeline { packagecollection_set(PACKAGE_COLLECTION) debpackagecollection = packagecollection_get() - debpackagecollection['packages'].each { packageinfo-> - def packagekey = packageinfo.key - def debpackageinfo = packageinfo.value + for (packagekey in debpackagecollection['packages'].keySet()) { + def debpackageinfo = debpackagecollection[packagekey] echo "Processing package: ${packagekey}\n${asJsonText(debpackageinfo)}" def packagedest = "${PACKAGEDEST}/${packagekey}" From 7e987f0a51af1d578149de1f0396853d46b74121 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 22:31:31 +0000 Subject: [PATCH 1809/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index fd24b2e..717487b 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -72,7 +72,7 @@ pipeline { for (packagekey in debpackagecollection['packages'].keySet()) { def debpackageinfo = debpackagecollection[packagekey] - echo "Processing package: ${packagekey}\n${asJsonText(debpackageinfo)}" + echo "Processing package: ${packagekey}\n${debpackageinfo}" def packagedest = "${PACKAGEDEST}/${packagekey}" From 2c11a0cea7d2b4793dc7080e4bd263b04ab4e7f8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 22:41:05 +0000 Subject: [PATCH 1810/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 717487b..1ad8773 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -33,7 +33,7 @@ def boolean packagecollection_exists() { def packagecollection_set(String jsontext) { packagecollection = readJSON(text: jsontext) - echo "Package collection info:\n${asJsonText(packagecollection)}" + echo "Package collection info:\n${asJsonText(packagecollection)}\nType:\n${packagecollection.getClass()}" } def packagecollection_get() { @@ -71,7 +71,7 @@ pipeline { debpackagecollection = packagecollection_get() for (packagekey in debpackagecollection['packages'].keySet()) { - def debpackageinfo = debpackagecollection[packagekey] + def debpackageinfo = debpackagecollection['packages'][packagekey] echo "Processing package: ${packagekey}\n${debpackageinfo}" def packagedest = "${PACKAGEDEST}/${packagekey}" From b0cc38c742fc01089e74a4902aa63cc84fd2f56a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 22:54:21 +0000 Subject: [PATCH 1811/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 1ad8773..20e2427 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -70,9 +70,9 @@ pipeline { packagecollection_set(PACKAGE_COLLECTION) debpackagecollection = packagecollection_get() - for (packagekey in debpackagecollection['packages'].keySet()) { + for (packagekey in debpackagecollection.packages.keySet()) { def debpackageinfo = debpackagecollection['packages'][packagekey] - echo "Processing package: ${packagekey}\n${debpackageinfo}" + echo "Processing package: ${packagekey}\n${debpackageinfo}\n${debpackageinfo.getClass()}" def packagedest = "${PACKAGEDEST}/${packagekey}" From 80c2a61596c8d1ef4353131b5e1243df0df38982 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 23:01:44 +0000 Subject: [PATCH 1812/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 20e2427..85bb215 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -73,6 +73,12 @@ pipeline { for (packagekey in debpackagecollection.packages.keySet()) { def debpackageinfo = debpackagecollection['packages'][packagekey] echo "Processing package: ${packagekey}\n${debpackageinfo}\n${debpackageinfo.getClass()}" + echo "Info: ${debpackageinfo['Location']}" + echo "Info: ${debpackageinfo['Job']}" + echo "Info: ${debpackageinfo['Job selector']}" + echo "Info: ${debpackageinfo['Release repo']}" + echo "Info: ${debpackageinfo['Release repo revision']}" + echo "Info: ${debpackageinfo.Location}" def packagedest = "${PACKAGEDEST}/${packagekey}" From 9ad83e9a802e673c68bbfe044ca3766a8032a00f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 23:04:59 +0000 Subject: [PATCH 1813/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 85bb215..2bb7429 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -70,9 +70,8 @@ pipeline { packagecollection_set(PACKAGE_COLLECTION) debpackagecollection = packagecollection_get() - for (packagekey in debpackagecollection.packages.keySet()) { - def debpackageinfo = debpackagecollection['packages'][packagekey] - echo "Processing package: ${packagekey}\n${debpackageinfo}\n${debpackageinfo.getClass()}" + for (debpackageinfo in debpackagecollection.packages) { + echo "Processing package: ${debpackageinfo.key}\n${debpackageinfo}\n${debpackageinfo.getClass()}" echo "Info: ${debpackageinfo['Location']}" echo "Info: ${debpackageinfo['Job']}" echo "Info: ${debpackageinfo['Job selector']}" From 0c5fb9833daf47487053c83558de7448e10040f8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 23:17:38 +0000 Subject: [PATCH 1814/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index 2bb7429..c2d3007 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -11,7 +11,7 @@ def packagecollection = null "Release repo revision": "refs/tag/0.9.6.57669", "Path": "package/gis-hmb-fd-hv-esw-el-sg1024_armhf.deb" }, - "gis-hmb-fd-hv-esw-el-sg1024": { + "gis-hmb-fd-hv-control-service-sg1024": { "Location": "Jenkins job artifact", "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_control_0.9.6_debpackage", "Job selector": "1722", @@ -72,12 +72,12 @@ pipeline { for (debpackageinfo in debpackagecollection.packages) { echo "Processing package: ${debpackageinfo.key}\n${debpackageinfo}\n${debpackageinfo.getClass()}" + echo "Info: ${debpackageinfo.Location}" echo "Info: ${debpackageinfo['Location']}" echo "Info: ${debpackageinfo['Job']}" echo "Info: ${debpackageinfo['Job selector']}" echo "Info: ${debpackageinfo['Release repo']}" echo "Info: ${debpackageinfo['Release repo revision']}" - echo "Info: ${debpackageinfo.Location}" def packagedest = "${PACKAGEDEST}/${packagekey}" From 7515c39bc30e705d0a0cb8fdd8efca767c35c9d2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 23:21:01 +0000 Subject: [PATCH 1815/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index c2d3007..a2c8656 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -70,7 +70,7 @@ pipeline { packagecollection_set(PACKAGE_COLLECTION) debpackagecollection = packagecollection_get() - for (debpackageinfo in debpackagecollection.packages) { + debpackagecollection.packages.each { debpackageinfo-> echo "Processing package: ${debpackageinfo.key}\n${debpackageinfo}\n${debpackageinfo.getClass()}" echo "Info: ${debpackageinfo.Location}" echo "Info: ${debpackageinfo['Location']}" From 6fd010a622066ab9d7f495cd1124a8b687875385 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 23:30:13 +0000 Subject: [PATCH 1816/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index a2c8656..f3f313f 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -2,8 +2,9 @@ def packagecollection = null /* Example expected JSON { - "packages": { - "gis-hmb-fd-hv-esw-el-sg1024": { + "packages": [ + { + "Name": "gis-hmb-fd-hv-esw-el-sg1024", "Location": "Jenkins job artifact", "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_app_0.9.6_debpackage", "Job selector": "1248", @@ -11,7 +12,8 @@ def packagecollection = null "Release repo revision": "refs/tag/0.9.6.57669", "Path": "package/gis-hmb-fd-hv-esw-el-sg1024_armhf.deb" }, - "gis-hmb-fd-hv-control-service-sg1024": { + { + "Name", "gis-hmb-fd-hv-control-service-sg1024", "Location": "Jenkins job artifact", "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_control_0.9.6_debpackage", "Job selector": "1722", @@ -19,7 +21,7 @@ def packagecollection = null "Release repo revision": "refs/tag/0.9.6.7964", "Path": "package/gis-hmb-fd-hv-control-service-sg1024_armhf.deb" } - } + ] } */ @@ -71,7 +73,7 @@ pipeline { debpackagecollection = packagecollection_get() debpackagecollection.packages.each { debpackageinfo-> - echo "Processing package: ${debpackageinfo.key}\n${debpackageinfo}\n${debpackageinfo.getClass()}" + echo "Processing package: ${debpackageinfo.Name}\n${debpackageinfo}\n${debpackageinfo.getClass()}" echo "Info: ${debpackageinfo.Location}" echo "Info: ${debpackageinfo['Location']}" echo "Info: ${debpackageinfo['Job']}" @@ -79,7 +81,7 @@ pipeline { echo "Info: ${debpackageinfo['Release repo']}" echo "Info: ${debpackageinfo['Release repo revision']}" - def packagedest = "${PACKAGEDEST}/${packagekey}" + def packagedest = "${PACKAGEDEST}/${debpackageinfo.Name}" def packageimportoptions = importer.getNewImportOptions() // For backward compatibility - in case these parameters are not supplied From e408bd18dc96a71c807f45180e058fe7b04963db Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 23:32:33 +0000 Subject: [PATCH 1817/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index f3f313f..c16704a 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -13,7 +13,7 @@ def packagecollection = null "Path": "package/gis-hmb-fd-hv-esw-el-sg1024_armhf.deb" }, { - "Name", "gis-hmb-fd-hv-control-service-sg1024", + "Name": "gis-hmb-fd-hv-control-service-sg1024", "Location": "Jenkins job artifact", "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_control_0.9.6_debpackage", "Job selector": "1722", From 85afca9ccc289bec148791605ca9832e249002cb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 9 Jan 2022 23:39:43 +0000 Subject: [PATCH 1818/1971] Create a script for publishing a set of debian packages to a remote update server --- publish/packagecollection.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/publish/packagecollection.groovy b/publish/packagecollection.groovy index c16704a..a87453e 100644 --- a/publish/packagecollection.groovy +++ b/publish/packagecollection.groovy @@ -1,13 +1,14 @@ def packagecollection = null /* Example expected JSON +{ { "packages": [ { "Name": "gis-hmb-fd-hv-esw-el-sg1024", "Location": "Jenkins job artifact", "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_app_0.9.6_debpackage", - "Job selector": "1248", + "Job selector": "1248", "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_package.git", "Release repo revision": "refs/tag/0.9.6.57669", "Path": "package/gis-hmb-fd-hv-esw-el-sg1024_armhf.deb" @@ -16,7 +17,7 @@ def packagecollection = null "Name": "gis-hmb-fd-hv-control-service-sg1024", "Location": "Jenkins job artifact", "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_control_0.9.6_debpackage", - "Job selector": "1722", + "Job selector": "1722", "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_control_package.git", "Release repo revision": "refs/tag/0.9.6.7964", "Path": "package/gis-hmb-fd-hv-control-service-sg1024_armhf.deb" @@ -87,7 +88,7 @@ pipeline { // For backward compatibility - in case these parameters are not supplied packageimportoptions.source(debpackageinfo['Location'], debpackageinfo['Job'], - debpackageinfo['Job selector'], + "${debpackageinfo['Job selector']}", debpackageinfo['Release repo'], debpackageinfo['Release repo revision']) packageimportoptions.setincrementversionnumber(false) From 9d04525431e7a45a2be8dc02c005b737b2f0bcf0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 14:40:15 +0000 Subject: [PATCH 1819/1971] Correct hierarchical import of artifacts from release repositories --- import/importer.groovy | 8 ++++---- meta/folder.groovy | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 8bb565a..2c40215 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -200,11 +200,11 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) - relatedimportinfo = importedmeta.getassociated() + def collectedmetalist = importedmeta.getassociated(destpath) echo "Cloning associated repos" - for(relatedmetainfo in relatedimportinfo) { - def relatedmeta = relatedmetainfo.meta - def relatedoffsetpath = relatedmetainfo.offsetpath + for(def collectedmeta in collectedmetalist) { + def relatedmeta = collectedmeta.metainfo + def relatedoffsetpath = collectedmeta.accumulatedpath def cloneurl = relatedmeta.releaseinfo.releaserepoURL def clonerevision = "refs/tags/${relatedmeta.releasetag()}" def clonepath = "${destpath}/${relatedoffsetpath}" diff --git a/meta/folder.groovy b/meta/folder.groovy index b9e898c..1fdd3ff 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -701,10 +701,6 @@ class MetaInfo extends GISJsonSerialised { associatedmeta = new ArrayList() } - List getassociated() { - return associatedmeta - } - void markreleased() { script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") releaseinfo.markreleased() @@ -1079,6 +1075,7 @@ class MetaInfo extends GISJsonSerialised { return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ] } + // Walks all layers of associated data only def allrelatedmeta(String metapath = '') { def ArrayList metacollection = new ArrayList() def Map metamap = new LinkedHashMap() @@ -1092,6 +1089,11 @@ class MetaInfo extends GISJsonSerialised { return results.metacollection } + // Walks 1 layer of associated data only + def getassociated(String metapath) { + return releasewalker(1, '', metapath) + } + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] From 51224e052613daa518de977758d630a026b8bf73 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 15:08:15 +0000 Subject: [PATCH 1820/1971] Correct hierarchical import of artifacts from release repositories --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 2c40215..773c7a7 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -214,7 +214,7 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { gh.stripgithistory(clonepath) - def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}" + def metafilepath = "${clonepath}${relatedmeta.metafilepath()}" echo "Marking related meta as released and rewriting meta file: ${metafilepath}" rewritemetafileasreleased(relatedmeta, metafilepath) } From 8be38b88522cc3a8a119d6ae98e38ae13c6b9025 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 15:14:48 +0000 Subject: [PATCH 1821/1971] Correct hierarchical import of artifacts from release repositories --- import/importer.groovy | 6 ++++-- meta/folder.groovy | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 773c7a7..621e5f2 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -199,9 +199,11 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist) def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) - + + echo "Getting associated metadata from path ${destpath}" def collectedmetalist = importedmeta.getassociated(destpath) - echo "Cloning associated repos" + + echo "Cloning associated repos inside ${destpath}" for(def collectedmeta in collectedmetalist) { def relatedmeta = collectedmeta.metainfo def relatedoffsetpath = collectedmeta.accumulatedpath diff --git a/meta/folder.groovy b/meta/folder.groovy index 1fdd3ff..12bc2cb 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1090,8 +1090,8 @@ class MetaInfo extends GISJsonSerialised { } // Walks 1 layer of associated data only - def getassociated(String metapath) { - return releasewalker(1, '', metapath) + def getassociated(String rootpath) { + return releasewalker(1, rootpath, "${rootpath}/${METAFOLDERNAME}") } Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) { From 5c3c949e374c1b59a53e75bb0469910b9efd195d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 15:20:27 +0000 Subject: [PATCH 1822/1971] Correct hierarchical import of artifacts from release repositories --- import/importer.groovy | 4 ++-- meta/folder.groovy | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 621e5f2..208e66b 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -200,10 +200,10 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath)) - echo "Getting associated metadata from path ${destpath}" + echo "Getting associated metadata from path: ${destpath}" def collectedmetalist = importedmeta.getassociated(destpath) - echo "Cloning associated repos inside ${destpath}" + echo "Cloning associated repos inside path: ${destpath}" for(def collectedmeta in collectedmetalist) { def relatedmeta = collectedmeta.metainfo def relatedoffsetpath = collectedmeta.accumulatedpath diff --git a/meta/folder.groovy b/meta/folder.groovy index 12bc2cb..de613f5 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1091,7 +1091,7 @@ class MetaInfo extends GISJsonSerialised { // Walks 1 layer of associated data only def getassociated(String rootpath) { - return releasewalker(1, rootpath, "${rootpath}/${METAFOLDERNAME}") + return releasewalker(1, '', "${rootpath}/${METAFOLDERNAME}") } Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) { From eb72549852e5f60ad5b1f5782406ef7d28d4e95f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 15:45:17 +0000 Subject: [PATCH 1823/1971] Correct hierarchical import of artifacts from release repositories --- meta/folder.groovy | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index de613f5..f08ecae 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -608,6 +608,7 @@ class MetaInfo extends GISJsonSerialised { abstract void deserialiseJson(rawmeta) abstract LinkedHashMap serialisationdata() abstract String getrelatedid() + abstract void markreleased() } class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { @@ -642,6 +643,10 @@ class MetaInfo extends GISJsonSerialised { String getrelatedid() { return uniqueid } + + void markreleased() { + meta.releaseinfo.markreleased() + } } class RelatedMetaInfo_v0_2 extends RelatedMetaInfo { @@ -674,6 +679,10 @@ class MetaInfo extends GISJsonSerialised { String getrelatedid() { return uniqueid } + + void markreleased() { + // Do nothing + } } private ProductInfo productinfo @@ -705,7 +714,7 @@ class MetaInfo extends GISJsonSerialised { script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") releaseinfo.markreleased() for (associated in associatedmeta) { - associated.meta.releaseinfo.markreleased() + associated.markreleased() } } From b365f5b41825d26767635818b6ef2ed8c2583f62 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 15:58:45 +0000 Subject: [PATCH 1824/1971] Correct hierarchical import of artifacts from release repositories --- meta/folder.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f08ecae..9558ce9 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1094,7 +1094,9 @@ class MetaInfo extends GISJsonSerialised { ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { def ArrayList metacollection = new ArrayList() def Map metamap = new LinkedHashMap() - def results = walkrelated(new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth)) + def IterationInfo ii = new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth) + script.echo("Release walker interation info at start:\n${ii.show()}") + def results = walkrelated(ii) return results.metacollection } From 00afcebd3df0b2489e424488ec7dd742770e4b1d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 16:23:57 +0000 Subject: [PATCH 1825/1971] Correct hierarchical import of artifacts from release repositories --- import/importer.groovy | 3 +++ meta/folder.groovy | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 208e66b..0e870af 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -202,6 +202,9 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { echo "Getting associated metadata from path: ${destpath}" def collectedmetalist = importedmeta.getassociated(destpath) + for(def collectedmeta in collectedmetalist) { + echo "Collection meta item: ${collectedmeta.metainfo.componentversionuniqueidentifier()} offset path: ${collectedmeta.accumulatedpath}" + } echo "Cloning associated repos inside path: ${destpath}" for(def collectedmeta in collectedmetalist) { diff --git a/meta/folder.groovy b/meta/folder.groovy index 9558ce9..b6d9a76 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1095,7 +1095,7 @@ class MetaInfo extends GISJsonSerialised { def ArrayList metacollection = new ArrayList() def Map metamap = new LinkedHashMap() def IterationInfo ii = new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth) - script.echo("Release walker interation info at start:\n${ii.show()}") + script.echo("Release walker iteration info at start:\n${ii.show()}") def results = walkrelated(ii) return results.metacollection } From 1a0dcf9ac2f7b6fb8f2b2bdca9746e2bb45fc9aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 16:34:23 +0000 Subject: [PATCH 1826/1971] Correct hierarchical import of artifacts from release repositories --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index b6d9a76..6715145 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1102,7 +1102,7 @@ class MetaInfo extends GISJsonSerialised { // Walks 1 layer of associated data only def getassociated(String rootpath) { - return releasewalker(1, '', "${rootpath}/${METAFOLDERNAME}") + return releasewalker(2, '', "${rootpath}/${METAFOLDERNAME}") // Max depth 2 (including itself) } Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) { From aaa7b8ac086bbba6aa5e483f890214f029e59ebf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 17:39:57 +0000 Subject: [PATCH 1827/1971] Correct hierarchical import of artifacts from release repositories --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 0e870af..22dbc9e 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -56,7 +56,7 @@ class ImportOptions { m_sourceselect = sourceselect break default: - error("Unknown type of artifact source select: ${m_sourceselect}") + m_script.error("Unknown type of artifact source select: ${m_sourceselect}") } } From 0c87c2bccb2ebbeb78df00e015b73ce4dad20aad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 17:42:14 +0000 Subject: [PATCH 1828/1971] Correct hierarchical import of artifacts from release repositories --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 22dbc9e..6ec0841 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -56,7 +56,7 @@ class ImportOptions { m_sourceselect = sourceselect break default: - m_script.error("Unknown type of artifact source select: ${m_sourceselect}") + m_script.error("Unknown type of artifact source select: ${sourceselect}") } } From 2c26b221f12ad963c322612f2935afeb2705c68c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 11 Jan 2022 18:09:03 +0000 Subject: [PATCH 1829/1971] Correct hierarchical import of artifacts from release repositories --- import/importer.groovy | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 6ec0841..bb0d32e 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -151,7 +151,7 @@ def conditionalClean(ImportOptions importoptions, String destpath) { } } -def artifactimportfrombuildjob(meta, importoptions, String destpath) { +def artifactimportfrombuildjob(meta, ImportOptions importoptions, String destpath) { if (importoptions.m_sourceselect != 'Jenkins job artifact') { error("Import options settings have not been set for: Jenkins job artifact") return @@ -183,7 +183,7 @@ def rewritemetafileasreleased(meta, String filepath) { meta.saveJsonSerialised(filepath) } -def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { +def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { if (importoptions.m_sourceselect != 'Release repository') { error("Import options settings have not been set for: Release repository") return @@ -234,7 +234,7 @@ def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) { return importedmeta } -def artifactimportfromrepo(meta, importoptions, String destpath) { +def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { if (importoptions.m_sourceselect != 'Release repository') { error("Import options settings have not been set for: Release repository") return @@ -262,7 +262,7 @@ def artifactimportfromrepo(meta, importoptions, String destpath) { return importedmeta } -def artifactimport(meta, importoptions, String destpath) { +def artifactimport(meta, ImportOptions importoptions, String destpath) { switch (importoptions.m_sourceselect) { case 'Jenkins job artifact': case 'Jenkins job artefact': @@ -347,7 +347,13 @@ def artifactimport(meta, } // Import the artifacts of a named child component found below parent meta's hierarchy -def artifactimport(meta, parentmeta, String parentmetapath, String childproduct, String childsubcomponent, importoptions, String destinationfolder) { +def artifactimport(meta, + parentmeta, + String parentmetapath, + String childproduct, + String childsubcomponent, + ImportOptions importoptions, + String destinationfolder) { // Import from parent meta def childmeta = meta.getNewMetaObject() def childmeta2 @@ -356,7 +362,7 @@ def artifactimport(meta, parentmeta, String parentmetapath, String childproduct, def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent) if (findresults.matchfound) { childmeta = findresults.matchedmetaitem.metainfo - if (childmeta.releaseinfo.released) { + if (importoptions.m_sourceselect == 'Release repository' || childmeta.releaseinfo.released) { importoptions.releaserepo(childmeta.releaseinfo.releaserepoURL, childmeta.releasetag()) } else { importoptions.jenkinsjob(childmeta.jenkinsbuildinfo.buildjobname, childmeta.jenkinsbuildinfo.buildnumber) From f821da79d81ee32c13f98d60210f76e09c4bb772 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 12:38:49 +0000 Subject: [PATCH 1830/1971] CORE-594 - Debug installer creation --- import/importer.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/import/importer.groovy b/import/importer.groovy index bb0d32e..8df88e1 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -45,6 +45,10 @@ class ImportOptions { m_appendtoparentmeta = appendtoparentmeta } + void show() { + script.echo(this.toString()) + } + void setsourceselect(String sourceselect) { sourceselect = sourceselect.trim() switch (sourceselect) { @@ -263,6 +267,7 @@ def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { } def artifactimport(meta, ImportOptions importoptions, String destpath) { + importoptions.show() switch (importoptions.m_sourceselect) { case 'Jenkins job artifact': case 'Jenkins job artefact': From cfcdf5c827e9614001893376e96dc7e6f9c441a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 12:40:52 +0000 Subject: [PATCH 1831/1971] CORE-594 - Debug installer creation --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 8df88e1..8bc96a3 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -46,7 +46,7 @@ class ImportOptions { } void show() { - script.echo(this.toString()) + m_script.echo(this.toString()) } void setsourceselect(String sourceselect) { From 5b3f7a7226ba252489459f8b74f767491f00e5ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 13:03:32 +0000 Subject: [PATCH 1832/1971] CORE-594 - Debug installer creation --- import/importer.groovy | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 8bc96a3..2f7611e 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -45,8 +45,22 @@ class ImportOptions { m_appendtoparentmeta = appendtoparentmeta } - void show() { - m_script.echo(this.toString()) + String show() { + return """m_incrementversionnumber: ${m_incrementversionnumber} + m_filter: ${m_filter} + m_excludes: ${m_excludes} + m_fingerprint: ${m_fingerprint} + m_nested: ${m_nested} + m_flatten: ${m_flatten} + m_includemetainfilter: ${m_includemetainfilter} + m_clean: ${m_clean} + m_appendtoparentmeta: ${m_appendtoparentmeta} + m_sourceselect: ${m_sourceselect} + m_jobname: ${m_jobname} + m_buildnumberorselector: ${m_buildnumberorselector} + m_repo: ${m_repo} + m_revision: ${m_revision} + """ } void setsourceselect(String sourceselect) { @@ -267,7 +281,7 @@ def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { } def artifactimport(meta, ImportOptions importoptions, String destpath) { - importoptions.show() + echo "Importing artifacts: Import options:\n${importoptions.show()}\n to: ${destpath}" switch (importoptions.m_sourceselect) { case 'Jenkins job artifact': case 'Jenkins job artefact': From a1c2d3b336a64e7bfa71e45381b74e78ea3b07f3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 13:35:50 +0000 Subject: [PATCH 1833/1971] CORE-594 - Debug installer creation --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 2f7611e..af40c5f 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -127,7 +127,7 @@ class ImportOptions { m_jobname = jobname.trim() m_buildnumberorselector = [ $class: 'ParameterizedBuildSelector', - parameterName: "${buildnumberorselector}" + parameterName: "${buildnumberorselector}" ] setsourceselect('Jenkins job artifact') } From 36ed63e11b8a994ce8fefe0b8b903f25765e5814 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 13:39:13 +0000 Subject: [PATCH 1834/1971] CORE-594 - Debug installer creation --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index af40c5f..b2dc41b 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -114,7 +114,7 @@ class ImportOptions { m_appendtoparentmeta = appendtoparentmeta } - void jenkinsjob(String jobname, buildnumberorselector) { + void jenkinsjob(String jobname, String buildnumberorselector) { m_jobname = jobname.trim() m_buildnumberorselector = [ $class: 'ParameterizedBuildSelector', From 945f83759dfb6817275abed13480f3ff18c51675 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 14:16:27 +0000 Subject: [PATCH 1835/1971] CORE-594 - Debug installer creation --- import/importer.groovy | 10 ++++++++-- install/installhelper.groovy | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index b2dc41b..d6fb4d4 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -20,6 +20,8 @@ class ImportOptions { String m_repo String m_revision + + boolean m_showdetails ImportOptions(script, String sourceselect = 'Jenkins job artifact', @@ -31,7 +33,8 @@ class ImportOptions { boolean flatten = false, boolean includemetainfilter = true, boolean clean = true, - appendtoparentmeta = true) { + appendtoparentmeta = true, + show = false) { m_script = script m_sourceselect = sourceselect.trim() m_incrementversionnumber = incrementversionnumber @@ -43,6 +46,7 @@ class ImportOptions { m_includemetainfilter = includemetainfilter m_clean = clean m_appendtoparentmeta = appendtoparentmeta + m_showdetails = show } String show() { @@ -281,7 +285,9 @@ def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { } def artifactimport(meta, ImportOptions importoptions, String destpath) { - echo "Importing artifacts: Import options:\n${importoptions.show()}\n to: ${destpath}" + if (importoptions.m_show) { + echo "Importing artifacts:\nImport options:\n${importoptions.show()}\nto: ${destpath}" + } switch (importoptions.m_sourceselect) { case 'Jenkins job artifact': case 'Jenkins job artefact': diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 96a8b2e..2915d0c 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -26,6 +26,7 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) { artifactFetched = [:] + echo ("artifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}") def importoptions = importer.getNewImportOptions() for (installer in toBuild) { def artifactKeys = installerDetails.get(installer)[1] From d70f63344e8faef8448b5267eca6093bde946145 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 14:21:53 +0000 Subject: [PATCH 1836/1971] CORE-594 - Debug installer creation --- import/importer.groovy | 10 +++++++--- install/installhelper.groovy | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index d6fb4d4..4948cad 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -34,7 +34,7 @@ class ImportOptions { boolean includemetainfilter = true, boolean clean = true, appendtoparentmeta = true, - show = false) { + showdetails = false) { m_script = script m_sourceselect = sourceselect.trim() m_incrementversionnumber = incrementversionnumber @@ -46,7 +46,7 @@ class ImportOptions { m_includemetainfilter = includemetainfilter m_clean = clean m_appendtoparentmeta = appendtoparentmeta - m_showdetails = show + m_showdetails = showdetails } String show() { @@ -147,6 +147,10 @@ class ImportOptions { releaserepo(repo, revision) setsourceselect(sourceselect) } + + void showdetails(boolean showdetails) { + m_showdetails = showdetails + } } ImportOptions getNewImportOptions() { @@ -285,7 +289,7 @@ def artifactimportfromrepo(meta, ImportOptions importoptions, String destpath) { } def artifactimport(meta, ImportOptions importoptions, String destpath) { - if (importoptions.m_show) { + if (importoptions.m_showdetails) { echo "Importing artifacts:\nImport options:\n${importoptions.show()}\nto: ${destpath}" } switch (importoptions.m_sourceselect) { diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 2915d0c..9c11499 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -23,11 +23,12 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin } // Given details about artifacts to import and details of installers to build, import artifacts that are required -def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) { +def Map artifactsImporter(meta, importer, artifactDetails, installerDetails, boolean showdetails = false) { artifactFetched = [:] echo ("artifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}") def importoptions = importer.getNewImportOptions() + importoptions.showdetails(showdetails) for (installer in toBuild) { def artifactKeys = installerDetails.get(installer)[1] if (artifactKeys instanceof java.lang.String) { From 05a32d03f832828ddca41325ef2b6b9934b2aebc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 14:29:40 +0000 Subject: [PATCH 1837/1971] CORE-594 - Debug installer creation --- install/installhelper.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 9c11499..214fa84 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -26,7 +26,9 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin def Map artifactsImporter(meta, importer, artifactDetails, installerDetails, boolean showdetails = false) { artifactFetched = [:] - echo ("artifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}") + if (showdetails) { + echo ("toBuild:\n${toBuild}\nartifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}") + } def importoptions = importer.getNewImportOptions() importoptions.showdetails(showdetails) for (installer in toBuild) { From d2820996984068d8632ff5060ec3fd1c0758a699 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 14:36:22 +0000 Subject: [PATCH 1838/1971] CORE-594 - Debug installer creation --- install/installhelper.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 214fa84..a637fac 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -32,10 +32,17 @@ def Map artifactsImporter(meta, importer, artifactDetails, installerDetails, boo def importoptions = importer.getNewImportOptions() importoptions.showdetails(showdetails) for (installer in toBuild) { - def artifactKeys = installerDetails.get(installer)[1] + def installerinfo = installerDetails.get(installer) + if (showdetails) { + echo ("installer:\n${installer}\installerinfo:\n${installerinfo}") + } + def artifactKeys = installerinfo[1] if (artifactKeys instanceof java.lang.String) { artifactKeys = [ artifactKeys ] } + if (showdetails) { + echo ("artifactKeys:\n${artifactKeys}") + } for (artifactKey in artifactKeys) { (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) if (artifactFetched.get(artifactKey) == null) { From f1987cb9f47afdbdcefdc545567b71d86fee0c9d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 14:38:48 +0000 Subject: [PATCH 1839/1971] CORE-594 - Debug installer creation --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index a637fac..926775e 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -34,7 +34,7 @@ def Map artifactsImporter(meta, importer, artifactDetails, installerDetails, boo for (installer in toBuild) { def installerinfo = installerDetails.get(installer) if (showdetails) { - echo ("installer:\n${installer}\installerinfo:\n${installerinfo}") + echo ("installer:\n${installer}\ninstallerinfo:\n${installerinfo}") } def artifactKeys = installerinfo[1] if (artifactKeys instanceof java.lang.String) { From fb721bb774e5a849d316aea9939bb4ddc491fe92 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 14:44:49 +0000 Subject: [PATCH 1840/1971] CORE-594 - Debug installer creation --- install/installhelper.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 926775e..3a1cd23 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -44,7 +44,11 @@ def Map artifactsImporter(meta, importer, artifactDetails, installerDetails, boo echo ("artifactKeys:\n${artifactKeys}") } for (artifactKey in artifactKeys) { - (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey) + artifactDetail = artifactDetails.get(artifactKey) + if (showdetails) { + echo ("artifactKey: ${artifactKey}\nartifactDetail:\n${artifactDetail}") + } + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetail if (artifactFetched.get(artifactKey) == null) { importoptions.jenkinsjob(sourceProject, sourceselector) importoptions.setincrementversionnumber(incrementversionnumber) From eda480161f3b55b34ed217607eaf978fd5b425df Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 15:12:47 +0000 Subject: [PATCH 1841/1971] CORE-594 - Debug installer creation --- install/installhelper.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 3a1cd23..77b917c 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -60,6 +60,9 @@ def Map artifactsImporter(meta, importer, artifactDetails, installerDetails, boo } } } + if (showdetails) { + echo ("artifactFetched:\n${artifactFetched}") + } return artifactFetched } From cdd00fdeefd8663a92cf303d3cbc6d4e88ce754d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 16:28:00 +0000 Subject: [PATCH 1842/1971] CORE-594 - Debug installer creation --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 77b917c..6763cb1 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -23,7 +23,7 @@ def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, Strin } // Given details about artifacts to import and details of installers to build, import artifacts that are required -def Map artifactsImporter(meta, importer, artifactDetails, installerDetails, boolean showdetails = false) { +def Map artifactsImporter(meta, importer, toBuild, artifactDetails, installerDetails, boolean showdetails = false) { artifactFetched = [:] if (showdetails) { From 6a415afe26eaa813ef1a5df891b9cfc52f1ee2ce Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 18:46:33 +0000 Subject: [PATCH 1843/1971] CORE-594 - Debug installer creation --- install/installhelper.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 6763cb1..57fe65b 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -111,6 +111,7 @@ def checkISMfilebackend(String xml) { def checkISMfile(String ISMfile) { echo "Checking ISM file: ${ISMfile}" def xml = readFile(ISMfile) + echo "ISM file xml: ${xml}" (exitcode, message) = checkISMfilebackend(xml) echo message if (exitcode > 0) { From 951032de5a24f774f294d2241e67ad4260b9301a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 13 Jan 2022 22:17:14 +0000 Subject: [PATCH 1844/1971] CORE-594 - Debug installer creation --- install/installhelper.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installhelper.groovy b/install/installhelper.groovy index 57fe65b..8dbf23e 100644 --- a/install/installhelper.groovy +++ b/install/installhelper.groovy @@ -111,7 +111,7 @@ def checkISMfilebackend(String xml) { def checkISMfile(String ISMfile) { echo "Checking ISM file: ${ISMfile}" def xml = readFile(ISMfile) - echo "ISM file xml: ${xml}" + //echo "ISM file xml: ${xml}" (exitcode, message) = checkISMfilebackend(xml) echo message if (exitcode > 0) { From 8e15e7b6ce1690fadd187ac6542a82c78a8c0831 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 14 Jan 2022 10:21:06 +0000 Subject: [PATCH 1845/1971] CORE-594 - Import artifacts using full name --- artifacts/metaexport.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy index 8e5e56e..a40e9a8 100644 --- a/artifacts/metaexport.groovy +++ b/artifacts/metaexport.groovy @@ -4,7 +4,7 @@ def combineSubjobArtifacts(meta, importer, subJobs) { for (subJob in subJobs) { def subJobObject = subJob[0] if (subJobObject != null) { - def subJobName = subJobObject.getProjectName() + def subJobName = subJobObject.getFullProjectName() def subJobNumber = subJobObject.getNumber() def destFolder = subJob[1] def boolean incrementversionnumber = subJob[2] From e67bec14df6246631ef9e22fb06e16ed83c2527e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Jan 2022 21:04:36 +0000 Subject: [PATCH 1846/1971] When doing nested release repo imports - ignore components that have incomplete release info --- import/importer.groovy | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 4948cad..90383b0 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -239,15 +239,18 @@ def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String de 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) + if (relatedmeta.componentidentifier() != '___' && + relatedmeta.componentidentifier() != '_' && + cloneurl != '') { + 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) + } else { + echo "Not importing component that would be placed at path: ${clonepath}" + } } gh.stripgithistory(destpath) def metafilepath = "${destpath}/${meta.metafilepath()}" From b9f524061526dddd68e2195f4031e837a4232b53 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 16 Jan 2022 23:03:35 +0000 Subject: [PATCH 1847/1971] / missing when doing hierarchical release repo checkout --- import/importer.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/import/importer.groovy b/import/importer.groovy index 4948cad..133cd10 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -245,7 +245,7 @@ def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String de gh.stripgithistory(clonepath) - def metafilepath = "${clonepath}${relatedmeta.metafilepath()}" + def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}" echo "Marking related meta as released and rewriting meta file: ${metafilepath}" rewritemetafileasreleased(relatedmeta, metafilepath) } From 9b89c0f629d2fc58b6b803693c685a1f1f40ccb6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 27 Jan 2022 11:26:20 +0000 Subject: [PATCH 1848/1971] CORE-348 - Reverse a debugging change --- versioncontrol/git.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 2e7eade..a22054b 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -104,13 +104,13 @@ def String checkouttoreporoot(String gitURL) { def checkgitlfsinstall() { if (isUnix()) { sh """ - git lfs install --skip-repo + git lfs install if [ \$? -ne 0 ]; then exit 1; fi """ } else { powershell """ - git lfs install --skip-repo + git lfs install if (\$lastexitcode -ge 1) { exit 1 } """ } From 5575f2bd18cb7325eac43803d4297e998ba47918 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 28 Jan 2022 18:01:56 +0000 Subject: [PATCH 1849/1971] Don't attempt to import artifacts associated with components that do not have complete meta --- import/importer.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/import/importer.groovy b/import/importer.groovy index 438410d..fa32ebf 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -239,8 +239,7 @@ def hierarchyartifactimportfromrepo(meta, ImportOptions importoptions, String de def cloneurl = relatedmeta.releaseinfo.releaserepoURL def clonerevision = "refs/tags/${relatedmeta.releasetag()}" def clonepath = "${destpath}/${relatedoffsetpath}" - if (relatedmeta.componentidentifier() != '___' && - relatedmeta.componentidentifier() != '_' && + if (relatedmeta.componentidentifier() != '_' && cloneurl != '') { echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}" gh.gitCheckoutAlt(cloneurl, clonerevision, clonepath, "", 1, true, []) From 1e29bd5e2f6bd141d6c4ac0718c7440cd679d24f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 29 Jan 2022 15:58:36 +0000 Subject: [PATCH 1850/1971] Force item copier workspace to be cleaned each time --- copy/all.groovy | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index aab479c..d0a7fb3 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -4,27 +4,18 @@ pipeline { stage('Initial setup') { steps { script { + // Force workspace to be cleaned + CLEAN_WORKSPACE = "true" meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) importer = load("${autobuilder.commonscripts()}/import/importer.groovy") } } } - 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 { + IMPORTS = 'imports' def copyoptions = importer.getNewImportOptions() copyoptions.source( SOURCE_ARTIFACT_LOCATION, From 10d0019fd44ae1bb149ca3c7760a1dfd66459656 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 29 Jan 2022 16:13:21 +0000 Subject: [PATCH 1851/1971] Ensure script objects are around when source files have been cleaned --- copy/all.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index d0a7fb3..ea56044 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -32,9 +32,9 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(['**/*']) def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + def cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(['meta', 'autobuild']) dir(IMPORTS) { @@ -48,6 +48,7 @@ pipeline { cleaner.clean([IMPORTS]) + def artifactlist = meta.generateartifacts(['**/*']) artifactarchiver.archive(meta, artifactlist) } } From 2e74e8aa8a46d71f74ee1c660fc1e3de5251d0ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 29 Jan 2022 23:14:04 +0000 Subject: [PATCH 1852/1971] Eliminate a copy for performance --- copy/all.groovy | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index ea56044..5bf9590 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -15,7 +15,6 @@ pipeline { stage('Import source artifacts') { steps { script { - IMPORTS = 'imports' def copyoptions = importer.getNewImportOptions() copyoptions.source( SOURCE_ARTIFACT_LOCATION, @@ -25,7 +24,7 @@ pipeline { SOURCE_ARTIFACT_RELEASE_REVISION) echo "Nested: ${NESTED_COPY}" copyoptions.setnested(NESTED_COPY == 'true') - importer.artifactimport(meta, copyoptions, IMPORTS) + importer.artifactimport(meta, copyoptions, WORKSPACE) } } } @@ -37,17 +36,6 @@ pipeline { def cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(['meta', 'autobuild']) - dir(IMPORTS) { - fileOperations([ - fileCopyOperation(excludes: '', - flattenFiles: false, - includes: '**/*', - targetLocation: WORKSPACE) - ]) - } - - cleaner.clean([IMPORTS]) - def artifactlist = meta.generateartifacts(['**/*']) artifactarchiver.archive(meta, artifactlist) } From 4044992fbb8e1976084428be2f19e576205d5080 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 29 Jan 2022 23:19:04 +0000 Subject: [PATCH 1853/1971] Eliminate a copy for performance --- copy/all.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index 5bf9590..2a88800 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -9,6 +9,8 @@ pipeline { meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") } } } @@ -31,9 +33,6 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - - def cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(['meta', 'autobuild']) def artifactlist = meta.generateartifacts(['**/*']) From 3271d90a49d6773f744575293653b4fe7ebba5cc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 29 Jan 2022 23:24:13 +0000 Subject: [PATCH 1854/1971] Eliminate a copy for performance --- copy/all.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/all.groovy b/copy/all.groovy index 2a88800..a6431da 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -26,7 +26,7 @@ pipeline { SOURCE_ARTIFACT_RELEASE_REVISION) echo "Nested: ${NESTED_COPY}" copyoptions.setnested(NESTED_COPY == 'true') - importer.artifactimport(meta, copyoptions, WORKSPACE) + importer.artifactimport(meta, copyoptions, "${WORKSPACE}/.") } } } From cbc328915d31d7cfbe0d5e45ae4792b1193d5039 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 29 Jan 2022 23:48:45 +0000 Subject: [PATCH 1855/1971] Eliminate a copy for performance --- copy/all.groovy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index a6431da..14c0b35 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -33,9 +33,19 @@ pipeline { stage('Archiving artifacts') { steps { script { - cleaner.clean(['meta', 'autobuild']) + // Save the imported meta - while the unwanted meta is written to file then deleted + def stashname = 'Imported meta stash' + stash(allowEmpty: true, + includes: 'meta/**', + name: stashname, + useDefaultExcludes: false) + { + def artifactlist = meta.generateartifacts(['**/*']) + + cleaner.clean(['meta', 'autobuild']) + } + unstash(name: stashname) - def artifactlist = meta.generateartifacts(['**/*']) artifactarchiver.archive(meta, artifactlist) } } From 0326879391035840f42f5e1eb5ffc92e834c8995 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 30 Jan 2022 00:04:18 +0000 Subject: [PATCH 1856/1971] Eliminate a copy for performance --- copy/all.groovy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/copy/all.groovy b/copy/all.groovy index 14c0b35..24aacfb 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -39,11 +39,10 @@ pipeline { includes: 'meta/**', name: stashname, useDefaultExcludes: false) - { - def artifactlist = meta.generateartifacts(['**/*']) - cleaner.clean(['meta', 'autobuild']) - } + def artifactlist = meta.generateartifacts(['**/*']) + cleaner.clean(['meta', 'autobuild']) + unstash(name: stashname) artifactarchiver.archive(meta, artifactlist) From e5bca0dbb6e629c137edd5325ec3e132c01f4696 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Feb 2022 15:46:25 +0000 Subject: [PATCH 1857/1971] 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..d0349b6 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# release_info_autobuild + +release_info_autobuild release repo \ No newline at end of file From 9171d4d09383dd99d0fa5f06e3f4b50cbb26dca8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Feb 2022 17:01:43 +0000 Subject: [PATCH 1858/1971] Initial commit --- product/foreach.groovy | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 product/foreach.groovy diff --git a/product/foreach.groovy b/product/foreach.groovy new file mode 100644 index 0000000..690c5e1 --- /dev/null +++ b/product/foreach.groovy @@ -0,0 +1,61 @@ +def productcollectionstore = null + +/* Example expected JSON +{ + "ProductReleaseRepos": [ + "git@hydra:print-server-releases/print_server_whole.git" + ] +}*/ + +def String asJsonText() { + return writeJSON(returnText: true, json: productcollectionstore, pretty: 1) +} + +def boolean exists() { + return (productcollectionstore != null) +} + +def set(String jsontext) { + productcollectionstore = readJSON(text: jsontext) + echo "Product collection:\n${asJsonText()}" +} + +def get() { + return productcollectionstore +} + +pipeline { + agent { label AGENT_LABEL } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.startnonbuild(this) + + set(PRODUCT_COLLECTION) + } + } + } + stage('Clean folders') { + steps { + script { + cleanfolders = [ + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Iterate product collection') { + steps { + script { + def productcollection = get() + for (productrepo in productcollection.ProductReleaseRepos) { + } + } + } + } +} +} +PRODUCT_COLLECTION \ No newline at end of file From c1344e90845db3aa76de5f3d0fc93abb462f8782 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Feb 2022 17:04:54 +0000 Subject: [PATCH 1859/1971] Squashed 'Commons_scripts/' content from commit 0326879 git-subtree-dir: Commons_scripts git-subtree-split: 0326879391035840f42f5e1eb5ffc92e834c8995 --- .project | 17 + .pydevproject | 8 + .settings/org.eclipse.core.resources.prefs | 2 + artifacts/archiver.groovy | 17 + artifacts/metaexport.groovy | 26 + autobuilder.groovy | 147 ++ build/integrity.groovy | 113 ++ build/postactions.groovy | 225 ++++ build/postactionstest.groovy | 43 + check/build_meta.groovy | 87 ++ check/do_meta.groovy | 77 ++ checksum/utils.groovy | 15 + clean/clean.groovy | 10 + commandline/commandline.groovy | 12 + .../eclipsebuild/disableparallelbuilds.groovy | 12 + compile/eclipsebuild/eclipseSTM8build.groovy | 172 +++ compile/eclipsebuild/eclipseds5build.groovy | 252 ++++ compile/eclipsebuild/eclipseniosbuild.groovy | 116 ++ configuration/configuration.groovy | 18 + configuration/tools.groovy | 59 + copy/all.groovy | 67 + copy/esw.groovy | 67 + copy/filtered.groovy | 73 + copy/logic.groovy | 79 ++ differences/.project | 17 + differences/.pydevproject | 8 + differences/dometahierarchy.groovy | 836 ++++++++++++ differences/file.groovy | 24 + differences/json.groovy | 51 + differences/metahierarchy.groovy | 102 ++ documentation/doxygen_deploy.groovy | 80 ++ hardware/sominfo.groovy | 80 ++ import/importer.groovy | 408 ++++++ install/installhelper.groovy | 136 ++ meta/folder.groovy | 1193 +++++++++++++++++ packaging/debian.groovy | 111 ++ platform/lineendings.groovy | 5 + publish/.classpath | 9 + publish/.gitignore | 7 + publish/.project | 18 + .../org.eclipse.jdt.groovy.core.prefs | 3 + publish/do.groovy | 174 +++ publish/package.groovy | 181 +++ publish/promptingpublish.groovy | 182 +++ publish/publish.groovy | 92 ++ publish/publishitems.groovy | 129 ++ publishing/utils.groovy | 27 + release/do.groovy | 458 +++++++ release/registerrepo.groovy | 12 + release/release.groovy | 87 ++ remoteaccess/ftp.groovy | 32 + remoteaccess/hostedftp.groovy | 28 + staticanalysis/ccm.groovy | 85 ++ staticanalysis/cpd.groovy | 152 +++ staticanalysis/cppcheck.groovy | 114 ++ test/testethernetproduct.groovy | 204 +++ textutils/subst.groovy | 8 + .../vs2017install/buildmachines.vsconfig | 25 + versioncontrol/git.groovy | 377 ++++++ versionnumbering/do.groovy | 23 + versionnumbering/generate.groovy | 180 +++ versionstamping/.project | 17 + versionstamping/.pydevproject | 8 + versionstamping/versionstamper.py | 38 + 64 files changed, 7435 insertions(+) create mode 100644 .project create mode 100644 .pydevproject create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 artifacts/archiver.groovy create mode 100644 artifacts/metaexport.groovy create mode 100644 autobuilder.groovy create mode 100644 build/integrity.groovy create mode 100644 build/postactions.groovy create mode 100644 build/postactionstest.groovy create mode 100644 check/build_meta.groovy create mode 100644 check/do_meta.groovy create mode 100644 checksum/utils.groovy create mode 100644 clean/clean.groovy create mode 100644 commandline/commandline.groovy create mode 100644 compile/eclipsebuild/disableparallelbuilds.groovy create mode 100644 compile/eclipsebuild/eclipseSTM8build.groovy create mode 100644 compile/eclipsebuild/eclipseds5build.groovy create mode 100644 compile/eclipsebuild/eclipseniosbuild.groovy create mode 100644 configuration/configuration.groovy create mode 100644 configuration/tools.groovy create mode 100644 copy/all.groovy create mode 100644 copy/esw.groovy create mode 100644 copy/filtered.groovy create mode 100644 copy/logic.groovy create mode 100644 differences/.project create mode 100644 differences/.pydevproject create mode 100644 differences/dometahierarchy.groovy create mode 100644 differences/file.groovy create mode 100644 differences/json.groovy create mode 100644 differences/metahierarchy.groovy create mode 100644 documentation/doxygen_deploy.groovy create mode 100644 hardware/sominfo.groovy create mode 100644 import/importer.groovy create mode 100644 install/installhelper.groovy create mode 100644 meta/folder.groovy create mode 100644 packaging/debian.groovy create mode 100644 platform/lineendings.groovy create mode 100644 publish/.classpath create mode 100644 publish/.gitignore create mode 100644 publish/.project create mode 100644 publish/.settings/org.eclipse.jdt.groovy.core.prefs create mode 100644 publish/do.groovy create mode 100644 publish/package.groovy create mode 100644 publish/promptingpublish.groovy create mode 100644 publish/publish.groovy create mode 100644 publish/publishitems.groovy create mode 100644 publishing/utils.groovy create mode 100644 release/do.groovy create mode 100644 release/registerrepo.groovy create mode 100644 release/release.groovy create mode 100644 remoteaccess/ftp.groovy create mode 100644 remoteaccess/hostedftp.groovy create mode 100644 staticanalysis/ccm.groovy create mode 100644 staticanalysis/cpd.groovy create mode 100644 staticanalysis/cppcheck.groovy create mode 100644 test/testethernetproduct.groovy create mode 100644 textutils/subst.groovy create mode 100644 tool configurations/vs2017install/buildmachines.vsconfig create mode 100644 versioncontrol/git.groovy create mode 100644 versionnumbering/do.groovy create mode 100644 versionnumbering/generate.groovy create mode 100644 versionstamping/.project create mode 100644 versionstamping/.pydevproject create mode 100644 versionstamping/versionstamper.py diff --git a/.project b/.project new file mode 100644 index 0000000..e329c3f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Common Build Scripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..1ce5929 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 2.7 +python35 + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..1174a06 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//versionnumbering/versioninfo.py=utf-8 diff --git a/artifacts/archiver.groovy b/artifacts/archiver.groovy new file mode 100644 index 0000000..bafba02 --- /dev/null +++ b/artifacts/archiver.groovy @@ -0,0 +1,17 @@ +enum Store { + JENKINS, + ARTIFACTSERVER, +} + +this.JENKINS = Store.JENKINS +this.ARTIFACTSERVER = Store.JENKINS + +def archive(MetaInfo meta, String artifactlist, Store store = JENKINS) { + echo "Archiving artifacts to store: ${store}" + meta.copyrelatedmeta() + if (store == JENKINS) { + archiveArtifacts(artifacts: artifactlist) + } +} + +return this \ No newline at end of file diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy new file mode 100644 index 0000000..a40e9a8 --- /dev/null +++ b/artifacts/metaexport.groovy @@ -0,0 +1,26 @@ +// 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.getFullProjectName() + def subJobNumber = subJobObject.getNumber() + def destFolder = subJob[1] + def boolean incrementversionnumber = subJob[2] + dir(destFolder) { + deleteDir() + } + + def importoptions = importer.getNewImportOptions() + importoptions.jenkinsjob(subJobName, subJobNumber) + importoptions.setincrementversionnumber(incrementversionnumber) + importer.artifactimport(meta, importoptions, destFolder) + + artifactFolders.add("${destFolder}/**") + } + } + return artifactFolders +} + +return this; diff --git a/autobuilder.groovy b/autobuilder.groovy new file mode 100644 index 0000000..667f89a --- /dev/null +++ b/autobuilder.groovy @@ -0,0 +1,147 @@ +// 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 +} + +def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { + def String altered = releaserepo.trim() + + if (releaserepovariantsuffix?.trim()) { + altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", releaserepovariantsuffix) + } + return altered +} + +def setBuildType(meta, boolean dofullbuild = true) { + def doquickbuild = false + + echo "Build trigger cause: ${currentBuild.getBuildCauses()}" + if (currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')) { + echo "Build triggered by user" + if (!dofullbuild) { + echo "Marking as quick build as user wanted one" + doquickbuild = true + } + } else { + echo "Build triggered automatically" + if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause') || currentBuild.getBuildCauses('hudson.triggers.SCMTrigger$SCMTriggerCause')) { + echo "Marking as quick build as it was triggered by a commit" + doquickbuild = true + } else if (currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')) { + echo "Marking as full build as it was triggered by timer" + } + } + echo "Build type is ${doquickbuild ? "quick" : "full"}" + if (doquickbuild) { + unstable('This not a full build - a subset of the artifacts is not being generated') + } + meta.jenkinsbuildinfo.set(!doquickbuild) + return doquickbuild +} + +def setupmeta(script, String productname, String subcomponentname, String productvariant = '') { + def meta = getmetafolderscript().metareset(script) + echo "Product name: ${productname} Subcomponent name: ${subcomponentname} Variant: ${productvariant}" + 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()) + for (p in params) { + meta.jenkinsbuildinfo.addParameter(p.key, p.value) + } + return meta +} + +// Start up boilerplate +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 + commonscriptsroot = commonscriptspath + metafolderscript = load("${commonscripts()}/meta/folder.groovy") + + conditionalclean() + + def meta = setupmeta(script, productname, subcomponentname, productvariant) + + def rr = load("${commonscripts()}/release/registerrepo.groovy") + def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant) + + echo "Release repo: ${alteredreleaserepo}" + rr.registerrepo(meta, alteredreleaserepo) + + def ch = load("${commonscripts()}/configuration/configuration.groovy") + ch.registerPipelineScriptConfiguration(meta) + + return meta +} + +// Start up boilerplate +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 = setupmeta(script, "Non-build-product", "Non-build-subcomponent") + + 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/build/integrity.groovy b/build/integrity.groovy new file mode 100644 index 0000000..e93c00f --- /dev/null +++ b/build/integrity.groovy @@ -0,0 +1,113 @@ +import static groovy.json.JsonOutput.* + +def check(buildmeta) { + def results = [ + 'good': true, + 'comment': '', + ] + + // Walk the meta looking for different versions of the same components + def allmeta = buildmeta.allrelatedmeta() + echo "All meta:\n${allmeta.comment}" + + // Store build stamps associated with each product component; Store a counter against each product component version + def productcomponents = [:] + for (meta in allmeta.metacollection) { + def key = meta.componentidentifier() + + if (!productcomponents.containsKey(key)) { + productcomponents[key] = [:] + } + def buildstampnumber = meta.releasetag() + if (!productcomponents[key].containsKey(buildstampnumber)) { + productcomponents[key][buildstampnumber] = 1 + } else { + productcomponents[key][buildstampnumber] += 1 + } + } + + // Show what was collected + echo prettyPrint(toJson(productcomponents)) + + // Look for product components with more than one build stamp + for (pc in productcomponents.keySet()) { + def bsns = productcomponents[pc] + if (bsns.size() > 1) { + results.good = false + results.comment += "There is more than one version of Product component: ${pc} being used in this build:\n" + for (bsn in bsns.keySet()) { + results.comment += "${bsn}\n" + } + } + } + + // Store product components associated with each release git url + def releasegiturls = [:] + for (meta in allmeta.metacollection) { + def String key = meta.releaseinfo.releaserepoURL + + if (key) { + if (!releasegiturls.containsKey(key)) { + releasegiturls[key] = [:] + } + def componentidentifier = meta.componentidentifier() + if (!releasegiturls[key].containsKey(componentidentifier)) { + releasegiturls[key][componentidentifier] = 1 + } else { + releasegiturls[key][componentidentifier] += 1 + } + } + } + + // Show what was collected + echo prettyPrint(toJson(releasegiturls)) + + // Look for release git urls being used by more than one product component + for (rgu in releasegiturls.keySet()) { + def cis = releasegiturls[rgu] + if (cis.size() > 1) { + results.good = false + results.comment += "There is more than one product component associated with a release git url: ${rgu} being used in this build:\n" + for (ci in cis.keySet()) { + results.comment += "${ci}\n" + } + } + } + + // Store git commit shas associated with each source git url + def sourcegiturls = [:] + for (meta in allmeta.metacollection) { + def String key = meta.gitinfo.remoteurl + + if (key) { + if (!sourcegiturls.containsKey(key)) { + sourcegiturls[key] = [:] + } + def commitsha = meta.gitinfo.gitrevision + if (!sourcegiturls[key].containsKey(commitsha)) { + sourcegiturls[key][commitsha] = 1 + } else { + sourcegiturls[key][commitsha] += 1 + } + } + } + + // Show what was collected + echo prettyPrint(toJson(sourcegiturls)) + + // Look for source git urls associated with more than one sha code + for (sgu in sourcegiturls.keySet()) { + def cs = sourcegiturls[sgu] + if (cs.size() > 1) { + results.good = false + results.comment += "There is more than one source commit sha associated with a source git url: ${sgu} being used in this build:\n" + for (c in cs.keySet()) { + results.comment += "${c}\n" + } + } + } + + return results +} + +return this \ No newline at end of file diff --git a/build/postactions.groovy b/build/postactions.groovy new file mode 100644 index 0000000..8b18908 --- /dev/null +++ b/build/postactions.groovy @@ -0,0 +1,225 @@ +/* Example post build info +{ + "Build outcomes": { + "Success": { + "Actions": { + "Deploy documentation": { + "Description": "Can be empty - Name of documentation/doxygen deploy job to run if this build is successful", + "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_doxygen_deploy" + }, + "Static analysis": { + "Description": "Can be empty - Static analysis job to run when this build is successful", + "Job": "" + }, + "Unit test": { + "Description": "Can be empty - Unit test job to run when this build is successful", + "Job": "" + }, + "Regression test": { + "Description": "Can be empty - Regression test job to run when this build is successful", + "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_run_tests" + }, + "Update differences": { + "Description": "Can be empty - Update differences job to run when this build is successful", + "Job": "HMB_FD_HV_diff_releases" + }, + "Release to git": { + "Description": "Can be empty - Name of release to git job to run if this build is successful", + "Job": "HMB_FD_HV_release_to_git" + } + } + }, + "Failed": { + "Actions": { + "Email": { + "Description": "Can be empty - Name of release to git job to run if this build is successful", + "To": [ + "dan.hawkins@globalinkjetsystems.com" + ] + }, + "ExtEmail": { + "Description": "Send an email using Extended Email plugin", + "To": [ + "dan.hawkins@globalinkjetsystems.com" + ], + "Recipient providers": [ + "culprits", + "requestor", + "developers", + "upstreamDevelopers" + ] + } + } + } + } +} +*/ + +def getActionJobName(postbuildactions, String action, String alternativeparamname) { + def String jobname = '' + if (postbuildactions) { + try { + jobname = postbuildactions[action]['Job'] + } catch(Exception ex) { + echo "No post build actions found for action: ${action}" + jobname = '' + } + } else { + if (params[alternativeparamname] != null) { + if (params[alternativeparamname]) { + jobname = params[alternativeparamname] + } + } + } + if (jobname) { + def jobitem = Jenkins.instance.getItemByFullName(jobname) + if (jobitem) { + if (!jobitem.isBuildable()) { + jobname = '' + } + } else { + jobname = '' + } + } + // echo "Job name for action: ${action}: ${jobname}" + return jobname +} + +def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername) { + def jobname = getActionJobName(postbuildactions, action, alternativeparamname) + if (jobname) { + build( + wait: false, + job: jobname, + parameters: [ + string(name: jobnameparametername, value: JOB_NAME), + string(name: jobselectorparametername, value: buildselector), + ] + ) + } +} + +def readPostBuildInfo() { + def postbuildinfo = readJSON(text: POST_BUILD_INFO) + def postbuildjsontext = writeJSON(returnText: true, json: postbuildinfo, pretty: 1) + // echo "Post build info:\n${postbuildjsontext}" + + return postbuildinfo +} + +def performSuccessfulBuildActions() { + def postbuildactions + if (params.POST_BUILD_INFO != null) { + def postbuildinfo = readPostBuildInfo() + try { + postbuildactions = postbuildinfo['Build outcomes']['Success']['Actions'] + } catch(Exception ex) { + echo "Post build info did not contain: Build outcomes/Success/Actions" + postbuildactions = null + } + } + def String buildselector = "${BUILD_NUMBER}" + deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR') + deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' ) + deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') + deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') + deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR') + deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR') +} + +def sendemails(emailinfo) { + def emailtolist = emailinfo['To'] + + if (emailtolist) { + def emailbody = """ + Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} + + Console output: ${BUILD_URL}console + """ + for(emailto in emailtolist) { + mail( + subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + body: emailbody, + to: emailto + ) + // echo "Send email to: ${emailto}" + } + } +} + +def getRecipientProviders(recipientProviderInfoList) { + def recipientProviderMap = [ + culprits: [$class: 'CulpritsRecipientProvider'], + requestor: [$class: 'RequesterRecipientProvider'], + developers: [$class: 'DevelopersRecipientProvider'], + upstreamDevelopers: [$class: 'UpstreamComitterRecipientProvider'], + ] + def recipientProviders = [] + + if (recipientProviderInfoList) { + for(rp in recipientProviderInfoList) { + if (recipientProviderMap.containsKey(rp)) { + recipientProviders.add(recipientProviderMap[rp]) + } + } + } + if (recipientProviders.size() == 0) { + recipientProviders = [culprits(), requestor(), developers(), upstreamDevelopers()] + } + // echo "recipientProviders: ${recipientProviders.toString()}" + return recipientProviders; +} + +def String getToList(toListInfo) { + def String toList = '' + + if (toListInfo) { + toList = toListInfo.join(',') + } + // echo "toList: ${toList}" + return toList +} + +def sendextemail(extmailinfo) { + def recipientProviders = getRecipientProviders(extmailinfo['Recipient providers']) + def toList = getToList(extmailinfo['To']) + + emailext( + subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", + body: '''${JELLY_SCRIPT,template="html"}''', + attachLog: true, + // attachmentsPattern: '', + compressLog: false, + // from : '', + mimeType: 'text/html', + // postsendScript: '', + // presendScript: '', + recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers + // replyTo: '', + saveOutput: false, + to: toList, + ) +} + +def performFailedBuildActions() { + def postbuildactions = null + if (params.POST_BUILD_INFO != null) { + def postbuildinfo = readPostBuildInfo() + try { + postbuildactions = postbuildinfo['Build outcomes']['Failed']['Actions'] + } catch(Exception ex) { + echo "Post build info did not contain: Build outcomes/Failed/Actions" + postbuildactions = null + } + } + if (postbuildactions) { + if (postbuildactions['Email']) { + sendemails(postbuildactions['Email']) + } + if (postbuildactions['ExtEmail']) { + sendextemail(postbuildactions['ExtEmail']) + } + } +} + +return this; diff --git a/build/postactionstest.groovy b/build/postactionstest.groovy new file mode 100644 index 0000000..150f5d1 --- /dev/null +++ b/build/postactionstest.groovy @@ -0,0 +1,43 @@ +pipeline { + agent { label 'master' } + stages { + stage('Initial setup') { + steps { + script { + CLEAN_WORKSPACE = false + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Dummy build job') { + steps { + script { + echo "Execute dummy build job: ${CAUSE_ERROR}" + if (CAUSE_ERROR == 'true') { + error("Causing error") + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + script { + load("${autobuilder.commonscripts()}/build/postactions.groovy").performFailedBuildActions() + } + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + script { + load("${autobuilder.commonscripts()}/build/postactions.groovy").performSuccessfulBuildActions() + } + } + } +} diff --git a/check/build_meta.groovy b/check/build_meta.groovy new file mode 100644 index 0000000..fb8a75d --- /dev/null +++ b/check/build_meta.groovy @@ -0,0 +1,87 @@ +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() + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive("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/check/do_meta.groovy b/check/do_meta.groovy new file mode 100644 index 0000000..4b8a89e --- /dev/null +++ b/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.metainfo.componentversionuniqueidentifier() + def offsetpath = entry.accumulatedpath + 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.accumulatedpath + 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/checksum/utils.groovy b/checksum/utils.groovy new file mode 100644 index 0000000..be7569d --- /dev/null +++ b/checksum/utils.groovy @@ -0,0 +1,15 @@ + +// 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) { + echo "Checksumming: ${file.path}" + def sum = sha1(file: file.path).trim() + checksumset.addChecksumPair(file.path, sum) + } + } +} + +return this; \ No newline at end of file diff --git a/clean/clean.groovy b/clean/clean.groovy new file mode 100644 index 0000000..4707ba0 --- /dev/null +++ b/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/commandline/commandline.groovy b/commandline/commandline.groovy new file mode 100644 index 0000000..38f80fa --- /dev/null +++ b/commandline/commandline.groovy @@ -0,0 +1,12 @@ +String getCommandOutput(String cmd) { + if (isUnix()) { + return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim() + } else { + return powershell(returnStdout: true, script: """ + ${cmd} + """ + ).trim() + } +} + +return this \ No newline at end of file diff --git a/compile/eclipsebuild/disableparallelbuilds.groovy b/compile/eclipsebuild/disableparallelbuilds.groovy new file mode 100644 index 0000000..03e4c8f --- /dev/null +++ b/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) + + return registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) +} + +return this diff --git a/configuration/tools.groovy b/configuration/tools.groovy new file mode 100644 index 0000000..dbaeedb --- /dev/null +++ b/configuration/tools.groovy @@ -0,0 +1,59 @@ +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + +class ToolOptions { + def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) + + String m_toolName + + String m_gitURL + String m_revision + String m_repoRoot + int m_cloneDepth + boolean m_shallowClone + + ToolOptions(script) { + m_script = script + m_gitURL = '-' + m_revision = '-' + m_repoRoot = '' + m_cloneDepth = 1 + m_shallowClone = true + } + + void toolName(String name) { + m_toolName = name.trim() + } + + void toolRepo(String gitURL, String revision) { + m_gitURL = gitURL.trim() + m_revision = revision.trim() + } + + void repoRoot(String root) { + m_repoRoot = root.trim() + } + + void clonedepth(int depth) { + m_cloneDepth = depth + } + + void shallowclone(boolean shallow) { + m_shallowClone = shallow + } +} + +ToolOptions getNewToolOptions() { + return new ToolOptions(this) +} + +def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { + meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) +} + +def getTool(meta, ToolOptions options, String targetDir) { + gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone) + + registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir)) +} + +return this diff --git a/copy/all.groovy b/copy/all.groovy new file mode 100644 index 0000000..24aacfb --- /dev/null +++ b/copy/all.groovy @@ -0,0 +1,67 @@ +pipeline { + agent { label AGENT_LABEL } + stages { + stage('Initial setup') { + steps { + script { + // Force workspace to be cleaned + CLEAN_WORKSPACE = "true" + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + } + } + } + stage('Import source artifacts') { + steps { + script { + 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, "${WORKSPACE}/.") + } + } + } + stage('Archiving artifacts') { + steps { + script { + // Save the imported meta - while the unwanted meta is written to file then deleted + def stashname = 'Imported meta stash' + stash(allowEmpty: true, + includes: 'meta/**', + name: stashname, + useDefaultExcludes: false) + + def artifactlist = meta.generateartifacts(['**/*']) + cleaner.clean(['meta', 'autobuild']) + + unstash(name: stashname) + + artifactarchiver.archive(meta, artifactlist) + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/copy/esw.groovy b/copy/esw.groovy new file mode 100644 index 0000000..b9eb737 --- /dev/null +++ b/copy/esw.groovy @@ -0,0 +1,67 @@ +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 { + def eswimportoptions = importer.getNewImportOptions() + eswimportoptions.source(ESW_ARTIFACT_LOCATION, ESW_ARTIFACT_BUILD_JOB, ESW_ARTIFACT_BUILD_SELECTOR, ESW_ARTIFACT_RELEASE_REPO, ESW_ARTIFACT_RELEASE_REVISION) + eswimportoptions.setincrementversionnumber(true) + importer.artifactimport(meta, eswimportoptions, ESWDEST) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(["${ESWEXPORT}/**"]) + sh """ + rm -v -rf diff + rm -v -rf meta + mv -v "${ESW}"/* . + """ + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive(meta, 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/copy/filtered.groovy b/copy/filtered.groovy new file mode 100644 index 0000000..3ad24cd --- /dev/null +++ b/copy/filtered.groovy @@ -0,0 +1,73 @@ +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 { + def importoptions = importer.getNewImportOptions() + importoptions.source(ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION) + importer.artifactimport(meta, importoptions, 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/**"]) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive(meta, artifactlist) + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/copy/logic.groovy b/copy/logic.groovy new file mode 100644 index 0000000..db9dbc3 --- /dev/null +++ b/copy/logic.groovy @@ -0,0 +1,79 @@ +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 { + LOGICDEST = 'logic' + cleanfolders = [ + LOGICDEST, + "${WORKSPACE}/embedded_logic", + "${WORKSPACE}/el", + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Import source artifacts') { + steps { + script { + 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) + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts(['**/*']) + def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + + cleaner.clean(['meta', 'autobuild']) + + dir(LOGICDEST) { + fileOperations([ + fileCopyOperation(excludes: '', + flattenFiles: false, + includes: '**/*', + targetLocation: WORKSPACE) + ]) + } + + cleaner.clean([LOGICDEST]) + + artifactarchiver.archive(meta, artifactlist) + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/differences/.project b/differences/.project new file mode 100644 index 0000000..75af0fc --- /dev/null +++ b/differences/.project @@ -0,0 +1,17 @@ + + + Release_difference + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/differences/.pydevproject b/differences/.pydevproject new file mode 100644 index 0000000..c3434da --- /dev/null +++ b/differences/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Default + diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy new file mode 100644 index 0000000..3b25798 --- /dev/null +++ b/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 accumulatedpath = relatedmetainfo.accumulatedpath + info += "Name: ${key}\t\t\t\tPath: ${accumulatedpath}\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].metainfo + def latermeta = latermetaitems[key].metainfo + + 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, '', earlymetafolder) + def latermetaitems = latermeta.releasewalkerunique(md, '', latermetafolder) + + 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/differences/file.groovy b/differences/file.groovy new file mode 100644 index 0000000..ee1b8b3 --- /dev/null +++ b/differences/file.groovy @@ -0,0 +1,24 @@ +def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { + echo "Comparing file: ${importedfile} with: ${currentfile} option: ${ignorewhitespace}" + def wsparameter = "-w" + if (!ignorewhitespace) { + wsparameter = "" + } + if (isUnix()) { + sh """ + diff -c ${wsparameter} "${importedfile}" "${currentfile}" + """ + } + else { + // diffutils can be installed on windows with chocolatey + powershell """ + # echo Checking utilities exist + # where diff + # if errorlevel 1 EXIT /b 1 + + diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}" + """ + } +} + +return this; diff --git a/differences/json.groovy b/differences/json.groovy new file mode 100644 index 0000000..dbf47b8 --- /dev/null +++ b/differences/json.groovy @@ -0,0 +1,51 @@ +def comparefiles(importedjsonfile, currentjsonfile) { + echo "Comparing json file: ${importedjsonfile} with: ${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 { + // Jq and diffutils can be installed on windows with chocolatey + powershell """ + # echo Checking utilities exist + # set + # echo %PATH% + try { + if (Get-Command jq) {} + } + catch { + echo "jq is unavailable" + exit \$false + } + try { + if (Get-Command diff) {} + } + catch { + echo "diff is unavailable" + exit \$false + } + + # echo Sorting json in files to compare + # jq -S sorts json output + jq -S . "${importedjsonfile}" > temp1.txt + if (\$lastexitcode -ge 1) { exit 1 } + jq -S . "${currentjsonfile}" > temp2.txt + if (\$lastexitcode -ge 1) { exit 1 } + + # echo Diffing sorted json files + diff.exe -c temp1.txt temp2.txt + \$lec = \$lastexitcode + + Remove-Item temp1.txt + Remove-Item temp2.txt + + if (\$lec -ge 1) { exit 1 } + """ + } +} + +return this; diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy new file mode 100644 index 0000000..01c1890 --- /dev/null +++ b/differences/metahierarchy.groovy @@ -0,0 +1,102 @@ +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() + + def earlyimportoptions = importer.getNewImportOptions() + earlyimportoptions.source(EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION) + earlyimportoptions.setincrementversionnumber(false) + earlyimportoptions.setfilter('meta/**') + importer.artifactimport(meta, earlyimportoptions, EARLYROOTDIR) + + def laterimportoptions = importer.getNewImportOptions() + laterimportoptions.source(LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION) + laterimportoptions.setincrementversionnumber(false) + laterimportoptions.setfilter('meta/**') + importer.artifactimport(meta, laterimportoptions, LATERROOTDIR) + } + } + } + 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() + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive("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/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy new file mode 100644 index 0000000..5054c02 --- /dev/null +++ b/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/hardware/sominfo.groovy b/hardware/sominfo.groovy new file mode 100644 index 0000000..72a3ca9 --- /dev/null +++ b/hardware/sominfo.groovy @@ -0,0 +1,80 @@ +def sominfostore = null + +/* Example expected JSON +{ + "SomType": { + "Som_BA4": { + "Artifact info": { + "Location": "Jenkins job artifact", + "Job": "HMB_FD_HV_0.9.6/0.9.6_SG1024_EL_syn_ba4", + "Job selector": "true", + "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_logic_ba4.git", + "Release repo revision": "" + } + }, + "Som_FC5": { + "Artifact info": { + "Location": "Jenkins job artifact", + "Job": "HMB_FD_HV_0.9.6/0.9.6_SG1024_EL_syn_fc5", + "Job selector": "true", + "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_logic_fc5.git", + "Release repo revision": "" + } + } + } +} +*/ + +def String asJsonText() { + return writeJSON(returnText: true, json: sominfostore, pretty: 1) +} + +def boolean exists() { + return (sominfostore != null) +} + +def set(String jsontext) { + sominfostore = readJSON(text: jsontext) + echo "Som support info:\n${asJsonText()}" +} + +def get() { + return sominfostore +} + +def somtypes() { + return sominfostore['SomType'] +} + +def artifactinfo(somtype) { + return somtype['Artifact info'] +} + +def artifactlocation(artifactinfo) { + return artifactinfo['Location'] +} + +def boolean isjoblocation(artifactinfo) { + return (artifactinfo['Location'] == 'Jenkins job artifact' || + artifactinfo['Location'] == 'Jenkins job artefact') +} + +def boolean isreleaserepolocation(artifactinfo) { + return artifactinfo['Location'] == 'Release repository' +} + +def artifactjob(artifactinfo) { + return [ + "name": artifactinfo['Job'], + "selector": "${artifactinfo['Job selector']}" + ] +} + +def releaserepo(artifactinfo) { + return [ + "repo": artifactinfo['Release repo'], + "revision": artifactinfo['Release repo revision'] + ] +} + +return this \ No newline at end of file diff --git a/import/importer.groovy b/import/importer.groovy new file mode 100644 index 0000000..fa32ebf --- /dev/null +++ b/import/importer.groovy @@ -0,0 +1,408 @@ +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 + + boolean m_showdetails + + 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, + showdetails = false) { + 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 + m_showdetails = showdetails + } + + String show() { + return """m_incrementversionnumber: ${m_incrementversionnumber} + m_filter: ${m_filter} + m_excludes: ${m_excludes} + m_fingerprint: ${m_fingerprint} + m_nested: ${m_nested} + m_flatten: ${m_flatten} + m_includemetainfilter: ${m_includemetainfilter} + m_clean: ${m_clean} + m_appendtoparentmeta: ${m_appendtoparentmeta} + m_sourceselect: ${m_sourceselect} + m_jobname: ${m_jobname} + m_buildnumberorselector: ${m_buildnumberorselector} + m_repo: ${m_repo} + m_revision: ${m_revision} + """ + } + + void setsourceselect(String sourceselect) { + 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: + m_script.error("Unknown type of artifact source select: ${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 = [ + $class: 'ParameterizedBuildSelector', + parameterName: buildnumberorselector + ] + setsourceselect('Jenkins job artifact') + } + + void jenkinsjob(String jobname, int buildnumberorselector) { + m_jobname = jobname.trim() + m_buildnumberorselector = [ + $class: 'ParameterizedBuildSelector', + parameterName: "${buildnumberorselector}" + ] + 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) + } + + void showdetails(boolean showdetails) { + m_showdetails = showdetails + } +} + +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 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) + + echo "Build selector type: ${importoptions.m_buildnumberorselector.getClass()}" + echo "Importing artifacts from job: ${importoptions.m_jobname} selector: ${importoptions.m_buildnumberorselector.toString()}" + copyArtifacts( + filter: formFilter(importoptions), + excludes: importoptions.m_excludes, + fingerprintArtifacts: importoptions.m_fingerprint, + projectName: importoptions.m_jobname, + selector: 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 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)) + + echo "Getting associated metadata from path: ${destpath}" + def collectedmetalist = importedmeta.getassociated(destpath) + for(def collectedmeta in collectedmetalist) { + echo "Collection meta item: ${collectedmeta.metainfo.componentversionuniqueidentifier()} offset path: ${collectedmeta.accumulatedpath}" + } + + echo "Cloning associated repos inside path: ${destpath}" + for(def collectedmeta in collectedmetalist) { + def relatedmeta = collectedmeta.metainfo + def relatedoffsetpath = collectedmeta.accumulatedpath + def cloneurl = relatedmeta.releaseinfo.releaserepoURL + def clonerevision = "refs/tags/${relatedmeta.releasetag()}" + def clonepath = "${destpath}/${relatedoffsetpath}" + if (relatedmeta.componentidentifier() != '_' && + cloneurl != '') { + 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) + } else { + echo "Not importing component that would be placed at path: ${clonepath}" + } + } + 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 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 importoptions, String destpath) { + if (importoptions.m_showdetails) { + echo "Importing artifacts:\nImport options:\n${importoptions.show()}\nto: ${destpath}" + } + switch (importoptions.m_sourceselect) { + case 'Jenkins job artifact': + case 'Jenkins job artefact': + 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 = importer.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 = importer.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 = importer.getNewImportOptions() + + importoptions.jenkinsjob(buildjob, buildnumberorselector) + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(filter) + importoptions.setexcludes(excludes) + importoptions.setfingerprint(fingerprint) + + return artifactimport(meta, importoptions, destpath) +} + +// Import the artifacts of a named child component found below parent meta's hierarchy +def artifactimport(meta, + parentmeta, + String parentmetapath, + String childproduct, + String childsubcomponent, + ImportOptions importoptions, + String destinationfolder) { + // Import from parent meta + def childmeta = meta.getNewMetaObject() + def childmeta2 + echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" + echo "From parent meta identifier: ${parentmeta.componentidentifier()} and parent meta path: ${parentmetapath}" + def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent) + if (findresults.matchfound) { + childmeta = findresults.matchedmetaitem.metainfo + if (importoptions.m_sourceselect == 'Release repository' || childmeta.releaseinfo.released) { + importoptions.releaserepo(childmeta.releaseinfo.releaserepoURL, childmeta.releasetag()) + } else { + importoptions.jenkinsjob(childmeta.jenkinsbuildinfo.buildjobname, childmeta.jenkinsbuildinfo.buildnumber) + } + childmeta2 = importer.artifactimport(meta, importoptions, destinationfolder) + } else { + error("Could not find meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}") + } + return childmeta2 +} + +return this; diff --git a/install/installhelper.groovy b/install/installhelper.groovy new file mode 100644 index 0000000..8dbf23e --- /dev/null +++ b/install/installhelper.groovy @@ -0,0 +1,136 @@ +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, toBuild, artifactDetails, installerDetails, boolean showdetails = false) { + artifactFetched = [:] + + if (showdetails) { + echo ("toBuild:\n${toBuild}\nartifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}") + } + def importoptions = importer.getNewImportOptions() + importoptions.showdetails(showdetails) + for (installer in toBuild) { + def installerinfo = installerDetails.get(installer) + if (showdetails) { + echo ("installer:\n${installer}\ninstallerinfo:\n${installerinfo}") + } + def artifactKeys = installerinfo[1] + if (artifactKeys instanceof java.lang.String) { + artifactKeys = [ artifactKeys ] + } + if (showdetails) { + echo ("artifactKeys:\n${artifactKeys}") + } + for (artifactKey in artifactKeys) { + artifactDetail = artifactDetails.get(artifactKey) + if (showdetails) { + echo ("artifactKey: ${artifactKey}\nartifactDetail:\n${artifactDetail}") + } + (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetail + if (artifactFetched.get(artifactKey) == null) { + importoptions.jenkinsjob(sourceProject, sourceselector) + importoptions.setincrementversionnumber(incrementversionnumber) + importoptions.setfilter(toCopy) + importoptions.setexcludes(notToCopy) + + def importmeta = importer.artifactimport(meta, importoptions, destFolder) + artifactFetched.put(artifactKey, importmeta) + } + } + } + if (showdetails) { + echo ("artifactFetched:\n${artifactFetched}") + } + 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) + //echo "ISM file xml: ${xml}" + (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/meta/folder.groovy b/meta/folder.groovy new file mode 100644 index 0000000..6715145 --- /dev/null +++ b/meta/folder.groovy @@ -0,0 +1,1193 @@ +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 { + private String format + private String productname + private String subcomponentname + private String variant + private String uniqueid + + ProductInfo(script, String productname = '', String subcomponentname = '', String variant = '') { + super(script) + this.format = '0.1' + this.productname = productname + this.subcomponentname = subcomponentname + this.variant = variant + this.uniqueid = UUID.randomUUID().toString() + } + + 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()) { + pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) + } + else { + pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" 2>&1>\$null", , 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.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" 2>&1>\$null", , 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") + } + if (variant) { + def int vstatus = 0 + if (script.isUnix()) { + vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) + } + else { + vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" 2>&1>\$null", , returnStatus: true) + } + if (vstatus > 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 set(ProductInfo otherinfo) { + this.productname = otherinfo.productname + this.subcomponentname = otherinfo.subcomponentname + this.variant = otherinfo.variant + this.uniqueid = otherinfo.uniqueid + } + + void deserialiseJson(rawmeta) { + //format = rawmeta['format'] + productname = rawmeta['productname'] + subcomponentname = rawmeta['subcomponentname'] + variant = rawmeta['variant'] ?: '' + uniqueid = rawmeta['uniqueid'] ?: uniqueid + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'productname' : productname, + 'subcomponentname' : subcomponentname, + 'variant' : variant, + 'uniqueid': uniqueid, + ] + return data + } +} + +class GitInfo extends GISJsonSerialised { + private String format + 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.format = '0.1' + this.sourcepath = sourcepath + this.sourcerevision = sourcerevision + this.gitrevision = gitrevision + this.remoteurl = remoteurl + this.remoteinfo = remoteinfo + } + + GitInfo(GitInfo another) { + super(another.script) + this.sourcepath = another.sourcepath + this.sourcerevision = another.sourcerevision + this.gitrevision = another.gitrevision + this.remoteurl = another.remoteurl + this.remoteinfo = another.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 set(GitInfo otherinfo) { + this.sourcepath = otherinfo.sourcepath + this.sourcerevision = otherinfo.sourcerevision + this.gitrevision = otherinfo.gitrevision + this.remoteurl = otherinfo.remoteurl + this.remoteinfo = otherinfo.remoteinfo + } + + void deserialiseJson(rawmeta) { + //format = rawmeta['format'] + sourcepath = rawmeta['sourcepath'] + sourcerevision = rawmeta['sourcerevision'] + gitrevision = rawmeta['gitrevision'] + remoteurl = rawmeta['remoteurl'] + remoteinfo = rawmeta['remoteinfo'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'sourcepath' : sourcepath, + 'sourcerevision' : sourcerevision, + 'gitrevision' : gitrevision, + 'remoteurl' : remoteurl, + 'remoteinfo' : remoteinfo, + ] + return data + } +} + +class JenkinsBuildParameter extends GISJsonSerialised { + private String name + private String valuetype + private String value + + JenkinsBuildParameter(script, String name = '', String valuetype = '', String value = '') { + super(script) + this.name = name + this.valuetype = valuetype + this.value = value + } + + void set(String name, String valuetype, String value) { + this.name = name + this.valuetype = valuetype + this.value = value + } + + void deserialiseJson(rawmeta) { + name = rawmeta['name'] + valuetype = rawmeta['valuetype'] + value = rawmeta['value'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'name' : name, + 'valuetype' : valuetype, + 'value' : value, + ] + return data + } +} + +class JenkinsBuildInfo extends GISJsonSerialised { + private String format + private String buildjobname + private int buildnumber + private String buildmachine + private String builddate + private ArrayList parameters + private boolean isfullbuild + + JenkinsBuildInfo(script, String buildjobname = '', int buildnumber = 0, String buildmachine = '', String builddate = '', boolean isfullbuild = true) { + super(script) + this.format = '0.1' + this.buildjobname = buildjobname + this.buildnumber = buildnumber + this.buildmachine = buildmachine + this.builddate = builddate + this.isfullbuild = isfullbuild + parameters = new ArrayList() + } + + void set(String buildjobname, int buildnumber, String buildmachine, String builddate, boolean isfullbuild = true) { + this.buildjobname = buildjobname + this.buildnumber = buildnumber + this.buildmachine = buildmachine + this.builddate = builddate + this.isfullbuild = isfullbuild + } + + void set(boolean isfullbuild) { + this.isfullbuild = isfullbuild + } + + boolean isFullBuild() { + return isfullbuild + } + + void addParameter(String name, value) { + def p = new JenkinsBuildParameter(script, name, value.getClass().toString(), value.toString()) + parameters.add(p) + return p + } + + void deserialiseJson(rawmeta) { + //format = rawmeta['format'] + buildjobname = rawmeta['buildjobname'] + buildnumber = rawmeta['buildnumber'] + buildmachine = rawmeta['buildmachine'] + builddate = rawmeta['builddate'] + isfullbuild = (rawmeta['isfullbuild'] == null) ? true : rawmeta['isfullbuild'] + parameters = new ArrayList() + if (rawmeta['isfullbuild'] != null) { + for (rawparameter in rawmeta['parameters']) { + def p = new JenkinsBuildParameter(script) + p.deserialiseJson(rawparameter) + parameters.add(p) + } + } + } + + List parametersserialised() { + def associated = [] + for (p in parameters) { + associated.add(p.serialisationdata()) + } + return associated + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'buildjobname' : buildjobname, + 'buildnumber' : buildnumber, + 'buildmachine' : buildmachine, + 'builddate' : builddate, + 'isfullbuild' : isfullbuild, + 'parameters' : parametersserialised(), + ] + return data + } +} + +class BuildStampInfo extends GISJsonSerialised { + private String format + private String buildstampprefix + private int revision + private String buildstamp + + BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { + super(script) + this.format = '0.1' + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + } + + BuildStampInfo(BuildStampInfo another) { + super(another.script) + this.buildstampprefix = another.buildstampprefix + this.revision = another.revision + this.buildstamp = another.buildstamp + } + + void set(String buildstampprefix, int revision, String buildstamp) { + this.buildstampprefix = buildstampprefix + this.revision = revision + this.buildstamp = buildstamp + } + + void set(BuildStampInfo other) { + set(other.buildstampprefix, other.revision, other.buildstamp) + } + + // Override the buildstamp + void override(String buildstamp) { + this.buildstamp = buildstamp + script.echo("Build stamp overridden to: ${this.buildstamp}") + def s = this.buildstamp.split('\\.') + if (s.size() != 4) { + script.error("Overriding build stamp: ${buildstamp} is not of the format: 1.2.3.4") + } + this.buildstampprefix = "${s[0]}.${s[1]}.${s[2]}" + script.echo("Stamp prefix overridden to: ${this.buildstampprefix}") + this.revision = s[3].toInteger() + script.echo("Revision overridden to: ${this.revision}") + } + + 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) { + //format = rawmeta['format'] + buildstampprefix = rawmeta['buildstampprefix'] + revision = rawmeta['revision'] + buildstamp = rawmeta['buildstamp'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'buildstampprefix' : buildstampprefix, + 'revision' : revision, + 'buildstamp' : buildstamp, + ] + return data + } +} + +class ReleaseInfo extends GISJsonSerialised { + private String format + private String releaserepoURL + private ArrayList releaseitems + private boolean released + + ReleaseInfo(script, String releaserepoURL = '', boolean released = false) { + super(script) + this.format = '0.1' + 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) { + //format = rawmeta['format'] + releaserepoURL = rawmeta['releaserepoURL'] + releaseitems = new ArrayList() + for (rawreleaseitem in rawmeta['releaseitems']) { + releaseitems.add(rawreleaseitem) + } + released = rawmeta['released'] ?: false + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + '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 format + private String artifactpath + private ArrayList checksumpairs + + ChecksumSet(script, artifactpath = '') { + super(script) + this.format = '0.1' + 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) { + //format = rawmeta['format'] + 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 = [ + 'format' : format, + '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 format + private String filepath + + PublishableInfo(script, String filepath = '') { + super(script) + this.format = '0.1' + this.filepath = filepath + } + + void deserialiseJson(rawmeta) { + //format = rawmeta['format'] + filepath = rawmeta['filepath'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'filepath' : filepath, + ] + return data + } +} + +class MetaInfo extends GISJsonSerialised { + private static String METAFOLDERNAME = 'meta' + private static String METAFILENAME = 'info.json' + private static String METAARTIFACTS = "${METAFOLDERNAME}/**" + private static String format = '0.2' + + abstract class RelatedMetaInfo extends GISJsonSerialised { + String format + + RelatedMetaInfo(script, format) { + super(script) + this.format = format + } + + abstract void deserialiseJson(rawmeta) + abstract LinkedHashMap serialisationdata() + abstract String getrelatedid() + abstract void markreleased() + } + + class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { + private MetaInfo meta + private String offsetpath + private String uniqueid + + RelatedMetaInfo_v0_1(script, String offsetpath = '', MetaInfo meta = null, String uniqueid = UUID.randomUUID().toString()) { + super(script, '0.1') + this.offsetpath = offsetpath + this.uniqueid = uniqueid + this.meta = meta + } + + void deserialiseJson(rawmeta) { + offsetpath = rawmeta['offsetpath'] + uniqueid = rawmeta['uniqueid'] ?: uniqueid + meta = new MetaInfo(script) + meta.deserialiseJson(rawmeta['meta']) + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'offsetpath' : offsetpath, + 'uniqueid' : uniqueid, + 'meta' : meta.serialisationdata(), + ] + return data + } + + String getrelatedid() { + return uniqueid + } + + void markreleased() { + meta.releaseinfo.markreleased() + } + } + + class RelatedMetaInfo_v0_2 extends RelatedMetaInfo { + private String importpath + private String offsetpath + private String uniqueid + + RelatedMetaInfo_v0_2(script, String importpath = '', String offsetpath = '', String uniqueid = UUID.randomUUID().toString()) { + super(script, '0.2') + this.importpath = importpath + this.offsetpath = offsetpath + this.uniqueid = uniqueid + } + + void deserialiseJson(rawmeta) { + //format = rawmeta['format'] + offsetpath = rawmeta['offsetpath'] + uniqueid = rawmeta['uniqueid'] + } + + LinkedHashMap serialisationdata() { + def data = [ + 'format' : format, + 'offsetpath' : offsetpath, + 'uniqueid' : uniqueid + ] + return data + } + + String getrelatedid() { + return uniqueid + } + + void markreleased() { + // Do nothing + } + } + + private ProductInfo productinfo + private GitInfo gitinfo + private JenkinsBuildInfo jenkinsbuildinfo + private BuildStampInfo buildstampinfo + private ReleaseInfo releaseinfo + private 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() + } + + void markreleased() { + script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") + releaseinfo.markreleased() + for (associated in associatedmeta) { + associated.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) + return ci + } + + void addCustomInfo(String customId, String customValue) { + custominfo.put(customId.trim(), customValue) + } + + String getCustomInfo(String customId) { + return custominfo.getAt(customId.trim()) + } + + def isFullBuild() { + return jenkinsbuildinfo.isFullBuild() + } + + 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'].toString() != '0.1' && rawmeta['format'].toString() != '0.2' ) { + script.error("Unsupported meta format found") + 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']) { + if (!rawrelatedmeta['format'] || rawrelatedmeta['format'] == '0.1') { + def rm = new RelatedMetaInfo_v0_1(script) + rm.deserialiseJson(rawrelatedmeta) + associatedmeta.add(rm) + } else if (rawrelatedmeta['format'] == '0.2') { + def rm = new RelatedMetaInfo_v0_2(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)) { + script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})") + mi.deserialiseJson(importedmetafile) + + RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath, mi.productinfo.uniqueid) + if (appendtoparentmeta) { + associatedmeta.add(rmi) + } + } else { + script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist") + addConfigurationInfo('', givenRepo, givenRevision, givenSHA) + } + return mi + } + + def copyrelatedmeta() { + script.echo("Copying related input meta data to output meta") + for (relatedmetainfo in associatedmeta) { + def srcpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" + def destpath = "${METAFOLDERNAME}/${relatedmetainfo.offsetpath}" + script.echo("Copying related meta folder: ${srcpath} to meta output folder: ${destpath} recursively") + script.fileOperations([ + script.folderCreateOperation(folderPath: destpath), + script.folderCopyOperation(sourceFolderPath: srcpath, destinationFolderPath: destpath) + ]) + } + } + + 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 + } + + def 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 + } + + 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 + } + + class CollectedMeta { + private MetaInfo metainfo + private String accumulatedpath + private String accumulatedmetapath + + CollectedMeta(MetaInfo metainfo, String accumulatedpath = '', String accumulatedmetapath = '') { + this.metainfo = metainfo + this.accumulatedpath = accumulatedpath + this.accumulatedmetapath = accumulatedmetapath + } + } + + class IterationInfo { + private ArrayList metacollection + private Map metamap + private String comment + private int level + private String gatheredpath + private String gatheredmetapath + private boolean limiteddepth + private int maxdepth + + IterationInfo(ArrayList metacollection, + Map metamap, + String comment = '', + int level = 0, + String gatheredpath = '', + String gatheredmetapath = '', + boolean limiteddepth = false, + int maxdepth = 0) { + this.metacollection = metacollection + this.metamap = metamap + this.comment = comment + this.level = level + this.gatheredpath = gatheredpath + this.gatheredmetapath = gatheredmetapath + this.limiteddepth = limiteddepth + this.maxdepth = maxdepth + } + + String show() { + return "Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}" + } + + void add(CollectedMeta item) { + metacollection.add(item) + metamap.put(item.metainfo.productinfo.uniqueid, item) + } + } + + def openchildmeta(IterationInfo ii, RelatedMetaInfo relatedmetainfo) { + def MetaInfo mi = new MetaInfo(script) + + def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") + def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}" + def boolean imported + // If this has already been read in from a file + if (relatedmetainfo.getrelatedid() in ii.metamap) { + //script.echo("Already read in meta associated with uniqueid: ${relatedmetainfo.getrelatedid()} - Using it") + mi = ii.metamap[relatedmetainfo.getrelatedid()].metainfo + imported = true + } else if (script.fileExists(importedmetafile)) { + mi.deserialiseJson(importedmetafile) + imported = true + } else { + script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist") + imported = false + } + + def childmetainfo = [ + 'imported': imported, + 'nextgatheredpath': nextgatheredpath, + 'nextgatheredmetapath': nextgatheredmetapath, + 'childmeta': mi + ] + return childmetainfo + } + + def walkrelated_v0_1(IterationInfo ii) { + //script.echo("Walk related v0.1: ${ii.show()}") + if (!ii.limiteddepth || ii.maxdepth > 0) { + ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) + ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' + for (relatedmetainfo in associatedmeta) { + if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { + def MetaInfo othermeta = relatedmetainfo.meta + def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") + def nextii = new IterationInfo(ii.metacollection, + ii.metamap, + ii.comment, + ii.level + 1, + nextgatheredpath, + nextgatheredmetapath, + ii.limiteddepth, + ii.maxdepth - 1) + def results = othermeta.walkrelated_v0_1(nextii) + ii.metacollection = results.metacollection + ii.metamap = results.metamap + ii.comment = results.comment + } else { + script.error("There is non v0.1 format related meta info under v0.1 related meta info") + } + } + } + return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ] + } + + def walkrelated(IterationInfo ii) { + //script.echo("Walk related: ${ii.show()}") + if (!ii.limiteddepth || ii.maxdepth > 0) { + ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) + ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' + for (relatedmetainfo in associatedmeta) { + //script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}") + if (relatedmetainfo.format == '0.2') { + def childmetainfo = openchildmeta(ii, relatedmetainfo) + if (childmetainfo.imported) { + def nextii = new IterationInfo(ii.metacollection, + ii.metamap, + ii.comment, + ii.level + 1, + childmetainfo.nextgatheredpath, + childmetainfo.nextgatheredmetapath, + ii.limiteddepth, + ii.maxdepth - 1) + def results = childmetainfo.childmeta.walkrelated(nextii) + ii.metacollection = results.metacollection + ii.metamap = results.metamap + ii.comment = results.comment + } + } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { + def MetaInfo othermeta = relatedmetainfo.meta + def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") + def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") + def nextii = new IterationInfo(ii.metacollection, + ii.metamap, + ii.comment, + ii.level + 1, + nextgatheredpath, + nextgatheredmetapath, + ii.limiteddepth, + ii.maxdepth - 1) + def results = othermeta.walkrelated_v0_1(nextii) + ii.metacollection = results.metacollection + ii.metamap = results.metamap + ii.comment = results.comment + } + } + } + return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ] + } + + // Walks all layers of associated data only + def allrelatedmeta(String metapath = '') { + def ArrayList metacollection = new ArrayList() + def Map metamap = new LinkedHashMap() + return walkrelated(new IterationInfo(metacollection, metamap, '', 0, '', metapath)) + } + + ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { + def ArrayList metacollection = new ArrayList() + def Map metamap = new LinkedHashMap() + def IterationInfo ii = new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth) + script.echo("Release walker iteration info at start:\n${ii.show()}") + def results = walkrelated(ii) + return results.metacollection + } + + // Walks 1 layer of associated data only + def getassociated(String rootpath) { + return releasewalker(2, '', "${rootpath}/${METAFOLDERNAME}") // Max depth 2 (including itself) + } + + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) { + if (releasemetacollection.containsKey(uniquestring)) { + def existingentry = releasemetacollection[uniquestring] + def existingentrypathlength = existingentry.accumulatedpath.split('/').size() + def newentrypathlength = metaitem.accumulatedpath.split('/').size() + if (existingentrypathlength > newentrypathlength) { + releasemetacollection.put(uniquestring, metaitem) + } + } else { + releasemetacollection.put(uniquestring, metaitem) + } + return releasemetacollection + } + + Map releasewalkerversionunique(int maxdepth, String startpath = '', String startmetapath = '') { + def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}") + + def Map versionuniquecollection = new LinkedHashMap() + for (metaitem in metacollection) { + def String uniquestring = metaitem.metainfo.componentversionuniqueidentifier() + versionuniquecollection = putwithshortestoffsetpath(versionuniquecollection, uniquestring, metaitem) + } + + return versionuniquecollection + } + + Map releasewalkerunique(int maxdepth, String startpath = '', String startmetapath = '') { + def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}") + + def Map uniquecollection = new LinkedHashMap() + for (metaitem in metacollection) { + def String uniquestring = metaitem.metainfo.componentidentifier() + uniquecollection = putwithshortestoffsetpath(uniquecollection, uniquestring, metaitem) + } + + return uniquecollection + } + + MetaInfo getNewMetaObject(script) { + return new MetaInfo(script) + } + + def findAssociatedMeta(String parentmetapath, String productname, String subcomponentname) { + def results = [ + 'matchedmetaitem' : new CollectedMeta(this), + 'matchfound' : false + ] + def walkresults = allrelatedmeta("${parentmetapath}/${METAFOLDERNAME}") + for (dependentmetaitem in walkresults.metacollection) { + script.echo("Comparing: ${dependentmetaitem.metainfo.productinfo.productname} ${dependentmetaitem.metainfo.productinfo.subcomponentname}") + if (dependentmetaitem.metainfo.productinfo.productname == productname && + dependentmetaitem.metainfo.productinfo.subcomponentname == subcomponentname) { + script.echo("Found matching component: ${dependentmetaitem.metainfo.globalreleasetag()}") + results.matchedmetaitem = dependentmetaitem + results.matchfound = true + break + } + } + return results + } +} + +MetaInfo metareset(script) { + def mi = new MetaInfo(script) + + echo "Resetting meta folder" + 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/packaging/debian.groovy b/packaging/debian.groovy new file mode 100644 index 0000000..9f2f4d3 --- /dev/null +++ b/packaging/debian.groovy @@ -0,0 +1,111 @@ +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_KERNEL + String GIS_OPT_LOGIC + String GIS_OPT_PRINTHEAD + String GIS_OPT_BOOT + + 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, String inpackagepathsuffix) { + 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" + inpackagepathsuffix + GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + inpackagepathsuffix + GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + inpackagepathsuffix + GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + inpackagepathsuffix + GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + inpackagepathsuffix + GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" + inpackagepathsuffix + GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + inpackagepathsuffix + GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + inpackagepathsuffix + GIS_OPT_KERNEL = "${DEBPATH}/opt/gis/kernel" + inpackagepathsuffix + GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + inpackagepathsuffix + GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + inpackagepathsuffix + GIS_OPT_BOOT = "${DEBPATH}/opt/gis/boot" + inpackagepathsuffix + + USR_BIN = "${DEBPATH}/usr/bin" + inpackagepathsuffix + USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + inpackagepathsuffix + LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + inpackagepathsuffix + HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + inpackagepathsuffix + LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + inpackagepathsuffix + } +} + +def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') { + return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) +} + +def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String credentials_id) { + withCredentials([usernamePassword(credentialsId: credentials_id, + usernameVariable: 'SUDO_USERNAME', + passwordVariable: 'SUDO_PASSWORD')]) { + def sudo_S = "echo ${SUDO_PASSWORD} | sudo -S" + def sudo_Sk = "echo ${SUDO_PASSWORD} | sudo -S -k" + try { + sh """#!/bin/bash + # Exit if any command fails + set -xe + + cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + + ${sudo_Sk} 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_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}" + """ + } + catch (Exception e) { + echo "Exception occurred" + sh """#!/bin/bash -v + ${sudo_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}" + + exit 1 + """ + } + } +} + +return this; \ No newline at end of file diff --git a/platform/lineendings.groovy b/platform/lineendings.groovy new file mode 100644 index 0000000..9657b0d --- /dev/null +++ b/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/publish/.classpath b/publish/.classpath new file mode 100644 index 0000000..287c1ab --- /dev/null +++ b/publish/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/publish/.gitignore b/publish/.gitignore new file mode 100644 index 0000000..abed335 --- /dev/null +++ b/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/publish/.project b/publish/.project new file mode 100644 index 0000000..5c60328 --- /dev/null +++ b/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/publish/.settings/org.eclipse.jdt.groovy.core.prefs b/publish/.settings/org.eclipse.jdt.groovy.core.prefs new file mode 100644 index 0000000..1e68ed6 --- /dev/null +++ b/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/publish/do.groovy b/publish/do.groovy new file mode 100644 index 0000000..ea090f0 --- /dev/null +++ b/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.metainfo + 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.metainfo + 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 releasemetapath, 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, '', releasemetapath) + + 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 releasemetapath, String customer, String softwarerelease, String maxdepth) { + return publishhierarchy(hostedftpsiteinfo, releasemeta, releasemetapath, '', customer, softwarerelease, maxdepth) +} + +return this; diff --git a/publish/package.groovy b/publish/package.groovy new file mode 100644 index 0000000..68c41f3 --- /dev/null +++ b/publish/package.groovy @@ -0,0 +1,181 @@ +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") + + def packageimportoptions = importer.getNewImportOptions() + packageimportoptions.jenkinsjob(PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR) + packageimportoptions.setincrementversionnumber(true) + packagemeta = importer.artifactimport(meta, packageimportoptions, 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/publish/promptingpublish.groovy b/publish/promptingpublish.groovy new file mode 100644 index 0000000..ce6a805 --- /dev/null +++ b/publish/promptingpublish.groovy @@ -0,0 +1,182 @@ +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("superseded") && + !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, + SOURCEDIR, + 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, SOURCEDIR, selecteditems, customer, release, MAX_META_DEPTH) + if (markunstable) { + env.unstablereason = unstablereason + currentBuild.result = 'UNSTABLE' + } + } + } + } + stage('Archiving artifacts') { + steps { + script { + def artifactlist = meta.generateartifacts() + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive("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/publish/publish.groovy b/publish/publish.groovy new file mode 100644 index 0000000..ad33df9 --- /dev/null +++ b/publish/publish.groovy @@ -0,0 +1,92 @@ +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() + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive("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/publish/publishitems.groovy b/publish/publishitems.groovy new file mode 100644 index 0000000..9f6c368 --- /dev/null +++ b/publish/publishitems.groovy @@ -0,0 +1,129 @@ +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 releasemetapath, + 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, '', releasemetapath) + 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.metainfo + + for (publishableitem in meta.publishableinfo) { + menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") + } + } + + def outputSelection(menuitems, releaseinfo) { + def meta = releaseinfo.metainfo + + 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 releasemetapath, + 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, releasemetapath, preselectedext, metalevelsstringext, visibleItemCountExt, type) + + return pis +} + +return this; diff --git a/publishing/utils.groovy b/publishing/utils.groovy new file mode 100644 index 0000000..2daf6f6 --- /dev/null +++ b/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/release/do.groovy b/release/do.groovy new file mode 100644 index 0000000..4dcb091 --- /dev/null +++ b/release/do.groovy @@ -0,0 +1,458 @@ +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") + +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.metainfo.releaseinfo.releaseitems) { + def filterpath = artifactfilter + if (buildinfo.accumulatedpath) { + filterpath = buildinfo.accumulatedpath + '/' + artifactfilter + } + // Copy relevant artifacts to temp folder + echo "Copying artifacts: Filter path: ${filterpath} to ${tempfolder} from job: ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname} #${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" + 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.accumulatedpath + dir(originalrootdir) { + sh("mv -v * ${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)) { + echo "Tag added: ${tag} with sha: ${postcommitshacode}" + 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.metainfo + 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}" + + 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(String buildfolder, String metafolder, 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, buildfolder, metafolder) + 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, buildfolder, metafolder) + def String versionuniquecomponent = '' + def String versionwithpathscomponent = '' + for (key in componentReleaseInfoVersionUnique.keySet()) { + versionuniquecomponent += "${key}\n" + versionwithpathscomponent += "${key}: path: ${componentReleaseInfoVersionUnique[key].accumulatedpath} meta path: ${componentReleaseInfoVersionUnique[key].accumulatedmetapath}\n" + } + echo 'Version unique components:' + echo versionuniquecomponent + + echo 'Version unique components with paths:' + echo versionwithpathscomponent + + 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? (If you ignore this issue, you will get an error much later because the system cannot tag 2 different commits of the associated source code with the same label)" + } + } + + for (key in componentReleaseInfo.keySet()) { + def buildinfo = componentReleaseInfo[key] + if (!buildinfo.metainfo.jenkinsbuildinfo.isFullBuild()) { + error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" + } + } + + def toplevelid = buildmeta.componentidentifier() + // For each component + for (key in componentReleaseInfo.keySet()) { + def buildinfo = componentReleaseInfo[key] + echo "Releasing component: ${buildinfo.metainfo.componentidentifier()}" + if (buildinfo.metainfo.componentidentifier() != '___' && buildinfo.metainfo.componentidentifier() != '_') { + 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/release/registerrepo.groovy b/release/registerrepo.groovy new file mode 100644 index 0000000..f565706 --- /dev/null +++ b/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/release/release.groovy b/release/release.groovy new file mode 100644 index 0000000..82af511 --- /dev/null +++ b/release/release.groovy @@ -0,0 +1,87 @@ +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 { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + BUILD_ARTIFACTS = 'build' + + def importoptions = importer.getNewImportOptions() + importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) + importoptions.setincrementversionnumber(false) + importoptions.setfilter('meta/**') + importoptions.setappendtoparentmeta(false) + buildmeta = importer.artifactimport(meta, importoptions, 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('', BUILD_ARTIFACTS, 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() + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive("summary/**,${artifactlist}") + } + } + } + stage('Summarise') { + steps { + script { + echo "Summary:\n${summarystring}\n" + if (env.unstablereason) { + echo "Instability reason: ${env.unstablereason}" + } + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/remoteaccess/ftp.groovy b/remoteaccess/ftp.groovy new file mode 100644 index 0000000..25b9143 --- /dev/null +++ b/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/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy new file mode 100644 index 0000000..cf62d32 --- /dev/null +++ b/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/staticanalysis/ccm.groovy b/staticanalysis/ccm.groovy new file mode 100644 index 0000000..ae91cb0 --- /dev/null +++ b/staticanalysis/ccm.groovy @@ -0,0 +1,85 @@ +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() + + 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 { + SOURCEDIR = "${WORKSPACE}/source" + configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCE_REVISION, SOURCEDIR, '', 0, false) + } + } + } + stage("Clean exports") { + steps { + script { + RESULTS = 'results' + cleanfolders = [ + RESULTS, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Static analysis') { + steps { + script { + def ccmconfigurationfile = "${WORKSPACE}/ccm.xml" + writeFile(file: ccmconfigurationfile, text: CCM_CONFIGURATION) + echo "Configuration file: ${ccmconfigurationfile} contains:\n${CCM_CONFIGURATION}" + + dir(RESULTS) { + echo "Executing: ${CCM} ${ccmconfigurationfile} > ccm.xml" + if (isUnix()) { + sh """#!/bin/bash + ${CCM}" "${ccmconfigurationfile}" > ccm.xml + """ + } else { + echo "Executing: ${WINDOWS_COMMANDLINE_ENVIRONMENT} \"${CCM}\" \"${ccmconfigurationfile}\" > ccm.xml" + bat """ + ${WINDOWS_COMMANDLINE_ENVIRONMENT} "${CCM}" "${ccmconfigurationfile}" > ccm.xml + """ + } + } + recordIssues(tools: [ + ccm(pattern: "**/ccm.xml", reportEncoding: 'UTF-8'), + ]) + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy new file mode 100644 index 0000000..c04649c --- /dev/null +++ b/staticanalysis/cpd.groovy @@ -0,0 +1,152 @@ +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) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive(meta, artifactlist) + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/staticanalysis/cppcheck.groovy b/staticanalysis/cppcheck.groovy new file mode 100644 index 0000000..d959770 --- /dev/null +++ b/staticanalysis/cppcheck.groovy @@ -0,0 +1,114 @@ +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) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive(meta, artifactlist) + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} diff --git a/test/testethernetproduct.groovy b/test/testethernetproduct.groovy new file mode 100644 index 0000000..5e2ce53 --- /dev/null +++ b/test/testethernetproduct.groovy @@ -0,0 +1,204 @@ +import jenkins.model.Jenkins + +pipeline { + agent { label AGENT_LABEL } + stages { + stage ("Initial Setup") { + steps{ + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage ("Checkout test environment") { + steps { + script { + toolsimporter = load("${autobuilder.commonscripts()}/configuration/tools.groovy") + + def TEST_ENVIRONMENT_URL = 'git@hydra:gistest/jenkins-ethernet-test-environment.git' + def TEST_ENVIRONMENT_DIR = 'TestEnvironmentDir' + def TEST_ENVIRONMENT_REVISION = 'origin/master' + + def environmentoptions = toolsimporter.getNewToolOptions() + environmentoptions.toolName('Ethernet product test environment') + environmentoptions.toolRepo(TEST_ENVIRONMENT_URL, TEST_SOURCE_REVISION) + toolsimporter.getTool(meta, environmentoptions, TEST_ENVIRONMENT_DIR) + + TEST_ENVIRONMENT_FILE = "${TEST_ENVIRONMENT_DIR}/environment.json" + def alltestenvironment = readJSON(file: "${TEST_ENVIRONMENT_FILE}") + TEST_ENVIRONMENT = alltestenvironment[ETHERNET_PRODUCT_TO_RUN_TEST] + echo "Selected environment:\n${TEST_ENVIRONMENT}" + } + } + } + stage ('Setup') { + agent { label TEST_ENVIRONMENT['FTDI_AGENT'] } + stages { + stage ("Checkout dependencies") { + steps { + script { + def PYTHON_URL = 'git@hydra:tools/python.git' + if (isUnix()) { + PYTHON_REVISION = 'origin/3.6.3_linux' + } + else { + PYTHON_REVISION = 'origin/3.8.10_windows_for_test' + } + PYTHONDIR = "${WORKSPACE}/python" + + def pythonimportoptions = toolsimporter.getNewToolOptions() + pythonimportoptions.toolName('Python') + pythonimportoptions.toolRepo(PYTHON_URL, PYTHON_REVISION) + toolsimporter.getTool(meta, pythonimportoptions, PYTHONDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + + def TEST_SOURCE_URL = 'git@hydra:hmb_regression/hmb_tests.git' + TEST_SUITE_DIR = 'TestSuiteDir' + env.GIS_TEST_SUITE_HOME = "${WORKSPACE}/${TEST_SUITE_DIR}" + + def regressiontestimportoptions = toolsimporter.getNewToolOptions() + regressiontestimportoptions.toolName('Tests') + regressiontestimportoptions.toolRepo(TEST_SOURCE_URL, TEST_SOURCE_REVISION) + toolsimporter.getTool(meta, regressiontestimportoptions, GIS_TEST_SUITE_HOME) + + env.HISTORY_FOLDER = "${WORKSPACE}/testhistory" + + def resultimportoptions = toolsimporter.getNewToolOptions() + resultimportoptions.toolName('Test history') + resultimportoptions.toolRepo(HISTORY_REPO, HISTORY_REVISION) + toolsimporter.getTool(meta, resultimportoptions, HISTORY_FOLDER) + + def CORE_SOURCE_URL = 'git@hydra:gistest/giscorelite.git' + env.GIS_TEST_SUITE_CORE = "${WORKSPACE}/GisCore" + + def coreimportoptions = toolsimporter.getNewToolOptions() + coreimportoptions.toolName('Test core') + coreimportoptions.toolRepo(CORE_SOURCE_URL, CORE_SOURCE_REVISION) + toolsimporter.getTool(meta, coreimportoptions, GIS_TEST_SUITE_CORE) + + def FTDI_SOURCE_URL = 'git@hydra:python_scripts/ftdi_relay.git' + def FTDI_SOURCE_REVISION = 'origin/Core-98' + FTDI_SOURCE_DIR = "${WORKSPACE}/PowerController" + + def ftdiimportoptions = toolsimporter.getNewToolOptions() + ftdiimportoptions.toolName('FTDI relay driver') + ftdiimportoptions.toolRepo(FTDI_SOURCE_URL, FTDI_SOURCE_REVISION) + toolsimporter.getTool(meta, ftdiimportoptions, FTDI_SOURCE_DIR) + + def HISTORY_PROCESSING_REPO = 'git@hydra:gistestresults/ethernet-products-history-processing.git' + HISTORY_PROCESSING_DIR = "${WORKSPACE}/HistoryProcessing" + + def resultprocessingoptions = toolsimporter.getNewToolOptions() + resultprocessingoptions.toolName('History processing') + resultprocessingoptions.toolRepo(HISTORY_PROCESSING_REPO, HISTORY_PROCESSING_REVISION) + toolsimporter.getTool(meta, resultprocessingoptions, HISTORY_PROCESSING_DIR) + } + } + } + stage ("Import application to test") { + steps { + script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") + + APPLICATION_UNDER_TEST = 'application_under_test' + env.APPLICATION_ARTIFACT_FOLDER = "${WORKSPACE}/${APPLICATION_UNDER_TEST}" + + def applicationimportoptions = importer.getNewImportOptions() + applicationimportoptions.jenkinsjob(APPLICATION_ARTIFACT_PROJECT, APPLICATION_ARTIFACT_SELECTOR) + applicationimportoptions.setfilter('app_package/**,control_package/**') + applicationmeta = importer.artifactimport(meta, applicationimportoptions, APPLICATION_ARTIFACT_FOLDER) + + meta.productinfo.set(applicationmeta.productinfo) + meta.productinfo.subcomponentname = "${applicationmeta.productinfo.subcomponentname}_TEST" + meta.gitinfo.set(applicationmeta.gitinfo) + meta.buildstampinfo.set(applicationmeta.buildstampinfo) + } + } + } + stage("Clean") { + steps { + script { + LOGGING_ROOT = 'Logging' + env.GIS_TEST_OUTPUT_LOGGING_ROOT = "${WORKSPACE}/${LOGGING_ROOT}" + cleanfolders = [ + GIS_TEST_OUTPUT_LOGGING_ROOT, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage ('Test') { + steps { + script { + lock(TEST_ENVIRONMENT['RESOURCE_LOCK']) { + if (POWER_CYCLE_HARDWARE == 'true') { + dir(FTDI_SOURCE_DIR) { + bat """ + "${PYTHON}" "${FTDI_SOURCE_DIR}/RegressionPower.py" -d ${TEST_ENVIRONMENT['FTDI_RELAY_DEVICE']} -o True + """ + } + } + if (UPDATE_HARDWARE == 'true') { + dir(GIS_TEST_SUITE_CORE) { + bat """ + "${PYTHON}" "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbPackageDeployer.py" -p "${APPLICATION_ARTIFACT_FOLDER}" -t "${TEST_ENVIRONMENT['IP_ADDRESS']}" + """ + rc = bat (script:""" + "${PYTHON}" "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbinspectstate.py" + """, + returnStatus: true) + if (rc == 1) { + unstable('FAILED while inspecting state of hardware') + } + } + } + if (DO_TEST == 'true') { + rc = bat(script:""" + ${PYTHON} "${GIS_TEST_SUITE_CORE}/GISTestMaster.py" -w ${PRODUCT_LOCATION_UNDER_TEST} -fl --include ${TEST_INCLUDE_FILTER} + """, + returnStatus: true + ) + if (rc == 1) { + unstable('FAILED while running tests') + } + } + } + } + } + } + stage("Archive Test History") { + steps{ + script { + dir(HISTORY_FOLDER) { + rc = bat (script:""" + "${PYTHON}" "${HISTORY_PROCESSING_DIR}/GitCyclicPush.py" + """, + returnStatus: true + ) + if (rc == 1) { + unstable('FAILED to process history') + } + } + } + } + } + stage("Archive test artifacts"){ + steps{ + script { + def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + artifactarchiver.archive(meta, artifactlist) + } + } + } + } + } + } +} + diff --git a/textutils/subst.groovy b/textutils/subst.groovy new file mode 100644 index 0000000..c0207a3 --- /dev/null +++ b/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/tool configurations/vs2017install/buildmachines.vsconfig b/tool configurations/vs2017install/buildmachines.vsconfig new file mode 100644 index 0000000..ea618a3 --- /dev/null +++ b/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/versioncontrol/git.groovy b/versioncontrol/git.groovy new file mode 100644 index 0000000..a22054b --- /dev/null +++ b/versioncontrol/git.groovy @@ -0,0 +1,377 @@ +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 = powershell(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 { + powershell """ + git status + if (\$lastexitcode -ge 1) { exit 1 } + """ + } + } +*/ + } + } + return reporootsubfolder +} + +def checkgitlfsinstall() { + if (isUnix()) { + sh """ + git lfs install + if [ \$? -ne 0 ]; then exit 1; fi + """ + + } else { + powershell """ + git lfs install + if (\$lastexitcode -ge 1) { exit 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) { + echo "Git: Checking out: URL: ${gitURL} Revision: ${revision} to: ${targetDir}" + checkout([ + $class: 'GitSCM', + userRemoteConfigs: [ + [url: gitURL] + ], + branches: [ + [name: revision] + ], + 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)], + [$class: 'PruneStaleBranch'], + ], + 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 { + powershell """ + 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 { + powershell """ + 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 { + powershell """ + git rm -rf . > \$null + git clean -fxd > \$null + git reset --hard > \$null + """ + } + } + } + +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 = powershell( 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/versionnumbering/do.groovy b/versionnumbering/do.groovy new file mode 100644 index 0000000..208a60f --- /dev/null +++ b/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 { + powershell """ + & "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + """ + } + } +} + +return this; diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy new file mode 100644 index 0000000..5e974e2 --- /dev/null +++ b/versionnumbering/generate.groovy @@ -0,0 +1,180 @@ +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 = powershell(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 = powershell(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 = powershell(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 = powershell(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) { + if (integerstring.length() > 6) { + integerstring = integerstring.substring(0, 5) + } + 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 pregenerated(meta, String sourcerevision, String sourcepath, String pregeneratedbuildstamp, int basebuildnumber = 1000) { + generate(meta, sourcerevision, sourcepath, basebuildnumber) + meta.buildstampinfo.override(pregeneratedbuildstamp) + + return pregeneratedbuildstamp +} + +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) { + // Deep copy + meta.gitinfo.set(othermeta.gitinfo.sourcepath, othermeta.gitinfo.sourcerevision, othermeta.gitinfo.gitrevision, othermeta.gitinfo.remoteurl, othermeta.gitinfo.remoteinfo) + meta.buildstampinfo.set(othermeta.buildstampinfo.buildstampprefix, othermeta.buildstampinfo.revision, othermeta.buildstampinfo.buildstamp) + + return meta.buildstampinfo.buildstamp +} + +return this; \ No newline at end of file diff --git a/versionstamping/.project b/versionstamping/.project new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/versionstamping/.project @@ -0,0 +1,17 @@ + + + versionstamping + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/versionstamping/.pydevproject b/versionstamping/.pydevproject new file mode 100644 index 0000000..746d0f0 --- /dev/null +++ b/versionstamping/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +python35 + diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py new file mode 100644 index 0000000..9243aa4 --- /dev/null +++ b/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 instances 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 2c6a90d2e1fa515cdd3ec19d961d595e1a1e0be8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Feb 2022 19:13:16 +0000 Subject: [PATCH 1860/1971] New files --- product/foreach.groovy | 16 ++++++--- product/gatherreleases.groovy | 67 +++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 product/gatherreleases.groovy diff --git a/product/foreach.groovy b/product/foreach.groovy index 690c5e1..6d31d01 100644 --- a/product/foreach.groovy +++ b/product/foreach.groovy @@ -51,11 +51,17 @@ pipeline { steps { script { def productcollection = get() + def productreleaseinfo = [] for (productrepo in productcollection.ProductReleaseRepos) { + def query_product_job = build job: QUERY_PRODUCT_REPO_JOB, + parameters: [ + string(name: 'PRODUCT_RELEASE_REPO', value: productrepo), + string(name: 'OUTPUT_ROOT_URL', value: OUTPUT_ROOT_URL), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] } } - } - } -} -} -PRODUCT_COLLECTION \ No newline at end of file + } + } + } +} \ No newline at end of file diff --git a/product/gatherreleases.groovy b/product/gatherreleases.groovy new file mode 100644 index 0000000..6d31d01 --- /dev/null +++ b/product/gatherreleases.groovy @@ -0,0 +1,67 @@ +def productcollectionstore = null + +/* Example expected JSON +{ + "ProductReleaseRepos": [ + "git@hydra:print-server-releases/print_server_whole.git" + ] +}*/ + +def String asJsonText() { + return writeJSON(returnText: true, json: productcollectionstore, pretty: 1) +} + +def boolean exists() { + return (productcollectionstore != null) +} + +def set(String jsontext) { + productcollectionstore = readJSON(text: jsontext) + echo "Product collection:\n${asJsonText()}" +} + +def get() { + return productcollectionstore +} + +pipeline { + agent { label AGENT_LABEL } + stages { + stage('Initial setup') { + steps { + script { + autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilderscript.startnonbuild(this) + + set(PRODUCT_COLLECTION) + } + } + } + stage('Clean folders') { + steps { + script { + cleanfolders = [ + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Iterate product collection') { + steps { + script { + def productcollection = get() + def productreleaseinfo = [] + for (productrepo in productcollection.ProductReleaseRepos) { + def query_product_job = build job: QUERY_PRODUCT_REPO_JOB, + parameters: [ + string(name: 'PRODUCT_RELEASE_REPO', value: productrepo), + string(name: 'OUTPUT_ROOT_URL', value: OUTPUT_ROOT_URL), + booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), + ] + } + } + } + } + } +} \ No newline at end of file From a5ee31d24b52bfdf7147328ec7dc0516d8c71f64 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Feb 2022 19:39:48 +0000 Subject: [PATCH 1861/1971] New files --- product/foreach.groovy | 4 ++-- product/gatherreleases.groovy | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/product/foreach.groovy b/product/foreach.groovy index 6d31d01..6b95005 100644 --- a/product/foreach.groovy +++ b/product/foreach.groovy @@ -30,8 +30,8 @@ pipeline { stage('Initial setup') { steps { script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.startnonbuild(this) + autobuilder = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilder.startnonbuild(this) set(PRODUCT_COLLECTION) } diff --git a/product/gatherreleases.groovy b/product/gatherreleases.groovy index 6d31d01..6b95005 100644 --- a/product/gatherreleases.groovy +++ b/product/gatherreleases.groovy @@ -30,8 +30,8 @@ pipeline { stage('Initial setup') { steps { script { - autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") - meta = autobuilderscript.startnonbuild(this) + autobuilder = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy") + meta = autobuilder.startnonbuild(this) set(PRODUCT_COLLECTION) } From 2767e8a5c5c3750b6fdbf142a298fd40f81ff10d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Feb 2022 19:44:32 +0000 Subject: [PATCH 1862/1971] Rename folder --- {Commons_scripts => Common_scripts}/.project | 0 {Commons_scripts => Common_scripts}/.pydevproject | 0 .../.settings/org.eclipse.core.resources.prefs | 0 {Commons_scripts => Common_scripts}/artifacts/archiver.groovy | 0 {Commons_scripts => Common_scripts}/artifacts/metaexport.groovy | 0 {Commons_scripts => Common_scripts}/autobuilder.groovy | 0 {Commons_scripts => Common_scripts}/build/integrity.groovy | 0 {Commons_scripts => Common_scripts}/build/postactions.groovy | 0 {Commons_scripts => Common_scripts}/build/postactionstest.groovy | 0 {Commons_scripts => Common_scripts}/check/build_meta.groovy | 0 {Commons_scripts => Common_scripts}/check/do_meta.groovy | 0 {Commons_scripts => Common_scripts}/checksum/utils.groovy | 0 {Commons_scripts => Common_scripts}/clean/clean.groovy | 0 .../commandline/commandline.groovy | 0 .../compile/eclipsebuild/disableparallelbuilds.groovy | 0 .../compile/eclipsebuild/eclipseSTM8build.groovy | 0 .../compile/eclipsebuild/eclipseds5build.groovy | 0 .../compile/eclipsebuild/eclipseniosbuild.groovy | 0 .../configuration/configuration.groovy | 0 {Commons_scripts => Common_scripts}/configuration/tools.groovy | 0 {Commons_scripts => Common_scripts}/copy/all.groovy | 0 {Commons_scripts => Common_scripts}/copy/esw.groovy | 0 {Commons_scripts => Common_scripts}/copy/filtered.groovy | 0 {Commons_scripts => Common_scripts}/copy/logic.groovy | 0 {Commons_scripts => Common_scripts}/differences/.project | 0 {Commons_scripts => Common_scripts}/differences/.pydevproject | 0 .../differences/dometahierarchy.groovy | 0 {Commons_scripts => Common_scripts}/differences/file.groovy | 0 {Commons_scripts => Common_scripts}/differences/json.groovy | 0 .../differences/metahierarchy.groovy | 0 .../documentation/doxygen_deploy.groovy | 0 {Commons_scripts => Common_scripts}/hardware/sominfo.groovy | 0 {Commons_scripts => Common_scripts}/import/importer.groovy | 0 {Commons_scripts => Common_scripts}/install/installhelper.groovy | 0 {Commons_scripts => Common_scripts}/meta/folder.groovy | 0 {Commons_scripts => Common_scripts}/packaging/debian.groovy | 0 {Commons_scripts => Common_scripts}/platform/lineendings.groovy | 0 {Commons_scripts => Common_scripts}/publish/.classpath | 0 {Commons_scripts => Common_scripts}/publish/.gitignore | 0 {Commons_scripts => Common_scripts}/publish/.project | 0 .../publish/.settings/org.eclipse.jdt.groovy.core.prefs | 0 {Commons_scripts => Common_scripts}/publish/do.groovy | 0 {Commons_scripts => Common_scripts}/publish/package.groovy | 0 .../publish/promptingpublish.groovy | 0 {Commons_scripts => Common_scripts}/publish/publish.groovy | 0 {Commons_scripts => Common_scripts}/publish/publishitems.groovy | 0 {Commons_scripts => Common_scripts}/publishing/utils.groovy | 0 {Commons_scripts => Common_scripts}/release/do.groovy | 0 {Commons_scripts => Common_scripts}/release/registerrepo.groovy | 0 {Commons_scripts => Common_scripts}/release/release.groovy | 0 {Commons_scripts => Common_scripts}/remoteaccess/ftp.groovy | 0 {Commons_scripts => Common_scripts}/remoteaccess/hostedftp.groovy | 0 {Commons_scripts => Common_scripts}/staticanalysis/ccm.groovy | 0 {Commons_scripts => Common_scripts}/staticanalysis/cpd.groovy | 0 .../staticanalysis/cppcheck.groovy | 0 .../test/testethernetproduct.groovy | 0 {Commons_scripts => Common_scripts}/textutils/subst.groovy | 0 .../tool configurations/vs2017install/buildmachines.vsconfig | 0 {Commons_scripts => Common_scripts}/versioncontrol/git.groovy | 0 {Commons_scripts => Common_scripts}/versionnumbering/do.groovy | 0 .../versionnumbering/generate.groovy | 0 {Commons_scripts => Common_scripts}/versionstamping/.project | 0 {Commons_scripts => Common_scripts}/versionstamping/.pydevproject | 0 .../versionstamping/versionstamper.py | 0 64 files changed, 0 insertions(+), 0 deletions(-) rename {Commons_scripts => Common_scripts}/.project (100%) rename {Commons_scripts => Common_scripts}/.pydevproject (100%) rename {Commons_scripts => Common_scripts}/.settings/org.eclipse.core.resources.prefs (100%) rename {Commons_scripts => Common_scripts}/artifacts/archiver.groovy (100%) rename {Commons_scripts => Common_scripts}/artifacts/metaexport.groovy (100%) rename {Commons_scripts => Common_scripts}/autobuilder.groovy (100%) rename {Commons_scripts => Common_scripts}/build/integrity.groovy (100%) rename {Commons_scripts => Common_scripts}/build/postactions.groovy (100%) rename {Commons_scripts => Common_scripts}/build/postactionstest.groovy (100%) rename {Commons_scripts => Common_scripts}/check/build_meta.groovy (100%) rename {Commons_scripts => Common_scripts}/check/do_meta.groovy (100%) rename {Commons_scripts => Common_scripts}/checksum/utils.groovy (100%) rename {Commons_scripts => Common_scripts}/clean/clean.groovy (100%) rename {Commons_scripts => Common_scripts}/commandline/commandline.groovy (100%) rename {Commons_scripts => Common_scripts}/compile/eclipsebuild/disableparallelbuilds.groovy (100%) rename {Commons_scripts => Common_scripts}/compile/eclipsebuild/eclipseSTM8build.groovy (100%) rename {Commons_scripts => Common_scripts}/compile/eclipsebuild/eclipseds5build.groovy (100%) rename {Commons_scripts => Common_scripts}/compile/eclipsebuild/eclipseniosbuild.groovy (100%) rename {Commons_scripts => Common_scripts}/configuration/configuration.groovy (100%) rename {Commons_scripts => Common_scripts}/configuration/tools.groovy (100%) rename {Commons_scripts => Common_scripts}/copy/all.groovy (100%) rename {Commons_scripts => Common_scripts}/copy/esw.groovy (100%) rename {Commons_scripts => Common_scripts}/copy/filtered.groovy (100%) rename {Commons_scripts => Common_scripts}/copy/logic.groovy (100%) rename {Commons_scripts => Common_scripts}/differences/.project (100%) rename {Commons_scripts => Common_scripts}/differences/.pydevproject (100%) rename {Commons_scripts => Common_scripts}/differences/dometahierarchy.groovy (100%) rename {Commons_scripts => Common_scripts}/differences/file.groovy (100%) rename {Commons_scripts => Common_scripts}/differences/json.groovy (100%) rename {Commons_scripts => Common_scripts}/differences/metahierarchy.groovy (100%) rename {Commons_scripts => Common_scripts}/documentation/doxygen_deploy.groovy (100%) rename {Commons_scripts => Common_scripts}/hardware/sominfo.groovy (100%) rename {Commons_scripts => Common_scripts}/import/importer.groovy (100%) rename {Commons_scripts => Common_scripts}/install/installhelper.groovy (100%) rename {Commons_scripts => Common_scripts}/meta/folder.groovy (100%) rename {Commons_scripts => Common_scripts}/packaging/debian.groovy (100%) rename {Commons_scripts => Common_scripts}/platform/lineendings.groovy (100%) rename {Commons_scripts => Common_scripts}/publish/.classpath (100%) rename {Commons_scripts => Common_scripts}/publish/.gitignore (100%) rename {Commons_scripts => Common_scripts}/publish/.project (100%) rename {Commons_scripts => Common_scripts}/publish/.settings/org.eclipse.jdt.groovy.core.prefs (100%) rename {Commons_scripts => Common_scripts}/publish/do.groovy (100%) rename {Commons_scripts => Common_scripts}/publish/package.groovy (100%) rename {Commons_scripts => Common_scripts}/publish/promptingpublish.groovy (100%) rename {Commons_scripts => Common_scripts}/publish/publish.groovy (100%) rename {Commons_scripts => Common_scripts}/publish/publishitems.groovy (100%) rename {Commons_scripts => Common_scripts}/publishing/utils.groovy (100%) rename {Commons_scripts => Common_scripts}/release/do.groovy (100%) rename {Commons_scripts => Common_scripts}/release/registerrepo.groovy (100%) rename {Commons_scripts => Common_scripts}/release/release.groovy (100%) rename {Commons_scripts => Common_scripts}/remoteaccess/ftp.groovy (100%) rename {Commons_scripts => Common_scripts}/remoteaccess/hostedftp.groovy (100%) rename {Commons_scripts => Common_scripts}/staticanalysis/ccm.groovy (100%) rename {Commons_scripts => Common_scripts}/staticanalysis/cpd.groovy (100%) rename {Commons_scripts => Common_scripts}/staticanalysis/cppcheck.groovy (100%) rename {Commons_scripts => Common_scripts}/test/testethernetproduct.groovy (100%) rename {Commons_scripts => Common_scripts}/textutils/subst.groovy (100%) rename {Commons_scripts => Common_scripts}/tool configurations/vs2017install/buildmachines.vsconfig (100%) rename {Commons_scripts => Common_scripts}/versioncontrol/git.groovy (100%) rename {Commons_scripts => Common_scripts}/versionnumbering/do.groovy (100%) rename {Commons_scripts => Common_scripts}/versionnumbering/generate.groovy (100%) rename {Commons_scripts => Common_scripts}/versionstamping/.project (100%) rename {Commons_scripts => Common_scripts}/versionstamping/.pydevproject (100%) rename {Commons_scripts => Common_scripts}/versionstamping/versionstamper.py (100%) diff --git a/Commons_scripts/.project b/Common_scripts/.project similarity index 100% rename from Commons_scripts/.project rename to Common_scripts/.project diff --git a/Commons_scripts/.pydevproject b/Common_scripts/.pydevproject similarity index 100% rename from Commons_scripts/.pydevproject rename to Common_scripts/.pydevproject diff --git a/Commons_scripts/.settings/org.eclipse.core.resources.prefs b/Common_scripts/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from Commons_scripts/.settings/org.eclipse.core.resources.prefs rename to Common_scripts/.settings/org.eclipse.core.resources.prefs diff --git a/Commons_scripts/artifacts/archiver.groovy b/Common_scripts/artifacts/archiver.groovy similarity index 100% rename from Commons_scripts/artifacts/archiver.groovy rename to Common_scripts/artifacts/archiver.groovy diff --git a/Commons_scripts/artifacts/metaexport.groovy b/Common_scripts/artifacts/metaexport.groovy similarity index 100% rename from Commons_scripts/artifacts/metaexport.groovy rename to Common_scripts/artifacts/metaexport.groovy diff --git a/Commons_scripts/autobuilder.groovy b/Common_scripts/autobuilder.groovy similarity index 100% rename from Commons_scripts/autobuilder.groovy rename to Common_scripts/autobuilder.groovy diff --git a/Commons_scripts/build/integrity.groovy b/Common_scripts/build/integrity.groovy similarity index 100% rename from Commons_scripts/build/integrity.groovy rename to Common_scripts/build/integrity.groovy diff --git a/Commons_scripts/build/postactions.groovy b/Common_scripts/build/postactions.groovy similarity index 100% rename from Commons_scripts/build/postactions.groovy rename to Common_scripts/build/postactions.groovy diff --git a/Commons_scripts/build/postactionstest.groovy b/Common_scripts/build/postactionstest.groovy similarity index 100% rename from Commons_scripts/build/postactionstest.groovy rename to Common_scripts/build/postactionstest.groovy diff --git a/Commons_scripts/check/build_meta.groovy b/Common_scripts/check/build_meta.groovy similarity index 100% rename from Commons_scripts/check/build_meta.groovy rename to Common_scripts/check/build_meta.groovy diff --git a/Commons_scripts/check/do_meta.groovy b/Common_scripts/check/do_meta.groovy similarity index 100% rename from Commons_scripts/check/do_meta.groovy rename to Common_scripts/check/do_meta.groovy diff --git a/Commons_scripts/checksum/utils.groovy b/Common_scripts/checksum/utils.groovy similarity index 100% rename from Commons_scripts/checksum/utils.groovy rename to Common_scripts/checksum/utils.groovy diff --git a/Commons_scripts/clean/clean.groovy b/Common_scripts/clean/clean.groovy similarity index 100% rename from Commons_scripts/clean/clean.groovy rename to Common_scripts/clean/clean.groovy diff --git a/Commons_scripts/commandline/commandline.groovy b/Common_scripts/commandline/commandline.groovy similarity index 100% rename from Commons_scripts/commandline/commandline.groovy rename to Common_scripts/commandline/commandline.groovy diff --git a/Commons_scripts/compile/eclipsebuild/disableparallelbuilds.groovy b/Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy similarity index 100% rename from Commons_scripts/compile/eclipsebuild/disableparallelbuilds.groovy rename to Common_scripts/compile/eclipsebuild/disableparallelbuilds.groovy diff --git a/Commons_scripts/compile/eclipsebuild/eclipseSTM8build.groovy b/Common_scripts/compile/eclipsebuild/eclipseSTM8build.groovy similarity index 100% rename from Commons_scripts/compile/eclipsebuild/eclipseSTM8build.groovy rename to Common_scripts/compile/eclipsebuild/eclipseSTM8build.groovy diff --git a/Commons_scripts/compile/eclipsebuild/eclipseds5build.groovy b/Common_scripts/compile/eclipsebuild/eclipseds5build.groovy similarity index 100% rename from Commons_scripts/compile/eclipsebuild/eclipseds5build.groovy rename to Common_scripts/compile/eclipsebuild/eclipseds5build.groovy diff --git a/Commons_scripts/compile/eclipsebuild/eclipseniosbuild.groovy b/Common_scripts/compile/eclipsebuild/eclipseniosbuild.groovy similarity index 100% rename from Commons_scripts/compile/eclipsebuild/eclipseniosbuild.groovy rename to Common_scripts/compile/eclipsebuild/eclipseniosbuild.groovy diff --git a/Commons_scripts/configuration/configuration.groovy b/Common_scripts/configuration/configuration.groovy similarity index 100% rename from Commons_scripts/configuration/configuration.groovy rename to Common_scripts/configuration/configuration.groovy diff --git a/Commons_scripts/configuration/tools.groovy b/Common_scripts/configuration/tools.groovy similarity index 100% rename from Commons_scripts/configuration/tools.groovy rename to Common_scripts/configuration/tools.groovy diff --git a/Commons_scripts/copy/all.groovy b/Common_scripts/copy/all.groovy similarity index 100% rename from Commons_scripts/copy/all.groovy rename to Common_scripts/copy/all.groovy diff --git a/Commons_scripts/copy/esw.groovy b/Common_scripts/copy/esw.groovy similarity index 100% rename from Commons_scripts/copy/esw.groovy rename to Common_scripts/copy/esw.groovy diff --git a/Commons_scripts/copy/filtered.groovy b/Common_scripts/copy/filtered.groovy similarity index 100% rename from Commons_scripts/copy/filtered.groovy rename to Common_scripts/copy/filtered.groovy diff --git a/Commons_scripts/copy/logic.groovy b/Common_scripts/copy/logic.groovy similarity index 100% rename from Commons_scripts/copy/logic.groovy rename to Common_scripts/copy/logic.groovy diff --git a/Commons_scripts/differences/.project b/Common_scripts/differences/.project similarity index 100% rename from Commons_scripts/differences/.project rename to Common_scripts/differences/.project diff --git a/Commons_scripts/differences/.pydevproject b/Common_scripts/differences/.pydevproject similarity index 100% rename from Commons_scripts/differences/.pydevproject rename to Common_scripts/differences/.pydevproject diff --git a/Commons_scripts/differences/dometahierarchy.groovy b/Common_scripts/differences/dometahierarchy.groovy similarity index 100% rename from Commons_scripts/differences/dometahierarchy.groovy rename to Common_scripts/differences/dometahierarchy.groovy diff --git a/Commons_scripts/differences/file.groovy b/Common_scripts/differences/file.groovy similarity index 100% rename from Commons_scripts/differences/file.groovy rename to Common_scripts/differences/file.groovy diff --git a/Commons_scripts/differences/json.groovy b/Common_scripts/differences/json.groovy similarity index 100% rename from Commons_scripts/differences/json.groovy rename to Common_scripts/differences/json.groovy diff --git a/Commons_scripts/differences/metahierarchy.groovy b/Common_scripts/differences/metahierarchy.groovy similarity index 100% rename from Commons_scripts/differences/metahierarchy.groovy rename to Common_scripts/differences/metahierarchy.groovy diff --git a/Commons_scripts/documentation/doxygen_deploy.groovy b/Common_scripts/documentation/doxygen_deploy.groovy similarity index 100% rename from Commons_scripts/documentation/doxygen_deploy.groovy rename to Common_scripts/documentation/doxygen_deploy.groovy diff --git a/Commons_scripts/hardware/sominfo.groovy b/Common_scripts/hardware/sominfo.groovy similarity index 100% rename from Commons_scripts/hardware/sominfo.groovy rename to Common_scripts/hardware/sominfo.groovy diff --git a/Commons_scripts/import/importer.groovy b/Common_scripts/import/importer.groovy similarity index 100% rename from Commons_scripts/import/importer.groovy rename to Common_scripts/import/importer.groovy diff --git a/Commons_scripts/install/installhelper.groovy b/Common_scripts/install/installhelper.groovy similarity index 100% rename from Commons_scripts/install/installhelper.groovy rename to Common_scripts/install/installhelper.groovy diff --git a/Commons_scripts/meta/folder.groovy b/Common_scripts/meta/folder.groovy similarity index 100% rename from Commons_scripts/meta/folder.groovy rename to Common_scripts/meta/folder.groovy diff --git a/Commons_scripts/packaging/debian.groovy b/Common_scripts/packaging/debian.groovy similarity index 100% rename from Commons_scripts/packaging/debian.groovy rename to Common_scripts/packaging/debian.groovy diff --git a/Commons_scripts/platform/lineendings.groovy b/Common_scripts/platform/lineendings.groovy similarity index 100% rename from Commons_scripts/platform/lineendings.groovy rename to Common_scripts/platform/lineendings.groovy diff --git a/Commons_scripts/publish/.classpath b/Common_scripts/publish/.classpath similarity index 100% rename from Commons_scripts/publish/.classpath rename to Common_scripts/publish/.classpath diff --git a/Commons_scripts/publish/.gitignore b/Common_scripts/publish/.gitignore similarity index 100% rename from Commons_scripts/publish/.gitignore rename to Common_scripts/publish/.gitignore diff --git a/Commons_scripts/publish/.project b/Common_scripts/publish/.project similarity index 100% rename from Commons_scripts/publish/.project rename to Common_scripts/publish/.project diff --git a/Commons_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs b/Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs similarity index 100% rename from Commons_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs rename to Common_scripts/publish/.settings/org.eclipse.jdt.groovy.core.prefs diff --git a/Commons_scripts/publish/do.groovy b/Common_scripts/publish/do.groovy similarity index 100% rename from Commons_scripts/publish/do.groovy rename to Common_scripts/publish/do.groovy diff --git a/Commons_scripts/publish/package.groovy b/Common_scripts/publish/package.groovy similarity index 100% rename from Commons_scripts/publish/package.groovy rename to Common_scripts/publish/package.groovy diff --git a/Commons_scripts/publish/promptingpublish.groovy b/Common_scripts/publish/promptingpublish.groovy similarity index 100% rename from Commons_scripts/publish/promptingpublish.groovy rename to Common_scripts/publish/promptingpublish.groovy diff --git a/Commons_scripts/publish/publish.groovy b/Common_scripts/publish/publish.groovy similarity index 100% rename from Commons_scripts/publish/publish.groovy rename to Common_scripts/publish/publish.groovy diff --git a/Commons_scripts/publish/publishitems.groovy b/Common_scripts/publish/publishitems.groovy similarity index 100% rename from Commons_scripts/publish/publishitems.groovy rename to Common_scripts/publish/publishitems.groovy diff --git a/Commons_scripts/publishing/utils.groovy b/Common_scripts/publishing/utils.groovy similarity index 100% rename from Commons_scripts/publishing/utils.groovy rename to Common_scripts/publishing/utils.groovy diff --git a/Commons_scripts/release/do.groovy b/Common_scripts/release/do.groovy similarity index 100% rename from Commons_scripts/release/do.groovy rename to Common_scripts/release/do.groovy diff --git a/Commons_scripts/release/registerrepo.groovy b/Common_scripts/release/registerrepo.groovy similarity index 100% rename from Commons_scripts/release/registerrepo.groovy rename to Common_scripts/release/registerrepo.groovy diff --git a/Commons_scripts/release/release.groovy b/Common_scripts/release/release.groovy similarity index 100% rename from Commons_scripts/release/release.groovy rename to Common_scripts/release/release.groovy diff --git a/Commons_scripts/remoteaccess/ftp.groovy b/Common_scripts/remoteaccess/ftp.groovy similarity index 100% rename from Commons_scripts/remoteaccess/ftp.groovy rename to Common_scripts/remoteaccess/ftp.groovy diff --git a/Commons_scripts/remoteaccess/hostedftp.groovy b/Common_scripts/remoteaccess/hostedftp.groovy similarity index 100% rename from Commons_scripts/remoteaccess/hostedftp.groovy rename to Common_scripts/remoteaccess/hostedftp.groovy diff --git a/Commons_scripts/staticanalysis/ccm.groovy b/Common_scripts/staticanalysis/ccm.groovy similarity index 100% rename from Commons_scripts/staticanalysis/ccm.groovy rename to Common_scripts/staticanalysis/ccm.groovy diff --git a/Commons_scripts/staticanalysis/cpd.groovy b/Common_scripts/staticanalysis/cpd.groovy similarity index 100% rename from Commons_scripts/staticanalysis/cpd.groovy rename to Common_scripts/staticanalysis/cpd.groovy diff --git a/Commons_scripts/staticanalysis/cppcheck.groovy b/Common_scripts/staticanalysis/cppcheck.groovy similarity index 100% rename from Commons_scripts/staticanalysis/cppcheck.groovy rename to Common_scripts/staticanalysis/cppcheck.groovy diff --git a/Commons_scripts/test/testethernetproduct.groovy b/Common_scripts/test/testethernetproduct.groovy similarity index 100% rename from Commons_scripts/test/testethernetproduct.groovy rename to Common_scripts/test/testethernetproduct.groovy diff --git a/Commons_scripts/textutils/subst.groovy b/Common_scripts/textutils/subst.groovy similarity index 100% rename from Commons_scripts/textutils/subst.groovy rename to Common_scripts/textutils/subst.groovy diff --git a/Commons_scripts/tool configurations/vs2017install/buildmachines.vsconfig b/Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig similarity index 100% rename from Commons_scripts/tool configurations/vs2017install/buildmachines.vsconfig rename to Common_scripts/tool configurations/vs2017install/buildmachines.vsconfig diff --git a/Commons_scripts/versioncontrol/git.groovy b/Common_scripts/versioncontrol/git.groovy similarity index 100% rename from Commons_scripts/versioncontrol/git.groovy rename to Common_scripts/versioncontrol/git.groovy diff --git a/Commons_scripts/versionnumbering/do.groovy b/Common_scripts/versionnumbering/do.groovy similarity index 100% rename from Commons_scripts/versionnumbering/do.groovy rename to Common_scripts/versionnumbering/do.groovy diff --git a/Commons_scripts/versionnumbering/generate.groovy b/Common_scripts/versionnumbering/generate.groovy similarity index 100% rename from Commons_scripts/versionnumbering/generate.groovy rename to Common_scripts/versionnumbering/generate.groovy diff --git a/Commons_scripts/versionstamping/.project b/Common_scripts/versionstamping/.project similarity index 100% rename from Commons_scripts/versionstamping/.project rename to Common_scripts/versionstamping/.project diff --git a/Commons_scripts/versionstamping/.pydevproject b/Common_scripts/versionstamping/.pydevproject similarity index 100% rename from Commons_scripts/versionstamping/.pydevproject rename to Common_scripts/versionstamping/.pydevproject diff --git a/Commons_scripts/versionstamping/versionstamper.py b/Common_scripts/versionstamping/versionstamper.py similarity index 100% rename from Commons_scripts/versionstamping/versionstamper.py rename to Common_scripts/versionstamping/versionstamper.py From 9a31beb1d7dd099ef5292d234a686cdbb0dfdd84 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Feb 2022 19:45:52 +0000 Subject: [PATCH 1863/1971] Remove folder --- Common_scripts/.project | 17 - Common_scripts/.pydevproject | 8 - .../org.eclipse.core.resources.prefs | 2 - Common_scripts/artifacts/archiver.groovy | 17 - Common_scripts/artifacts/metaexport.groovy | 26 - Common_scripts/autobuilder.groovy | 147 -- Common_scripts/build/integrity.groovy | 113 -- Common_scripts/build/postactions.groovy | 225 ---- Common_scripts/build/postactionstest.groovy | 43 - Common_scripts/check/build_meta.groovy | 87 -- Common_scripts/check/do_meta.groovy | 77 -- Common_scripts/checksum/utils.groovy | 15 - Common_scripts/clean/clean.groovy | 10 - Common_scripts/commandline/commandline.groovy | 12 - .../eclipsebuild/disableparallelbuilds.groovy | 12 - .../eclipsebuild/eclipseSTM8build.groovy | 172 --- .../eclipsebuild/eclipseds5build.groovy | 252 ---- .../eclipsebuild/eclipseniosbuild.groovy | 116 -- .../configuration/configuration.groovy | 18 - Common_scripts/configuration/tools.groovy | 59 - Common_scripts/copy/all.groovy | 67 - Common_scripts/copy/esw.groovy | 67 - Common_scripts/copy/filtered.groovy | 73 - Common_scripts/copy/logic.groovy | 79 -- Common_scripts/differences/.project | 17 - Common_scripts/differences/.pydevproject | 8 - .../differences/dometahierarchy.groovy | 836 ------------ Common_scripts/differences/file.groovy | 24 - Common_scripts/differences/json.groovy | 51 - .../differences/metahierarchy.groovy | 102 -- .../documentation/doxygen_deploy.groovy | 80 -- Common_scripts/hardware/sominfo.groovy | 80 -- Common_scripts/import/importer.groovy | 408 ------ Common_scripts/install/installhelper.groovy | 136 -- Common_scripts/meta/folder.groovy | 1193 ----------------- Common_scripts/packaging/debian.groovy | 111 -- 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 | 181 --- .../publish/promptingpublish.groovy | 182 --- Common_scripts/publish/publish.groovy | 92 -- Common_scripts/publish/publishitems.groovy | 129 -- Common_scripts/publishing/utils.groovy | 27 - Common_scripts/release/do.groovy | 458 ------- Common_scripts/release/registerrepo.groovy | 12 - Common_scripts/release/release.groovy | 87 -- Common_scripts/remoteaccess/ftp.groovy | 32 - Common_scripts/remoteaccess/hostedftp.groovy | 28 - Common_scripts/staticanalysis/ccm.groovy | 85 -- Common_scripts/staticanalysis/cpd.groovy | 152 --- Common_scripts/staticanalysis/cppcheck.groovy | 114 -- .../test/testethernetproduct.groovy | 204 --- Common_scripts/textutils/subst.groovy | 8 - .../vs2017install/buildmachines.vsconfig | 25 - Common_scripts/versioncontrol/git.groovy | 377 ------ Common_scripts/versionnumbering/do.groovy | 23 - .../versionnumbering/generate.groovy | 180 --- Common_scripts/versionstamping/.project | 17 - Common_scripts/versionstamping/.pydevproject | 8 - .../versionstamping/versionstamper.py | 38 - 64 files changed, 7435 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/archiver.groovy delete mode 100644 Common_scripts/artifacts/metaexport.groovy delete mode 100644 Common_scripts/autobuilder.groovy delete mode 100644 Common_scripts/build/integrity.groovy delete mode 100644 Common_scripts/build/postactions.groovy delete mode 100644 Common_scripts/build/postactionstest.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/configuration/tools.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/hardware/sominfo.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/test/testethernetproduct.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/archiver.groovy b/Common_scripts/artifacts/archiver.groovy deleted file mode 100644 index bafba02..0000000 --- a/Common_scripts/artifacts/archiver.groovy +++ /dev/null @@ -1,17 +0,0 @@ -enum Store { - JENKINS, - ARTIFACTSERVER, -} - -this.JENKINS = Store.JENKINS -this.ARTIFACTSERVER = Store.JENKINS - -def archive(MetaInfo meta, String artifactlist, Store store = JENKINS) { - echo "Archiving artifacts to store: ${store}" - meta.copyrelatedmeta() - if (store == JENKINS) { - archiveArtifacts(artifacts: artifactlist) - } -} - -return this \ No newline at end of file diff --git a/Common_scripts/artifacts/metaexport.groovy b/Common_scripts/artifacts/metaexport.groovy deleted file mode 100644 index a40e9a8..0000000 --- a/Common_scripts/artifacts/metaexport.groovy +++ /dev/null @@ -1,26 +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.getFullProjectName() - def subJobNumber = subJobObject.getNumber() - def destFolder = subJob[1] - def boolean incrementversionnumber = subJob[2] - dir(destFolder) { - deleteDir() - } - - def importoptions = importer.getNewImportOptions() - importoptions.jenkinsjob(subJobName, subJobNumber) - importoptions.setincrementversionnumber(incrementversionnumber) - importer.artifactimport(meta, importoptions, destFolder) - - artifactFolders.add("${destFolder}/**") - } - } - return artifactFolders -} - -return this; diff --git a/Common_scripts/autobuilder.groovy b/Common_scripts/autobuilder.groovy deleted file mode 100644 index 667f89a..0000000 --- a/Common_scripts/autobuilder.groovy +++ /dev/null @@ -1,147 +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 -} - -def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) { - def String altered = releaserepo.trim() - - if (releaserepovariantsuffix?.trim()) { - altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", releaserepovariantsuffix) - } - return altered -} - -def setBuildType(meta, boolean dofullbuild = true) { - def doquickbuild = false - - echo "Build trigger cause: ${currentBuild.getBuildCauses()}" - if (currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')) { - echo "Build triggered by user" - if (!dofullbuild) { - echo "Marking as quick build as user wanted one" - doquickbuild = true - } - } else { - echo "Build triggered automatically" - if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause') || currentBuild.getBuildCauses('hudson.triggers.SCMTrigger$SCMTriggerCause')) { - echo "Marking as quick build as it was triggered by a commit" - doquickbuild = true - } else if (currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')) { - echo "Marking as full build as it was triggered by timer" - } - } - echo "Build type is ${doquickbuild ? "quick" : "full"}" - if (doquickbuild) { - unstable('This not a full build - a subset of the artifacts is not being generated') - } - meta.jenkinsbuildinfo.set(!doquickbuild) - return doquickbuild -} - -def setupmeta(script, String productname, String subcomponentname, String productvariant = '') { - def meta = getmetafolderscript().metareset(script) - echo "Product name: ${productname} Subcomponent name: ${subcomponentname} Variant: ${productvariant}" - 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()) - for (p in params) { - meta.jenkinsbuildinfo.addParameter(p.key, p.value) - } - return meta -} - -// Start up boilerplate -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 - commonscriptsroot = commonscriptspath - metafolderscript = load("${commonscripts()}/meta/folder.groovy") - - conditionalclean() - - def meta = setupmeta(script, productname, subcomponentname, productvariant) - - def rr = load("${commonscripts()}/release/registerrepo.groovy") - def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant) - - echo "Release repo: ${alteredreleaserepo}" - rr.registerrepo(meta, alteredreleaserepo) - - def ch = load("${commonscripts()}/configuration/configuration.groovy") - ch.registerPipelineScriptConfiguration(meta) - - return meta -} - -// Start up boilerplate -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 = setupmeta(script, "Non-build-product", "Non-build-subcomponent") - - 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/build/integrity.groovy b/Common_scripts/build/integrity.groovy deleted file mode 100644 index e93c00f..0000000 --- a/Common_scripts/build/integrity.groovy +++ /dev/null @@ -1,113 +0,0 @@ -import static groovy.json.JsonOutput.* - -def check(buildmeta) { - def results = [ - 'good': true, - 'comment': '', - ] - - // Walk the meta looking for different versions of the same components - def allmeta = buildmeta.allrelatedmeta() - echo "All meta:\n${allmeta.comment}" - - // Store build stamps associated with each product component; Store a counter against each product component version - def productcomponents = [:] - for (meta in allmeta.metacollection) { - def key = meta.componentidentifier() - - if (!productcomponents.containsKey(key)) { - productcomponents[key] = [:] - } - def buildstampnumber = meta.releasetag() - if (!productcomponents[key].containsKey(buildstampnumber)) { - productcomponents[key][buildstampnumber] = 1 - } else { - productcomponents[key][buildstampnumber] += 1 - } - } - - // Show what was collected - echo prettyPrint(toJson(productcomponents)) - - // Look for product components with more than one build stamp - for (pc in productcomponents.keySet()) { - def bsns = productcomponents[pc] - if (bsns.size() > 1) { - results.good = false - results.comment += "There is more than one version of Product component: ${pc} being used in this build:\n" - for (bsn in bsns.keySet()) { - results.comment += "${bsn}\n" - } - } - } - - // Store product components associated with each release git url - def releasegiturls = [:] - for (meta in allmeta.metacollection) { - def String key = meta.releaseinfo.releaserepoURL - - if (key) { - if (!releasegiturls.containsKey(key)) { - releasegiturls[key] = [:] - } - def componentidentifier = meta.componentidentifier() - if (!releasegiturls[key].containsKey(componentidentifier)) { - releasegiturls[key][componentidentifier] = 1 - } else { - releasegiturls[key][componentidentifier] += 1 - } - } - } - - // Show what was collected - echo prettyPrint(toJson(releasegiturls)) - - // Look for release git urls being used by more than one product component - for (rgu in releasegiturls.keySet()) { - def cis = releasegiturls[rgu] - if (cis.size() > 1) { - results.good = false - results.comment += "There is more than one product component associated with a release git url: ${rgu} being used in this build:\n" - for (ci in cis.keySet()) { - results.comment += "${ci}\n" - } - } - } - - // Store git commit shas associated with each source git url - def sourcegiturls = [:] - for (meta in allmeta.metacollection) { - def String key = meta.gitinfo.remoteurl - - if (key) { - if (!sourcegiturls.containsKey(key)) { - sourcegiturls[key] = [:] - } - def commitsha = meta.gitinfo.gitrevision - if (!sourcegiturls[key].containsKey(commitsha)) { - sourcegiturls[key][commitsha] = 1 - } else { - sourcegiturls[key][commitsha] += 1 - } - } - } - - // Show what was collected - echo prettyPrint(toJson(sourcegiturls)) - - // Look for source git urls associated with more than one sha code - for (sgu in sourcegiturls.keySet()) { - def cs = sourcegiturls[sgu] - if (cs.size() > 1) { - results.good = false - results.comment += "There is more than one source commit sha associated with a source git url: ${sgu} being used in this build:\n" - for (c in cs.keySet()) { - results.comment += "${c}\n" - } - } - } - - return results -} - -return this \ No newline at end of file diff --git a/Common_scripts/build/postactions.groovy b/Common_scripts/build/postactions.groovy deleted file mode 100644 index 8b18908..0000000 --- a/Common_scripts/build/postactions.groovy +++ /dev/null @@ -1,225 +0,0 @@ -/* Example post build info -{ - "Build outcomes": { - "Success": { - "Actions": { - "Deploy documentation": { - "Description": "Can be empty - Name of documentation/doxygen deploy job to run if this build is successful", - "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_doxygen_deploy" - }, - "Static analysis": { - "Description": "Can be empty - Static analysis job to run when this build is successful", - "Job": "" - }, - "Unit test": { - "Description": "Can be empty - Unit test job to run when this build is successful", - "Job": "" - }, - "Regression test": { - "Description": "Can be empty - Regression test job to run when this build is successful", - "Job": "HMB_FD_HV_0.9.6/HMB_FD_HV_0.9.6_sg1024_run_tests" - }, - "Update differences": { - "Description": "Can be empty - Update differences job to run when this build is successful", - "Job": "HMB_FD_HV_diff_releases" - }, - "Release to git": { - "Description": "Can be empty - Name of release to git job to run if this build is successful", - "Job": "HMB_FD_HV_release_to_git" - } - } - }, - "Failed": { - "Actions": { - "Email": { - "Description": "Can be empty - Name of release to git job to run if this build is successful", - "To": [ - "dan.hawkins@globalinkjetsystems.com" - ] - }, - "ExtEmail": { - "Description": "Send an email using Extended Email plugin", - "To": [ - "dan.hawkins@globalinkjetsystems.com" - ], - "Recipient providers": [ - "culprits", - "requestor", - "developers", - "upstreamDevelopers" - ] - } - } - } - } -} -*/ - -def getActionJobName(postbuildactions, String action, String alternativeparamname) { - def String jobname = '' - if (postbuildactions) { - try { - jobname = postbuildactions[action]['Job'] - } catch(Exception ex) { - echo "No post build actions found for action: ${action}" - jobname = '' - } - } else { - if (params[alternativeparamname] != null) { - if (params[alternativeparamname]) { - jobname = params[alternativeparamname] - } - } - } - if (jobname) { - def jobitem = Jenkins.instance.getItemByFullName(jobname) - if (jobitem) { - if (!jobitem.isBuildable()) { - jobname = '' - } - } else { - jobname = '' - } - } - // echo "Job name for action: ${action}: ${jobname}" - return jobname -} - -def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername) { - def jobname = getActionJobName(postbuildactions, action, alternativeparamname) - if (jobname) { - build( - wait: false, - job: jobname, - parameters: [ - string(name: jobnameparametername, value: JOB_NAME), - string(name: jobselectorparametername, value: buildselector), - ] - ) - } -} - -def readPostBuildInfo() { - def postbuildinfo = readJSON(text: POST_BUILD_INFO) - def postbuildjsontext = writeJSON(returnText: true, json: postbuildinfo, pretty: 1) - // echo "Post build info:\n${postbuildjsontext}" - - return postbuildinfo -} - -def performSuccessfulBuildActions() { - def postbuildactions - if (params.POST_BUILD_INFO != null) { - def postbuildinfo = readPostBuildInfo() - try { - postbuildactions = postbuildinfo['Build outcomes']['Success']['Actions'] - } catch(Exception ex) { - echo "Post build info did not contain: Build outcomes/Success/Actions" - postbuildactions = null - } - } - def String buildselector = "${BUILD_NUMBER}" - deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR') - deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' ) - deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') - deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') - deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR') - deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR') -} - -def sendemails(emailinfo) { - def emailtolist = emailinfo['To'] - - if (emailtolist) { - def emailbody = """ - Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME} : ${BUILD_URL} - - Console output: ${BUILD_URL}console - """ - for(emailto in emailtolist) { - mail( - subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", - body: emailbody, - to: emailto - ) - // echo "Send email to: ${emailto}" - } - } -} - -def getRecipientProviders(recipientProviderInfoList) { - def recipientProviderMap = [ - culprits: [$class: 'CulpritsRecipientProvider'], - requestor: [$class: 'RequesterRecipientProvider'], - developers: [$class: 'DevelopersRecipientProvider'], - upstreamDevelopers: [$class: 'UpstreamComitterRecipientProvider'], - ] - def recipientProviders = [] - - if (recipientProviderInfoList) { - for(rp in recipientProviderInfoList) { - if (recipientProviderMap.containsKey(rp)) { - recipientProviders.add(recipientProviderMap[rp]) - } - } - } - if (recipientProviders.size() == 0) { - recipientProviders = [culprits(), requestor(), developers(), upstreamDevelopers()] - } - // echo "recipientProviders: ${recipientProviders.toString()}" - return recipientProviders; -} - -def String getToList(toListInfo) { - def String toList = '' - - if (toListInfo) { - toList = toListInfo.join(',') - } - // echo "toList: ${toList}" - return toList -} - -def sendextemail(extmailinfo) { - def recipientProviders = getRecipientProviders(extmailinfo['Recipient providers']) - def toList = getToList(extmailinfo['To']) - - emailext( - subject: "[Jenkins] Failed build: ${JOB_NAME} ${BUILD_DISPLAY_NAME}", - body: '''${JELLY_SCRIPT,template="html"}''', - attachLog: true, - // attachmentsPattern: '', - compressLog: false, - // from : '', - mimeType: 'text/html', - // postsendScript: '', - // presendScript: '', - recipientProviders: recipientProviders, // Could be: buildUser, culprits, developers, brokenTestsSuspects, brokenBuildSuspects, recipients, requestor, upstreamDevelopers - // replyTo: '', - saveOutput: false, - to: toList, - ) -} - -def performFailedBuildActions() { - def postbuildactions = null - if (params.POST_BUILD_INFO != null) { - def postbuildinfo = readPostBuildInfo() - try { - postbuildactions = postbuildinfo['Build outcomes']['Failed']['Actions'] - } catch(Exception ex) { - echo "Post build info did not contain: Build outcomes/Failed/Actions" - postbuildactions = null - } - } - if (postbuildactions) { - if (postbuildactions['Email']) { - sendemails(postbuildactions['Email']) - } - if (postbuildactions['ExtEmail']) { - sendextemail(postbuildactions['ExtEmail']) - } - } -} - -return this; diff --git a/Common_scripts/build/postactionstest.groovy b/Common_scripts/build/postactionstest.groovy deleted file mode 100644 index 150f5d1..0000000 --- a/Common_scripts/build/postactionstest.groovy +++ /dev/null @@ -1,43 +0,0 @@ -pipeline { - agent { label 'master' } - stages { - stage('Initial setup') { - steps { - script { - CLEAN_WORKSPACE = false - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - } - } - } - stage('Dummy build job') { - steps { - script { - echo "Execute dummy build job: ${CAUSE_ERROR}" - if (CAUSE_ERROR == 'true') { - error("Causing error") - } - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - script { - load("${autobuilder.commonscripts()}/build/postactions.groovy").performFailedBuildActions() - } - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - script { - load("${autobuilder.commonscripts()}/build/postactions.groovy").performSuccessfulBuildActions() - } - } - } -} diff --git a/Common_scripts/check/build_meta.groovy b/Common_scripts/check/build_meta.groovy deleted file mode 100644 index fb8a75d..0000000 --- a/Common_scripts/check/build_meta.groovy +++ /dev/null @@ -1,87 +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() - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive("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 4b8a89e..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.metainfo.componentversionuniqueidentifier() - def offsetpath = entry.accumulatedpath - 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.accumulatedpath - 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 be7569d..0000000 --- a/Common_scripts/checksum/utils.groovy +++ /dev/null @@ -1,15 +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) { - echo "Checksumming: ${file.path}" - 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 38f80fa..0000000 --- a/Common_scripts/commandline/commandline.groovy +++ /dev/null @@ -1,12 +0,0 @@ -String getCommandOutput(String cmd) { - if (isUnix()) { - return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim() - } else { - return powershell(returnStdout: true, script: """ - ${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) - - return registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) -} - -return this diff --git a/Common_scripts/configuration/tools.groovy b/Common_scripts/configuration/tools.groovy deleted file mode 100644 index dbaeedb..0000000 --- a/Common_scripts/configuration/tools.groovy +++ /dev/null @@ -1,59 +0,0 @@ -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - -class ToolOptions { - def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo) - - String m_toolName - - String m_gitURL - String m_revision - String m_repoRoot - int m_cloneDepth - boolean m_shallowClone - - ToolOptions(script) { - m_script = script - m_gitURL = '-' - m_revision = '-' - m_repoRoot = '' - m_cloneDepth = 1 - m_shallowClone = true - } - - void toolName(String name) { - m_toolName = name.trim() - } - - void toolRepo(String gitURL, String revision) { - m_gitURL = gitURL.trim() - m_revision = revision.trim() - } - - void repoRoot(String root) { - m_repoRoot = root.trim() - } - - void clonedepth(int depth) { - m_cloneDepth = depth - } - - void shallowclone(boolean shallow) { - m_shallowClone = shallow - } -} - -ToolOptions getNewToolOptions() { - return new ToolOptions(this) -} - -def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) { - meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA) -} - -def getTool(meta, ToolOptions options, String targetDir) { - gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone) - - registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_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 24aacfb..0000000 --- a/Common_scripts/copy/all.groovy +++ /dev/null @@ -1,67 +0,0 @@ -pipeline { - agent { label AGENT_LABEL } - stages { - stage('Initial setup') { - steps { - script { - // Force workspace to be cleaned - CLEAN_WORKSPACE = "true" - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - } - } - } - stage('Import source artifacts') { - steps { - script { - 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, "${WORKSPACE}/.") - } - } - } - stage('Archiving artifacts') { - steps { - script { - // Save the imported meta - while the unwanted meta is written to file then deleted - def stashname = 'Imported meta stash' - stash(allowEmpty: true, - includes: 'meta/**', - name: stashname, - useDefaultExcludes: false) - - def artifactlist = meta.generateartifacts(['**/*']) - cleaner.clean(['meta', 'autobuild']) - - unstash(name: stashname) - - artifactarchiver.archive(meta, artifactlist) - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} diff --git a/Common_scripts/copy/esw.groovy b/Common_scripts/copy/esw.groovy deleted file mode 100644 index b9eb737..0000000 --- a/Common_scripts/copy/esw.groovy +++ /dev/null @@ -1,67 +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 { - def eswimportoptions = importer.getNewImportOptions() - eswimportoptions.source(ESW_ARTIFACT_LOCATION, ESW_ARTIFACT_BUILD_JOB, ESW_ARTIFACT_BUILD_SELECTOR, ESW_ARTIFACT_RELEASE_REPO, ESW_ARTIFACT_RELEASE_REVISION) - eswimportoptions.setincrementversionnumber(true) - importer.artifactimport(meta, eswimportoptions, ESWDEST) - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts(["${ESWEXPORT}/**"]) - sh """ - rm -v -rf diff - rm -v -rf meta - mv -v "${ESW}"/* . - """ - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(meta, 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 3ad24cd..0000000 --- a/Common_scripts/copy/filtered.groovy +++ /dev/null @@ -1,73 +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 { - def importoptions = importer.getNewImportOptions() - importoptions.source(ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION) - importer.artifactimport(meta, importoptions, 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/**"]) - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(meta, 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 db9dbc3..0000000 --- a/Common_scripts/copy/logic.groovy +++ /dev/null @@ -1,79 +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 { - LOGICDEST = 'logic' - cleanfolders = [ - LOGICDEST, - "${WORKSPACE}/embedded_logic", - "${WORKSPACE}/el", - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Import source artifacts') { - steps { - script { - 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) - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts(['**/*']) - def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - - cleaner.clean(['meta', 'autobuild']) - - dir(LOGICDEST) { - fileOperations([ - fileCopyOperation(excludes: '', - flattenFiles: false, - includes: '**/*', - targetLocation: WORKSPACE) - ]) - } - - cleaner.clean([LOGICDEST]) - - artifactarchiver.archive(meta, artifactlist) - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} 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 3b25798..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 accumulatedpath = relatedmetainfo.accumulatedpath - info += "Name: ${key}\t\t\t\tPath: ${accumulatedpath}\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].metainfo - def latermeta = latermetaitems[key].metainfo - - 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, '', earlymetafolder) - def latermetaitems = latermeta.releasewalkerunique(md, '', latermetafolder) - - 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 ee1b8b3..0000000 --- a/Common_scripts/differences/file.groovy +++ /dev/null @@ -1,24 +0,0 @@ -def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { - echo "Comparing file: ${importedfile} with: ${currentfile} option: ${ignorewhitespace}" - def wsparameter = "-w" - if (!ignorewhitespace) { - wsparameter = "" - } - if (isUnix()) { - sh """ - diff -c ${wsparameter} "${importedfile}" "${currentfile}" - """ - } - else { - // diffutils can be installed on windows with chocolatey - powershell """ - # echo Checking utilities exist - # where diff - # if errorlevel 1 EXIT /b 1 - - diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}" - """ - } -} - -return this; diff --git a/Common_scripts/differences/json.groovy b/Common_scripts/differences/json.groovy deleted file mode 100644 index dbf47b8..0000000 --- a/Common_scripts/differences/json.groovy +++ /dev/null @@ -1,51 +0,0 @@ -def comparefiles(importedjsonfile, currentjsonfile) { - echo "Comparing json file: ${importedjsonfile} with: ${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 { - // Jq and diffutils can be installed on windows with chocolatey - powershell """ - # echo Checking utilities exist - # set - # echo %PATH% - try { - if (Get-Command jq) {} - } - catch { - echo "jq is unavailable" - exit \$false - } - try { - if (Get-Command diff) {} - } - catch { - echo "diff is unavailable" - exit \$false - } - - # echo Sorting json in files to compare - # jq -S sorts json output - jq -S . "${importedjsonfile}" > temp1.txt - if (\$lastexitcode -ge 1) { exit 1 } - jq -S . "${currentjsonfile}" > temp2.txt - if (\$lastexitcode -ge 1) { exit 1 } - - # echo Diffing sorted json files - diff.exe -c temp1.txt temp2.txt - \$lec = \$lastexitcode - - Remove-Item temp1.txt - Remove-Item temp2.txt - - if (\$lec -ge 1) { exit 1 } - """ - } -} - -return this; diff --git a/Common_scripts/differences/metahierarchy.groovy b/Common_scripts/differences/metahierarchy.groovy deleted file mode 100644 index 01c1890..0000000 --- a/Common_scripts/differences/metahierarchy.groovy +++ /dev/null @@ -1,102 +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() - - def earlyimportoptions = importer.getNewImportOptions() - earlyimportoptions.source(EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION) - earlyimportoptions.setincrementversionnumber(false) - earlyimportoptions.setfilter('meta/**') - importer.artifactimport(meta, earlyimportoptions, EARLYROOTDIR) - - def laterimportoptions = importer.getNewImportOptions() - laterimportoptions.source(LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION) - laterimportoptions.setincrementversionnumber(false) - laterimportoptions.setfilter('meta/**') - importer.artifactimport(meta, laterimportoptions, LATERROOTDIR) - } - } - } - 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() - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive("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 5054c02..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/hardware/sominfo.groovy b/Common_scripts/hardware/sominfo.groovy deleted file mode 100644 index 72a3ca9..0000000 --- a/Common_scripts/hardware/sominfo.groovy +++ /dev/null @@ -1,80 +0,0 @@ -def sominfostore = null - -/* Example expected JSON -{ - "SomType": { - "Som_BA4": { - "Artifact info": { - "Location": "Jenkins job artifact", - "Job": "HMB_FD_HV_0.9.6/0.9.6_SG1024_EL_syn_ba4", - "Job selector": "true", - "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_logic_ba4.git", - "Release repo revision": "" - } - }, - "Som_FC5": { - "Artifact info": { - "Location": "Jenkins job artifact", - "Job": "HMB_FD_HV_0.9.6/0.9.6_SG1024_EL_syn_fc5", - "Job selector": "true", - "Release repo": "git@hydra:hmb_fd_hv-releases/sg1024/hmb_fd_hv_logic_fc5.git", - "Release repo revision": "" - } - } - } -} -*/ - -def String asJsonText() { - return writeJSON(returnText: true, json: sominfostore, pretty: 1) -} - -def boolean exists() { - return (sominfostore != null) -} - -def set(String jsontext) { - sominfostore = readJSON(text: jsontext) - echo "Som support info:\n${asJsonText()}" -} - -def get() { - return sominfostore -} - -def somtypes() { - return sominfostore['SomType'] -} - -def artifactinfo(somtype) { - return somtype['Artifact info'] -} - -def artifactlocation(artifactinfo) { - return artifactinfo['Location'] -} - -def boolean isjoblocation(artifactinfo) { - return (artifactinfo['Location'] == 'Jenkins job artifact' || - artifactinfo['Location'] == 'Jenkins job artefact') -} - -def boolean isreleaserepolocation(artifactinfo) { - return artifactinfo['Location'] == 'Release repository' -} - -def artifactjob(artifactinfo) { - return [ - "name": artifactinfo['Job'], - "selector": "${artifactinfo['Job selector']}" - ] -} - -def releaserepo(artifactinfo) { - return [ - "repo": artifactinfo['Release repo'], - "revision": artifactinfo['Release repo revision'] - ] -} - -return this \ No newline at end of file diff --git a/Common_scripts/import/importer.groovy b/Common_scripts/import/importer.groovy deleted file mode 100644 index fa32ebf..0000000 --- a/Common_scripts/import/importer.groovy +++ /dev/null @@ -1,408 +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 - - boolean m_showdetails - - 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, - showdetails = false) { - 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 - m_showdetails = showdetails - } - - String show() { - return """m_incrementversionnumber: ${m_incrementversionnumber} - m_filter: ${m_filter} - m_excludes: ${m_excludes} - m_fingerprint: ${m_fingerprint} - m_nested: ${m_nested} - m_flatten: ${m_flatten} - m_includemetainfilter: ${m_includemetainfilter} - m_clean: ${m_clean} - m_appendtoparentmeta: ${m_appendtoparentmeta} - m_sourceselect: ${m_sourceselect} - m_jobname: ${m_jobname} - m_buildnumberorselector: ${m_buildnumberorselector} - m_repo: ${m_repo} - m_revision: ${m_revision} - """ - } - - void setsourceselect(String sourceselect) { - 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: - m_script.error("Unknown type of artifact source select: ${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 = [ - $class: 'ParameterizedBuildSelector', - parameterName: buildnumberorselector - ] - setsourceselect('Jenkins job artifact') - } - - void jenkinsjob(String jobname, int buildnumberorselector) { - m_jobname = jobname.trim() - m_buildnumberorselector = [ - $class: 'ParameterizedBuildSelector', - parameterName: "${buildnumberorselector}" - ] - 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) - } - - void showdetails(boolean showdetails) { - m_showdetails = showdetails - } -} - -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 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) - - echo "Build selector type: ${importoptions.m_buildnumberorselector.getClass()}" - echo "Importing artifacts from job: ${importoptions.m_jobname} selector: ${importoptions.m_buildnumberorselector.toString()}" - copyArtifacts( - filter: formFilter(importoptions), - excludes: importoptions.m_excludes, - fingerprintArtifacts: importoptions.m_fingerprint, - projectName: importoptions.m_jobname, - selector: 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 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)) - - echo "Getting associated metadata from path: ${destpath}" - def collectedmetalist = importedmeta.getassociated(destpath) - for(def collectedmeta in collectedmetalist) { - echo "Collection meta item: ${collectedmeta.metainfo.componentversionuniqueidentifier()} offset path: ${collectedmeta.accumulatedpath}" - } - - echo "Cloning associated repos inside path: ${destpath}" - for(def collectedmeta in collectedmetalist) { - def relatedmeta = collectedmeta.metainfo - def relatedoffsetpath = collectedmeta.accumulatedpath - def cloneurl = relatedmeta.releaseinfo.releaserepoURL - def clonerevision = "refs/tags/${relatedmeta.releasetag()}" - def clonepath = "${destpath}/${relatedoffsetpath}" - if (relatedmeta.componentidentifier() != '_' && - cloneurl != '') { - 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) - } else { - echo "Not importing component that would be placed at path: ${clonepath}" - } - } - 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 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 importoptions, String destpath) { - if (importoptions.m_showdetails) { - echo "Importing artifacts:\nImport options:\n${importoptions.show()}\nto: ${destpath}" - } - switch (importoptions.m_sourceselect) { - case 'Jenkins job artifact': - case 'Jenkins job artefact': - 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 = importer.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 = importer.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 = importer.getNewImportOptions() - - importoptions.jenkinsjob(buildjob, buildnumberorselector) - importoptions.setincrementversionnumber(incrementversionnumber) - importoptions.setfilter(filter) - importoptions.setexcludes(excludes) - importoptions.setfingerprint(fingerprint) - - return artifactimport(meta, importoptions, destpath) -} - -// Import the artifacts of a named child component found below parent meta's hierarchy -def artifactimport(meta, - parentmeta, - String parentmetapath, - String childproduct, - String childsubcomponent, - ImportOptions importoptions, - String destinationfolder) { - // Import from parent meta - def childmeta = meta.getNewMetaObject() - def childmeta2 - echo "Finding meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}" - echo "From parent meta identifier: ${parentmeta.componentidentifier()} and parent meta path: ${parentmetapath}" - def findresults = parentmeta.findAssociatedMeta(parentmetapath, childproduct, childsubcomponent) - if (findresults.matchfound) { - childmeta = findresults.matchedmetaitem.metainfo - if (importoptions.m_sourceselect == 'Release repository' || childmeta.releaseinfo.released) { - importoptions.releaserepo(childmeta.releaseinfo.releaserepoURL, childmeta.releasetag()) - } else { - importoptions.jenkinsjob(childmeta.jenkinsbuildinfo.buildjobname, childmeta.jenkinsbuildinfo.buildnumber) - } - childmeta2 = importer.artifactimport(meta, importoptions, destinationfolder) - } else { - error("Could not find meta associated with child: Product: ${childproduct} Sub-component: ${childsubcomponent}") - } - return childmeta2 -} - -return this; diff --git a/Common_scripts/install/installhelper.groovy b/Common_scripts/install/installhelper.groovy deleted file mode 100644 index 8dbf23e..0000000 --- a/Common_scripts/install/installhelper.groovy +++ /dev/null @@ -1,136 +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, toBuild, artifactDetails, installerDetails, boolean showdetails = false) { - artifactFetched = [:] - - if (showdetails) { - echo ("toBuild:\n${toBuild}\nartifactDetails:\n${artifactDetails}\ninstallerDetails:\n${installerDetails}") - } - def importoptions = importer.getNewImportOptions() - importoptions.showdetails(showdetails) - for (installer in toBuild) { - def installerinfo = installerDetails.get(installer) - if (showdetails) { - echo ("installer:\n${installer}\ninstallerinfo:\n${installerinfo}") - } - def artifactKeys = installerinfo[1] - if (artifactKeys instanceof java.lang.String) { - artifactKeys = [ artifactKeys ] - } - if (showdetails) { - echo ("artifactKeys:\n${artifactKeys}") - } - for (artifactKey in artifactKeys) { - artifactDetail = artifactDetails.get(artifactKey) - if (showdetails) { - echo ("artifactKey: ${artifactKey}\nartifactDetail:\n${artifactDetail}") - } - (sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetail - if (artifactFetched.get(artifactKey) == null) { - importoptions.jenkinsjob(sourceProject, sourceselector) - importoptions.setincrementversionnumber(incrementversionnumber) - importoptions.setfilter(toCopy) - importoptions.setexcludes(notToCopy) - - def importmeta = importer.artifactimport(meta, importoptions, destFolder) - artifactFetched.put(artifactKey, importmeta) - } - } - } - if (showdetails) { - echo ("artifactFetched:\n${artifactFetched}") - } - 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) - //echo "ISM file xml: ${xml}" - (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 6715145..0000000 --- a/Common_scripts/meta/folder.groovy +++ /dev/null @@ -1,1193 +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 { - private String format - private String productname - private String subcomponentname - private String variant - private String uniqueid - - ProductInfo(script, String productname = '', String subcomponentname = '', String variant = '') { - super(script) - this.format = '0.1' - this.productname = productname - this.subcomponentname = subcomponentname - this.variant = variant - this.uniqueid = UUID.randomUUID().toString() - } - - 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()) { - pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) - } - else { - pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" 2>&1>\$null", , 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.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" 2>&1>\$null", , 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") - } - if (variant) { - def int vstatus = 0 - if (script.isUnix()) { - vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) - } - else { - vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" 2>&1>\$null", , returnStatus: true) - } - if (vstatus > 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 set(ProductInfo otherinfo) { - this.productname = otherinfo.productname - this.subcomponentname = otherinfo.subcomponentname - this.variant = otherinfo.variant - this.uniqueid = otherinfo.uniqueid - } - - void deserialiseJson(rawmeta) { - //format = rawmeta['format'] - productname = rawmeta['productname'] - subcomponentname = rawmeta['subcomponentname'] - variant = rawmeta['variant'] ?: '' - uniqueid = rawmeta['uniqueid'] ?: uniqueid - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - 'productname' : productname, - 'subcomponentname' : subcomponentname, - 'variant' : variant, - 'uniqueid': uniqueid, - ] - return data - } -} - -class GitInfo extends GISJsonSerialised { - private String format - 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.format = '0.1' - this.sourcepath = sourcepath - this.sourcerevision = sourcerevision - this.gitrevision = gitrevision - this.remoteurl = remoteurl - this.remoteinfo = remoteinfo - } - - GitInfo(GitInfo another) { - super(another.script) - this.sourcepath = another.sourcepath - this.sourcerevision = another.sourcerevision - this.gitrevision = another.gitrevision - this.remoteurl = another.remoteurl - this.remoteinfo = another.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 set(GitInfo otherinfo) { - this.sourcepath = otherinfo.sourcepath - this.sourcerevision = otherinfo.sourcerevision - this.gitrevision = otherinfo.gitrevision - this.remoteurl = otherinfo.remoteurl - this.remoteinfo = otherinfo.remoteinfo - } - - void deserialiseJson(rawmeta) { - //format = rawmeta['format'] - sourcepath = rawmeta['sourcepath'] - sourcerevision = rawmeta['sourcerevision'] - gitrevision = rawmeta['gitrevision'] - remoteurl = rawmeta['remoteurl'] - remoteinfo = rawmeta['remoteinfo'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - 'sourcepath' : sourcepath, - 'sourcerevision' : sourcerevision, - 'gitrevision' : gitrevision, - 'remoteurl' : remoteurl, - 'remoteinfo' : remoteinfo, - ] - return data - } -} - -class JenkinsBuildParameter extends GISJsonSerialised { - private String name - private String valuetype - private String value - - JenkinsBuildParameter(script, String name = '', String valuetype = '', String value = '') { - super(script) - this.name = name - this.valuetype = valuetype - this.value = value - } - - void set(String name, String valuetype, String value) { - this.name = name - this.valuetype = valuetype - this.value = value - } - - void deserialiseJson(rawmeta) { - name = rawmeta['name'] - valuetype = rawmeta['valuetype'] - value = rawmeta['value'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'name' : name, - 'valuetype' : valuetype, - 'value' : value, - ] - return data - } -} - -class JenkinsBuildInfo extends GISJsonSerialised { - private String format - private String buildjobname - private int buildnumber - private String buildmachine - private String builddate - private ArrayList parameters - private boolean isfullbuild - - JenkinsBuildInfo(script, String buildjobname = '', int buildnumber = 0, String buildmachine = '', String builddate = '', boolean isfullbuild = true) { - super(script) - this.format = '0.1' - this.buildjobname = buildjobname - this.buildnumber = buildnumber - this.buildmachine = buildmachine - this.builddate = builddate - this.isfullbuild = isfullbuild - parameters = new ArrayList() - } - - void set(String buildjobname, int buildnumber, String buildmachine, String builddate, boolean isfullbuild = true) { - this.buildjobname = buildjobname - this.buildnumber = buildnumber - this.buildmachine = buildmachine - this.builddate = builddate - this.isfullbuild = isfullbuild - } - - void set(boolean isfullbuild) { - this.isfullbuild = isfullbuild - } - - boolean isFullBuild() { - return isfullbuild - } - - void addParameter(String name, value) { - def p = new JenkinsBuildParameter(script, name, value.getClass().toString(), value.toString()) - parameters.add(p) - return p - } - - void deserialiseJson(rawmeta) { - //format = rawmeta['format'] - buildjobname = rawmeta['buildjobname'] - buildnumber = rawmeta['buildnumber'] - buildmachine = rawmeta['buildmachine'] - builddate = rawmeta['builddate'] - isfullbuild = (rawmeta['isfullbuild'] == null) ? true : rawmeta['isfullbuild'] - parameters = new ArrayList() - if (rawmeta['isfullbuild'] != null) { - for (rawparameter in rawmeta['parameters']) { - def p = new JenkinsBuildParameter(script) - p.deserialiseJson(rawparameter) - parameters.add(p) - } - } - } - - List parametersserialised() { - def associated = [] - for (p in parameters) { - associated.add(p.serialisationdata()) - } - return associated - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - 'buildjobname' : buildjobname, - 'buildnumber' : buildnumber, - 'buildmachine' : buildmachine, - 'builddate' : builddate, - 'isfullbuild' : isfullbuild, - 'parameters' : parametersserialised(), - ] - return data - } -} - -class BuildStampInfo extends GISJsonSerialised { - private String format - private String buildstampprefix - private int revision - private String buildstamp - - BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") { - super(script) - this.format = '0.1' - this.buildstampprefix = buildstampprefix - this.revision = revision - this.buildstamp = buildstamp - } - - BuildStampInfo(BuildStampInfo another) { - super(another.script) - this.buildstampprefix = another.buildstampprefix - this.revision = another.revision - this.buildstamp = another.buildstamp - } - - void set(String buildstampprefix, int revision, String buildstamp) { - this.buildstampprefix = buildstampprefix - this.revision = revision - this.buildstamp = buildstamp - } - - void set(BuildStampInfo other) { - set(other.buildstampprefix, other.revision, other.buildstamp) - } - - // Override the buildstamp - void override(String buildstamp) { - this.buildstamp = buildstamp - script.echo("Build stamp overridden to: ${this.buildstamp}") - def s = this.buildstamp.split('\\.') - if (s.size() != 4) { - script.error("Overriding build stamp: ${buildstamp} is not of the format: 1.2.3.4") - } - this.buildstampprefix = "${s[0]}.${s[1]}.${s[2]}" - script.echo("Stamp prefix overridden to: ${this.buildstampprefix}") - this.revision = s[3].toInteger() - script.echo("Revision overridden to: ${this.revision}") - } - - 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) { - //format = rawmeta['format'] - buildstampprefix = rawmeta['buildstampprefix'] - revision = rawmeta['revision'] - buildstamp = rawmeta['buildstamp'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - 'buildstampprefix' : buildstampprefix, - 'revision' : revision, - 'buildstamp' : buildstamp, - ] - return data - } -} - -class ReleaseInfo extends GISJsonSerialised { - private String format - private String releaserepoURL - private ArrayList releaseitems - private boolean released - - ReleaseInfo(script, String releaserepoURL = '', boolean released = false) { - super(script) - this.format = '0.1' - 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) { - //format = rawmeta['format'] - releaserepoURL = rawmeta['releaserepoURL'] - releaseitems = new ArrayList() - for (rawreleaseitem in rawmeta['releaseitems']) { - releaseitems.add(rawreleaseitem) - } - released = rawmeta['released'] ?: false - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - '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 format - private String artifactpath - private ArrayList checksumpairs - - ChecksumSet(script, artifactpath = '') { - super(script) - this.format = '0.1' - 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) { - //format = rawmeta['format'] - 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 = [ - 'format' : format, - '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 format - private String filepath - - PublishableInfo(script, String filepath = '') { - super(script) - this.format = '0.1' - this.filepath = filepath - } - - void deserialiseJson(rawmeta) { - //format = rawmeta['format'] - filepath = rawmeta['filepath'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - 'filepath' : filepath, - ] - return data - } -} - -class MetaInfo extends GISJsonSerialised { - private static String METAFOLDERNAME = 'meta' - private static String METAFILENAME = 'info.json' - private static String METAARTIFACTS = "${METAFOLDERNAME}/**" - private static String format = '0.2' - - abstract class RelatedMetaInfo extends GISJsonSerialised { - String format - - RelatedMetaInfo(script, format) { - super(script) - this.format = format - } - - abstract void deserialiseJson(rawmeta) - abstract LinkedHashMap serialisationdata() - abstract String getrelatedid() - abstract void markreleased() - } - - class RelatedMetaInfo_v0_1 extends RelatedMetaInfo { - private MetaInfo meta - private String offsetpath - private String uniqueid - - RelatedMetaInfo_v0_1(script, String offsetpath = '', MetaInfo meta = null, String uniqueid = UUID.randomUUID().toString()) { - super(script, '0.1') - this.offsetpath = offsetpath - this.uniqueid = uniqueid - this.meta = meta - } - - void deserialiseJson(rawmeta) { - offsetpath = rawmeta['offsetpath'] - uniqueid = rawmeta['uniqueid'] ?: uniqueid - meta = new MetaInfo(script) - meta.deserialiseJson(rawmeta['meta']) - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - 'offsetpath' : offsetpath, - 'uniqueid' : uniqueid, - 'meta' : meta.serialisationdata(), - ] - return data - } - - String getrelatedid() { - return uniqueid - } - - void markreleased() { - meta.releaseinfo.markreleased() - } - } - - class RelatedMetaInfo_v0_2 extends RelatedMetaInfo { - private String importpath - private String offsetpath - private String uniqueid - - RelatedMetaInfo_v0_2(script, String importpath = '', String offsetpath = '', String uniqueid = UUID.randomUUID().toString()) { - super(script, '0.2') - this.importpath = importpath - this.offsetpath = offsetpath - this.uniqueid = uniqueid - } - - void deserialiseJson(rawmeta) { - //format = rawmeta['format'] - offsetpath = rawmeta['offsetpath'] - uniqueid = rawmeta['uniqueid'] - } - - LinkedHashMap serialisationdata() { - def data = [ - 'format' : format, - 'offsetpath' : offsetpath, - 'uniqueid' : uniqueid - ] - return data - } - - String getrelatedid() { - return uniqueid - } - - void markreleased() { - // Do nothing - } - } - - private ProductInfo productinfo - private GitInfo gitinfo - private JenkinsBuildInfo jenkinsbuildinfo - private BuildStampInfo buildstampinfo - private ReleaseInfo releaseinfo - private 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() - } - - void markreleased() { - script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released") - releaseinfo.markreleased() - for (associated in associatedmeta) { - associated.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) - return ci - } - - void addCustomInfo(String customId, String customValue) { - custominfo.put(customId.trim(), customValue) - } - - String getCustomInfo(String customId) { - return custominfo.getAt(customId.trim()) - } - - def isFullBuild() { - return jenkinsbuildinfo.isFullBuild() - } - - 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'].toString() != '0.1' && rawmeta['format'].toString() != '0.2' ) { - script.error("Unsupported meta format found") - 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']) { - if (!rawrelatedmeta['format'] || rawrelatedmeta['format'] == '0.1') { - def rm = new RelatedMetaInfo_v0_1(script) - rm.deserialiseJson(rawrelatedmeta) - associatedmeta.add(rm) - } else if (rawrelatedmeta['format'] == '0.2') { - def rm = new RelatedMetaInfo_v0_2(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)) { - script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})") - mi.deserialiseJson(importedmetafile) - - RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath, mi.productinfo.uniqueid) - if (appendtoparentmeta) { - associatedmeta.add(rmi) - } - } else { - script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist") - addConfigurationInfo('', givenRepo, givenRevision, givenSHA) - } - return mi - } - - def copyrelatedmeta() { - script.echo("Copying related input meta data to output meta") - for (relatedmetainfo in associatedmeta) { - def srcpath = "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" - def destpath = "${METAFOLDERNAME}/${relatedmetainfo.offsetpath}" - script.echo("Copying related meta folder: ${srcpath} to meta output folder: ${destpath} recursively") - script.fileOperations([ - script.folderCreateOperation(folderPath: destpath), - script.folderCopyOperation(sourceFolderPath: srcpath, destinationFolderPath: destpath) - ]) - } - } - - 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 - } - - def 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 - } - - 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 - } - - class CollectedMeta { - private MetaInfo metainfo - private String accumulatedpath - private String accumulatedmetapath - - CollectedMeta(MetaInfo metainfo, String accumulatedpath = '', String accumulatedmetapath = '') { - this.metainfo = metainfo - this.accumulatedpath = accumulatedpath - this.accumulatedmetapath = accumulatedmetapath - } - } - - class IterationInfo { - private ArrayList metacollection - private Map metamap - private String comment - private int level - private String gatheredpath - private String gatheredmetapath - private boolean limiteddepth - private int maxdepth - - IterationInfo(ArrayList metacollection, - Map metamap, - String comment = '', - int level = 0, - String gatheredpath = '', - String gatheredmetapath = '', - boolean limiteddepth = false, - int maxdepth = 0) { - this.metacollection = metacollection - this.metamap = metamap - this.comment = comment - this.level = level - this.gatheredpath = gatheredpath - this.gatheredmetapath = gatheredmetapath - this.limiteddepth = limiteddepth - this.maxdepth = maxdepth - } - - String show() { - return "Iteration:\nLevel: ${level}\nGathered path: ${gatheredpath}\nGathered meta path: ${gatheredmetapath}\nLimited depth: ${limiteddepth}\nMax depth: ${maxdepth}" - } - - void add(CollectedMeta item) { - metacollection.add(item) - metamap.put(item.metainfo.productinfo.uniqueid, item) - } - } - - def openchildmeta(IterationInfo ii, RelatedMetaInfo relatedmetainfo) { - def MetaInfo mi = new MetaInfo(script) - - def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") - def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? "${relatedmetainfo.offsetpath}/${METAFOLDERNAME}" : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") - def importedmetafile = "${nextgatheredmetapath}/${METAFILENAME}" - def boolean imported - // If this has already been read in from a file - if (relatedmetainfo.getrelatedid() in ii.metamap) { - //script.echo("Already read in meta associated with uniqueid: ${relatedmetainfo.getrelatedid()} - Using it") - mi = ii.metamap[relatedmetainfo.getrelatedid()].metainfo - imported = true - } else if (script.fileExists(importedmetafile)) { - mi.deserialiseJson(importedmetafile) - imported = true - } else { - script.echo("Could not deserialise meta at file: ${importedmetafile} - Does not exist") - imported = false - } - - def childmetainfo = [ - 'imported': imported, - 'nextgatheredpath': nextgatheredpath, - 'nextgatheredmetapath': nextgatheredmetapath, - 'childmeta': mi - ] - return childmetainfo - } - - def walkrelated_v0_1(IterationInfo ii) { - //script.echo("Walk related v0.1: ${ii.show()}") - if (!ii.limiteddepth || ii.maxdepth > 0) { - ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) - ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' - for (relatedmetainfo in associatedmeta) { - if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { - def MetaInfo othermeta = relatedmetainfo.meta - def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") - def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") - def nextii = new IterationInfo(ii.metacollection, - ii.metamap, - ii.comment, - ii.level + 1, - nextgatheredpath, - nextgatheredmetapath, - ii.limiteddepth, - ii.maxdepth - 1) - def results = othermeta.walkrelated_v0_1(nextii) - ii.metacollection = results.metacollection - ii.metamap = results.metamap - ii.comment = results.comment - } else { - script.error("There is non v0.1 format related meta info under v0.1 related meta info") - } - } - } - return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ] - } - - def walkrelated(IterationInfo ii) { - //script.echo("Walk related: ${ii.show()}") - if (!ii.limiteddepth || ii.maxdepth > 0) { - ii.add(new CollectedMeta(this, ii.gatheredpath, ii.gatheredmetapath)) - ii.comment += "${ii.level} ".padRight(ii.level * 4) + globalreleasetag() + '\n' - for (relatedmetainfo in associatedmeta) { - //script.echo("Related meta info: ${relatedmetainfo.offsetpath} format: ${relatedmetainfo.format}") - if (relatedmetainfo.format == '0.2') { - def childmetainfo = openchildmeta(ii, relatedmetainfo) - if (childmetainfo.imported) { - def nextii = new IterationInfo(ii.metacollection, - ii.metamap, - ii.comment, - ii.level + 1, - childmetainfo.nextgatheredpath, - childmetainfo.nextgatheredmetapath, - ii.limiteddepth, - ii.maxdepth - 1) - def results = childmetainfo.childmeta.walkrelated(nextii) - ii.metacollection = results.metacollection - ii.metamap = results.metamap - ii.comment = results.comment - } - } else if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') { - def MetaInfo othermeta = relatedmetainfo.meta - def String nextgatheredpath = (ii.gatheredpath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredpath}/${relatedmetainfo.offsetpath}") - def String nextgatheredmetapath = (ii.gatheredmetapath == '' ? relatedmetainfo.offsetpath : "${ii.gatheredmetapath}/${relatedmetainfo.offsetpath}") - def nextii = new IterationInfo(ii.metacollection, - ii.metamap, - ii.comment, - ii.level + 1, - nextgatheredpath, - nextgatheredmetapath, - ii.limiteddepth, - ii.maxdepth - 1) - def results = othermeta.walkrelated_v0_1(nextii) - ii.metacollection = results.metacollection - ii.metamap = results.metamap - ii.comment = results.comment - } - } - } - return [ 'metacollection' : ii.metacollection, 'metamap' : ii.metamap, 'comment': ii.comment ] - } - - // Walks all layers of associated data only - def allrelatedmeta(String metapath = '') { - def ArrayList metacollection = new ArrayList() - def Map metamap = new LinkedHashMap() - return walkrelated(new IterationInfo(metacollection, metamap, '', 0, '', metapath)) - } - - ArrayList releasewalker(int maxdepth, String startpath = '', String startmetapath = '') { - def ArrayList metacollection = new ArrayList() - def Map metamap = new LinkedHashMap() - def IterationInfo ii = new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth) - script.echo("Release walker iteration info at start:\n${ii.show()}") - def results = walkrelated(ii) - return results.metacollection - } - - // Walks 1 layer of associated data only - def getassociated(String rootpath) { - return releasewalker(2, '', "${rootpath}/${METAFOLDERNAME}") // Max depth 2 (including itself) - } - - Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, CollectedMeta metaitem) { - if (releasemetacollection.containsKey(uniquestring)) { - def existingentry = releasemetacollection[uniquestring] - def existingentrypathlength = existingentry.accumulatedpath.split('/').size() - def newentrypathlength = metaitem.accumulatedpath.split('/').size() - if (existingentrypathlength > newentrypathlength) { - releasemetacollection.put(uniquestring, metaitem) - } - } else { - releasemetacollection.put(uniquestring, metaitem) - } - return releasemetacollection - } - - Map releasewalkerversionunique(int maxdepth, String startpath = '', String startmetapath = '') { - def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}") - - def Map versionuniquecollection = new LinkedHashMap() - for (metaitem in metacollection) { - def String uniquestring = metaitem.metainfo.componentversionuniqueidentifier() - versionuniquecollection = putwithshortestoffsetpath(versionuniquecollection, uniquestring, metaitem) - } - - return versionuniquecollection - } - - Map releasewalkerunique(int maxdepth, String startpath = '', String startmetapath = '') { - def ArrayList metacollection = releasewalker(maxdepth, startpath, "${startmetapath}/${METAFOLDERNAME}") - - def Map uniquecollection = new LinkedHashMap() - for (metaitem in metacollection) { - def String uniquestring = metaitem.metainfo.componentidentifier() - uniquecollection = putwithshortestoffsetpath(uniquecollection, uniquestring, metaitem) - } - - return uniquecollection - } - - MetaInfo getNewMetaObject(script) { - return new MetaInfo(script) - } - - def findAssociatedMeta(String parentmetapath, String productname, String subcomponentname) { - def results = [ - 'matchedmetaitem' : new CollectedMeta(this), - 'matchfound' : false - ] - def walkresults = allrelatedmeta("${parentmetapath}/${METAFOLDERNAME}") - for (dependentmetaitem in walkresults.metacollection) { - script.echo("Comparing: ${dependentmetaitem.metainfo.productinfo.productname} ${dependentmetaitem.metainfo.productinfo.subcomponentname}") - if (dependentmetaitem.metainfo.productinfo.productname == productname && - dependentmetaitem.metainfo.productinfo.subcomponentname == subcomponentname) { - script.echo("Found matching component: ${dependentmetaitem.metainfo.globalreleasetag()}") - results.matchedmetaitem = dependentmetaitem - results.matchfound = true - break - } - } - return results - } -} - -MetaInfo metareset(script) { - def mi = new MetaInfo(script) - - echo "Resetting meta folder" - 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 9f2f4d3..0000000 --- a/Common_scripts/packaging/debian.groovy +++ /dev/null @@ -1,111 +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_KERNEL - String GIS_OPT_LOGIC - String GIS_OPT_PRINTHEAD - String GIS_OPT_BOOT - - 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, String inpackagepathsuffix) { - 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" + inpackagepathsuffix - GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + inpackagepathsuffix - GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + inpackagepathsuffix - GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + inpackagepathsuffix - GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + inpackagepathsuffix - GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" + inpackagepathsuffix - GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + inpackagepathsuffix - GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + inpackagepathsuffix - GIS_OPT_KERNEL = "${DEBPATH}/opt/gis/kernel" + inpackagepathsuffix - GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + inpackagepathsuffix - GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + inpackagepathsuffix - GIS_OPT_BOOT = "${DEBPATH}/opt/gis/boot" + inpackagepathsuffix - - USR_BIN = "${DEBPATH}/usr/bin" + inpackagepathsuffix - USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + inpackagepathsuffix - LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + inpackagepathsuffix - HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + inpackagepathsuffix - LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + inpackagepathsuffix - } -} - -def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') { - return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix) -} - -def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String credentials_id) { - withCredentials([usernamePassword(credentialsId: credentials_id, - usernameVariable: 'SUDO_USERNAME', - passwordVariable: 'SUDO_PASSWORD')]) { - def sudo_S = "echo ${SUDO_PASSWORD} | sudo -S" - def sudo_Sk = "echo ${SUDO_PASSWORD} | sudo -S -k" - try { - sh """#!/bin/bash - # Exit if any command fails - set -xe - - cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" - - ${sudo_Sk} 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_Sk} chown -R ${USER}: "${packagedefs.DEBPATH}" - """ - } - catch (Exception e) { - echo "Exception occurred" - sh """#!/bin/bash -v - ${sudo_Sk} 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 ea090f0..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.metainfo - 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.metainfo - 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 releasemetapath, 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, '', releasemetapath) - - 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 releasemetapath, String customer, String softwarerelease, String maxdepth) { - return publishhierarchy(hostedftpsiteinfo, releasemeta, releasemetapath, '', customer, softwarerelease, maxdepth) -} - -return this; diff --git a/Common_scripts/publish/package.groovy b/Common_scripts/publish/package.groovy deleted file mode 100644 index 68c41f3..0000000 --- a/Common_scripts/publish/package.groovy +++ /dev/null @@ -1,181 +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") - - def packageimportoptions = importer.getNewImportOptions() - packageimportoptions.jenkinsjob(PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR) - packageimportoptions.setincrementversionnumber(true) - packagemeta = importer.artifactimport(meta, packageimportoptions, 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 ce6a805..0000000 --- a/Common_scripts/publish/promptingpublish.groovy +++ /dev/null @@ -1,182 +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("superseded") && - !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, - SOURCEDIR, - 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, SOURCEDIR, selecteditems, customer, release, MAX_META_DEPTH) - if (markunstable) { - env.unstablereason = unstablereason - currentBuild.result = 'UNSTABLE' - } - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts() - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive("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 ad33df9..0000000 --- a/Common_scripts/publish/publish.groovy +++ /dev/null @@ -1,92 +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() - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive("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 9f6c368..0000000 --- a/Common_scripts/publish/publishitems.groovy +++ /dev/null @@ -1,129 +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 releasemetapath, - 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, '', releasemetapath) - 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.metainfo - - for (publishableitem in meta.publishableinfo) { - menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}") - } - } - - def outputSelection(menuitems, releaseinfo) { - def meta = releaseinfo.metainfo - - 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 releasemetapath, - 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, releasemetapath, 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 4dcb091..0000000 --- a/Common_scripts/release/do.groovy +++ /dev/null @@ -1,458 +0,0 @@ -gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - -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.metainfo.releaseinfo.releaseitems) { - def filterpath = artifactfilter - if (buildinfo.accumulatedpath) { - filterpath = buildinfo.accumulatedpath + '/' + artifactfilter - } - // Copy relevant artifacts to temp folder - echo "Copying artifacts: Filter path: ${filterpath} to ${tempfolder} from job: ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname} #${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" - 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.accumulatedpath - dir(originalrootdir) { - sh("mv -v * ${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)) { - echo "Tag added: ${tag} with sha: ${postcommitshacode}" - 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.metainfo - 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}" - - 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(String buildfolder, String metafolder, 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, buildfolder, metafolder) - 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, buildfolder, metafolder) - def String versionuniquecomponent = '' - def String versionwithpathscomponent = '' - for (key in componentReleaseInfoVersionUnique.keySet()) { - versionuniquecomponent += "${key}\n" - versionwithpathscomponent += "${key}: path: ${componentReleaseInfoVersionUnique[key].accumulatedpath} meta path: ${componentReleaseInfoVersionUnique[key].accumulatedmetapath}\n" - } - echo 'Version unique components:' - echo versionuniquecomponent - - echo 'Version unique components with paths:' - echo versionwithpathscomponent - - 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? (If you ignore this issue, you will get an error much later because the system cannot tag 2 different commits of the associated source code with the same label)" - } - } - - for (key in componentReleaseInfo.keySet()) { - def buildinfo = componentReleaseInfo[key] - if (!buildinfo.metainfo.jenkinsbuildinfo.isFullBuild()) { - error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)" - } - } - - def toplevelid = buildmeta.componentidentifier() - // For each component - for (key in componentReleaseInfo.keySet()) { - def buildinfo = componentReleaseInfo[key] - echo "Releasing component: ${buildinfo.metainfo.componentidentifier()}" - if (buildinfo.metainfo.componentidentifier() != '___' && buildinfo.metainfo.componentidentifier() != '_') { - 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 82af511..0000000 --- a/Common_scripts/release/release.groovy +++ /dev/null @@ -1,87 +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 { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - BUILD_ARTIFACTS = 'build' - - def importoptions = importer.getNewImportOptions() - importoptions.jenkinsjob(BUILD_JOB, BUILD_JOB_SELECTOR) - importoptions.setincrementversionnumber(false) - importoptions.setfilter('meta/**') - importoptions.setappendtoparentmeta(false) - buildmeta = importer.artifactimport(meta, importoptions, 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('', BUILD_ARTIFACTS, 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() - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive("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 ae91cb0..0000000 --- a/Common_scripts/staticanalysis/ccm.groovy +++ /dev/null @@ -1,85 +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() - - 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 { - SOURCEDIR = "${WORKSPACE}/source" - configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCE_REVISION, SOURCEDIR, '', 0, false) - } - } - } - stage("Clean exports") { - steps { - script { - RESULTS = 'results' - cleanfolders = [ - RESULTS, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage('Static analysis') { - steps { - script { - def ccmconfigurationfile = "${WORKSPACE}/ccm.xml" - writeFile(file: ccmconfigurationfile, text: CCM_CONFIGURATION) - echo "Configuration file: ${ccmconfigurationfile} contains:\n${CCM_CONFIGURATION}" - - dir(RESULTS) { - echo "Executing: ${CCM} ${ccmconfigurationfile} > ccm.xml" - if (isUnix()) { - sh """#!/bin/bash - ${CCM}" "${ccmconfigurationfile}" > ccm.xml - """ - } else { - echo "Executing: ${WINDOWS_COMMANDLINE_ENVIRONMENT} \"${CCM}\" \"${ccmconfigurationfile}\" > ccm.xml" - bat """ - ${WINDOWS_COMMANDLINE_ENVIRONMENT} "${CCM}" "${ccmconfigurationfile}" > ccm.xml - """ - } - } - recordIssues(tools: [ - ccm(pattern: "**/ccm.xml", reportEncoding: 'UTF-8'), - ]) - } - } - } - } - 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 c04649c..0000000 --- a/Common_scripts/staticanalysis/cpd.groovy +++ /dev/null @@ -1,152 +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) - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(meta, 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 d959770..0000000 --- a/Common_scripts/staticanalysis/cppcheck.groovy +++ /dev/null @@ -1,114 +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) - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(meta, artifactlist) - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} diff --git a/Common_scripts/test/testethernetproduct.groovy b/Common_scripts/test/testethernetproduct.groovy deleted file mode 100644 index 5e2ce53..0000000 --- a/Common_scripts/test/testethernetproduct.groovy +++ /dev/null @@ -1,204 +0,0 @@ -import jenkins.model.Jenkins - -pipeline { - agent { label AGENT_LABEL } - stages { - stage ("Initial Setup") { - steps{ - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) - } - } - } - stage ("Checkout test environment") { - steps { - script { - toolsimporter = load("${autobuilder.commonscripts()}/configuration/tools.groovy") - - def TEST_ENVIRONMENT_URL = 'git@hydra:gistest/jenkins-ethernet-test-environment.git' - def TEST_ENVIRONMENT_DIR = 'TestEnvironmentDir' - def TEST_ENVIRONMENT_REVISION = 'origin/master' - - def environmentoptions = toolsimporter.getNewToolOptions() - environmentoptions.toolName('Ethernet product test environment') - environmentoptions.toolRepo(TEST_ENVIRONMENT_URL, TEST_SOURCE_REVISION) - toolsimporter.getTool(meta, environmentoptions, TEST_ENVIRONMENT_DIR) - - TEST_ENVIRONMENT_FILE = "${TEST_ENVIRONMENT_DIR}/environment.json" - def alltestenvironment = readJSON(file: "${TEST_ENVIRONMENT_FILE}") - TEST_ENVIRONMENT = alltestenvironment[ETHERNET_PRODUCT_TO_RUN_TEST] - echo "Selected environment:\n${TEST_ENVIRONMENT}" - } - } - } - stage ('Setup') { - agent { label TEST_ENVIRONMENT['FTDI_AGENT'] } - stages { - stage ("Checkout dependencies") { - steps { - script { - def PYTHON_URL = 'git@hydra:tools/python.git' - if (isUnix()) { - PYTHON_REVISION = 'origin/3.6.3_linux' - } - else { - PYTHON_REVISION = 'origin/3.8.10_windows_for_test' - } - PYTHONDIR = "${WORKSPACE}/python" - - def pythonimportoptions = toolsimporter.getNewToolOptions() - pythonimportoptions.toolName('Python') - pythonimportoptions.toolRepo(PYTHON_URL, PYTHON_REVISION) - toolsimporter.getTool(meta, pythonimportoptions, PYTHONDIR) - if (isUnix()) { - env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" - } - else { - env.PYTHON = "${PYTHONDIR}/ver/python.exe" - } - - def TEST_SOURCE_URL = 'git@hydra:hmb_regression/hmb_tests.git' - TEST_SUITE_DIR = 'TestSuiteDir' - env.GIS_TEST_SUITE_HOME = "${WORKSPACE}/${TEST_SUITE_DIR}" - - def regressiontestimportoptions = toolsimporter.getNewToolOptions() - regressiontestimportoptions.toolName('Tests') - regressiontestimportoptions.toolRepo(TEST_SOURCE_URL, TEST_SOURCE_REVISION) - toolsimporter.getTool(meta, regressiontestimportoptions, GIS_TEST_SUITE_HOME) - - env.HISTORY_FOLDER = "${WORKSPACE}/testhistory" - - def resultimportoptions = toolsimporter.getNewToolOptions() - resultimportoptions.toolName('Test history') - resultimportoptions.toolRepo(HISTORY_REPO, HISTORY_REVISION) - toolsimporter.getTool(meta, resultimportoptions, HISTORY_FOLDER) - - def CORE_SOURCE_URL = 'git@hydra:gistest/giscorelite.git' - env.GIS_TEST_SUITE_CORE = "${WORKSPACE}/GisCore" - - def coreimportoptions = toolsimporter.getNewToolOptions() - coreimportoptions.toolName('Test core') - coreimportoptions.toolRepo(CORE_SOURCE_URL, CORE_SOURCE_REVISION) - toolsimporter.getTool(meta, coreimportoptions, GIS_TEST_SUITE_CORE) - - def FTDI_SOURCE_URL = 'git@hydra:python_scripts/ftdi_relay.git' - def FTDI_SOURCE_REVISION = 'origin/Core-98' - FTDI_SOURCE_DIR = "${WORKSPACE}/PowerController" - - def ftdiimportoptions = toolsimporter.getNewToolOptions() - ftdiimportoptions.toolName('FTDI relay driver') - ftdiimportoptions.toolRepo(FTDI_SOURCE_URL, FTDI_SOURCE_REVISION) - toolsimporter.getTool(meta, ftdiimportoptions, FTDI_SOURCE_DIR) - - def HISTORY_PROCESSING_REPO = 'git@hydra:gistestresults/ethernet-products-history-processing.git' - HISTORY_PROCESSING_DIR = "${WORKSPACE}/HistoryProcessing" - - def resultprocessingoptions = toolsimporter.getNewToolOptions() - resultprocessingoptions.toolName('History processing') - resultprocessingoptions.toolRepo(HISTORY_PROCESSING_REPO, HISTORY_PROCESSING_REVISION) - toolsimporter.getTool(meta, resultprocessingoptions, HISTORY_PROCESSING_DIR) - } - } - } - stage ("Import application to test") { - steps { - script { - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - - APPLICATION_UNDER_TEST = 'application_under_test' - env.APPLICATION_ARTIFACT_FOLDER = "${WORKSPACE}/${APPLICATION_UNDER_TEST}" - - def applicationimportoptions = importer.getNewImportOptions() - applicationimportoptions.jenkinsjob(APPLICATION_ARTIFACT_PROJECT, APPLICATION_ARTIFACT_SELECTOR) - applicationimportoptions.setfilter('app_package/**,control_package/**') - applicationmeta = importer.artifactimport(meta, applicationimportoptions, APPLICATION_ARTIFACT_FOLDER) - - meta.productinfo.set(applicationmeta.productinfo) - meta.productinfo.subcomponentname = "${applicationmeta.productinfo.subcomponentname}_TEST" - meta.gitinfo.set(applicationmeta.gitinfo) - meta.buildstampinfo.set(applicationmeta.buildstampinfo) - } - } - } - stage("Clean") { - steps { - script { - LOGGING_ROOT = 'Logging' - env.GIS_TEST_OUTPUT_LOGGING_ROOT = "${WORKSPACE}/${LOGGING_ROOT}" - cleanfolders = [ - GIS_TEST_OUTPUT_LOGGING_ROOT, - ] - cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") - cleaner.clean(cleanfolders) - } - } - } - stage ('Test') { - steps { - script { - lock(TEST_ENVIRONMENT['RESOURCE_LOCK']) { - if (POWER_CYCLE_HARDWARE == 'true') { - dir(FTDI_SOURCE_DIR) { - bat """ - "${PYTHON}" "${FTDI_SOURCE_DIR}/RegressionPower.py" -d ${TEST_ENVIRONMENT['FTDI_RELAY_DEVICE']} -o True - """ - } - } - if (UPDATE_HARDWARE == 'true') { - dir(GIS_TEST_SUITE_CORE) { - bat """ - "${PYTHON}" "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbPackageDeployer.py" -p "${APPLICATION_ARTIFACT_FOLDER}" -t "${TEST_ENVIRONMENT['IP_ADDRESS']}" - """ - rc = bat (script:""" - "${PYTHON}" "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbinspectstate.py" - """, - returnStatus: true) - if (rc == 1) { - unstable('FAILED while inspecting state of hardware') - } - } - } - if (DO_TEST == 'true') { - rc = bat(script:""" - ${PYTHON} "${GIS_TEST_SUITE_CORE}/GISTestMaster.py" -w ${PRODUCT_LOCATION_UNDER_TEST} -fl --include ${TEST_INCLUDE_FILTER} - """, - returnStatus: true - ) - if (rc == 1) { - unstable('FAILED while running tests') - } - } - } - } - } - } - stage("Archive Test History") { - steps{ - script { - dir(HISTORY_FOLDER) { - rc = bat (script:""" - "${PYTHON}" "${HISTORY_PROCESSING_DIR}/GitCyclicPush.py" - """, - returnStatus: true - ) - if (rc == 1) { - unstable('FAILED to process history') - } - } - } - } - } - stage("Archive test artifacts"){ - steps{ - script { - def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"]) - artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") - artifactarchiver.archive(meta, artifactlist) - } - } - } - } - } - } -} - 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 a22054b..0000000 --- a/Common_scripts/versioncontrol/git.groovy +++ /dev/null @@ -1,377 +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 = powershell(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 { - powershell """ - git status - if (\$lastexitcode -ge 1) { exit 1 } - """ - } - } -*/ - } - } - return reporootsubfolder -} - -def checkgitlfsinstall() { - if (isUnix()) { - sh """ - git lfs install - if [ \$? -ne 0 ]; then exit 1; fi - """ - - } else { - powershell """ - git lfs install - if (\$lastexitcode -ge 1) { exit 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) { - echo "Git: Checking out: URL: ${gitURL} Revision: ${revision} to: ${targetDir}" - checkout([ - $class: 'GitSCM', - userRemoteConfigs: [ - [url: gitURL] - ], - branches: [ - [name: revision] - ], - 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)], - [$class: 'PruneStaleBranch'], - ], - 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 { - powershell """ - 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 { - powershell """ - 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 { - powershell """ - git rm -rf . > \$null - git clean -fxd > \$null - git reset --hard > \$null - """ - } - } - } - -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 = powershell( 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 208a60f..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 { - powershell """ - & "${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 5e974e2..0000000 --- a/Common_scripts/versionnumbering/generate.groovy +++ /dev/null @@ -1,180 +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 = powershell(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 = powershell(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 = powershell(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 = powershell(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) { - if (integerstring.length() > 6) { - integerstring = integerstring.substring(0, 5) - } - 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 pregenerated(meta, String sourcerevision, String sourcepath, String pregeneratedbuildstamp, int basebuildnumber = 1000) { - generate(meta, sourcerevision, sourcepath, basebuildnumber) - meta.buildstampinfo.override(pregeneratedbuildstamp) - - return pregeneratedbuildstamp -} - -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) { - // Deep copy - meta.gitinfo.set(othermeta.gitinfo.sourcepath, othermeta.gitinfo.sourcerevision, othermeta.gitinfo.gitrevision, othermeta.gitinfo.remoteurl, othermeta.gitinfo.remoteinfo) - meta.buildstampinfo.set(othermeta.buildstampinfo.buildstampprefix, othermeta.buildstampinfo.revision, othermeta.buildstampinfo.buildstamp) - - 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 9243aa4..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 instances 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 8bd075f1131353d4ec1b165193e51f21eb5400a0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 17 Feb 2022 09:41:46 +0000 Subject: [PATCH 1864/1971] Filter long name releases from version selection --- publish/promptingpublish.groovy | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index ce6a805..9e4a3ba 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -55,23 +55,25 @@ pipeline { 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("superseded") && - !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}") - } + for (release in allreleases) { + def boolean canadd = true + if (FILTER_REDUNDANT_RELEASES && ( + release.toLowerCase().startsWith("superceded") || + release.toLowerCase().startsWith("superseded") || + release.toLowerCase().startsWith("erroneous") || + release.toLowerCase().startsWith("faulty") || + release.toLowerCase().startsWith("ignore") || + release.toLowerCase().startsWith("inmainline"))) { + canadd = false + } + if (FILTER_LONGNAME_RELEASES && release.findAll(/[a-zA-Z_]/) { + canadd = false + } + if (canadd) { + echo("Showing release: ${release}") + releases.add(release) + } else { + echo("Not showing release: ${release}") } } timeout(time: 10, unit: 'MINUTES') { From cad2d4e55ba4884aa94c9d3c53fc3dd1c227b260 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 17 Feb 2022 09:43:43 +0000 Subject: [PATCH 1865/1971] Filter long name releases from version selection --- publish/promptingpublish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 9e4a3ba..c61f1fd 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -66,7 +66,7 @@ pipeline { release.toLowerCase().startsWith("inmainline"))) { canadd = false } - if (FILTER_LONGNAME_RELEASES && release.findAll(/[a-zA-Z_]/) { + if (FILTER_LONGNAME_RELEASES && release.findAll(/[a-zA-Z_]/)) { canadd = false } if (canadd) { From 3981ecea3e26f102f4aa7d0c0c39aea3520040a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 17 Feb 2022 10:07:16 +0000 Subject: [PATCH 1866/1971] Filter long name releases from version selection --- publish/promptingpublish.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index c61f1fd..d0f6564 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -66,7 +66,7 @@ pipeline { release.toLowerCase().startsWith("inmainline"))) { canadd = false } - if (FILTER_LONGNAME_RELEASES && release.findAll(/[a-zA-Z_]/)) { + if (FILTER_LONGNAME_RELEASES && release.findAll(/[a-zA-Z]/)) { canadd = false } if (canadd) { From 11826a463cc876fd54dd8b7c52274b3e6e64c4ad Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 19:19:43 +0000 Subject: [PATCH 1867/1971] Get list of tags for each product release repo --- versioncontrol/git.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index a22054b..8a26fb7 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,6 +34,13 @@ ArrayList gettaglist(String workingSetRootPath) { return taglist } +ArrayList getremotetaglist(String repositoryURL) { + ArrayList taglist = new ArrayList() + def tagliststring = clh.getCommandOutput("git ls-remote --tags --sort=-version:refname ${repositoryURL}") + taglist = tagliststring.split('\\n') + return taglist +} + @NonCPS def ArrayList sparsecheckoutconfig(ArrayList paths) { ArrayList sparsecheckoutpaths = new ArrayList() From c5f01d0f1a76396d056f1af8d2e6346130f18044 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 20:22:51 +0000 Subject: [PATCH 1868/1971] Build up a tag map --- versioncontrol/git.groovy | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 8a26fb7..7cfd20f 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,11 +34,19 @@ ArrayList gettaglist(String workingSetRootPath) { return taglist } -ArrayList getremotetaglist(String repositoryURL) { +LinkedHashMap> getremoteshatagmap(String repositoryURL) { ArrayList taglist = new ArrayList() - def tagliststring = clh.getCommandOutput("git ls-remote --tags --sort=-version:refname ${repositoryURL}") - taglist = tagliststring.split('\\n') - return taglist + def shatagliststring = clh.getCommandOutput("git ls-remote --tags --sort=-version:refname ${repositoryURL}") + def shataglist = tagliststring.split('\\n') + + LinkedHashMap> shatagmap = new LinkedHashMap>() + for (shatag in shataglist) { + def shatagfields = shatag.split(' ') + def sha = shatagfields[0].trim() + def tag = shatagfields[1].trim() + shatagmap[sha].add(tag) + } + return shatagmap } @NonCPS From 453a14acc597f40bbbe117c58ccba05af8f72158 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 20:25:17 +0000 Subject: [PATCH 1869/1971] Build up a tag map --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 7cfd20f..25221e0 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -37,7 +37,7 @@ ArrayList gettaglist(String workingSetRootPath) { LinkedHashMap> getremoteshatagmap(String repositoryURL) { ArrayList taglist = new ArrayList() def shatagliststring = clh.getCommandOutput("git ls-remote --tags --sort=-version:refname ${repositoryURL}") - def shataglist = tagliststring.split('\\n') + def shataglist = shatagliststring.split('\\n') LinkedHashMap> shatagmap = new LinkedHashMap>() for (shatag in shataglist) { From 462b17733fc0e81d423218022a15498d20656342 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 20:29:59 +0000 Subject: [PATCH 1870/1971] Build up a tag map --- versioncontrol/git.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 25221e0..711ae5f 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -41,7 +41,9 @@ LinkedHashMap> getremoteshatagmap(String repositoryURL LinkedHashMap> shatagmap = new LinkedHashMap>() for (shatag in shataglist) { + echo "shatag: ${shatag}" def shatagfields = shatag.split(' ') + echo "shatagfields: ${shatagfields}" def sha = shatagfields[0].trim() def tag = shatagfields[1].trim() shatagmap[sha].add(tag) From be599cbe86911a7f4b182d5e1939a13c93fa8f51 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 20:32:46 +0000 Subject: [PATCH 1871/1971] Build up a tag map --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 711ae5f..ecefc11 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -42,7 +42,7 @@ LinkedHashMap> getremoteshatagmap(String repositoryURL LinkedHashMap> shatagmap = new LinkedHashMap>() for (shatag in shataglist) { echo "shatag: ${shatag}" - def shatagfields = shatag.split(' ') + def shatagfields = shatag.split('\\t') echo "shatagfields: ${shatagfields}" def sha = shatagfields[0].trim() def tag = shatagfields[1].trim() From fb72031c9724489f234a6a949d87149bf879d832 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 20:39:10 +0000 Subject: [PATCH 1872/1971] Build up a tag map --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index ecefc11..2ed4ac4 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -43,9 +43,9 @@ LinkedHashMap> getremoteshatagmap(String repositoryURL for (shatag in shataglist) { echo "shatag: ${shatag}" def shatagfields = shatag.split('\\t') - echo "shatagfields: ${shatagfields}" def sha = shatagfields[0].trim() def tag = shatagfields[1].trim() + echo "sha: ${sha} tag: ${tag}" shatagmap[sha].add(tag) } return shatagmap From 3dbdf85dfae6ac03537e006840d8a5e7d14892a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 20:58:09 +0000 Subject: [PATCH 1873/1971] Build up a tag map --- versioncontrol/git.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 2ed4ac4..8afd5f3 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -41,12 +41,15 @@ LinkedHashMap> getremoteshatagmap(String repositoryURL LinkedHashMap> shatagmap = new LinkedHashMap>() for (shatag in shataglist) { - echo "shatag: ${shatag}" def shatagfields = shatag.split('\\t') def sha = shatagfields[0].trim() def tag = shatagfields[1].trim() echo "sha: ${sha} tag: ${tag}" - shatagmap[sha].add(tag) + if (shatagmap.get(sha) == null) { + shatagmap.put(sha, [tag]) + } else { + shatagmap.put(sha, shatagmap.get(sha).add(tag)) + } } return shatagmap } From 0ca7886778b3085b2596db3cc19b328db8aac4a5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 21:08:09 +0000 Subject: [PATCH 1874/1971] Build up a tag map --- versioncontrol/git.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 8afd5f3..3a8cc68 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -46,9 +46,13 @@ LinkedHashMap> getremoteshatagmap(String repositoryURL def tag = shatagfields[1].trim() echo "sha: ${sha} tag: ${tag}" if (shatagmap.get(sha) == null) { - shatagmap.put(sha, [tag]) + def ArrayList taglist = new ArrayList() + taglist.add(tag) + shatagmap.put(sha, taglist) } else { - shatagmap.put(sha, shatagmap.get(sha).add(tag)) + def taglist = shatagmap.get(sha) + taglist.add(tag) + shatagmap.put(sha, taglist) } } return shatagmap From 4a46b8ffe062c14ad56a4c98ef2ebda0bd5f778f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 19 Feb 2022 21:09:29 +0000 Subject: [PATCH 1875/1971] Build up a tag map --- versioncontrol/git.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 3a8cc68..61378b5 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -35,7 +35,6 @@ ArrayList gettaglist(String workingSetRootPath) { } LinkedHashMap> getremoteshatagmap(String repositoryURL) { - ArrayList taglist = new ArrayList() def shatagliststring = clh.getCommandOutput("git ls-remote --tags --sort=-version:refname ${repositoryURL}") def shataglist = shatagliststring.split('\\n') From 940a8d56bd327f0050cdc1e32f22532be7bbf082 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 22 Feb 2022 22:59:09 +0000 Subject: [PATCH 1876/1971] Start adding dependencies --- meta/folder.groovy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index 6715145..7a92030 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -913,6 +913,14 @@ class MetaInfo extends GISJsonSerialised { String componentidentifier() { return productinfo.productname + "_" + productinfo.subcomponentname } + + String productvariant() { + if (variant == '') { + return productinfo.productname + } else { + return productinfo.productname + "_" + productinfo.variant + } + } String componentversionuniqueidentifier() { return componentidentifier() + "_" + buildstampinfo.buildstamp From 704e49969395635194b1fda7d3bf921305edebc7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 22 Feb 2022 23:03:10 +0000 Subject: [PATCH 1877/1971] Start adding dependencies --- meta/folder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 7a92030..ac3d0dd 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -915,7 +915,7 @@ class MetaInfo extends GISJsonSerialised { } String productvariant() { - if (variant == '') { + if (!productinfo.variant) { return productinfo.productname } else { return productinfo.productname + "_" + productinfo.variant From 64882035b913280d8403a0bc34b8a5dd627ad495 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 24 Feb 2022 22:37:30 +0000 Subject: [PATCH 1878/1971] Supply release tag processing --- release/tag.groovy | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 release/tag.groovy diff --git a/release/tag.groovy b/release/tag.groovy new file mode 100644 index 0000000..be1944f --- /dev/null +++ b/release/tag.groovy @@ -0,0 +1,31 @@ + +def LinkedHashMap RELEASETAG_PREFIXES = [ + 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', + 'superseded' : 'Indicates a later release has superseded the release with this prefix', + 'erroneous' : 'The release was released unintentionally', + 'faulty' : 'The release was found to have a serious fault', + 'ignore' : 'The release should be ignored', + 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', +] + +def RELEASETAG_PREFIX_SEPERATOR = '_' + +def LinkedHashMap startswithspecialprefix(String releasetag) { + def boolean hasspecialprefix = false + def String releasetagprefix = '' + def String prefixfound = '' + def String tagwithoutprefix = releasetag + + def rtsplits = releasetag.split(RELEASETAG_PREFIX_SEPERATOR) + if (rtsplits.size() > 0) + prefixfound = rtsplits[0].toLowerCase() + hasspecialprefix = RELEASETAG_PREFIXES.containsKey(prefixfound) + tagwithoutprefix = rtsplits[1..].join(RELEASETAG_PREFIX_SEPERATOR) + } + return [ 'hasspecialprefix' : hasspecialprefix, + 'prefixfound' : prefixfound, + 'tagwithoutprefix' : tagwithoutprefix, + ] +} + +return this; From 80bc64e32eea7ef6c4528f0374dace9d19b4553b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 24 Feb 2022 23:16:06 +0000 Subject: [PATCH 1879/1971] Supply release tag processing --- release/tag.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/release/tag.groovy b/release/tag.groovy index be1944f..2574fbc 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -16,11 +16,11 @@ def LinkedHashMap startswithspecialprefix(String releasetag) { def String prefixfound = '' def String tagwithoutprefix = releasetag - def rtsplits = releasetag.split(RELEASETAG_PREFIX_SEPERATOR) - if (rtsplits.size() > 0) - prefixfound = rtsplits[0].toLowerCase() + def firstseperatorindex = releasetag.indexOf(RELEASETAG_PREFIX_SEPERATOR) + if (firstseperatorindex > 0) + prefixfound = releasetag[0..(firstseperatorindex - 1)].toLowerCase() hasspecialprefix = RELEASETAG_PREFIXES.containsKey(prefixfound) - tagwithoutprefix = rtsplits[1..].join(RELEASETAG_PREFIX_SEPERATOR) + tagwithoutprefix = releasetag[(firstseperatorindex + 1)..-1] } return [ 'hasspecialprefix' : hasspecialprefix, 'prefixfound' : prefixfound, From 88cba3bc685a0fad146452b19990d5a23537e9c5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 24 Feb 2022 23:18:11 +0000 Subject: [PATCH 1880/1971] Supply release tag processing --- release/tag.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/tag.groovy b/release/tag.groovy index 2574fbc..acfdb09 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -17,7 +17,7 @@ def LinkedHashMap startswithspecialprefix(String releasetag) { def String tagwithoutprefix = releasetag def firstseperatorindex = releasetag.indexOf(RELEASETAG_PREFIX_SEPERATOR) - if (firstseperatorindex > 0) + if (firstseperatorindex > 0) { prefixfound = releasetag[0..(firstseperatorindex - 1)].toLowerCase() hasspecialprefix = RELEASETAG_PREFIXES.containsKey(prefixfound) tagwithoutprefix = releasetag[(firstseperatorindex + 1)..-1] From ce33f59ea65a8008d1595080cbd0497c6d2a7c92 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 24 Feb 2022 23:42:04 +0000 Subject: [PATCH 1881/1971] Supply release tag processing --- release/tag.groovy | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/release/tag.groovy b/release/tag.groovy index acfdb09..a6bbd28 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -16,11 +16,17 @@ def LinkedHashMap startswithspecialprefix(String releasetag) { def String prefixfound = '' def String tagwithoutprefix = releasetag + // Two forms of releasetag expected + // __ + // _ + def int seperatorcount = releasetag.split(RELEASETAG_PREFIX_SEPERATOR).size() - 1 def firstseperatorindex = releasetag.indexOf(RELEASETAG_PREFIX_SEPERATOR) - if (firstseperatorindex > 0) { - prefixfound = releasetag[0..(firstseperatorindex - 1)].toLowerCase() - hasspecialprefix = RELEASETAG_PREFIXES.containsKey(prefixfound) - tagwithoutprefix = releasetag[(firstseperatorindex + 1)..-1] + if (separatorcount >= 2) { + if (firstseperatorindex > 0) { + prefixfound = releasetag[0..(firstseperatorindex - 1)].toLowerCase() + hasspecialprefix = RELEASETAG_PREFIXES.containsKey(prefixfound) + tagwithoutprefix = releasetag[(firstseperatorindex + 1)..-1] + } } return [ 'hasspecialprefix' : hasspecialprefix, 'prefixfound' : prefixfound, From d2b8d1b7dc06197cda4783a6af6bdda19cd81815 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 24 Feb 2022 23:59:16 +0000 Subject: [PATCH 1882/1971] Supply release tag processing --- release/tag.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/tag.groovy b/release/tag.groovy index a6bbd28..5238aa3 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -1,5 +1,5 @@ -def LinkedHashMap RELEASETAG_PREFIXES = [ +LinkedHashMap RELEASETAG_PREFIXES = [ 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', 'superseded' : 'Indicates a later release has superseded the release with this prefix', 'erroneous' : 'The release was released unintentionally', @@ -8,7 +8,7 @@ def LinkedHashMap RELEASETAG_PREFIXES = [ 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', ] -def RELEASETAG_PREFIX_SEPERATOR = '_' +RELEASETAG_PREFIX_SEPERATOR = '_' def LinkedHashMap startswithspecialprefix(String releasetag) { def boolean hasspecialprefix = false From 70d569c43bf09e6b613c5bebdd16a77e14baf8da Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 00:01:09 +0000 Subject: [PATCH 1883/1971] Supply release tag processing --- release/tag.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/tag.groovy b/release/tag.groovy index 5238aa3..db6d59f 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -19,7 +19,7 @@ def LinkedHashMap startswithspecialprefix(String releasetag) { // Two forms of releasetag expected // __ // _ - def int seperatorcount = releasetag.split(RELEASETAG_PREFIX_SEPERATOR).size() - 1 + def int separatorcount = releasetag.split(RELEASETAG_PREFIX_SEPERATOR).size() - 1 def firstseperatorindex = releasetag.indexOf(RELEASETAG_PREFIX_SEPERATOR) if (separatorcount >= 2) { if (firstseperatorindex > 0) { From 89736f09fe503c0eecf873836b9db5e54527a551 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 00:06:23 +0000 Subject: [PATCH 1884/1971] Supply release tag processing --- release/tag.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/tag.groovy b/release/tag.groovy index db6d59f..63da06c 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -10,7 +10,7 @@ LinkedHashMap RELEASETAG_PREFIXES = [ RELEASETAG_PREFIX_SEPERATOR = '_' -def LinkedHashMap startswithspecialprefix(String releasetag) { +def startswithspecialprefix(String releasetag) { def boolean hasspecialprefix = false def String releasetagprefix = '' def String prefixfound = '' From 8b361de6538022600276a63eb5c3a2b18049a0a7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 00:12:00 +0000 Subject: [PATCH 1885/1971] Supply release tag processing --- release/tag.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release/tag.groovy b/release/tag.groovy index 63da06c..87ac043 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -16,6 +16,7 @@ def startswithspecialprefix(String releasetag) { def String prefixfound = '' def String tagwithoutprefix = releasetag + echo "Release tag is: ${releasetag}" // Two forms of releasetag expected // __ // _ @@ -28,6 +29,7 @@ def startswithspecialprefix(String releasetag) { tagwithoutprefix = releasetag[(firstseperatorindex + 1)..-1] } } + echo "Results are: ${hasspecialprefix} ${prefixfound} ${tagwithoutprefix}" return [ 'hasspecialprefix' : hasspecialprefix, 'prefixfound' : prefixfound, 'tagwithoutprefix' : tagwithoutprefix, From af3c0415660d78b2c0cb1e772f27caf93a243d1f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 00:16:38 +0000 Subject: [PATCH 1886/1971] Supply release tag processing --- release/tag.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release/tag.groovy b/release/tag.groovy index 87ac043..5d4d575 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -21,7 +21,9 @@ def startswithspecialprefix(String releasetag) { // __ // _ def int separatorcount = releasetag.split(RELEASETAG_PREFIX_SEPERATOR).size() - 1 + echo "separatorcount is: ${separatorcount}" def firstseperatorindex = releasetag.indexOf(RELEASETAG_PREFIX_SEPERATOR) + echo "firstseperatorindex is: ${firstseperatorindex}" if (separatorcount >= 2) { if (firstseperatorindex > 0) { prefixfound = releasetag[0..(firstseperatorindex - 1)].toLowerCase() From 44b1e13f31b55a229cb6679162d6259743ab17a7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 07:56:28 +0000 Subject: [PATCH 1887/1971] Supply release tag processing --- release/tag.groovy | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/release/tag.groovy b/release/tag.groovy index 5d4d575..bb258ce 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -1,5 +1,5 @@ -LinkedHashMap RELEASETAG_PREFIXES = [ +def LinkedHashMap RELEASETAG_PREFIXES = [ 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', 'superseded' : 'Indicates a later release has superseded the release with this prefix', 'erroneous' : 'The release was released unintentionally', @@ -8,33 +8,29 @@ LinkedHashMap RELEASETAG_PREFIXES = [ 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', ] -RELEASETAG_PREFIX_SEPERATOR = '_' +def RELEASETAG_PREFIX_SEPERATOR = '_' def startswithspecialprefix(String releasetag) { def boolean hasspecialprefix = false def String releasetagprefix = '' def String prefixfound = '' + def String prefixmeaning = '' def String tagwithoutprefix = releasetag - echo "Release tag is: ${releasetag}" - // Two forms of releasetag expected - // __ - // _ - def int separatorcount = releasetag.split(RELEASETAG_PREFIX_SEPERATOR).size() - 1 - echo "separatorcount is: ${separatorcount}" - def firstseperatorindex = releasetag.indexOf(RELEASETAG_PREFIX_SEPERATOR) - echo "firstseperatorindex is: ${firstseperatorindex}" - if (separatorcount >= 2) { - if (firstseperatorindex > 0) { - prefixfound = releasetag[0..(firstseperatorindex - 1)].toLowerCase() - hasspecialprefix = RELEASETAG_PREFIXES.containsKey(prefixfound) - tagwithoutprefix = releasetag[(firstseperatorindex + 1)..-1] + RELEASETAG_PREFIXES.each { prefix, meaning -> + if (releasetag.toLowerCase().startsWith(prefix)) { + prefixfound = prefix + hasspecialprefix = true + prefixmeaning = meaning + tagwithoutprefix = releasetag[(prefix.size() + 1)..-1] + break } } echo "Results are: ${hasspecialprefix} ${prefixfound} ${tagwithoutprefix}" return [ 'hasspecialprefix' : hasspecialprefix, 'prefixfound' : prefixfound, 'tagwithoutprefix' : tagwithoutprefix, + 'meaning' : prefixmeaning, ] } From 4fbe1d9baae38b7062cac2ae4b0d804315733189 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 07:58:37 +0000 Subject: [PATCH 1888/1971] Supply release tag processing --- release/tag.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/tag.groovy b/release/tag.groovy index bb258ce..b8d7b91 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -1,5 +1,5 @@ -def LinkedHashMap RELEASETAG_PREFIXES = [ +LinkedHashMap RELEASETAG_PREFIXES = [ 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', 'superseded' : 'Indicates a later release has superseded the release with this prefix', 'erroneous' : 'The release was released unintentionally', @@ -8,7 +8,7 @@ def LinkedHashMap RELEASETAG_PREFIXES = [ 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', ] -def RELEASETAG_PREFIX_SEPERATOR = '_' +RELEASETAG_PREFIX_SEPERATOR = '_' def startswithspecialprefix(String releasetag) { def boolean hasspecialprefix = false From b7c5a669f3b732d13d7e27900afce0cd8ce35024 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 08:01:08 +0000 Subject: [PATCH 1889/1971] Supply release tag processing --- release/tag.groovy | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/release/tag.groovy b/release/tag.groovy index b8d7b91..19901d9 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -1,16 +1,16 @@ -LinkedHashMap RELEASETAG_PREFIXES = [ - 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', - 'superseded' : 'Indicates a later release has superseded the release with this prefix', - 'erroneous' : 'The release was released unintentionally', - 'faulty' : 'The release was found to have a serious fault', - 'ignore' : 'The release should be ignored', - 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', -] - -RELEASETAG_PREFIX_SEPERATOR = '_' - def startswithspecialprefix(String releasetag) { + def LinkedHashMap RELEASETAG_PREFIXES = [ + 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', + 'superseded' : 'Indicates a later release has superseded the release with this prefix', + 'erroneous' : 'The release was released unintentionally', + 'faulty' : 'The release was found to have a serious fault', + 'ignore' : 'The release should be ignored', + 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', + ] + + def RELEASETAG_PREFIX_SEPERATOR = '_' + def boolean hasspecialprefix = false def String releasetagprefix = '' def String prefixfound = '' From af3e22db939a8332117ad3cc3f98d3d34c00dbd3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 08:04:50 +0000 Subject: [PATCH 1890/1971] Supply release tag processing --- release/tag.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/tag.groovy b/release/tag.groovy index 19901d9..b17a14e 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -1,6 +1,6 @@ def startswithspecialprefix(String releasetag) { - def LinkedHashMap RELEASETAG_PREFIXES = [ + LinkedHashMap RELEASETAG_PREFIXES = [ 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', 'superseded' : 'Indicates a later release has superseded the release with this prefix', 'erroneous' : 'The release was released unintentionally', @@ -9,7 +9,7 @@ def startswithspecialprefix(String releasetag) { 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', ] - def RELEASETAG_PREFIX_SEPERATOR = '_' + RELEASETAG_PREFIX_SEPERATOR = '_' def boolean hasspecialprefix = false def String releasetagprefix = '' From 01ce78080191d0a6927ba45e3f032124ea088918 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 08:11:27 +0000 Subject: [PATCH 1891/1971] Supply release tag processing --- release/tag.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/release/tag.groovy b/release/tag.groovy index b17a14e..0214eca 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -26,7 +26,6 @@ def startswithspecialprefix(String releasetag) { break } } - echo "Results are: ${hasspecialprefix} ${prefixfound} ${tagwithoutprefix}" return [ 'hasspecialprefix' : hasspecialprefix, 'prefixfound' : prefixfound, 'tagwithoutprefix' : tagwithoutprefix, From 32a3aeda0fce8162a58e3477ee63c74bb93e3645 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 08:17:53 +0000 Subject: [PATCH 1892/1971] Supply release tag processing --- release/tag.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/release/tag.groovy b/release/tag.groovy index 0214eca..90d6bbd 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -26,11 +26,13 @@ def startswithspecialprefix(String releasetag) { break } } - return [ 'hasspecialprefix' : hasspecialprefix, - 'prefixfound' : prefixfound, - 'tagwithoutprefix' : tagwithoutprefix, - 'meaning' : prefixmeaning, - ] + + LinkedHashMap results = [ 'hasspecialprefix' : hasspecialprefix, + 'prefixfound' : prefixfound, + 'tagwithoutprefix' : tagwithoutprefix, + 'meaning' : prefixmeaning, + ] + return results } return this; From a576d6403fe00c78a14f433faf76a8c4046e6e03 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 08:38:54 +0000 Subject: [PATCH 1893/1971] Script reorg --- product/info.groovy | 185 ++++++++++++++++++++++++++++++++++++++++++++ release/tag.groovy | 16 ++-- 2 files changed, 193 insertions(+), 8 deletions(-) create mode 100644 product/info.groovy diff --git a/product/info.groovy b/product/info.groovy new file mode 100644 index 0000000..e0bbede --- /dev/null +++ b/product/info.groovy @@ -0,0 +1,185 @@ + +def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") +def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") +def rt = load("${autobuilder.commonscripts()}/release/tag.groovy") + +class ProductDependency { + private script + private String productvariant + private String releaserepo + private String releasetag + private String releasestate + + def ProductDependency(script, String productvariant, String releasetag, String releaserepo) { + this.script = script + this.productvariant = productvariant + this.releaserepo = releaserepo + this.releasetag = releasetag + this.releasestate = '' + } + + def setreleasestate(rt) { + def LinkedHashMap results = rt.startswithspecialprefix(releasetag) + if (results.hasspecialprefix) { + releasetag = results.tagwithoutprefix + releasestate = results.prefixfound + } else { + releasetag = results.tagwithoutprefix + releasestate = '' + } + } +} + +class ProductComponent { + private String componentname + private String releaserepo + private String releasetag + + def ProductComponent(String componentname, String releasetag, String releaserepo) { + this.componentname = componentname + this.releaserepo = releaserepo + this.releasetag = releasetag + } +} + +class ProductRelease { + private String sha + private String builddate + private ArrayList tags + private ArrayList productdependencies + private ArrayList productcomponents + + def ProductRelease(String sha, String builddate, ArrayList tags) { + this.sha = sha + this.builddate = builddate + this.tags = tags + this.productdependencies = new ArrayList() + this.productcomponents = new ArrayList() + } + + def addProductDependency(ProductDependency dependency) { + productdependencies.add(dependency) + } + + def addProductComponent(ProductComponent component) { + productcomponents.add(component) + } +} + +class ProductParsed { + enum State { + UNPARSED, + PARSED, + } + private State scanstate + private String productvariant + private ArrayList releases + + def ProductParsed(String productvariant) { + scanstate = State.UNPARSED + this.productvariant = productvariant + this.releases = new ArrayList() + } + + def markparsed() { + scanstate = State.PARSED + } + + def boolean parsed() { + return (scanstate == State.PARSED) + } + + def addProductRelease(ProductRelease productrelease) { + releases.add(productrelease) + } +} + +def LinkedHashMap products = new LinkedHashMap() + +def addProductEntry(LinkedHashMap products, + String productvariant, + String releaserepo) { + def productparsed + if (products.get(releaserepo) == null) { // Use the first entry name only + productparsed = new ProductParsed(productvariant) + products.put(releaserepo, productparsed) + } else { + productparsed = products.get(releaserepo) + } + return productparsed +} + +def parseproductdependencies(rt, + productreleasemeta, + String productreleasefolder, + String containingproductvariant, + ProductRelease productrelease, + LinkedHashMap products) { + def dependentmeta = productreleasemeta.getassociated(productreleasefolder) + + for (meta in dependentmeta) { + if (meta.productinfo.subcomponentname != 'WHOLE') { + def pc = new ProductComponent(meta.productinfo.subcomponentname, + meta.releasetag(), + meta.releaseinfo.releaserepoURL) + productrelease.addProductComponent(pc) + } else { + if (meta.productvariant() != containingproductvariant) { + def pd = new ProductDependency(meta.productvariant(), + meta.releasetag(), + meta.releaseinfo.releaserepoURL) + pd.setreleasestate(rt) + addProductEntry(products, + meta.productvariant(), + meta.releaseinfo.releaserepoURL) + productrelease.addProductDependency(pd) + } + } + } +} + +def parseproductrepo(String productrepo, + String productreleasefolder) { + def LinkedHashMap> shatagmap = gh.getremoteshatagmap(productrepo) + def String productvariant + def ProductParsed pp + + def ArrayList productreleases = new ArrayList() + shatagmap.each { sha, tags -> + def importoptions = importer.getNewImportOptions() + importoptions.releaserepo(productrepo, sha) + importoptions.setfilter('meta/**') + def productreleasemeta = importer.artifactimport(meta, importoptions, productreleasefolder) + + if (!productvariant) { + productvariant = productreleasemeta.productvariant() + pp = addProductEntry(productvariant, productrepo) + } + + def productrelease = new ProductRelease(sha, productreleasemeta.jenkinsbuildinfo.builddate, tags) + parseproductdependencies(productreleasemeta, productreleasefolder, productvariant, productrelease, products) + pp.addProductRelease(productrelease) + } + pp.markparsed() +} + +def iterateinitialproductrepos(productcollection, String productreleasefolder) { + for (productrepo in productcollection.ProductReleaseRepos) { + echo "Querying ${productrepo}" + parseproductrepo(productrepo, + productreleasefolder) + } + while( true ) { + boolean allparsed = true + products.each { releaserepo, productparsed -> + if (!productparsed.parsed()) { + allparsed = false + parseproductrepo(releaserepo, + productreleasefolder) + } + } + if (allparsed) break + } +} + +return this \ No newline at end of file diff --git a/release/tag.groovy b/release/tag.groovy index 90d6bbd..cb9dd6c 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -1,6 +1,6 @@ def startswithspecialprefix(String releasetag) { - LinkedHashMap RELEASETAG_PREFIXES = [ + def RELEASETAG_PREFIXES = [ 'superceded' : 'Misspelt - Indicates a later release has superseded the release with this prefix', 'superseded' : 'Indicates a later release has superseded the release with this prefix', 'erroneous' : 'The release was released unintentionally', @@ -9,7 +9,7 @@ def startswithspecialprefix(String releasetag) { 'inmainline' : 'This release was associated with development branch which has now been merged into mainline', ] - RELEASETAG_PREFIX_SEPERATOR = '_' + def RELEASETAG_PREFIX_SEPERATOR = '_' def boolean hasspecialprefix = false def String releasetagprefix = '' @@ -27,12 +27,12 @@ def startswithspecialprefix(String releasetag) { } } - LinkedHashMap results = [ 'hasspecialprefix' : hasspecialprefix, - 'prefixfound' : prefixfound, - 'tagwithoutprefix' : tagwithoutprefix, - 'meaning' : prefixmeaning, - ] + def results = [ 'hasspecialprefix' : hasspecialprefix, + 'prefixfound' : prefixfound, + 'tagwithoutprefix' : tagwithoutprefix, + 'meaning' : prefixmeaning, + ] return results } -return this; +return this From 57eeaf4bc7a26eaaa25c111beb0a064e8864195c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 22:43:55 +0000 Subject: [PATCH 1894/1971] Comment out code to debug later --- product/info.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/product/info.groovy b/product/info.groovy index e0bbede..cecba6c 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -3,6 +3,7 @@ def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def rt = load("${autobuilder.commonscripts()}/release/tag.groovy") +/* class ProductDependency { private script private String productvariant @@ -181,5 +182,6 @@ def iterateinitialproductrepos(productcollection, String productreleasefolder) { if (allparsed) break } } +*/ return this \ No newline at end of file From e6c6fcf5e433ea90879a17515c500e09268ec6be Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 22:53:53 +0000 Subject: [PATCH 1895/1971] Debugging --- product/info.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index cecba6c..321e8d0 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -163,10 +163,12 @@ def parseproductrepo(String productrepo, } pp.markparsed() } +*/ def iterateinitialproductrepos(productcollection, String productreleasefolder) { for (productrepo in productcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" +/* parseproductrepo(productrepo, productreleasefolder) } @@ -180,8 +182,8 @@ def iterateinitialproductrepos(productcollection, String productreleasefolder) { } } if (allparsed) break + */ } } -*/ return this \ No newline at end of file From b1bc5408883b6d301d59b4d5f8285bd2fb02333c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 23:03:47 +0000 Subject: [PATCH 1896/1971] Debugging --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 321e8d0..b08feea 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -165,7 +165,7 @@ def parseproductrepo(String productrepo, } */ -def iterateinitialproductrepos(productcollection, String productreleasefolder) { +def iterateinitialproductrepos(JSONObject productcollection, String productreleasefolder) { for (productrepo in productcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" /* From ed17de0309b00db351be542f07e2ad8ea83a3d3e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 23:07:02 +0000 Subject: [PATCH 1897/1971] Debugging --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index b08feea..6542b6b 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -165,7 +165,7 @@ def parseproductrepo(String productrepo, } */ -def iterateinitialproductrepos(JSONObject productcollection, String productreleasefolder) { +def iterateinitialproductrepos(JSONArray productcollection, String productreleasefolder) { for (productrepo in productcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" /* From 5771490114d5d7e92f76f088d28896a35d5292d3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 25 Feb 2022 23:13:42 +0000 Subject: [PATCH 1898/1971] Debugging --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 6542b6b..321e8d0 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -165,7 +165,7 @@ def parseproductrepo(String productrepo, } */ -def iterateinitialproductrepos(JSONArray productcollection, String productreleasefolder) { +def iterateinitialproductrepos(productcollection, String productreleasefolder) { for (productrepo in productcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" /* From 68cbc00f3c28936169f2b99ede6c8b32719c92cd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:12:12 +0000 Subject: [PATCH 1899/1971] Debugging script --- product/info.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 321e8d0..6cd70ad 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -3,7 +3,6 @@ def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def rt = load("${autobuilder.commonscripts()}/release/tag.groovy") -/* class ProductDependency { private script private String productvariant @@ -97,6 +96,7 @@ class ProductParsed { def LinkedHashMap products = new LinkedHashMap() +/* def addProductEntry(LinkedHashMap products, String productvariant, String releaserepo) { @@ -182,8 +182,8 @@ def iterateinitialproductrepos(productcollection, String productreleasefolder) { } } if (allparsed) break - */ } + */ } return this \ No newline at end of file From 113186532c51860cbf9f5aee2edee90f89854cca Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:15:32 +0000 Subject: [PATCH 1900/1971] Debugging script --- product/info.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/product/info.groovy b/product/info.groovy index 6cd70ad..8cbdb58 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -171,7 +171,9 @@ def iterateinitialproductrepos(productcollection, String productreleasefolder) { /* parseproductrepo(productrepo, productreleasefolder) +*/ } + /* while( true ) { boolean allparsed = true products.each { releaserepo, productparsed -> From b187d23be32cc0dddace926d28b34f8cc5ce8324 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:25:54 +0000 Subject: [PATCH 1901/1971] Debugging script --- product/info.groovy | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 8cbdb58..6fccece 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -165,10 +165,18 @@ def parseproductrepo(String productrepo, } */ -def iterateinitialproductrepos(productcollection, String productreleasefolder) { +def iterateinitialproductrepos(script, productcollection, String productreleasefolder) { for (productrepo in productcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" -/* + + def String productvariant = 'HMBFDHV_sg1024' + def String releasetag = '1.2.3.4_54' + def releaserepo = 'git@hydra/blah.git' + def pd = new ProductDependency(script, + productvariant, + releasetag, + releaserepo) + /* parseproductrepo(productrepo, productreleasefolder) */ From 1d3f18418fa546184926b9c9378d6f7388cf7a53 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:29:41 +0000 Subject: [PATCH 1902/1971] Debugging script --- product/info.groovy | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 6fccece..3087aac 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -165,10 +165,12 @@ def parseproductrepo(String productrepo, } */ -def iterateinitialproductrepos(script, productcollection, String productreleasefolder) { - for (productrepo in productcollection.ProductReleaseRepos) { +def iterateinitialproductrepos(script, + productcollection, + String productreleasefolder) { +/* for (productrepo in productcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" - +*/ def String productvariant = 'HMBFDHV_sg1024' def String releasetag = '1.2.3.4_54' def releaserepo = 'git@hydra/blah.git' @@ -179,7 +181,6 @@ def iterateinitialproductrepos(script, productcollection, String productreleasef /* parseproductrepo(productrepo, productreleasefolder) -*/ } /* while( true ) { From ac5e7cdbbffac01b43e21e19cc0a64076111cfdb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:34:48 +0000 Subject: [PATCH 1903/1971] Debugging script --- product/info.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/product/info.groovy b/product/info.groovy index 3087aac..b479bc5 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -178,6 +178,7 @@ def iterateinitialproductrepos(script, productvariant, releasetag, releaserepo) + script.echo("pd is: ${pd}") /* parseproductrepo(productrepo, productreleasefolder) From 38b562b1a6909f64c7f95df2897da089ad8acee3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:38:19 +0000 Subject: [PATCH 1904/1971] Debugging script --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index b479bc5..f98694a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -178,7 +178,7 @@ def iterateinitialproductrepos(script, productvariant, releasetag, releaserepo) - script.echo("pd is: ${pd}") + script.echo("pd is: ${pd.dump()}") /* parseproductrepo(productrepo, productreleasefolder) From 48d7b0fc338e075d29bbb8104bebdb4711c83601 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:46:42 +0000 Subject: [PATCH 1905/1971] Debugging script --- product/info.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index f98694a..ea0d5b1 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -18,8 +18,9 @@ class ProductDependency { this.releasestate = '' } - def setreleasestate(rt) { + def setreleasestate() { def LinkedHashMap results = rt.startswithspecialprefix(releasetag) + script.echo("results is: ${results.dump()}") if (results.hasspecialprefix) { releasetag = results.tagwithoutprefix releasestate = results.prefixfound @@ -179,6 +180,8 @@ def iterateinitialproductrepos(script, releasetag, releaserepo) script.echo("pd is: ${pd.dump()}") + + pd.setreleasestate() /* parseproductrepo(productrepo, productreleasefolder) From 04e947cbfdef1dfe182c4c2e98789e7d732726e6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:51:28 +0000 Subject: [PATCH 1906/1971] Debugging script --- product/info.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index ea0d5b1..8283615 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,13 +5,19 @@ def rt = load("${autobuilder.commonscripts()}/release/tag.groovy") class ProductDependency { private script + private rt private String productvariant private String releaserepo private String releasetag private String releasestate - def ProductDependency(script, String productvariant, String releasetag, String releaserepo) { + def ProductDependency(script, + rt, + String productvariant, + String releasetag, + String releaserepo) { this.script = script + this.rt = rt this.productvariant = productvariant this.releaserepo = releaserepo this.releasetag = releasetag @@ -176,6 +182,7 @@ def iterateinitialproductrepos(script, def String releasetag = '1.2.3.4_54' def releaserepo = 'git@hydra/blah.git' def pd = new ProductDependency(script, + rt, productvariant, releasetag, releaserepo) From f34fb2e2fafd775356467fd099f0a5de2f06eacc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:55:44 +0000 Subject: [PATCH 1907/1971] Debugging script --- product/info.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 8283615..e844c59 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,19 +5,19 @@ def rt = load("${autobuilder.commonscripts()}/release/tag.groovy") class ProductDependency { private script - private rt + private rtscript private String productvariant private String releaserepo private String releasetag private String releasestate def ProductDependency(script, - rt, + rtscript, String productvariant, String releasetag, String releaserepo) { this.script = script - this.rt = rt + this.rtscript = rtscript this.productvariant = productvariant this.releaserepo = releaserepo this.releasetag = releasetag @@ -25,7 +25,7 @@ class ProductDependency { } def setreleasestate() { - def LinkedHashMap results = rt.startswithspecialprefix(releasetag) + def LinkedHashMap results = rtscript.startswithspecialprefix(releasetag) script.echo("results is: ${results.dump()}") if (results.hasspecialprefix) { releasetag = results.tagwithoutprefix From d418e5ab107f830c6d8517bad2422f7cae5d3428 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 14:58:45 +0000 Subject: [PATCH 1908/1971] Debugging script --- product/info.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index e844c59..d777bbf 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -1,7 +1,7 @@ -def importer = load("${autobuilder.commonscripts()}/import/importer.groovy") -def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") -def rt = load("${autobuilder.commonscripts()}/release/tag.groovy") +importer = load("${autobuilder.commonscripts()}/import/importer.groovy") +gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") +rt = load("${autobuilder.commonscripts()}/release/tag.groovy") class ProductDependency { private script From fa199eb5ffcd5da5721bc22213e828f286a7dff6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 15:03:09 +0000 Subject: [PATCH 1909/1971] Debugging script --- product/info.groovy | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index d777bbf..8e2cefb 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,19 +5,16 @@ rt = load("${autobuilder.commonscripts()}/release/tag.groovy") class ProductDependency { private script - private rtscript private String productvariant private String releaserepo private String releasetag private String releasestate def ProductDependency(script, - rtscript, String productvariant, String releasetag, String releaserepo) { this.script = script - this.rtscript = rtscript this.productvariant = productvariant this.releaserepo = releaserepo this.releasetag = releasetag @@ -25,7 +22,7 @@ class ProductDependency { } def setreleasestate() { - def LinkedHashMap results = rtscript.startswithspecialprefix(releasetag) + def LinkedHashMap results = rt.startswithspecialprefix(releasetag) script.echo("results is: ${results.dump()}") if (results.hasspecialprefix) { releasetag = results.tagwithoutprefix @@ -182,7 +179,6 @@ def iterateinitialproductrepos(script, def String releasetag = '1.2.3.4_54' def releaserepo = 'git@hydra/blah.git' def pd = new ProductDependency(script, - rt, productvariant, releasetag, releaserepo) From c2faf8abc6bb620a6b2c96a7dc44a04d6d24810e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 15:14:04 +0000 Subject: [PATCH 1910/1971] Debugging script --- product/info.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 8e2cefb..d777bbf 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,16 +5,19 @@ rt = load("${autobuilder.commonscripts()}/release/tag.groovy") class ProductDependency { private script + private rtscript private String productvariant private String releaserepo private String releasetag private String releasestate def ProductDependency(script, + rtscript, String productvariant, String releasetag, String releaserepo) { this.script = script + this.rtscript = rtscript this.productvariant = productvariant this.releaserepo = releaserepo this.releasetag = releasetag @@ -22,7 +25,7 @@ class ProductDependency { } def setreleasestate() { - def LinkedHashMap results = rt.startswithspecialprefix(releasetag) + def LinkedHashMap results = rtscript.startswithspecialprefix(releasetag) script.echo("results is: ${results.dump()}") if (results.hasspecialprefix) { releasetag = results.tagwithoutprefix @@ -179,6 +182,7 @@ def iterateinitialproductrepos(script, def String releasetag = '1.2.3.4_54' def releaserepo = 'git@hydra/blah.git' def pd = new ProductDependency(script, + rt, productvariant, releasetag, releaserepo) From b5e289411cf028428ade167ebe1eae88c5ceb6c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 15:17:14 +0000 Subject: [PATCH 1911/1971] Debugging script --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index d777bbf..18bcef3 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -179,7 +179,7 @@ def iterateinitialproductrepos(script, echo "Querying ${productrepo}" */ def String productvariant = 'HMBFDHV_sg1024' - def String releasetag = '1.2.3.4_54' + def String releasetag = 'inmainline_1.2.3.4_54' def releaserepo = 'git@hydra/blah.git' def pd = new ProductDependency(script, rt, From f2e3e526eddf5ebe8c6826d97a631f993a0402ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 15:30:24 +0000 Subject: [PATCH 1912/1971] Debugging script --- release/tag.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/tag.groovy b/release/tag.groovy index cb9dd6c..6155e7f 100644 --- a/release/tag.groovy +++ b/release/tag.groovy @@ -17,7 +17,8 @@ def startswithspecialprefix(String releasetag) { def String prefixmeaning = '' def String tagwithoutprefix = releasetag - RELEASETAG_PREFIXES.each { prefix, meaning -> + for (def prefix in RELEASETAG_PREFIXES.keySet()) { + def meaning = RELEASETAG_PREFIXES.get(prefix) if (releasetag.toLowerCase().startsWith(prefix)) { prefixfound = prefix hasspecialprefix = true From defc807e97935826dd31e30557b1e3d5b140d963 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 15:34:24 +0000 Subject: [PATCH 1913/1971] Debugging script --- product/info.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 18bcef3..23f898d 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -186,10 +186,10 @@ def iterateinitialproductrepos(script, productvariant, releasetag, releaserepo) + pd.setreleasestate() script.echo("pd is: ${pd.dump()}") - pd.setreleasestate() - /* + /* parseproductrepo(productrepo, productreleasefolder) } From 35d3862b258b00125f4978a295bb90be383b0ffd Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 15:40:36 +0000 Subject: [PATCH 1914/1971] Debugging script --- product/info.groovy | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 23f898d..c598bbf 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -5,7 +5,6 @@ rt = load("${autobuilder.commonscripts()}/release/tag.groovy") class ProductDependency { private script - private rtscript private String productvariant private String releaserepo private String releasetag @@ -17,22 +16,15 @@ class ProductDependency { String releasetag, String releaserepo) { this.script = script - this.rtscript = rtscript this.productvariant = productvariant this.releaserepo = releaserepo - this.releasetag = releasetag - this.releasestate = '' - } - - def setreleasestate() { def LinkedHashMap results = rtscript.startswithspecialprefix(releasetag) - script.echo("results is: ${results.dump()}") if (results.hasspecialprefix) { - releasetag = results.tagwithoutprefix - releasestate = results.prefixfound + this.releasetag = results.tagwithoutprefix + this.releasestate = results.prefixfound } else { - releasetag = results.tagwithoutprefix - releasestate = '' + this.releasetag = results.tagwithoutprefix + this.releasestate = '' } } } @@ -186,7 +178,6 @@ def iterateinitialproductrepos(script, productvariant, releasetag, releaserepo) - pd.setreleasestate() script.echo("pd is: ${pd.dump()}") /* From 2939eaf4b2753df7bb41961ba0d7a1e0453e750b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 15:50:43 +0000 Subject: [PATCH 1915/1971] Debugging script --- product/info.groovy | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index c598bbf..657b027 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -4,27 +4,28 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") rt = load("${autobuilder.commonscripts()}/release/tag.groovy") class ProductDependency { - private script private String productvariant private String releaserepo private String releasetag private String releasestate - def ProductDependency(script, - rtscript, - String productvariant, + def ProductDependency(String productvariant, String releasetag, String releaserepo) { - this.script = script this.productvariant = productvariant this.releaserepo = releaserepo + this.releasetag = releasetag + this.releasestate = '' + } + + def setreleasestate(rtscript) { def LinkedHashMap results = rtscript.startswithspecialprefix(releasetag) if (results.hasspecialprefix) { - this.releasetag = results.tagwithoutprefix - this.releasestate = results.prefixfound + releasetag = results.tagwithoutprefix + releasestate = results.prefixfound } else { - this.releasetag = results.tagwithoutprefix - this.releasestate = '' + releasetag = results.tagwithoutprefix + releasestate = '' } } } @@ -173,12 +174,11 @@ def iterateinitialproductrepos(script, def String productvariant = 'HMBFDHV_sg1024' def String releasetag = 'inmainline_1.2.3.4_54' def releaserepo = 'git@hydra/blah.git' - def pd = new ProductDependency(script, - rt, - productvariant, + def pd = new ProductDependency(productvariant, releasetag, releaserepo) - script.echo("pd is: ${pd.dump()}") + pd.setreleasestate(rt) + script.echo("pd is: ${pd.dump()}") /* parseproductrepo(productrepo, From 490b37bd7a2e339ed739e7af90a878d48a0c2f6d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 15:57:37 +0000 Subject: [PATCH 1916/1971] Debugging script --- product/info.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 657b027..6f5ec2b 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -21,11 +21,11 @@ class ProductDependency { def setreleasestate(rtscript) { def LinkedHashMap results = rtscript.startswithspecialprefix(releasetag) if (results.hasspecialprefix) { - releasetag = results.tagwithoutprefix - releasestate = results.prefixfound + this.releasetag = results.tagwithoutprefix + this.releasestate = results.prefixfound } else { - releasetag = results.tagwithoutprefix - releasestate = '' + this.releasetag = results.tagwithoutprefix + this.releasestate = '' } } } From 30ac58da78d6bd5fce2d89a93fe66443488f1122 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 16:00:49 +0000 Subject: [PATCH 1917/1971] Debugging script --- product/info.groovy | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 6f5ec2b..afc8da4 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -4,28 +4,35 @@ gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") rt = load("${autobuilder.commonscripts()}/release/tag.groovy") class ProductDependency { + private script + private rtscript private String productvariant private String releaserepo private String releasetag private String releasestate - def ProductDependency(String productvariant, + def ProductDependency(script, + rtscript, + String productvariant, String releasetag, String releaserepo) { + this.script = script + this.rtscript = rtscript this.productvariant = productvariant this.releaserepo = releaserepo this.releasetag = releasetag this.releasestate = '' } - def setreleasestate(rtscript) { + def setreleasestate() { def LinkedHashMap results = rtscript.startswithspecialprefix(releasetag) + script.echo("results is: ${results.dump()}") if (results.hasspecialprefix) { - this.releasetag = results.tagwithoutprefix - this.releasestate = results.prefixfound + releasetag = results.tagwithoutprefix + releasestate = results.prefixfound } else { - this.releasetag = results.tagwithoutprefix - this.releasestate = '' + releasetag = results.tagwithoutprefix + releasestate = '' } } } @@ -174,11 +181,13 @@ def iterateinitialproductrepos(script, def String productvariant = 'HMBFDHV_sg1024' def String releasetag = 'inmainline_1.2.3.4_54' def releaserepo = 'git@hydra/blah.git' - def pd = new ProductDependency(productvariant, + def pd = new ProductDependency(script, + rt, + productvariant, releasetag, releaserepo) - pd.setreleasestate(rt) - script.echo("pd is: ${pd.dump()}") + pd.setreleasestate() + script.echo("pd is: ${pd.dump()}") /* parseproductrepo(productrepo, From d2a22db3aba3403e8b9c140683d132c831c583c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 16:15:25 +0000 Subject: [PATCH 1918/1971] Debugging script --- product/info.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index afc8da4..7058c9d 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -8,24 +8,26 @@ class ProductDependency { private rtscript private String productvariant private String releaserepo + private String presplitreleasetag private String releasetag private String releasestate def ProductDependency(script, rtscript, String productvariant, - String releasetag, + String presplitreleasetag, String releaserepo) { this.script = script this.rtscript = rtscript this.productvariant = productvariant this.releaserepo = releaserepo - this.releasetag = releasetag + this.presplitreleasetag = presplitreleasetag + this.releasetag = '' this.releasestate = '' } def setreleasestate() { - def LinkedHashMap results = rtscript.startswithspecialprefix(releasetag) + def LinkedHashMap results = rtscript.startswithspecialprefix(presplitreleasetag) script.echo("results is: ${results.dump()}") if (results.hasspecialprefix) { releasetag = results.tagwithoutprefix From 01d91a7ec10461804df652b6fb6e774e36f4b83b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 16:24:19 +0000 Subject: [PATCH 1919/1971] Debugging script --- product/info.groovy | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 7058c9d..be95978 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -105,7 +105,6 @@ class ProductParsed { def LinkedHashMap products = new LinkedHashMap() -/* def addProductEntry(LinkedHashMap products, String productvariant, String releaserepo) { @@ -119,8 +118,7 @@ def addProductEntry(LinkedHashMap products, return productparsed } -def parseproductdependencies(rt, - productreleasemeta, +def parseproductdependencies(productreleasemeta, String productreleasefolder, String containingproductvariant, ProductRelease productrelease, @@ -135,10 +133,12 @@ def parseproductdependencies(rt, productrelease.addProductComponent(pc) } else { if (meta.productvariant() != containingproductvariant) { - def pd = new ProductDependency(meta.productvariant(), + def pd = new ProductDependency(this, + rt, + meta.productvariant(), meta.releasetag(), meta.releaseinfo.releaserepoURL) - pd.setreleasestate(rt) + pd.setreleasestate() addProductEntry(products, meta.productvariant(), meta.releaseinfo.releaserepoURL) @@ -159,43 +159,36 @@ def parseproductrepo(String productrepo, def importoptions = importer.getNewImportOptions() importoptions.releaserepo(productrepo, sha) importoptions.setfilter('meta/**') - def productreleasemeta = importer.artifactimport(meta, importoptions, productreleasefolder) + def productreleasemeta = importer.artifactimport(meta, + importoptions, + productreleasefolder) if (!productvariant) { productvariant = productreleasemeta.productvariant() pp = addProductEntry(productvariant, productrepo) } - def productrelease = new ProductRelease(sha, productreleasemeta.jenkinsbuildinfo.builddate, tags) - parseproductdependencies(productreleasemeta, productreleasefolder, productvariant, productrelease, products) + def productrelease = new ProductRelease(sha, + productreleasemeta.jenkinsbuildinfo.builddate, + tags) + parseproductdependencies(productreleasemeta, + productreleasefolder, + productvariant, + productrelease, + products) pp.addProductRelease(productrelease) } pp.markparsed() } -*/ def iterateinitialproductrepos(script, productcollection, String productreleasefolder) { -/* for (productrepo in productcollection.ProductReleaseRepos) { + for (productrepo in productcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" -*/ - def String productvariant = 'HMBFDHV_sg1024' - def String releasetag = 'inmainline_1.2.3.4_54' - def releaserepo = 'git@hydra/blah.git' - def pd = new ProductDependency(script, - rt, - productvariant, - releasetag, - releaserepo) - pd.setreleasestate() - script.echo("pd is: ${pd.dump()}") - - /* parseproductrepo(productrepo, productreleasefolder) } - /* while( true ) { boolean allparsed = true products.each { releaserepo, productparsed -> @@ -207,7 +200,6 @@ def iterateinitialproductrepos(script, } if (allparsed) break } - */ } return this \ No newline at end of file From d5a178bee9ae68f7078496b878da33325546bf1b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 16:28:15 +0000 Subject: [PATCH 1920/1971] Debugging script --- product/info.groovy | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index be95978..18c7ac2 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -103,10 +103,9 @@ class ProductParsed { } } -def LinkedHashMap products = new LinkedHashMap() +LinkedHashMap products = new LinkedHashMap() -def addProductEntry(LinkedHashMap products, - String productvariant, +def addProductEntry(String productvariant, String releaserepo) { def productparsed if (products.get(releaserepo) == null) { // Use the first entry name only @@ -121,8 +120,7 @@ def addProductEntry(LinkedHashMap products, def parseproductdependencies(productreleasemeta, String productreleasefolder, String containingproductvariant, - ProductRelease productrelease, - LinkedHashMap products) { + ProductRelease productrelease) { def dependentmeta = productreleasemeta.getassociated(productreleasefolder) for (meta in dependentmeta) { @@ -165,7 +163,8 @@ def parseproductrepo(String productrepo, if (!productvariant) { productvariant = productreleasemeta.productvariant() - pp = addProductEntry(productvariant, productrepo) + pp = addProductEntry(products, + productvariant, productrepo) } def productrelease = new ProductRelease(sha, @@ -174,8 +173,7 @@ def parseproductrepo(String productrepo, parseproductdependencies(productreleasemeta, productreleasefolder, productvariant, - productrelease, - products) + productrelease) pp.addProductRelease(productrelease) } pp.markparsed() From 0ad763cd295aa78df32f1b790374576846b16110 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 16:31:53 +0000 Subject: [PATCH 1921/1971] Debugging script --- product/info.groovy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 18c7ac2..433003c 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -105,7 +105,8 @@ class ProductParsed { LinkedHashMap products = new LinkedHashMap() -def addProductEntry(String productvariant, +def addProductEntry(LinkedHashMap products, + String productvariant, String releaserepo) { def productparsed if (products.get(releaserepo) == null) { // Use the first entry name only @@ -117,7 +118,8 @@ def addProductEntry(String productvariant, return productparsed } -def parseproductdependencies(productreleasemeta, +def parseproductdependencies(LinkedHashMap products, + productreleasemeta, String productreleasefolder, String containingproductvariant, ProductRelease productrelease) { @@ -170,7 +172,8 @@ def parseproductrepo(String productrepo, def productrelease = new ProductRelease(sha, productreleasemeta.jenkinsbuildinfo.builddate, tags) - parseproductdependencies(productreleasemeta, + parseproductdependencies(products, + productreleasemeta, productreleasefolder, productvariant, productrelease) From 2e5b6b212141b33eab6c407ea86827fad5e5f589 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 16:34:56 +0000 Subject: [PATCH 1922/1971] Debugging script --- product/info.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 433003c..3ad7968 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -148,7 +148,8 @@ def parseproductdependencies(LinkedHashMap products, } } -def parseproductrepo(String productrepo, +def parseproductrepo(LinkedHashMap products, + String productrepo, String productreleasefolder) { def LinkedHashMap> shatagmap = gh.getremoteshatagmap(productrepo) def String productvariant @@ -182,12 +183,12 @@ def parseproductrepo(String productrepo, pp.markparsed() } -def iterateinitialproductrepos(script, - productcollection, +def iterateinitialproductrepos(productcollection, String productreleasefolder) { for (productrepo in productcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" - parseproductrepo(productrepo, + parseproductrepo(products, + productrepo, productreleasefolder) } while( true ) { @@ -195,7 +196,8 @@ def iterateinitialproductrepos(script, products.each { releaserepo, productparsed -> if (!productparsed.parsed()) { allparsed = false - parseproductrepo(releaserepo, + parseproductrepo(products, + releaserepo, productreleasefolder) } } From c993ecc75bdc11539ee197dd96f9413735ce4f0e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 16:40:31 +0000 Subject: [PATCH 1923/1971] Debugging script --- product/info.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 3ad7968..e004b87 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -103,7 +103,7 @@ class ProductParsed { } } -LinkedHashMap products = new LinkedHashMap() +LinkedHashMap productscollection = new LinkedHashMap() def addProductEntry(LinkedHashMap products, String productvariant, @@ -183,11 +183,11 @@ def parseproductrepo(LinkedHashMap products, pp.markparsed() } -def iterateinitialproductrepos(productcollection, +def iterateinitialproductrepos(initialproductcollection, String productreleasefolder) { - for (productrepo in productcollection.ProductReleaseRepos) { + for (productrepo in initialproductcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" - parseproductrepo(products, + parseproductrepo(productscollection, productrepo, productreleasefolder) } @@ -196,7 +196,7 @@ def iterateinitialproductrepos(productcollection, products.each { releaserepo, productparsed -> if (!productparsed.parsed()) { allparsed = false - parseproductrepo(products, + parseproductrepo(productscollection, releaserepo, productreleasefolder) } From caf71e38cedc351cb29d0353f0c3eeddc53cf632 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 16:47:37 +0000 Subject: [PATCH 1924/1971] Debugging script --- product/info.groovy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index e004b87..d71177d 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -103,8 +103,6 @@ class ProductParsed { } } -LinkedHashMap productscollection = new LinkedHashMap() - def addProductEntry(LinkedHashMap products, String productvariant, String releaserepo) { @@ -184,10 +182,11 @@ def parseproductrepo(LinkedHashMap products, } def iterateinitialproductrepos(initialproductcollection, + LinkedHashMap productcollection, String productreleasefolder) { for (productrepo in initialproductcollection.ProductReleaseRepos) { echo "Querying ${productrepo}" - parseproductrepo(productscollection, + parseproductrepo(productcollection, productrepo, productreleasefolder) } @@ -196,7 +195,7 @@ def iterateinitialproductrepos(initialproductcollection, products.each { releaserepo, productparsed -> if (!productparsed.parsed()) { allparsed = false - parseproductrepo(productscollection, + parseproductrepo(productcollection, releaserepo, productreleasefolder) } From d93f9429b1f3f245a12279854ea6d8e4e4a8db4c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 17:02:17 +0000 Subject: [PATCH 1925/1971] Debugging script --- product/info.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/product/info.groovy b/product/info.groovy index d71177d..07a0b86 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -204,4 +204,9 @@ def iterateinitialproductrepos(initialproductcollection, } } +def LinkedHashMap getNewProductCollection() { + return new LinkedHashMap() +} + + return this \ No newline at end of file From 3c4de238e40c6dcc004e0ccbc3bf318577b6f418 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 17:04:37 +0000 Subject: [PATCH 1926/1971] Debugging script --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 07a0b86..51515e3 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -192,7 +192,7 @@ def iterateinitialproductrepos(initialproductcollection, } while( true ) { boolean allparsed = true - products.each { releaserepo, productparsed -> + productcollection.each { releaserepo, productparsed -> if (!productparsed.parsed()) { allparsed = false parseproductrepo(productcollection, From 54bf29f749811351c1b599422543be8306da0635 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 26 Feb 2022 20:11:59 +0000 Subject: [PATCH 1927/1971] Attempt to separate dependent products and sub-components --- product/info.groovy | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 51515e3..3d7bc30 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -124,24 +124,29 @@ def parseproductdependencies(LinkedHashMap products, def dependentmeta = productreleasemeta.getassociated(productreleasefolder) for (meta in dependentmeta) { - if (meta.productinfo.subcomponentname != 'WHOLE') { - def pc = new ProductComponent(meta.productinfo.subcomponentname, - meta.releasetag(), - meta.releaseinfo.releaserepoURL) - productrelease.addProductComponent(pc) - } else { - if (meta.productvariant() != containingproductvariant) { - def pd = new ProductDependency(this, - rt, - meta.productvariant(), - meta.releasetag(), - meta.releaseinfo.releaserepoURL) - pd.setreleasestate() + def pd = new ProductDependency(this, + rt, + meta.productvariant(), + meta.releasetag(), + meta.releaseinfo.releaserepoURL) + pd.setreleasestate() + if (meta.productinfo.subcomponentname == 'WHOLE') { + if (meta.productvariant() != containingproductvariant) { // Don't add myself addProductEntry(products, meta.productvariant(), meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) } + } else if (meta.productvariant() != containingproductvariant) { + addProductEntry(products, + meta.productvariant(), + meta.releaseinfo.releaserepoURL) + productrelease.addProductDependency(pd) + } else { + def pc = new ProductComponent(meta.productinfo.subcomponentname, + meta.releasetag(), + meta.releaseinfo.releaserepoURL) + productrelease.addProductComponent(pc) } } } From 23931461adc32f137b88f013253f645a328c93ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 1 Mar 2022 22:44:22 +0000 Subject: [PATCH 1928/1971] Use releasetag script --- publish/promptingpublish.groovy | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index d0f6564..053004e 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -52,19 +52,17 @@ pipeline { stage('Identify software release to publish') { steps { script { + rt = load("${autobuilder.commonscripts()}/release/tag.groovy") gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") def allreleases = gh.gettaglist(SOURCEDIR) def releases = new ArrayList() for (release in allreleases) { def boolean canadd = true - if (FILTER_REDUNDANT_RELEASES && ( - release.toLowerCase().startsWith("superceded") || - release.toLowerCase().startsWith("superseded") || - release.toLowerCase().startsWith("erroneous") || - release.toLowerCase().startsWith("faulty") || - release.toLowerCase().startsWith("ignore") || - release.toLowerCase().startsWith("inmainline"))) { - canadd = false + if (FILTER_REDUNDANT_RELEASES) { + def results = rt.startswithspecialprefix(release) + if (results.prefixfound) { + canadd = false + } } if (FILTER_LONGNAME_RELEASES && release.findAll(/[a-zA-Z]/)) { canadd = false From db92ee3e90180bef27289b57e025e79d650ae208 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 1 Mar 2022 23:05:39 +0000 Subject: [PATCH 1929/1971] Debug release filtering --- publish/promptingpublish.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 053004e..f6002e5 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -62,10 +62,14 @@ pipeline { def results = rt.startswithspecialprefix(release) if (results.prefixfound) { canadd = false + echo "Found prefix in ${release}" } } - if (FILTER_LONGNAME_RELEASES && release.findAll(/[a-zA-Z]/)) { - canadd = false + if (FILTER_LONGNAME_RELEASES) { + if (release.findAll(/[a-zA-Z]/)) { + canadd = false + echo "${release} is a long name" + } } if (canadd) { echo("Showing release: ${release}") From 3730461511700e692f81f2fb780398254307a71c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 1 Mar 2022 23:13:05 +0000 Subject: [PATCH 1930/1971] Debug release filtering --- publish/promptingpublish.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index f6002e5..7430a3c 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -58,14 +58,14 @@ pipeline { def releases = new ArrayList() for (release in allreleases) { def boolean canadd = true - if (FILTER_REDUNDANT_RELEASES) { + if (FILTER_REDUNDANT_RELEASES == 'true') { def results = rt.startswithspecialprefix(release) if (results.prefixfound) { canadd = false echo "Found prefix in ${release}" } } - if (FILTER_LONGNAME_RELEASES) { + if (FILTER_LONGNAME_RELEASES == 'true') { if (release.findAll(/[a-zA-Z]/)) { canadd = false echo "${release} is a long name" From b70fe5f7bd258ba0c3be2eaeebb12403e01c460b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 1 Mar 2022 23:17:58 +0000 Subject: [PATCH 1931/1971] Remove debug release filtering --- publish/promptingpublish.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy index 7430a3c..49d9421 100644 --- a/publish/promptingpublish.groovy +++ b/publish/promptingpublish.groovy @@ -62,13 +62,11 @@ pipeline { def results = rt.startswithspecialprefix(release) if (results.prefixfound) { canadd = false - echo "Found prefix in ${release}" } } if (FILTER_LONGNAME_RELEASES == 'true') { if (release.findAll(/[a-zA-Z]/)) { canadd = false - echo "${release} is a long name" } } if (canadd) { From 1c9579fc3b92298ab6f220c9790e19acceb4ed7c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 10 Mar 2022 23:04:26 +0000 Subject: [PATCH 1932/1971] Use raw git to checkout each tag --- product/info.groovy | 51 ++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 3d7bc30..128bce3 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -159,29 +159,38 @@ def parseproductrepo(LinkedHashMap products, def ProductParsed pp def ArrayList productreleases = new ArrayList() - shatagmap.each { sha, tags -> - def importoptions = importer.getNewImportOptions() - importoptions.releaserepo(productrepo, sha) - importoptions.setfilter('meta/**') - def productreleasemeta = importer.artifactimport(meta, - importoptions, - productreleasefolder) - if (!productvariant) { - productvariant = productreleasemeta.productvariant() - pp = addProductEntry(products, - productvariant, productrepo) + dir(productreleasefolder) { + deleteDir() + sh """#!/bin/bash + git init + git config remote.origin.url ${productrepo} + git sparse-checkout init + git sparse-checkout set meta/* + git pull -t + """ + shatagmap.each { sha, tags -> + sh """#!/bin/bash + git checkout ${sha} + """ + def productreleasemeta = meta.importrelated(false, productreleasefolder) + + if (!productvariant) { + productvariant = productreleasemeta.productvariant() + pp = addProductEntry(products, + productvariant, productrepo) + } + + def productrelease = new ProductRelease(sha, + productreleasemeta.jenkinsbuildinfo.builddate, + tags) + parseproductdependencies(products, + productreleasemeta, + productreleasefolder, + productvariant, + productrelease) + pp.addProductRelease(productrelease) } - - def productrelease = new ProductRelease(sha, - productreleasemeta.jenkinsbuildinfo.builddate, - tags) - parseproductdependencies(products, - productreleasemeta, - productreleasefolder, - productvariant, - productrelease) - pp.addProductRelease(productrelease) } pp.markparsed() } From 82f9bb6040f5d360a3d07e8831bae4e4ef4e86a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 10 Mar 2022 23:24:11 +0000 Subject: [PATCH 1933/1971] Use raw git to checkout each tag --- product/info.groovy | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 128bce3..4e6d026 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -165,32 +165,37 @@ def parseproductrepo(LinkedHashMap products, sh """#!/bin/bash git init git config remote.origin.url ${productrepo} + git config advice.detachedHead false git sparse-checkout init git sparse-checkout set meta/* git pull -t """ - shatagmap.each { sha, tags -> + } + shatagmap.each { sha, tags -> + echo "Sha is ${sha}" + dir(productreleasefolder) { sh """#!/bin/bash git checkout ${sha} """ - def productreleasemeta = meta.importrelated(false, productreleasefolder) - - if (!productvariant) { - productvariant = productreleasemeta.productvariant() - pp = addProductEntry(products, - productvariant, productrepo) - } - - def productrelease = new ProductRelease(sha, - productreleasemeta.jenkinsbuildinfo.builddate, - tags) - parseproductdependencies(products, - productreleasemeta, - productreleasefolder, - productvariant, - productrelease) - pp.addProductRelease(productrelease) } + def productreleasemeta = meta.importrelated(false, productreleasefolder) + + if (!productvariant) { + productvariant = productreleasemeta.productvariant() + pp = addProductEntry(products, + productvariant, + productrepo) + } + + def productrelease = new ProductRelease(sha, + productreleasemeta.jenkinsbuildinfo.builddate, + tags) + parseproductdependencies(products, + productreleasemeta, + productreleasefolder, + productvariant, + productrelease) + pp.addProductRelease(productrelease) } pp.markparsed() } From df5c9d1ffc0687d357d0b3a0573a211036ba9bb8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 10 Mar 2022 23:40:51 +0000 Subject: [PATCH 1934/1971] Remove debug --- product/info.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 4e6d026..595f47a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -28,7 +28,6 @@ class ProductDependency { def setreleasestate() { def LinkedHashMap results = rtscript.startswithspecialprefix(presplitreleasetag) - script.echo("results is: ${results.dump()}") if (results.hasspecialprefix) { releasetag = results.tagwithoutprefix releasestate = results.prefixfound From 66a6672c4dd809afc4302c4aaebcb032d2912aed Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 10 Mar 2022 23:59:30 +0000 Subject: [PATCH 1935/1971] Debug sha/tags table --- versioncontrol/git.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 61378b5..9eadd6f 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -54,6 +54,9 @@ LinkedHashMap> getremoteshatagmap(String repositoryURL shatagmap.put(sha, taglist) } } + shatagmap.each { sha, tags -> + echo "sha: ${sha} has tags: ${tags}" + } return shatagmap } From 2580ed3db12d7f3b2438bce68d645a4398dcb151 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Mar 2022 00:13:12 +0000 Subject: [PATCH 1936/1971] Debug sha/tags table --- product/info.groovy | 2 +- versioncontrol/git.groovy | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 595f47a..11f76ba 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -171,7 +171,7 @@ def parseproductrepo(LinkedHashMap products, """ } shatagmap.each { sha, tags -> - echo "Sha is ${sha}" + echo "Sha: ${sha} has tags: ${tags}" dir(productreleasefolder) { sh """#!/bin/bash git checkout ${sha} diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 9eadd6f..2b6fb09 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -43,7 +43,6 @@ LinkedHashMap> getremoteshatagmap(String repositoryURL def shatagfields = shatag.split('\\t') def sha = shatagfields[0].trim() def tag = shatagfields[1].trim() - echo "sha: ${sha} tag: ${tag}" if (shatagmap.get(sha) == null) { def ArrayList taglist = new ArrayList() taglist.add(tag) From fd795d2bda076e4242176e554b057bd05cffe713 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Mar 2022 00:23:17 +0000 Subject: [PATCH 1937/1971] Debug sha/tags table --- product/info.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/product/info.groovy b/product/info.groovy index 11f76ba..eaf9e3a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -184,19 +184,23 @@ def parseproductrepo(LinkedHashMap products, pp = addProductEntry(products, productvariant, productrepo) + echo "Productvariant: ${pp.productvariant} created" } def productrelease = new ProductRelease(sha, productreleasemeta.jenkinsbuildinfo.builddate, tags) + echo "Productrelease: ${productrelease.sha} created" parseproductdependencies(products, productreleasemeta, productreleasefolder, productvariant, productrelease) + echo "Productrelease: ${productrelease.sha} added to Productvariant: ${pp.productvariant}" pp.addProductRelease(productrelease) } pp.markparsed() + echo "Productvariant: ${pp.productvariant} parsed" } def iterateinitialproductrepos(initialproductcollection, From 149aad2c30ae819827cbfc49d39e6bb070a2cb45 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Mar 2022 00:37:44 +0000 Subject: [PATCH 1938/1971] Debug sha/tags table --- product/info.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index eaf9e3a..bdbe3cf 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -214,15 +214,22 @@ def iterateinitialproductrepos(initialproductcollection, } while( true ) { boolean allparsed = true + echo "Parsing extra products" productcollection.each { releaserepo, productparsed -> if (!productparsed.parsed()) { + echo "Querying unparsed ${productparsed.productvariant}" allparsed = false parseproductrepo(productcollection, releaserepo, productreleasefolder) + } else { + echo "Parsed already ${productparsed.productvariant}" } } - if (allparsed) break + if (allparsed) { + echo "All parsed" + break + } } } From e711a6cc5464e15c242a9c8b8d325b2425e5931e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Mar 2022 00:49:12 +0000 Subject: [PATCH 1939/1971] Debug sha/tags table --- product/info.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/product/info.groovy b/product/info.groovy index bdbe3cf..2dbf979 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -107,6 +107,7 @@ def addProductEntry(LinkedHashMap products, String releaserepo) { def productparsed if (products.get(releaserepo) == null) { // Use the first entry name only + echo "Adding product variant: ${productvariant} releaserepo: ${releaserepo}" productparsed = new ProductParsed(productvariant) products.put(releaserepo, productparsed) } else { From 93b2f2b0b91138a7fec2a2102ce6367137c246cc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Mar 2022 08:10:29 +0000 Subject: [PATCH 1940/1971] Debug sha/tags table --- product/info.groovy | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 2dbf979..bfe1f77 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -102,21 +102,21 @@ class ProductParsed { } } -def addProductEntry(LinkedHashMap products, +def ProductParsed addProductEntry(LinkedHashMap productcollection, String productvariant, String releaserepo) { - def productparsed - if (products.get(releaserepo) == null) { // Use the first entry name only + def ProductParsed productparsed + if (productcollection.get(releaserepo) == null) { // Use the first entry name only echo "Adding product variant: ${productvariant} releaserepo: ${releaserepo}" productparsed = new ProductParsed(productvariant) - products.put(releaserepo, productparsed) + productcollection.put(releaserepo, productparsed) } else { - productparsed = products.get(releaserepo) + productparsed = productcollection.get(releaserepo) } return productparsed } -def parseproductdependencies(LinkedHashMap products, +def parseproductdependencies(LinkedHashMap productcollection, productreleasemeta, String productreleasefolder, String containingproductvariant, @@ -132,13 +132,13 @@ def parseproductdependencies(LinkedHashMap products, pd.setreleasestate() if (meta.productinfo.subcomponentname == 'WHOLE') { if (meta.productvariant() != containingproductvariant) { // Don't add myself - addProductEntry(products, + addProductEntry(productcollection, meta.productvariant(), meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) } } else if (meta.productvariant() != containingproductvariant) { - addProductEntry(products, + addProductEntry(productcollection, meta.productvariant(), meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) @@ -151,7 +151,7 @@ def parseproductdependencies(LinkedHashMap products, } } -def parseproductrepo(LinkedHashMap products, +def parseproductrepo(LinkedHashMap productcollection, String productrepo, String productreleasefolder) { def LinkedHashMap> shatagmap = gh.getremoteshatagmap(productrepo) @@ -182,7 +182,7 @@ def parseproductrepo(LinkedHashMap products, if (!productvariant) { productvariant = productreleasemeta.productvariant() - pp = addProductEntry(products, + pp = addProductEntry(productcollection, productvariant, productrepo) echo "Productvariant: ${pp.productvariant} created" @@ -192,7 +192,7 @@ def parseproductrepo(LinkedHashMap products, productreleasemeta.jenkinsbuildinfo.builddate, tags) echo "Productrelease: ${productrelease.sha} created" - parseproductdependencies(products, + parseproductdependencies(productcollection, productreleasemeta, productreleasefolder, productvariant, From 9f0a5dbc39c6ee7ece144092e5667e047471cb42 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Mar 2022 08:18:58 +0000 Subject: [PATCH 1941/1971] Debug sha/tags table --- product/info.groovy | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index bfe1f77..3cc3bb9 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -106,12 +106,17 @@ def ProductParsed addProductEntry(LinkedHashMap productco String productvariant, String releaserepo) { def ProductParsed productparsed - if (productcollection.get(releaserepo) == null) { // Use the first entry name only - echo "Adding product variant: ${productvariant} releaserepo: ${releaserepo}" - productparsed = new ProductParsed(productvariant) - productcollection.put(releaserepo, productparsed) + + echo "Attempting to add product variant: ${productvariant} releaserepo: ${releaserepo}" + if (productvariant && releaserepo) { + if (productcollection.get(releaserepo) == null) { // Use the first entry name only + echo "Adding product variant: ${productvariant} releaserepo: ${releaserepo}" + productparsed = new ProductParsed(productvariant) + productcollection.put(releaserepo, productparsed) + productparsed = productcollection.get(releaserepo) + } } else { - productparsed = productcollection.get(releaserepo) + echo "Not adding product variant: ${productvariant} releaserepo: ${releaserepo}" } return productparsed } From eb960a6d80ddcf015690e63cc1ec354f13ed45d5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Mar 2022 08:25:17 +0000 Subject: [PATCH 1942/1971] Debug sha/tags table --- product/info.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 3cc3bb9..995c936 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -135,14 +135,14 @@ def parseproductdependencies(LinkedHashMap productcollect meta.releasetag(), meta.releaseinfo.releaserepoURL) pd.setreleasestate() - if (meta.productinfo.subcomponentname == 'WHOLE') { + if (meta.productinfo.subcomponentname == 'WHOLE' && meta.productvariant() != '') { if (meta.productvariant() != containingproductvariant) { // Don't add myself addProductEntry(productcollection, meta.productvariant(), meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) } - } else if (meta.productvariant() != containingproductvariant) { + } else if (meta.productvariant() != containingproductvariant && meta.productvariant() != '') { addProductEntry(productcollection, meta.productvariant(), meta.releaseinfo.releaserepoURL) From 9235c1aa6f9b7fc2551aa930ef2e13199db71409 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Fri, 11 Mar 2022 08:41:35 +0000 Subject: [PATCH 1943/1971] Debug sha/tags table --- product/info.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/product/info.groovy b/product/info.groovy index 995c936..ec84c10 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -114,6 +114,8 @@ def ProductParsed addProductEntry(LinkedHashMap productco productparsed = new ProductParsed(productvariant) productcollection.put(releaserepo, productparsed) productparsed = productcollection.get(releaserepo) + } else { + echo "Already added product variant: ${productvariant}" } } else { echo "Not adding product variant: ${productvariant} releaserepo: ${releaserepo}" From da33b16cdf47f892cd007664f8ebb25334a690e9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Mar 2022 09:28:08 +0000 Subject: [PATCH 1944/1971] Debug sha/tags table --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index ec84c10..24650ac 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -113,10 +113,10 @@ def ProductParsed addProductEntry(LinkedHashMap productco echo "Adding product variant: ${productvariant} releaserepo: ${releaserepo}" productparsed = new ProductParsed(productvariant) productcollection.put(releaserepo, productparsed) - productparsed = productcollection.get(releaserepo) } else { echo "Already added product variant: ${productvariant}" } + productparsed = productcollection.get(releaserepo) } else { echo "Not adding product variant: ${productvariant} releaserepo: ${releaserepo}" } From 390c97c87bc4f8b835aaa752d6a04da04bc850a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Mar 2022 10:24:22 +0000 Subject: [PATCH 1945/1971] Debug sha/tags table --- meta/folder.groovy | 2 +- product/info.groovy | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index ac3d0dd..67ca47a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -1103,7 +1103,7 @@ class MetaInfo extends GISJsonSerialised { def ArrayList metacollection = new ArrayList() def Map metamap = new LinkedHashMap() def IterationInfo ii = new IterationInfo(metacollection, metamap, 'meta', 0, startpath, startmetapath, true, maxdepth) - script.echo("Release walker iteration info at start:\n${ii.show()}") + //script.echo("Release walker iteration info at start:\n${ii.show()}") def results = walkrelated(ii) return results.metacollection } diff --git a/product/info.groovy b/product/info.groovy index 24650ac..14a7ea4 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -181,9 +181,16 @@ def parseproductrepo(LinkedHashMap productcollection, shatagmap.each { sha, tags -> echo "Sha: ${sha} has tags: ${tags}" dir(productreleasefolder) { - sh """#!/bin/bash - git checkout ${sha} - """ + def returnstatus = sh( script: """#!/bin/bash + git checkout ${sha} + """, + returnStatus: true) + echo "returnstatus: ${returnstatus}" + if (returnstatus > 0) { + dir('meta') { + deleteDir() + } + } } def productreleasemeta = meta.importrelated(false, productreleasefolder) From 60c1fbab1375aad98a629eb06465b3d3af9ca972 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Mar 2022 10:54:46 +0000 Subject: [PATCH 1946/1971] Debug sha/tags table --- product/info.groovy | 52 ++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 14a7ea4..bbda541 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -93,6 +93,10 @@ class ProductParsed { scanstate = State.PARSED } + def markparseerror() { + scanstate = State.PARSED + } + def boolean parsed() { return (scanstate == State.PARSED) } @@ -161,12 +165,6 @@ def parseproductdependencies(LinkedHashMap productcollect def parseproductrepo(LinkedHashMap productcollection, String productrepo, String productreleasefolder) { - def LinkedHashMap> shatagmap = gh.getremoteshatagmap(productrepo) - def String productvariant - def ProductParsed pp - - def ArrayList productreleases = new ArrayList() - dir(productreleasefolder) { deleteDir() sh """#!/bin/bash @@ -178,6 +176,9 @@ def parseproductrepo(LinkedHashMap productcollection, git pull -t """ } + def LinkedHashMap> shatagmap = gh.getremoteshatagmap(productrepo) + def String productvariant + def ProductParsed pp shatagmap.each { sha, tags -> echo "Sha: ${sha} has tags: ${tags}" dir(productreleasefolder) { @@ -193,29 +194,36 @@ def parseproductrepo(LinkedHashMap productcollection, } } def productreleasemeta = meta.importrelated(false, productreleasefolder) - if (!productvariant) { productvariant = productreleasemeta.productvariant() pp = addProductEntry(productcollection, productvariant, productrepo) - echo "Productvariant: ${pp.productvariant} created" + if (pp) { + echo "Productvariant: ${pp.productvariant} created" + } else { + echo "No product entry added/associated with ${productvariant}" + } + } + + if (pp) { + def productrelease = new ProductRelease(sha, + productreleasemeta.jenkinsbuildinfo.builddate, + tags) + echo "Productrelease: ${productrelease.sha} created" + parseproductdependencies(productcollection, + productreleasemeta, + productreleasefolder, + productvariant, + productrelease) + echo "Productrelease: ${productrelease.sha} added to Productvariant: ${pp.productvariant}" + pp.addProductRelease(productrelease) } - - def productrelease = new ProductRelease(sha, - productreleasemeta.jenkinsbuildinfo.builddate, - tags) - echo "Productrelease: ${productrelease.sha} created" - parseproductdependencies(productcollection, - productreleasemeta, - productreleasefolder, - productvariant, - productrelease) - echo "Productrelease: ${productrelease.sha} added to Productvariant: ${pp.productvariant}" - pp.addProductRelease(productrelease) } - pp.markparsed() - echo "Productvariant: ${pp.productvariant} parsed" + if (pp) { + pp.markparsed() + echo "Productvariant: ${pp.productvariant} parsed" + } } def iterateinitialproductrepos(initialproductcollection, From 94de9d206995b15c09831b5e1742dacca3baa58c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Mar 2022 22:35:03 +0000 Subject: [PATCH 1947/1971] Debug sha/tags table --- product/info.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index bbda541..2c15937 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -111,7 +111,6 @@ def ProductParsed addProductEntry(LinkedHashMap productco String releaserepo) { def ProductParsed productparsed - echo "Attempting to add product variant: ${productvariant} releaserepo: ${releaserepo}" if (productvariant && releaserepo) { if (productcollection.get(releaserepo) == null) { // Use the first entry name only echo "Adding product variant: ${productvariant} releaserepo: ${releaserepo}" @@ -186,7 +185,6 @@ def parseproductrepo(LinkedHashMap productcollection, git checkout ${sha} """, returnStatus: true) - echo "returnstatus: ${returnstatus}" if (returnstatus > 0) { dir('meta') { deleteDir() From cd0a35359a6e6841c56768d7afaab4d86b373001 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Mar 2022 22:40:12 +0000 Subject: [PATCH 1948/1971] Debug sha/tags table --- meta/folder.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 67ca47a..810fc4f 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -817,20 +817,20 @@ class MetaInfo extends GISJsonSerialised { String relativize(String mypath) { String pathRelative - script.echo("Seeing if ${mypath} begins with ${script.WORKSPACE}") + //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}") + //script.echo("Extracted ${pathRelative} from ${script.WORKSPACE} and ${mypath}") } else { pathRelative = mypath - script.echo("Path relative is unchanged: ${pathRelative}") + //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}") + //script.echo("Path relative is ${pathRelative}") return pathRelative } From 839f987a81341fbc84f909c7ed79b19bf84da321 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Mar 2022 22:50:00 +0000 Subject: [PATCH 1949/1971] Debug sha/tags table --- meta/folder.groovy | 2 +- product/info.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 810fc4f..34448dd 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -845,7 +845,7 @@ class MetaInfo extends GISJsonSerialised { def String adjustedpath = relativize(destpath) def importedmetafile = adjustedpath + "/" + metafilepath() if (script.fileExists(importedmetafile)) { - script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})") + //script.echo("Deserialising meta at file: ${importedmetafile} (destpath: ${destpath})") mi.deserialiseJson(importedmetafile) RelatedMetaInfo rmi = new RelatedMetaInfo_v0_2(script, importedmetafile, adjustedpath, mi.productinfo.uniqueid) diff --git a/product/info.groovy b/product/info.groovy index 2c15937..0ae2779 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -179,7 +179,7 @@ def parseproductrepo(LinkedHashMap productcollection, def String productvariant def ProductParsed pp shatagmap.each { sha, tags -> - echo "Sha: ${sha} has tags: ${tags}" + //echo "Sha: ${sha} has tags: ${tags}" dir(productreleasefolder) { def returnstatus = sh( script: """#!/bin/bash git checkout ${sha} From ab4165ebc0e3a679da1c7a343671efb93bf002b4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 12 Mar 2022 23:22:12 +0000 Subject: [PATCH 1950/1971] Debug sha/tags table --- product/info.groovy | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 0ae2779..5a1dfaf 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -134,29 +134,33 @@ def parseproductdependencies(LinkedHashMap productcollect def dependentmeta = productreleasemeta.getassociated(productreleasefolder) for (meta in dependentmeta) { - def pd = new ProductDependency(this, - rt, - meta.productvariant(), - meta.releasetag(), - meta.releaseinfo.releaserepoURL) - pd.setreleasestate() - if (meta.productinfo.subcomponentname == 'WHOLE' && meta.productvariant() != '') { - if (meta.productvariant() != containingproductvariant) { // Don't add myself + if (meta.productvariant() && meta.productinfo.subcomponentname) { + def pd = new ProductDependency(this, + rt, + meta.productvariant(), + meta.releasetag(), + meta.releaseinfo.releaserepoURL) + pd.setreleasestate() + if (meta.productinfo.subcomponentname == 'WHOLE' && meta.productvariant() != '') { + if (meta.productvariant() != containingproductvariant) { // Don't add myself + addProductEntry(productcollection, + meta.productvariant(), + meta.releaseinfo.releaserepoURL) + productrelease.addProductDependency(pd) + } + } else if (meta.productvariant() != containingproductvariant && meta.productvariant() != '') { addProductEntry(productcollection, meta.productvariant(), meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) + } else { + def pc = new ProductComponent(meta.productinfo.subcomponentname, + meta.releasetag(), + meta.releaseinfo.releaserepoURL) + productrelease.addProductComponent(pc) } - } else if (meta.productvariant() != containingproductvariant && meta.productvariant() != '') { - addProductEntry(productcollection, - meta.productvariant(), - meta.releaseinfo.releaserepoURL) - productrelease.addProductDependency(pd) } else { - def pc = new ProductComponent(meta.productinfo.subcomponentname, - meta.releasetag(), - meta.releaseinfo.releaserepoURL) - productrelease.addProductComponent(pc) + echo "Ignoring unnamed dependency in ${productreleasemeta.productvariant()}" } } } From 8aeb9a930b80659460d3e3b321c965957d5d2cb6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 10:06:48 +0000 Subject: [PATCH 1951/1971] Debug sha/tags table --- product/info.groovy | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 5a1dfaf..3f55ed8 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -170,14 +170,28 @@ def parseproductrepo(LinkedHashMap productcollection, String productreleasefolder) { dir(productreleasefolder) { deleteDir() - sh """#!/bin/bash - git init - git config remote.origin.url ${productrepo} - git config advice.detachedHead false - git sparse-checkout init - git sparse-checkout set meta/* - git pull -t - """ + def returnstatus = sh(script: """#!/bin/bash + git init + if [ \$? -ne 0 ]; then exit 1; fi + git config remote.origin.url ${productrepo} + if [ \$? -ne 0 ]; then exit 1; fi + git config advice.detachedHead false + if [ \$? -ne 0 ]; then exit 1; fi + git sparse-checkout init + if [ \$? -ne 0 ]; then exit 1; fi + git sparse-checkout set meta/* + if [ \$? -ne 0 ]; then exit 1; fi + git pull -t + if [ \$? -ne 0 ]; then exit 1; fi + """, + returnStatus: true) + if (returnstatus > 0) { + dir('meta') { + deleteDir() + } + echo "Couldn't clone repository: ${productrepo} correctly" + return + } } def LinkedHashMap> shatagmap = gh.getremoteshatagmap(productrepo) def String productvariant @@ -185,10 +199,10 @@ def parseproductrepo(LinkedHashMap productcollection, shatagmap.each { sha, tags -> //echo "Sha: ${sha} has tags: ${tags}" dir(productreleasefolder) { - def returnstatus = sh( script: """#!/bin/bash - git checkout ${sha} - """, - returnStatus: true) + def returnstatus = sh(script: """#!/bin/bash + git checkout ${sha} + """, + returnStatus: true) if (returnstatus > 0) { dir('meta') { deleteDir() From 295c18c0bbe9cb5207ff75f7ba95493b6193910c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 18:14:28 +0000 Subject: [PATCH 1952/1971] Debug sha/tags table --- product/info.groovy | 83 +++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 3f55ed8..28107de 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -168,6 +168,7 @@ def parseproductdependencies(LinkedHashMap productcollect def parseproductrepo(LinkedHashMap productcollection, String productrepo, String productreleasefolder) { + def boolean productrepogood = true dir(productreleasefolder) { deleteDir() def returnstatus = sh(script: """#!/bin/bash @@ -190,56 +191,58 @@ def parseproductrepo(LinkedHashMap productcollection, deleteDir() } echo "Couldn't clone repository: ${productrepo} correctly" - return + productrepogood = false } } - def LinkedHashMap> shatagmap = gh.getremoteshatagmap(productrepo) - def String productvariant - def ProductParsed pp - shatagmap.each { sha, tags -> - //echo "Sha: ${sha} has tags: ${tags}" - dir(productreleasefolder) { - def returnstatus = sh(script: """#!/bin/bash - git checkout ${sha} - """, - returnStatus: true) - if (returnstatus > 0) { - dir('meta') { - deleteDir() + if (productrepogood) { + def LinkedHashMap> shatagmap = gh.getremoteshatagmap(productrepo) + def String productvariant + def ProductParsed pp + shatagmap.each { sha, tags -> + //echo "Sha: ${sha} has tags: ${tags}" + dir(productreleasefolder) { + def returnstatus = sh(script: """#!/bin/bash + git checkout ${sha} + """, + returnStatus: true) + if (returnstatus > 0) { + dir('meta') { + deleteDir() + } } } - } - def productreleasemeta = meta.importrelated(false, productreleasefolder) - if (!productvariant) { - productvariant = productreleasemeta.productvariant() - pp = addProductEntry(productcollection, - productvariant, - productrepo) + def productreleasemeta = meta.importrelated(false, productreleasefolder) + if (!productvariant) { + productvariant = productreleasemeta.productvariant() + pp = addProductEntry(productcollection, + productvariant, + productrepo) + if (pp) { + echo "Productvariant: ${pp.productvariant} created" + } else { + echo "No product entry added/associated with ${productvariant}" + } + } + if (pp) { - echo "Productvariant: ${pp.productvariant} created" - } else { - echo "No product entry added/associated with ${productvariant}" + def productrelease = new ProductRelease(sha, + productreleasemeta.jenkinsbuildinfo.builddate, + tags) + echo "Productrelease: ${productrelease.sha} created" + parseproductdependencies(productcollection, + productreleasemeta, + productreleasefolder, + productvariant, + productrelease) + echo "Productrelease: ${productrelease.sha} added to Productvariant: ${pp.productvariant}" + pp.addProductRelease(productrelease) } } - if (pp) { - def productrelease = new ProductRelease(sha, - productreleasemeta.jenkinsbuildinfo.builddate, - tags) - echo "Productrelease: ${productrelease.sha} created" - parseproductdependencies(productcollection, - productreleasemeta, - productreleasefolder, - productvariant, - productrelease) - echo "Productrelease: ${productrelease.sha} added to Productvariant: ${pp.productvariant}" - pp.addProductRelease(productrelease) + pp.markparsed() + echo "Productvariant: ${pp.productvariant} parsed" } } - if (pp) { - pp.markparsed() - echo "Productvariant: ${pp.productvariant} parsed" - } } def iterateinitialproductrepos(initialproductcollection, From e72f0067281fb4ecdc429d069aee9d5218c339a7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 18:21:46 +0000 Subject: [PATCH 1953/1971] Debug sha/tags table --- product/info.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 28107de..e89922a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -169,6 +169,7 @@ def parseproductrepo(LinkedHashMap productcollection, String productrepo, String productreleasefolder) { def boolean productrepogood = true + echo "Querying repo: ${productrepo}" dir(productreleasefolder) { deleteDir() def returnstatus = sh(script: """#!/bin/bash @@ -249,7 +250,6 @@ def iterateinitialproductrepos(initialproductcollection, LinkedHashMap productcollection, String productreleasefolder) { for (productrepo in initialproductcollection.ProductReleaseRepos) { - echo "Querying ${productrepo}" parseproductrepo(productcollection, productrepo, productreleasefolder) @@ -259,7 +259,6 @@ def iterateinitialproductrepos(initialproductcollection, echo "Parsing extra products" productcollection.each { releaserepo, productparsed -> if (!productparsed.parsed()) { - echo "Querying unparsed ${productparsed.productvariant}" allparsed = false parseproductrepo(productcollection, releaserepo, From bf4a42881b624cffd3a9507b75f9d636ea405367 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 19:05:47 +0000 Subject: [PATCH 1954/1971] Debug sha/tags table --- product/info.groovy | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index e89922a..61e2740 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -106,6 +106,10 @@ class ProductParsed { } } +def String translateproductvariant(String productvariant) { + +} + def ProductParsed addProductEntry(LinkedHashMap productcollection, String productvariant, String releaserepo) { @@ -113,15 +117,15 @@ def ProductParsed addProductEntry(LinkedHashMap productco if (productvariant && releaserepo) { if (productcollection.get(releaserepo) == null) { // Use the first entry name only - echo "Adding product variant: ${productvariant} releaserepo: ${releaserepo}" + echo "Adding product entry: releaserepo: ${releaserepo} (product variant: ${productvariant})" productparsed = new ProductParsed(productvariant) productcollection.put(releaserepo, productparsed) } else { - echo "Already added product variant: ${productvariant}" + echo "Already added product entry: releaserepo: ${releaserepo} (product variant: ${productvariant})" } productparsed = productcollection.get(releaserepo) } else { - echo "Not adding product variant: ${productvariant} releaserepo: ${releaserepo}" + echo "Not adding product entry: releaserepo: ${releaserepo} (product variant: ${productvariant})" } return productparsed } From 14b1eff631cfcafb1343b5ee7a20c546c7106046 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 21:04:15 +0000 Subject: [PATCH 1955/1971] Provide a product variant translation table --- product/info.groovy | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 61e2740..c991f61 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -106,11 +106,19 @@ class ProductParsed { } } -def String translateproductvariant(String productvariant) { - +def String translateproductvariant(LinkedHashMap productvarianttranslation, + String releaserepo, + String productvariant) { + def translatedproductvariant = productvarianttranslation.get(releaserepo) + if (translatedproductvariant != null) { + echo "Translating product variant: ${productvariant} to: ${translatedproductvariant}" + return translatedproductvariant + } + return productvariant } def ProductParsed addProductEntry(LinkedHashMap productcollection, + LinkedHashMap productvarianttranslation, String productvariant, String releaserepo) { def ProductParsed productparsed @@ -118,7 +126,10 @@ def ProductParsed addProductEntry(LinkedHashMap productco if (productvariant && releaserepo) { if (productcollection.get(releaserepo) == null) { // Use the first entry name only echo "Adding product entry: releaserepo: ${releaserepo} (product variant: ${productvariant})" - productparsed = new ProductParsed(productvariant) + def translatedproductvariant = translateproductvariant(productvarianttranslation, + releaserepo, + productvariant) + productparsed = new ProductParsed(translatedproductvariant) productcollection.put(releaserepo, productparsed) } else { echo "Already added product entry: releaserepo: ${releaserepo} (product variant: ${productvariant})" @@ -131,6 +142,7 @@ def ProductParsed addProductEntry(LinkedHashMap productco } def parseproductdependencies(LinkedHashMap productcollection, + LinkedHashMap productvarianttranslation productreleasemeta, String productreleasefolder, String containingproductvariant, @@ -148,12 +160,14 @@ def parseproductdependencies(LinkedHashMap productcollect if (meta.productinfo.subcomponentname == 'WHOLE' && meta.productvariant() != '') { if (meta.productvariant() != containingproductvariant) { // Don't add myself addProductEntry(productcollection, + productvarianttranslation, meta.productvariant(), meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) } } else if (meta.productvariant() != containingproductvariant && meta.productvariant() != '') { addProductEntry(productcollection, + productvarianttranslation, meta.productvariant(), meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) @@ -170,6 +184,7 @@ def parseproductdependencies(LinkedHashMap productcollect } def parseproductrepo(LinkedHashMap productcollection, + LinkedHashMap productvarianttranslation, String productrepo, String productreleasefolder) { def boolean productrepogood = true @@ -220,6 +235,7 @@ def parseproductrepo(LinkedHashMap productcollection, if (!productvariant) { productvariant = productreleasemeta.productvariant() pp = addProductEntry(productcollection, + productvarianttranslation, productvariant, productrepo) if (pp) { @@ -235,6 +251,7 @@ def parseproductrepo(LinkedHashMap productcollection, tags) echo "Productrelease: ${productrelease.sha} created" parseproductdependencies(productcollection, + productvarianttranslation, productreleasemeta, productreleasefolder, productvariant, @@ -252,9 +269,11 @@ def parseproductrepo(LinkedHashMap productcollection, def iterateinitialproductrepos(initialproductcollection, LinkedHashMap productcollection, + LinkedHashMap productvarianttranslation, String productreleasefolder) { for (productrepo in initialproductcollection.ProductReleaseRepos) { parseproductrepo(productcollection, + productvarianttranslation, productrepo, productreleasefolder) } @@ -265,6 +284,7 @@ def iterateinitialproductrepos(initialproductcollection, if (!productparsed.parsed()) { allparsed = false parseproductrepo(productcollection, + productvarianttranslation, releaserepo, productreleasefolder) } else { @@ -282,5 +302,4 @@ def LinkedHashMap getNewProductCollection() { return new LinkedHashMap() } - return this \ No newline at end of file From ba8062d97e25e9e646bf289de27000defc158ce3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 21:05:47 +0000 Subject: [PATCH 1956/1971] Provide a product variant translation table --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index c991f61..44240b9 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -142,7 +142,7 @@ def ProductParsed addProductEntry(LinkedHashMap productco } def parseproductdependencies(LinkedHashMap productcollection, - LinkedHashMap productvarianttranslation + LinkedHashMap productvarianttranslation, productreleasemeta, String productreleasefolder, String containingproductvariant, From 58d69909ef3caa9b23b24e5c5d752760368e9986 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 21:07:53 +0000 Subject: [PATCH 1957/1971] Provide a product variant translation table --- product/info.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/info.groovy b/product/info.groovy index 44240b9..d1f652a 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -268,8 +268,8 @@ def parseproductrepo(LinkedHashMap productcollection, } def iterateinitialproductrepos(initialproductcollection, - LinkedHashMap productcollection, LinkedHashMap productvarianttranslation, + LinkedHashMap productcollection, String productreleasefolder) { for (productrepo in initialproductcollection.ProductReleaseRepos) { parseproductrepo(productcollection, From 3e317a5d3daed560cdd64bfb2e49be400ef310b8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 21:23:43 +0000 Subject: [PATCH 1958/1971] Provide a product variant translation table --- product/info.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index d1f652a..937b22c 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -106,7 +106,7 @@ class ProductParsed { } } -def String translateproductvariant(LinkedHashMap productvarianttranslation, +def String translateproductvariant(productvarianttranslation, String releaserepo, String productvariant) { def translatedproductvariant = productvarianttranslation.get(releaserepo) @@ -118,7 +118,7 @@ def String translateproductvariant(LinkedHashMap productvariantt } def ProductParsed addProductEntry(LinkedHashMap productcollection, - LinkedHashMap productvarianttranslation, + productvarianttranslation, String productvariant, String releaserepo) { def ProductParsed productparsed @@ -142,7 +142,7 @@ def ProductParsed addProductEntry(LinkedHashMap productco } def parseproductdependencies(LinkedHashMap productcollection, - LinkedHashMap productvarianttranslation, + productvarianttranslation, productreleasemeta, String productreleasefolder, String containingproductvariant, @@ -184,7 +184,7 @@ def parseproductdependencies(LinkedHashMap productcollect } def parseproductrepo(LinkedHashMap productcollection, - LinkedHashMap productvarianttranslation, + productvarianttranslation, String productrepo, String productreleasefolder) { def boolean productrepogood = true @@ -268,7 +268,7 @@ def parseproductrepo(LinkedHashMap productcollection, } def iterateinitialproductrepos(initialproductcollection, - LinkedHashMap productvarianttranslation, + productvarianttranslation, LinkedHashMap productcollection, String productreleasefolder) { for (productrepo in initialproductcollection.ProductReleaseRepos) { From 5db7c8dd22cfb8d0b4dfa94f56c53fac2e35b65b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 21:33:17 +0000 Subject: [PATCH 1959/1971] Provide a product variant translation table --- product/info.groovy | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 937b22c..c6cccff 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -150,25 +150,28 @@ def parseproductdependencies(LinkedHashMap productcollect def dependentmeta = productreleasemeta.getassociated(productreleasefolder) for (meta in dependentmeta) { - if (meta.productvariant() && meta.productinfo.subcomponentname) { + def translatedproductvariant = translateproductvariant(productvarianttranslation, + releaserepo, + meta.productvariant()) + if (translatedproductvariant && meta.productinfo.subcomponentname) { def pd = new ProductDependency(this, rt, - meta.productvariant(), + translatedproductvariant, meta.releasetag(), meta.releaseinfo.releaserepoURL) pd.setreleasestate() - if (meta.productinfo.subcomponentname == 'WHOLE' && meta.productvariant() != '') { - if (meta.productvariant() != containingproductvariant) { // Don't add myself + if (meta.productinfo.subcomponentname == 'WHOLE' && translatedproductvariant) { + if (translatedproductvariant != containingproductvariant) { // Don't add myself addProductEntry(productcollection, productvarianttranslation, - meta.productvariant(), + translatedproductvariant, meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) } - } else if (meta.productvariant() != containingproductvariant && meta.productvariant() != '') { + } else if (translatedproductvariant != containingproductvariant && translatedproductvariant) { addProductEntry(productcollection, productvarianttranslation, - meta.productvariant(), + translatedproductvariant, meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) } else { From 806f098ac64bac602802892659f2bf7fa155558c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 21:38:50 +0000 Subject: [PATCH 1960/1971] Provide a product variant translation table --- product/info.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index c6cccff..1d22cb0 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -151,7 +151,7 @@ def parseproductdependencies(LinkedHashMap productcollect for (meta in dependentmeta) { def translatedproductvariant = translateproductvariant(productvarianttranslation, - releaserepo, + meta.releaseinfo.releaserepoURL, meta.productvariant()) if (translatedproductvariant && meta.productinfo.subcomponentname) { def pd = new ProductDependency(this, @@ -257,7 +257,7 @@ def parseproductrepo(LinkedHashMap productcollection, productvarianttranslation, productreleasemeta, productreleasefolder, - productvariant, + pp.productvariant, productrelease) echo "Productrelease: ${productrelease.sha} added to Productvariant: ${pp.productvariant}" pp.addProductRelease(productrelease) From 2e74b329a610a494ed8a3979bca5f24d0940e040 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 21:53:33 +0000 Subject: [PATCH 1961/1971] Provide a product variant translation table --- product/info.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 1d22cb0..4ff347b 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -242,9 +242,9 @@ def parseproductrepo(LinkedHashMap productcollection, productvariant, productrepo) if (pp) { - echo "Productvariant: ${pp.productvariant} created" + echo "Product variant created for: ${productrepo} name: ${pp.productvariant}" } else { - echo "No product entry added/associated with ${productvariant}" + echo "No product entry added/associated with ${productrepo} name: ${productvariant}" } } From 2ae44ffdcd5cbad80fea76cb895f17c1a7828c08 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 13 Mar 2022 22:19:51 +0000 Subject: [PATCH 1962/1971] Use productvariant() instead of .productinfo.productname --- differences/dometahierarchy.groovy | 16 ++++++++-------- documentation/doxygen_deploy.groovy | 6 +++--- publish/do.groovy | 6 +++--- release/do.groovy | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 3b25798..34a7dfe 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -27,7 +27,7 @@ class JiraTicketInfo { } class DifferenceRecord { - String productname + String productvariant String subcomponentname String rawdifferencetext @@ -39,7 +39,7 @@ class DifferenceRecord { String comment DifferenceRecord() { - productname = "" + productvariant = "" subcomponentname = "" rawdifferencetext = "" @@ -130,7 +130,7 @@ def boolean checkoutsourcerepo(buildmeta, String checkoutfolder) { } def String getcomponent(meta) { - def String uniquefolder = "${meta.productinfo.productname}_${meta.productinfo.subcomponentname}" + def String uniquefolder = "${meta.productvariant()}_${meta.productinfo.subcomponentname}" def String uniquefoldertemp = "${tempfolder}/${uniquefolder}" def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}" @@ -343,7 +343,7 @@ def List fillrecord(meta, line, String sourcepath) { def List differencerecords = [] def DifferenceRecord dr = new DifferenceRecord() - dr.productname = meta.productinfo.productname + dr.productvariant = meta.productvariant() dr.subcomponentname = meta.productinfo.subcomponentname dr.rawdifferencetext = line @@ -755,7 +755,7 @@ def boolean report(meta, title, differencerecords, boolean iscomponent = true) { def title(earlymeta, latermeta) { return """ Differences in: - Product: ${earlymeta.productinfo.productname} Subcomponent: ${earlymeta.productinfo.subcomponentname} + Product: ${earlymeta.productvariant()} Subcomponent: ${earlymeta.productinfo.subcomponentname} between: then: Build date: ${earlymeta.jenkinsbuildinfo.builddate} Build stamp: ${earlymeta.buildstampinfo.buildstamp} Git revision: ${earlymeta.gitinfo.gitrevision} @@ -771,7 +771,7 @@ def compare(earlymetaitems, latermetaitems, key) { def earlymeta = earlymetaitems[key].metainfo def latermeta = latermetaitems[key].metainfo - summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ") + summaryappend("${earlymeta.productvariant()} ${earlymeta.productinfo.subcomponentname}: Changed: ") def boolean repoavailable def String uniquefolderforsourcerepo @@ -817,14 +817,14 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin (result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key) differencerecords = differencerecords + componentdifferencerecords } else { - summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ") + summaryappend("${earlymeta.productvariant()} ${earlymeta.productinfo.subcomponentname}: ") deletedcomponent(earlymetaitems, key) summaryappend("\n") } } for (key in latermetaitems.keySet()) { if (!earlymetaitems.containsKey(key)) { - summaryappend("${latermeta.productinfo.productname} ${latermeta.productinfo.subcomponentname}: ") + summaryappend("${latermeta.productvariant()} ${latermeta.productinfo.subcomponentname}: ") addedcomponent(latermetaitems, key) summaryappend("\n") } diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy index 5054c02..e2f74a7 100644 --- a/documentation/doxygen_deploy.groovy +++ b/documentation/doxygen_deploy.groovy @@ -30,10 +30,10 @@ pipeline { importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**') doxygenmeta = importer.artifactimportfrombuildjob(meta, importoptions, DOXYGEN) - productname = doxygenmeta.productinfo.productname + productvariant = doxygenmeta.productvariant() buildstampprefix = doxygenmeta.buildstampinfo.buildstampprefix - echo "Doyxgen imported for product: ${productname} and build stamp prefix: ${buildstampprefix}" + echo "Doyxgen imported for product: ${productvariant} and build stamp prefix: ${buildstampprefix}" } } } @@ -41,7 +41,7 @@ pipeline { steps { script { doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}" - pathonserver = "${ROOT_PATH_ON_SERVER.trim()}/${productname}/${buildstampprefix}" + pathonserver = "${ROOT_PATH_ON_SERVER.trim()}/${productvariant}/${buildstampprefix}" echo "Copying from ${doxygensource} to ${pathonserver}" if (isUnix()) { sh """#!/bin/bash diff --git a/publish/do.groovy b/publish/do.groovy index ea090f0..8e302d8 100644 --- a/publish/do.groovy +++ b/publish/do.groovy @@ -22,7 +22,7 @@ def resetfolders() { } def productuniquefolder(releasemeta) { - return "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}" + return "${releasemeta.productvariant()}_${releasemeta.productinfo.subcomponentname}" } def uniquereleasefolder(String productline, String softwarerelease, releasemeta) { @@ -116,7 +116,7 @@ def recallcomponent(String productline, releaseinfo, String softwarerelease, ite def releasemeta = releaseinfo.metainfo def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta) - summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ") + summaryappend("${releasemeta.productvariant()} ${releasemeta.productinfo.subcomponentname}: ") getcomponentartifacts(releaseinfo, uniquefolderforrepo, itempathstopublish) @@ -145,7 +145,7 @@ def publishhierarchy(hostedftpsiteinfo, releasemeta, String releasemetapath, Str resetfolders() preconditions() - def productline = releasemeta.productinfo.productname + def productline = releasemeta.productvariant() // Walk the meta information to a max depth, looking for artifacts to publish def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md, '', releasemetapath) diff --git a/release/do.groovy b/release/do.groovy index 4dcb091..05de91f 100644 --- a/release/do.groovy +++ b/release/do.groovy @@ -191,7 +191,7 @@ def ArrayList maketaglist(buildmeta, String buildstamp, String otherrele def ArrayList othertaglist = otherreleasetags.split(',') for (othertagitem in othertaglist) { if (othertagitem?.trim()) { - def componentothertagitem = "${othertagitem.trim()}_${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}" + def componentothertagitem = "${othertagitem.trim()}_${buildmeta.productvariant()}_${buildmeta.productinfo.subcomponentname}" taglist.add(componentothertagitem) } } @@ -377,13 +377,13 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) { def buildmeta = buildinfo.metainfo def uriconverted = gh.uniquereporootname(buildmeta.gitinfo.remoteurl) - def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${uriconverted}" + def String uniquefolder = "${buildmeta.productvariant()}_${buildmeta.productinfo.subcomponentname}_${uriconverted}" 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}: ") + summaryappend("${buildmeta.productvariant()} ${buildmeta.productinfo.subcomponentname}: ") + repoandtagsappend("${buildmeta.productvariant()} ${buildmeta.productinfo.subcomponentname}: ") def previousreleasemeta = checkoutreleaserepo(buildmeta, uniquefolderforrepo) checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo) From 2b61646633b3b31d05e8cb3f30039c7dab39a12d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Mar 2022 08:29:42 +0000 Subject: [PATCH 1963/1971] Products are those with WHOLE subcomponent --- product/info.groovy | 6 ------ 1 file changed, 6 deletions(-) diff --git a/product/info.groovy b/product/info.groovy index 4ff347b..67d1449 100644 --- a/product/info.groovy +++ b/product/info.groovy @@ -168,12 +168,6 @@ def parseproductdependencies(LinkedHashMap productcollect meta.releaseinfo.releaserepoURL) productrelease.addProductDependency(pd) } - } else if (translatedproductvariant != containingproductvariant && translatedproductvariant) { - addProductEntry(productcollection, - productvarianttranslation, - translatedproductvariant, - meta.releaseinfo.releaserepoURL) - productrelease.addProductDependency(pd) } else { def pc = new ProductComponent(meta.productinfo.subcomponentname, meta.releasetag(), From 7c05ddea69d1bbd8eaeb814432d685018cad0c06 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Mar 2022 13:42:58 +0000 Subject: [PATCH 1964/1971] Use productvariant() instead of .productinfo.productname --- differences/dometahierarchy.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy index 34a7dfe..f9a2404 100644 --- a/differences/dometahierarchy.groovy +++ b/differences/dometahierarchy.groovy @@ -56,7 +56,7 @@ class DifferenceRecord { 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}" + return "Difference Record:\nproductvariant: ${productvariant}\nsubcomponentname: ${subcomponentname}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketstring}\ncomment: ${comment}" } } From d21f4b1a7e2b16b12748bb9df024f0f7534b9302 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Mar 2022 15:00:37 +0000 Subject: [PATCH 1965/1971] Pass meta to post action handlers; Pass release repo to post actions --- build/postactions.groovy | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index 8b18908..f4465bc 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -85,16 +85,20 @@ def getActionJobName(postbuildactions, String action, String alternativeparamnam return jobname } -def deployjob(String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername) { +def deployjob(meta, String buildselector, postbuildactions, String action, String alternativeparamname, String jobnameparametername, String jobselectorparametername, String releaserepoparametername = '') { def jobname = getActionJobName(postbuildactions, action, alternativeparamname) if (jobname) { + def parameters = [ + StringParameterValue(jobnameparametername, JOB_NAME), + StringParameterValue(jobselectorparametername, buildselector), + ] + if (releaserepoparametername) { + parameters += StringParameterValue(releaserepoparametername, meta.releaseinfo.releaserepoURL) + } build( wait: false, job: jobname, - parameters: [ - string(name: jobnameparametername, value: JOB_NAME), - string(name: jobselectorparametername, value: buildselector), - ] + parameters: parameters ) } } @@ -107,7 +111,7 @@ def readPostBuildInfo() { return postbuildinfo } -def performSuccessfulBuildActions() { +def performSuccessfulBuildActions(meta) { def postbuildactions if (params.POST_BUILD_INFO != null) { def postbuildinfo = readPostBuildInfo() @@ -119,12 +123,12 @@ def performSuccessfulBuildActions() { } } def String buildselector = "${BUILD_NUMBER}" - deployjob(buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR') - deployjob(buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' ) - deployjob(buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') - deployjob(buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') - deployjob(buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR') - deployjob(buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR') + deployjob(meta, buildselector, postbuildactions, 'Deploy documentation', 'DOXYGEN_DEPLOY_JOB', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR') + deployjob(meta, buildselector, postbuildactions, 'Static analysis', 'STATIC_ANALYSIS_JOB', 'BUILD_JOB_TO_ANALYSE', 'BUILD_JOB_TO_ANALYSE_SELECTOR' ) + deployjob(meta, buildselector, postbuildactions, 'Unit test', 'UNIT_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') + deployjob(meta, buildselector, postbuildactions, 'Regression test', 'REGRESSION_TEST_JOB', 'BUILD_JOB_TO_TEST', 'BUILD_JOB_TO_TEST_SELECTOR') + deployjob(meta, buildselector, postbuildactions, 'Update differences', 'DIFF_JOB', 'LATER_BUILD_JOB', 'LATER_BUILD_SELECTOR', 'TOP_LEVEL_META_REPOSITORY') + deployjob(meta, buildselector, postbuildactions, 'Release to git', 'RELEASE_TO_GIT_JOB', 'BUILD_JOB', 'BUILD_JOB_SELECTOR') } def sendemails(emailinfo) { @@ -201,7 +205,7 @@ def sendextemail(extmailinfo) { ) } -def performFailedBuildActions() { +def performFailedBuildActions(meta) { def postbuildactions = null if (params.POST_BUILD_INFO != null) { def postbuildinfo = readPostBuildInfo() From 791c94c94d28ee29daf58b55738cd9c13cd158eb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 14 Mar 2022 23:26:58 +0000 Subject: [PATCH 1966/1971] Pass meta to post action handlers; Pass release repo to post actions --- build/postactions.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/postactions.groovy b/build/postactions.groovy index f4465bc..3206004 100644 --- a/build/postactions.groovy +++ b/build/postactions.groovy @@ -89,11 +89,11 @@ def deployjob(meta, String buildselector, postbuildactions, String action, Strin def jobname = getActionJobName(postbuildactions, action, alternativeparamname) if (jobname) { def parameters = [ - StringParameterValue(jobnameparametername, JOB_NAME), - StringParameterValue(jobselectorparametername, buildselector), + new StringParameterValue(jobnameparametername, JOB_NAME), + new StringParameterValue(jobselectorparametername, buildselector), ] if (releaserepoparametername) { - parameters += StringParameterValue(releaserepoparametername, meta.releaseinfo.releaserepoURL) + parameters += new StringParameterValue(releaserepoparametername, meta.releaseinfo.releaserepoURL) } build( wait: false, From a517c026b64d5bb4cbb57b23041be976891fc207 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 23 Mar 2022 18:14:14 +0000 Subject: [PATCH 1967/1971] Use the autobuild script revision count to alter the version --- versionnumbering/generate.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 5e974e2..c3c4266 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -146,13 +146,17 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) + (scriptgitrevisioncount, scriptgitrevision, scriptremoteinfo, scriptremoteurl) = getGitRevision(autobuilder, 0) + + def int totalrevisioncount = incrementrevision(gitrevisioncount, scriptgitrevisioncount) { + def versionprefix = getVersionPrefix(sourcerevision) - def buildstamp = versionprefix + gitrevisioncount.toString() + def buildstamp = versionprefix + totalrevisioncount.toString() echo "Build stamp is: ${buildstamp}" meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo) - meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp) + meta.buildstampinfo.set(versionprefix, totalrevisioncount, buildstamp) return buildstamp } From 554e551e76e8042573e8f1251aba5e24edccb0dc Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 23 Mar 2022 18:19:06 +0000 Subject: [PATCH 1968/1971] Use the autobuild script revision count to alter the version --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index c3c4266..9db65ac 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -148,7 +148,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum (scriptgitrevisioncount, scriptgitrevision, scriptremoteinfo, scriptremoteurl) = getGitRevision(autobuilder, 0) - def int totalrevisioncount = incrementrevision(gitrevisioncount, scriptgitrevisioncount) { + def int totalrevisioncount = incrementrevision(gitrevisioncount, scriptgitrevisioncount) def versionprefix = getVersionPrefix(sourcerevision) From 727be2da189f8836419803dc6b14ceda0dd2174b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 23 Mar 2022 18:38:25 +0000 Subject: [PATCH 1969/1971] Use the autobuild script revision count to alter the version --- versionnumbering/generate.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 9db65ac..6cec569 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -11,7 +11,7 @@ int incrementrevision(int current, int increment) { return newrevision } -def getGitRevision(String gitrootpath, int basebuildnumber) { +def getGitRevision(String gitrootpath, int basebuildnumber = 0) { def int adjustedchangecount def String gitrevision def String remoteinfo @@ -146,7 +146,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) - (scriptgitrevisioncount, scriptgitrevision, scriptremoteinfo, scriptremoteurl) = getGitRevision(autobuilder, 0) + (scriptgitrevisioncount, scriptgitrevision, scriptremoteinfo, scriptremoteurl) = getGitRevision(autobuilder) def int totalrevisioncount = incrementrevision(gitrevisioncount, scriptgitrevisioncount) From 659d0a0a827dbc01ba54e06d84d0663db36144e2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 23 Mar 2022 18:40:04 +0000 Subject: [PATCH 1970/1971] Use the autobuild script revision count to alter the version --- versionnumbering/generate.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 6cec569..176c42c 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -143,9 +143,12 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum def String gitrevision def String remoteinfo def String remoteurl - (gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber) + def int scriptgitrevisioncount + def String scriptgitrevision + def String scriptremoteinfo + def String scriptremoteurl (scriptgitrevisioncount, scriptgitrevision, scriptremoteinfo, scriptremoteurl) = getGitRevision(autobuilder) def int totalrevisioncount = incrementrevision(gitrevisioncount, scriptgitrevisioncount) From 98bc43bd9ea1b5adeebd4ad84bde71ac371b9a62 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 23 Mar 2022 18:44:59 +0000 Subject: [PATCH 1971/1971] Use the autobuild script revision count to alter the version --- versionnumbering/generate.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 176c42c..40413d7 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -149,7 +149,7 @@ String generate(meta, String sourcerevision, String sourcepath, int basebuildnum def String scriptgitrevision def String scriptremoteinfo def String scriptremoteurl - (scriptgitrevisioncount, scriptgitrevision, scriptremoteinfo, scriptremoteurl) = getGitRevision(autobuilder) + (scriptgitrevisioncount, scriptgitrevision, scriptremoteinfo, scriptremoteurl) = getGitRevision(autobuilder.getautobuildpath()) def int totalrevisioncount = incrementrevision(gitrevisioncount, scriptgitrevisioncount)