Skip to content

Commit

Permalink
Merge branch 'master' into jenkins_mr
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime-desroches committed Oct 7, 2024
2 parents c194a9e + 2040f04 commit ca2d512
Show file tree
Hide file tree
Showing 37 changed files with 439 additions and 1,028 deletions.
32 changes: 31 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,44 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps)
device(device_ip, "git checkout", extra + "\n" + readFile("selfdrive/test/setup_device_ci.sh"))
}
steps.each { item ->
device(device_ip, item[0], item[1])
if (branch != "master" && item.size() == 3 && !hasPathChanged(item[2])) {
println "Skipping ${item[0]}: no changes in ${item[2]}."
return;
} else {
device(device_ip, item[0], item[1])
}
}
}
}
}
}
}

@NonCPS
def hasPathChanged(List<String> paths) {
changedFiles = []
for (changeLogSet in currentBuild.changeSets) {
for (entry in changeLogSet.getItems()) {
for (file in entry.getAffectedFiles()) {
changedFiles.add(file.getPath())
}
}
}

env.CHANGED_FILES = changedFiles.join(" ")
if (currentBuild.number > 1) {
env.CHANGED_FILES += currentBuild.previousBuild.getBuildVariables().get("CHANGED_FILES")
}

for (path in paths) {
if (env.CHANGED_FILES.contains(path)) {
return true;
}
}

return false;
}

def setupCredentials() {
withCredentials([
string(credentialsId: 'azure_token', variable: 'AZURE_TOKEN'),
Expand Down
Loading

0 comments on commit ca2d512

Please sign in to comment.