Address Copilot review: cache isDocker/isAgentInstalled calls, rename test file
Compute isDocker() and isAgentInstalled() once and reuse for both the deploy check and logging. Rename setup.test.ts to utils.test.ts to match the module it tests.
This commit is contained in:
parent
b62162e11d
commit
bb4b9e732d
4 changed files with 12 additions and 7 deletions
8
dist/pre/index.js
vendored
8
dist/pre/index.js
vendored
|
|
@ -85900,7 +85900,9 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|||
encoding: "utf8",
|
||||
});
|
||||
lib_core.info(SELF_HOSTED_RUNNER_MESSAGE);
|
||||
if (shouldDeployAgentOnSelfHosted(confg.deploy_on_self_hosted_vm, isDocker(), isAgentInstalled(process.platform))) {
|
||||
const inContainer = isDocker();
|
||||
const alreadyInstalled = isAgentInstalled(process.platform);
|
||||
if (shouldDeployAgentOnSelfHosted(confg.deploy_on_self_hosted_vm, inContainer, alreadyInstalled)) {
|
||||
if (process.platform !== "linux") {
|
||||
lib_core.info("deploy-on-self-hosted-vm is only supported on Linux. Skipping agent deployment.");
|
||||
}
|
||||
|
|
@ -85910,10 +85912,10 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (confg.deploy_on_self_hosted_vm && isDocker()) {
|
||||
if (confg.deploy_on_self_hosted_vm && inContainer) {
|
||||
lib_core.info("Skipping agent deployment: running inside a container.");
|
||||
}
|
||||
if (confg.deploy_on_self_hosted_vm && isAgentInstalled(process.platform)) {
|
||||
if (confg.deploy_on_self_hosted_vm && alreadyInstalled) {
|
||||
lib_core.info("Agent already installed on self-hosted runner, skipping installation.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
dist/pre/index.js.map
vendored
2
dist/pre/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -295,7 +295,10 @@ interface MonitorResponse {
|
|||
|
||||
core.info(common.SELF_HOSTED_RUNNER_MESSAGE);
|
||||
|
||||
if (shouldDeployAgentOnSelfHosted(confg.deploy_on_self_hosted_vm, isDocker(), isAgentInstalled(process.platform))) {
|
||||
const inContainer = isDocker();
|
||||
const alreadyInstalled = isAgentInstalled(process.platform);
|
||||
|
||||
if (shouldDeployAgentOnSelfHosted(confg.deploy_on_self_hosted_vm, inContainer, alreadyInstalled)) {
|
||||
if (process.platform !== "linux") {
|
||||
core.info("deploy-on-self-hosted-vm is only supported on Linux. Skipping agent deployment.");
|
||||
} else {
|
||||
|
|
@ -303,10 +306,10 @@ interface MonitorResponse {
|
|||
await installAgentForSelfHosted(context.repo.owner, confg);
|
||||
}
|
||||
} else {
|
||||
if (confg.deploy_on_self_hosted_vm && isDocker()) {
|
||||
if (confg.deploy_on_self_hosted_vm && inContainer) {
|
||||
core.info("Skipping agent deployment: running inside a container.");
|
||||
}
|
||||
if (confg.deploy_on_self_hosted_vm && isAgentInstalled(process.platform)) {
|
||||
if (confg.deploy_on_self_hosted_vm && alreadyInstalled) {
|
||||
core.info("Agent already installed on self-hosted runner, skipping installation.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue