@dagger.io/dagger 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.gen.d.ts +648 -62
- package/dist/api/client.gen.d.ts.map +1 -1
- package/dist/api/client.gen.js +668 -45
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/api/utils.js +6 -2
- package/dist/common/errors/DaggerSDKError.d.ts +1 -1
- package/dist/common/errors/DaggerSDKError.d.ts.map +1 -1
- package/dist/common/errors/NotAwaitedRequestError.d.ts +13 -0
- package/dist/common/errors/NotAwaitedRequestError.d.ts.map +1 -0
- package/dist/common/errors/NotAwaitedRequestError.js +15 -0
- package/dist/common/errors/errors-codes.d.ts +4 -0
- package/dist/common/errors/errors-codes.d.ts.map +1 -1
- package/dist/common/errors/errors-codes.js +4 -0
- package/dist/common/errors/index.d.ts +1 -0
- package/dist/common/errors/index.d.ts.map +1 -1
- package/dist/common/errors/index.js +1 -0
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +1 -4
- package/dist/provisioning/default.d.ts +1 -1
- package/dist/provisioning/default.js +1 -1
- package/package.json +7 -7
package/dist/api/client.gen.d.ts
CHANGED
|
@@ -33,7 +33,13 @@ declare class BaseClient {
|
|
|
33
33
|
get queryTree(): QueryTree[];
|
|
34
34
|
}
|
|
35
35
|
export type BuildArg = {
|
|
36
|
+
/**
|
|
37
|
+
* The build argument name.
|
|
38
|
+
*/
|
|
36
39
|
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* The build argument value.
|
|
42
|
+
*/
|
|
37
43
|
value: string;
|
|
38
44
|
};
|
|
39
45
|
/**
|
|
@@ -63,7 +69,8 @@ export declare enum CacheSharingMode {
|
|
|
63
69
|
export type ContainerBuildOpts = {
|
|
64
70
|
/**
|
|
65
71
|
* Path to the Dockerfile to use.
|
|
66
|
-
*
|
|
72
|
+
*
|
|
73
|
+
* Default: './Dockerfile'.
|
|
67
74
|
*/
|
|
68
75
|
dockerfile?: string;
|
|
69
76
|
/**
|
|
@@ -75,21 +82,31 @@ export type ContainerBuildOpts = {
|
|
|
75
82
|
*/
|
|
76
83
|
target?: string;
|
|
77
84
|
};
|
|
85
|
+
export type ContainerEndpointOpts = {
|
|
86
|
+
/**
|
|
87
|
+
* The exposed port number for the endpoint
|
|
88
|
+
*/
|
|
89
|
+
port?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Return a URL with the given scheme, eg. http for http://
|
|
92
|
+
*/
|
|
93
|
+
scheme?: string;
|
|
94
|
+
};
|
|
78
95
|
export type ContainerExecOpts = {
|
|
79
96
|
/**
|
|
80
|
-
* Command to run instead of the container's default command.
|
|
97
|
+
* Command to run instead of the container's default command (e.g., ["run", "main.go"]).
|
|
81
98
|
*/
|
|
82
99
|
args?: string[];
|
|
83
100
|
/**
|
|
84
|
-
* Content to write to the command's standard input before closing.
|
|
101
|
+
* Content to write to the command's standard input before closing (e.g., "Hello world").
|
|
85
102
|
*/
|
|
86
103
|
stdin?: string;
|
|
87
104
|
/**
|
|
88
|
-
* Redirect the command's standard output to a file in the container.
|
|
105
|
+
* Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
|
|
89
106
|
*/
|
|
90
107
|
redirectStdout?: string;
|
|
91
108
|
/**
|
|
92
|
-
* Redirect the command's standard error to a file in the container.
|
|
109
|
+
* Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
|
|
93
110
|
*/
|
|
94
111
|
redirectStderr?: string;
|
|
95
112
|
/**
|
|
@@ -117,38 +134,63 @@ export type ContainerPublishOpts = {
|
|
|
117
134
|
platformVariants?: Container[];
|
|
118
135
|
};
|
|
119
136
|
export type ContainerWithDefaultArgsOpts = {
|
|
137
|
+
/**
|
|
138
|
+
* Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
|
|
139
|
+
*/
|
|
120
140
|
args?: string[];
|
|
121
141
|
};
|
|
122
142
|
export type ContainerWithDirectoryOpts = {
|
|
143
|
+
/**
|
|
144
|
+
* Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
|
|
145
|
+
*/
|
|
123
146
|
exclude?: string[];
|
|
147
|
+
/**
|
|
148
|
+
* Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
|
|
149
|
+
*/
|
|
124
150
|
include?: string[];
|
|
125
151
|
};
|
|
126
152
|
export type ContainerWithExecOpts = {
|
|
127
153
|
/**
|
|
128
|
-
* Content to write to the command's standard input before closing.
|
|
154
|
+
* Content to write to the command's standard input before closing (e.g., "Hello world").
|
|
129
155
|
*/
|
|
130
156
|
stdin?: string;
|
|
131
157
|
/**
|
|
132
|
-
* Redirect the command's standard output to a file in the container.
|
|
158
|
+
* Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
|
|
133
159
|
*/
|
|
134
160
|
redirectStdout?: string;
|
|
135
161
|
/**
|
|
136
|
-
* Redirect the command's standard error to a file in the container.
|
|
162
|
+
* Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
|
|
137
163
|
*/
|
|
138
164
|
redirectStderr?: string;
|
|
139
165
|
/**
|
|
140
|
-
*
|
|
166
|
+
* Provides dagger access to the executed command.
|
|
167
|
+
*
|
|
141
168
|
* Do not use this option unless you trust the command being executed.
|
|
142
169
|
* The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
|
|
143
170
|
*/
|
|
144
171
|
experimentalPrivilegedNesting?: boolean;
|
|
145
172
|
};
|
|
173
|
+
export type ContainerWithExposedPortOpts = {
|
|
174
|
+
/**
|
|
175
|
+
* Transport layer network protocol
|
|
176
|
+
*/
|
|
177
|
+
protocol?: NetworkProtocol;
|
|
178
|
+
/**
|
|
179
|
+
* Optional port description
|
|
180
|
+
*/
|
|
181
|
+
description?: string;
|
|
182
|
+
};
|
|
146
183
|
export type ContainerWithFileOpts = {
|
|
184
|
+
/**
|
|
185
|
+
* Permission given to the copied file (e.g., 0600).
|
|
186
|
+
*
|
|
187
|
+
* Default: 0644.
|
|
188
|
+
*/
|
|
147
189
|
permissions?: number;
|
|
148
190
|
};
|
|
149
191
|
export type ContainerWithMountedCacheOpts = {
|
|
150
192
|
/**
|
|
151
|
-
*
|
|
193
|
+
* Identifier of the directory to use as the cache volume's root.
|
|
152
194
|
*/
|
|
153
195
|
source?: Directory;
|
|
154
196
|
/**
|
|
@@ -157,9 +199,23 @@ export type ContainerWithMountedCacheOpts = {
|
|
|
157
199
|
sharing?: CacheSharingMode;
|
|
158
200
|
};
|
|
159
201
|
export type ContainerWithNewFileOpts = {
|
|
202
|
+
/**
|
|
203
|
+
* Content of the file to write (e.g., "Hello world!").
|
|
204
|
+
*/
|
|
160
205
|
contents?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Permission given to the written file (e.g., 0600).
|
|
208
|
+
*
|
|
209
|
+
* Default: 0644.
|
|
210
|
+
*/
|
|
161
211
|
permissions?: number;
|
|
162
212
|
};
|
|
213
|
+
export type ContainerWithoutExposedPortOpts = {
|
|
214
|
+
/**
|
|
215
|
+
* Port protocol to unexpose
|
|
216
|
+
*/
|
|
217
|
+
protocol?: NetworkProtocol;
|
|
218
|
+
};
|
|
163
219
|
/**
|
|
164
220
|
* A unique container identifier. Null designates an empty container (scratch).
|
|
165
221
|
*/
|
|
@@ -174,8 +230,9 @@ export type DateTime = string & {
|
|
|
174
230
|
};
|
|
175
231
|
export type DirectoryDockerBuildOpts = {
|
|
176
232
|
/**
|
|
177
|
-
* Path to the Dockerfile to use.
|
|
178
|
-
*
|
|
233
|
+
* Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
|
|
234
|
+
*
|
|
235
|
+
* Defaults: './Dockerfile'.
|
|
179
236
|
*/
|
|
180
237
|
dockerfile?: string;
|
|
181
238
|
/**
|
|
@@ -183,7 +240,7 @@ export type DirectoryDockerBuildOpts = {
|
|
|
183
240
|
*/
|
|
184
241
|
platform?: Platform;
|
|
185
242
|
/**
|
|
186
|
-
*
|
|
243
|
+
* Build arguments to use in the build.
|
|
187
244
|
*/
|
|
188
245
|
buildArgs?: BuildArg[];
|
|
189
246
|
/**
|
|
@@ -192,6 +249,9 @@ export type DirectoryDockerBuildOpts = {
|
|
|
192
249
|
target?: string;
|
|
193
250
|
};
|
|
194
251
|
export type DirectoryEntriesOpts = {
|
|
252
|
+
/**
|
|
253
|
+
* Location of the directory to look at (e.g., "/src").
|
|
254
|
+
*/
|
|
195
255
|
path?: string;
|
|
196
256
|
};
|
|
197
257
|
export type DirectoryPipelineOpts = {
|
|
@@ -199,23 +259,36 @@ export type DirectoryPipelineOpts = {
|
|
|
199
259
|
};
|
|
200
260
|
export type DirectoryWithDirectoryOpts = {
|
|
201
261
|
/**
|
|
202
|
-
* Exclude artifacts that match the given pattern.
|
|
203
|
-
* (e.g. ["node_modules/", ".git*"]).
|
|
262
|
+
* Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
|
|
204
263
|
*/
|
|
205
264
|
exclude?: string[];
|
|
206
265
|
/**
|
|
207
|
-
* Include only artifacts that match the given pattern.
|
|
208
|
-
* (e.g. ["app/", "package.*"]).
|
|
266
|
+
* Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
|
|
209
267
|
*/
|
|
210
268
|
include?: string[];
|
|
211
269
|
};
|
|
212
270
|
export type DirectoryWithFileOpts = {
|
|
271
|
+
/**
|
|
272
|
+
* Permission given to the copied file (e.g., 0600).
|
|
273
|
+
*
|
|
274
|
+
* Default: 0644.
|
|
275
|
+
*/
|
|
213
276
|
permissions?: number;
|
|
214
277
|
};
|
|
215
278
|
export type DirectoryWithNewDirectoryOpts = {
|
|
279
|
+
/**
|
|
280
|
+
* Permission granted to the created directory (e.g., 0777).
|
|
281
|
+
*
|
|
282
|
+
* Default: 0755.
|
|
283
|
+
*/
|
|
216
284
|
permissions?: number;
|
|
217
285
|
};
|
|
218
286
|
export type DirectoryWithNewFileOpts = {
|
|
287
|
+
/**
|
|
288
|
+
* Permission given to the copied file (e.g., 0600).
|
|
289
|
+
*
|
|
290
|
+
* Default: 0644.
|
|
291
|
+
*/
|
|
219
292
|
permissions?: number;
|
|
220
293
|
};
|
|
221
294
|
/**
|
|
@@ -235,11 +308,23 @@ export type GitRefTreeOpts = {
|
|
|
235
308
|
sshAuthSocket?: Socket;
|
|
236
309
|
};
|
|
237
310
|
export type HostDirectoryOpts = {
|
|
311
|
+
/**
|
|
312
|
+
* Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
|
|
313
|
+
*/
|
|
238
314
|
exclude?: string[];
|
|
315
|
+
/**
|
|
316
|
+
* Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
|
|
317
|
+
*/
|
|
239
318
|
include?: string[];
|
|
240
319
|
};
|
|
241
320
|
export type HostWorkdirOpts = {
|
|
321
|
+
/**
|
|
322
|
+
* Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
|
|
323
|
+
*/
|
|
242
324
|
exclude?: string[];
|
|
325
|
+
/**
|
|
326
|
+
* Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
|
|
327
|
+
*/
|
|
243
328
|
include?: string[];
|
|
244
329
|
};
|
|
245
330
|
/**
|
|
@@ -248,9 +333,23 @@ export type HostWorkdirOpts = {
|
|
|
248
333
|
export type ID = string & {
|
|
249
334
|
__ID: never;
|
|
250
335
|
};
|
|
336
|
+
/**
|
|
337
|
+
* Transport layer network protocol associated to a port.
|
|
338
|
+
*/
|
|
339
|
+
export declare enum NetworkProtocol {
|
|
340
|
+
/**
|
|
341
|
+
* TCP (Transmission Control Protocol)
|
|
342
|
+
*/
|
|
343
|
+
Tcp = 0,
|
|
344
|
+
/**
|
|
345
|
+
* UDP (User Datagram Protocol)
|
|
346
|
+
*/
|
|
347
|
+
Udp = 1
|
|
348
|
+
}
|
|
251
349
|
/**
|
|
252
350
|
* The platform config OS and architecture in a Container.
|
|
253
|
-
*
|
|
351
|
+
*
|
|
352
|
+
* The format is [os]/[platform]/[version] (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64").
|
|
254
353
|
*/
|
|
255
354
|
export type Platform = string & {
|
|
256
355
|
__Platform: never;
|
|
@@ -263,7 +362,20 @@ export type ClientDirectoryOpts = {
|
|
|
263
362
|
id?: DirectoryID;
|
|
264
363
|
};
|
|
265
364
|
export type ClientGitOpts = {
|
|
365
|
+
/**
|
|
366
|
+
* Set to true to keep .git directory.
|
|
367
|
+
*/
|
|
266
368
|
keepGitDir?: boolean;
|
|
369
|
+
/**
|
|
370
|
+
* A service which must be started before the repo is fetched.
|
|
371
|
+
*/
|
|
372
|
+
experimentalServiceHost?: Container;
|
|
373
|
+
};
|
|
374
|
+
export type ClientHttpOpts = {
|
|
375
|
+
/**
|
|
376
|
+
* A service which must be started before the URL is fetched.
|
|
377
|
+
*/
|
|
378
|
+
experimentalServiceHost?: Container;
|
|
267
379
|
};
|
|
268
380
|
export type ClientPipelineOpts = {
|
|
269
381
|
description?: string;
|
|
@@ -294,16 +406,39 @@ export type __TypeFieldsOpts = {
|
|
|
294
406
|
*/
|
|
295
407
|
export declare class CacheVolume extends BaseClient {
|
|
296
408
|
id(): Promise<CacheID>;
|
|
409
|
+
/**
|
|
410
|
+
* Chain objects together
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* function AddAFewMounts(c) {
|
|
414
|
+
* return c
|
|
415
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
416
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
417
|
+
* }
|
|
418
|
+
*
|
|
419
|
+
* connect(async (client) => {
|
|
420
|
+
* const tree = await client
|
|
421
|
+
* .container()
|
|
422
|
+
* .from("alpine")
|
|
423
|
+
* .withWorkdir("/foo")
|
|
424
|
+
* .with(AddAFewMounts)
|
|
425
|
+
* .withExec(["ls", "-lh"])
|
|
426
|
+
* .stdout()
|
|
427
|
+
* })
|
|
428
|
+
*```
|
|
429
|
+
*/
|
|
430
|
+
with(arg: (param: CacheVolume) => CacheVolume): CacheVolume;
|
|
297
431
|
}
|
|
298
432
|
/**
|
|
299
433
|
* An OCI-compatible container, also known as a docker container.
|
|
300
434
|
*/
|
|
301
435
|
export declare class Container extends BaseClient {
|
|
302
436
|
/**
|
|
303
|
-
* Initializes this container from a Dockerfile build
|
|
437
|
+
* Initializes this container from a Dockerfile build.
|
|
304
438
|
* @param context Directory context used by the Dockerfile.
|
|
305
439
|
* @param opts.dockerfile Path to the Dockerfile to use.
|
|
306
|
-
|
|
440
|
+
*
|
|
441
|
+
* Default: './Dockerfile'.
|
|
307
442
|
* @param opts.buildArgs Additional build arguments.
|
|
308
443
|
* @param opts.target Target build stage to build.
|
|
309
444
|
*/
|
|
@@ -313,15 +448,29 @@ export declare class Container extends BaseClient {
|
|
|
313
448
|
*/
|
|
314
449
|
defaultArgs(): Promise<string[]>;
|
|
315
450
|
/**
|
|
316
|
-
* Retrieves a directory at the given path.
|
|
451
|
+
* Retrieves a directory at the given path.
|
|
452
|
+
*
|
|
453
|
+
* Mounts are included.
|
|
454
|
+
* @param path The path of the directory to retrieve (e.g., "./src").
|
|
317
455
|
*/
|
|
318
456
|
directory(path: string): Directory;
|
|
457
|
+
/**
|
|
458
|
+
* Retrieves an endpoint that clients can use to reach this container.
|
|
459
|
+
*
|
|
460
|
+
* If no port is specified, the first exposed port is used. If none exist an error is returned.
|
|
461
|
+
*
|
|
462
|
+
* If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
|
|
463
|
+
* @param opts.port The exposed port number for the endpoint
|
|
464
|
+
* @param opts.scheme Return a URL with the given scheme, eg. http for http://
|
|
465
|
+
*/
|
|
466
|
+
endpoint(opts?: ContainerEndpointOpts): Promise<string>;
|
|
319
467
|
/**
|
|
320
468
|
* Retrieves entrypoint to be prepended to the arguments of all commands.
|
|
321
469
|
*/
|
|
322
470
|
entrypoint(): Promise<string[]>;
|
|
323
471
|
/**
|
|
324
472
|
* Retrieves the value of the specified environment variable.
|
|
473
|
+
* @param name The name of the environment variable to retrieve (e.g., "PATH").
|
|
325
474
|
*/
|
|
326
475
|
envVariable(name: string): Promise<string>;
|
|
327
476
|
/**
|
|
@@ -330,13 +479,13 @@ export declare class Container extends BaseClient {
|
|
|
330
479
|
envVariables(): Promise<EnvVariable[]>;
|
|
331
480
|
/**
|
|
332
481
|
* Retrieves this container after executing the specified command inside it.
|
|
333
|
-
* @param opts.args Command to run instead of the container's default command.
|
|
334
|
-
* @param opts.stdin Content to write to the command's standard input before closing.
|
|
335
|
-
* @param opts.redirectStdout Redirect the command's standard output to a file in the container.
|
|
336
|
-
* @param opts.redirectStderr Redirect the command's standard error to a file in the container.
|
|
482
|
+
* @param opts.args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
|
|
483
|
+
* @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
|
|
484
|
+
* @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
|
|
485
|
+
* @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
|
|
337
486
|
* @param opts.experimentalPrivilegedNesting Provide dagger access to the executed command.
|
|
338
|
-
|
|
339
|
-
|
|
487
|
+
* Do not use this option unless you trust the command being executed.
|
|
488
|
+
* The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
|
|
340
489
|
* @deprecated Replaced by withExec.
|
|
341
490
|
*/
|
|
342
491
|
exec(opts?: ContainerExecOpts): Container;
|
|
@@ -346,22 +495,32 @@ export declare class Container extends BaseClient {
|
|
|
346
495
|
*/
|
|
347
496
|
exitCode(): Promise<number>;
|
|
348
497
|
/**
|
|
349
|
-
* Writes the container as an OCI tarball to the destination file path on the host for the specified
|
|
498
|
+
* Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants.
|
|
499
|
+
*
|
|
350
500
|
* Return true on success.
|
|
351
|
-
*
|
|
352
|
-
|
|
501
|
+
* It can also publishes platform variants.
|
|
502
|
+
* @param path Host's destination path (e.g., "./tarball").
|
|
503
|
+
* Path can be relative to the engine's workdir or absolute.
|
|
353
504
|
* @param opts.platformVariants Identifiers for other platform specific containers.
|
|
354
|
-
|
|
505
|
+
* Used for multi-platform image.
|
|
355
506
|
*/
|
|
356
507
|
export(path: string, opts?: ContainerExportOpts): Promise<boolean>;
|
|
357
508
|
/**
|
|
358
|
-
* Retrieves
|
|
509
|
+
* Retrieves the list of exposed ports
|
|
510
|
+
*/
|
|
511
|
+
exposedPorts(): Promise<Port[]>;
|
|
512
|
+
/**
|
|
513
|
+
* Retrieves a file at the given path.
|
|
514
|
+
*
|
|
515
|
+
* Mounts are included.
|
|
516
|
+
* @param path The path of the file to retrieve (e.g., "./README.md").
|
|
359
517
|
*/
|
|
360
518
|
file(path: string): File;
|
|
361
519
|
/**
|
|
362
|
-
* Initializes this container from
|
|
520
|
+
* Initializes this container from a pulled base image.
|
|
363
521
|
* @param address Image's address from its registry.
|
|
364
|
-
|
|
522
|
+
*
|
|
523
|
+
* Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").
|
|
365
524
|
*/
|
|
366
525
|
from(address: string): Container;
|
|
367
526
|
/**
|
|
@@ -369,10 +528,18 @@ export declare class Container extends BaseClient {
|
|
|
369
528
|
* @deprecated Replaced by rootfs.
|
|
370
529
|
*/
|
|
371
530
|
fs(): Directory;
|
|
531
|
+
/**
|
|
532
|
+
* Retrieves a hostname which can be used by clients to reach this container.
|
|
533
|
+
*/
|
|
534
|
+
hostname(): Promise<string>;
|
|
372
535
|
/**
|
|
373
536
|
* A unique identifier for this container.
|
|
374
537
|
*/
|
|
375
538
|
id(): Promise<ContainerID>;
|
|
539
|
+
/**
|
|
540
|
+
* The unique image reference which can only be retrieved immediately after the 'Container.From' call.
|
|
541
|
+
*/
|
|
542
|
+
imageRef(): Promise<string>;
|
|
376
543
|
/**
|
|
377
544
|
* Retrieves the value of the specified label.
|
|
378
545
|
*/
|
|
@@ -394,11 +561,15 @@ export declare class Container extends BaseClient {
|
|
|
394
561
|
*/
|
|
395
562
|
platform(): Promise<Platform>;
|
|
396
563
|
/**
|
|
397
|
-
* Publishes this container as a new image to the specified address
|
|
564
|
+
* Publishes this container as a new image to the specified address.
|
|
565
|
+
*
|
|
566
|
+
* Publish returns a fully qualified ref.
|
|
567
|
+
* It can also publish platform variants.
|
|
398
568
|
* @param address Registry's address to publish the image to.
|
|
399
|
-
|
|
569
|
+
*
|
|
570
|
+
* Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").
|
|
400
571
|
* @param opts.platformVariants Identifiers for other platform specific containers.
|
|
401
|
-
|
|
572
|
+
* Used for multi-platform image.
|
|
402
573
|
*/
|
|
403
574
|
publish(address: string, opts?: ContainerPublishOpts): Promise<string>;
|
|
404
575
|
/**
|
|
@@ -421,31 +592,50 @@ export declare class Container extends BaseClient {
|
|
|
421
592
|
user(): Promise<string>;
|
|
422
593
|
/**
|
|
423
594
|
* Configures default arguments for future commands.
|
|
595
|
+
* @param opts.args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
|
|
424
596
|
*/
|
|
425
597
|
withDefaultArgs(opts?: ContainerWithDefaultArgsOpts): Container;
|
|
426
598
|
/**
|
|
427
599
|
* Retrieves this container plus a directory written at the given path.
|
|
600
|
+
* @param path Location of the written directory (e.g., "/tmp/directory").
|
|
601
|
+
* @param directory Identifier of the directory to write
|
|
602
|
+
* @param opts.exclude Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
|
|
603
|
+
* @param opts.include Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
|
|
428
604
|
*/
|
|
429
605
|
withDirectory(path: string, directory: Directory, opts?: ContainerWithDirectoryOpts): Container;
|
|
430
606
|
/**
|
|
431
607
|
* Retrieves this container but with a different command entrypoint.
|
|
608
|
+
* @param args Entrypoint to use for future executions (e.g., ["go", "run"]).
|
|
432
609
|
*/
|
|
433
610
|
withEntrypoint(args: string[]): Container;
|
|
434
611
|
/**
|
|
435
612
|
* Retrieves this container plus the given environment variable.
|
|
613
|
+
* @param name The name of the environment variable (e.g., "HOST").
|
|
614
|
+
* @param value The value of the environment variable. (e.g., "localhost").
|
|
436
615
|
*/
|
|
437
616
|
withEnvVariable(name: string, value: string): Container;
|
|
438
617
|
/**
|
|
439
618
|
* Retrieves this container after executing the specified command inside it.
|
|
440
|
-
* @param args Command to run instead of the container's default command.
|
|
441
|
-
* @param opts.stdin Content to write to the command's standard input before closing.
|
|
442
|
-
* @param opts.redirectStdout Redirect the command's standard output to a file in the container.
|
|
443
|
-
* @param opts.redirectStderr Redirect the command's standard error to a file in the container.
|
|
444
|
-
* @param opts.experimentalPrivilegedNesting
|
|
445
|
-
|
|
446
|
-
|
|
619
|
+
* @param args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
|
|
620
|
+
* @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
|
|
621
|
+
* @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
|
|
622
|
+
* @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
|
|
623
|
+
* @param opts.experimentalPrivilegedNesting Provides dagger access to the executed command.
|
|
624
|
+
*
|
|
625
|
+
* Do not use this option unless you trust the command being executed.
|
|
626
|
+
* The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
|
|
447
627
|
*/
|
|
448
628
|
withExec(args: string[], opts?: ContainerWithExecOpts): Container;
|
|
629
|
+
/**
|
|
630
|
+
* Expose a network port.
|
|
631
|
+
* Exposed ports serve two purposes:
|
|
632
|
+
* - For health checks and introspection, when running services
|
|
633
|
+
* - For setting the EXPOSE OCI field when publishing the container
|
|
634
|
+
* @param port Port number to expose
|
|
635
|
+
* @param opts.protocol Transport layer network protocol
|
|
636
|
+
* @param opts.description Optional port description
|
|
637
|
+
*/
|
|
638
|
+
withExposedPort(port: number, opts?: ContainerWithExposedPortOpts): Container;
|
|
449
639
|
/**
|
|
450
640
|
* Initializes this container from this DirectoryID.
|
|
451
641
|
* @deprecated Replaced by withRootfs.
|
|
@@ -453,44 +643,63 @@ export declare class Container extends BaseClient {
|
|
|
453
643
|
withFS(id: Directory): Container;
|
|
454
644
|
/**
|
|
455
645
|
* Retrieves this container plus the contents of the given file copied to the given path.
|
|
646
|
+
* @param path Location of the copied file (e.g., "/tmp/file.txt").
|
|
647
|
+
* @param source Identifier of the file to copy.
|
|
648
|
+
* @param opts.permissions Permission given to the copied file (e.g., 0600).
|
|
649
|
+
*
|
|
650
|
+
* Default: 0644.
|
|
456
651
|
*/
|
|
457
652
|
withFile(path: string, source: File, opts?: ContainerWithFileOpts): Container;
|
|
458
653
|
/**
|
|
459
654
|
* Retrieves this container plus the given label.
|
|
655
|
+
* @param name The name of the label (e.g., "org.opencontainers.artifact.created").
|
|
656
|
+
* @param value The value of the label (e.g., "2023-01-01T00:00:00Z").
|
|
460
657
|
*/
|
|
461
658
|
withLabel(name: string, value: string): Container;
|
|
462
659
|
/**
|
|
463
660
|
* Retrieves this container plus a cache volume mounted at the given path.
|
|
464
|
-
* @param path
|
|
465
|
-
* @param cache
|
|
466
|
-
* @param opts.source
|
|
661
|
+
* @param path Location of the cache directory (e.g., "/cache/node_modules").
|
|
662
|
+
* @param cache Identifier of the cache volume to mount.
|
|
663
|
+
* @param opts.source Identifier of the directory to use as the cache volume's root.
|
|
467
664
|
* @param opts.sharing Sharing mode of the cache volume.
|
|
468
665
|
*/
|
|
469
666
|
withMountedCache(path: string, cache: CacheVolume, opts?: ContainerWithMountedCacheOpts): Container;
|
|
470
667
|
/**
|
|
471
668
|
* Retrieves this container plus a directory mounted at the given path.
|
|
669
|
+
* @param path Location of the mounted directory (e.g., "/mnt/directory").
|
|
670
|
+
* @param source Identifier of the mounted directory.
|
|
472
671
|
*/
|
|
473
672
|
withMountedDirectory(path: string, source: Directory): Container;
|
|
474
673
|
/**
|
|
475
674
|
* Retrieves this container plus a file mounted at the given path.
|
|
675
|
+
* @param path Location of the mounted file (e.g., "/tmp/file.txt").
|
|
676
|
+
* @param source Identifier of the mounted file.
|
|
476
677
|
*/
|
|
477
678
|
withMountedFile(path: string, source: File): Container;
|
|
478
679
|
/**
|
|
479
680
|
* Retrieves this container plus a secret mounted into a file at the given path.
|
|
681
|
+
* @param path Location of the secret file (e.g., "/tmp/secret.txt").
|
|
682
|
+
* @param source Identifier of the secret to mount.
|
|
480
683
|
*/
|
|
481
684
|
withMountedSecret(path: string, source: Secret): Container;
|
|
482
685
|
/**
|
|
483
686
|
* Retrieves this container plus a temporary directory mounted at the given path.
|
|
687
|
+
* @param path Location of the temporary directory (e.g., "/tmp/temp_dir").
|
|
484
688
|
*/
|
|
485
689
|
withMountedTemp(path: string): Container;
|
|
486
690
|
/**
|
|
487
691
|
* Retrieves this container plus a new file written at the given path.
|
|
692
|
+
* @param path Location of the written file (e.g., "/tmp/file.txt").
|
|
693
|
+
* @param opts.contents Content of the file to write (e.g., "Hello world!").
|
|
694
|
+
* @param opts.permissions Permission given to the written file (e.g., 0600).
|
|
695
|
+
*
|
|
696
|
+
* Default: 0644.
|
|
488
697
|
*/
|
|
489
698
|
withNewFile(path: string, opts?: ContainerWithNewFileOpts): Container;
|
|
490
699
|
/**
|
|
491
700
|
* Retrieves this container with a registry authentication for a given address.
|
|
492
701
|
* @param address Registry's address to bind the authentication to.
|
|
493
|
-
|
|
702
|
+
* Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
|
494
703
|
* @param username The username of the registry's account (e.g., "Dagger").
|
|
495
704
|
* @param secret The API key, password or token to authenticate to this registry.
|
|
496
705
|
*/
|
|
@@ -501,46 +710,94 @@ export declare class Container extends BaseClient {
|
|
|
501
710
|
withRootfs(id: Directory): Container;
|
|
502
711
|
/**
|
|
503
712
|
* Retrieves this container plus an env variable containing the given secret.
|
|
713
|
+
* @param name The name of the secret variable (e.g., "API_SECRET").
|
|
714
|
+
* @param secret The identifier of the secret value.
|
|
504
715
|
*/
|
|
505
716
|
withSecretVariable(name: string, secret: Secret): Container;
|
|
717
|
+
/**
|
|
718
|
+
* Establish a runtime dependency on a service. The service will be started automatically when needed and detached when it is no longer needed.
|
|
719
|
+
*
|
|
720
|
+
* The service will be reachable from the container via the provided hostname alias.
|
|
721
|
+
*
|
|
722
|
+
* The service dependency will also convey to any files or directories produced by the container.
|
|
723
|
+
* @param alias A name that can be used to reach the service from the container
|
|
724
|
+
* @param service Identifier of the service container
|
|
725
|
+
*/
|
|
726
|
+
withServiceBinding(alias: string, service: Container): Container;
|
|
506
727
|
/**
|
|
507
728
|
* Retrieves this container plus a socket forwarded to the given Unix socket path.
|
|
729
|
+
* @param path Location of the forwarded Unix socket (e.g., "/tmp/socket").
|
|
730
|
+
* @param source Identifier of the socket to forward.
|
|
508
731
|
*/
|
|
509
732
|
withUnixSocket(path: string, source: Socket): Container;
|
|
510
733
|
/**
|
|
511
|
-
* Retrieves this
|
|
734
|
+
* Retrieves this container with a different command user.
|
|
735
|
+
* @param name The user to set (e.g., "root").
|
|
512
736
|
*/
|
|
513
737
|
withUser(name: string): Container;
|
|
514
738
|
/**
|
|
515
739
|
* Retrieves this container with a different working directory.
|
|
740
|
+
* @param path The path to set as the working directory (e.g., "/app").
|
|
516
741
|
*/
|
|
517
742
|
withWorkdir(path: string): Container;
|
|
518
743
|
/**
|
|
519
744
|
* Retrieves this container minus the given environment variable.
|
|
745
|
+
* @param name The name of the environment variable (e.g., "HOST").
|
|
520
746
|
*/
|
|
521
747
|
withoutEnvVariable(name: string): Container;
|
|
748
|
+
/**
|
|
749
|
+
* Unexpose a previously exposed port.
|
|
750
|
+
* @param port Port number to unexpose
|
|
751
|
+
* @param opts.protocol Port protocol to unexpose
|
|
752
|
+
*/
|
|
753
|
+
withoutExposedPort(port: number, opts?: ContainerWithoutExposedPortOpts): Container;
|
|
522
754
|
/**
|
|
523
755
|
* Retrieves this container minus the given environment label.
|
|
756
|
+
* @param name The name of the label to remove (e.g., "org.opencontainers.artifact.created").
|
|
524
757
|
*/
|
|
525
758
|
withoutLabel(name: string): Container;
|
|
526
759
|
/**
|
|
527
760
|
* Retrieves this container after unmounting everything at the given path.
|
|
761
|
+
* @param path Location of the cache directory (e.g., "/cache/node_modules").
|
|
528
762
|
*/
|
|
529
763
|
withoutMount(path: string): Container;
|
|
530
764
|
/**
|
|
531
765
|
* Retrieves this container without the registry authentication of a given address.
|
|
532
766
|
* @param address Registry's address to remove the authentication from.
|
|
533
|
-
|
|
767
|
+
* Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
|
534
768
|
*/
|
|
535
769
|
withoutRegistryAuth(address: string): Container;
|
|
536
770
|
/**
|
|
537
771
|
* Retrieves this container with a previously added Unix socket removed.
|
|
772
|
+
* @param path Location of the socket to remove (e.g., "/tmp/socket").
|
|
538
773
|
*/
|
|
539
774
|
withoutUnixSocket(path: string): Container;
|
|
540
775
|
/**
|
|
541
776
|
* Retrieves the working directory for all commands.
|
|
542
777
|
*/
|
|
543
778
|
workdir(): Promise<string>;
|
|
779
|
+
/**
|
|
780
|
+
* Chain objects together
|
|
781
|
+
* @example
|
|
782
|
+
* ```ts
|
|
783
|
+
* function AddAFewMounts(c) {
|
|
784
|
+
* return c
|
|
785
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
786
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
787
|
+
* }
|
|
788
|
+
*
|
|
789
|
+
* connect(async (client) => {
|
|
790
|
+
* const tree = await client
|
|
791
|
+
* .container()
|
|
792
|
+
* .from("alpine")
|
|
793
|
+
* .withWorkdir("/foo")
|
|
794
|
+
* .with(AddAFewMounts)
|
|
795
|
+
* .withExec(["ls", "-lh"])
|
|
796
|
+
* .stdout()
|
|
797
|
+
* })
|
|
798
|
+
*```
|
|
799
|
+
*/
|
|
800
|
+
with(arg: (param: Container) => Container): Container;
|
|
544
801
|
}
|
|
545
802
|
/**
|
|
546
803
|
* A directory.
|
|
@@ -548,31 +805,37 @@ export declare class Container extends BaseClient {
|
|
|
548
805
|
export declare class Directory extends BaseClient {
|
|
549
806
|
/**
|
|
550
807
|
* Gets the difference between this directory and an another directory.
|
|
808
|
+
* @param other Identifier of the directory to compare.
|
|
551
809
|
*/
|
|
552
810
|
diff(other: Directory): Directory;
|
|
553
811
|
/**
|
|
554
812
|
* Retrieves a directory at the given path.
|
|
813
|
+
* @param path Location of the directory to retrieve (e.g., "/src").
|
|
555
814
|
*/
|
|
556
815
|
directory(path: string): Directory;
|
|
557
816
|
/**
|
|
558
817
|
* Builds a new Docker container from this directory.
|
|
559
|
-
* @param opts.dockerfile Path to the Dockerfile to use.
|
|
560
|
-
|
|
818
|
+
* @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
|
|
819
|
+
*
|
|
820
|
+
* Defaults: './Dockerfile'.
|
|
561
821
|
* @param opts.platform The platform to build.
|
|
562
|
-
* @param opts.buildArgs
|
|
822
|
+
* @param opts.buildArgs Build arguments to use in the build.
|
|
563
823
|
* @param opts.target Target build stage to build.
|
|
564
824
|
*/
|
|
565
825
|
dockerBuild(opts?: DirectoryDockerBuildOpts): Container;
|
|
566
826
|
/**
|
|
567
827
|
* Returns a list of files and directories at the given path.
|
|
828
|
+
* @param opts.path Location of the directory to look at (e.g., "/src").
|
|
568
829
|
*/
|
|
569
830
|
entries(opts?: DirectoryEntriesOpts): Promise<string[]>;
|
|
570
831
|
/**
|
|
571
832
|
* Writes the contents of the directory to a path on the host.
|
|
833
|
+
* @param path Location of the copied directory (e.g., "logs/").
|
|
572
834
|
*/
|
|
573
835
|
export(path: string): Promise<boolean>;
|
|
574
836
|
/**
|
|
575
837
|
* Retrieves a file at the given path.
|
|
838
|
+
* @param path Location of the file to retrieve (e.g., "README.md").
|
|
576
839
|
*/
|
|
577
840
|
file(path: string): File;
|
|
578
841
|
/**
|
|
@@ -589,36 +852,77 @@ export declare class Directory extends BaseClient {
|
|
|
589
852
|
pipeline(name: string, opts?: DirectoryPipelineOpts): Directory;
|
|
590
853
|
/**
|
|
591
854
|
* Retrieves this directory plus a directory written at the given path.
|
|
592
|
-
* @param
|
|
593
|
-
|
|
594
|
-
* @param opts.
|
|
595
|
-
|
|
855
|
+
* @param path Location of the written directory (e.g., "/src/").
|
|
856
|
+
* @param directory Identifier of the directory to copy.
|
|
857
|
+
* @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
|
|
858
|
+
* @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
|
|
596
859
|
*/
|
|
597
860
|
withDirectory(path: string, directory: Directory, opts?: DirectoryWithDirectoryOpts): Directory;
|
|
598
861
|
/**
|
|
599
862
|
* Retrieves this directory plus the contents of the given file copied to the given path.
|
|
863
|
+
* @param path Location of the copied file (e.g., "/file.txt").
|
|
864
|
+
* @param source Identifier of the file to copy.
|
|
865
|
+
* @param opts.permissions Permission given to the copied file (e.g., 0600).
|
|
866
|
+
*
|
|
867
|
+
* Default: 0644.
|
|
600
868
|
*/
|
|
601
869
|
withFile(path: string, source: File, opts?: DirectoryWithFileOpts): Directory;
|
|
602
870
|
/**
|
|
603
871
|
* Retrieves this directory plus a new directory created at the given path.
|
|
872
|
+
* @param path Location of the directory created (e.g., "/logs").
|
|
873
|
+
* @param opts.permissions Permission granted to the created directory (e.g., 0777).
|
|
874
|
+
*
|
|
875
|
+
* Default: 0755.
|
|
604
876
|
*/
|
|
605
877
|
withNewDirectory(path: string, opts?: DirectoryWithNewDirectoryOpts): Directory;
|
|
606
878
|
/**
|
|
607
879
|
* Retrieves this directory plus a new file written at the given path.
|
|
880
|
+
* @param path Location of the written file (e.g., "/file.txt").
|
|
881
|
+
* @param contents Content of the written file (e.g., "Hello world!").
|
|
882
|
+
* @param opts.permissions Permission given to the copied file (e.g., 0600).
|
|
883
|
+
*
|
|
884
|
+
* Default: 0644.
|
|
608
885
|
*/
|
|
609
886
|
withNewFile(path: string, contents: string, opts?: DirectoryWithNewFileOpts): Directory;
|
|
610
887
|
/**
|
|
611
|
-
* Retrieves this directory with all file/dir timestamps set to the given time
|
|
888
|
+
* Retrieves this directory with all file/dir timestamps set to the given time.
|
|
889
|
+
* @param timestamp Timestamp to set dir/files in.
|
|
890
|
+
*
|
|
891
|
+
* Formatted in seconds following Unix epoch (e.g., 1672531199).
|
|
612
892
|
*/
|
|
613
893
|
withTimestamps(timestamp: number): Directory;
|
|
614
894
|
/**
|
|
615
895
|
* Retrieves this directory with the directory at the given path removed.
|
|
896
|
+
* @param path Location of the directory to remove (e.g., ".github/").
|
|
616
897
|
*/
|
|
617
898
|
withoutDirectory(path: string): Directory;
|
|
618
899
|
/**
|
|
619
900
|
* Retrieves this directory with the file at the given path removed.
|
|
901
|
+
* @param path Location of the file to remove (e.g., "/file.txt").
|
|
620
902
|
*/
|
|
621
903
|
withoutFile(path: string): Directory;
|
|
904
|
+
/**
|
|
905
|
+
* Chain objects together
|
|
906
|
+
* @example
|
|
907
|
+
* ```ts
|
|
908
|
+
* function AddAFewMounts(c) {
|
|
909
|
+
* return c
|
|
910
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
911
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
912
|
+
* }
|
|
913
|
+
*
|
|
914
|
+
* connect(async (client) => {
|
|
915
|
+
* const tree = await client
|
|
916
|
+
* .container()
|
|
917
|
+
* .from("alpine")
|
|
918
|
+
* .withWorkdir("/foo")
|
|
919
|
+
* .with(AddAFewMounts)
|
|
920
|
+
* .withExec(["ls", "-lh"])
|
|
921
|
+
* .stdout()
|
|
922
|
+
* })
|
|
923
|
+
*```
|
|
924
|
+
*/
|
|
925
|
+
with(arg: (param: Directory) => Directory): Directory;
|
|
622
926
|
}
|
|
623
927
|
/**
|
|
624
928
|
* A simple key value object that represents an environment variable.
|
|
@@ -632,6 +936,28 @@ export declare class EnvVariable extends BaseClient {
|
|
|
632
936
|
* The environment variable value.
|
|
633
937
|
*/
|
|
634
938
|
value(): Promise<string>;
|
|
939
|
+
/**
|
|
940
|
+
* Chain objects together
|
|
941
|
+
* @example
|
|
942
|
+
* ```ts
|
|
943
|
+
* function AddAFewMounts(c) {
|
|
944
|
+
* return c
|
|
945
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
946
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
947
|
+
* }
|
|
948
|
+
*
|
|
949
|
+
* connect(async (client) => {
|
|
950
|
+
* const tree = await client
|
|
951
|
+
* .container()
|
|
952
|
+
* .from("alpine")
|
|
953
|
+
* .withWorkdir("/foo")
|
|
954
|
+
* .with(AddAFewMounts)
|
|
955
|
+
* .withExec(["ls", "-lh"])
|
|
956
|
+
* .stdout()
|
|
957
|
+
* })
|
|
958
|
+
*```
|
|
959
|
+
*/
|
|
960
|
+
with(arg: (param: EnvVariable) => EnvVariable): EnvVariable;
|
|
635
961
|
}
|
|
636
962
|
/**
|
|
637
963
|
* A file.
|
|
@@ -643,6 +969,7 @@ export declare class File extends BaseClient {
|
|
|
643
969
|
contents(): Promise<string>;
|
|
644
970
|
/**
|
|
645
971
|
* Writes the file to a file path on the host.
|
|
972
|
+
* @param path Location of the written directory (e.g., "output.txt").
|
|
646
973
|
*/
|
|
647
974
|
export(path: string): Promise<boolean>;
|
|
648
975
|
/**
|
|
@@ -658,9 +985,34 @@ export declare class File extends BaseClient {
|
|
|
658
985
|
*/
|
|
659
986
|
size(): Promise<number>;
|
|
660
987
|
/**
|
|
661
|
-
* Retrieves this file with its created/modified timestamps set to the given time
|
|
988
|
+
* Retrieves this file with its created/modified timestamps set to the given time.
|
|
989
|
+
* @param timestamp Timestamp to set dir/files in.
|
|
990
|
+
*
|
|
991
|
+
* Formatted in seconds following Unix epoch (e.g., 1672531199).
|
|
662
992
|
*/
|
|
663
993
|
withTimestamps(timestamp: number): File;
|
|
994
|
+
/**
|
|
995
|
+
* Chain objects together
|
|
996
|
+
* @example
|
|
997
|
+
* ```ts
|
|
998
|
+
* function AddAFewMounts(c) {
|
|
999
|
+
* return c
|
|
1000
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1001
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1002
|
+
* }
|
|
1003
|
+
*
|
|
1004
|
+
* connect(async (client) => {
|
|
1005
|
+
* const tree = await client
|
|
1006
|
+
* .container()
|
|
1007
|
+
* .from("alpine")
|
|
1008
|
+
* .withWorkdir("/foo")
|
|
1009
|
+
* .with(AddAFewMounts)
|
|
1010
|
+
* .withExec(["ls", "-lh"])
|
|
1011
|
+
* .stdout()
|
|
1012
|
+
* })
|
|
1013
|
+
*```
|
|
1014
|
+
*/
|
|
1015
|
+
with(arg: (param: File) => File): File;
|
|
664
1016
|
}
|
|
665
1017
|
/**
|
|
666
1018
|
* A git ref (tag, branch or commit).
|
|
@@ -674,6 +1026,28 @@ export declare class GitRef extends BaseClient {
|
|
|
674
1026
|
* The filesystem tree at this ref.
|
|
675
1027
|
*/
|
|
676
1028
|
tree(opts?: GitRefTreeOpts): Directory;
|
|
1029
|
+
/**
|
|
1030
|
+
* Chain objects together
|
|
1031
|
+
* @example
|
|
1032
|
+
* ```ts
|
|
1033
|
+
* function AddAFewMounts(c) {
|
|
1034
|
+
* return c
|
|
1035
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1036
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1037
|
+
* }
|
|
1038
|
+
*
|
|
1039
|
+
* connect(async (client) => {
|
|
1040
|
+
* const tree = await client
|
|
1041
|
+
* .container()
|
|
1042
|
+
* .from("alpine")
|
|
1043
|
+
* .withWorkdir("/foo")
|
|
1044
|
+
* .with(AddAFewMounts)
|
|
1045
|
+
* .withExec(["ls", "-lh"])
|
|
1046
|
+
* .stdout()
|
|
1047
|
+
* })
|
|
1048
|
+
*```
|
|
1049
|
+
*/
|
|
1050
|
+
with(arg: (param: GitRef) => GitRef): GitRef;
|
|
677
1051
|
}
|
|
678
1052
|
/**
|
|
679
1053
|
* A git repository.
|
|
@@ -681,6 +1055,7 @@ export declare class GitRef extends BaseClient {
|
|
|
681
1055
|
export declare class GitRepository extends BaseClient {
|
|
682
1056
|
/**
|
|
683
1057
|
* Returns details on one branch.
|
|
1058
|
+
* @param name Branch's name (e.g., "main").
|
|
684
1059
|
*/
|
|
685
1060
|
branch(name: string): GitRef;
|
|
686
1061
|
/**
|
|
@@ -689,16 +1064,40 @@ export declare class GitRepository extends BaseClient {
|
|
|
689
1064
|
branches(): Promise<string[]>;
|
|
690
1065
|
/**
|
|
691
1066
|
* Returns details on one commit.
|
|
1067
|
+
* @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").
|
|
692
1068
|
*/
|
|
693
1069
|
commit(id: string): GitRef;
|
|
694
1070
|
/**
|
|
695
1071
|
* Returns details on one tag.
|
|
1072
|
+
* @param name Tag's name (e.g., "v0.3.9").
|
|
696
1073
|
*/
|
|
697
1074
|
tag(name: string): GitRef;
|
|
698
1075
|
/**
|
|
699
1076
|
* Lists of tags on the repository.
|
|
700
1077
|
*/
|
|
701
1078
|
tags(): Promise<string[]>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Chain objects together
|
|
1081
|
+
* @example
|
|
1082
|
+
* ```ts
|
|
1083
|
+
* function AddAFewMounts(c) {
|
|
1084
|
+
* return c
|
|
1085
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1086
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1087
|
+
* }
|
|
1088
|
+
*
|
|
1089
|
+
* connect(async (client) => {
|
|
1090
|
+
* const tree = await client
|
|
1091
|
+
* .container()
|
|
1092
|
+
* .from("alpine")
|
|
1093
|
+
* .withWorkdir("/foo")
|
|
1094
|
+
* .with(AddAFewMounts)
|
|
1095
|
+
* .withExec(["ls", "-lh"])
|
|
1096
|
+
* .stdout()
|
|
1097
|
+
* })
|
|
1098
|
+
*```
|
|
1099
|
+
*/
|
|
1100
|
+
with(arg: (param: GitRepository) => GitRepository): GitRepository;
|
|
702
1101
|
}
|
|
703
1102
|
/**
|
|
704
1103
|
* Information about the host execution environment.
|
|
@@ -706,21 +1105,50 @@ export declare class GitRepository extends BaseClient {
|
|
|
706
1105
|
export declare class Host extends BaseClient {
|
|
707
1106
|
/**
|
|
708
1107
|
* Accesses a directory on the host.
|
|
1108
|
+
* @param path Location of the directory to access (e.g., ".").
|
|
1109
|
+
* @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
|
|
1110
|
+
* @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
|
|
709
1111
|
*/
|
|
710
1112
|
directory(path: string, opts?: HostDirectoryOpts): Directory;
|
|
711
1113
|
/**
|
|
712
1114
|
* Accesses an environment variable on the host.
|
|
1115
|
+
* @param name Name of the environment variable (e.g., "PATH").
|
|
713
1116
|
*/
|
|
714
1117
|
envVariable(name: string): HostVariable;
|
|
715
1118
|
/**
|
|
716
1119
|
* Accesses a Unix socket on the host.
|
|
1120
|
+
* @param path Location of the Unix socket (e.g., "/var/run/docker.sock").
|
|
717
1121
|
*/
|
|
718
1122
|
unixSocket(path: string): Socket;
|
|
719
1123
|
/**
|
|
720
1124
|
* Retrieves the current working directory on the host.
|
|
1125
|
+
* @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
|
|
1126
|
+
* @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
|
|
721
1127
|
* @deprecated Use directory with path set to '.' instead.
|
|
722
1128
|
*/
|
|
723
1129
|
workdir(opts?: HostWorkdirOpts): Directory;
|
|
1130
|
+
/**
|
|
1131
|
+
* Chain objects together
|
|
1132
|
+
* @example
|
|
1133
|
+
* ```ts
|
|
1134
|
+
* function AddAFewMounts(c) {
|
|
1135
|
+
* return c
|
|
1136
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1137
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1138
|
+
* }
|
|
1139
|
+
*
|
|
1140
|
+
* connect(async (client) => {
|
|
1141
|
+
* const tree = await client
|
|
1142
|
+
* .container()
|
|
1143
|
+
* .from("alpine")
|
|
1144
|
+
* .withWorkdir("/foo")
|
|
1145
|
+
* .with(AddAFewMounts)
|
|
1146
|
+
* .withExec(["ls", "-lh"])
|
|
1147
|
+
* .stdout()
|
|
1148
|
+
* })
|
|
1149
|
+
*```
|
|
1150
|
+
*/
|
|
1151
|
+
with(arg: (param: Host) => Host): Host;
|
|
724
1152
|
}
|
|
725
1153
|
/**
|
|
726
1154
|
* An environment variable on the host environment.
|
|
@@ -734,6 +1162,28 @@ export declare class HostVariable extends BaseClient {
|
|
|
734
1162
|
* The value of this variable.
|
|
735
1163
|
*/
|
|
736
1164
|
value(): Promise<string>;
|
|
1165
|
+
/**
|
|
1166
|
+
* Chain objects together
|
|
1167
|
+
* @example
|
|
1168
|
+
* ```ts
|
|
1169
|
+
* function AddAFewMounts(c) {
|
|
1170
|
+
* return c
|
|
1171
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1172
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1173
|
+
* }
|
|
1174
|
+
*
|
|
1175
|
+
* connect(async (client) => {
|
|
1176
|
+
* const tree = await client
|
|
1177
|
+
* .container()
|
|
1178
|
+
* .from("alpine")
|
|
1179
|
+
* .withWorkdir("/foo")
|
|
1180
|
+
* .with(AddAFewMounts)
|
|
1181
|
+
* .withExec(["ls", "-lh"])
|
|
1182
|
+
* .stdout()
|
|
1183
|
+
* })
|
|
1184
|
+
*```
|
|
1185
|
+
*/
|
|
1186
|
+
with(arg: (param: HostVariable) => HostVariable): HostVariable;
|
|
737
1187
|
}
|
|
738
1188
|
/**
|
|
739
1189
|
* A simple key value object that represents a label.
|
|
@@ -747,6 +1197,67 @@ export declare class Label extends BaseClient {
|
|
|
747
1197
|
* The label value.
|
|
748
1198
|
*/
|
|
749
1199
|
value(): Promise<string>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Chain objects together
|
|
1202
|
+
* @example
|
|
1203
|
+
* ```ts
|
|
1204
|
+
* function AddAFewMounts(c) {
|
|
1205
|
+
* return c
|
|
1206
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1207
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1208
|
+
* }
|
|
1209
|
+
*
|
|
1210
|
+
* connect(async (client) => {
|
|
1211
|
+
* const tree = await client
|
|
1212
|
+
* .container()
|
|
1213
|
+
* .from("alpine")
|
|
1214
|
+
* .withWorkdir("/foo")
|
|
1215
|
+
* .with(AddAFewMounts)
|
|
1216
|
+
* .withExec(["ls", "-lh"])
|
|
1217
|
+
* .stdout()
|
|
1218
|
+
* })
|
|
1219
|
+
*```
|
|
1220
|
+
*/
|
|
1221
|
+
with(arg: (param: Label) => Label): Label;
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* A port exposed by a container.
|
|
1225
|
+
*/
|
|
1226
|
+
export declare class Port extends BaseClient {
|
|
1227
|
+
/**
|
|
1228
|
+
* The port description.
|
|
1229
|
+
*/
|
|
1230
|
+
description(): Promise<string>;
|
|
1231
|
+
/**
|
|
1232
|
+
* The port number.
|
|
1233
|
+
*/
|
|
1234
|
+
port(): Promise<number>;
|
|
1235
|
+
/**
|
|
1236
|
+
* The transport layer network protocol.
|
|
1237
|
+
*/
|
|
1238
|
+
protocol(): Promise<NetworkProtocol>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Chain objects together
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```ts
|
|
1243
|
+
* function AddAFewMounts(c) {
|
|
1244
|
+
* return c
|
|
1245
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1246
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1247
|
+
* }
|
|
1248
|
+
*
|
|
1249
|
+
* connect(async (client) => {
|
|
1250
|
+
* const tree = await client
|
|
1251
|
+
* .container()
|
|
1252
|
+
* .from("alpine")
|
|
1253
|
+
* .withWorkdir("/foo")
|
|
1254
|
+
* .with(AddAFewMounts)
|
|
1255
|
+
* .withExec(["ls", "-lh"])
|
|
1256
|
+
* .stdout()
|
|
1257
|
+
* })
|
|
1258
|
+
*```
|
|
1259
|
+
*/
|
|
1260
|
+
with(arg: (param: Port) => Port): Port;
|
|
750
1261
|
}
|
|
751
1262
|
/**
|
|
752
1263
|
* A set of scripts and/or extensions
|
|
@@ -776,17 +1287,41 @@ export declare class Project extends BaseClient {
|
|
|
776
1287
|
* sdk used to generate code for and/or execute this project
|
|
777
1288
|
*/
|
|
778
1289
|
sdk(): Promise<string>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Chain objects together
|
|
1292
|
+
* @example
|
|
1293
|
+
* ```ts
|
|
1294
|
+
* function AddAFewMounts(c) {
|
|
1295
|
+
* return c
|
|
1296
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1297
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1298
|
+
* }
|
|
1299
|
+
*
|
|
1300
|
+
* connect(async (client) => {
|
|
1301
|
+
* const tree = await client
|
|
1302
|
+
* .container()
|
|
1303
|
+
* .from("alpine")
|
|
1304
|
+
* .withWorkdir("/foo")
|
|
1305
|
+
* .with(AddAFewMounts)
|
|
1306
|
+
* .withExec(["ls", "-lh"])
|
|
1307
|
+
* .stdout()
|
|
1308
|
+
* })
|
|
1309
|
+
*```
|
|
1310
|
+
*/
|
|
1311
|
+
with(arg: (param: Project) => Project): Project;
|
|
779
1312
|
}
|
|
780
1313
|
export default class Client extends BaseClient {
|
|
781
1314
|
/**
|
|
782
1315
|
* Constructs a cache volume for a given cache key.
|
|
783
|
-
* @param key A string identifier to target this cache volume (e.g
|
|
1316
|
+
* @param key A string identifier to target this cache volume (e.g., "modules-cache").
|
|
784
1317
|
*/
|
|
785
1318
|
cacheVolume(key: string): CacheVolume;
|
|
786
1319
|
/**
|
|
787
1320
|
* Loads a container from ID.
|
|
1321
|
+
*
|
|
788
1322
|
* Null ID returns an empty container (scratch).
|
|
789
|
-
* Optional platform argument initializes new containers to execute and publish as that platform.
|
|
1323
|
+
* Optional platform argument initializes new containers to execute and publish as that platform.
|
|
1324
|
+
* Platform defaults to that of the builder's host.
|
|
790
1325
|
*/
|
|
791
1326
|
container(opts?: ClientContainerOpts): Container;
|
|
792
1327
|
/**
|
|
@@ -803,6 +1338,11 @@ export default class Client extends BaseClient {
|
|
|
803
1338
|
file(id: FileID): File;
|
|
804
1339
|
/**
|
|
805
1340
|
* Queries a git repository.
|
|
1341
|
+
* @param url Url of the git repository.
|
|
1342
|
+
* Can be formatted as https://{host}/{owner}/{repo}, git@{host}/{owner}/{repo}
|
|
1343
|
+
* Suffix ".git" is optional.
|
|
1344
|
+
* @param opts.keepGitDir Set to true to keep .git directory.
|
|
1345
|
+
* @param opts.experimentalServiceHost A service which must be started before the repo is fetched.
|
|
806
1346
|
*/
|
|
807
1347
|
git(url: string, opts?: ClientGitOpts): GitRepository;
|
|
808
1348
|
/**
|
|
@@ -811,8 +1351,10 @@ export default class Client extends BaseClient {
|
|
|
811
1351
|
host(): Host;
|
|
812
1352
|
/**
|
|
813
1353
|
* Returns a file containing an http remote url content.
|
|
1354
|
+
* @param url HTTP url to get the content from (e.g., "https://docs.dagger.io").
|
|
1355
|
+
* @param opts.experimentalServiceHost A service which must be started before the URL is fetched.
|
|
814
1356
|
*/
|
|
815
|
-
http(url: string): File;
|
|
1357
|
+
http(url: string, opts?: ClientHttpOpts): File;
|
|
816
1358
|
/**
|
|
817
1359
|
* Creates a named sub-pipeline
|
|
818
1360
|
*/
|
|
@@ -842,12 +1384,56 @@ export declare class Secret extends BaseClient {
|
|
|
842
1384
|
* The value of this secret.
|
|
843
1385
|
*/
|
|
844
1386
|
plaintext(): Promise<string>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Chain objects together
|
|
1389
|
+
* @example
|
|
1390
|
+
* ```ts
|
|
1391
|
+
* function AddAFewMounts(c) {
|
|
1392
|
+
* return c
|
|
1393
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1394
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1395
|
+
* }
|
|
1396
|
+
*
|
|
1397
|
+
* connect(async (client) => {
|
|
1398
|
+
* const tree = await client
|
|
1399
|
+
* .container()
|
|
1400
|
+
* .from("alpine")
|
|
1401
|
+
* .withWorkdir("/foo")
|
|
1402
|
+
* .with(AddAFewMounts)
|
|
1403
|
+
* .withExec(["ls", "-lh"])
|
|
1404
|
+
* .stdout()
|
|
1405
|
+
* })
|
|
1406
|
+
*```
|
|
1407
|
+
*/
|
|
1408
|
+
with(arg: (param: Secret) => Secret): Secret;
|
|
845
1409
|
}
|
|
846
1410
|
export declare class Socket extends BaseClient {
|
|
847
1411
|
/**
|
|
848
1412
|
* The content-addressed identifier of the socket.
|
|
849
1413
|
*/
|
|
850
1414
|
id(): Promise<SocketID>;
|
|
1415
|
+
/**
|
|
1416
|
+
* Chain objects together
|
|
1417
|
+
* @example
|
|
1418
|
+
* ```ts
|
|
1419
|
+
* function AddAFewMounts(c) {
|
|
1420
|
+
* return c
|
|
1421
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1422
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1423
|
+
* }
|
|
1424
|
+
*
|
|
1425
|
+
* connect(async (client) => {
|
|
1426
|
+
* const tree = await client
|
|
1427
|
+
* .container()
|
|
1428
|
+
* .from("alpine")
|
|
1429
|
+
* .withWorkdir("/foo")
|
|
1430
|
+
* .with(AddAFewMounts)
|
|
1431
|
+
* .withExec(["ls", "-lh"])
|
|
1432
|
+
* .stdout()
|
|
1433
|
+
* })
|
|
1434
|
+
*```
|
|
1435
|
+
*/
|
|
1436
|
+
with(arg: (param: Socket) => Socket): Socket;
|
|
851
1437
|
}
|
|
852
1438
|
export {};
|
|
853
1439
|
//# sourceMappingURL=client.gen.d.ts.map
|