Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions bun.lock

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"checksum": "1.x.x",
"deep-extend": "0.6.x",
"dotenv": "17.x",
"execa": "5.x.x",
"execa": "10.x",
"fs-extra": "11.x.x",
"globby": "16.x.x",
"js-yaml": "4.x.x",
Expand Down
14 changes: 9 additions & 5 deletions src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {GitData} from "./git-data.js";
import assert, {AssertionError} from "node:assert";
import {Mutex} from "./mutex.js";
import {Argv} from "./argv.js";
import execa from "execa";
import {execa} from "execa";
import {CICDVariable} from "./variables-from-files.js";
import {GitlabRunnerCPUsPresetValue, GitlabRunnerMemoryPresetValue, GitlabRunnerPresetValues} from "./gitlab-preset.js";
import {handler} from "./handler.js";
Expand Down Expand Up @@ -932,10 +932,12 @@ If you know what you're doing and would like to suppress this warning, use one o
shell: "bash",
stdio: ["inherit", "inherit", "inherit"],
env: {...expanded, ...process.env},
reject: false,
});
const interactiveChildProcess = interactiveCp.nodeChildProcess;
return new Promise<number>((resolve, reject) => {
void interactiveCp.on("exit", (code) => resolve(code ?? 0));
void interactiveCp.on("error", (err) => reject(err));
interactiveChildProcess.on("exit", (code) => resolve(code ?? 0));
interactiveChildProcess.on("error", (err) => reject(err));
});
}

Expand Down Expand Up @@ -1143,7 +1145,9 @@ If you know what you're doing and would like to suppress this warning, use one o
cwd,
shell: "bash",
env: imageName ? process.env : expanded,
reject: false,
});
const childProcess = cp.nodeChildProcess;

// eslint-disable-next-line no-control-regex
const sectionRegex = /\x1b\[0Ksection_(start|end):(\d+):([^\s[]+)(?:\[[^\]]*\])?\r\x1b\[0K/;
Expand Down Expand Up @@ -1187,11 +1191,11 @@ If you know what you're doing and would like to suppress this warning, use one o
}
// Wait for "close" rather than "exit" so all stdout/stderr data events
// have flushed to the output log file before we resolve.
void cp.on("close", (code) => {
childProcess.on("close", (code) => {
clearTimeout(this._longRunningSilentTimeout);
return resolve(code ?? 0);},
);
void cp.on("error", (err) => {
childProcess.on("error", (err) => {
clearTimeout(this._longRunningSilentTimeout);
return reject(err);
});
Expand Down
8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {needsComplex} from "./data-expander.js";
import fs from "fs-extra";
import checksum from "checksum";
import base64url from "base64url";
import execa, {ExecaError} from "execa";
import {execa, execaSync, ExecaError} from "execa";
import assert from "node:assert";
import {createHash} from "node:crypto";
import {CICDVariable} from "./variables-from-files.js";
Expand All @@ -30,11 +30,11 @@ type ExpandWith = {
};

export class Utils {
static bashMulti (scripts: string[], cwd = process.cwd()): Promise<{stdout: string; stderr: string; exitCode: number}> {
static bashMulti (scripts: string[], cwd = process.cwd()): Promise<{stdout: string; stderr: string; exitCode?: number}> {
return execa(scripts.join(" && \\"), {shell: "bash", cwd});
}

static bash (shellScript: string, cwd = process.cwd()): Promise<{stdout: string; stderr: string; exitCode: number}> {
static bash (shellScript: string, cwd = process.cwd()): Promise<{stdout: string; stderr: string; exitCode?: number}> {
return execa(shellScript, {shell: "bash", cwd});
}

Expand All @@ -43,7 +43,7 @@ export class Utils {
}

static syncSpawn (cmdArgs: string[], cwd = process.cwd()): {stdout: string; stderr: string} {
return execa.sync(cmdArgs[0], cmdArgs.slice(1), {cwd});
return execaSync(cmdArgs[0], cmdArgs.slice(1), {cwd});
}

static fsUrl (url: string): string {
Expand Down
2 changes: 1 addition & 1 deletion tests/test-cases/dependency-proxy/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe("dependency-proxy", () => {
}, writeStreams);
} catch (e: any) {
// In ci environment, gitlab.com:443 is not authenticated, but at least this shows that we're pulling from the correct path
expect(e.shortMessage).toEqual("Command failed with exit code 1: docker pull gitlab.com:443/gcl/dependency_proxy/containers/busybox:latest");
expect(e.command).toEqual("docker pull gitlab.com:443/gcl/dependency_proxy/containers/busybox:latest");
return;
}
throw new Error("Error is expected but not thrown/caught");
Expand Down