diff --git a/ci/Jenkinsfile.tests b/ci/Jenkinsfile.tests index 1e528f5c..29e9b35e 100644 --- a/ci/Jenkinsfile.tests +++ b/ci/Jenkinsfile.tests @@ -18,6 +18,16 @@ pipeline { )) } + /* WARNING: Defining parameters here with the ?: trick causes them to remember last value. */ + parameters { + booleanParam( + name: 'RACE', + description: 'Run tests with check for race condition.', + defaultValue: getRaceDefault() + ) + } + + environment { TARGET = 'tests' REPO = "${env.WORKSPACE}/src/github.com/waku-org/go-waku" @@ -40,7 +50,7 @@ pipeline { stage('Test') { steps { script { dir(env.REPO) { - if (env.JOB_BASE_NAME == "race") { + if (params.RACE) { nix.develop('make test-with-race', pure: false) }else { nix.develop('make test-ci', pure: false) @@ -64,7 +74,7 @@ pipeline { GANACHE_NETWORK_RPC_URL = "ws://localhost:${env.GANACHE_RPC_PORT}" } steps { script { dir(env.REPO) { - if (env.JOB_BASE_NAME == "race") { + if (params.RACE) { nix.develop('make test-onchain-with-race', pure: false) }else { nix.develop('make test-onchain', pure: false) @@ -86,3 +96,7 @@ pipeline { } } } } + +def Boolean getRaceDefault() { + return env.JOB_NAME.split('/').contains('race') +}