Я пытаюсь на одном из этапов записать некоторые данные в файл, а на следующем этапе прочитать эти данные, используя их, и назначить их переменной. Это мой декларативный конвейер Jenkins:
pipeline {
agent {label 'build-slave-aws'}
stages {
stage('Notify about start') {
steps {
sh 'echo "Some fatct with brackets ()" > /tmp/facts.issues'
}
}
stage('Gather the facts') {
steps {
script {
factsIssues = sh( script: "cat /tmp/facts.issues", returnStdout: true )
}
sh "echo these are facts: ${factsIssues}"
}
}
}
}
Вывод этого прогона следующий:
Started by user 123
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on i-000df827977fd5175 in /workspace/workspace/test
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Notify about start)
[Pipeline] sh
+ echo 'Some fatct with brackets ()'
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Gather the facts)
[Pipeline] script
[Pipeline] {
[Pipeline] sh
+ cat /tmp/facts.issues
[Pipeline] }
[Pipeline] // script
[Pipeline] sh
/workspace/workspace/test@tmp/durable-2a1f8cdf/script.sh: line 1: syntax error near unexpected token `('
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 2
Finished: FAILURE
Любой другой текст, который не содержит (
, просто отлично работает. Есть ли у вас какие-либо предложения о том, как я могу записать некоторые данные в файл с (
и прочитать их обратно в переменную?