Auto-install .NET SDK in CI scripts when runner lacks it
Gitea runner build failed with "dotnet: command not found". Added ensure_dotnet() to lib.sh, using the vendored dotnet-install.sh to bootstrap the SDK into .dotnet/ when not already on PATH, called from build.sh/test.sh/prepush.sh. Also trigger CI on build-runner-fix to verify the fix.
This commit is contained in:
@@ -37,6 +37,23 @@ image_names() {
|
||||
ADMIN_IMAGE="$REGISTRY/$REGISTRY_OWNER/miccheck-admin"
|
||||
}
|
||||
|
||||
# Installs .NET into $CI_ROOT/.dotnet via the vendored dotnet-install.sh if
|
||||
# `dotnet` isn't already on PATH, then prepends it to PATH for this process.
|
||||
# Keeps bare runners (no SDK preinstalled) working the same as a dev machine.
|
||||
ensure_dotnet() {
|
||||
if command -v dotnet > /dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local install_dir="$CI_ROOT/.dotnet"
|
||||
if [[ ! -x "$install_dir/dotnet" ]]; then
|
||||
log "dotnet not found on PATH; installing .NET SDK via dotnet-install.sh"
|
||||
bash "$CI_ROOT/dotnet-install.sh" --channel LTS --install-dir "$install_dir"
|
||||
fi
|
||||
export PATH="$install_dir:$PATH"
|
||||
export DOTNET_ROOT="$install_dir"
|
||||
}
|
||||
|
||||
registry_login() {
|
||||
require_registry_vars
|
||||
[[ -n "$REGISTRY_USER" ]] || fail "REGISTRY_USER env var is required to push images"
|
||||
|
||||
Reference in New Issue
Block a user