diff options
| author | Oskar <oskar@mullvad.net> | 2025-05-14 10:00:28 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2025-05-14 13:15:34 +0200 |
| commit | 74a0422f31a8ddd3f95f1754bd4e81a65f6782d9 (patch) | |
| tree | a7ea0a2c452ab88b649650182d2f7327ee66f9cb | |
| parent | 883dda41693e3f55dbc4fe7bccce424df6898f18 (diff) | |
| download | mullvadvpn-74a0422f31a8ddd3f95f1754bd4e81a65f6782d9.tar.xz mullvadvpn-74a0422f31a8ddd3f95f1754bd4e81a65f6782d9.zip | |
Improve error handling in buildserver code checkout
| -rwxr-xr-x | ci/buildserver-build.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ci/buildserver-build.sh b/ci/buildserver-build.sh index d932f6825d..b178e162a1 100755 --- a/ci/buildserver-build.sh +++ b/ci/buildserver-build.sh @@ -156,8 +156,15 @@ function checkout_ref { # Clean our working dir and check out the code we want to build rm -r dist/ 2&>/dev/null || true - git reset --hard + + # Reset to main in case there is some issue on the current branch that prevents resetting to it. + git reset --hard origin/main + git checkout "$ref" + + # Return an error if it's not possible to reset to the current branch. Some errors will result in exit code 0 from `checkout` but >0 from `reset`. + git reset --hard || return 1 + git submodule update git submodule update --init wireguard-go-rs/libwg/wireguard-go || true git clean -df |
