diff --git a/copy/all.groovy b/copy/all.groovy index aab479c..24aacfb 100644 --- a/copy/all.groovy +++ b/copy/all.groovy @@ -4,21 +4,13 @@ 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) + artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") } } } @@ -34,29 +26,25 @@ pipeline { SOURCE_ARTIFACT_RELEASE_REVISION) echo "Nested: ${NESTED_COPY}" copyoptions.setnested(NESTED_COPY == 'true') - importer.artifactimport(meta, copyoptions, IMPORTS) + importer.artifactimport(meta, copyoptions, "${WORKSPACE}/.") } } } stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(['**/*']) - def artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy") + // 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']) - dir(IMPORTS) { - fileOperations([ - fileCopyOperation(excludes: '', - flattenFiles: false, - includes: '**/*', - targetLocation: WORKSPACE) - ]) - } + unstash(name: stashname) - cleaner.clean([IMPORTS]) - artifactarchiver.archive(meta, artifactlist) } } diff --git a/import/importer.groovy b/import/importer.groovy index 4948cad..fa32ebf 100644 --- a/import/importer.groovy +++ b/import/importer.groovy @@ -239,15 +239,17 @@ 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() != '_' && + 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()}"