Correct import flattenning
This commit is contained in:
parent
b131bc7218
commit
e8258c9b28
1 changed files with 18 additions and 3 deletions
|
|
@ -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<String> sparseitemlist = gh.convertSparseItemsString(importoptions.m_filter)
|
||||
def ArrayList<String> 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<String> sparseitemlist = gh.convertSparseItemsString(importoptions.m_filter)
|
||||
def ArrayList<String> 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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue