fix: detect ubuntu-slim runners early and bail out
ubuntu-slim runners (Hosted Compute Agent Docker containers) are GitHub-hosted but lack the standard USER environment variable set on full VM-based runners. This causes chownForFolder to fail with 'chown: invalid user: undefined'. Instead of patching chownForFolder, detect ubuntu-slim early informative message, matching the existing patterns for isDocker(), isARCRunner(), and other unsupported runner types. Fixes #627 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
f808768d15
commit
376d25a97f
3 changed files with 13 additions and 0 deletions
|
|
@ -26,6 +26,11 @@ import { isPlatformSupported, isAgentInstalled } from "./utils";
|
|||
return;
|
||||
}
|
||||
|
||||
if (isGithubHosted() && process.platform === "linux" && !process.env.USER) {
|
||||
console.log(common.UBUNTU_SLIM_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isARCRunner()) {
|
||||
console.log(`[!] ${common.ARC_RUNNER_MESSAGE}`);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -148,3 +148,6 @@ export const ARM64_RUNNER_MESSAGE =
|
|||
|
||||
export const ARM64_WINDOWS_RUNNER_MESSAGE =
|
||||
"Windows ARM runners are not yet supported by Harden-Runner.";
|
||||
|
||||
export const UBUNTU_SLIM_MESSAGE =
|
||||
"This job is running on an ubuntu-slim runner (GitHub-hosted Linux container without a standard USER environment variable). Harden Runner is not supported on ubuntu-slim runners. This job will not be monitored.";
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ interface MonitorResponse {
|
|||
return;
|
||||
}
|
||||
|
||||
if (isGithubHosted() && process.platform === "linux" && !process.env.USER) {
|
||||
console.log(common.UBUNTU_SLIM_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
var correlation_id = uuidv4();
|
||||
var api_url = STEPSECURITY_API_URL;
|
||||
var web_url = STEPSECURITY_WEB_URL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue