Skip to content

Commit

Permalink
Add k8s-mode detection (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
h0x0er authored Oct 27, 2023
1 parent 2579b52 commit abb3730
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
13 changes: 11 additions & 2 deletions dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61322,12 +61322,21 @@ var external_path_ = __nccwpck_require__(5622);
var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);
;// CONCATENATED MODULE: ./src/arc-runner.ts


function isArcRunner() {
const runnerUserAgent = process.env["GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT"];
let isARC = false;
if (!runnerUserAgent) {
return false;
isARC = false;
}
return runnerUserAgent.includes("actions-runner-controller/");
else {
isARC = runnerUserAgent.includes("actions-runner-controller/");
}
return isARC || isSecondaryPod();
}
function isSecondaryPod() {
const workDir = "/__w";
return external_fs_.existsSync(workDir);
}
function getRunnerTempDir() {
const isTest = process.env["isTest"];
Expand Down
2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions dist/pre/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/pre/index.js.map

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions src/arc-runner.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import * as cp from "child_process";
import * as fs from "fs";
import { sleep } from "./setup";

export function isArcRunner(): boolean {
const runnerUserAgent = process.env["GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT"];

let isARC = false;

if (!runnerUserAgent) {
return false;
isARC = false;
} else {
isARC = runnerUserAgent.includes("actions-runner-controller/");
}

return runnerUserAgent.includes("actions-runner-controller/");
return isARC || isSecondaryPod();
}

function isSecondaryPod(): boolean {
const workDir = "/__w";
return fs.existsSync(workDir);
}

function getRunnerTempDir(): string {
Expand Down

0 comments on commit abb3730

Please sign in to comment.