-
Notifications
You must be signed in to change notification settings - Fork 555
/
gen_sync.py
1264 lines (1078 loc) · 40.4 KB
/
gen_sync.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Code generated by dagger. DO NOT EDIT.
from typing import NewType
from dagger.api.base import Arg, Root, Type
CacheID = NewType("CacheID", str)
"""A global cache volume identifier"""
ContainerID = NewType("ContainerID", str)
"""A unique container identifier. Null designates an empty container (scratch)."""
DirectoryID = NewType("DirectoryID", str)
"""A content-addressed directory identifier"""
FileID = NewType("FileID", str)
Platform = NewType("Platform", str)
SecretID = NewType("SecretID", str)
"""A unique identifier for a secret"""
SocketID = NewType("SocketID", str)
"""A content-addressed socket identifier"""
class CacheVolume(Type):
"""A directory whose contents persist across runs"""
def id(self) -> CacheID:
"""Note
----
This is lazyly evaluated, no operation is actually run.
Returns
-------
CacheID
A global cache volume identifier
"""
_args: list[Arg] = []
_ctx = self._select("id", _args)
return _ctx.execute_sync(CacheID)
class Container(Type):
"""An OCI-compatible container, also known as a docker container"""
def build(self, context: "Directory", dockerfile: str | None = None) -> "Container":
"""Initialize this container from a Dockerfile build"""
_args = [
Arg("context", "context", context, Directory),
Arg("dockerfile", "dockerfile", dockerfile, str | None, None),
]
_ctx = self._select("build", _args)
return Container(_ctx)
def default_args(self) -> list[str] | None:
"""Default arguments for future commands
Returns
-------
list[str] | None
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("defaultArgs", _args)
return _ctx.execute_sync(list[str] | None)
def directory(self, path: str) -> "Directory":
"""Retrieve a directory at the given path. Mounts are included."""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("directory", _args)
return Directory(_ctx)
def entrypoint(self) -> list[str] | None:
"""Entrypoint to be prepended to the arguments of all commands
Returns
-------
list[str] | None
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("entrypoint", _args)
return _ctx.execute_sync(list[str] | None)
def env_variable(self, name: str) -> str | None:
"""The value of the specified environment variable
Returns
-------
str | None
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args = [
Arg("name", "name", name, str),
]
_ctx = self._select("envVariable", _args)
return _ctx.execute_sync(str | None)
def env_variables(self) -> "EnvVariable":
"""A list of environment variables passed to commands"""
_args: list[Arg] = []
_ctx = self._select("envVariables", _args)
return EnvVariable(_ctx)
def exec(
self,
args: list[str] | None = None,
stdin: str | None = None,
redirect_stdout: str | None = None,
redirect_stderr: str | None = None,
experimental_privileged_nesting: bool | None = None,
) -> "Container":
"""This container after executing the specified command inside it
.. deprecated::
Replaced by :py:meth:`with_exec`.
Parameters
----------
args:
Command to run instead of the container's default command
stdin:
Content to write to the command's standard input before closing
redirect_stdout:
Redirect the command's standard output to a file in the container
redirect_stderr:
Redirect the command's standard error to a file in the container
experimental_privileged_nesting:
Provide dagger access to the executed command
Do not use this option unless you trust the command being executed
The command being executed WILL BE GRANTED FULL ACCESS TO YOUR
HOST FILESYSTEM
"""
_args = [
Arg("args", "args", args, list[str] | None, None),
Arg("stdin", "stdin", stdin, str | None, None),
Arg("redirect_stdout", "redirectStdout", redirect_stdout, str | None, None),
Arg("redirect_stderr", "redirectStderr", redirect_stderr, str | None, None),
Arg(
"experimental_privileged_nesting",
"experimentalPrivilegedNesting",
experimental_privileged_nesting,
bool | None,
None,
),
]
_ctx = self._select("exec", _args)
return Container(_ctx)
def exit_code(self) -> int | None:
"""Exit code of the last executed command. Zero means success.
Null if no command has been executed.
Returns
-------
int | None
The `Int` scalar type represents non-fractional signed whole
numeric values. Int can represent values between -(2^31) and 2^31
- 1.
"""
_args: list[Arg] = []
_ctx = self._select("exitCode", _args)
return _ctx.execute_sync(int | None)
def export(
self, path: str, platform_variants: "list[Container] | None" = None
) -> bool:
"""Write the container as an OCI tarball to the destination file path on
the host
Returns
-------
bool
The `Boolean` scalar type represents `true` or `false`.
"""
_args = [
Arg("path", "path", path, str),
Arg(
"platform_variants",
"platformVariants",
platform_variants,
list[Container] | None,
None,
),
]
_ctx = self._select("export", _args)
return _ctx.execute_sync(bool)
def file(self, path: str) -> "File":
"""Retrieve a file at the given path. Mounts are included."""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("file", _args)
return File(_ctx)
def from_(self, address: str) -> "Container":
"""Initialize this container from the base image published at the given
address
"""
_args = [
Arg("address", "address", address, str),
]
_ctx = self._select("from", _args)
return Container(_ctx)
def fs(self) -> "Directory":
"""This container's root filesystem. Mounts are not included.
.. deprecated::
Replaced by :py:meth:`rootfs`.
"""
_args: list[Arg] = []
_ctx = self._select("fs", _args)
return Directory(_ctx)
def id(self) -> ContainerID:
"""A unique identifier for this container
Note
----
This is lazyly evaluated, no operation is actually run.
Returns
-------
ContainerID
A unique container identifier. Null designates an empty container
(scratch).
"""
_args: list[Arg] = []
_ctx = self._select("id", _args)
return _ctx.execute_sync(ContainerID)
def mounts(self) -> list[str]:
"""List of paths where a directory is mounted
Returns
-------
list[str]
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("mounts", _args)
return _ctx.execute_sync(list[str])
def platform(self) -> Platform:
"""The platform this container executes and publishes as"""
_args: list[Arg] = []
_ctx = self._select("platform", _args)
return _ctx.execute_sync(Platform)
def publish(
self, address: str, platform_variants: "list[Container] | None" = None
) -> str:
"""Publish this container as a new image, returning a fully qualified ref
Returns
-------
str
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args = [
Arg("address", "address", address, str),
Arg(
"platform_variants",
"platformVariants",
platform_variants,
list[Container] | None,
None,
),
]
_ctx = self._select("publish", _args)
return _ctx.execute_sync(str)
def rootfs(self) -> "Directory":
"""This container's root filesystem. Mounts are not included."""
_args: list[Arg] = []
_ctx = self._select("rootfs", _args)
return Directory(_ctx)
def stderr(self) -> str | None:
"""The error stream of the last executed command.
Null if no command has been executed.
Returns
-------
str | None
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("stderr", _args)
return _ctx.execute_sync(str | None)
def stdout(self) -> str | None:
"""The output stream of the last executed command.
Null if no command has been executed.
Returns
-------
str | None
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("stdout", _args)
return _ctx.execute_sync(str | None)
def user(self) -> str | None:
"""The user to be set for all commands
Returns
-------
str | None
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("user", _args)
return _ctx.execute_sync(str | None)
def with_default_args(self, args: list[str] | None = None) -> "Container":
"""Configures default arguments for future commands"""
_args = [
Arg("args", "args", args, list[str] | None, None),
]
_ctx = self._select("withDefaultArgs", _args)
return Container(_ctx)
def with_directory(
self,
path: str,
directory: "Directory",
exclude: list[str] | None = None,
include: list[str] | None = None,
) -> "Container":
"""This container plus a directory written at the given path"""
_args = [
Arg("path", "path", path, str),
Arg("directory", "directory", directory, Directory),
Arg("exclude", "exclude", exclude, list[str] | None, None),
Arg("include", "include", include, list[str] | None, None),
]
_ctx = self._select("withDirectory", _args)
return Container(_ctx)
def with_entrypoint(self, args: list[str]) -> "Container":
"""This container but with a different command entrypoint"""
_args = [
Arg("args", "args", args, list[str]),
]
_ctx = self._select("withEntrypoint", _args)
return Container(_ctx)
def with_env_variable(self, name: str, value: str) -> "Container":
"""This container plus the given environment variable"""
_args = [
Arg("name", "name", name, str),
Arg("value", "value", value, str),
]
_ctx = self._select("withEnvVariable", _args)
return Container(_ctx)
def with_exec(
self,
args: list[str],
stdin: str | None = None,
redirect_stdout: str | None = None,
redirect_stderr: str | None = None,
experimental_privileged_nesting: bool | None = None,
) -> "Container":
"""This container after executing the specified command inside it
Parameters
----------
args:
Command to run instead of the container's default command
stdin:
Content to write to the command's standard input before closing
redirect_stdout:
Redirect the command's standard output to a file in the container
redirect_stderr:
Redirect the command's standard error to a file in the container
experimental_privileged_nesting:
Provide dagger access to the executed command
Do not use this option unless you trust the command being executed
The command being executed WILL BE GRANTED FULL ACCESS TO YOUR
HOST FILESYSTEM
"""
_args = [
Arg("args", "args", args, list[str]),
Arg("stdin", "stdin", stdin, str | None, None),
Arg("redirect_stdout", "redirectStdout", redirect_stdout, str | None, None),
Arg("redirect_stderr", "redirectStderr", redirect_stderr, str | None, None),
Arg(
"experimental_privileged_nesting",
"experimentalPrivilegedNesting",
experimental_privileged_nesting,
bool | None,
None,
),
]
_ctx = self._select("withExec", _args)
return Container(_ctx)
def with_fs(self, id: "Directory") -> "Container":
"""Initialize this container from this DirectoryID
.. deprecated::
Replaced by :py:meth:`with_rootfs`.
"""
_args = [
Arg("id", "id", id, Directory),
]
_ctx = self._select("withFS", _args)
return Container(_ctx)
def with_file(self, path: str, source: "File") -> "Container":
"""This container plus the contents of the given file copied to the given
path
"""
_args = [
Arg("path", "path", path, str),
Arg("source", "source", source, File),
]
_ctx = self._select("withFile", _args)
return Container(_ctx)
def with_mounted_cache(
self, path: str, cache: "CacheVolume", source: "Directory | None" = None
) -> "Container":
"""This container plus a cache volume mounted at the given path"""
_args = [
Arg("path", "path", path, str),
Arg("cache", "cache", cache, CacheVolume),
Arg("source", "source", source, Directory | None, None),
]
_ctx = self._select("withMountedCache", _args)
return Container(_ctx)
def with_mounted_directory(self, path: str, source: "Directory") -> "Container":
"""This container plus a directory mounted at the given path"""
_args = [
Arg("path", "path", path, str),
Arg("source", "source", source, Directory),
]
_ctx = self._select("withMountedDirectory", _args)
return Container(_ctx)
def with_mounted_file(self, path: str, source: "File") -> "Container":
"""This container plus a file mounted at the given path"""
_args = [
Arg("path", "path", path, str),
Arg("source", "source", source, File),
]
_ctx = self._select("withMountedFile", _args)
return Container(_ctx)
def with_mounted_secret(self, path: str, source: "Secret") -> "Container":
"""This container plus a secret mounted into a file at the given path"""
_args = [
Arg("path", "path", path, str),
Arg("source", "source", source, Secret),
]
_ctx = self._select("withMountedSecret", _args)
return Container(_ctx)
def with_mounted_temp(self, path: str) -> "Container":
"""This container plus a temporary directory mounted at the given path"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("withMountedTemp", _args)
return Container(_ctx)
def with_new_file(self, path: str, contents: str | None = None) -> "Container":
"""This container plus a new file written at the given path"""
_args = [
Arg("path", "path", path, str),
Arg("contents", "contents", contents, str | None, None),
]
_ctx = self._select("withNewFile", _args)
return Container(_ctx)
def with_rootfs(self, id: "Directory") -> "Container":
"""Initialize this container from this DirectoryID"""
_args = [
Arg("id", "id", id, Directory),
]
_ctx = self._select("withRootfs", _args)
return Container(_ctx)
def with_secret_variable(self, name: str, secret: "Secret") -> "Container":
"""This container plus an env variable containing the given secret"""
_args = [
Arg("name", "name", name, str),
Arg("secret", "secret", secret, Secret),
]
_ctx = self._select("withSecretVariable", _args)
return Container(_ctx)
def with_unix_socket(self, path: str, source: "Socket") -> "Container":
"""This container plus a socket forwarded to the given Unix socket path"""
_args = [
Arg("path", "path", path, str),
Arg("source", "source", source, Socket),
]
_ctx = self._select("withUnixSocket", _args)
return Container(_ctx)
def with_user(self, name: str) -> "Container":
"""This container but with a different command user"""
_args = [
Arg("name", "name", name, str),
]
_ctx = self._select("withUser", _args)
return Container(_ctx)
def with_workdir(self, path: str) -> "Container":
"""This container but with a different working directory"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("withWorkdir", _args)
return Container(_ctx)
def without_env_variable(self, name: str) -> "Container":
"""This container minus the given environment variable"""
_args = [
Arg("name", "name", name, str),
]
_ctx = self._select("withoutEnvVariable", _args)
return Container(_ctx)
def without_mount(self, path: str) -> "Container":
"""This container after unmounting everything at the given path."""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("withoutMount", _args)
return Container(_ctx)
def without_unix_socket(self, path: str) -> "Container":
"""This container with a previously added Unix socket removed"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("withoutUnixSocket", _args)
return Container(_ctx)
def workdir(self) -> str | None:
"""The working directory for all commands
Returns
-------
str | None
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("workdir", _args)
return _ctx.execute_sync(str | None)
class Directory(Type):
"""A directory"""
def diff(self, other: "Directory") -> "Directory":
"""The difference between this directory and an another directory"""
_args = [
Arg("other", "other", other, Directory),
]
_ctx = self._select("diff", _args)
return Directory(_ctx)
def directory(self, path: str) -> "Directory":
"""Retrieve a directory at the given path"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("directory", _args)
return Directory(_ctx)
def docker_build(
self, dockerfile: str | None = None, platform: "Platform | None" = None
) -> "Container":
"""Build a new Docker container from this directory"""
_args = [
Arg("dockerfile", "dockerfile", dockerfile, str | None, None),
Arg("platform", "platform", platform, Platform | None, None),
]
_ctx = self._select("dockerBuild", _args)
return Container(_ctx)
def entries(self, path: str | None = None) -> list[str]:
"""Return a list of files and directories at the given path
Returns
-------
list[str]
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args = [
Arg("path", "path", path, str | None, None),
]
_ctx = self._select("entries", _args)
return _ctx.execute_sync(list[str])
def export(self, path: str) -> bool:
"""Write the contents of the directory to a path on the host
Returns
-------
bool
The `Boolean` scalar type represents `true` or `false`.
"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("export", _args)
return _ctx.execute_sync(bool)
def file(self, path: str) -> "File":
"""Retrieve a file at the given path"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("file", _args)
return File(_ctx)
def id(self) -> DirectoryID:
"""The content-addressed identifier of the directory
Note
----
This is lazyly evaluated, no operation is actually run.
Returns
-------
DirectoryID
A content-addressed directory identifier
"""
_args: list[Arg] = []
_ctx = self._select("id", _args)
return _ctx.execute_sync(DirectoryID)
def load_project(self, config_path: str) -> "Project":
"""load a project's metadata"""
_args = [
Arg("config_path", "configPath", config_path, str),
]
_ctx = self._select("loadProject", _args)
return Project(_ctx)
def with_directory(
self,
path: str,
directory: "Directory",
exclude: list[str] | None = None,
include: list[str] | None = None,
) -> "Directory":
"""This directory plus a directory written at the given path"""
_args = [
Arg("path", "path", path, str),
Arg("directory", "directory", directory, Directory),
Arg("exclude", "exclude", exclude, list[str] | None, None),
Arg("include", "include", include, list[str] | None, None),
]
_ctx = self._select("withDirectory", _args)
return Directory(_ctx)
def with_file(self, path: str, source: "File") -> "Directory":
"""This directory plus the contents of the given file copied to the given
path
"""
_args = [
Arg("path", "path", path, str),
Arg("source", "source", source, File),
]
_ctx = self._select("withFile", _args)
return Directory(_ctx)
def with_new_directory(self, path: str) -> "Directory":
"""This directory plus a new directory created at the given path"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("withNewDirectory", _args)
return Directory(_ctx)
def with_new_file(self, path: str, contents: str) -> "Directory":
"""This directory plus a new file written at the given path"""
_args = [
Arg("path", "path", path, str),
Arg("contents", "contents", contents, str),
]
_ctx = self._select("withNewFile", _args)
return Directory(_ctx)
def with_timestamps(self, timestamp: int) -> "Directory":
"""This directory with all file/dir timestamps set to the given time, in
seconds from the Unix epoch
"""
_args = [
Arg("timestamp", "timestamp", timestamp, int),
]
_ctx = self._select("withTimestamps", _args)
return Directory(_ctx)
def without_directory(self, path: str) -> "Directory":
"""This directory with the directory at the given path removed"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("withoutDirectory", _args)
return Directory(_ctx)
def without_file(self, path: str) -> "Directory":
"""This directory with the file at the given path removed"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("withoutFile", _args)
return Directory(_ctx)
class EnvVariable(Type):
"""EnvVariable is a simple key value object that represents an
environment variable."""
def name(self) -> str:
"""name is the environment variable name.
Returns
-------
str
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("name", _args)
return _ctx.execute_sync(str)
def value(self) -> str:
"""value is the environment variable value
Returns
-------
str
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("value", _args)
return _ctx.execute_sync(str)
class File(Type):
"""A file"""
def contents(self) -> str:
"""The contents of the file
Returns
-------
str
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("contents", _args)
return _ctx.execute_sync(str)
def export(self, path: str) -> bool:
"""Write the file to a file path on the host
Returns
-------
bool
The `Boolean` scalar type represents `true` or `false`.
"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("export", _args)
return _ctx.execute_sync(bool)
def id(self) -> FileID:
"""The content-addressed identifier of the file
Note
----
This is lazyly evaluated, no operation is actually run.
"""
_args: list[Arg] = []
_ctx = self._select("id", _args)
return _ctx.execute_sync(FileID)
def secret(self) -> "Secret":
"""A secret referencing the contents of this file"""
_args: list[Arg] = []
_ctx = self._select("secret", _args)
return Secret(_ctx)
def size(self) -> int:
"""The size of the file, in bytes
Returns
-------
int
The `Int` scalar type represents non-fractional signed whole
numeric values. Int can represent values between -(2^31) and 2^31
- 1.
"""
_args: list[Arg] = []
_ctx = self._select("size", _args)
return _ctx.execute_sync(int)
def with_timestamps(self, timestamp: int) -> "File":
"""This file with its created/modified timestamps set to the given time,
in seconds from the Unix epoch
"""
_args = [
Arg("timestamp", "timestamp", timestamp, int),
]
_ctx = self._select("withTimestamps", _args)
return File(_ctx)
class GitRef(Type):
"""A git ref (tag or branch)"""
def digest(self) -> str:
"""The digest of the current value of this ref
Returns
-------
str
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("digest", _args)
return _ctx.execute_sync(str)
def tree(
self,
ssh_known_hosts: str | None = None,
ssh_auth_socket: "Socket | None" = None,
) -> "Directory":
"""The filesystem tree at this ref"""
_args = [
Arg("ssh_known_hosts", "sshKnownHosts", ssh_known_hosts, str | None, None),
Arg(
"ssh_auth_socket", "sshAuthSocket", ssh_auth_socket, Socket | None, None
),
]
_ctx = self._select("tree", _args)
return Directory(_ctx)
class GitRepository(Type):
"""A git repository"""
def branch(self, name: str) -> "GitRef":
"""Details on one branch"""
_args = [
Arg("name", "name", name, str),
]
_ctx = self._select("branch", _args)
return GitRef(_ctx)
def branches(self) -> list[str]:
"""List of branches on the repository
Returns
-------
list[str]
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("branches", _args)
return _ctx.execute_sync(list[str])
def commit(self, id: str) -> "GitRef":
"""Details on one commit"""
_args = [
Arg("id", "id", id, str),
]
_ctx = self._select("commit", _args)
return GitRef(_ctx)
def tag(self, name: str) -> "GitRef":
"""Details on one tag"""
_args = [
Arg("name", "name", name, str),
]
_ctx = self._select("tag", _args)
return GitRef(_ctx)
def tags(self) -> list[str]:
"""List of tags on the repository
Returns
-------
list[str]
The `String` scalar type represents textual data, represented as
UTF-8 character sequences. The String type is most often used by
GraphQL to represent free-form human-readable text.
"""
_args: list[Arg] = []
_ctx = self._select("tags", _args)
return _ctx.execute_sync(list[str])
class Host(Type):
"""Information about the host execution environment"""
def directory(
self,
path: str,
exclude: list[str] | None = None,
include: list[str] | None = None,
) -> "Directory":
"""Access a directory on the host"""
_args = [
Arg("path", "path", path, str),
Arg("exclude", "exclude", exclude, list[str] | None, None),
Arg("include", "include", include, list[str] | None, None),
]
_ctx = self._select("directory", _args)
return Directory(_ctx)
def env_variable(self, name: str) -> "HostVariable":
"""Access an environment variable on the host"""
_args = [
Arg("name", "name", name, str),
]
_ctx = self._select("envVariable", _args)
return HostVariable(_ctx)
def unix_socket(self, path: str) -> "Socket":
"""Access a Unix socket on the host"""
_args = [
Arg("path", "path", path, str),
]
_ctx = self._select("unixSocket", _args)
return Socket(_ctx)
def workdir(
self, exclude: list[str] | None = None, include: list[str] | None = None
) -> "Directory":
"""The current working directory on the host
.. deprecated::
Use :py:meth:`directory` with path set to '.' instead.
"""
_args = [
Arg("exclude", "exclude", exclude, list[str] | None, None),
Arg("include", "include", include, list[str] | None, None),
]
_ctx = self._select("workdir", _args)
return Directory(_ctx)
class HostVariable(Type):
"""An environment variable on the host environment"""