Merge commit 'd2a31e9baf'
This commit is contained in:
commit
4bf94f2272
26 changed files with 1270 additions and 317 deletions
|
|
@ -40,7 +40,7 @@ def doCheck(checkpathlist, build_variant = "") {
|
|||
// Print out dependencies of the built file
|
||||
echo "Showing dependencies of ${srcFileExpanded}"
|
||||
result = sh( script: """
|
||||
readelf -d "${srcFileExpanded}" | grep NEEDED
|
||||
readelf -d "${srcFileExpanded}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
""",
|
||||
returnStatus: true
|
||||
|
|
@ -54,7 +54,7 @@ def doCheck(checkpathlist, build_variant = "") {
|
|||
return result
|
||||
}
|
||||
|
||||
def doExport(exportfolder, exportpathlist, project = "", build_variant = "") {
|
||||
def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") {
|
||||
def result = 0
|
||||
def destFolder = ""
|
||||
def srcFile = ""
|
||||
|
|
@ -62,24 +62,26 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") {
|
|||
for (exportpath in exportpathlist) {
|
||||
echo "Export path at: ${exportpath}"
|
||||
script {
|
||||
echo "Build variant is ${build_variant}"
|
||||
if (build_variant) {
|
||||
echo "Build variant is ${build_variant}"
|
||||
destFolder = "${exportfolder}/${build_variant}"
|
||||
srcFile = "${WORKSPACE}/${exportpath}"
|
||||
srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
}
|
||||
else {
|
||||
echo "No build variant"
|
||||
destFolder = "${exportfolder}/${project}"
|
||||
srcFileExpanded = "${WORKSPACE}/${exportpath}"
|
||||
}
|
||||
destFolder = "${exportfolder}"
|
||||
if (partdest) {
|
||||
destFolder += "/" + partdest
|
||||
}
|
||||
}
|
||||
dir (destFolder) {
|
||||
echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\""
|
||||
def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
dir (destFolderExpanded) {
|
||||
echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\""
|
||||
if (isUnix()) {
|
||||
result = sh( script: """
|
||||
cp -r -v "${srcFileExpanded}" "${destFolder}"
|
||||
cp -v --no-dereference --preserve=links -r "${srcFileExpanded}" "${destFolderExpanded}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
""",
|
||||
returnStatus: true
|
||||
|
|
@ -90,7 +92,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") {
|
|||
}
|
||||
else {
|
||||
result = bat( script: """
|
||||
copy "${srcFileExpanded}" "${destFolder}"
|
||||
copy "${srcFileExpanded}" "${destFolderExpanded}"
|
||||
if errorlevel 1 EXIT /b 1
|
||||
""",
|
||||
returnStatus: true
|
||||
|
|
@ -145,8 +147,76 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand,
|
|||
}
|
||||
}
|
||||
|
||||
def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) {
|
||||
echo "Doing build and export project: ${project} : ${doexport}"
|
||||
for (build_variant in variants) {
|
||||
retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing)
|
||||
try {
|
||||
if (toBuild.contains(build_variant)) {
|
||||
doDisplayLeftovers()
|
||||
doRegisterToolchain(ds5folder, toolchainfolder)
|
||||
echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'"
|
||||
timeout(time: 20, unit: 'MINUTES') {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
echo Start time: `date`
|
||||
${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'
|
||||
echo End time: `date`
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
result = doCheck(exportpathlist, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to check files...."
|
||||
}
|
||||
echo "Doing export: ${doexport}"
|
||||
if (doexport) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "Not building ${build_variant} variant of project: ${project}"
|
||||
}
|
||||
} catch (Exception e) {
|
||||
echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while"
|
||||
sleep(time: 4, unit: 'SECONDS')
|
||||
error "Build failed..."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def doExportOnlyProject(String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) {
|
||||
echo "Doing export only project: ${project} : ${doexport}"
|
||||
if (doexport) {
|
||||
if (!variants) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
} else {
|
||||
for (build_variant in variants) {
|
||||
if (toBuild.contains(build_variant)) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build and export files
|
||||
def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/bin") {
|
||||
def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") {
|
||||
toBuild = []
|
||||
if (variantstobuild) {
|
||||
toBuildUntrimmed = variantstobuild.split(',')
|
||||
|
|
@ -161,69 +231,20 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou
|
|||
addToolchainPath(toolchainfolder)
|
||||
doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder)
|
||||
}
|
||||
for (appInfo in apps ) {
|
||||
(build, cleanbuild, project, variants, exportpathlist) = appInfo
|
||||
for (appInfo in apps) {
|
||||
def Boolean build
|
||||
def Boolean doexport
|
||||
(build, doexport, project, variants, exportpathlist, destpart) = appInfo
|
||||
if (build) {
|
||||
if (cleanbuild) {
|
||||
buildtype = "-cleanBuild"
|
||||
}
|
||||
else {
|
||||
buildtype = "-build"
|
||||
}
|
||||
for (build_variant in variants) {
|
||||
retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing)
|
||||
try {
|
||||
if (toBuild.contains(build_variant)) {
|
||||
doDisplayLeftovers()
|
||||
doRegisterToolchain(ds5folder, toolchainfolder)
|
||||
echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'"
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
echo Start time: `date`
|
||||
${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'
|
||||
echo End time: `date`
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
result = doCheck(exportpathlist, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to check files...."
|
||||
}
|
||||
result = doExport(exportfolder, exportpathlist, "", build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "Not building ${build_variant} variant of project: ${project}"
|
||||
}
|
||||
} catch (Exception e) {
|
||||
echo "Build failed - Waiting for a while"
|
||||
sleep(time: 4, unit: 'SECONDS')
|
||||
error "Build failed..."
|
||||
}
|
||||
}
|
||||
}
|
||||
doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart)
|
||||
}
|
||||
else {
|
||||
// Only export if the project has no variants - signifying that there are files to export which have been prebuilt
|
||||
if (!variants) {
|
||||
result = doExport(exportfolder, exportpathlist, project)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart)
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// doKillLeftovers()
|
||||
error "Build failed - Killing leftovers"
|
||||
error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ def registerConfigurationInfo(meta, String configurationName, String configurati
|
|||
}
|
||||
|
||||
def registerPipelineScriptConfiguration(meta) {
|
||||
registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo("${autobuilder.getautobuildpath()}"))
|
||||
registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo(autobuilder.getautobuildpath()))
|
||||
}
|
||||
|
||||
def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true) {
|
||||
def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') {
|
||||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
|
||||
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
|
||||
|
||||
registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pipeline {
|
|||
cleanfolders = [
|
||||
"${WORKSPACE}/logic",
|
||||
"${WORKSPACE}/embedded_logic",
|
||||
"${WORKSPACE}/diff",
|
||||
"${WORKSPACE}/diff", // Some old artifacts have this folder
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
|
|
@ -37,8 +37,9 @@ pipeline {
|
|||
script {
|
||||
def artifactlist = meta.generateartifacts(["embedded_logic/**"])
|
||||
sh """
|
||||
rm -v -rf diff meta embedded_logic
|
||||
mv -v logic/* .
|
||||
rm -v -rf diff
|
||||
rm -v -rf meta
|
||||
mv -v "logic"/* .
|
||||
"""
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
|
|
@ -59,4 +60,4 @@ pipeline {
|
|||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
def differences(meta, String sourcerevision, String previoussourcerevision, String sourcepath) {
|
||||
def String cs = autobuilder.commonscripts()
|
||||
def String difffile = meta.difffilepath()
|
||||
def String jirakey = meta.productinfo.jirakey
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
"${PYTHON}" -u "${cs}/differences/show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}"
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"${PYTHON}" -u "${cs}\\differences\\show_release_differences.py" -g "${sourcepath}" -s "${sourcerevision}" -p "${previoussourcerevision}" -j "${jirakey}" -o "opposite notcommon" -f "${difffile}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
@ -405,9 +405,9 @@ class MergeReportRecord {
|
|||
}
|
||||
}
|
||||
|
||||
def mergereport(String reportsubfolder, LinkedHashMap<String, MergeReportRecord> merges, boolean iscomponent = true) {
|
||||
def mergereport(String reportsubfolder, String title, LinkedHashMap<String, MergeReportRecord> merges, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String mergelist = "Merge list:\n"
|
||||
def String mergelist = "${title}\nMerge list:\n"
|
||||
def mergessorted = merges.sort()
|
||||
for (amerge in mergessorted) {
|
||||
def MergeReportRecord m = amerge.value
|
||||
|
|
@ -439,9 +439,9 @@ class RevertsReportRecord {
|
|||
}
|
||||
}
|
||||
|
||||
def revertsreport(String reportsubfolder, LinkedHashMap<String, RevertsReportRecord> reverts, boolean iscomponent = true) {
|
||||
def revertsreport(String reportsubfolder, String title, LinkedHashMap<String, RevertsReportRecord> reverts, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String revertlist = "Revert list:\n"
|
||||
def String revertlist = "${title}\nRevert list:\n"
|
||||
def revertssorted = reverts.sort()
|
||||
for (arevert in revertssorted) {
|
||||
def RevertsReportRecord r = arevert.value
|
||||
|
|
@ -470,9 +470,9 @@ class TicketedReportRecord {
|
|||
}
|
||||
}
|
||||
|
||||
def ticketedreport(String reportsubfolder, LinkedHashMap<String, TicketedReportRecord> ticketed, boolean iscomponent = true) {
|
||||
def ticketedreport(String reportsubfolder, String title, LinkedHashMap<String, TicketedReportRecord> ticketed, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String ticketedlist = "Ticketed list:\n"
|
||||
def String ticketedlist = "${title}\nTicketed list:\n"
|
||||
def ticketedsorted = ticketed.sort()
|
||||
for (aticketed in ticketedsorted) {
|
||||
def TicketedReportRecord r = aticketed.value
|
||||
|
|
@ -499,9 +499,9 @@ class UnticketedReportRecord {
|
|||
}
|
||||
}
|
||||
|
||||
def unticketedreport(String reportsubfolder, LinkedHashMap<String, UnticketedReportRecord> unticketed, boolean iscomponent = true) {
|
||||
def unticketedreport(String reportsubfolder, String title, LinkedHashMap<String, UnticketedReportRecord> unticketed, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String unticketedlist = "Unticketed list:\n"
|
||||
def String unticketedlist = "${title}\nUnticketed list:\n"
|
||||
def unticketedsorted = unticketed.sort()
|
||||
for (anunticketed in unticketedsorted) {
|
||||
UnticketedReportRecord u = anunticketed.value
|
||||
|
|
@ -523,9 +523,9 @@ class TicketsReportRecord {
|
|||
}
|
||||
}
|
||||
|
||||
def ticketsreport(String reportsubfolder, tickets, boolean iscomponent = true) {
|
||||
def ticketsreport(String reportsubfolder, String title, tickets, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
String ticketlist = "Ticket list:\n"
|
||||
String ticketlist = "${title}\nTicket list:\n"
|
||||
ticketssorted = tickets.sort()
|
||||
for (ticketnumber in ticketssorted) {
|
||||
TicketsReportRecord t = ticketnumber.value
|
||||
|
|
@ -535,9 +535,9 @@ def ticketsreport(String reportsubfolder, tickets, boolean iscomponent = true) {
|
|||
}
|
||||
}
|
||||
|
||||
def differencerecordsreport(String reportsubfolder, differencerecords, boolean iscomponent = true) {
|
||||
def differencerecordsreport(String reportsubfolder, String title, differencerecords, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
String recordlist = ""
|
||||
String recordlist = "${title}\n"
|
||||
for (dr in differencerecords) {
|
||||
recordlist += dr.dump() + "\n\n"
|
||||
}
|
||||
|
|
@ -545,7 +545,7 @@ def differencerecordsreport(String reportsubfolder, differencerecords, boolean i
|
|||
}
|
||||
}
|
||||
|
||||
def boolean report(meta, differencerecords, boolean iscomponent = true) {
|
||||
def boolean report(meta, title, differencerecords, boolean iscomponent = true) {
|
||||
def Map ticketed = [:]
|
||||
def Map merges = [:]
|
||||
def Map reverts = [:]
|
||||
|
|
@ -664,12 +664,24 @@ def boolean report(meta, differencerecords, boolean iscomponent = true) {
|
|||
} else {
|
||||
reportsubfolder = "${reportfolder}/Combined"
|
||||
}
|
||||
mergereport(reportsubfolder, merges, iscomponent)
|
||||
revertsreport(reportsubfolder, reverts, iscomponent)
|
||||
ticketedreport(reportsubfolder, ticketed, iscomponent)
|
||||
unticketedreport(reportsubfolder, unticketed, iscomponent)
|
||||
ticketsreport(reportsubfolder, tickets, iscomponent)
|
||||
differencerecordsreport(reportsubfolder, differencerecords, iscomponent)
|
||||
mergereport(reportsubfolder, title, merges, iscomponent)
|
||||
revertsreport(reportsubfolder, title, reverts, iscomponent)
|
||||
ticketedreport(reportsubfolder, title, ticketed, iscomponent)
|
||||
unticketedreport(reportsubfolder, title, unticketed, iscomponent)
|
||||
ticketsreport(reportsubfolder, title, tickets, iscomponent)
|
||||
differencerecordsreport(reportsubfolder, title, differencerecords, iscomponent)
|
||||
}
|
||||
|
||||
def title(earlymeta, latermeta) {
|
||||
return """
|
||||
Differences in:
|
||||
Product: ${earlymeta.productinfo.productname} Subcomponent: ${earlymeta.productinfo.subcomponentname}
|
||||
between:
|
||||
then:
|
||||
Build date: ${earlymeta.jenkinsbuildinfo.builddate} Build stamp: ${earlymeta.buildstampinfo.buildstamp} Git revision: ${earlymeta.gitinfo.gitrevision}
|
||||
now:
|
||||
Build date: ${latermeta.jenkinsbuildinfo.builddate} Build stamp: ${latermeta.buildstampinfo.buildstamp} Git revision: ${latermeta.gitinfo.gitrevision}
|
||||
"""
|
||||
}
|
||||
|
||||
def compare(earlymetaitems, latermetaitems, key) {
|
||||
|
|
@ -690,7 +702,7 @@ def compare(earlymetaitems, latermetaitems, key) {
|
|||
(result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo)
|
||||
|
||||
summaryappend(" Items: ${differencerecords.size()} ")
|
||||
report(earlymeta, differencerecords)
|
||||
report(earlymeta, title(earlymeta, latermeta), differencerecords)
|
||||
} else {
|
||||
summaryappend(" No source repo ")
|
||||
}
|
||||
|
|
@ -737,7 +749,7 @@ def comparehierarchy(meta, String earlymetafolder, String latermetafolder, Strin
|
|||
summaryappend("\n")
|
||||
}
|
||||
}
|
||||
report(meta, differencerecords, false)
|
||||
report(meta, title(earlymeta, latermeta), differencerecords, false)
|
||||
return [summarystring, markunstable, unstablereason]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d
|
|||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
|
||||
gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist)
|
||||
|
||||
def importedmeta = meta.importrelated(destpath)
|
||||
def importedmeta = meta.importrelated(destpath, rooturl, rootrevision, gh.getGitInfo(destpath))
|
||||
|
||||
relatedimportinfo = importedmeta.getassociated()
|
||||
echo "Cloning associated repos"
|
||||
|
|
@ -85,16 +85,16 @@ def hierarchyartifactimportfromrepo(meta, String repo, String revision, String d
|
|||
def artifactimportfromrepo(meta, String repo, String revision, String destpath, boolean incrementversionnumber = true, String filter = '', String excludes = '', boolean fingerprint = false) {
|
||||
def rooturl = repo.trim()
|
||||
def rootrevision = revision.trim()
|
||||
echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}"
|
||||
echo "Cloning release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}"
|
||||
|
||||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
|
||||
gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist)
|
||||
|
||||
def importedmeta = meta.importrelated(destpath)
|
||||
def importedmeta = meta.importrelated(destpath, rooturl, rootrevision, gh.getGitInfo(destpath))
|
||||
|
||||
gh.stripgithistory(destpath)
|
||||
def metafilepath = "${destpath}/${meta.metafilepath()}"
|
||||
echo "Marking root meta as released and rewriting meta file: ${metafilepath}"
|
||||
echo "Marking meta as released and rewriting meta file: ${metafilepath}"
|
||||
rewritemetafileasreleased(importedmeta, metafilepath)
|
||||
|
||||
if (incrementversionnumber) {
|
||||
|
|
|
|||
|
|
@ -28,11 +28,16 @@ def Map artifactsImporter(meta, artifactDetails, installerDetails) {
|
|||
|
||||
def importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
for (installer in toBuild) {
|
||||
def artifactKey = installerDetails.get(installer)[1]
|
||||
(sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey)
|
||||
if (artifactFetched.get(artifactKey) == null) {
|
||||
def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy)
|
||||
artifactFetched.put(artifactKey, importmeta)
|
||||
def artifactKeys = installerDetails.get(installer)[1]
|
||||
if (artifactKeys instanceof java.lang.String) {
|
||||
artifactKeys = [ artifactKeys ]
|
||||
}
|
||||
for (artifactKey in artifactKeys) {
|
||||
(sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey)
|
||||
if (artifactFetched.get(artifactKey) == null) {
|
||||
def importmeta = importer.artifactimport(meta, sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy)
|
||||
artifactFetched.put(artifactKey, importmeta)
|
||||
}
|
||||
}
|
||||
}
|
||||
return artifactFetched
|
||||
|
|
@ -92,4 +97,16 @@ def checkISMfile(String ISMfile) {
|
|||
}
|
||||
}
|
||||
|
||||
certificatethumbprints = [:]
|
||||
certificatethumbprints['floreana'] = '0FDEB0A227982C877146CA595091173AC9655479' // Authoring takes place on this machine - so this is what should be in the ISM file already
|
||||
certificatethumbprints['hawaii'] = '49FD1B361CFF35014B81940C5B046543045DD34B'
|
||||
|
||||
def selectSigningCertificate(String nodeName, String ISMfile) {
|
||||
def masterpattern = '0FDEB0A227982C877146CA595091173AC9655479'
|
||||
echo "Substituting occurrences of ${masterpattern} with ${certificatethumbprints[nodeName]} in ISM file: ${ISMfile}"
|
||||
|
||||
textutils_subst = load("${autobuilder.commonscripts()}/textutils/subst.groovy")
|
||||
textutils_subst.substitute(ISMfile, masterpattern, certificatethumbprints[nodeName])
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -429,11 +429,8 @@ class PublishableInfo extends GISJsonSerialised {
|
|||
class MetaInfo extends GISJsonSerialised {
|
||||
private static String FORMAT = "0.1"
|
||||
private static String METAFOLDERNAME = "meta"
|
||||
private static String DIFFFOLDERNAME = "diff"
|
||||
private static String METAFILENAME = "info.json"
|
||||
private static String METADIFFFILENAME = "differences.txt"
|
||||
private static String METAARTIFACTS = "${METAFOLDERNAME}/**"
|
||||
private static String DIFFARTIFACTS = "${DIFFFOLDERNAME}/**"
|
||||
|
||||
class RelatedMetaInfo extends GISJsonSerialised {
|
||||
String offsetpath
|
||||
|
|
@ -514,6 +511,7 @@ class MetaInfo extends GISJsonSerialised {
|
|||
|
||||
void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) {
|
||||
def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA)
|
||||
script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}")
|
||||
configurationinfo.add(ci)
|
||||
}
|
||||
|
||||
|
|
@ -607,11 +605,7 @@ class MetaInfo extends GISJsonSerialised {
|
|||
return METAFOLDERNAME + "/" + METAFILENAME
|
||||
}
|
||||
|
||||
static String difffilepath() {
|
||||
return DIFFFOLDERNAME + "/" + METADIFFFILENAME
|
||||
}
|
||||
|
||||
MetaInfo importrelated(String destpath) {
|
||||
MetaInfo importrelated(String destpath, String givenRepo = 'Unknown', String givenRevision = 'Unknown', String givenSHA = 'Unknown') {
|
||||
MetaInfo mi = new MetaInfo(script)
|
||||
|
||||
def String adjustedpath = relativize(destpath)
|
||||
|
|
@ -620,22 +614,12 @@ class MetaInfo extends GISJsonSerialised {
|
|||
mi.deserialiseJson(importedmetafile)
|
||||
} else {
|
||||
script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist")
|
||||
mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA)
|
||||
}
|
||||
|
||||
RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi)
|
||||
associatedmeta.add(rmi)
|
||||
|
||||
def importedmetadifffile = adjustedpath + "/" + difffilepath()
|
||||
if (script.fileExists(importedmetadifffile)) {
|
||||
def String newcontents = script.readFile(file: importedmetadifffile)
|
||||
def String currentcontents = ""
|
||||
if (script.fileExists(difffilepath())) {
|
||||
currentcontents = script.readFile(file: difffilepath())
|
||||
}
|
||||
|
||||
script.writeFile(file: difffilepath(), text: currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents)
|
||||
}
|
||||
|
||||
return mi
|
||||
}
|
||||
|
||||
|
|
@ -660,15 +644,11 @@ class MetaInfo extends GISJsonSerialised {
|
|||
return METAFOLDERNAME
|
||||
}
|
||||
|
||||
static String difffolder() {
|
||||
return DIFFFOLDERNAME
|
||||
}
|
||||
|
||||
String generateartifacts(ArrayList<String> releasedfromhere = new ArrayList<String>(), // These items are recorded in meta as released from here
|
||||
ArrayList<String> releasedfromsubmeta = new ArrayList<String>(), // These items are not recorded in meta as released from here
|
||||
String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}"
|
||||
) {
|
||||
def String artifactlist = "${METAARTIFACTS},${DIFFARTIFACTS}"
|
||||
def String artifactlist = METAARTIFACTS
|
||||
releaseinfo.addReleaseItem(METAARTIFACTS)
|
||||
for (releaseitem in releasedfromhere) {
|
||||
artifactlist += "," + releaseitem
|
||||
|
|
@ -722,6 +702,10 @@ class MetaInfo extends GISJsonSerialised {
|
|||
return buildstampinfo.buildstamp + "_" + jenkinsbuildinfo.buildnumber
|
||||
}
|
||||
|
||||
String releasetagfordebpackage() {
|
||||
return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber
|
||||
}
|
||||
|
||||
Map<String, RelatedMetaInfo> putwithshortestoffsetpath(Map<String, RelatedMetaInfo> releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) {
|
||||
if (releasemetacollection.containsKey(uniquestring)) {
|
||||
def existingentry = releasemetacollection[uniquestring]
|
||||
|
|
@ -773,10 +757,6 @@ MetaInfo metareset(script) {
|
|||
deleteDir()
|
||||
}
|
||||
|
||||
dir(mi.difffolder()) {
|
||||
deleteDir()
|
||||
}
|
||||
|
||||
return mi
|
||||
}
|
||||
|
||||
|
|
|
|||
106
packaging/debian.groovy
Normal file
106
packaging/debian.groovy
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
class DebRootDefinition {
|
||||
String ROOTPATH
|
||||
String PACKAGE_PREFIX
|
||||
String PACKAGE_FOLDER_NAME
|
||||
String PACKAGE_NAME
|
||||
String UNIQUE_PACKAGE_NAME
|
||||
|
||||
String PACKAGE_SOURCE_ROOT
|
||||
String PACKAGE_SOURCE_FOLDER_NAME
|
||||
String DEBPATH
|
||||
|
||||
String ETC
|
||||
String GIS_OPT_BIN
|
||||
String GIS_OPT_LIB
|
||||
String GIS_OPT_SCRIPTS_APP
|
||||
String GIS_OPT_SCRIPTS_EL
|
||||
String GIS_OPT_SCRIPTS_CONTROL
|
||||
String GIS_OPT_WWW
|
||||
String GIS_OPT_OTHER
|
||||
String GIS_OPT_LOGIC
|
||||
String GIS_OPT_PRINTHEAD
|
||||
|
||||
String USR_BIN
|
||||
String USR_LIB_ARCH
|
||||
String LIB_FIRMWARE
|
||||
String HTTP_DEV_DIV
|
||||
String LIB_SYSTEMD
|
||||
|
||||
DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) {
|
||||
ROOTPATH = rootpath
|
||||
PACKAGE_PREFIX = packageprefix
|
||||
PACKAGE_FOLDER_NAME = packageprefix
|
||||
PACKAGE_NAME = packageprefix + "_armhf.deb"
|
||||
UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb"
|
||||
|
||||
PACKAGE_SOURCE_ROOT = packagesourceroot
|
||||
PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}"
|
||||
DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}"
|
||||
|
||||
ETC = "${DEBPATH}/etc"
|
||||
GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin"
|
||||
GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib"
|
||||
GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app"
|
||||
GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el"
|
||||
GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control"
|
||||
GIS_OPT_WWW = "${DEBPATH}/opt/gis/www"
|
||||
GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other"
|
||||
GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic"
|
||||
GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead"
|
||||
|
||||
USR_BIN = "${DEBPATH}/usr/bin"
|
||||
USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf"
|
||||
LIB_FIRMWARE = "${DEBPATH}/lib/firmware"
|
||||
HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev"
|
||||
LIB_SYSTEMD = "${DEBPATH}/lib/systemd"
|
||||
}
|
||||
}
|
||||
|
||||
def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) {
|
||||
return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp)
|
||||
}
|
||||
|
||||
def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) {
|
||||
try {
|
||||
sh """#!/bin/bash
|
||||
# Exit if any command fails
|
||||
set -xe
|
||||
|
||||
echo "${password}" | sudo -S echo
|
||||
|
||||
cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}"
|
||||
|
||||
sudo chmod -v -R 755 "${packagedefs.DEBPATH}"
|
||||
sudo chown -v -R root: "${packagedefs.DEBPATH}"
|
||||
|
||||
mkdir -v -p "${packageout}"
|
||||
echo "Building package:"
|
||||
dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}"
|
||||
|
||||
mkdir -v -p "${uniquepackageout}"
|
||||
cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}"
|
||||
|
||||
echo "Showing package:"
|
||||
dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}"
|
||||
echo "Showing package contents:"
|
||||
dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}"
|
||||
|
||||
echo "Showing package lintian output:"
|
||||
lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true
|
||||
|
||||
sudo chown -R ${USER}: "${packagedefs.DEBPATH}"
|
||||
"""
|
||||
}
|
||||
catch (Exception e) {
|
||||
echo "Exception occurred"
|
||||
sh """#!/bin/bash -v
|
||||
echo "${password}" | sudo -S echo
|
||||
|
||||
sudo chown -R ${USER}: "${packagedefs.DEBPATH}"
|
||||
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
@ -25,12 +25,12 @@ def productuniquefolder(releasemeta) {
|
|||
return "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}"
|
||||
}
|
||||
|
||||
def uniquereleasefolder(String softwarerelease, releasemeta) {
|
||||
return "Software/${PRODUCT_NAME} ${softwarerelease}/${productuniquefolder(releasemeta)}"
|
||||
def uniquereleasefolder(String productline, String softwarerelease, releasemeta) {
|
||||
return "Software/${productline} ${softwarerelease}/${productuniquefolder(releasemeta)}"
|
||||
}
|
||||
|
||||
def uniqueabsoluterreleasefolder(String releaserepofolder, String softwarerelease, releasemeta) {
|
||||
return "${releaserepofolder}/${uniquereleasefolder(softwarerelease, releasemeta)}"
|
||||
def uniqueabsoluterreleasefolder(String productline, String releaserepofolder, String softwarerelease, releasemeta) {
|
||||
return "${releaserepofolder}/${uniquereleasefolder(productline, softwarerelease, releasemeta)}"
|
||||
}
|
||||
|
||||
def preconditions() {
|
||||
|
|
@ -85,18 +85,14 @@ def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) {
|
|||
}
|
||||
}
|
||||
|
||||
def publish(String customer, String finalreleaserepofolder = releaserepofolder) {
|
||||
def publish(hostedftpsiteinfo, String customer, String finalreleaserepofolder = releaserepofolder) {
|
||||
summaryappend(" FTP operations: ")
|
||||
|
||||
def String FTP_CLIENT_LOCATION='ftp'
|
||||
def String FTP_URL='ie1.hostedftp.com'
|
||||
def String FTP_USER='ftp@globalinkjetsystems.com'
|
||||
def String FTP_CUSTOMER_ROOT="/Customers/${customer}"
|
||||
def String FTP_PASSWORD='ramshorn42'
|
||||
def String ftproot = "${hostedftpsiteinfo.workingdirectory}${customer}"
|
||||
dir(finalreleaserepofolder) {
|
||||
summaryappend("FTP operations: Transferring to ${FTP_CUSTOMER_ROOT}")
|
||||
summaryappend("FTP operations: Transferring to ${ftproot}")
|
||||
sh """#!/bin/bash
|
||||
ncftpput -u ${FTP_USER} -p ${FTP_PASSWORD} -R ${FTP_URL} "${FTP_CUSTOMER_ROOT}" .
|
||||
ncftpput -u ${hostedftpsiteinfo.username} -p ${hostedftpsiteinfo.password} -R ${hostedftpsiteinfo.url} "${ftproot}" .
|
||||
"""
|
||||
summaryappend(", Transferred ")
|
||||
}
|
||||
|
|
@ -116,9 +112,9 @@ def copydirectory(File dirFrom, File dirTo) {
|
|||
}
|
||||
}
|
||||
|
||||
def recallcomponent(releaseinfo, String softwarerelease, itempathstopublish) {
|
||||
def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) {
|
||||
def releasemeta = releaseinfo.meta
|
||||
def String uniquefolderforrepo = uniqueabsoluterreleasefolder(releaserepofolder, softwarerelease, releasemeta)
|
||||
def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta)
|
||||
|
||||
summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ")
|
||||
|
||||
|
|
@ -144,11 +140,12 @@ def convertitemstopublish(String itemstopublishstring) {
|
|||
|
||||
// Publish selected items from a release to the customer folder on the ftp site
|
||||
// itemstopublishstring is a comma-seperated set of strings in this format <ProductName>#<ComponentName>#<PathToPublishableItem>
|
||||
def publishhierarchy(releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) {
|
||||
def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) {
|
||||
int md = maxdepth.toInteger()
|
||||
resetfolders()
|
||||
preconditions()
|
||||
|
||||
def productline = releasemeta.productinfo.productname
|
||||
// Walk the meta information to a max depth, looking for artifacts to publish
|
||||
def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md)
|
||||
|
||||
|
|
@ -162,16 +159,16 @@ def publishhierarchy(releasemeta, String itemstopublishstring, String customer,
|
|||
def itempathstopublish = convertitemstopublish(itemstopublishstring)
|
||||
for (key in componentReleaseInfoVersionUnique.keySet()) {
|
||||
def releaseinfo = componentReleaseInfoVersionUnique[key]
|
||||
recallcomponent(releaseinfo, softwarerelease, itempathstopublish)
|
||||
recallcomponent(productline, releaseinfo, softwarerelease, itempathstopublish)
|
||||
}
|
||||
gh.stripgithistory(releaserepofolder)
|
||||
publish(customer)
|
||||
publish(hostedftpsiteinfo, customer)
|
||||
|
||||
return [summarystring, markunstable, unstablereason]
|
||||
}
|
||||
|
||||
def publishhierarchy(releasemeta, String customer, String softwarerelease, String maxdepth) {
|
||||
return publishhierarchy(releasemeta, "", customer, softwarerelease, maxdepth)
|
||||
def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) {
|
||||
return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth)
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
|||
163
publish/package.groovy
Normal file
163
publish/package.groovy
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = "origin/3.6.3_linux"
|
||||
}
|
||||
else {
|
||||
PYTHONBRANCH = "origin/3.6.3_windows"
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
PYTHONROOTDIR = 'python'
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR)
|
||||
if (isUnix()) {
|
||||
env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3"
|
||||
}
|
||||
else {
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
PACKAGEDEST = "${WORKSPACE}/package"
|
||||
cleanfolders = [
|
||||
PACKAGEDEST,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying package artifacts') {
|
||||
steps {
|
||||
script {
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST)
|
||||
PACKAGE_FOLDER = "${PACKAGEDEST}/package"
|
||||
UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Aptly environment') {
|
||||
steps {
|
||||
script {
|
||||
echo "Aptly config file is ${APTLY_CONFIG_FILE}"
|
||||
sh """#!/bin/bash -v
|
||||
aptly config show
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create repo - if not already there') {
|
||||
steps {
|
||||
script {
|
||||
echo "Repo name is ${REPO_NAME}"
|
||||
sh """#!/bin/bash -v
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then
|
||||
echo "aptly repo ${REPO_NAME} does not exist; Creating it"
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
fi
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Drop published repo - if any') {
|
||||
steps {
|
||||
script {
|
||||
sh """#!/bin/bash -v
|
||||
# This errors if the published repo exists already; Ignore it
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}"
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" list
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Add/update package in repo') {
|
||||
steps {
|
||||
script {
|
||||
echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}"
|
||||
sh """#!/bin/bash -v
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${UNIQUE_PACKAGE_FOLDER}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create snapshot') {
|
||||
steps {
|
||||
script {
|
||||
echo "Snapshot name is ${SNAPSHOT_NAME}"
|
||||
FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}"
|
||||
PACKAGE_VERSION_PREFIX = packagemeta.buildstampinfo.buildstampprefix
|
||||
echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME} containing packages of versions beginning with: ${PACKAGE_VERSION_PREFIX}"
|
||||
sh """#!/bin/bash -v
|
||||
# This errors if the snapshot exists already; Ignore it
|
||||
aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}"
|
||||
aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All_${FULL_SNAPSHOT_NAME}"
|
||||
aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All_${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_PREFIX}.*)'
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Publish snapshot') {
|
||||
steps {
|
||||
script {
|
||||
sh """#!/bin/bash -v
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" "${PUBLISH_PATH_PREFIX}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" list
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
179
publish/promptingpublish.groovy
Normal file
179
publish/promptingpublish.groovy
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
|
||||
meta = autobuilderscript.startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean folders') {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout release repo') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
SOURCEURL = RELEASE_REPO
|
||||
SOURCEREVISION = "origin/master"
|
||||
SOURCEDIR = "${WORKSPACE}/whole"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Identify customer to publish to') {
|
||||
steps {
|
||||
script {
|
||||
hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy")
|
||||
def List<String> customers = hostedftb.getCustomerList()
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
customer = input(
|
||||
message: 'Please select customer to publish to',
|
||||
ok: 'Ok',
|
||||
parameters: [
|
||||
choice(name: 'customer', choices: customers, description: 'Which customer?')
|
||||
]
|
||||
)
|
||||
echo "Chosen customer is: ${customer}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Identify software release to publish') {
|
||||
steps {
|
||||
script {
|
||||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
def allreleases = gh.gettaglist(SOURCEDIR)
|
||||
def releases = new ArrayList<String>()
|
||||
if (FILTER_REDUNDANT_RELEASES == 'false') {
|
||||
echo("Showing all releases")
|
||||
releases = allreleases
|
||||
} else {
|
||||
echo("Showing filtered releases")
|
||||
for (release in allreleases) {
|
||||
if (!release.toLowerCase().startsWith("superceded") &&
|
||||
!release.toLowerCase().startsWith("erroneous") &&
|
||||
!release.toLowerCase().startsWith("faulty") &&
|
||||
!release.toLowerCase().startsWith("ignore") &&
|
||||
!release.toLowerCase().startsWith("inmainline")) {
|
||||
//echo("Showing release: ${release}")
|
||||
releases.add(release)
|
||||
} else {
|
||||
//echo("Not showing release: ${release}")
|
||||
}
|
||||
}
|
||||
}
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
release = input(
|
||||
message: 'Please select the software version',
|
||||
ok: 'Ok',
|
||||
parameters: [
|
||||
choice(name: 'release', choices: releases, description: 'Which software release?')
|
||||
]
|
||||
)
|
||||
echo "Chosen software version is: ${release}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout release repo at selected software version') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEURL = RELEASE_REPO
|
||||
SOURCEREVISION = "refs/tags/${release}"
|
||||
SOURCEDIR = "${WORKSPACE}/whole"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Get release artifact info') {
|
||||
steps {
|
||||
script {
|
||||
def mfs = autobuilderscript.getmetafolderscript()
|
||||
releasemeta = mfs.metafromfolder(SOURCEDIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Select which items from software release to publish') {
|
||||
steps {
|
||||
script {
|
||||
publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy")
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
def itemsobject = publishitems.createItemSelector(
|
||||
'Select software items',
|
||||
'Software items',
|
||||
releasemeta,
|
||||
ITEMSDEFAULTLIST,
|
||||
MAX_META_DEPTH,
|
||||
'20',
|
||||
'PT_MULTI_SELECT')
|
||||
selecteditems = input(
|
||||
message: 'Select which items from the release are to be published',
|
||||
ok: 'Ok',
|
||||
parameters: [
|
||||
itemsobject.multiSelect()
|
||||
]
|
||||
)
|
||||
echo "Chosen items are: ${selecteditems}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Publish components') {
|
||||
steps {
|
||||
script {
|
||||
def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy")
|
||||
def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo()
|
||||
(summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, selecteditems, customer, release, MAX_META_DEPTH)
|
||||
if (markunstable) {
|
||||
env.unstablereason = unstablereason
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts()
|
||||
archiveArtifacts "summary/**,${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Summarise') {
|
||||
steps {
|
||||
script {
|
||||
echo "Summary:\n${summarystring}\n"
|
||||
if (env.unstablereason) {
|
||||
echo "Instability reason: ${env.unstablereason}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +44,9 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy")
|
||||
(summarystring, markunstable, unstablereason) = publisher.publishhierarchy(releasemeta, ITEMS_TO_PUBLISH, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH)
|
||||
def hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy")
|
||||
def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo()
|
||||
(summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, ITEMS_TO_PUBLISH, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH)
|
||||
if (markunstable) {
|
||||
env.unstablereason = unstablereason
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
|
|
|
|||
|
|
@ -1,135 +0,0 @@
|
|||
#!/usr/local/bin/groovy
|
||||
|
||||
jobnameext = jobname ?: "jobunique"
|
||||
metarepoext = metarepo ?: "git@hydra:print-server-releases/print_server_whole.git"
|
||||
outputselectext = outputselect ?: "description"
|
||||
metalevelsstringext = metalevels ?: "2"
|
||||
|
||||
//jobnameext = "jobunique"
|
||||
//metarepoext = "git@hydra:print-server-releases/print_server_whole.git"
|
||||
//outputselectext = "description"
|
||||
//metalevelsstringext = "2"
|
||||
|
||||
metalevelsext = metalevelsstringext.toInteger()
|
||||
dolog = false
|
||||
|
||||
commonscriptsrepo="git@hydra:jenkinsautobuild/Common_scripts.git"
|
||||
|
||||
def log(message) {
|
||||
if (dolog) {
|
||||
println message
|
||||
}
|
||||
}
|
||||
|
||||
def createfolder(String folder) {
|
||||
def sout = new StringBuilder()
|
||||
def serr = new StringBuilder()
|
||||
|
||||
log("Creating directory: ${folder}")
|
||||
def s = ['mkdir', '-p', folder].execute()
|
||||
s.consumeProcessOutput(sout, serr)
|
||||
s.waitFor()
|
||||
|
||||
log("Out: ${sout} Err: ${serr}")
|
||||
return [sout, serr]
|
||||
}
|
||||
|
||||
def gitCloneOrPull(String repo, String folder) {
|
||||
def sout = new StringBuilder()
|
||||
def serr = new StringBuilder()
|
||||
|
||||
if (!(new File(folder).exists())) {
|
||||
log("Cloning: ${repo} to: ${folder}")
|
||||
createfolder(folder)
|
||||
def s = ['git', 'clone', repo, folder].execute()
|
||||
s.consumeProcessOutput(sout, serr)
|
||||
s.waitFor()
|
||||
} else {
|
||||
log("Pull in: ${folder}")
|
||||
def s = ['git', 'pull'].execute(null, new File(folder))
|
||||
s.consumeProcessOutput(sout, serr)
|
||||
s.waitFor()
|
||||
}
|
||||
|
||||
log("Out: ${sout} Err: ${serr}")
|
||||
return [sout, serr]
|
||||
}
|
||||
|
||||
def loadmetaclass(String commonscripts, String metafolder) {
|
||||
def metafolderscriptfile = "${commonscripts}/meta/folder.groovy"
|
||||
|
||||
GroovyShell shell = new GroovyShell()
|
||||
def metafolderscript = shell.parse(new File(metafolderscriptfile))
|
||||
def meta = metafolderscript.metafromfolderSlurper(metafolder)
|
||||
return meta
|
||||
}
|
||||
|
||||
def makeworking() {
|
||||
def r = ['whoami'].execute()
|
||||
r.waitFor()
|
||||
def user = r.text.trim()
|
||||
|
||||
def rootfolder = "/home/${user}/tmp"
|
||||
createfolder(rootfolder)
|
||||
|
||||
def commonscripts = "${rootfolder}/commonscripts"
|
||||
gitCloneOrPull(commonscriptsrepo, commonscripts)
|
||||
|
||||
// Clone or pull the relevant meta repo
|
||||
def metareporoot = "${rootfolder}/${jobnameext}"
|
||||
gitCloneOrPull(metarepoext, metareporoot)
|
||||
def metafolder = "${metareporoot}/meta"
|
||||
|
||||
// Load the meta folder class that interprets the meta repo
|
||||
def meta = loadmetaclass(commonscripts, metareporoot)
|
||||
return meta
|
||||
}
|
||||
|
||||
def String outputDescription(menuitems, releaseinfo) {
|
||||
meta = releaseinfo.meta
|
||||
|
||||
for (publishableitem in meta.publishableinfo) {
|
||||
menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}")
|
||||
}
|
||||
}
|
||||
|
||||
def String outputSelection(menuitems, releaseinfo) {
|
||||
meta = releaseinfo.meta
|
||||
|
||||
for (publishableitem in meta.publishableinfo) {
|
||||
menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}")
|
||||
}
|
||||
}
|
||||
|
||||
def List<String> getItems(meta) {
|
||||
def List<String> menuitems = new ArrayList<String>()
|
||||
def metaitems = meta.releasewalkerunique(metalevelsext)
|
||||
log("metaitems is ${metaitems.getClass()}")
|
||||
|
||||
try {
|
||||
for (key in metaitems.keySet()) {
|
||||
def releaseinfo = metaitems[key]
|
||||
if (outputselectext == "description") {
|
||||
outputDescription(menuitems, releaseinfo)
|
||||
}
|
||||
if (outputselectext == "selection") {
|
||||
outputSelection(menuitems, releaseinfo)
|
||||
}
|
||||
}
|
||||
return menuitems
|
||||
} catch (Exception e) {
|
||||
menuitems.add("Error ${e}")
|
||||
return menuitems
|
||||
}
|
||||
}
|
||||
|
||||
def meta = makeworking()
|
||||
def items = getItems(meta)
|
||||
|
||||
count = 0
|
||||
for (item in items) {
|
||||
count += 1
|
||||
log ("${count}: ${item}")
|
||||
}
|
||||
|
||||
return items
|
||||
127
publish/publishitems.groovy
Normal file
127
publish/publishitems.groovy
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition
|
||||
|
||||
class PublishableItemsSelection {
|
||||
def script
|
||||
def ArrayList<String> preselectedmenuitems
|
||||
def ArrayList<String> menuitemdescriptions
|
||||
def ArrayList<String> menuitemsfull
|
||||
def ExtendedChoiceParameterDefinition multiselect
|
||||
|
||||
PublishableItemsSelection(script) {
|
||||
this.script = script
|
||||
preselectedmenuitems = new ArrayList<String>()
|
||||
menuitemdescriptions = new ArrayList<String>()
|
||||
menuitemsfull = new ArrayList<String>()
|
||||
}
|
||||
|
||||
def init(
|
||||
String name,
|
||||
String description,
|
||||
releasemeta,
|
||||
String preselectedext,
|
||||
String metalevelsstringext,
|
||||
String visibleItemCountExt,
|
||||
String controltype) {
|
||||
outputSelectionfromPreselect(preselectedmenuitems, preselectedext)
|
||||
def Integer metalevelsext = metalevelsstringext.toInteger()
|
||||
def Integer visibleItemCount = visibleItemCountExt.toInteger()
|
||||
def metaitems = releasemeta.releasewalkerunique(metalevelsext)
|
||||
for (key in metaitems.keySet()) {
|
||||
def releaseinfo = metaitems[key]
|
||||
outputDescription(menuitemdescriptions, releaseinfo)
|
||||
outputSelection(menuitemsfull, releaseinfo)
|
||||
}
|
||||
|
||||
script.echo("name is: ${name}")
|
||||
script.echo("description is: ${description}")
|
||||
script.echo("menuitemsfull is: ${menuitemsfull}")
|
||||
script.echo("preselectedmenuitems is: ${preselectedmenuitems}")
|
||||
script.echo("menuitemdescriptions is: ${menuitemdescriptions}")
|
||||
script.echo("visibleItemCount is: ${visibleItemCount}")
|
||||
script.echo("controltype is: ${controltype}")
|
||||
|
||||
def seperator = ","
|
||||
visibleItemCount = Math.min(visibleItemCount, menuitemsfull.size())
|
||||
script.echo("visibleItemCount is now: ${visibleItemCount}")
|
||||
|
||||
multiselect = new ExtendedChoiceParameterDefinition(
|
||||
name, // String name
|
||||
controltype, // String type
|
||||
menuitemsfull.join(seperator), // String value
|
||||
"project name", // String projectName
|
||||
"", // String propertyFile
|
||||
"", // String groovyScript
|
||||
"", // String groovyScriptFile
|
||||
"", // String bindings
|
||||
"", // String groovyClasspath
|
||||
"", // String propertyKey
|
||||
preselectedmenuitems.join(seperator),// String defaultValue
|
||||
"", // String defaultPropertyFile
|
||||
"", // String defaultGroovyScript
|
||||
"", // String defaultGroovyScriptFile
|
||||
"", // String defaultBindings
|
||||
"", // String defaultGroovyClasspath
|
||||
"", // String defaultPropertyKey
|
||||
menuitemdescriptions.join(seperator),// String descriptionPropertyValue
|
||||
"", // String descriptionPropertyFile
|
||||
"", // String descriptionGroovyScript
|
||||
"", // String descriptionGroovyScriptFile
|
||||
"", // String descriptionBindings
|
||||
"", // String descriptionGroovyClasspath
|
||||
"", // String descriptionPropertyKey
|
||||
"", // String javascriptFile
|
||||
"", // String javascript
|
||||
false, // boolean saveJSONParameterToFile
|
||||
false, // boolean quoteValue
|
||||
visibleItemCount, // int visibleItemCount
|
||||
description, // String description
|
||||
seperator) // String multiSelectDelimiter
|
||||
}
|
||||
|
||||
def outputSelectionfromPreselect(menuitems, preselectedext) {
|
||||
script.echo ("preselectext: ${preselectedext}")
|
||||
def menuitemstemp = preselectedext.split(',')
|
||||
script.echo ("Menuitemstemp: ${menuitemstemp}")
|
||||
|
||||
for (menuitem in menuitemstemp) {
|
||||
menuitems.add(menuitem.trim())
|
||||
}
|
||||
}
|
||||
|
||||
def outputDescription(menuitems, releaseinfo) {
|
||||
def meta = releaseinfo.meta
|
||||
|
||||
for (publishableitem in meta.publishableinfo) {
|
||||
menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}")
|
||||
}
|
||||
}
|
||||
|
||||
def outputSelection(menuitems, releaseinfo) {
|
||||
def meta = releaseinfo.meta
|
||||
|
||||
for (publishableitem in meta.publishableinfo) {
|
||||
menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}")
|
||||
}
|
||||
}
|
||||
|
||||
def multiSelect() {
|
||||
return multiselect
|
||||
}
|
||||
}
|
||||
|
||||
PublishableItemsSelection createItemSelector(
|
||||
String name,
|
||||
String description,
|
||||
releasemeta,
|
||||
String preselectedext,
|
||||
String metalevelsstringext,
|
||||
String visibleItemCountExt = '20',
|
||||
String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT"
|
||||
PublishableItemsSelection pis = new PublishableItemsSelection(this)
|
||||
|
||||
pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type)
|
||||
|
||||
return pis
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
@ -262,6 +262,7 @@ def sourcegittags(String buildsha, List taglist) {
|
|||
}
|
||||
|
||||
def releasegitpush(String dryrunpush ) {
|
||||
sh("git remote -v")
|
||||
if (dryrunpush == "true") {
|
||||
sh("git push -n --tags origin master")
|
||||
summaryappend(",Dry-Run-Push")
|
||||
|
|
@ -274,6 +275,7 @@ def releasegitpush(String dryrunpush ) {
|
|||
}
|
||||
|
||||
def sourcegitpush(String dryrunpush ) {
|
||||
sh("git remote -v")
|
||||
if (dryrunpush == "true") {
|
||||
sh("git push -n --tags")
|
||||
summaryappend(",Src-Dry-Run-Push")
|
||||
|
|
|
|||
33
remoteaccess/ftp.groovy
Normal file
33
remoteaccess/ftp.groovy
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
@Grab(group='commons-net', module='commons-net', version='2.0')
|
||||
import org.apache.commons.net.ftp.FTPClient
|
||||
|
||||
class FTPSiteInfo {
|
||||
String url
|
||||
String username
|
||||
String password
|
||||
String workingdirectory
|
||||
|
||||
FTPSiteInfo(String url, String username, String password, String workingdirectory) {
|
||||
this.url = url
|
||||
this.username = username
|
||||
this.password = password
|
||||
this.workingdirectory = workingdirectory
|
||||
}
|
||||
}
|
||||
|
||||
FTPSiteInfo createFTPSiteInfo(String url, String username, String password, String workingdirectory) {
|
||||
FTPSiteInfo ftpsiteinfo = new FTPSiteInfo(url, username, password, workingdirectory)
|
||||
return ftpsiteinfo
|
||||
}
|
||||
|
||||
FTPClient createFTPClient(FTPSiteInfo ftpsiteinfo) {
|
||||
FTPClient ftpclient = new FTPClient()
|
||||
ftpclient.connect(ftpsiteinfo.url)
|
||||
ftpclient.enterLocalPassiveMode()
|
||||
ftpclient.login(ftpsiteinfo.username, ftpsiteinfo.password)
|
||||
ftpclient.changeWorkingDirectory(ftpsiteinfo.workingdirectory)
|
||||
|
||||
return ftpclient
|
||||
}
|
||||
|
||||
return this;
|
||||
28
remoteaccess/hostedftp.groovy
Normal file
28
remoteaccess/hostedftp.groovy
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy")
|
||||
|
||||
def getHostedFTPSiteInfo() {
|
||||
hostedftpsiteinfo =
|
||||
ftpremote.createFTPSiteInfo("ftp.hostedftp.com",
|
||||
"ftp@globalinkjetsystems.com",
|
||||
"ramshorn42",
|
||||
"/Customers/")
|
||||
return hostedftpsiteinfo
|
||||
}
|
||||
|
||||
def getCustomerList() {
|
||||
def List<String> customerfilenames = new ArrayList<String>()
|
||||
def List<String> customers = new ArrayList<String>()
|
||||
|
||||
def ftpsiteinfo = getHostedFTPSiteInfo()
|
||||
def ftpclient = ftpremote.createFTPClient(ftpsiteinfo)
|
||||
|
||||
customerfilenames = ftpclient.listNames()
|
||||
for(customer in customerfilenames) {
|
||||
def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8")
|
||||
customers.add(converted)
|
||||
}
|
||||
ftpclient.disconnect()
|
||||
return customers
|
||||
}
|
||||
|
||||
return this;
|
||||
119
staticanalysis/ccm.groovy
Normal file
119
staticanalysis/ccm.groovy
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
PYTHONBRANCH = 'origin/3.6.3_windows'
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
|
||||
CCMURL = 'git@hydra:tools/ccm.git'
|
||||
CCMBRANCH = 'origin/master'
|
||||
CCMDIR = "${WORKSPACE}/ccm"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'ccm', CCMURL, CCMBRANCH, CCMDIR)
|
||||
CCM = "${CCMDIR}/bin/CCM.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEREVISION = "${SOURCE_REVISION}"
|
||||
SOURCEDIR = "${WORKSPACE}/source"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
SOURCE_PATH = "${SOURCEDIR}"
|
||||
env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Clean exports") {
|
||||
steps {
|
||||
script {
|
||||
STATICANALYSIS = 'staticanalysis'
|
||||
cleanfolders = [
|
||||
STATICANALYSIS,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
def CCMOLDER = "${STATICANALYSIS}/ccm"
|
||||
dir(CCMOLDER) {
|
||||
echo "Executing: ${CCM} ${SRC} /xml /nummetrics=100 > ccm.xml"
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
find "${SRC}" -type f ! -name "*.cpp" -a ! -name "*.h" -a ! -name "*.hpp" -a ! -name "*.c" -exec rm -r {} \;
|
||||
# Uses mono
|
||||
"${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
"${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml
|
||||
"""
|
||||
}
|
||||
}
|
||||
recordIssues(tools: [
|
||||
ccm(pattern: "**/ccm.xml", reportEncoding: 'UTF-8'),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
|
||||
def artifactlist = meta.generateartifacts(itemsForRelease)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
139
staticanalysis/cpd.groovy
Normal file
139
staticanalysis/cpd.groovy
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = 'origin/3.6.3_linux'
|
||||
} else {
|
||||
PYTHONBRANCH = 'origin/3.6.3_windows'
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
|
||||
JAVAURL = 'git@hydra:tools/openjdk.git'
|
||||
if (isUnix()) {
|
||||
JAVABRANCH = 'origin/openjdk-11.0.2_linux-x64_bin'
|
||||
} else {
|
||||
JAVABRANCH = 'origin/openjdk-11.0.2_windows-x64_bin'
|
||||
}
|
||||
JAVADIR = "${WORKSPACE}/java"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'java', JAVAURL, JAVABRANCH, JAVADIR)
|
||||
JAVA = "${JAVADIR}/ver/bin"
|
||||
if (isUnix()) {
|
||||
env.PATH = JAVA + ':' + PATH
|
||||
} else {
|
||||
env.PATH = JAVA + ';' + PATH
|
||||
}
|
||||
|
||||
PPDURL = 'git@hydra:tools/pmd.git'
|
||||
PPDBRANCH = 'origin/master'
|
||||
PPDDIR = "${WORKSPACE}/ppd"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'ppd', PPDURL, PPDBRANCH, PPDDIR)
|
||||
PPD = "${PPDDIR}/bin"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEREVISION = "${SOURCE_REVISION}"
|
||||
SOURCEDIR = "${WORKSPACE}/source"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
SOURCE_PATH = "${SOURCEDIR}"
|
||||
env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Clean exports") {
|
||||
steps {
|
||||
script {
|
||||
STATICANALYSIS = 'staticanalysis'
|
||||
cleanfolders = [
|
||||
STATICANALYSIS,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
def PPDFOLDER = "${STATICANALYSIS}/ppd"
|
||||
dir(PPDFOLDER) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -e
|
||||
|
||||
export PMD_JAVA_OPTS=-Xmx65536m
|
||||
"${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
set PMD_JAVA_OPTS=-Xmx2048m
|
||||
"${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml
|
||||
"""
|
||||
}
|
||||
}
|
||||
recordIssues(tools: [
|
||||
cpd(pattern: "**/cpd.xml", reportEncoding: 'UTF-8'),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
|
||||
def artifactlist = meta.generateartifacts(itemsForRelease)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
113
staticanalysis/cppcheck.groovy
Normal file
113
staticanalysis/cppcheck.groovy
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
PYTHONBRANCH = 'origin/3.6.3_windows'
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEREVISION = "${SOURCE_REVISION}"
|
||||
SOURCEDIR = "${WORKSPACE}/source"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
SOURCE_PATH = "${SOURCEDIR}"
|
||||
env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Clean exports") {
|
||||
steps {
|
||||
script {
|
||||
STATICANALYSIS = 'staticanalysis'
|
||||
cleanfolders = [
|
||||
STATICANALYSIS,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH, BASEBUILDNUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
def CPPCHECKFOLDER = "${STATICANALYSIS}/cppcheck"
|
||||
dir(CPPCHECKFOLDER) {
|
||||
echo "Executing: ${CPPCHECK} --xml --xml-version=2 ${SRC} 2> cppcheck.xml"
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -e
|
||||
|
||||
"${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
"${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml
|
||||
"""
|
||||
}
|
||||
}
|
||||
recordIssues(tools: [
|
||||
cppCheck(pattern: "**/cppcheck.xml", reportEncoding: 'UTF-8'),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
|
||||
def artifactlist = meta.generateartifacts(itemsForRelease)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
8
textutils/subst.groovy
Normal file
8
textutils/subst.groovy
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
def substitute(String filepath, String pattern, String subst) {
|
||||
fileText = readFile(file: filepath, encoding: 'UTF-8')
|
||||
def converted = fileText.replaceAll(pattern, subst)
|
||||
writeFile(file: filepath, text: converted, encoding: 'UTF-8')
|
||||
}
|
||||
|
||||
return this;
|
||||
25
tool configurations/vs2017install/buildmachines.vsconfig
Normal file
25
tool configurations/vs2017install/buildmachines.vsconfig
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Workload.ManagedDesktop",
|
||||
"Microsoft.VisualStudio.Workload.NativeDesktop",
|
||||
"Microsoft.VisualStudio.Workload.NetWeb",
|
||||
"Microsoft.VisualStudio.Workload.NetCoreTools",
|
||||
"microsoft.net.componentgroup.targetingpacks.common",
|
||||
"microsoft.componentgroup.blend",
|
||||
"microsoft.visualstudio.component.entityframework",
|
||||
"microsoft.visualstudio.component.debugger.justintime",
|
||||
"microsoft.visualstudio.component.wcf.tooling",
|
||||
"microsoft.visualstudio.component.vc.diagnostictools",
|
||||
"microsoft.visualstudio.component.vc.cmake.project",
|
||||
"microsoft.visualstudio.component.vc.testadapterforboosttest",
|
||||
"microsoft.visualstudio.component.vc.testadapterforgoogletest",
|
||||
"microsoft.visualstudio.component.vc.atlmfc",
|
||||
"microsoft.visualstudio.component.appinsights.tools",
|
||||
"microsoft.visualstudio.component.diagnostictools",
|
||||
"microsoft.visualstudio.componentgroup.web.cloudtools",
|
||||
"microsoft.visualstudio.component.aspnet45",
|
||||
"microsoft.visualstudio.component.webdeploy",
|
||||
"microsoft.visualstudio.component.nuget.buildtools"
|
||||
]
|
||||
}
|
||||
|
|
@ -4,12 +4,36 @@ import hudson.plugins.git.extensions.impl.*
|
|||
|
||||
clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy")
|
||||
|
||||
def boolean isShallowClonedRepo(String gitrootpath) {
|
||||
def boolean isshallowclone = true
|
||||
|
||||
dir( gitrootpath) {
|
||||
if (isUnix()) {
|
||||
isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean()
|
||||
}
|
||||
else {
|
||||
isshallowclone = bat(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean()
|
||||
}
|
||||
echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}"
|
||||
}
|
||||
return isshallowclone
|
||||
}
|
||||
|
||||
String getGitInfo(String workingSetRootPath) {
|
||||
dir(workingSetRootPath) {
|
||||
return clh.getCommandOutput('git rev-parse HEAD')
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<String> gettaglist(String workingSetRootPath) {
|
||||
ArrayList<String> taglist = new ArrayList<String>()
|
||||
dir(workingSetRootPath) {
|
||||
def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname')
|
||||
taglist = tagliststring.split('\\n')
|
||||
}
|
||||
return taglist
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def ArrayList<SparseCheckoutPath> sparsecheckoutconfig(ArrayList<String> paths) {
|
||||
ArrayList<SparseCheckoutPath> sparsecheckoutpaths = new ArrayList<SparseCheckoutPath>()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
def int maxversionnumber() {
|
||||
def int MAXVERSIONNUMBER = 65535
|
||||
return MAXVERSIONNUMBER
|
||||
|
|
@ -15,6 +16,12 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
|
|||
def String gitrevision
|
||||
def String remoteinfo
|
||||
def String remoteurl
|
||||
|
||||
def boolean isShallowCloned = gh.isShallowClonedRepo(gitrootpath)
|
||||
if (isShallowCloned) {
|
||||
error("Cannot generate a version number from a shallow cloned repo at ${gitrootpath}")
|
||||
}
|
||||
|
||||
dir( gitrootpath) {
|
||||
def int changecount = 0
|
||||
if (isUnix()) {
|
||||
|
|
@ -152,4 +159,11 @@ String generate(meta, String sourcerevision, String sourcepath, String basebuild
|
|||
return generate(meta, sourcerevision, sourcepath, bbn)
|
||||
}
|
||||
|
||||
String copyfrom(meta, othermeta) {
|
||||
meta.gitinfo = othermeta.gitinfo
|
||||
meta.buildstampinfo = othermeta.buildstampinfo
|
||||
|
||||
return meta.buildstampinfo.buildstamp
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
@ -19,21 +19,15 @@ def main(argv):
|
|||
|
||||
print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert))
|
||||
|
||||
filecopy = filetoconvert + ".orig"
|
||||
try:
|
||||
shutil.move(filetoconvert, filecopy)
|
||||
except FileNotFoundError:
|
||||
print("Could not find file: {0}\n".format(filetoconvert))
|
||||
return 1
|
||||
with open(filetoconvert,'r') as c:
|
||||
fileread = c.read()
|
||||
|
||||
count = 0
|
||||
with open(filetoconvert, 'x') as f:
|
||||
with open(filecopy,'r') as c:
|
||||
fileread = c.read()
|
||||
print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern))
|
||||
converted = fileread.replace(pattern, substitute)
|
||||
count = converted.count(substitute)
|
||||
print("Confirmed %s instances of %s post-conversion"%(count,substitute))
|
||||
with open(filetoconvert, 'w') as f:
|
||||
print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern))
|
||||
converted = fileread.replace(pattern, substitute)
|
||||
count = converted.count(substitute)
|
||||
print("Confirmed %s instances of %s post-conversion"%(count,substitute))
|
||||
f.write(converted)
|
||||
|
||||
if count == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue