Merge remote-tracking branch 'origin/production' into master
This commit is contained in:
commit
298c0b5eaf
15 changed files with 193 additions and 76 deletions
|
|
@ -34,8 +34,25 @@ def getmetafolderscript() {
|
|||
return metafolderscript
|
||||
}
|
||||
|
||||
// Start up boilderplate
|
||||
def startbuild(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String releaserepo = RELEASE_REPO, String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) {
|
||||
def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) {
|
||||
def String altered = releaserepo.trim()
|
||||
|
||||
if (releaserepovariantsuffix?.trim()) {
|
||||
altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", releaserepovariantsuffix)
|
||||
}
|
||||
return altered
|
||||
}
|
||||
|
||||
// Start up boilerplate
|
||||
def startbuild(
|
||||
script,
|
||||
String productname = PRODUCT_NAME,
|
||||
String subcomponentname = SUBCOMPONENT_NAME,
|
||||
String releaserepo = RELEASE_REPO,
|
||||
String productvariant = '',
|
||||
String autobuildpath = autobuildroot,
|
||||
String commonscriptspath = commonscriptsroot
|
||||
) {
|
||||
echo "Starting...."
|
||||
|
||||
autobuildroot = autobuildpath
|
||||
|
|
@ -46,14 +63,16 @@ def startbuild(script, String productname = PRODUCT_NAME, String subcomponentnam
|
|||
|
||||
def meta = getmetafolderscript().metareset(script)
|
||||
echo "Product name: ${productname} Subcomponent name: ${subcomponentname}"
|
||||
meta.productinfo.set(productname, subcomponentname)
|
||||
meta.productinfo.set(productname, subcomponentname, productvariant)
|
||||
def now = new Date()
|
||||
now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC'))
|
||||
meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString())
|
||||
|
||||
def rr = load("${commonscripts()}/release/registerrepo.groovy")
|
||||
echo "Release repo: ${releaserepo}"
|
||||
rr.registerrepo(meta, releaserepo)
|
||||
def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant)
|
||||
|
||||
echo "Release repo: ${alteredreleaserepo}"
|
||||
rr.registerrepo(meta, alteredreleaserepo)
|
||||
|
||||
def ch = load("${commonscripts()}/configuration/configuration.groovy")
|
||||
ch.registerPipelineScriptConfiguration(meta)
|
||||
|
|
@ -61,13 +80,27 @@ def startbuild(script, String productname = PRODUCT_NAME, String subcomponentnam
|
|||
return meta
|
||||
}
|
||||
|
||||
def start(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String jirakey = JIRA_KEY, String releaserepo = RELEASE_REPO, String repoRootSuffix = "", String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) {
|
||||
// DEPRECATED Metod, Use StartBuild Instead.
|
||||
def start(
|
||||
script,
|
||||
String productname = PRODUCT_NAME,
|
||||
String subcomponentname = SUBCOMPONENT_NAME,
|
||||
String jirakey = JIRA_KEY,
|
||||
String releaserepo = RELEASE_REPO,
|
||||
String repoRootSuffix = "",
|
||||
String autobuildpath = autobuildroot,
|
||||
String commonscriptspath = commonscriptsroot
|
||||
) {
|
||||
echo "DEPRECATED method: start(script, String productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, ...)"
|
||||
return startbuild(script, productname, subcomponentname, releaserepo, autobuildpath, commonscriptspath)
|
||||
}
|
||||
|
||||
// Start up boilderplate
|
||||
def startnonbuild(script, autobuildpath = autobuildroot, commonscriptspath = commonscriptsroot) {
|
||||
def startnonbuild(
|
||||
script,
|
||||
autobuildpath = autobuildroot,
|
||||
commonscriptspath = commonscriptsroot
|
||||
) {
|
||||
echo "Starting non-build job...."
|
||||
|
||||
autobuildroot = autobuildpath
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ def generatelist(meta, checksummable) {
|
|||
def checksumset = meta.checksuminfo.addChecksumSet(filepath)
|
||||
def files = findFiles(glob: filepath)
|
||||
for (file in files) {
|
||||
echo "Checksumming: ${file.path}"
|
||||
def sum = sha1(file: file.path).trim()
|
||||
checksumset.addChecksumPair(file.path, sum)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ String getCommandOutput(String cmd) {
|
|||
if (isUnix()) {
|
||||
return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim()
|
||||
} else {
|
||||
return bat(returnStdout: true, script: """
|
||||
@echo off
|
||||
return powershell(returnStdout: true, script: """
|
||||
${cmd}
|
||||
"""
|
||||
).trim()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ pipeline {
|
|||
stage('Copying logic artifacts') {
|
||||
steps {
|
||||
script {
|
||||
importer.artifactimport(meta, LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_RELEASE_REPO, LOGIC_RELEASE_REVISION, LOGICDEST)
|
||||
sh('env')
|
||||
def logicoptions = importer.getNewImportOptions()
|
||||
logicoptions.source(LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_ARTIFACT_RELEASE_REPO, LOGIC_ARTIFACT_RELEASE_REVISION)
|
||||
importer.artifactimport(meta, logicoptions, LOGICDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,22 @@
|
|||
def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) {
|
||||
def wsparameter = "-w"
|
||||
if (!ignorewhitespace) {
|
||||
wsparameter = ""
|
||||
}
|
||||
if (isUnix()) {
|
||||
def wsparameter = "-w"
|
||||
if (!ignorewhitespace) {
|
||||
wsparameter = ""
|
||||
}
|
||||
sh """
|
||||
diff -c ${wsparameter} "${importedfile}" "${currentfile}"
|
||||
"""
|
||||
}
|
||||
else {
|
||||
error "Windows not currently supporting file comparison"
|
||||
// diffutils can be installed on windows with chocolatey
|
||||
powershell """
|
||||
# echo Checking utilities exist
|
||||
# where diff
|
||||
# if errorlevel 1 EXIT /b 1
|
||||
|
||||
diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
def comparefiles(importedjsonfile, currentjsonfile) {
|
||||
echo "Comparing file: ${importedjsonfile} with: ${currentjsonfile}"
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
which jq
|
||||
|
|
@ -8,7 +9,42 @@ def comparefiles(importedjsonfile, currentjsonfile) {
|
|||
"""
|
||||
}
|
||||
else {
|
||||
error "Windows not currently supporting json file comparison"
|
||||
// Jq and diffutils can be installed on windows with chocolatey
|
||||
powershell """
|
||||
# echo Checking utilities exist
|
||||
# set
|
||||
# echo %PATH%
|
||||
try {
|
||||
if (Get-Command jq) {}
|
||||
}
|
||||
catch {
|
||||
echo "jq is unavailable"
|
||||
exit \$false
|
||||
}
|
||||
try {
|
||||
if (Get-Command diff) {}
|
||||
}
|
||||
catch {
|
||||
echo "diff is unavailable"
|
||||
exit \$false
|
||||
}
|
||||
|
||||
# echo Sorting json in files to compare
|
||||
# jq -S sorts json output
|
||||
jq -S . "${importedjsonfile}" > temp1.txt
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
jq -S . "${currentjsonfile}" > temp2.txt
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
|
||||
# echo Diffing sorted json files
|
||||
diff.exe -c temp1.txt temp2.txt
|
||||
\$lec = \$lastexitcode
|
||||
|
||||
Remove-Item temp1.txt
|
||||
Remove-Item temp2.txt
|
||||
|
||||
if (\$lec -ge 1) { exit 1 }
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,21 +22,23 @@ abstract class GISJsonSerialised implements Serializable {
|
|||
class ProductInfo extends GISJsonSerialised {
|
||||
String productname
|
||||
String subcomponentname
|
||||
String variant
|
||||
|
||||
ProductInfo(script, productname = "", subcomponentname = "") {
|
||||
ProductInfo(script, productname = "", subcomponentname = "", variant = "") {
|
||||
super(script)
|
||||
this.productname = productname
|
||||
this.subcomponentname = subcomponentname
|
||||
this.variant = variant
|
||||
}
|
||||
|
||||
void set(String productname, String subcomponentname) {
|
||||
void set(String productname, String subcomponentname, String variant = '') {
|
||||
// Make sure the fields can be used in git tags
|
||||
def int pstatus = 0
|
||||
if (script.isUnix()) {
|
||||
pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
}
|
||||
else {
|
||||
pstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true)
|
||||
pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" 2>&1>\$null", , returnStatus: true)
|
||||
}
|
||||
if (pstatus > 0) {
|
||||
script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name")
|
||||
|
|
@ -46,24 +48,39 @@ class ProductInfo extends GISJsonSerialised {
|
|||
sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
}
|
||||
else {
|
||||
sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true)
|
||||
sstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" 2>&1>\$null", , returnStatus: true)
|
||||
}
|
||||
if (sstatus > 0) {
|
||||
script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name")
|
||||
}
|
||||
if (variant) {
|
||||
def int vstatus = 0
|
||||
if (script.isUnix()) {
|
||||
vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
}
|
||||
else {
|
||||
vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" 2>&1>\$null", , returnStatus: true)
|
||||
}
|
||||
if (vstatus > 0) {
|
||||
script.error("The subcomponent name: ${variant} needs to be renamed as it cannot be used in a git tag name")
|
||||
}
|
||||
}
|
||||
this.productname = productname
|
||||
this.subcomponentname = subcomponentname
|
||||
this.variant = variant
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
productname = rawmeta['productname']
|
||||
subcomponentname = rawmeta['subcomponentname']
|
||||
variant = rawmeta['variant'] ?: ""
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'productname' : productname,
|
||||
'subcomponentname' : subcomponentname,
|
||||
'variant' : variant,
|
||||
]
|
||||
return data
|
||||
}
|
||||
|
|
@ -170,6 +187,10 @@ class BuildStampInfo extends GISJsonSerialised {
|
|||
this.buildstamp = buildstamp
|
||||
}
|
||||
|
||||
void set(BuildStampInfo other) {
|
||||
set(other.buildstampprefix, other.revision, other.buildstamp)
|
||||
}
|
||||
|
||||
String buildstampcommasep() {
|
||||
def String buildstampcommasep = buildstamp.replace(".", ",")
|
||||
return buildstampcommasep
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class DebRootDefinition {
|
|||
String GIS_OPT_SCRIPTS_CONTROL
|
||||
String GIS_OPT_WWW
|
||||
String GIS_OPT_OTHER
|
||||
String GIS_OPT_KERNEL
|
||||
String GIS_OPT_LOGIC
|
||||
String GIS_OPT_PRINTHEAD
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ class DebRootDefinition {
|
|||
String HTTP_DEV_DIV
|
||||
String LIB_SYSTEMD
|
||||
|
||||
DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) {
|
||||
DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix) {
|
||||
ROOTPATH = rootpath
|
||||
PACKAGE_PREFIX = packageprefix
|
||||
PACKAGE_FOLDER_NAME = packageprefix
|
||||
|
|
@ -37,27 +38,28 @@ class DebRootDefinition {
|
|||
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"
|
||||
ETC = "${DEBPATH}/etc" + inpackagepathsuffix
|
||||
GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + inpackagepathsuffix
|
||||
GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + inpackagepathsuffix
|
||||
GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + inpackagepathsuffix
|
||||
GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + inpackagepathsuffix
|
||||
GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" + inpackagepathsuffix
|
||||
GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + inpackagepathsuffix
|
||||
GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + inpackagepathsuffix
|
||||
GIS_OPT_KERNEL = "${DEBPATH}/opt/gis/kernel" + inpackagepathsuffix
|
||||
GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + inpackagepathsuffix
|
||||
GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + inpackagepathsuffix
|
||||
|
||||
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"
|
||||
USR_BIN = "${DEBPATH}/usr/bin" + inpackagepathsuffix
|
||||
USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + inpackagepathsuffix
|
||||
LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + inpackagepathsuffix
|
||||
HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + inpackagepathsuffix
|
||||
LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + inpackagepathsuffix
|
||||
}
|
||||
}
|
||||
|
||||
def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp) {
|
||||
return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp)
|
||||
def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') {
|
||||
return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix)
|
||||
}
|
||||
|
||||
def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) {
|
||||
|
|
@ -70,7 +72,6 @@ def buildPackage(String packageout, String uniquepackageout, DebRootDefinition p
|
|||
|
||||
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}"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
markunstable = false
|
||||
unstablereason = ""
|
||||
|
||||
|
|
@ -373,7 +375,8 @@ def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String source
|
|||
|
||||
def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) {
|
||||
def buildmeta = buildinfo.meta
|
||||
def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}"
|
||||
def uriconverted = gh.uniquereporootname(buildmeta.gitinfo.remoteurl)
|
||||
def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${uriconverted}"
|
||||
def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}"
|
||||
def String uniquefoldertemp = "${tempfolder}/${uniquefolder}"
|
||||
def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
|
||||
meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO)
|
||||
meta = autobuilderscript.startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
agent { label AGENT_LABEL }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
|
|
@ -53,7 +53,10 @@ pipeline {
|
|||
SOURCEDIR = "${WORKSPACE}/source"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
SOURCE_PATH = "${SOURCEDIR}"
|
||||
env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}"
|
||||
SRC = "${SOURCE_PATH}"
|
||||
if (SOURCE_OFFSET_PATH) {
|
||||
SRC += "/${SOURCE_OFFSET_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -81,20 +84,29 @@ pipeline {
|
|||
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
|
||||
"""
|
||||
def EXCLUDE_PARAM = ''
|
||||
if (EXCLUDE_PATHS) {
|
||||
EXCLUDE_PARAM = '--exclude "'
|
||||
def exclude_path_list = EXCLUDE_PATHS.split(',')
|
||||
for (exclude_path in exclude_path_list) {
|
||||
EXCLUDE_PARAM += "${SRC}/${exclude_path.trim()},"
|
||||
}
|
||||
EXCLUDE_PARAM += '"'
|
||||
}
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -ev
|
||||
|
||||
mkdir -p "${PPDFOLDER}"
|
||||
export PMD_JAVA_OPTS=-Xmx65536m
|
||||
"${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/cpd.xml"
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
mkdir -p "${PPDFOLDER}"
|
||||
set PMD_JAVA_OPTS=-Xmx2048m
|
||||
"${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/cpd.xml"
|
||||
"""
|
||||
}
|
||||
recordIssues(tools: [
|
||||
cpd(pattern: "**/cpd.xml", reportEncoding: 'UTF-8'),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ def boolean isShallowClonedRepo(String gitrootpath) {
|
|||
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()
|
||||
isshallowclone = powershell(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean()
|
||||
}
|
||||
echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}"
|
||||
}
|
||||
|
|
@ -89,9 +89,9 @@ def String checkouttoreporoot(String gitURL) {
|
|||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
powershell """
|
||||
git status
|
||||
if errorlevel 1 EXIT /b 1
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
|
@ -109,9 +109,9 @@ def checkgitlfsinstall() {
|
|||
"""
|
||||
|
||||
} else {
|
||||
bat """
|
||||
powershell """
|
||||
git lfs install
|
||||
if errorlevel 1 EXIT /b 1
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
|
@ -185,6 +185,7 @@ def showsparseitemlist(ArrayList<String> sparseitemlist = new ArrayList<String>(
|
|||
}
|
||||
|
||||
def docheckout(String gitURL, String revision, int cloneDepth, String reporootpath, boolean shallowClone, String targetDir, sparseitemlist) {
|
||||
echo "Git: Checking out: URL: ${gitURL} Revision: ${revision} to: ${targetDir}"
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
userRemoteConfigs: [
|
||||
|
|
@ -221,7 +222,7 @@ def gitinit(String targetDir, String reporootpath) {
|
|||
git init "${targetDir}"
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
powershell """
|
||||
git init "${targetDir}"
|
||||
"""
|
||||
}
|
||||
|
|
@ -245,7 +246,7 @@ def setlfsfetchinclude(String targetDir, ArrayList<String> sparseitemlist) {
|
|||
git config lfs.fetchinclude "${sparseitemliststring}"
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
powershell """
|
||||
git config lfs.fetchinclude "${sparseitemliststring}"
|
||||
"""
|
||||
}
|
||||
|
|
@ -263,7 +264,7 @@ def gitsparserestore(String targetDir) {
|
|||
git reset --hard > /dev/null
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
powershell """
|
||||
git rm -rf . 2> nul
|
||||
git clean -fxd 2> nul
|
||||
git reset --hard 2> nul
|
||||
|
|
@ -311,8 +312,8 @@ def checkRepoExists(String gitURL) {
|
|||
returnStatus: true
|
||||
)
|
||||
} else {
|
||||
result = bat( script: """
|
||||
@git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY
|
||||
result = powershell( script: """
|
||||
git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY
|
||||
""",
|
||||
returnStatus: true
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@ def stamp(convertdetails) {
|
|||
def filetoconvert = convertdetail[0]
|
||||
def pattern = convertdetail[1]
|
||||
def replacement = convertdetail[2]
|
||||
//echo "Converting any instances of pattern: ${pattern} with replacement: ${replacement} in file: ${filetoconvert}"
|
||||
echo "Converting any instances of pattern: ${pattern} with replacement: ${replacement} in file: ${filetoconvert}"
|
||||
def stampscript = "${autobuilder.commonscripts()}/versionstamping/versionstamper.py"
|
||||
//echo "Using python: ${PYTHON} and script: ${stampscript}"
|
||||
echo "Using python: ${PYTHON} and script: ${stampscript}"
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
"${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
|
||||
powershell """
|
||||
& "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
|
|||
changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
|
||||
}
|
||||
else {
|
||||
changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger()
|
||||
changecount = powershell(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
|
||||
}
|
||||
echo "Change count: ${changecount}"
|
||||
def int mvnp1 = maxversionnumber() + 1
|
||||
|
|
@ -39,21 +39,21 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
|
|||
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||
}
|
||||
else {
|
||||
gitrevision = bat(returnStdout: true, script: "@git rev-parse HEAD").trim()
|
||||
gitrevision = powershell(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||
}
|
||||
echo "Revision: ${gitrevision}"
|
||||
if (isUnix()) {
|
||||
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
|
||||
}
|
||||
else {
|
||||
remoteinfo = bat(returnStdout: true, script: "@git remote show origin").trim()
|
||||
remoteinfo = powershell(returnStdout: true, script: "git remote show origin").trim()
|
||||
}
|
||||
echo "Remote info: ${remoteinfo}"
|
||||
if (isUnix()) {
|
||||
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
|
||||
}
|
||||
else {
|
||||
remoteurl = bat(returnStdout: true, script: "@git config --get remote.origin.url").trim()
|
||||
remoteurl = powershell(returnStdout: true, script: "git config --get remote.origin.url").trim()
|
||||
}
|
||||
echo "Remote URL: ${remoteurl}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ def main(argv):
|
|||
pattern = args.pattern
|
||||
substitute = args.substitute
|
||||
|
||||
print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert))
|
||||
print("Converting instances of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert))
|
||||
|
||||
with open(filetoconvert,'r') as c:
|
||||
fileread = c.read()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue