Skip to content

Commit

Permalink
ci: block Jenkins replay (commaai#34196)
Browse files Browse the repository at this point in the history
* test

* not replay

* up

* text

* text

* fix

* no

* commit

* clean
  • Loading branch information
maxime-desroches authored Dec 10, 2024
1 parent 334e06c commit 41b5065
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -123,6 +127,11 @@ def hasPathChanged(String gitDiff, List<String> 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'),
Expand Down

0 comments on commit 41b5065

Please sign in to comment.