Hi, I have an xml file in my project repo which after checkout, I will like to auto increment the last value of the version number for every build. I am already accessing the version number using xmlslurper and storing this in a variable. I have something like this in my pipeline script and my xml file is just a single line script with <Version>1.0.0.0 </Version> and I will like auto increment the last digit for every build. NB: I do not want to use jenkins's build number. That would have been easy by just changing the last digit to $BUILD_NUMBER in my project repo.
any help please? @NonCPS String getVersion(String path) { def version = new xmlSlurper().parse(new File(path)) return version.toString() } node { stage ('checkout') { ......... } stage ('build) { def pwd2=pwd() def v=getVersion("${pwd2}/VersionNumber.xml") sh ' dotnet publish path/to/project -p:Fileversion=$v ' } } -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a9d3b4a3-b565-471b-9366-c364faed7a50%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.