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
4 changes: 4 additions & 0 deletions src/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ export class Argv {
return this.map.get("defaultImage") ?? "docker.io/ruby:3.1";
}

get waitImage (): string {
return this.map.get("waitImage") ?? "docker.io/sumina46/wait-for-it:latest";
}

get helperImage (): string {
return this.map.get("helperImage") ?? "docker.io/firecow/gitlab-ci-local-util:latest";
}
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ process.on("SIGUSR2", async () => await cleanupJobResources(jobs));
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.",
requiresArg: false,
})
.option("wait-image", {
type: "string",
description: "Which image to be used for the wait container. Defaults to docker.io/sumina46/wait-for-it:latest if not set.",
requiresArg: false,
})
.option("helper-image", {
type: "string",
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.",
Expand Down
3 changes: 2 additions & 1 deletion src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,7 @@ export class Job {
private async serviceHealthCheck (writeStreams: WriteStreams, service: Service, serviceIndex: number, serviceContainerLogFile: string) {
const serviceAlias = service.alias;
const serviceName = service.name;
const waitImageName = this.argv.waitImage;

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