This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Task.dhall
101 lines (90 loc) · 3.39 KB
/
Task.dhall
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
let ImageResource
: ∀(_params : { source : Type, get_params : Type, version : Type }) →
{ Type : Type
, default :
{ params : Optional _params.get_params
, version : Optional _params.version
}
}
= λ(_params : { source : Type, get_params : Type, version : Type }) →
{ Type =
{ type : Text
, source : _params.source
, params : Optional _params.get_params
, version : Optional _params.version
}
, default =
{ params = None _params.get_params, version = None _params.version }
}
let Input =
{ Type = { name : Text, path : Optional Text, optional : Optional Bool }
, default = { path = None Text, optional = None Bool }
}
let Output =
{ Type = { name : Text, path : Optional Text }, default.path = None Text }
let Cache = { Type = { path : Text }, default = {=} }
let Run =
{ Type =
{ path : Text
, args : Optional (List Text)
, dir : Optional Text
, user : Optional Text
}
, default = { args = None (List Text), dir = None Text, user = None Text }
}
let ContainerLimits =
{ Type = { cpu : Optional Natural, memory : Optional Natural }
, default = { cpu = None Natural, memory = None Natural }
}
let Config
: ∀(_params : { image_resource : Type }) →
{ Type : Type
, default :
{ inputs : Optional (List Input.Type)
, outputs : Optional (List Output.Type)
, caches : Optional (List Cache.Type)
, params : Optional (List { mapKey : Text, mapValue : Text })
, rootfs_uri : Optional Text
, container_limits : Optional ContainerLimits.Type
}
}
= λ(_params : { image_resource : Type }) →
{ Type =
{ platform : Text
, image_resource : _params.image_resource
, inputs : Optional (List Input.Type)
, outputs : Optional (List Output.Type)
, caches : Optional (List Cache.Type)
, params : Optional (List { mapKey : Text, mapValue : Text })
, run : Run.Type
, rootfs_uri : Optional Text
, container_limits : Optional ContainerLimits.Type
}
, default =
{ inputs = None (List Input.Type)
, outputs = None (List Output.Type)
, caches = None (List Cache.Type)
, params = None (List { mapKey : Text, mapValue : Text })
, rootfs_uri = None Text
, container_limits = None ContainerLimits.Type
}
}
let example =
let RegistryImage = ./resource-types/RegistryImage.dhall
let ImageResource =
ImageResource
{ source = RegistryImage.Source.Type
, get_params = <>
, version = <>
}
let Config = Config { image_resource = ImageResource.Type }
in Config::{
, platform = "linux"
, image_resource = ImageResource::{
, type = RegistryImage.meta.name
, source = RegistryImage.Source::{ repository = "busybox" }
}
, params = Some (toMap { FOO = "hello" })
, run = Run::{ path = "/bin/sh", args = Some [ "-ec", "echo \$FOO" ] }
}
in { ImageResource, Input, Output, Cache, Run, ContainerLimits, Config }