To add a devfile:
-
Check out the devfile registry sources.
$ git clone https://github.com/eclipse/che-devfile-registry; \ cd che-devfile-registry
-
Create a
devfile.yamlandmeta.yamlin some local folder. This can be done from scratch or by copying from an existing devfile.$ STACK="new-stack"; \ mkdir -p devfiles/${STACK}; cp devfiles/nodejs/* devfiles/${STACK}/ -
If copying from an existing devfile, make changes to the devfile to suit your needs. Make sure your new devfile has a unique
displayNameanddescription. -
Get the name of the Pod that hosts the devfile registry container. To do this, filter the
component=devfile-registrylabel:$ DEVFILE_REG_POD=$(kubectl get -o custom-columns=NAME:.metadata.name \ --no-headers pod -l component=devfile-registry)
-
Regenerate the registry’s
index.jsonfile to include your new devfile.$ cd che-devfile-registry; \ "$(pwd)/build/scripts/check_mandatory_fields.sh" devfiles; \ "$(pwd)/build/scripts/index.sh" > index.json
-
Copy the new
index.json,devfile.yamlandmeta.yamlfiles from your new local devfile folder to the container.$ cd che-devfile-registry; \ LOCAL_FILES="$(pwd)/${STACK}/meta.yaml $(pwd)/${STACK}/devfile.yaml $(pwd)/index.json"; \ kubectl exec ${DEVFILE_REG_POD} -i -t -- mkdir -p /var/www/html/devfiles/${STACK}; \ for f in $LOCAL_FILES; do e=${f/$(pwd)\//}; echo "Upload ${f} -> /var/www/html/devfiles/${e}" kubectl cp "${f}" ${DEVFILE_REG_POD}:/var/www/html/devfiles/${e}; done -
The new devfile can now be used from the existing Che instance’s devfile registry. To discover it, go to the Che dashboard, then click the
Workspaceslink. From there, clickAdd Workspaceto see the updated list of available devfiles.