Я пытаюсь установить свое текущее состояние сборки в Jenkins и вижу это странное поведение:
Jenkinsfile
node('master') {
checkout(scm)
lib = load("Jenkinsfiles/Jenkinsfile_functions.groovy")
docker_lib = load("Jenkinsfiles/lib/docker.groovy")
lib.cancel_existing_pull_request_builds()
stage('StartPipeline') {
lib.notifyStash('INPROGRESS')
lib.notifyBuild('STARTED')
}
...
И
lib.notifyStash ('INPROGRESS')
def notifyStash(String state, displayName=null) {
def states = ['SUCCESS', 'FAILED', 'INPROGRESS']
if(states.contains(state)) {
currentBuild.result = state
println("#1 Current State of Build is: " + currentBuild.result)
} else {
throw new AbortException("NotifyStash State: " + state + " needs to be in " + states)
}
originalName = currentBuild.displayName
currentBuild.displayName = originalName
println("#2 Current State of Build is: " + currentBuild.result)
}
Я вижу этот результат:
[Pipeline] { (Jenkinsfiles/lib/docker.groovy)
[Pipeline] }
[Pipeline] // load
[Pipeline] stage
[Pipeline] { (StartPipeline)
[Pipeline] echo
#1 Current State of Build is: FAILURE
[Pipeline] echo
#2 Current State of Build is: FAILURE
Почему состояние устанавливается на «Сбой»?Я специально настраиваю его на INPROGRESS.