Add checksum info to meta
This commit is contained in:
parent
820586ccd2
commit
eee94ee262
2 changed files with 87 additions and 11 deletions
|
|
@ -1,21 +1,14 @@
|
|||
|
||||
metafolder = load("${autobuilder.commonscripts()}/meta/folder.groovy")
|
||||
env.CHECKSUMARTIFACTS = "${metafolder.METAFOLDERNAME}/checksums/**"
|
||||
CHECKSUMFOLDER = "${metafolder.METAFOLDERNAME}/checksums"
|
||||
|
||||
// Generate a checksum file of from a list of files/directories relative to workspace
|
||||
def generatelist(checksummable) {
|
||||
load("${autobuilder.commonscripts()}/platform/lineendings.groovy")
|
||||
sums = ""
|
||||
def generatelist(meta, checksummable) {
|
||||
for (filepath in checksummable) {
|
||||
echo "Checksumming ${filepath}"
|
||||
def checksumset = meta.checksuminfo.addchecksumset(filepath)
|
||||
def files = findFiles(glob: filepath)
|
||||
for (file in files) {
|
||||
def sum = sha1(file: file.path)
|
||||
sums += "${sum} ${file.path}${nl}" // Format suitable for sha1sum utility
|
||||
def sum = sha1(file: file.path).trim()
|
||||
checksumset.addChecksumPair(file.path, sum)
|
||||
}
|
||||
}
|
||||
writeFile(file: "${CHECKSUMFOLDER}/sha1sumlist.txt", text: sums)
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -187,6 +187,86 @@ class ConfigurationInfo extends GISJsonSerialised {
|
|||
}
|
||||
}
|
||||
|
||||
class ChecksumPair extends GISJsonSerialised {
|
||||
private String filepath
|
||||
private String sum
|
||||
|
||||
ChecksumPair(script, String filepath, String sum) {
|
||||
super(checksumset.script)
|
||||
this.filepath = filepath
|
||||
this.sum = sum
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'filepath' : filepath,
|
||||
'sum' : sum,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class ChecksumSet extends GISJsonSerialised {
|
||||
private String artifactpath
|
||||
private ArrayList<ChecksumPair> checksumpairs
|
||||
|
||||
ChecksumInfo(script, artifactpath) {
|
||||
super(script)
|
||||
this.artifactpath = artifactpath
|
||||
}
|
||||
|
||||
ChecksumPair addChecksumPair(String filepath, String sum) {
|
||||
def cp = new ChecksumPair(script, filepath, sum)
|
||||
checksumpairs.add(cp)
|
||||
return cp
|
||||
}
|
||||
|
||||
List checksumpairsserialised() {
|
||||
def associated = []
|
||||
for (cp in checksumpairs) {
|
||||
associated.add(cp.serialisationdata())
|
||||
}
|
||||
return associated
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'artifactpath' : artifactpath,
|
||||
'checksumpairs' : checksumpairsserialised(),
|
||||
]
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
class ChecksumInfo extends GISJsonSerialised {
|
||||
private ArrayList<ChecksumSet> checksumsets
|
||||
|
||||
ChecksumInfo(script) {
|
||||
super(script)
|
||||
}
|
||||
|
||||
ChecksumSet addChecksumSet(String artifactpath) {
|
||||
def cs = new ChecksumSet(script, artifactpath)
|
||||
checksumsets.add(cs)
|
||||
return cs
|
||||
}
|
||||
|
||||
List checksumsetsserialised() {
|
||||
def associated = []
|
||||
for (cs in checksumsets) {
|
||||
associated.add(cs.serialisationdata())
|
||||
}
|
||||
return associated
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'checksumsets' : checksumsetsserialised(),
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class MetaInfo extends GISJsonSerialised {
|
||||
private String METAFOLDERNAME = "meta"
|
||||
private String METAFILENAME = "info.json"
|
||||
|
|
@ -198,6 +278,7 @@ class MetaInfo extends GISJsonSerialised {
|
|||
JenkinsBuildInfo jenkinsbuildinfo
|
||||
BuildStampInfo buildstampinfo
|
||||
ReleaseInfo releaseinfo
|
||||
ChecksumInfo checksuminfo
|
||||
private ArrayList<ConfigurationInfo> configurationinfo
|
||||
private ArrayList<MetaInfo> associatedmeta
|
||||
|
||||
|
|
@ -208,6 +289,7 @@ class MetaInfo extends GISJsonSerialised {
|
|||
jenkinsbuildinfo = new JenkinsBuildInfo(script)
|
||||
buildstampinfo = new BuildStampInfo(script)
|
||||
releaseinfo = new ReleaseInfo(script)
|
||||
checksuminfo = new ChecksumInfo(script)
|
||||
configurationinfo = new ArrayList<ConfigurationInfo>()
|
||||
associatedmeta = new ArrayList<MetaInfo>()
|
||||
}
|
||||
|
|
@ -246,6 +328,7 @@ class MetaInfo extends GISJsonSerialised {
|
|||
'buildstampinfo' : buildstampinfo.serialisationdata(),
|
||||
'releaseinfo' : releaseinfo.serialisationdata(),
|
||||
'configuration' : configurationinfoserialised(),
|
||||
'checksuminfo' : checksuminfo.serialisationdata(),
|
||||
'associatedmeta' : associatedmetaserialised(),
|
||||
]
|
||||
return data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue