I have a large amount of pipeline script. The second half of them usually consists of the same code The redundand code looks a bit like this
stage 'Windows 7'
sh 'foo'
sh 'bar'
Stage 'Windows 8.1'
sh 'foo'
sh 'somethingelse'
I would like to export this code fragment into a file and then reuse it when I need it. What can I do to achieve this? Where Do I have to store the script to make it accessible?
Cheers