Skip to content

Instantly share code, notes, and snippets.

@johnstosh
Last active September 14, 2017 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnstosh/38cb3e064037d33e674eb2a916c38c23 to your computer and use it in GitHub Desktop.
Save johnstosh/38cb3e064037d33e674eb2a916c38c23 to your computer and use it in GitHub Desktop.
declarative jenkins pipeline for parallel builds
pipeline {
environment {
/*
* Maybe maven 3.5.0 is why the build hangs sometimes?
* I'm trying 3.0.5 which is what's in NetBeans.
* That fixed it.
*/
mvnHome = tool 'maven-3.0.5'
jenkins2MvnVersion = 'maven-3.5.0'
jenkins2JdkVersion = 'jdk8u131'
sqApacheMaven = 'M:\\apache-maven-3.0.5'
sqApacheAnt = 'M:\\apache-ant-1.9.9'
sqJdk8u131_32 = 'M:\\jdk1.8.0_131-32'
sqJdk8u131_64 = 'M:\\jdk1.8.0_131-64'
/*
* commands that are repeatedly used
*/
qp_install_build_tools = 'mvn -B -V -U --file java\\qp-install-build-tools\\pom.xml initialize'
qp_version_set = 'mvn -B -DskipTests -V -U --file java\\qp-versionset\\pom.xml process-resources'
qp_full_aggregator = 'mvn -B -DskipTests -V -U --file java\\full-aggregator\\pom.xml install'
qp_fetch_for_munit = 'mvn -B -V -U --file java\\qp-fetch-for-munit\\pom.xml install'
qp_munit = 'ant -buildfile matlab\\dev\\ContinuousIntegration\\qp_munit.xml -lib matlab\\dev\\ContinuousIntegration'
mybranch = 'default'
}
agent none
options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '30'))
retry(1)
skipDefaultCheckout()
disableConcurrentBuilds()
}
stages {
stage('prepare') {
steps {
parallel (
qp_blks_docs: {
node ('QPRE-BLKS-DOCS') {
ws ('quantiphire-ws') {
// Name the build after the build machine as a debugging aid.
script {
currentBuild.displayName = "#${env.BUILD_ID} ${env.NODE_NAME}"
}
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
/* This is a cut-down version of the text from the script builder and seems to work.
* When I had changelog:true on this first one and false on the rest, I was still
* getting doubles in the change log ("Changes" in Jenkins UI). So now its false
* everywhere.
* I'm still seeing multiple "Tag this build", but what can you do? Wait for
* a bug fix.
*
* changelog:
*
* skipChangeLog:
*
* filterChangelog: If set Jenkins will apply the same inclusion and exclusion
* patterns for displaying changelog entries as it does for polling for changes.
* If this is disabled, changes which are excluded for polling are still
* displayed in the changelog.
*/
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
//locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity',
//ignoreExternalsOption: false, local: '.', remote: 'svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/trunk']],
// what's with these?
//checkout(changelog: false, workspaceUpdater: 'UpdateWithCleanUpdater')
//checkout(workspaceUpdater: [$class: 'UpdateWithCleanUpdater'])
//checkout(workspaceUpdater: 'UpdateWithCleanUpdater', scm: scm)
// scm.setWorkspaceUpdater(new UpdateWithCleanUpdater())
// Maven requires JAVA_HOME.
// Use the Jenkins2 installed maven at jenkins2MvnVersion
// to bring up all the tools we desire to use, including our
// favorite mvn version and favorite JDK version.
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
// Advice: don't define M2_HOME in general. Maven will autodetect its root fine.
// dunno why, but ${env.JAVA_HOME} was showing up null, so I dup'd the ${sqJdk8u131_64}
// I flipped all the slashes to backslashes and dumped the colon used as a path separator.
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 30, unit: 'MINUTES') {
// Set the version numbers of various pieces of QuantiPhi
// based on the SVN revisions of subtrees. This uses the
// qp-build-support jar because it is named in the pom files.
// This will also create the productBuild.properties file.
bat "mvn -B -V -U --file matlab\\versionset\\pom.xml process-resources"
// qp-blks-docs gets a version number different than the product.
// It gets the committedRevision for the matlab folder (tree) only.
script {
def props = readProperties file: 'productBuild.properties'
def productFullVersion = props['productFullVersion']
bat "mvn -B -V -U --file matlab\\qp-blks-docs\\pom.xml versions:set -DnewVersion=${productFullVersion}"
}
}
}
// Can need more than 30 minutes when uploading across slow internet pipes.
// Note we'll also get "Connection reset by peer: socket write error" so I've added retries.
retry (3) {
timeout(time: 90, unit: 'MINUTES') {
bat "mvn -B -V -U --file matlab\\qp-blks-docs\\pom.xml deploy -Dsqnode=${env.NODE_NAME}"
}
}
} // end withenv
} // end of ws
} // end of node
}, // end of parallel case
// Turned off while Steve Fowler borrows the laptop that runs this test.
// inhw_RL78: {
// node ('INHW-RL78') {
// ws ('quantiphire-ws') {
//
// // Report the build name and the build machine as a debugging aid.
// //echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
//
// script{
// if (env.BRANCH_NAME == null) {
// mybranch = "trunk";
// } else {
// mybranch = 'branches/' + env.BRANCH_NAME;
// }
// }
// checkout changelog: false, poll: false, scm:
// [$class: 'SubversionSCM',
// scm.locations,
// workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
//
//
// withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
// "PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// // If files are installed, it'll take a longer timeout.
// retry (30) {
// timeout(time: 2, unit: 'HOURS') {
// // Here we install some tools like JDK and target compilers.
// // Using whatever default maven is supplied by Jenkins2.
// bat qp_install_build_tools
// }
// }
// }
//
// withEnv(["JAVA_HOME=${sqJdk8u131_32}", "PATH+MAVEN=${sqApacheMaven}\\bin",
// "PATH+JAVA=${sqJdk8u131_32}\\bin", "PATH+ANT=${sqApacheAnt}\\bin"]) {
// retry (3) {
// timeout(time: 20, unit: 'MINUTES') {
// // This will also create the productBuild.properties file.
// bat qp_version_set
//
// // Rename the build after the QuantiPhi product version. Also includes the build machine as a debugging aid.
// script {
// def props = readProperties file: 'productBuild.properties'
// def productFullVersion = props['productFullVersion']
// currentBuild.displayName = "#${env.BUILD_ID} ${env.NODE_NAME} ${productFullVersion}"
// }
//
//
// // Build QuantiPhi in general before doing the in-hardware testing.
// // http://maven.apache.org/plugins-archives/maven-surefire-plugin-2.12.4/examples/skipping-test.html
// // -DskipTests skips executing tests while still compiling tests.
// // The lifecycle is: ... package, verify, install. We don't need the install?
// // We need the install for local dependencies (on this machine) because this is the first build on this machine.
// // Apache Maven related side notes:
// // -B : recommended in CI to inform maven to not run in interactive mode (less logs)
// // -V : strongly recommended in CI, will display the JDK and Maven versions in use.
// // Very useful to be quickly sure the selected versions were the ones you think.
// // -U : force maven to update snapshots each time (default : once an hour, makes no sense in CI).
// // -Dsurefire.useFile=false : useful in CI. Displays test errors in the logs directly (instead of
// // having to crawl the workspace files to see the cause).
// bat "${qp_full_aggregator} -Dsqnode=${env.NODE_NAME}"
// }
// }
//
// // I don't want a retry here because it takes so long and the tests internally do retries.
// timeout(time: 1, unit: 'HOURS') {
// // maven has groups based on annotations for doing particular subsets of tests
// bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rl78-base-test\\pom.xml test -DSqInHw=yes -Dgroups=qp.InHwF14 -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// // The documentation has to run after the testing.
// bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rl78-base-test\\pom.xml test -Dgroups=qp.DocumentGeneration -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// // zip reports and put into Artifactory
// bat "mvn -B -V -U --file java\\qp-docs\\pom.xml deploy -Dmicro=RL78 -Dsqnode=${env.NODE_NAME}"
//
// // Rewrite the JUnit test results to be prefixed with the RL78 in-hardware catagory.
// bat "mvn -B -V -U --file java\\qp-rewrite-inhw-testresults\\pom.xml install -DmatlabVersion=inhw_RL78.${env.NODE_NAME}"
// }
// } // end withenv
//
//
// // declarative pipeline doesn't allow nesting POST and ALWAYS here.
// junit 'java/QuantiPhiSuite/**/surefire-reports/*.xml'
//
//
// } // end of ws
// } // end of node
// }, // end of parallel case
junit_RH850: {
node ('QPRE-JUNIT') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 30, unit: 'MINUTES') {
// This will also create the productBuild.properties file.
bat qp_version_set
// Build QuantiPhi in general. This is a work-around for the fact that I haven't deployed all the
// jar files that are part of QuantiPhi. The unit tests below have dependencies on individual jar files.
bat "${qp_full_aggregator} -Dsqnode=${env.NODE_NAME}"
}
}
timeout(time: 5, unit: 'HOURS') {
// test QuantiPhi in general.
// Note that -DSqInHw= must be set to no for JUnit testing. It is optional to set it to yes for in-hardware testing.
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\pom.xml test -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-common-base-test\\pom.xml test -DSqInHw=no -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rh850-base-test\\pom.xml test -DSqInHw=no -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rh850-ui-test\\pom.xml test -DSqInHw=no -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// Rewrite the JUnit test results to be prefixed with the JUnit catagory.
bat "mvn -B -V -U --file java\\qp-rewrite-inhw-testresults\\pom.xml install -DmatlabVersion=JUnit.${env.NODE_NAME}"
}
} // end of withEnv step
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit 'java/QuantiPhiSuite/**/surefire-reports/*.xml'
} // end of ws
} // end of node
}, // end of parallel case
junit_RL78: {
node ('QPRE-JUNIT') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 30, unit: 'MINUTES') {
// This will also create the productBuild.properties file.
bat qp_version_set
// Build QuantiPhi in general. This is a work-around for the fact that I haven't deployed all the
// jar files that are part of QuantiPhi. The unit tests below have dependencies on individual jar files.
bat "${qp_full_aggregator} -Dsqnode=${env.NODE_NAME}"
}
}
timeout(time: 5, unit: 'HOURS') {
// test QuantiPhi in general.
// I've split this up to avoid out-of-memory problems.
// I'm not sure that I have an out of memory problem.
// These could execute in separate machines?
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rl78-base-test\\pom.xml test -DSqInHw=no -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rl78-ui-test\\pom.xml test -DSqInHw=no -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// Rewrite the JUnit test results to be prefixed with the JUnit catagory.
bat "mvn -B -V -U --file java\\qp-rewrite-inhw-testresults\\pom.xml install -DmatlabVersion=JUnit.${env.NODE_NAME}"
}
} // end of withEnv step
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit 'java/QuantiPhiSuite/**/surefire-reports/*.xml'
} // end of ws
} // end of node
}, // end of parallel case
junit_SH72AY: {
node ('QPRE-JUNIT') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 30, unit: 'MINUTES') {
// This will also create the productBuild.properties file.
bat qp_version_set
// Build QuantiPhi in general. This is a work-around for the fact that I haven't deployed all the
// jar files that are part of QuantiPhi. The unit tests below have dependencies on individual jar files.
bat "${qp_full_aggregator} -Dsqnode=${env.NODE_NAME}"
}
}
timeout(time: 5, unit: 'HOURS') {
// test QuantiPhi in general.
// I've split this up to avoid out-of-memory problems.
// I'm not sure that I have an out of memory problem.
// These could execute in separate machines?
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-sh72ay-base-test\\pom.xml test -DSqInHw=no -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-sh72ay-ui-test\\pom.xml test -DSqInHw=no -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// Rewrite the JUnit test results to be prefixed with the JUnit catagory.
bat "mvn -B -V -U --file java\\qp-rewrite-inhw-testresults\\pom.xml install -DmatlabVersion=JUnit.${env.NODE_NAME}"
}
} // end of withEnv step
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit 'java/QuantiPhiSuite/**/surefire-reports/*.xml'
} // end of ws
} // end of node
}, // end of parallel case
failFast: false) // end of parallel
} // end of steps
} // end of stage
stage('building') {
steps {
parallel (
build: {
node ('QPRE-BUILD') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 30, unit: 'MINUTES') {
// This will also create the productBuild.properties file.
bat qp_version_set
// Rename the build after the QuantiPhi product version. Also includes the build machine as a debugging aid.
script {
def props = readProperties file: 'productBuild.properties'
def productFullVersion = props['productFullVersion']
currentBuild.displayName = "#${env.BUILD_ID} ${env.NODE_NAME} ${productFullVersion}"
}
// Build QuantiPhi in general.
// http://maven.apache.org/plugins-archives/maven-surefire-plugin-2.12.4/examples/skipping-test.html
// -DskipTests skips executing tests while still compiling tests.
bat "${qp_full_aggregator} -Dsqnode=${env.NODE_NAME}"
}
// scan/report java warnings
warnings canComputeNew: false, canResolveRelativePaths: false,
consoleParsers: [[parserName: 'Java Compiler (javac)']],
defaultEncoding: '', excludePattern: '', healthy: '',
includePattern: '', messagesPattern: '', unHealthy: ''
}
// Can need more than 30 minutes when uploading across slow internet pipes.
// Note we'll also get "Connection reset by peer: socket write error" so I've added retries.
retry (3) {
timeout(time: 90, unit: 'MINUTES') {
// This can't execute in parallel with JUnit testing because
// the worker for building doesn't need target system compilers
// whereas the JUnit testing does.
bat "mvn -B -DskipTests -V -U --file java\\QuantiPhiSuite\\parent\\pom.xml deploy -Dsqnode=${env.NODE_NAME}"
bat "mvn -B -DskipTests -V -U --file java\\QuantiPhiSuite\\sq-test-case\\pom.xml deploy -Dsqnode=${env.NODE_NAME}"
// bundle it all up and deploy so that qp-fetch-for-munit can be used below.
bat "mvn -B -DskipTests -V -U --file java\\qp-standalone-zip\\pom.xml deploy -Dsqnode=${env.NODE_NAME}"
}
}
} // end withenv
// This will not wait for the target build to complete.
build job: 'QP-model-in-hardware', wait: false
} // end of ws
} // end of node
}, // end of parallel case
failFast: false) // end of parallel
} // end of steps
} // end of stage
stage('testing') {
steps {
parallel (
inhw_RH850_EVB: {
node ('INHW-RH850-EVB') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${sqJdk8u131_64}\\bin", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 30, unit: 'MINUTES') {
// This will also create the productBuild.properties file.
bat qp_version_set
// Build QuantiPhi in general before doing the in-hardware testing.
// http://maven.apache.org/plugins-archives/maven-surefire-plugin-2.12.4/examples/skipping-test.html
// -DskipTests skips executing tests while still compiling tests.
// The lifecycle is: ... package, verify, install. We don't need the install?
// We need the install for local dependencies (on this machine) because this is the first build on this machine.
// Apache Maven related side notes:
// -B : recommended in CI to inform maven to not run in interactive mode (less logs)
// -V : strongly recommended in CI, will display the JDK and Maven versions in use.
// Very useful to be quickly sure the selected versions were the ones you think.
// -U : force maven to update snapshots each time (default : once an hour, makes no sense in CI).
// -Dsurefire.useFile=false : useful in CI. Displays test errors in the logs directly (instead of
// having to crawl the workspace files to see the cause).
bat "${qp_full_aggregator} -Dsqnode=${env.NODE_NAME}"
}
}
// I don't want a retry here because it takes so long and the tests internally do retries.
timeout(time: 1, unit: 'HOURS') {
// TODO: make qp-fetch-for-model-inhw and differentiate between SNAPSHOT and release
bat qp_fetch_for_munit
bat "${qp_munit} R2013b-64 -DGENERATE=inhw -Dsqnode=${env.NODE_NAME}"
// maven has groups based on annotations for doing particular subsets of tests
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rh850-base-test\\pom.xml test -DSqInHw=yes -Dgroups=qp.InHwRH850 -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// This is the group that tests Simulink models in the EVB hardware.
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rh850-base-test\\pom.xml test -DSqInHw=yes -Dgroups=qp.ModelInHwRH850Evb -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// Rewrite the JUnit test results to be prefixed with the Matlab version used for testing.
bat "mvn -B -V -U --file java\\qp-rewrite-inhw-testresults\\pom.xml install -DmatlabVersion=RH850Evb_R2013b.${env.NODE_NAME}"
// The documentation has to run after the testing.
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rh850-base-test\\pom.xml test -Dgroups=qp.DocumentGeneration -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// zip reports and put into Artifactory
bat "mvn -B -V -U --file java\\qp-docs\\pom.xml deploy -Dmicro=RH850 -Dsqnode=${env.NODE_NAME}"
}
} // end withenv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
inhw_RH850_EmbarkE1: {
node ('INHW-RH850-EMBARK-E1') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${sqJdk8u131_64}\\bin", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 30, unit: 'MINUTES') {
// This will also create the productBuild.properties file.
bat qp_version_set
// Build QuantiPhi in general before doing the in-hardware testing.
bat "${qp_full_aggregator} -Dsqnode=${env.NODE_NAME}"
}
}
// I don't want a retry here because it takes so long and the tests internally do retries.
timeout(time: 1, unit: 'HOURS') {
// get zips so we can build demo models
bat qp_fetch_for_munit
// build demo models that can be built on this matlab
bat "${qp_munit} R2013b-64 -DGENERATE=inhw -Dsqnode=${env.NODE_NAME}"
// maven has groups based on annotations for doing particular subsets of tests
// This is the group that tests Simulink models in the Embark-E1 hardware.
bat "mvn -B -V -U --file java\\QuantiPhiSuite\\qp-rh850-base-test\\pom.xml test -DSqInHw=yes -Dgroups=qp.ModelInHwRH850EmbarkE1 -Dsqnode=${env.NODE_NAME} & cmd /c exit 0"
// Rewrite the JUnit test results to be prefixed with the Matlab version used for testing.
bat "mvn -B -V -U --file java\\qp-rewrite-inhw-testresults\\pom.xml install -DmatlabVersion=RH850Embark_R2013b.${env.NODE_NAME}"
// Can we add some document generation here?
}
} // end withenv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
// removed R2009 because RuntimeException: Method code too large!
// R2009bSP1: {
// node ('QPRE-MATLAB') {
// ws ('quantiphire-ws') {
//
// // Report the build name and the build machine as a debugging aid.
// //echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
//
// script{
// if (env.BRANCH_NAME == null) {
// mybranch = "trunk";
// } else {
// mybranch = 'branches/' + env.BRANCH_NAME;
// }
// }
// checkout changelog: false, poll: false, scm:
// [$class: 'SubversionSCM',
// locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
// workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
//
//
// withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
// "PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// // If files are installed, it'll take a longer timeout.
// retry (30) {
// timeout(time: 2, unit: 'HOURS') {
// // Here we install some tools like JDK and target compilers.
// // Using whatever default maven is supplied by Jenkins2.
// bat qp_install_build_tools
// }
// }
// }
//
// withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
// "PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
// retry (3) {
// timeout(time: 5, unit: 'HOURS') {
// // This will also create the productBuild.properties file.
// bat qp_version_set
// bat qp_fetch_for_munit
// bat "${qp_munit} R2009bSP1-64 -DGENERATE=test -Dsqnode=${env.NODE_NAME}"
// }
// }
//
// } // end withEnv
//
//
// // declarative pipeline doesn't allow nesting POST and ALWAYS here.
// junit '**/TEST*.xml'
//
//
// } // end of ws
// } // end of node
// }, // end of parallel case
R2010b: {
node ('QPRE-MATLAB') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 5, unit: 'HOURS') {
// This will also create the productBuild.properties file.
bat qp_version_set
bat qp_fetch_for_munit
bat "${qp_munit} R2010b-64 -DGENERATE=test -Dsqnode=${env.NODE_NAME}"
}
}
} // end withEnv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
R2011b: {
node ('QPRE-MATLAB') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 5, unit: 'HOURS') {
// This will also create the productBuild.properties file.
bat qp_version_set
bat qp_fetch_for_munit
bat "${qp_munit} R2011b-64 -DGENERATE=test -Dsqnode=${env.NODE_NAME}"
}
}
} // end withEnv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
R2012b: {
node ('QPRE-MATLAB') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 5, unit: 'HOURS') {
// This will also create the productBuild.properties file.
bat qp_version_set
bat qp_fetch_for_munit
bat "${qp_munit} R2012b-64 -DGENERATE=test -Dsqnode=${env.NODE_NAME}"
}
}
} // end withEnv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
R2013b: {
node ('QPRE-MATLAB') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 5, unit: 'HOURS') {
// This will also create the productBuild.properties file.
bat qp_version_set
bat qp_fetch_for_munit
bat "${qp_munit} R2013b-64 -DGENERATE=test -Dsqnode=${env.NODE_NAME}"
}
}
} // end withEnv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
R2014b: {
node ('QPRE-MATLAB') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 5, unit: 'HOURS') {
// This will also create the productBuild.properties file.
bat qp_version_set
bat qp_fetch_for_munit
bat "${qp_munit} R2014b-64 -DGENERATE=test -Dsqnode=${env.NODE_NAME}"
}
}
} // end withEnv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
R2015b: {
node ('QPRE-MATLAB') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 5, unit: 'HOURS') {
// This will also create the productBuild.properties file.
bat qp_version_set
bat qp_fetch_for_munit
bat "${qp_munit} R2015b-64 -DGENERATE=test -Dsqnode=${env.NODE_NAME}"
}
}
} // end withEnv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
R2016b: {
node ('QPRE-MATLAB') {
ws ('quantiphire-ws') {
// Report the build name and the build machine as a debugging aid.
//echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
script{
if (env.BRANCH_NAME == null) {
mybranch = "trunk";
} else {
mybranch = 'branches/' + env.BRANCH_NAME;
}
}
checkout changelog: false, poll: false, scm:
[$class: 'SubversionSCM',
locations: [[credentialsId: '90859659-0bde-4a8c-94b7-fdf17b4fd091', depthOption: 'infinity', local: '.', remote: "svn+ssh://svn.simuquest.com/svn/sq/QuantiPhiRE/${mybranch}"]],
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
withEnv(["JAVA_HOME=${ tool jenkins2JdkVersion }", "PATH+MAVEN=${tool jenkins2MvnVersion}\\bin",
"PATH+JAVA=${ tool jenkins2JdkVersion}"]) {
// If files are installed, it'll take a longer timeout.
retry (30) {
timeout(time: 2, unit: 'HOURS') {
// Here we install some tools like JDK and target compilers.
// Using whatever default maven is supplied by Jenkins2.
bat qp_install_build_tools
}
}
}
withEnv(["JAVA_HOME=${sqJdk8u131_64}", "PATH+MAVEN=${sqApacheMaven}\\bin",
"PATH+JAVA=${ tool 'jdk8u131-64'}", "PATH+ANT=${sqApacheAnt}\\bin"]) {
retry (3) {
timeout(time: 5, unit: 'HOURS') {
// This will also create the productBuild.properties file.
bat qp_version_set
bat qp_fetch_for_munit
bat "${qp_munit} R2016b-64 -DGENERATE=test -Dsqnode=${env.NODE_NAME}"
}
}
} // end withEnv
// declarative pipeline doesn't allow nesting POST and ALWAYS here.
junit '**/TEST*.xml'
} // end of ws
} // end of node
}, // end of parallel case
failFast: false) // end of parallel
} // end of steps
} // end of stage
} // end of stages
} // end pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment