Move meta data to one groovy file because of the difficulty of including/importing groovy classes
This commit is contained in:
parent
94ddf17df7
commit
bbc3da7e37
5 changed files with 181 additions and 97 deletions
|
|
@ -35,10 +35,8 @@ def start(script, productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NA
|
||||||
conditionalclean()
|
conditionalclean()
|
||||||
|
|
||||||
def metafolder = load("${commonscripts()}/meta/folder.groovy")
|
def metafolder = load("${commonscripts()}/meta/folder.groovy")
|
||||||
metafolder.metareset()
|
metafolder.metareset(script)
|
||||||
|
metafolder.setproductinfo(productname, subcomponentname, jirakey)
|
||||||
def productinfo = load("${commonscripts()}/product/info.groovy")
|
|
||||||
productinfo.setname(script, productname, subcomponentname, jirakey)
|
|
||||||
|
|
||||||
def ch = load("${commonscripts()}/configuration/configuration.groovy")
|
def ch = load("${commonscripts()}/configuration/configuration.groovy")
|
||||||
ch.registerPipelineScriptConfiguration()
|
ch.registerPipelineScriptConfiguration()
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
|
|
@ -2,11 +2,189 @@
|
||||||
METAFOLDERNAME = "meta"
|
METAFOLDERNAME = "meta"
|
||||||
env.METAARTIFACTS = "${METAFOLDERNAME}/**"
|
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"
|
echo "Resetting meta folder"
|
||||||
dir("${WORKSPACE}/${METAFOLDERNAME}") {
|
dir("${WORKSPACE}/${METAFOLDERNAME}") {
|
||||||
deleteDir()
|
deleteDir()
|
||||||
}
|
}
|
||||||
|
theMetaData = new MetaInfo(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def setproductinfo(productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY) {
|
||||||
|
theMetaData.setproductinfo(productname, subcomponentname, jirakey)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -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;
|
|
||||||
|
|
@ -1,22 +1,9 @@
|
||||||
|
|
||||||
def ji = load("${autobuilder.commonscripts()}/json/interface.groovy")
|
|
||||||
|
|
||||||
metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy")
|
metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy")
|
||||||
env.VERSIONARTIFACTS = "${metafolder.METAFOLDERNAME}/version/**"
|
|
||||||
VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version"
|
VERSIONFOLDER = "${WORKSPACE}/${metafolder.METAFOLDERNAME}/version"
|
||||||
|
|
||||||
def pi = load("${autobuilder.commonscripts()}/product/info.groovy")
|
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 generate(sourcerevision, sourcepath, basebuildnumber = "1000", releasejobname = "", versionfolder = "${VERSIONFOLDER}", jobname = "${JOB_NAME}", buildid = "${BUILD_ID}") {
|
||||||
def cs = autobuilder.commonscripts()
|
def cs = autobuilder.commonscripts()
|
||||||
if (isUnix()) {
|
if (isUnix()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue