-
-
Save yasinai/1d8a72e011a51d73fa0e3192dca4b1f4 to your computer and use it in GitHub Desktop.
Jenkinsfile: build only changed files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
@NonCPS | |
def getACIChangeSets() { | |
def aci = [] | |
currentBuild.rawBuild.getChangeSets().each { cs -> | |
cs.getItems().each { item -> | |
item.getAffectedFiles().each { f -> | |
if (f.path.endsWith(".yml")) { | |
aci << f.path | |
} | |
} | |
} | |
} | |
return aci | |
} | |
def acis = [:] | |
def aci = { f -> | |
def file_name = f | |
acis[f] = { | |
node ('my-builder'){ | |
checkout scm | |
sh "aci_build ${file_name}" | |
} | |
} | |
} | |
def c = getACIChangeSets() | |
for (i = 0; i < c.size(); i++) { | |
aci c.get(i) | |
} | |
stage name: "Build ACI", concurrency: 8 | |
parallel acis |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment