GIS-1621 - Try to stop jenkins crash - member names
This commit is contained in:
parent
6621b2c402
commit
c6ef2c58ad
1 changed files with 65 additions and 65 deletions
|
|
@ -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<String> sparseitemlist = gh.convertSparseItemsString(importoptions.filter)
|
||||
def ArrayList<String> 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<String> sparseitemlist = gh.convertSparseItemsString(importoptions.filter)
|
||||
def ArrayList<String> 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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue