Merge commit '3e3fc780b2d0860d3bed5cb788358ebdca90cbfc' into production

This commit is contained in:
Dan Hawkins 2021-11-08 22:40:11 +00:00
commit 907f2d6bdd
29 changed files with 667 additions and 95 deletions

View file

@ -43,8 +43,56 @@ def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) {
return altered
}
// Start up boilderplate
def startbuild(script, String productname = PRODUCT_NAME, String subcomponentname = SUBCOMPONENT_NAME, String releaserepo = RELEASE_REPO, String productvariant = '', String autobuildpath = autobuildroot, String commonscriptspath = commonscriptsroot) {
def setBuildType(meta, boolean dofullbuild = true) {
def doquickbuild = false
echo "Build trigger cause: ${currentBuild.getBuildCauses()}"
if (currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')) {
echo "Build triggered by user"
if (!dofullbuild) {
echo "Marking as quick build as user wanted one"
doquickbuild = true
}
} else {
echo "Build triggered automatically"
if (currentBuild.getBuildCauses('jenkins.branch.BranchEventCause') || currentBuild.getBuildCauses('hudson.triggers.SCMTrigger$SCMTriggerCause')) {
echo "Marking as quick build as it was triggered by a commit"
doquickbuild = true
} else if (currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')) {
echo "Marking as full build as it was triggered by timer"
}
}
echo "Build type is ${doquickbuild ? "quick" : "full"}"
if (doquickbuild) {
unstable('This not a full build - a subset of the artifacts is not being generated')
}
meta.jenkinsbuildinfo.set(!doquickbuild)
return doquickbuild
}
def setupmeta(script, String productname, String subcomponentname, String productvariant = '') {
def meta = getmetafolderscript().metareset(script)
echo "Product name: ${productname} Subcomponent name: ${subcomponentname} Variant: ${productvariant}"
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())
for (p in params) {
meta.jenkinsbuildinfo.addParameter(p.key, p.value)
}
return meta
}
// 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
@ -53,12 +101,7 @@ def startbuild(script, String productname = PRODUCT_NAME, String subcomponentnam
conditionalclean()
def meta = getmetafolderscript().metareset(script)
echo "Product name: ${productname} Subcomponent name: ${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 meta = setupmeta(script, productname, subcomponentname, productvariant)
def rr = load("${commonscripts()}/release/registerrepo.groovy")
def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant)
@ -72,13 +115,12 @@ 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) {
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) {
// Start up boilerplate
def startnonbuild(
script,
autobuildpath = autobuildroot,
commonscriptspath = commonscriptsroot
) {
echo "Starting non-build job...."
autobuildroot = autobuildpath
@ -87,11 +129,7 @@ def startnonbuild(script, autobuildpath = autobuildroot, commonscriptspath = com
conditionalclean()
def meta = getmetafolderscript().metareset(script)
meta.productinfo.set("Non-build-product", "Non-build-subcomponent")
def now = new Date()
now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC'))
meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString())
def meta = setupmeta(script, "Non-build-product", "Non-build-subcomponent")
def ch = load("${commonscripts()}/configuration/configuration.groovy")
ch.registerPipelineScriptConfiguration(meta)

41
build/integrity.groovy Normal file
View file

@ -0,0 +1,41 @@
import static groovy.json.JsonOutput.*
def check(buildmeta) {
def results = [
'good': true,
'comment': '',
]
// Walk the meta looking for different versions of the same components
def allmeta = buildmeta.allrelatedmeta()
echo "All meta:\n${allmeta.comment}"
def productcomponents = [:]
for (meta in allmeta.metacollection) {
def key = meta.componentidentifier()
if (!productcomponents.containsKey(key)) {
productcomponents[key] = [:]
}
def buildstampnumber = meta.releasetag()
if (!productcomponents[key].containsKey(buildstampnumber)) {
productcomponents[key][buildstampnumber] = 1
} else {
productcomponents[key][buildstampnumber] += 1
}
}
echo prettyPrint(toJson(productcomponents))
for (pc in productcomponents.keySet()) {
bsns = productcomponents[pc]
if (bsns.size() > 1) {
results.good = false
results.comment += "There is more than one version of Product component: ${pc} being used in this build:\n"
for (bsn in bsns.keySet()) {
results.comment += "${bsn}\n"
}
}
}
return results
}
return this

65
build/postactions.groovy Normal file
View file

@ -0,0 +1,65 @@
def performSuccessfulBuildActions() {
if (params.DOXYGEN_DEPLOY_JOB != null) {
if (DOXYGEN_DEPLOY_JOB && Jenkins.instance.getItemByFullName(DOXYGEN_DEPLOY_JOB).isBuildable()) {
build(
wait: false,
job: DOXYGEN_DEPLOY_JOB,
parameters: [
string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS', value: JOB_NAME),
string(name: 'BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.46.2'> <buildNumber>${BUILD_NUMBER}</buildNumber></SpecificBuildSelector>"),
]
)
}
}
if (params.STATIC_ANALYSIS_JOB != null) {
if (STATIC_ANALYSIS_JOB && Jenkins.instance.getItemByFullName(STATIC_ANALYSIS_JOB).isBuildable()) {
build(
wait: false,
job: STATIC_ANALYSIS_JOB,
parameters: [
string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME),
string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.46.2'> <buildNumber>${BUILD_NUMBER}</buildNumber></SpecificBuildSelector>"),
]
)
}
}
if (params.UNIT_TEST_JOB != null) {
if (UNIT_TEST_JOB && Jenkins.instance.getItemByFullName(UNIT_TEST_JOB).isBuildable()) {
build(
wait: false,
job: UNIT_TEST_JOB,
parameters: [
string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME),
string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.46.2'> <buildNumber>${BUILD_NUMBER}</buildNumber></SpecificBuildSelector>"),
]
)
}
}
if (params.REGRESSION_TEST_JOB != null) {
if (REGRESSION_TEST_JOB && Jenkins.instance.getItemByFullName(REGRESSION_TEST_JOB).isBuildable()) {
build(
wait: false,
job: REGRESSION_TEST_JOB,
parameters: [
string(name: 'APPLICATION_ARTIFACT_PROJECT', value: JOB_NAME),
string(name: 'APPLICATION_ARTIFACT_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.46.2'> <buildNumber>${BUILD_NUMBER}</buildNumber></SpecificBuildSelector>"),
]
)
}
}
if (params.RELEASE_TO_GIT_JOB != null) {
if (RELEASE_TO_GIT_JOB && Jenkins.instance.getItemByFullName(RELEASE_TO_GIT_JOB).isBuildable()) {
build(
wait: false,
job: RELEASE_TO_GIT_JOB,
parameters: [
string(name: 'BUILD_JOB', value: JOB_NAME),
string(name: 'BUILD_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.46.2'> <buildNumber>${BUILD_NUMBER}</buildNumber></SpecificBuildSelector>"),
]
)
}
}
}
return this;

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {

View file

@ -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)
}

View file

@ -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()

View file

@ -0,0 +1,59 @@
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
class ToolOptions {
def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo)
String m_toolName
String m_gitURL
String m_revision
String m_repoRoot
int m_cloneDepth
boolean m_shallowClone
ToolOptions(script) {
m_script = script
m_gitURL = '-'
m_revision = '-'
m_repoRoot = ''
m_cloneDepth = 1
m_shallowClone = true
}
void toolName(String name) {
m_toolName = name.trim()
}
void toolRepo(String gitURL, String revision) {
m_gitURL = gitURL.trim()
m_revision = revision.trim()
}
void repoRoot(String root) {
m_repoRoot = root.trim()
}
void clonedepth(int depth) {
m_cloneDepth = depth
}
void shallowclone(boolean shallow) {
m_shallowClone = shallow
}
}
ToolOptions getNewToolOptions() {
return new ToolOptions(this)
}
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
}
def getTool(meta, ToolOptions options, String targetDir) {
gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone)
registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir))
}
return this

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {
@ -41,7 +41,7 @@ pipeline {
rm -v -rf meta
mv -v "${ESW}"/* .
"""
archiveArtifacts "${artifactlist}"
archiveArtifacts artifactlist
}
}
}

View file

@ -48,7 +48,7 @@ pipeline {
steps {
script {
def artifactlist = meta.generateartifacts(["filtered/**"])
archiveArtifacts "${artifactlist}"
archiveArtifacts artifactlist
}
}
}

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {
@ -26,6 +26,7 @@ pipeline {
stage('Copying logic artifacts') {
steps {
script {
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)
@ -42,7 +43,7 @@ pipeline {
rm -v -rf diff
mv -v "logic"/* .
"""
archiveArtifacts "${artifactlist}"
archiveArtifacts artifactlist
}
}
}

View file

@ -1,15 +1,23 @@
def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) {
echo "Comparing file: ${importedfile} with: ${currentfile} option: ${ignorewhitespace}"
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}"
"""
}
}

View file

@ -1,4 +1,5 @@
def comparefiles(importedjsonfile, currentjsonfile) {
echo "Comparing json 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 }
"""
}
}

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {

View file

@ -38,7 +38,7 @@ class ProductInfo extends GISJsonSerialised {
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")
@ -48,7 +48,7 @@ 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")
@ -59,7 +59,7 @@ class ProductInfo extends GISJsonSerialised {
vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true)
}
else {
vstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true)
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")
@ -70,6 +70,12 @@ class ProductInfo extends GISJsonSerialised {
this.variant = variant
}
void set(ProductInfo otherinfo) {
this.productname = otherinfo.productname
this.subcomponentname = otherinfo.subcomponentname
this.variant = otherinfo.variant
}
void deserialiseJson(rawmeta) {
productname = rawmeta['productname']
subcomponentname = rawmeta['subcomponentname']
@ -110,6 +116,14 @@ class GitInfo extends GISJsonSerialised {
this.remoteinfo = remoteinfo
}
void set(GitInfo otherinfo) {
this.sourcepath = otherinfo.sourcepath
this.sourcerevision = otherinfo.sourcerevision
this.gitrevision = otherinfo.gitrevision
this.remoteurl = otherinfo.remoteurl
this.remoteinfo = otherinfo.remoteinfo
}
void deserialiseJson(rawmeta) {
sourcepath = rawmeta['sourcepath']
sourcerevision = rawmeta['sourcerevision']
@ -130,25 +144,78 @@ class GitInfo extends GISJsonSerialised {
}
}
class JenkinsBuildParameter extends GISJsonSerialised {
private String name
private String valuetype
private String value
JenkinsBuildParameter(script, String name = '', String valuetype = '', String value = '') {
super(script)
this.name = name
this.valuetype = valuetype
this.value = value
}
void set(String name, String valuetype, String value) {
this.name = name
this.valuetype = valuetype
this.value = value
}
void deserialiseJson(rawmeta) {
name = rawmeta['name']
valuetype = rawmeta['valuetype']
value = rawmeta['value']
}
LinkedHashMap serialisationdata() {
def data = [
'name' : name,
'valuetype' : valuetype,
'value' : value,
]
return data
}
}
class JenkinsBuildInfo extends GISJsonSerialised {
String buildjobname
int buildnumber
private String buildmachine
private String builddate
ArrayList<JenkinsBuildParameter> parameters
boolean isfullbuild
JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "") {
JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "", boolean isfullbuild = true) {
super(script)
this.buildjobname = buildjobname
this.buildnumber = buildnumber
this.buildmachine = buildmachine
this.builddate = builddate
this.isfullbuild = isfullbuild
parameters = new ArrayList<JenkinsBuildParameter>()
}
void set(String buildjobname, int buildnumber, String buildmachine, String builddate) {
void set(String buildjobname, int buildnumber, String buildmachine, String builddate, boolean isfullbuild = true) {
this.buildjobname = buildjobname
this.buildnumber = buildnumber
this.buildmachine = buildmachine
this.builddate = builddate
this.isfullbuild = isfullbuild
}
void set(boolean isfullbuild) {
this.isfullbuild = isfullbuild
}
boolean isFullBuild() {
return isfullbuild
}
void addParameter(String name, value) {
def p = new JenkinsBuildParameter(script, name, value.getClass().toString(), value.toString())
parameters.add(p)
return p
}
void deserialiseJson(rawmeta) {
@ -156,6 +223,23 @@ class JenkinsBuildInfo extends GISJsonSerialised {
buildnumber = rawmeta['buildnumber']
buildmachine = rawmeta['buildmachine']
builddate = rawmeta['builddate']
isfullbuild = (rawmeta['isfullbuild'] == null) ? true : rawmeta['isfullbuild']
parameters = new ArrayList<JenkinsBuildParameter>()
if (rawmeta['isfullbuild'] != null) {
for (rawparameter in rawmeta['parameters']) {
def p = new JenkinsBuildParameter(script)
p.deserialiseJson(rawparameter)
parameters.add(p)
}
}
}
List parametersserialised() {
def associated = []
for (p in parameters) {
associated.add(p.serialisationdata())
}
return associated
}
LinkedHashMap serialisationdata() {
@ -164,6 +248,8 @@ class JenkinsBuildInfo extends GISJsonSerialised {
'buildnumber' : buildnumber,
'buildmachine' : buildmachine,
'builddate' : builddate,
'isfullbuild' : isfullbuild,
'parameters' : parametersserialised(),
]
return data
}
@ -539,6 +625,10 @@ class MetaInfo extends GISJsonSerialised {
return custominfo.getAt(customId.trim())
}
def isFullBuild() {
return jenkinsbuildinfo.isFullBuild()
}
List publishableinfoserialised() {
def publishable = []
for (publishableitem in publishableinfo) {
@ -762,6 +852,25 @@ class MetaInfo extends GISJsonSerialised {
return releasemetaversionuniquecollection
}
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0) {
def results = [
'metacollection' : metacollection,
'comment': comment
]
results.metacollection.add(this)
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
for (relatedmetainfo in associatedmeta) {
MetaInfo othermeta = relatedmetainfo.meta
results = othermeta.walkrelated(results.metacollection, results.comment, level + 1)
}
return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
}
def allrelatedmeta() {
ArrayList<MetaInfo> metacollection = new ArrayList<MetaInfo>()
return walkrelated(metacollection)
}
MetaInfo getNewMetaObject(script) {
return new MetaInfo(script)
}

View file

@ -20,6 +20,7 @@ class DebRootDefinition {
String GIS_OPT_KERNEL
String GIS_OPT_LOGIC
String GIS_OPT_PRINTHEAD
String GIS_OPT_BOOT
String USR_BIN
String USR_LIB_ARCH
@ -27,7 +28,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
@ -38,28 +39,29 @@ 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_KERNEL = "${DEBPATH}/opt/gis/kernel"
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
GIS_OPT_BOOT = "${DEBPATH}/opt/gis/boot" + 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) {

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {
@ -62,6 +62,7 @@ pipeline {
echo("Showing filtered releases")
for (release in allreleases) {
if (!release.toLowerCase().startsWith("superceded") &&
!release.toLowerCase().startsWith("superseded") &&
!release.toLowerCase().startsWith("erroneous") &&
!release.toLowerCase().startsWith("faulty") &&
!release.toLowerCase().startsWith("ignore") &&

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {

View file

@ -235,6 +235,7 @@ def boolean releasegittags(String postcommitshacode, ArrayList<String> taglist)
summaryappend("Rel Tag ")
for (tag in taglist) {
if (releasegittag(postcommitshacode, tag)) {
echo "Tag added: ${tag} with sha: ${postcommitshacode}"
tagadded = true
}
}
@ -420,7 +421,14 @@ def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String
if (DO_INTEGRITY_CHECK == "true") {
if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) {
error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct?"
error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct? (If you ignore this issue, you will get an error much later because the system cannot tag 2 different commits of the associated source code with the same label)"
}
}
for (key in componentReleaseInfo.keySet()) {
def buildinfo = componentReleaseInfo[key]
if (!buildinfo.jenkinsbuildinfo.isFullBuild()) {
error "The subcomponent: ${buildinfo.componentidentifier()} is not a full build (Some artifacts are missing)"
}
}

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {
@ -97,7 +97,7 @@ pipeline {
script {
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
def artifactlist = meta.generateartifacts(itemsForRelease)
archiveArtifacts "${artifactlist}"
archiveArtifacts artifactlist
}
}
}

View file

@ -129,7 +129,7 @@ pipeline {
script {
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
def artifactlist = meta.generateartifacts(itemsForRelease)
archiveArtifacts "${artifactlist}"
archiveArtifacts artifactlist
}
}
}

View file

@ -1,5 +1,5 @@
pipeline {
agent { label "${AGENT_LABEL}" }
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {
@ -91,7 +91,7 @@ pipeline {
script {
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
def artifactlist = meta.generateartifacts(itemsForRelease)
archiveArtifacts "${artifactlist}"
archiveArtifacts artifactlist
}
}
}

View file

@ -0,0 +1,203 @@
import jenkins.model.Jenkins
pipeline {
agent { label AGENT_LABEL }
stages {
stage ("Initial Setup") {
steps{
script {
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
}
}
}
stage ("Checkout test environment") {
steps {
script {
toolsimporter = load("${autobuilder.commonscripts()}/configuration/tools.groovy")
def TEST_ENVIRONMENT_URL = 'git@hydra:gistest/jenkins-ethernet-test-environment.git'
def TEST_ENVIRONMENT_DIR = 'TestEnvironmentDir'
def TEST_ENVIRONMENT_REVISION = 'origin/master'
def environmentoptions = toolsimporter.getNewToolOptions()
environmentoptions.toolName('Ethernet product test environment')
environmentoptions.toolRepo(TEST_ENVIRONMENT_URL, TEST_SOURCE_REVISION)
toolsimporter.getTool(meta, environmentoptions, TEST_ENVIRONMENT_DIR)
TEST_ENVIRONMENT_FILE = "${TEST_ENVIRONMENT_DIR}/environment.json"
def alltestenvironment = readJSON(file: "${TEST_ENVIRONMENT_FILE}")
TEST_ENVIRONMENT = alltestenvironment[ETHERNET_PRODUCT_TO_RUN_TEST]
echo "Selected environment:\n${TEST_ENVIRONMENT}"
}
}
}
stage ('Setup') {
agent { label TEST_ENVIRONMENT['FTDI_AGENT'] }
stages {
stage ("Checkout dependencies") {
steps {
script {
def PYTHON_URL = 'git@hydra:tools/python.git'
if (isUnix()) {
PYTHON_REVISION = 'origin/3.6.3_linux'
}
else {
PYTHON_REVISION = 'origin/3.8.10_windows_for_test'
}
PYTHONDIR = "${WORKSPACE}/python"
def pythonimportoptions = toolsimporter.getNewToolOptions()
pythonimportoptions.toolName('Python')
pythonimportoptions.toolRepo(PYTHON_URL, PYTHON_REVISION)
toolsimporter.getTool(meta, pythonimportoptions, PYTHONDIR)
if (isUnix()) {
env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3"
}
else {
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
}
def TEST_SOURCE_URL = 'git@hydra:hmb_regression/hmb_tests.git'
TEST_SUITE_DIR = 'TestSuiteDir'
env.GIS_TEST_SUITE_HOME = "${WORKSPACE}/${TEST_SUITE_DIR}"
def regressiontestimportoptions = toolsimporter.getNewToolOptions()
regressiontestimportoptions.toolName('Tests')
regressiontestimportoptions.toolRepo(TEST_SOURCE_URL, TEST_SOURCE_REVISION)
toolsimporter.getTool(meta, regressiontestimportoptions, GIS_TEST_SUITE_HOME)
env.HISTORY_FOLDER = "${WORKSPACE}/testhistory"
def resultimportoptions = toolsimporter.getNewToolOptions()
resultimportoptions.toolName('Test history')
resultimportoptions.toolRepo(HISTORY_REPO, HISTORY_REVISION)
toolsimporter.getTool(meta, resultimportoptions, HISTORY_FOLDER)
def CORE_SOURCE_URL = 'git@hydra:gistest/giscorelite.git'
env.GIS_TEST_SUITE_CORE = "${WORKSPACE}/GisCore"
def coreimportoptions = toolsimporter.getNewToolOptions()
coreimportoptions.toolName('Test core')
coreimportoptions.toolRepo(CORE_SOURCE_URL, CORE_SOURCE_REVISION)
toolsimporter.getTool(meta, coreimportoptions, GIS_TEST_SUITE_CORE)
def FTDI_SOURCE_URL = 'git@hydra:python_scripts/ftdi_relay.git'
def FTDI_SOURCE_REVISION = 'origin/Core-98'
FTDI_SOURCE_DIR = "${WORKSPACE}/PowerController"
def ftdiimportoptions = toolsimporter.getNewToolOptions()
ftdiimportoptions.toolName('FTDI relay driver')
ftdiimportoptions.toolRepo(FTDI_SOURCE_URL, FTDI_SOURCE_REVISION)
toolsimporter.getTool(meta, ftdiimportoptions, FTDI_SOURCE_DIR)
def HISTORY_PROCESSING_REPO = 'git@hydra:gistestresults/ethernet-products-history-processing.git'
HISTORY_PROCESSING_DIR = "${WORKSPACE}/HistoryProcessing"
def resultprocessingoptions = toolsimporter.getNewToolOptions()
resultprocessingoptions.toolName('History processing')
resultprocessingoptions.toolRepo(HISTORY_PROCESSING_REPO, HISTORY_PROCESSING_REVISION)
toolsimporter.getTool(meta, resultprocessingoptions, HISTORY_PROCESSING_DIR)
}
}
}
stage ("Import application to test") {
steps {
script {
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
APPLICATION_UNDER_TEST = 'application_under_test'
env.APPLICATION_ARTIFACT_FOLDER = "${WORKSPACE}/${APPLICATION_UNDER_TEST}"
def applicationimportoptions = importer.getNewImportOptions()
applicationimportoptions.jenkinsjob(APPLICATION_ARTIFACT_PROJECT, APPLICATION_ARTIFACT_SELECTOR)
applicationimportoptions.setfilter('app_package/**,control_package/**')
applicationmeta = importer.artifactimport(meta, applicationimportoptions, APPLICATION_ARTIFACT_FOLDER)
meta.productinfo.set(applicationmeta.productinfo)
meta.productinfo.subcomponentname = "${applicationmeta.productinfo.subcomponentname}_TEST"
meta.gitinfo.set(applicationmeta.gitinfo)
meta.buildstampinfo.set(applicationmeta.buildstampinfo)
}
}
}
stage("Clean") {
steps {
script {
LOGGING_ROOT = 'Logging'
env.GIS_TEST_OUTPUT_LOGGING_ROOT = "${WORKSPACE}/${LOGGING_ROOT}"
cleanfolders = [
GIS_TEST_OUTPUT_LOGGING_ROOT,
]
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
cleaner.clean(cleanfolders)
}
}
}
stage ('Test') {
steps {
script {
lock(TEST_ENVIRONMENT['RESOURCE_LOCK']) {
if (POWER_CYCLE_HARDWARE == 'true') {
dir(FTDI_SOURCE_DIR) {
bat """
"${PYTHON}" "${FTDI_SOURCE_DIR}/RegressionPower.py" -d ${TEST_ENVIRONMENT['FTDI_RELAY_DEVICE']} -o True
"""
}
}
if (UPDATE_HARDWARE == 'true') {
dir(GIS_TEST_SUITE_CORE) {
bat """
"${PYTHON}" "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbPackageDeployer.py" -p "${APPLICATION_ARTIFACT_FOLDER}" -t "${TEST_ENVIRONMENT['IP_ADDRESS']}"
"""
rc = bat (script:"""
"${PYTHON}" "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbinspectstate.py"
""",
returnStatus: true)
if (rc == 1) {
unstable('FAILED while inspecting state of hardware')
}
}
}
if (DO_TEST == 'true') {
rc = bat(script:"""
${PYTHON} "${GIS_TEST_SUITE_CORE}/GISTestMaster.py" -w ${PRODUCT_LOCATION_UNDER_TEST} -fl --include ${TEST_INCLUDE_FILTER}
""",
returnStatus: true
)
if (rc == 1) {
unstable('FAILED while running tests')
}
}
}
}
}
}
stage("Archive Test History") {
steps{
script {
dir(HISTORY_FOLDER) {
rc = bat (script:"""
"${PYTHON}" "${HISTORY_PROCESSING_DIR}/GitCyclicPush.py"
""",
returnStatus: true
)
if (rc == 1) {
unstable('FAILED to process history')
}
}
}
}
}
stage("Archive test artifacts"){
steps{
script {
def artifactlist = meta.generateartifacts([ "${LOGGING_ROOT}/**"])
archiveArtifacts artifactlist
}
}
}
}
}
}
}

View file

@ -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: [
@ -195,8 +196,8 @@ def docheckout(String gitURL, String revision, int cloneDepth, String reporootpa
],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'GitLFSPull'],
[$class: 'CleanBeforeCheckout'],
[$class: 'GitLFSPull',timeout: 25],
[$class: 'CleanBeforeCheckout',timeout: 20],
[$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120],
[$class: 'CheckoutOption', timeout: 120],
[$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir],
@ -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,10 +264,10 @@ def gitsparserestore(String targetDir) {
git reset --hard > /dev/null
"""
} else {
bat """
git rm -rf . 2> nul
git clean -fxd 2> nul
git reset --hard 2> nul
powershell """
git rm -rf . > \$null
git clean -fxd > \$null
git reset --hard > \$null
"""
}
}
@ -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
)

View file

@ -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}"
"""
}
}

View file

@ -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}"
}