hammerkit 1.5.0-alpha.0 → 1.5.1
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/Dockerfile +1 -1
- package/build.schema.json +338 -161
- package/dist/executer/docker-service.js +1 -1
- package/dist/executer/environment-mock.js +6 -3
- package/dist/executer/event-cache.js +2 -6
- package/dist/executer/execute-docker.js +1 -1
- package/dist/executer/execute.spec.js +1 -1
- package/dist/executer/execution-steps.js +10 -1
- package/dist/executer/get-docker-executor.js +34 -7
- package/dist/executer/schedule.js +4 -6
- package/dist/executer/start-node.js +11 -3
- package/dist/executer/watch-node.js +0 -1
- package/dist/index.js +5 -2
- package/dist/log.js +35 -30
- package/dist/logging/grouped-logger.js +2 -2
- package/dist/logging/interactive-logger.js +3 -3
- package/dist/logging/live-logger.js +1 -1
- package/dist/optimizer/get-work-node-cache-stats.js +8 -2
- package/dist/optimizer/work-node-cache-description.js +1 -1
- package/dist/parser/default-build-file.js +22 -0
- package/dist/parser/parse-build-file-references.js +13 -2
- package/dist/parser/parse-build-file.js +37 -3
- package/dist/planner/utils/parse-work-service-volume.js +2 -0
- package/dist/planner/utils/plan-work-dependency.js +5 -8
- package/dist/planner/utils/plan-work-node.js +29 -8
- package/dist/planner/utils/plan-work-volume.js +7 -1
- package/dist/planner/work-node-status.js +2 -1
- package/dist/program.js +23 -22
- package/dist/testing/example-test-suite.js +17 -6
- package/dist/testing/expect.js +5 -0
- package/dist/testing/integration/cache.spec.js +3 -3
- package/dist/testing/integration/cancellation.spec.js +1 -1
- package/dist/testing/integration/clean.spec.js +1 -1
- package/dist/testing/integration/cmd.spec.js +1 -1
- package/dist/testing/integration/concurrency.spec.js +1 -1
- package/dist/testing/integration/docker.spec.js +1 -1
- package/dist/testing/integration/env.spec.js +1 -1
- package/dist/testing/integration/error.spec.js +1 -1
- package/dist/testing/integration/extend.spec.js +2 -2
- package/dist/testing/integration/glob.spec.js +1 -1
- package/dist/testing/integration/include.spec.js +1 -1
- package/dist/testing/integration/invalid.spec.js +1 -1
- package/dist/testing/integration/invalid_loop.spec.js +1 -1
- package/dist/testing/integration/kubernetes.spec.js +1 -1
- package/dist/testing/integration/labels.spec.js +1 -1
- package/dist/testing/integration/local.spec.js +1 -1
- package/dist/testing/integration/monorepo.spec.js +1 -1
- package/dist/testing/integration/multi-line.spec.js +1 -1
- package/dist/testing/integration/reference.spec.js +1 -1
- package/dist/testing/integration/services.spec.js +7 -1
- package/dist/testing/integration/store.spec.js +2 -2
- package/dist/testing/integration/unknown.spec.js +1 -1
- package/dist/testing/integration/validate.spec.js +1 -1
- package/dist/testing/integration/watch-dependency.spec.js +30 -0
- package/dist/testing/integration/watch.spec.js +1 -1
- package/dist/utils/empty-writable.js +13 -0
- package/logs/cache-console.log +0 -0
- package/logs/cache-status.log +6 -0
- package/logs/cache-stout.log +0 -0
- package/logs/cancellation-console.log +0 -0
- package/logs/cancellation-status.log +3 -0
- package/logs/cancellation-stout.log +3 -0
- package/logs/clean-console.log +0 -0
- package/logs/clean-status.log +37 -0
- package/logs/clean-stout.log +95 -0
- package/logs/cmd-console.log +0 -0
- package/logs/cmd-status.log +8 -0
- package/logs/cmd-stout.log +9 -0
- package/logs/concurrency-console.log +0 -0
- package/logs/concurrency-status.log +14 -0
- package/logs/concurrency-stout.log +88 -0
- package/logs/docker-console.log +0 -0
- package/logs/docker-status.log +14 -0
- package/logs/docker-stout.log +39 -0
- package/logs/env-console.log +1 -0
- package/logs/env-status.log +1 -0
- package/logs/env-stout.log +0 -0
- package/logs/error-console.log +0 -0
- package/logs/error-status.log +10 -0
- package/logs/error-stout.log +36 -0
- package/logs/extend-console.log +0 -0
- package/logs/extend-status.log +1 -0
- package/logs/extend-stout.log +0 -0
- package/logs/glob-console.log +28 -0
- package/logs/glob-status.log +23 -0
- package/logs/glob-stout.log +52 -0
- package/logs/hello-world-node-console.log +0 -0
- package/logs/hello-world-node-status.log +37 -0
- package/logs/hello-world-node-stout.log +41 -0
- package/logs/include-console.log +0 -0
- package/logs/include-status.log +3 -0
- package/logs/include-stout.log +0 -0
- package/logs/invalid-console.log +0 -0
- package/logs/invalid-status.log +1 -0
- package/logs/invalid-stout.log +0 -0
- package/logs/invalid_loop-console.log +0 -0
- package/logs/invalid_loop-status.log +1 -0
- package/logs/invalid_loop-stout.log +11 -0
- package/logs/labels-console.log +0 -0
- package/logs/labels-status.log +1 -0
- package/logs/labels-stout.log +0 -0
- package/logs/local-console.log +0 -0
- package/logs/local-status.log +7 -0
- package/logs/local-stout.log +8 -0
- package/logs/monorepo-console.log +0 -0
- package/logs/monorepo-status.log +152 -0
- package/logs/monorepo-stout.log +2354 -0
- package/logs/multi-line-console.log +0 -0
- package/logs/multi-line-status.log +1 -0
- package/logs/multi-line-stout.log +0 -0
- package/logs/reference-console.log +0 -0
- package/logs/reference-status.log +5 -0
- package/logs/reference-stout.log +0 -0
- package/logs/services-console.log +0 -0
- package/logs/services-status.log +129 -0
- package/logs/services-stout.log +639 -0
- package/logs/store-restore-console.log +0 -0
- package/logs/store-restore-status.log +40 -0
- package/logs/store-restore-stout.log +97 -0
- package/logs/unknown-console.log +3 -0
- package/logs/unknown-status.log +1 -0
- package/logs/unknown-stout.log +0 -0
- package/logs/validate-console.log +0 -0
- package/logs/validate-status.log +2 -0
- package/logs/validate-stout.log +0 -0
- package/logs/watch-console.log +0 -0
- package/logs/watch-dependency-console.log +0 -0
- package/logs/watch-dependency-status.log +176 -0
- package/logs/watch-dependency-stout.log +779 -0
- package/logs/watch-status.log +100 -0
- package/logs/watch-stout.log +349 -0
- package/package.json +1 -1
package/Dockerfile
CHANGED
package/build.schema.json
CHANGED
|
@@ -1,257 +1,434 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$comment": "https://no0dles.gitbook.io",
|
|
2
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"title": "JSON Schema for hammerkit's build file",
|
|
4
|
-
"description": "Build tool with support for containerization",
|
|
5
|
-
"type": "object",
|
|
6
4
|
"additionalProperties": false,
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
5
|
+
"definitions": {
|
|
6
|
+
"buildFileEnvs": {
|
|
7
|
+
"title": "environment variables",
|
|
8
|
+
"description": "Environment values for the current build task\nhttps://no0dles.gitbook.io/hammerkit/build-file/environment-variables",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"additionalProperties": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
}
|
|
10
13
|
},
|
|
11
|
-
"
|
|
14
|
+
"buildFileTasks": {
|
|
15
|
+
"title": "tasks",
|
|
16
|
+
"description": "Task for the current build file\nhttps://no0dles.gitbook.io/hammerkit/task",
|
|
12
17
|
"type": "object",
|
|
13
|
-
"description": "A map of tasks",
|
|
14
18
|
"additionalProperties": {
|
|
15
19
|
"$ref": "#/definitions/task"
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
|
-
"
|
|
22
|
+
"buildFileServices": {
|
|
23
|
+
"title": "services",
|
|
24
|
+
"description": "Services for the current build file\nhttps://no0dles.gitbook.io/hammerkit/service",
|
|
19
25
|
"type": "object",
|
|
20
|
-
"description": "A map of services",
|
|
21
26
|
"additionalProperties": {
|
|
22
27
|
"$ref": "#/definitions/service"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"references": {
|
|
29
|
-
"$ref": "#/definitions/reference"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"definitions": {
|
|
33
|
-
"labels": {
|
|
34
|
-
"description": "A map of label values",
|
|
30
|
+
"buildFileIncludes": {
|
|
31
|
+
"title": "includes",
|
|
32
|
+
"description": "Includes to other build files\nhttps://no0dles.gitbook.io/hammerkit/build-file/includes",
|
|
35
33
|
"type": "object",
|
|
36
|
-
"additionalProperties": {
|
|
34
|
+
"additionalProperties": {
|
|
35
|
+
"$ref": "https://json.schemastore.org/base.json#/definitions/path"
|
|
36
|
+
}
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"buildFileReferences": {
|
|
39
|
+
"title": "references",
|
|
40
|
+
"description": "References to other build files\nhttps://no0dles.gitbook.io/hammerkit/build-file/references",
|
|
40
41
|
"type": "object",
|
|
41
42
|
"additionalProperties": {
|
|
42
|
-
"
|
|
43
|
+
"$ref": "https://json.schemastore.org/base.json#/definitions/path"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"task": {
|
|
47
|
+
"title": "task",
|
|
48
|
+
"description": "Task for the current build file\nhttps://no0dles.gitbook.io/hammerkit/task",
|
|
49
|
+
"anyOf": [
|
|
50
|
+
{
|
|
51
|
+
"$ref": "#/definitions/containerTask"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"$ref": "#/definitions/localTask"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"localTask": {
|
|
59
|
+
"title": "local task",
|
|
60
|
+
"description": "Task that gets executed in the local shell in the current directory",
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"required": ["cmds"],
|
|
64
|
+
"properties": {
|
|
65
|
+
"description": {
|
|
66
|
+
"$ref": "#/definitions/taskCommand"
|
|
67
|
+
},
|
|
68
|
+
"extend": {
|
|
69
|
+
"$ref": "#/definitions/taskExtend"
|
|
70
|
+
},
|
|
71
|
+
"cache": {
|
|
72
|
+
"$ref": "#/definitions/taskCache"
|
|
73
|
+
},
|
|
74
|
+
"continuous": {
|
|
75
|
+
"$ref": "#/definitions/taskContinuous"
|
|
76
|
+
},
|
|
77
|
+
"envs": {
|
|
78
|
+
"$ref": "#/definitions/taskEnvs"
|
|
79
|
+
},
|
|
80
|
+
"needs": {
|
|
81
|
+
"$ref": "#/definitions/taskNeeds"
|
|
82
|
+
},
|
|
83
|
+
"deps": {
|
|
84
|
+
"$ref": "#/definitions/taskDeps"
|
|
85
|
+
},
|
|
86
|
+
"src": {
|
|
87
|
+
"$ref": "#/definitions/taskSrc"
|
|
88
|
+
},
|
|
89
|
+
"generates": {
|
|
90
|
+
"$ref": "#/definitions/taskGenerates"
|
|
91
|
+
},
|
|
92
|
+
"cmds": {
|
|
93
|
+
"title": "task commands",
|
|
94
|
+
"description": "Commands for the current task",
|
|
95
|
+
"type": "array",
|
|
96
|
+
"items": {
|
|
97
|
+
"$ref": "#/definitions/taskCommand"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"containerTask": {
|
|
103
|
+
"title": "container task",
|
|
104
|
+
"description": "Container task for the current build file\nhttps://no0dles.gitbook.io/hammerkit/task/container",
|
|
105
|
+
"type": "object",
|
|
106
|
+
"required": ["image", "cmds"],
|
|
107
|
+
"additionalProperties": false,
|
|
108
|
+
"properties": {
|
|
109
|
+
"description": {
|
|
110
|
+
"$ref": "#/definitions/taskCommand"
|
|
111
|
+
},
|
|
112
|
+
"extend": {
|
|
113
|
+
"$ref": "#/definitions/taskExtend"
|
|
114
|
+
},
|
|
115
|
+
"cache": {
|
|
116
|
+
"$ref": "#/definitions/taskCache"
|
|
117
|
+
},
|
|
118
|
+
"continuous": {
|
|
119
|
+
"$ref": "#/definitions/taskContinuous"
|
|
120
|
+
},
|
|
121
|
+
"envs": {
|
|
122
|
+
"$ref": "#/definitions/taskEnvs"
|
|
123
|
+
},
|
|
124
|
+
"needs": {
|
|
125
|
+
"$ref": "#/definitions/taskNeeds"
|
|
126
|
+
},
|
|
127
|
+
"deps": {
|
|
128
|
+
"$ref": "#/definitions/taskDeps"
|
|
129
|
+
},
|
|
130
|
+
"src": {
|
|
131
|
+
"$ref": "#/definitions/taskSrc"
|
|
132
|
+
},
|
|
133
|
+
"generates": {
|
|
134
|
+
"$ref": "#/definitions/taskGenerates"
|
|
135
|
+
},
|
|
136
|
+
"cmds": {
|
|
137
|
+
"title": "task commands",
|
|
138
|
+
"description": "Commands for the current task",
|
|
139
|
+
"type": "array",
|
|
140
|
+
"items": {
|
|
141
|
+
"$ref": "#/definitions/taskCommand"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"shell": {
|
|
145
|
+
"title": "task shell",
|
|
146
|
+
"description": "Define which shell is used to execute the commands",
|
|
147
|
+
"type": "string"
|
|
148
|
+
},
|
|
149
|
+
"image": {
|
|
150
|
+
"title": "task image",
|
|
151
|
+
"description": "Container image for the current task to run commands in",
|
|
152
|
+
"type": "string"
|
|
153
|
+
},
|
|
154
|
+
"ports": {
|
|
155
|
+
"title": "task ports",
|
|
156
|
+
"description": "A list of ports that get exposed on the host from the container <localPort>:<targetPort>",
|
|
157
|
+
"type": "array",
|
|
158
|
+
"uniqueItems": true,
|
|
159
|
+
"items": {
|
|
160
|
+
"description": "<localPort>:<targetPort>",
|
|
161
|
+
"type": "string",
|
|
162
|
+
"pattern": "\\d+:\\d+"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"mounts": {
|
|
166
|
+
"title": "task mount",
|
|
167
|
+
"description": "File paths that get mounted into the container\nhttps://no0dles.gitbook.io/hammerkit/task/container#adding-mounts",
|
|
168
|
+
"type": "array",
|
|
169
|
+
"uniqueItems": true,
|
|
170
|
+
"items": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"pattern": "\\d+:\\d+"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
43
175
|
}
|
|
44
176
|
},
|
|
45
177
|
"taskCommand": {
|
|
46
178
|
"anyOf": [
|
|
47
179
|
{
|
|
48
|
-
"
|
|
180
|
+
"title": "command",
|
|
181
|
+
"description": "Command to be executed for the current task",
|
|
49
182
|
"type": "string"
|
|
50
183
|
},
|
|
51
184
|
{
|
|
185
|
+
"title": "task command with path extension",
|
|
186
|
+
"description": "Command to be executed in sub directory for the current task",
|
|
52
187
|
"type": "object",
|
|
53
188
|
"additionalProperties": false,
|
|
189
|
+
"required": ["cmd"],
|
|
54
190
|
"properties": {
|
|
55
191
|
"cmd": {
|
|
192
|
+
"title": "command",
|
|
56
193
|
"description": "Command to be executed for the task",
|
|
57
194
|
"type": "string"
|
|
58
195
|
},
|
|
59
196
|
"path": {
|
|
197
|
+
"title": "command path",
|
|
60
198
|
"description": "Path below build file path",
|
|
61
|
-
"
|
|
199
|
+
"$ref": "https://json.schemastore.org/base.json#/definitions/path"
|
|
62
200
|
}
|
|
63
|
-
}
|
|
64
|
-
"required": ["cmd"]
|
|
201
|
+
}
|
|
65
202
|
}
|
|
66
203
|
]
|
|
67
204
|
},
|
|
68
|
-
"
|
|
205
|
+
"taskDescription": {
|
|
206
|
+
"title": "task description",
|
|
207
|
+
"description": "Description for the current task",
|
|
208
|
+
"type": "string"
|
|
209
|
+
},
|
|
210
|
+
"taskExtend": {
|
|
211
|
+
"title": "task extension",
|
|
212
|
+
"description": "Extension task as a base template\nhttps://no0dles.gitbook.io/hammerkit/task/extending",
|
|
213
|
+
"type": "string"
|
|
214
|
+
},
|
|
215
|
+
"taskCache": {
|
|
216
|
+
"title": "task cache",
|
|
217
|
+
"description": "compare type for detecting changes in source files\nhttps://no0dles.gitbook.io/hammerkit/task/caching",
|
|
218
|
+
"type": "string",
|
|
219
|
+
"enum": ["checksum", "modify-date", "none"]
|
|
220
|
+
},
|
|
221
|
+
"taskContinuous": {
|
|
222
|
+
"title": "task continuous",
|
|
223
|
+
"description": "The task runs continuous and does not end without cancellation\nhttps://no0dles.gitbook.io/hammerkit/task/watching#continuous-tasks",
|
|
224
|
+
"type": "boolean"
|
|
225
|
+
},
|
|
226
|
+
"taskLabels": {
|
|
227
|
+
"title": "label options",
|
|
228
|
+
"description": "A map of label values for the current task\nhttps://no0dles.gitbook.io/hammerkit/labels",
|
|
69
229
|
"type": "object",
|
|
70
|
-
"
|
|
71
|
-
"additionalProperties": {
|
|
72
|
-
"type": "string"
|
|
73
|
-
}
|
|
230
|
+
"additionalProperties": { "type": "string" }
|
|
74
231
|
},
|
|
75
|
-
"
|
|
232
|
+
"taskEnvs": {
|
|
233
|
+
"title": "task environment variables",
|
|
234
|
+
"description": "Environment values for the current build file\nhttps://no0dles.gitbook.io/hammerkit/build-file/environment-variables",
|
|
76
235
|
"type": "object",
|
|
77
|
-
"description": "A map of references",
|
|
78
236
|
"additionalProperties": {
|
|
79
237
|
"type": "string"
|
|
80
238
|
}
|
|
81
239
|
},
|
|
82
|
-
"
|
|
240
|
+
"taskNeeds": {
|
|
241
|
+
"title": "task service needs",
|
|
242
|
+
"description": "Service needs that need to get ready before the current task\nhttps://no0dles.gitbook.io/hammerkit/task/needs",
|
|
83
243
|
"type": "array",
|
|
84
|
-
"
|
|
244
|
+
"uniqueItems": true,
|
|
85
245
|
"items": {
|
|
86
246
|
"type": "string"
|
|
87
247
|
}
|
|
88
248
|
},
|
|
89
|
-
"
|
|
249
|
+
"taskDeps": {
|
|
250
|
+
"title": "task dependencies",
|
|
251
|
+
"description": "Task dependencies that get executed before the current task\nhttps://no0dles.gitbook.io/hammerkit/task/dependencies",
|
|
90
252
|
"type": "array",
|
|
91
|
-
"
|
|
253
|
+
"uniqueItems": true,
|
|
92
254
|
"items": {
|
|
93
255
|
"type": "string"
|
|
94
256
|
}
|
|
95
257
|
},
|
|
96
|
-
"
|
|
258
|
+
"taskSrc": {
|
|
259
|
+
"title": "task source",
|
|
260
|
+
"description": "Source files and folders for the current task\nhttps://no0dles.gitbook.io/hammerkit/task#source",
|
|
97
261
|
"type": "array",
|
|
98
|
-
"
|
|
262
|
+
"uniqueItems": true,
|
|
99
263
|
"items": {
|
|
100
|
-
"
|
|
264
|
+
"$ref": "https://json.schemastore.org/base.json#/definitions/path"
|
|
101
265
|
}
|
|
102
266
|
},
|
|
103
|
-
"
|
|
267
|
+
"taskGenerates": {
|
|
268
|
+
"title": "task generate",
|
|
269
|
+
"description": "Generated files and folders for the current task\n\nhttps://no0dles.gitbook.io/hammerkit/task#generate",
|
|
104
270
|
"type": "array",
|
|
105
|
-
"
|
|
271
|
+
"uniqueItems": true,
|
|
106
272
|
"items": {
|
|
107
|
-
"
|
|
273
|
+
"$ref": "https://json.schemastore.org/base.json#/definitions/path"
|
|
108
274
|
}
|
|
109
275
|
},
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"description": "A
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
276
|
+
"service": {
|
|
277
|
+
"title": "service",
|
|
278
|
+
"description": "A daemon in the background",
|
|
279
|
+
"anyOf": [
|
|
280
|
+
{
|
|
281
|
+
"$ref": "#/definitions/containerService"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"$ref": "#/definitions/kubernetesService"
|
|
285
|
+
}
|
|
286
|
+
]
|
|
116
287
|
},
|
|
117
|
-
"
|
|
288
|
+
"kubernetesService": {
|
|
289
|
+
"title": "kubernetes service",
|
|
290
|
+
"description": "Kubernetes service for the current build file\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes",
|
|
118
291
|
"type": "object",
|
|
119
|
-
"
|
|
292
|
+
"required": ["context", "selector", "ports"],
|
|
120
293
|
"additionalProperties": false,
|
|
121
294
|
"properties": {
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"description": "
|
|
125
|
-
|
|
126
|
-
"extend": {
|
|
127
|
-
"type": "string",
|
|
128
|
-
"description": "Name of task that gets used a template"
|
|
129
|
-
},
|
|
130
|
-
"labels": {
|
|
131
|
-
"$ref": "#/definitions/labels"
|
|
132
|
-
},
|
|
133
|
-
"envs": {
|
|
134
|
-
"$ref": "#/definitions/envMap"
|
|
135
|
-
},
|
|
136
|
-
"deps": {
|
|
137
|
-
"$ref": "#/definitions/taskDependency"
|
|
138
|
-
},
|
|
139
|
-
"watch": {
|
|
140
|
-
"type": "boolean",
|
|
141
|
-
"description": "Watch the source files and restart the task on changes"
|
|
142
|
-
},
|
|
143
|
-
"src": {
|
|
144
|
-
"$ref": "#/definitions/taskSource"
|
|
295
|
+
"kubeconfig": {
|
|
296
|
+
"title": "service kube config",
|
|
297
|
+
"description": "Kubernetes context for the current service\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes#config",
|
|
298
|
+
"type": "string"
|
|
145
299
|
},
|
|
146
|
-
"
|
|
147
|
-
"
|
|
300
|
+
"context": {
|
|
301
|
+
"title": "service context",
|
|
302
|
+
"description": "Kubernetes context for the current service\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes#config",
|
|
303
|
+
"type": "string"
|
|
148
304
|
},
|
|
149
|
-
"
|
|
150
|
-
"
|
|
305
|
+
"ports": {
|
|
306
|
+
"title": "service ports",
|
|
307
|
+
"description": "A list of ports that get exposed on the host from the service <localPort>:<targetPort>",
|
|
151
308
|
"type": "array",
|
|
309
|
+
"uniqueItems": true,
|
|
152
310
|
"items": {
|
|
153
|
-
"
|
|
311
|
+
"description": "<localPort>:<targetPort>",
|
|
312
|
+
"type": "string",
|
|
313
|
+
"pattern": "\\d+:\\d+"
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"selector": {
|
|
317
|
+
"title": "service selector",
|
|
318
|
+
"description": "Selector to specify which resource gets forwarded to\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes",
|
|
319
|
+
"type": "object",
|
|
320
|
+
"required": ["type", "name"],
|
|
321
|
+
"additionalProperties": false,
|
|
322
|
+
"properties": {
|
|
323
|
+
"type": {
|
|
324
|
+
"title": "selector resource type",
|
|
325
|
+
"description": "resource type for the current service",
|
|
326
|
+
"type": "string",
|
|
327
|
+
"enum": ["deployment", "service", "pod"]
|
|
328
|
+
},
|
|
329
|
+
"name": {
|
|
330
|
+
"title": "selector resource name",
|
|
331
|
+
"description": "resource name for the kubernetes resource",
|
|
332
|
+
"type": "string"
|
|
333
|
+
}
|
|
154
334
|
}
|
|
155
335
|
}
|
|
156
|
-
}
|
|
157
|
-
"required": ["cmds"]
|
|
336
|
+
}
|
|
158
337
|
},
|
|
159
|
-
"
|
|
160
|
-
"
|
|
338
|
+
"containerService": {
|
|
339
|
+
"title": "container service",
|
|
340
|
+
"description": "Container service for the current build file\nhttps://no0dles.gitbook.io/hammerkit/service/kubernetes",
|
|
341
|
+
"type": "object",
|
|
342
|
+
"required": ["image"],
|
|
161
343
|
"additionalProperties": false,
|
|
162
344
|
"properties": {
|
|
163
|
-
"description": {
|
|
164
|
-
"type": "string",
|
|
165
|
-
"description": "A description of the task"
|
|
166
|
-
},
|
|
167
345
|
"labels": {
|
|
168
|
-
"
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"type": "string"
|
|
172
|
-
"description": "Name of task that gets used a template"
|
|
173
|
-
},
|
|
174
|
-
"ports": {
|
|
175
|
-
"$ref": "#/definitions/taskPort"
|
|
346
|
+
"title": "label options",
|
|
347
|
+
"description": "A map of label values for the current service\nhttps://no0dles.gitbook.io/hammerkit/labels",
|
|
348
|
+
"type": "object",
|
|
349
|
+
"additionalProperties": { "type": "string" }
|
|
176
350
|
},
|
|
177
351
|
"envs": {
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
"
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
"type": "boolean",
|
|
185
|
-
"description": "Watch the source files and restart the task on changes"
|
|
352
|
+
"title": "service environment variables",
|
|
353
|
+
"description": "Environment values for the current service\nhttps://no0dles.gitbook.io/hammerkit/build-file/environment-variables",
|
|
354
|
+
"type": "object",
|
|
355
|
+
"additionalProperties": {
|
|
356
|
+
"type": "string"
|
|
357
|
+
}
|
|
186
358
|
},
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"description": "
|
|
359
|
+
"healthcheck": {
|
|
360
|
+
"title": "service healthcheck",
|
|
361
|
+
"description": "Check to detect if the service is started and ready\nhttps://no0dles.gitbook.io/hammerkit/service/container#healthcheck",
|
|
362
|
+
"type": "object",
|
|
363
|
+
"required": ["cmd"],
|
|
364
|
+
"additionalProperties": false,
|
|
365
|
+
"properties": {
|
|
366
|
+
"cmd": {
|
|
367
|
+
"title": "command",
|
|
368
|
+
"description": "task to check if the service is healthy",
|
|
369
|
+
"type": "string"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
190
372
|
},
|
|
191
373
|
"image": {
|
|
192
|
-
"
|
|
193
|
-
"description": "
|
|
194
|
-
|
|
195
|
-
"mounts": {
|
|
196
|
-
"$ref": "#/definitions/mount"
|
|
374
|
+
"title": "service image",
|
|
375
|
+
"description": "Container image for the current service to run commands in",
|
|
376
|
+
"type": "string"
|
|
197
377
|
},
|
|
198
|
-
"
|
|
199
|
-
"
|
|
378
|
+
"ports": {
|
|
379
|
+
"title": "service ports",
|
|
380
|
+
"description": "A list of ports that get exposed on the host from the container <localPort>:<targetPort>\nhttps://no0dles.gitbook.io/hammerkit/service/container#mounts",
|
|
381
|
+
"type": "array",
|
|
382
|
+
"uniqueItems": true,
|
|
383
|
+
"items": {
|
|
384
|
+
"description": "<localPort>:<targetPort>",
|
|
385
|
+
"type": "string",
|
|
386
|
+
"pattern": "\\d+:\\d+"
|
|
387
|
+
}
|
|
200
388
|
},
|
|
201
|
-
"
|
|
202
|
-
"
|
|
389
|
+
"volumes": {
|
|
390
|
+
"title": "service volumes",
|
|
391
|
+
"description": "A list of volumes that get attached to the container <name>:<containerPath>\nhttps://no0dles.gitbook.io/hammerkit/service/container#mounts",
|
|
392
|
+
"type": "array",
|
|
393
|
+
"uniqueItems": true,
|
|
394
|
+
"items": {
|
|
395
|
+
"description": "<name>:<containerPath>",
|
|
396
|
+
"type": "string",
|
|
397
|
+
"pattern": "\\d+:\\d+"
|
|
398
|
+
}
|
|
203
399
|
},
|
|
204
|
-
"
|
|
205
|
-
"
|
|
400
|
+
"mounts": {
|
|
401
|
+
"title": "service mount",
|
|
402
|
+
"description": "File paths that get mounted into the container <localPath>:<containerPath>\nhttps://no0dles.gitbook.io/hammerkit/service/container#mounts",
|
|
206
403
|
"type": "array",
|
|
404
|
+
"uniqueItems": true,
|
|
207
405
|
"items": {
|
|
208
|
-
"
|
|
406
|
+
"type": "string",
|
|
407
|
+
"description": "<localPath>:<containerPath>",
|
|
408
|
+
"pattern": "\\d+:\\d+"
|
|
209
409
|
}
|
|
210
410
|
}
|
|
211
411
|
}
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
"description": "Build tool with support for containerization\nhttps://no0dles.gitbook.io/hammerkit/build-file",
|
|
415
|
+
"properties": {
|
|
416
|
+
"envs": {
|
|
417
|
+
"$ref": "#/definitions/buildFileEnvs"
|
|
212
418
|
},
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"$ref": "#/definitions/dockerTask"
|
|
216
|
-
}, {
|
|
217
|
-
"$ref": "#/definitions/localTask"
|
|
218
|
-
}]
|
|
419
|
+
"tasks": {
|
|
420
|
+
"$ref": "#/definitions/buildFileTasks"
|
|
219
421
|
},
|
|
220
|
-
"
|
|
221
|
-
"
|
|
222
|
-
"required": ["image"],
|
|
223
|
-
"additionalProperties": false,
|
|
224
|
-
"properties": {
|
|
225
|
-
"image": {
|
|
226
|
-
"type": "string",
|
|
227
|
-
"description": "Define the container image the commands run in"
|
|
228
|
-
},
|
|
229
|
-
"labels": {
|
|
230
|
-
"$ref": "#/definitions/labels"
|
|
231
|
-
},
|
|
232
|
-
"envs": {
|
|
233
|
-
"$ref": "#/definitions/envMap"
|
|
234
|
-
},
|
|
235
|
-
"ports": {
|
|
236
|
-
"$ref": "#/definitions/taskPort"
|
|
237
|
-
},
|
|
238
|
-
"healthcheck": {
|
|
239
|
-
"$ref": "#/definitions/serviceHealthcheck"
|
|
240
|
-
},
|
|
241
|
-
"mounts": {
|
|
242
|
-
"$ref": "#/definitions/mount"
|
|
243
|
-
}
|
|
244
|
-
}
|
|
422
|
+
"services": {
|
|
423
|
+
"$ref": "#/definitions/buildFileServices"
|
|
245
424
|
},
|
|
246
|
-
"
|
|
247
|
-
"
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
"description": "task to check if the service is healthy",
|
|
252
|
-
"type": "string"
|
|
253
|
-
}
|
|
254
|
-
}
|
|
425
|
+
"includes": {
|
|
426
|
+
"$ref": "#/definitions/buildFileIncludes"
|
|
427
|
+
},
|
|
428
|
+
"references": {
|
|
429
|
+
"$ref": "#/definitions/buildFileReferences"
|
|
255
430
|
}
|
|
256
|
-
}
|
|
431
|
+
},
|
|
432
|
+
"title": "JSON Schema for hammerkit's build file",
|
|
433
|
+
"type": "object"
|
|
257
434
|
}
|
|
@@ -45,7 +45,7 @@ function dockerService(service, stateKey, state, environment) {
|
|
|
45
45
|
const stream = await container.attach({ stream: true, stdout: true, stderr: true });
|
|
46
46
|
(0, stream_1.logStream)(status, stream);
|
|
47
47
|
await container.start();
|
|
48
|
-
//
|
|
48
|
+
//await setUserPermissions(service, container, environment)
|
|
49
49
|
if (!service.healthcheck) {
|
|
50
50
|
state.patchService({
|
|
51
51
|
type: 'running',
|
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.environmentMock = void 0;
|
|
4
4
|
const work_node_status_1 = require("../planner/work-node-status");
|
|
5
|
-
const console_context_mock_1 = require("../console/console-context-mock");
|
|
6
5
|
const get_file_context_1 = require("../file/get-file-context");
|
|
7
6
|
const execute_docker_1 = require("./execute-docker");
|
|
7
|
+
const log_1 = require("../log");
|
|
8
|
+
const empty_writable_1 = require("../utils/empty-writable");
|
|
8
9
|
function environmentMock(cwd) {
|
|
9
10
|
return {
|
|
10
11
|
cwd,
|
|
11
12
|
file: (0, get_file_context_1.getFileContext)(cwd),
|
|
12
|
-
console: (0,
|
|
13
|
+
console: (0, log_1.consoleContext)((0, empty_writable_1.emptyWritable)()),
|
|
13
14
|
abortCtrl: new AbortController(),
|
|
14
15
|
processEnvs: {},
|
|
15
|
-
status: (0, work_node_status_1.statusConsole)(),
|
|
16
|
+
status: (0, work_node_status_1.statusConsole)((0, empty_writable_1.emptyWritable)()),
|
|
16
17
|
docker: (0, execute_docker_1.getContainerCli)(),
|
|
18
|
+
stdout: (0, empty_writable_1.emptyWritable)(),
|
|
19
|
+
stdoutColumns: 80,
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
exports.environmentMock = environmentMock;
|
|
@@ -127,9 +127,7 @@ async function cleanCache(workTree, environment, options) {
|
|
|
127
127
|
const volumeName = (0, plan_work_volume_1.getVolumeName)(generate.path);
|
|
128
128
|
const volumeExists = await (0, get_docker_executor_1.existsVolume)(environment, volumeName);
|
|
129
129
|
if (volumeExists) {
|
|
130
|
-
|
|
131
|
-
const volume = await environment.docker.getVolume(volumeName);
|
|
132
|
-
await volume.remove();
|
|
130
|
+
await (0, get_docker_executor_1.removeVolume)(environment, nodeStatus, volumeName);
|
|
133
131
|
}
|
|
134
132
|
else {
|
|
135
133
|
nodeStatus.write('info', `generate ${generate} has no volume ${volumeName}`);
|
|
@@ -154,9 +152,7 @@ async function cleanCache(workTree, environment, options) {
|
|
|
154
152
|
if (!volumeExists) {
|
|
155
153
|
continue;
|
|
156
154
|
}
|
|
157
|
-
|
|
158
|
-
const containerVolume = await environment.docker.getVolume(volume.name);
|
|
159
|
-
await containerVolume.remove();
|
|
155
|
+
await (0, get_docker_executor_1.removeVolume)(environment, nodeStatus, volume.name);
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
158
|
}
|