Value on Custom properties not incremented in the remote repository on the master branch
Hello,
I use this groovy script to increment variable "increment" that i declared on Custom properties :
// read the property as a string
def uniqueUserPortion = testRunner.testCase.testSuite.project.getPropertyValue("increment")
// convert it to an Integer, and increment
def uniqueUserPortionInc = uniqueUserPortion.toInteger() + 1
// set the property back as string
testRunner.testCase.testSuite.project.setPropertyValue("increment", uniqueUserPortionInc.toString())
// check
return testRunner.testCase.testSuite.project.getPropertyValue("increment");
When I launch the script in my local branch, the variable 'increment' is successfully incremented, but when the Jenkins started to run the job automatically on the master branch, the value of the variable 'increment' doesn't change.
So I supposed that the script could not be executed automatically on the master branch. the project on my local branch is the same that I have on the master branch
Have you any ideas about that issue?
Thank you in advance for your response
Finally, I found the solution to this issue 🙂. the problem is that we can't modify the File in the remote Git Repository via an automated script launched by Jenkins.
So I created a file in the System File of the Machine where Jenkins is running in order to update the value of the variable ' increment'. and then I wrote the groovy programme that reads, increments by 1 the value and save it back to the file.
thanks for your collaboration.