mirror of
https://github.com/SAP/jenkins-library.git
synced 2026-06-19 22:58:55 +02:00
Merge pull request #3 from marcusholl/pr/handleSpaceWithSedCommand
handle space within sed command
This commit is contained in:
@@ -84,8 +84,7 @@ public class MTABuildTest extends BasePipelineTest {
|
||||
def script = loadScript(pipeline)
|
||||
def mtarFilePath = script.execute()
|
||||
|
||||
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
|
||||
assert shellCalls[0].endsWith('/mta.yaml')
|
||||
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
|
||||
|
||||
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
|
||||
|
||||
@@ -108,8 +107,7 @@ public class MTABuildTest extends BasePipelineTest {
|
||||
def script = loadScript(pipeline)
|
||||
def mtarFilePath = script.execute()
|
||||
|
||||
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
|
||||
assert shellCalls[0].endsWith('/mta.yaml')
|
||||
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
|
||||
|
||||
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
|
||||
|
||||
@@ -134,8 +132,7 @@ public class MTABuildTest extends BasePipelineTest {
|
||||
def script = loadScript(pipeline)
|
||||
def mtarFilePath = script.execute(newDirName)
|
||||
|
||||
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
|
||||
assert shellCalls[0].endsWith('/mta.yaml')
|
||||
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/newDir\/mta.yaml"$/
|
||||
|
||||
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
|
||||
|
||||
@@ -155,8 +152,7 @@ public class MTABuildTest extends BasePipelineTest {
|
||||
def script = loadScript(pipeline)
|
||||
def mtarFilePath = script.execute()
|
||||
|
||||
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
|
||||
assert shellCalls[0].endsWith('/mta.yaml')
|
||||
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
|
||||
|
||||
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
|
||||
|
||||
@@ -177,8 +173,7 @@ public class MTABuildTest extends BasePipelineTest {
|
||||
def script = loadScript(pipeline)
|
||||
def mtarFilePath = script.execute()
|
||||
|
||||
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
|
||||
assert shellCalls[0].endsWith('/mta.yaml')
|
||||
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
|
||||
|
||||
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ def call(Map parameters = [:]) {
|
||||
def mtaYaml = readYaml file: "${pwd()}/mta.yaml"
|
||||
|
||||
//[Q]: Why not yaml.dump()? [A]: This reformats the whole file.
|
||||
sh "sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ${pwd()}/mta.yaml"
|
||||
sh "sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" \"${pwd()}/mta.yaml\""
|
||||
|
||||
def id = mtaYaml.ID
|
||||
if (!id) {
|
||||
|
||||
Reference in New Issue
Block a user