Sortir de la boucle lorsqu’une tâche est en erreur
Cadoles/Jenkins/pipeline/head There was a failure building this commit Details

This commit is contained in:
Benjamin Bohard 2022-03-28 12:15:38 +02:00
parent 1f6a71e0a9
commit 44764866a8
1 changed files with 5 additions and 4 deletions

View File

@ -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(