]> git.lizzy.rs Git - rust.git/blob - src/ci/shared.sh
Implement Clone::clone_from for VecDeque
[rust.git] / src / ci / shared.sh
1 #!/bin/false
2
3 # This file is intended to be sourced with `. shared.sh` or
4 # `source shared.sh`, hence the invalid shebang and not being
5 # marked as an executable file in git.
6
7 # See http://unix.stackexchange.com/questions/82598
8 # Duplicated in docker/dist-various-2/shared.sh
9 function retry {
10   echo "Attempting with retry:" "$@"
11   local n=1
12   local max=5
13   while true; do
14     "$@" && break || {
15       if [[ $n -lt $max ]]; then
16         sleep $n  # don't retry immediately
17         ((n++))
18         echo "Command failed. Attempt $n/$max:"
19       else
20         echo "The command has failed after $n attempts."
21         return 1
22       fi
23     }
24   done
25 }
26
27 function isCI {
28   [ "$CI" = "true" ] || [ "$TF_BUILD" = "True" ]
29 }
30
31 function isOSX {
32   [ "$AGENT_OS" = "Darwin" ]
33 }
34
35 function getCIBranch {
36   echo "$BUILD_SOURCEBRANCHNAME"
37 }