Skip to content

Commit a05f8d5

Browse files
committed
append attempt number to runner name if >1
1 parent 07b369b commit a05f8d5

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

apps/supervisor/src/util.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ export function getDockerHostDomain() {
55
return isMacOs || isWindows ? "host.docker.internal" : "localhost";
66
}
77

8-
export function getRunnerId(runId: string) {
9-
return `runner-${runId.replace("run_", "")}`;
8+
export function getRunnerId(runId: string, attemptNumber?: number) {
9+
const parts = ["runner", runId.replace("run_", "")];
10+
11+
if (attemptNumber && attemptNumber > 1) {
12+
parts.push(`attempt-${attemptNumber}`);
13+
}
14+
15+
return parts.join("-");
1016
}

apps/supervisor/src/workloadManager/docker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class DockerWorkloadManager implements WorkloadManager {
2222
async create(opts: WorkloadManagerCreateOptions) {
2323
this.logger.log("[DockerWorkloadProvider] Creating container", { opts });
2424

25-
const runnerId = getRunnerId(opts.runFriendlyId);
25+
const runnerId = getRunnerId(opts.runFriendlyId, opts.nextAttemptNumber);
2626

2727
const runArgs = [
2828
"run",

apps/supervisor/src/workloadManager/kubernetes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class KubernetesWorkloadManager implements WorkloadManager {
3131
async create(opts: WorkloadManagerCreateOptions) {
3232
this.logger.log("[KubernetesWorkloadManager] Creating container", { opts });
3333

34-
const runnerId = getRunnerId(opts.runFriendlyId);
34+
const runnerId = getRunnerId(opts.runFriendlyId, opts.nextAttemptNumber);
3535

3636
try {
3737
await this.k8s.core.createNamespacedPod({

0 commit comments

Comments
 (0)