Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Latest commit

 

History

History
87 lines (55 loc) · 3.85 KB

custom-template.md

File metadata and controls

87 lines (55 loc) · 3.85 KB
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:

After the associated Github workflow in substrate-playground is triggered, playground will use the newly built image.

Custom commands

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

Github workflow

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:

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
Loading

Github secrets

The following secrets must be defined:

REPO_ACCESS_TOKEN a token with public_repo or repo scope