Get started
Devfile validation rules
Id and name:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
The restriction is added to allow easy translation to K8s resource names, and also to have consistent rules for both name and id fields.
The validation will be done as part of schema validation, the rule will be introduced as a regex in schema definition, any objection of the rule in devfile will result in a failure.
- Limit to lowercase characters i.e., no uppercase allowed
- Limit within 63 characters
- No special characters allowed except dash(-)
- Start with an alphanumeric character
- End with an alphanumeric character
Endpoints:
- All the endpoint names are unique across components
- Endpoint ports must be unique across
containercomponents -- twocontainercomponents cannot have the sametargetPort, but onecontainercomponent may have two endpoints with the sametargetPort. This restriction does not apply tocontainercomponents withdedicatedPodset totrue.
Commands:
idmust be uniquecompositecommand:- Should not reference itself via a subcommand
- Should not indirectly reference itself via a subcommand which is a
compositecommand - Should reference a valid devfile command
execcommand should: map to a validcontainercomponentapplycommand should: map to a validcontainer/kubernetes/openshift/imagecomponent{build, run, test, debug, deploy}, each kind of group can only have one default command associated with it. If there are multiple commands of the same kind without a default, a warning will be displayed.
Components:
Common rules for all components types:
namemust be unique
Container component
- The container components must reference a valid volume component if it uses volume mounts, and the volume components are unique
PROJECT_SOURCEorPROJECTS_ROOTare reserved environment variables defined under env, cannot be defined again inenv- The annotations should not have conflict values for same key, except deployment annotations and service annotations set for a container with
dedicatedPod=true - Resource requirements, e.g.
cpuLimit,cpuRequest,memoryLimit,memoryRequest, must be in valid quantity format; and the resource requested must be less than the resource limit (if specified).
Plugin component
- Commands in plugins components share the same commands validation rules as listed above. Validation occurs after overriding and merging, in flattened devfile
- Registry URL needs to be in valid format
Kubernetes & OpenShift component
urineeds to be a valid URI format
Image component
- An
imagecomponent's git source cannot have more than one remote defined. If checkout remote is mentioned, validate it against the remote configured map
Events:
preStartandpostStopevents can only beapplycommandspostStartandpreStopevents can only beexeccommands- If
preStartandpostStopevents refer to acompositecommand, then all containing commands need to beapplycommands. - If
postStartandpreStopevents refer to acompositecommand, then all containing commands need to beexeccommands.
Parent:
- Share the same validation rules as listed above. Validation occurs after overriding and merging, in flattened devfile
Starter projects:
- Starter project entries cannot have more than one remote defined
- If
checkoutFrom.remoteis mentioned, validate it against the starter project remote configured map
Projects
checkoutFrom.remoteis mandatory if more than one remote is configured- If checkout remote is mentioned, validate it against the starter project remote configured map