id | title |
---|---|
custom-template |
Custom Template |
External users can provide and maintain templates used by the playground.
To create a template the following steps are mandatory:
- create
.devcontainer/devcontainer.json
(find an example here) - create a Github worflow that build this image then dispatches an event to
substrate-playground
(find an example here)
Additionally there are a number of standard VSCode configuration files that will be leveraged by the playground:
- .vscode/settings.json (see https://code.visualstudio.com/docs/getstarted/settings)
- .vscode/launch.json
- .vscode/tasks.json
- .vscode/snippets.code-snippets
After the associated Github workflow in substrate-playground is triggered, playground will use the newly built image.
Replace ENV, USER, HOST (via ${containerEnv:VAR_NAME})
preCreateCommand
is executed
preContainerStartCommand
via Init Containers, can write files
postContainerStartCommand
via Container lifecycle hooks, run inside the container
preContainerStopCommand
via Container lifecycle hooks, run inside the container
Container killed after terminationGracePeriodSeconds
https://www.linkedin.com/pulse/kubernetes-deep-dive-part-1-init-containers-lifecycle-chauthaiwale/
https://kubernetes.io/fr/docs/concepts/containers/container-lifecycle-hooks/
preStartCommand
postStartCommand
(or postAttachCommand
) are executed
menuActions
TODO: support string and array syntax TODO: add postCreateCommand
Potential hooks:
- when image is created (
preCreateCommand
) - when user deploy a template ** server side ** before theia loads ** after theia is loaded, headless or in a shell
A template workflow can be found here.
client_payload
must define id
pointing to one of the existing templates.
It can also define a ref
(branch/tag/commit used to build, defaults to master) and a dockerFile
location (default to .devcontainer/Dockerfile)
This workflow will trigger the template-updated workflow on substrate-playground, including the following actions:
- create and publish a composite docker image from the new template one and latest base one
- update template image id
- commit changes
Changes to the configuration file are finally continuously deployed to the staging playground environment as kubernetes ConfigMap.
Once live, images are tested and rollbacked if errors are detected.
sequenceDiagram
CUSTOM_TEMPLATE->>PLAYGROUND: Trigger template-updated
PLAYGROUND->>PLAYGROUND: Build docker image
PLAYGROUND-->>PLAYGROUND: Build template docker image
PLAYGROUND-->>PLAYGROUND: Push new configuration to staging
PLAYGROUND-->>PLAYGROUND: Test new image
The following secrets must be defined:
REPO_ACCESS_TOKEN
a token with public_repo
or repo scope