Project: Devfile (App Definition and Development / Application Definition & Image Build)
File: validation-rule.md

`^?$` 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 all the endpoint names are unique across components endpoint ports must be unique across container components -- two container components cannot have the same target port, but one container component may have two endpoints with the same target port. This restriction does not apply to container components with `dedicatedPod` set to `true`. id must be unique composite 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 valid container component apply command should: map to a valid container/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. Common rules for all components types: Name must be unique the container components must reference a valid volume component if it uses volume mounts, and the volume components are unique `PROJECTSOURCE` or `PROJECTSROOT` are reserved environment variables defined under env, cannot be defined again in `env` 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). 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 URI needs to be in valid URI format A Dockerfile Image component's git source cannot have more than one remote defined. If checkout remote is mentioned, validate it against the remote configured map preStart and postStop events can only be Apply commands postStart and preStop events can only be Exec commands if preStart and postStop events refer to a composite command, then all containing commands need to be Apply commands. if postStart and preStop events refer to a composite command, then all containing commands need to be Exec commands. Share the same validation rules as listed above. Validation occurs after overriding and merging, in flattened devfile Starter project entries cannot have more than one remote defined if checkout remote is mentioned, validate it against the starter project remote configured map if more than one remote is configured, a checkout remote is mandatory if checkout remote is mentioned, validate it against the starter project remote configured map