@@ -10,7 +10,7 @@ def call(body) {
1010 body()
1111
1212 def yaml
13- def openShiftProject = config. openShiftProject
13+ def openShiftProject = config. openShiftProject + ' - ' + utils . getRepoName()
1414 def openShiftTemplate = config. openShiftTemplate
1515 def originalImageName = config. originalImageName
1616 def newImageName = config. newImageName
@@ -21,22 +21,25 @@ def call(body) {
2121 def flow = new io.fabric8.Fabric8Commands ()
2222 def utils = new io.fabric8.Utils ()
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 }
3839 // cant use writeFile as we have long filename errors
39- sh " echo '${ yaml} ' > snapshot.yml"
40+ def snapshotFile = new File (' snapshot.yml' )
41+ snapshotFile. write(yaml)
42+ // sh "echo '${yaml}' > snapshot.yml"
4043
4144 container(' clients' ) {
4245 try {
0 commit comments