From 41b5065499a1e3ca48948008302c67e1665c8c1c Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Tue, 10 Dec 2024 11:04:32 -0800 Subject: [PATCH] ci: block Jenkins replay (#34196) * test * not replay * up * text * text * fix * no * commit * clean --- Jenkinsfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 7867985fc1..656f1055eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -79,6 +79,10 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps) return } + if (isReplay()) { + error("REPLAYING TESTS IS NOT ALLOWED. FIX THEM INSTEAD.") + } + def extra = extra_env.collect { "export ${it}" }.join('\n'); def branch = env.BRANCH_NAME ?: 'master'; def gitDiff = sh returnStdout: true, script: 'curl -s -H "Authorization: Bearer ${GITHUB_COMMENTS_TOKEN}" https://api.github.com/repos/commaai/openpilot/compare/master...${GIT_BRANCH} | jq .files[].filename || echo "/"', label: 'Getting changes' @@ -123,6 +127,11 @@ def hasPathChanged(String gitDiff, List paths) { return false } +def isReplay() { + def replayClass = "org.jenkinsci.plugins.workflow.cps.replay.ReplayCause" + return currentBuild.rawBuild.getCauses().any{ cause -> cause.toString().contains(replayClass) } +} + def setupCredentials() { withCredentials([ string(credentialsId: 'azure_token', variable: 'AZURE_TOKEN'),