Unverified Commit d3aee9cd authored by norvell's avatar norvell
Browse files

Hotfix: prevent retrieving previous artifacts from failing in ivas-long-term-job-logs

parent e322510a
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2525,10 +2525,11 @@ ivas-long-term-job-logs:
    - echo "Job name from variables - "$CI_JOB_NAME", Job ID from script - $id_previous"

    - if [ "$id_previous" != "-1" ]; then
        # Unzip artifacts to recover past logs dir
    -   curl --request GET "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip
        # Unzip artifacts to recover past logs dir. If the last job artifacts have expired (long outage), this may fail. 
        # In that case, rely on backup.
    -   curl --request GET "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/$id_previous/artifacts" --output artifacts.zip || true
        # If there is overlap between injected log and new log, use the new logs.
    -   unzip -o artifacts.zip
    -   unzip -o artifacts.zip || true
    - else
        # create logs dir if it doesn't exist (should only happen in first run)
    -   echo "Could not find previous job, creating empty logs folder. If this is not the first run, an error likely happened!"