Created
May 20, 2015 15:00
-
-
Save MachinesAreUs/ec4e0deda23817452c1a to your computer and use it in GitHub Desktop.
Example of how to pass parameters from one job to the next via a file and groovy magic
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
build_number = build.buildVariableResolver.resolve('PARENT_BUILD_NUMBER') | |
compile_job = build.buildVariableResolver.resolve('COMPILE_JOB_NAME') | |
println("Build number: ${build_number}") | |
println("Compile job: ${compile_job}") | |
PackagePath = "C:\\Jenkins\\jobs\\" | |
RutaLog = "$PackagePath\\$compile_job\\builds\\$build_number\\log" | |
println("Ruta log: ${RutaLog}") | |
id = "System version is " | |
file = new File(RutaLog) | |
file.eachLine { line -> | |
if (line.contains(id)) { | |
println(line) | |
texto = line | |
texto = texto.replace("System version is : ","") | |
texto = texto.replace(" ","") | |
} | |
} | |
props = new File("version.properties") | |
props.write("TEST_ENV="+texto+"\n") | |
println "Groovy script done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment