Skip to content

Commit 15f30fd

Browse files
authored
[schema] Add lifecycle hooks to devContainerFeature (#207)
* Add lifecycle hooks to devContainerFeature schema With CLI v0.32.0 and devcontainers/cli#390, devcontainer-feature.json now support lifecycle hooks. Spec proposal: https://github.com/devcontainers/spec/blob/b1d19a5375f667a1bb91e86311bc37c36312996b/proposals/features-contribute-lifecycle-scripts.md * Description for providing an option to lifecycle hook
1 parent b1d19a5 commit 15f30fd

2 files changed

Lines changed: 106 additions & 6 deletions

File tree

schemas/devContainer.base.schema.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
"array",
277277
"object"
278278
],
279-
"description": "A command to run when creating the container. This command is run after \"initializeCommand\" and before \"updateContentCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.",
279+
"description": "A command to run when creating the container. This command is run after \"initializeCommand\" and before \"updateContentCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
280280
"items": {
281281
"type": "string"
282282
},
@@ -296,7 +296,7 @@
296296
"array",
297297
"object"
298298
],
299-
"description": "A command to run when creating the container and rerun when the workspace content was updated while creating the container. This command is run after \"onCreateCommand\" and before \"postCreateCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.",
299+
"description": "A command to run when creating the container and rerun when the workspace content was updated while creating the container. This command is run after \"onCreateCommand\" and before \"postCreateCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
300300
"items": {
301301
"type": "string"
302302
},
@@ -316,7 +316,7 @@
316316
"array",
317317
"object"
318318
],
319-
"description": "A command to run after creating the container. This command is run after \"updateContentCommand\" and before \"postStartCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.",
319+
"description": "A command to run after creating the container. This command is run after \"updateContentCommand\" and before \"postStartCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
320320
"items": {
321321
"type": "string"
322322
},
@@ -336,7 +336,7 @@
336336
"array",
337337
"object"
338338
],
339-
"description": "A command to run after starting the container. This command is run after \"postCreateCommand\" and before \"postAttachCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.",
339+
"description": "A command to run after starting the container. This command is run after \"postCreateCommand\" and before \"postAttachCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
340340
"items": {
341341
"type": "string"
342342
},
@@ -356,7 +356,7 @@
356356
"array",
357357
"object"
358358
],
359-
"description": "A command to run when attaching to the container. This command is run after \"postStartCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.",
359+
"description": "A command to run when attaching to the container. This command is run after \"postStartCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
360360
"items": {
361361
"type": "string"
362362
},

schemas/devContainerFeature.schema.json

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,106 @@
102102
"deprecated": {
103103
"description": "Indicates that the Feature is deprecated, and will not receive any further updates/support. This property is intended to be used by the supporting tools for highlighting Feature deprecation.",
104104
"type": "boolean"
105+
},
106+
"onCreateCommand": {
107+
"type": [
108+
"string",
109+
"array",
110+
"object"
111+
],
112+
"description": "A command to run when creating the container. This command is run after \"initializeCommand\" and before \"updateContentCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
113+
"items": {
114+
"type": "string"
115+
},
116+
"additionalProperties": {
117+
"type": [
118+
"string",
119+
"array"
120+
],
121+
"items": {
122+
"type": "string"
123+
}
124+
}
125+
},
126+
"updateContentCommand": {
127+
"type": [
128+
"string",
129+
"array",
130+
"object"
131+
],
132+
"description": "A command to run when creating the container and rerun when the workspace content was updated while creating the container. This command is run after \"onCreateCommand\" and before \"postCreateCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
133+
"items": {
134+
"type": "string"
135+
},
136+
"additionalProperties": {
137+
"type": [
138+
"string",
139+
"array"
140+
],
141+
"items": {
142+
"type": "string"
143+
}
144+
}
145+
},
146+
"postCreateCommand": {
147+
"type": [
148+
"string",
149+
"array",
150+
"object"
151+
],
152+
"description": "A command to run after creating the container. This command is run after \"updateContentCommand\" and before \"postStartCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
153+
"items": {
154+
"type": "string"
155+
},
156+
"additionalProperties": {
157+
"type": [
158+
"string",
159+
"array"
160+
],
161+
"items": {
162+
"type": "string"
163+
}
164+
}
165+
},
166+
"postStartCommand": {
167+
"type": [
168+
"string",
169+
"array",
170+
"object"
171+
],
172+
"description": "A command to run after starting the container. This command is run after \"postCreateCommand\" and before \"postAttachCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
173+
"items": {
174+
"type": "string"
175+
},
176+
"additionalProperties": {
177+
"type": [
178+
"string",
179+
"array"
180+
],
181+
"items": {
182+
"type": "string"
183+
}
184+
}
185+
},
186+
"postAttachCommand": {
187+
"type": [
188+
"string",
189+
"array",
190+
"object"
191+
],
192+
"description": "A command to run when attaching to the container. This command is run after \"postStartCommand\". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.",
193+
"items": {
194+
"type": "string"
195+
},
196+
"additionalProperties": {
197+
"type": [
198+
"string",
199+
"array"
200+
],
201+
"items": {
202+
"type": "string"
203+
}
204+
}
105205
}
106206
},
107207
"required": [
@@ -234,4 +334,4 @@
234334
"$ref": "#/definitions/Feature"
235335
}
236336
]
237-
}
337+
}

0 commit comments

Comments
 (0)