Fix retry loop bashisms in clone test repo CI job

Summary

The clone test repo job's retry loop in .gitlab/ci/build.gitlab-ci.yml never actually retried, because it used bash-only syntax while running under alpine:latest's default /bin/sh (BusyBox ash):

  • for i in {1..3} relies on bash brace expansion, which ash does not support, so $i was literally the string {1..3} and the loop body ran exactly once.
  • [[ "$succeed" -eq 1 ]] is also a bashism not supported by ash.

This made the job's only mitigation for transient network flakiness during git clone a silent no-op.

Fix

Replace the loop with a POSIX-compatible while loop and [ ] test, so the job actually retries up to 3 times on transient failures as intended.

Verification

  • glab ci lint reports the updated YAML as valid.
  • Reproduced the bug and verified the fix's retry/success paths directly under alpine:latest's sh, e.g.:
    docker run --rm alpine:latest sh -c '
    succeed=0
    i=1
    while [ "$i" -le 3 ]; do
      echo "attempt: i=$i"
      false && succeed=1 && break
      echo "retrying"
      i=$((i + 1))
    done
    [ "$succeed" -eq 1 ]
    echo "exit code: $?"
    '
    confirms 3 real attempts occur (previously only 1), and the final check correctly reflects success/failure.

Closes #39586 (closed)

Merge request reports

Loading