Skip to content

Commit f043c52

Browse files
committed
add waitImage param
1 parent 2494389 commit f043c52

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/argv.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ export class Argv {
322322
return this.map.get("defaultImage") ?? "docker.io/ruby:3.1";
323323
}
324324

325+
get waitImage (): string {
326+
return this.map.get("waitImage") ?? "docker.io/sumina46/wait-for-it:latest";
327+
}
328+
325329
get helperImage (): string {
326330
return this.map.get("helperImage") ?? "docker.io/firecow/gitlab-ci-local-util:latest";
327331
}

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ process.on("SIGUSR2", async () => await cleanupJobResources(jobs));
187187
description: "When using --shell-executor-no-image=false which image to be used for the container. Defaults to docker.io/ruby:3.1 if not set.",
188188
requiresArg: false,
189189
})
190+
.option("wait-image", {
191+
type: "string",
192+
description: "Which image to be used for the wait container. Defaults to docker.io/sumina46/wait-for-it:latest if not set.",
193+
requiresArg: false,
194+
})
190195
.option("helper-image", {
191196
type: "string",
192197
description: "When using --shell-executor-no-image=false which image to be used for the utils container. Defaults to docker.io/firecow/gitlab-ci-local-util:latest if not set.",

src/job.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,8 @@ export class Job {
14871487
private async serviceHealthCheck (writeStreams: WriteStreams, service: Service, serviceIndex: number, serviceContainerLogFile: string) {
14881488
const serviceAlias = service.alias;
14891489
const serviceName = service.name;
1490+
const waitImageName = this.argv.waitImage;
1491+
14901492

14911493
const {stdout} = await Utils.spawn([this.argv.containerExecutable, "image", "inspect", serviceName]);
14921494
const imageInspect = JSON.parse(stdout);
@@ -1511,7 +1513,7 @@ export class Job {
15111513
if (!port.endsWith("/tcp")) return;
15121514
const portNum = parseInt(port.replace("/tcp", ""));
15131515
const containerName = `gcl-wait-for-it-${this.jobId}-${serviceIndex}-${portNum}`;
1514-
const spawnCmd = [this.argv.containerExecutable, "run", "--rm", `--name=${containerName}`, "--network", `${this._serviceNetworkId}`, "docker.io/sumina46/wait-for-it", `${uniqueAlias}:${portNum}`, "-t", "30"];
1516+
const spawnCmd = [this.argv.containerExecutable, "run", "--rm", `--name=${containerName}`, "--network", `${this._serviceNetworkId}`,`${waitImageName}`, `${uniqueAlias}:${portNum}`, "-t", "30"];
15151517
this._containersToClean.push(containerName);
15161518
return Utils.spawn(spawnCmd);
15171519
}));

0 commit comments

Comments
 (0)