@@ -10,7 +10,6 @@ def call(body) {
1010 body()
1111
1212 def yaml
13- def openShiftProject = config. openShiftProject
1413 def openShiftTemplate = config. openShiftTemplate
1514 def originalImageName = config. originalImageName
1615 def newImageName = config. newImageName
@@ -20,22 +19,25 @@ def call(body) {
2019
2120 def flow = new io.fabric8.Fabric8Commands ()
2221 def utils = new io.fabric8.Utils ()
22+ def openShiftProject = config. openShiftProject + ' -' + utils. getRepoName()
2323
24- openShiftProject = openShiftProject + ' -' + utils. getRepoName()
2524 container(' clients' ) {
2625 if (! flow. isAuthorCollaborator(" " , project)){
2726 currentBuild. result = ' ABORTED'
2827 error ' Change author is not a collaborator on the project, aborting build until we support the [test] comment'
2928 }
3029
3130 yaml = flow. getUrlAsString(openShiftTemplate)
32- yaml = Pattern . compile(" - image: ${ originalImageName} :(.*)" ). matcher(yaml). replaceFirst(" - image: ${ newImageName} " )
31+ def originalImage = " - image: ${ originalImageName} :(.*)"
32+ def newImage = " - image: ${ newImageName} "
33+ yaml = Pattern . compile(originalImage). matcher(yaml). replaceFirst(newImage)
3334
34- if (! yaml. contains(newImageName )){
35- error " original image ${ originalImageName} not replaced with ${ newImageName } in yaml: \n ${ yaml} "
35+ if (! yaml. contains(newImage )){
36+ error " original image ${ originalImageName} not replaced with ${ newImage } in yaml: \n ${ yaml} "
3637 }
3738 }
38- // cant use writeFile as we have long filename errors
39+ // cant use writeFile as we are facing following error
40+ // Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods
3941 sh " echo '${ yaml} ' > snapshot.yml"
4042
4143 container(' clients' ) {
0 commit comments