Skip to content

Commit

Permalink
Add Cmd validation for v1alpha2 Template commands (#695)
Browse files Browse the repository at this point in the history
We expect action commands configured on templates to be unix paths that reference an executable. This adds a validation to ensure its a single path. 

The command will translate in implementation to a Docker entrypoint which has 2 forms. We're only allowing a single argument as the entrypoint that can accept a number of args `<cmd> <arg1> ...<argN>` for simplicity.
  • Loading branch information
mergify[bot] authored Apr 10, 2023
2 parents d8f27a7 + 03aafc9 commit f017f99
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/v1alpha2/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ type Action struct {
// Image is an OCI image.
Image string `json:"image"`

// Cmd defines the command to use when launching the image.
// Cmd defines the command to use when launching the image. It overrides the default command
// of the action. It must be a unix path to an executable program.
// +kubebuilder:validation:Pattern=`^(/[^/ ]*)+/?$`
// +optional
Cmd *string `json:"cmd,omitempty"`

// Args are a set of arguments to be passed to the container on launch.
// Args are a set of arguments to be passed to the command executed by the container on
// launch.
// +optional
Args []string `json:"args,omitempty"`

Expand Down

0 comments on commit f017f99

Please sign in to comment.