build: Consolidate touched file checks

This will make it easier to add more in the future.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2022-12-15 16:44:20 +00:00
parent 2f855c9a67
commit 0031dacd7b

39
Jenkinsfile vendored
View File

@ -10,29 +10,16 @@ pipeline {
checkout scm
}
}
stage('Check for documentation only changes') {
stage('Check if worker build can be skipped') {
when {
expression {
return docsFileOnly()
return skipWorkerBuild()
}
}
steps {
script {
runWorkers = false
echo 'Documentation only changes, no need to run the CI'
}
}
}
stage('Check for fuzzer files only changes') {
when {
expression {
return fuzzFileOnly()
}
}
steps {
script {
runWorkers = false
echo 'Fuzzer cargo files only changes, no need to run the CI'
echo 'No changes requring a build'
}
}
}
@ -432,24 +419,24 @@ def installAzureCli(distro, arch) {
sh 'sudo apt install -y azure-cli'
}
def boolean docsFileOnly() {
def boolean skipWorkerBuild() {
if (env.CHANGE_TARGET == null) {
return false
}
return sh(
if (sh(
returnStatus: true,
script: "git diff --name-only origin/${env.CHANGE_TARGET}... | grep -v '\\.md'"
) != 0
}
def boolean fuzzFileOnly() {
if (env.CHANGE_TARGET == null) {
return false
) != 0) {
return true
}
return sh(
if (sh(
returnStatus: true,
script: "git diff --name-only origin/${env.CHANGE_TARGET}... | grep -v -E 'fuzz/'"
) != 0
) != 0) {
return true
}
return false
}