Merge commit 'fec34dd485'
This commit is contained in:
commit
b055fe543f
15 changed files with 748 additions and 238 deletions
|
|
@ -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: 10, 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -722,6 +722,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]
|
||||
|
|
|
|||
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 -e
|
||||
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
160
publish/promptingpublish.groovy
Normal file
160
publish/promptingpublish.groovy
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
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 releases = gh.gettaglist(SOURCEDIR)
|
||||
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',
|
||||
'Print Server 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;
|
||||
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;
|
||||
|
|
@ -86,7 +86,7 @@ pipeline {
|
|||
sh """#!/bin/bash
|
||||
set -e
|
||||
|
||||
export PMD_JAVA_OPTS=-Xmx16384m
|
||||
export PMD_JAVA_OPTS=-Xmx65536m
|
||||
"${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml --failOnViolation false > cpd.xml
|
||||
"""
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,15 @@ String getGitInfo(String workingSetRootPath) {
|
|||
}
|
||||
}
|
||||
|
||||
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>()
|
||||
|
|
|
|||
|
|
@ -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