File tree Expand file tree Collapse file tree 4 files changed +9
-11
lines changed
packages/core/src/v3/isomorphic Expand file tree Collapse file tree 4 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,7 @@ export function getDockerHostDomain() {
4
4
5
5
return isMacOs || isWindows ? "host.docker.internal" : "localhost" ;
6
6
}
7
+
8
+ export function getRunnerId ( runId : string ) {
9
+ return `runner-${ runId . replace ( "run_" , "" ) } ` ;
10
+ }
Original file line number Diff line number Diff line change 1
1
import { SimpleStructuredLogger } from "@trigger.dev/core/v3/utils/structuredLogger" ;
2
- import { RunnerId } from "@trigger.dev/core/v3/isomorphic" ;
3
2
import {
4
3
type WorkloadManager ,
5
4
type WorkloadManagerCreateOptions ,
6
5
type WorkloadManagerOptions ,
7
6
} from "./types.js" ;
8
7
import { x } from "tinyexec" ;
9
8
import { env } from "../env.js" ;
10
- import { getDockerHostDomain } from "../util.js" ;
9
+ import { getDockerHostDomain , getRunnerId } from "../util.js" ;
11
10
12
11
export class DockerWorkloadManager implements WorkloadManager {
13
12
private readonly logger = new SimpleStructuredLogger ( "docker-workload-provider" ) ;
@@ -23,7 +22,8 @@ export class DockerWorkloadManager implements WorkloadManager {
23
22
async create ( opts : WorkloadManagerCreateOptions ) {
24
23
this . logger . log ( "[DockerWorkloadProvider] Creating container" , { opts } ) ;
25
24
26
- const runnerId = RunnerId . generate ( ) ;
25
+ const runnerId = getRunnerId ( opts . runFriendlyId ) ;
26
+
27
27
const runArgs = [
28
28
"run" ,
29
29
"--detach" ,
Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ import {
4
4
type WorkloadManagerCreateOptions ,
5
5
type WorkloadManagerOptions ,
6
6
} from "./types.js" ;
7
- import { RunnerId } from "@trigger.dev/core/v3/isomorphic" ;
8
7
import type { EnvironmentType , MachinePreset } from "@trigger.dev/core/v3" ;
9
8
import { env } from "../env.js" ;
10
9
import { type K8sApi , createK8sApi , type k8s } from "../clients/kubernetes.js" ;
10
+ import { getRunnerId } from "../util.js" ;
11
11
12
12
type ResourceQuantities = {
13
13
[ K in "cpu" | "memory" | "ephemeral-storage" ] ?: string ;
@@ -31,7 +31,7 @@ export class KubernetesWorkloadManager implements WorkloadManager {
31
31
async create ( opts : WorkloadManagerCreateOptions ) {
32
32
this . logger . log ( "[KubernetesWorkloadManager] Creating container" , { opts } ) ;
33
33
34
- const runnerId = RunnerId . generate ( ) . replace ( / _ / g , "-" ) ;
34
+ const runnerId = getRunnerId ( opts . runFriendlyId ) ;
35
35
36
36
try {
37
37
await this . k8s . core . createNamespacedPod ( {
Original file line number Diff line number Diff line change @@ -110,9 +110,3 @@ export class IdGenerator {
110
110
return `${ this . prefix } ${ customAlphabet ( this . alphabet , this . length ) ( ) } ` ;
111
111
}
112
112
}
113
-
114
- export const RunnerId = new IdGenerator ( {
115
- alphabet : "123456789abcdefghijkmnopqrstuvwxyz" ,
116
- length : 20 ,
117
- prefix : "runner_" ,
118
- } ) ;
You can’t perform that action at this time.
0 commit comments