1
0

Возврат значения из шага cmd

This commit is contained in:
Nikita Gryzlov
2020-04-29 17:04:49 +03:00
parent 515a91dcc1
commit 540b90fceb
4 changed files with 29 additions and 5 deletions

View File

@@ -35,4 +35,28 @@ class cmdTest {
rule.assertLogContains('helloWorld', rule.buildAndAssertSuccess(workflowJob))
}
@Test
void "cmd should return status"() {
def pipeline = '''
pipeline {
agent any
stages {
stage('test') {
steps {
script {
def status = cmd("false", true)
echo "status = $status"
}
}
}
}
}
'''.stripIndent()
final CpsFlowDefinition flow = new CpsFlowDefinition(pipeline, true)
final WorkflowJob workflowJob = rule.createProject(WorkflowJob, 'project')
workflowJob.definition = flow
rule.assertLogContains('status = 1', rule.buildAndAssertSuccess(workflowJob))
}
}