Merge commit '7a3bb4426e'
This commit is contained in:
commit
e41181fbf1
10 changed files with 739 additions and 78 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,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;
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
111
packaging/debian.groovy
Normal file
111
packaging/debian.groovy
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
class DebRootDefinition {
|
||||
String ROOTPATH
|
||||
String PACKAGE_PREFIX
|
||||
String PACKAGE_FOLDER_NAME
|
||||
String PACKAGE_NAME
|
||||
String UNIQUE_PACKAGE_NAME
|
||||
|
||||
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 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_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 packageprefix, String buildstamp) {
|
||||
return new DebRootDefinition(rootpath, 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
|
||||
|
||||
mkdir -v -p "${packagedefs.USR_BIN}"
|
||||
mkdir -v -p "${packagedefs.USR_LIB_ARCH}"
|
||||
mkdir -v -p "${packagedefs.LIB_FIRMWARE}"
|
||||
|
||||
mkdir -v -p "${packagedefs.HTTP_DEV_DIV}"
|
||||
mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system"
|
||||
|
||||
cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${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;
|
||||
158
publish/package.groovy
Normal file
158
publish/package.groovy
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
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}"
|
||||
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}"
|
||||
echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}"
|
||||
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}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}"
|
||||
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}"
|
||||
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}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
110
staticanalysis/ccm.groovy
Normal file
110
staticanalysis/ccm.groovy
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
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) {
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
104
staticanalysis/cppcheck.groovy
Normal file
104
staticanalysis/cppcheck.groovy
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
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) {
|
||||
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;
|
||||
|
|
@ -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