2020-08-07 21:51:37 +00:00
|
|
|
// https://stackoverflow.com/questions/40760716/jenkins-abort-running-build-if-new-one-is-started
|
2021-01-11 18:51:38 +00:00
|
|
|
// We should only abort older jobs in PR branches, so we have a nice CI history in "stable",
|
|
|
|
// "testing", and "unstable".
|
|
|
|
if (env.BRANCH_NAME != "stable" && env.BRANCH_NAME != "testing" && env.BRANCH_NAME != "unstable") {
|
2020-09-25 10:26:59 +00:00
|
|
|
def buildNumber = env.BUILD_NUMBER as int
|
|
|
|
if (buildNumber > 1) {
|
|
|
|
milestone(buildNumber - 1)
|
|
|
|
}
|
|
|
|
milestone(buildNumber)
|
2020-08-07 21:51:37 +00:00
|
|
|
}
|
|
|
|
|
2022-02-04 13:43:40 +00:00
|
|
|
def runStages(nodeDir) {
|
|
|
|
sh "mkdir -p ${nodeDir}"
|
|
|
|
dir(nodeDir) {
|
|
|
|
try {
|
2022-06-27 23:44:26 +00:00
|
|
|
stage("Clone") { timeout(15) {
|
2022-02-04 13:43:40 +00:00
|
|
|
/* source code checkout */
|
|
|
|
checkout scm
|
|
|
|
/* we need to update the submodules before caching kicks in */
|
|
|
|
sh "git submodule update --init --recursive"
|
2022-06-14 20:39:54 +00:00
|
|
|
} }
|
2022-02-04 13:43:40 +00:00
|
|
|
|
2022-06-14 20:39:54 +00:00
|
|
|
stage("Preparations") { timeout(10) {
|
2022-04-14 15:56:05 +00:00
|
|
|
sh """#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# macOS shows scary warnings if there are old libraries and object files laying around
|
|
|
|
make clean
|
|
|
|
# to allow the following parallel stages
|
|
|
|
make -j${env.NPROC} QUICK_AND_DIRTY_COMPILER=1 update
|
|
|
|
./scripts/setup_scenarios.sh
|
|
|
|
"""
|
2022-06-14 20:39:54 +00:00
|
|
|
} }
|
2019-12-03 14:02:38 +00:00
|
|
|
|
2022-06-14 20:39:54 +00:00
|
|
|
stage("Tools") { timeout(30) {
|
2020-05-20 22:02:05 +00:00
|
|
|
sh """#!/bin/bash
|
|
|
|
set -e
|
2022-02-04 13:43:40 +00:00
|
|
|
make -j${env.NPROC} LOG_LEVEL=TRACE
|
2020-05-20 22:02:05 +00:00
|
|
|
"""
|
2022-06-14 20:39:54 +00:00
|
|
|
} }
|
2019-12-03 14:02:38 +00:00
|
|
|
|
2022-06-14 20:39:54 +00:00
|
|
|
stage("Test suite") { timeout(60) {
|
2022-02-04 13:43:40 +00:00
|
|
|
sh "make -j${env.NPROC} DISABLE_TEST_FIXTURES_SCRIPT=1 test"
|
2022-06-14 20:39:54 +00:00
|
|
|
} }
|
2021-04-29 01:28:11 +00:00
|
|
|
|
2022-06-14 20:39:54 +00:00
|
|
|
stage("REST test suite") { timeout(5) {
|
2022-06-19 17:54:12 +00:00
|
|
|
sh "make restapi-test"
|
2022-06-14 20:39:54 +00:00
|
|
|
} }
|
2021-07-26 19:55:24 +00:00
|
|
|
|
2022-06-14 20:39:54 +00:00
|
|
|
stage("Testnet finalization") { timeout(75) {
|
2022-02-04 13:43:40 +00:00
|
|
|
// EXECUTOR_NUMBER will be 0 or 1, since we have 2 executors per Jenkins node
|
|
|
|
sh """#!/bin/bash
|
2022-07-15 00:19:19 +00:00
|
|
|
make local-testnet-minimal
|
|
|
|
make local-testnet-mainnet
|
2022-02-04 13:43:40 +00:00
|
|
|
"""
|
2022-06-14 20:39:54 +00:00
|
|
|
} }
|
2022-02-04 13:43:40 +00:00
|
|
|
} catch(e) {
|
|
|
|
// we need to rethrow the exception here
|
|
|
|
throw e
|
|
|
|
} finally {
|
|
|
|
// archive testnet logs
|
2021-04-29 01:28:11 +00:00
|
|
|
sh """#!/bin/bash
|
2022-02-04 13:43:40 +00:00
|
|
|
for D in local_testnet0_data local_testnet1_data resttest0_data; do
|
2022-06-14 14:41:20 +00:00
|
|
|
[[ -d "\$D" ]] && tar czf "\${D}-\${NODE_NAME}.tar.gz" "\${D}"/*.txt || true
|
2022-02-04 13:43:40 +00:00
|
|
|
done
|
2021-04-29 01:28:11 +00:00
|
|
|
"""
|
2022-02-04 13:43:40 +00:00
|
|
|
try {
|
2022-06-16 20:43:12 +00:00
|
|
|
archiveArtifacts("*.tar.gz")
|
2022-02-04 13:43:40 +00:00
|
|
|
} catch(e) {
|
|
|
|
println("Couldn't archive artefacts.")
|
|
|
|
println(e.toString());
|
|
|
|
// we don't need to re-raise it here; it might be a PR build being cancelled by a newer one
|
|
|
|
}
|
|
|
|
// clean the workspace
|
|
|
|
cleanWs(disableDeferredWipeout: true, deleteDirs: true)
|
2019-12-03 14:02:38 +00:00
|
|
|
}
|
2022-02-04 13:43:40 +00:00
|
|
|
} // dir(...)
|
2019-11-11 21:16:17 +00:00
|
|
|
}
|
|
|
|
|
2019-11-11 21:43:40 +00:00
|
|
|
parallel(
|
|
|
|
"Linux": {
|
2021-11-25 21:22:08 +00:00
|
|
|
throttle(['nimbus-eth2']) {
|
2022-06-14 20:39:54 +00:00
|
|
|
timeout(time: 24, unit: 'HOURS') { // includes time in build queue
|
2022-01-10 12:07:08 +00:00
|
|
|
node("linux") {
|
|
|
|
withEnv(["NPROC=${sh(returnStdout: true, script: 'nproc').trim()}"]) {
|
2022-02-04 13:43:40 +00:00
|
|
|
runStages("linux")
|
2022-01-10 12:07:08 +00:00
|
|
|
}
|
2021-11-25 21:22:08 +00:00
|
|
|
}
|
2019-11-11 21:43:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-02-04 13:43:40 +00:00
|
|
|
"macOS (AMD64)": {
|
2021-11-25 21:22:08 +00:00
|
|
|
throttle(['nimbus-eth2']) {
|
2022-06-14 20:39:54 +00:00
|
|
|
timeout(time: 24, unit: 'HOURS') { // includes time in build queue
|
2022-01-10 12:07:08 +00:00
|
|
|
node("macos && x86_64") {
|
|
|
|
withEnv(["NPROC=${sh(returnStdout: true, script: 'sysctl -n hw.logicalcpu').trim()}"]) {
|
2022-02-04 13:43:40 +00:00
|
|
|
runStages("macos_amd64")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"macOS (ARM64)": {
|
|
|
|
throttle(['nimbus-eth2']) {
|
2022-06-14 20:39:54 +00:00
|
|
|
timeout(time: 24, unit: 'HOURS') { // includes time in build queue
|
2022-02-04 13:43:40 +00:00
|
|
|
node("macos && arm64") {
|
|
|
|
withEnv(["NPROC=${sh(returnStdout: true, script: 'sysctl -n hw.logicalcpu').trim()}"]) {
|
|
|
|
runStages("macos_arm64")
|
2022-01-10 12:07:08 +00:00
|
|
|
}
|
2021-11-25 21:22:08 +00:00
|
|
|
}
|
2019-11-11 21:43:40 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-26 15:31:46 +00:00
|
|
|
},
|
2019-11-11 21:43:40 +00:00
|
|
|
)
|