Skip to content

Commit

Permalink
fix: Allow specifying multiple networks (#1205)
Browse files Browse the repository at this point in the history
  • Loading branch information
PigeonF authored May 9, 2024
1 parent 0fc0b2d commit 7165616
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,6 @@ export class Job {
dockerCmd += "--network-alias=build ";
}

for (const network of this.argv.network) {
dockerCmd += `--network ${network} `;
}

dockerCmd += `--volume ${buildVolumeName}:/gcl-builds `;
dockerCmd += `--volume ${tmpVolumeName}:${this.fileVariablesDir} `;
dockerCmd += "--workdir /gcl-builds ";
Expand Down Expand Up @@ -736,6 +732,11 @@ export class Job {
dockerCmd += "fi\n\"";

const {stdout: containerId} = await Utils.bash(dockerCmd, cwd);

for (const network of this.argv.network) {
await Utils.spawn([this.argv.containerExecutable, "network", "connect", network, `${containerId}`]);
}

this._containerId = containerId;
this._containersToClean.push(this._containerId);
}
Expand Down Expand Up @@ -1173,6 +1174,10 @@ export class Job {
const {stdout: containerId} = await Utils.bash(dockerCmd, cwd);
this._containersToClean.push(containerId);

for (const network of this.argv.network) {
await Utils.spawn([this.argv.containerExecutable, "network", "connect", network, `${containerId}`]);
}

await Utils.spawn([this.argv.containerExecutable, "start", `${containerId}`]);

const endTime = process.hrtime(time);
Expand Down

0 comments on commit 7165616

Please sign in to comment.