From 6b35583fd2565683a197829f481c5521aef0af11 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 19 Dec 2021 21:13:30 +0000 Subject: [PATCH] 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 +}