nimbus-eth2/Jenkinsfile

114 lines
3.6 KiB
Plaintext
Raw Normal View History

// https://stackoverflow.com/questions/40760716/jenkins-abort-running-build-if-new-one-is-started
// 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") {
def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) {
milestone(buildNumber - 1)
}
milestone(buildNumber)
}
2019-11-11 21:43:40 +00:00
def runStages() {
try {
stage("Clone") {
/* source code checkout */
checkout scm
/* we need to update the submodules before caching kicks in */
sh "git submodule update --init --recursive"
}
2019-12-03 17:57:05 +00:00
cache(maxCacheSize: 250, caches: [
[$class: "ArbitraryFileCache", excludes: "", includes: "**/*", path: "${WORKSPACE}/vendor/nimbus-build-system/vendor/Nim/bin"],
[$class: "ArbitraryFileCache", excludes: "", includes: "**/*", path: "${WORKSPACE}/jsonTestsCache"]
]) {
stage("Build") {
sh """#!/bin/bash
set -e
2021-02-11 19:03:29 +00:00
# to allow the following parallel stages
make -j${env.NPROC} QUICK_AND_DIRTY_COMPILER=1 deps
./scripts/setup_scenarios.sh jsonTestsCache
"""
2019-11-11 21:43:40 +00:00
}
2019-12-03 17:57:05 +00:00
}
stage("Tools") {
sh """#!/bin/bash
set -e
make -j${env.NPROC}
Logging and startup improvements (#3038) * Logging and startup improvements Color support for released binaries! * startup scripts no longer log to file by default - this only affects source builds - released binaries don't support file logging * add --log-stdout option to control logging to stdout (colors, json) * detect tty:s vs redirected logs and log accordingly * add option to disable log colors at runtime * simplify several "common" logs, showing the most important information earlier and more clearly * remove line numbers / file information / tid - these take up space and are of little use to end users * still enabled in debug builds and tools * remove `testnet_servers_image` compile-time option * server images, released binaries and compile-from-source now offer the same behaviour and features * fixes https://github.com/status-im/nimbus-eth2/issues/2326 * fixes https://github.com/status-im/nimbus-eth2/issues/1794 * remove instanteneous block speed from sync message, keeping only average before: ``` INF 2021-10-28 16:45:59.000+02:00 Slot start topics="beacnde" tid=386429 file=nimbus_beacon_node.nim:884 lastSlot=2384027 wallSlot=2384028 delay=461us84ns peers=0 head=75a10ee5:3348 headEpoch=104 finalized=cd6804ba:3264 finalizedEpoch=102 sync="wwwwwwwwww:0:0.0000:0.0000:00h00m (3348)" INF 2021-10-28 16:45:59.046+02:00 Slot end topics="beacnde" tid=386429 file=nimbus_beacon_node.nim:821 slot=2384028 nextSlot=2384029 head=75a10ee5:3348 headEpoch=104 finalizedHead=cd6804ba:3264 finalizedEpoch=102 nextAttestationSlot=-1 nextProposalSlot=-1 nextActionWait=n/a ``` after: ``` INF 2021-10-28 22:43:23.033+02:00 Slot start topics="beacnde" slot=2385815 epoch=74556 sync="DDPDDPUDDD:10:5.2258:01h19m (2361088)" peers=37 head=eacd2dae:2361096 finalized=73782:a4751487 delay=33ms687us715ns INF 2021-10-28 22:43:23.291+02:00 Slot end topics="beacnde" slot=2385815 nextActionWait=n/a nextAttestationSlot=-1 nextProposalSlot=-1 head=eacd2dae:2361096 ``` * fix comment * documentation updates * mention `--log-file` may be deprecated in the future * update various docs
2021-11-02 17:06:36 +00:00
make -j${env.NPROC} LOG_LEVEL=TRACE
"""
}
stage("Test suite") {
sh "make -j${env.NPROC} DISABLE_TEST_FIXTURES_SCRIPT=1 test"
}
stage("REST test suite") {
sh """#!/bin/bash
set -e
./tests/simulation/restapi.sh --data-dir resttest0_data --base-port \$(( 9100 + EXECUTOR_NUMBER * 100 )) \
--base-rest-port \$(( 7100 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \
\$(( 8108 + EXECUTOR_NUMBER * 100 )) --sleep-timeout 30 --kill-old-processes
"""
}
stage("Testnet finalization") {
// EXECUTOR_NUMBER will be 0 or 1, since we have 2 executors per Jenkins node
sh """#!/bin/bash
set -e
./scripts/launch_local_testnet.sh --preset minimal --nodes 4 --stop-at-epoch 5 --disable-htop --enable-logtrace \
--data-dir local_testnet0_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-rpc-port \
\$(( 7000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) --timeout 600 \
--kill-old-processes \
-- --verify-finalization --discv5:no
./scripts/launch_local_testnet.sh --nodes 4 --stop-at-epoch 5 --disable-htop --enable-logtrace \
--data-dir local_testnet1_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-rpc-port \
\$(( 7000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) --timeout 2400 \
--kill-old-processes \
-- --verify-finalization --discv5:no
"""
}
} catch(e) {
2019-12-03 17:57:05 +00:00
// we need to rethrow the exception here
throw e
} finally {
// archive testnet logs
sh """#!/bin/bash
for D in local_testnet0_data local_testnet1_data resttest0_data; do
[[ -d "\$D" ]] && tar cjf "\${D}-\${NODE_NAME}.tar.bz2" "\${D}"/*.txt || true
done
"""
try {
archiveArtifacts("*.tar.bz2")
} 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-11-11 21:16:17 +00:00
}
}
2019-11-11 21:43:40 +00:00
parallel(
"Linux": {
throttle(['nimbus-eth2']) {
node("linux") {
withEnv(["NPROC=${sh(returnStdout: true, script: 'nproc').trim()}"]) {
runStages()
}
2019-11-11 21:43:40 +00:00
}
}
},
"macOS": {
throttle(['nimbus-eth2']) {
node("macos && x86_64") {
withEnv(["NPROC=${sh(returnStdout: true, script: 'sysctl -n hw.logicalcpu').trim()}"]) {
runStages()
}
2019-11-11 21:43:40 +00:00
}
}
},
2019-11-11 21:43:40 +00:00
)