False Job Status over API if it retryed

Hi,

we deploy one of our environment on a Cloud Provider. We have the "deploy environment" task extended with the retry option, why the task runs occasionally in timeouts.

In another pipeline, i need the status of this job. I'll get the status with this shell script:

PIPELINE_ID=curl -s --header "PRIVATE-TOKEN: $TOKEN" "https://example.com/api/v4/projects/$PROJECT/pipelines?per_page=1" | jq -r '.[].id'
JOB_STATUS=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "https://example.com/api/v4/projects/$PROJECT/pipelines/$PIPELINE_ID/jobs" | jq -r '.[] | select (.name | contains("deploy environment")).status')

if [ "$JOB_STATUS" != "success" ]; then
    curl -s --request POST --header "PRIVATE-TOKEN: $TOKEN" "https://example.com/api/v4/projects/$CURRENT_PROJECT_ID/pipelines/$CURRENT_PIPELINE_ID/cancel"
fi

If this task is retryed, the value of $JOB_STATUS is failed, even though the second run is success. Is there a possibility to read out the correct status over the api or is it a bug?

Thanks Thoralf

Edited May 13, 2019 by Thoralf Liersch
Assignee Loading
Time tracking Loading