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
container
components -- twocontainer
components cannot have the sametargetPort
, but onecontainer
component may have two endpoints with the sametargetPort
. This restriction does not apply tocontainer
components withdedicatedPod
set totrue
.
Commands:
id
must be uniquecomposite
command:- Should not reference itself via a subcommand
- Should not indirectly reference itself via a subcommand which is a
composite
command - Should reference a valid devfile command
exec
command should: map to a validcontainer
componentapply
command should: map to a validcontainer
/kubernetes
/openshift
/image
component{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:
name
must 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_SOURCE
orPROJECTS_ROOT
are 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
uri
needs to be a valid URI format
Image component
- An
image
component's git source cannot have more than one remote defined. If checkout remote is mentioned, validate it against the remote configured map
Events:
preStart
andpostStop
events can only beapply
commandspostStart
andpreStop
events can only beexec
commands- If
preStart
andpostStop
events refer to acomposite
command, then all containing commands need to beapply
commands. - If
postStart
andpreStop
events refer to acomposite
command, then all containing commands need to beexec
commands.
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.remote
is mentioned, validate it against the starter project remote configured map
Projects
checkoutFrom.remote
is mandatory if more than one remote is configured- If checkout remote is mentioned, validate it against the starter project remote configured map