From c9bd37bf0bbab4d43b05dd7f8665eea23cb1730f Mon Sep 17 00:00:00 2001 From: Josh Spicer Date: Fri, 3 Mar 2023 19:18:25 +0000 Subject: [PATCH 1/2] Add lifecycle hooks to devContainerFeature schema With CLI v0.32.0 and https://github.com/devcontainers/cli/pull/390, devcontainer-feature.json now support lifecycle hooks. Spec proposal: https://github.com/devcontainers/spec/blob/b1d19a5375f667a1bb91e86311bc37c36312996b/proposals/features-contribute-lifecycle-scripts.md --- schemas/devContainerFeature.schema.json | 102 +++++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/schemas/devContainerFeature.schema.json b/schemas/devContainerFeature.schema.json index ce8ed877..b227c954 100644 --- a/schemas/devContainerFeature.schema.json +++ b/schemas/devContainerFeature.schema.json @@ -102,7 +102,107 @@ "deprecated": { "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.", "type": "boolean" - } + }, + "onCreateCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + }, + "updateContentCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + }, + "postCreateCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + }, + "postStartCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + }, + "postAttachCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + } }, "required": [ "id", From 2573eb09bf862d9dd9100be369cc896d2dcf39b8 Mon Sep 17 00:00:00 2001 From: Josh Spicer Date: Thu, 9 Mar 2023 18:25:26 +0000 Subject: [PATCH 2/2] Description for providing an option to lifecycle hook --- schemas/devContainer.base.schema.json | 10 +- schemas/devContainerFeature.schema.json | 200 ++++++++++++------------ 2 files changed, 105 insertions(+), 105 deletions(-) diff --git a/schemas/devContainer.base.schema.json b/schemas/devContainer.base.schema.json index 2d112dcb..c9183827 100644 --- a/schemas/devContainer.base.schema.json +++ b/schemas/devContainer.base.schema.json @@ -276,7 +276,7 @@ "array", "object" ], - "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.", + "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.", "items": { "type": "string" }, @@ -296,7 +296,7 @@ "array", "object" ], - "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.", + "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.", "items": { "type": "string" }, @@ -316,7 +316,7 @@ "array", "object" ], - "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.", + "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.", "items": { "type": "string" }, @@ -336,7 +336,7 @@ "array", "object" ], - "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.", + "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.", "items": { "type": "string" }, @@ -356,7 +356,7 @@ "array", "object" ], - "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.", + "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.", "items": { "type": "string" }, diff --git a/schemas/devContainerFeature.schema.json b/schemas/devContainerFeature.schema.json index b227c954..47241616 100644 --- a/schemas/devContainerFeature.schema.json +++ b/schemas/devContainerFeature.schema.json @@ -104,105 +104,105 @@ "type": "boolean" }, "onCreateCommand": { - "type": [ - "string", - "array", - "object" - ], - "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.", - "items": { - "type": "string" - }, - "additionalProperties": { - "type": [ - "string", - "array" - ], - "items": { - "type": "string" - } - } - }, - "updateContentCommand": { - "type": [ - "string", - "array", - "object" - ], - "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.", - "items": { - "type": "string" - }, - "additionalProperties": { - "type": [ - "string", - "array" - ], - "items": { - "type": "string" - } - } - }, - "postCreateCommand": { - "type": [ - "string", - "array", - "object" - ], - "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.", - "items": { - "type": "string" - }, - "additionalProperties": { - "type": [ - "string", - "array" - ], - "items": { - "type": "string" - } - } - }, - "postStartCommand": { - "type": [ - "string", - "array", - "object" - ], - "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.", - "items": { - "type": "string" - }, - "additionalProperties": { - "type": [ - "string", - "array" - ], - "items": { - "type": "string" - } - } - }, - "postAttachCommand": { - "type": [ - "string", - "array", - "object" - ], - "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.", - "items": { - "type": "string" - }, - "additionalProperties": { - "type": [ - "string", - "array" - ], - "items": { - "type": "string" - } - } - } + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + }, + "updateContentCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + }, + "postCreateCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + }, + "postStartCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + }, + "postAttachCommand": { + "type": [ + "string", + "array", + "object" + ], + "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.", + "items": { + "type": "string" + }, + "additionalProperties": { + "type": [ + "string", + "array" + ], + "items": { + "type": "string" + } + } + } }, "required": [ "id", @@ -334,4 +334,4 @@ "$ref": "#/definitions/Feature" } ] -} +} \ No newline at end of file