Sortir de la boucle lorsqu’une tâche est en erreur
Cadoles/Jenkins/pipeline/head There was a failure building this commit
Details
Cadoles/Jenkins/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
1f6a71e0a9
commit
44764866a8
|
@ -22,16 +22,17 @@ def waitForTaskCompletion(
|
|||
) {
|
||||
def status = ''
|
||||
def created_resources = []
|
||||
while (status != 'completed') {
|
||||
while (status == 'running') {
|
||||
def response = httpRequest authentication: credentials, url: "https://${pulpHost}${taskHREF}", httpMode: 'GET', ignoreSslErrors: true
|
||||
def jsonResponse = readJSON text: response.content
|
||||
status = jsonResponse.state
|
||||
if (status == 'completed') {
|
||||
created_resources = jsonResponse.created_resources
|
||||
return jsonResponse.created_resources
|
||||
} else if (status == 'failed') {
|
||||
throw new Exception("Task failed:" + jsonResponse.error.description)
|
||||
}
|
||||
sleep(10)
|
||||
}
|
||||
return created_resources
|
||||
}
|
||||
|
||||
def exportPackages(
|
||||
|
|
Loading…
Reference in New Issue