Referring to a parent devfile in a devfile
This section describes how to designate a parent devfile to a given devfile. If you designate a parent devfile, the given devfile inherits all its behavior from its parent. Still, you can use the child devfile to override certain content from the parent devfile. If you override the correct content, you can reuse the same parent devfile in multiple other devfiles. If you do reuse a parent devfile, the parent turns into a stack that is used in multiple other devfiles.
-
Define the
schemaVersion
to v2.x. If you need to define yourschemaVersion
, go to Adding schema version to a devfile. -
Define a name for the devfile. If you need to define a name for your devfile, go to Adding a name to a devfile.
You can refer to a parent devfile in three different ways:
-
id
-
uri
-
kubernetes
Example 1. Parent referred by registryUsing its
id
if it has been published in a registry.schemaVersion: 2.1.0 metadata: name: my-project-dev parent: id: redhat/nodejs registryUrl: https://devfile-registry.io/
Example 2. Parent referred by uriUsing the URI if it has been published on a static http server (like gist or pastebin).
schemaVersion: 2.1.0 metadata: name: my-project-dev parent: uri: https://raw.githubusercontent.com/devfile/registry/main/stacks/nodejs/devfile.yaml
Example 3. Parent identified by a Kubernetes resourceUsing a Kubernetes resource name and namespace if it has been deployed on a Kubernete cluster.
schemaVersion: 2.1.0 metadata: name: my-project-dev parent: kubernetes: name: mydevworkspacetemplate namespace: mynamespace
For more information on referring to parent devfiles, go to the following topics: