diff --git a/cmd/entrypoint/main.go b/cmd/entrypoint/main.go index 445452f7464..65b05873365 100644 --- a/cmd/entrypoint/main.go +++ b/cmd/entrypoint/main.go @@ -30,6 +30,7 @@ import ( "github.com/containerd/containerd/platforms" "github.com/tektoncd/pipeline/cmd/entrypoint/subcommands" "github.com/tektoncd/pipeline/pkg/apis/pipeline" + "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/pkg/credentials" "github.com/tektoncd/pipeline/pkg/credentials/dockercreds" "github.com/tektoncd/pipeline/pkg/credentials/gitcreds" @@ -146,7 +147,7 @@ func main() { Results: strings.Split(*results, ","), Timeout: timeout, BreakpointOnFailure: *breakpointOnFailure, - OnError: *onError, + OnError: v1beta1.OnErrorType(*onError), StepMetadataDir: *stepMetadataDir, } @@ -175,12 +176,12 @@ func main() { if status, ok := t.Sys().(syscall.WaitStatus); ok { checkForBreakpointOnFailure(e, breakpointExitPostFile) // ignore a step error i.e. do not exit if a container terminates with a non-zero exit code when onError is set to "continue" - if e.OnError != entrypoint.ContinueOnError { + if e.OnError != v1beta1.Continue { os.Exit(status.ExitStatus()) } } // log and exit only if a step error must cause run failure - if e.OnError != entrypoint.ContinueOnError { + if e.OnError != v1beta1.Continue { log.Fatalf("Error executing command (ExitError): %v", err) } default: diff --git a/docs/pipeline-api.md b/docs/pipeline-api.md index 61552f0e3b9..ac48e3d5d7b 100644 --- a/docs/pipeline-api.md +++ b/docs/pipeline-api.md @@ -24,8 +24,160 @@ weight: 1000 Resource Types:
+Pipeline describes a list of Tasks to execute. It expresses how outputs +of tasks feed into inputs of subsequent tasks.
+Field | +Description | +||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+apiVersion +string |
+
+
+tekton.dev/v1
+
+ |
+||||||||||||
+kind +string + |
+Pipeline |
+||||||||||||
+metadata + + +Kubernetes meta/v1.ObjectMeta + + + |
+
+(Optional)
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
+ |
+||||||||||||
+spec + + +PipelineSpec + + + |
+
+(Optional)
+ Spec holds the desired state of the Pipeline from the client ++ +
|
+
-(Appears on:Param, ParamSpec, TaskRunResult) +(Appears on:Param, ParamSpec, PipelineResult, TaskRunResult)
ArrayOrString is a type that can hold a single string or string array. @@ -270,8 +422,122 @@ map[string]string +
+(Appears on:PipelineTask) +
+EmbeddedTask is used to define a Task inline within a Pipeline’s PipelineTasks.
+Field | +Description | +||||
---|---|---|---|---|---|
+spec + +k8s.io/apimachinery/pkg/runtime.RawExtension + + |
+
+(Optional)
+ Spec is a specification of a custom task ++ +
|
+||||
+metadata + + +PipelineTaskMetadata + + + |
++(Optional) + | +||||
+TaskSpec + + +TaskSpec + + + |
+
+
+(Members of TaskSpec is a specification of a task + |
+
string
alias)+(Appears on:Step) +
+OnErrorType defines a list of supported exiting behavior of a container on error
+Value | +Description | +
---|---|
"continue" |
+Continue indicates continue executing the rest of the steps irrespective of the container exit code + |
+
"stopAndFail" |
+StopAndFail indicates exit the taskRun if the container exits with non-zero exit code + |
+
+(Appears on:PipelineTask) +
Param declares an ArrayOrString to use for the parameter called name.
+(Appears on:PipelineSpec, TaskSpec) +
+ParamSpec defines arbitrary parameters needed beyond typed inputs (such as +resources). Parameter values are provided by users as inputs on a TaskRun +or PipelineRun.
+Field | +Description | +
---|---|
+name + +string + + |
+
+ Name declares the name by which a parameter is referenced. + |
+
+type + + +ParamType + + + |
+
+(Optional)
+ Type is the user-specified type of the parameter. The possible types +are currently “string”, “array” and “object”, and “string” is the default. + |
+
+description + +string + + |
+
+(Optional)
+ Description is a user-facing description of the parameter that may be +used to populate a UI. + |
+
+properties + + +map[string]github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.PropertySpec + + + |
+
+(Optional)
+ Properties is the JSON Schema properties to support key-value pairs parameter. + |
+
+default + + +ArrayOrString + + + |
+
+(Optional)
+ Default is the value a parameter takes if no input value is supplied. If +default is set, a Task may be executed without a supplied value for the +parameter. + |
+
string
alias)+(Appears on:ArrayOrString, ParamSpec, PropertySpec) +
+ParamType indicates the type of an input parameter; +Used to distinguish between a single string and an array of strings.
+Value | +Description | +
---|---|
"array" |
++ |
"object" |
++ |
"string" |
++ |
+(Appears on:PipelineSpec) +
+PipelineResult used to describe the results of a pipeline
+Field | +Description | +
---|---|
+name + +string + + |
+
+ Name the given name + |
+
+type + + +ResultsType + + + |
+
+ Type is the user-specified type of the result. +The possible types are ‘string’, ‘array’, and ‘object’, with ‘string’ as the default. +‘array’ and ‘object’ types are alpha features. + |
+
+description + +string + + |
+
+(Optional)
+ Description is a human-readable description of the result + |
+
+value + + +ArrayOrString + + + |
+
+ Value the expression used to retrieve the value + |
+
+(Appears on:Pipeline) +
+PipelineSpec defines the desired state of Pipeline.
+Field | +Description | +
---|---|
+description + +string + + |
+
+(Optional)
+ Description is a user-facing description of the pipeline that may be +used to populate a UI. + |
+
+tasks + + +[]PipelineTask + + + |
+
+ Tasks declares the graph of Tasks that execute when this Pipeline is run. + |
+
+params + + +[]ParamSpec + + + |
+
+ Params declares a list of input parameters that must be supplied when +this Pipeline is run. + |
+
+workspaces + + +[]PipelineWorkspaceDeclaration + + + |
+
+(Optional)
+ Workspaces declares a set of named workspaces that are expected to be +provided by a PipelineRun. + |
+
+results + + +[]PipelineResult + + + |
+
+(Optional)
+ Results are values that this pipeline can output once run + |
+
+finally + + +[]PipelineTask + + + |
+
+ Finally declares the list of Tasks that execute just before leaving the Pipeline +i.e. either after all Tasks are finished executing successfully +or after a failure which would result in ending the Pipeline + |
+
+(Appears on:PipelineSpec) +
+PipelineTask defines a task in a Pipeline, passing inputs from both +Params and from the output of previous tasks.
+Field | +Description | +
---|---|
+name + +string + + |
+
+ Name is the name of this task within the context of a Pipeline. Name is
+used as a coordinate with the |
+
+taskRef + + +TaskRef + + + |
+
+(Optional)
+ TaskRef is a reference to a task definition. + |
+
+taskSpec + + +EmbeddedTask + + + |
+
+(Optional)
+ TaskSpec is a specification of a task + |
+
+when + + +WhenExpressions + + + |
+
+(Optional)
+ When is a list of when expressions that need to be true for the task to run + |
+
+retries + +int + + |
+
+(Optional)
+ Retries represents how many times this task should be retried in case of task failure: ConditionSucceeded set to False + |
+
+runAfter + +[]string + + |
+
+(Optional)
+ RunAfter is the list of PipelineTask names that should be executed before +this Task executes. (Used to force a specific ordering in graph execution.) + |
+
+params + + +[]Param + + + |
+
+(Optional)
+ Parameters declares parameters passed to this task. + |
+
+matrix + + +[]Param + + + |
+
+(Optional)
+ Matrix declares parameters used to fan out this task. + |
+
+workspaces + + +[]WorkspacePipelineTaskBinding + + + |
+
+(Optional)
+ Workspaces maps workspaces from the pipeline spec to the workspaces +declared in the Task. + |
+
+timeout + + +Kubernetes meta/v1.Duration + + + |
+
+(Optional)
+ Time after which the TaskRun times out. Defaults to 1 hour. +Specified TaskRun timeout should be less than 24h. +Refer Go’s ParseDuration documentation for expected format: https://golang.org/pkg/time/#ParseDuration + |
+
-(Appears on:TaskSpec) +(Appears on:EmbeddedTask)
ParamSpec defines arbitrary parameters needed beyond typed inputs (such as -resources). Parameter values are provided by users as inputs on a TaskRun -or PipelineRun.
+PipelineTaskMetadata contains the labels or annotations for an EmbeddedTask
-name + labels -string +map[string]string |
- Name declares the name by which a parameter is referenced. +(Optional) |
-type + annotations - -ParamType - +map[string]string |
(Optional)
- Type is the user-specified type of the parameter. The possible types -are currently “string”, “array” and “object”, and “string” is the default. |
PipelineTaskParam is used to provide arbitrary string parameters to a Task.
+
-description - -string - - |
-
-(Optional)
- Description is a user-facing description of the parameter that may be -used to populate a UI. - |
+Field | +Description |
---|---|---|---|
-properties + name - -map[string]github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.PropertySpec - +string |
-(Optional)
- Properties is the JSON Schema properties to support key-value pairs parameter. |
||
-default + value - -ArrayOrString - +string |
-(Optional)
- Default is the value a parameter takes if no input value is supplied. If -default is set, a Task may be executed without a supplied value for the -parameter. |
string
alias)-(Appears on:ArrayOrString, ParamSpec, PropertySpec) -
-ParamType indicates the type of an input parameter; -Used to distinguish between a single string and an array of strings.
-Value | -Description | -
---|---|
"array" |
-- |
"object" |
-- |
"string" |
-- |
+(Appears on:PipelineSpec) +
WorkspacePipelineDeclaration creates a named slot in a Pipeline that a PipelineRun is expected to populate with a workspace binding. @@ -557,6 +1230,9 @@ passed to the resolver.
+(Appears on:TaskRef) +
ResolverRef can be used to refer to a Pipeline or Task in a remote location like a git repo. This feature is in alpha and these fields @@ -604,10 +1280,65 @@ the chosen resolver.
+ResultRef is a type that represents a reference to a task run result
+Field | +Description | +
---|---|
+pipelineTask + +string + + |
++ | +
+result + +string + + |
++ | +
+resultsIndex + +int + + |
++ | +
+property + +string + + |
++ | +
string
alias)-(Appears on:TaskResult, TaskRunResult) +(Appears on:PipelineResult, TaskResult, TaskRunResult)
ResultsType indicates the type of a result; @@ -657,8 +1388,8 @@ string
Name of the container specified as a DNS_LABEL. -Each container in a pod must have a unique name (DNS_LABEL). +
Name of the Sidecar specified as a DNS_LABEL. +Each Sidecar in a Task must have a unique name (DNS_LABEL). Cannot be updated.
Docker image name. +
Image reference name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.
@@ -687,8 +1418,8 @@ container images in workload controllers like Deployments and StatefulSets.Entrypoint array. Not executed within a shell. -The docker image’s ENTRYPOINT is used if this is not provided. -Variable references $(VAR_NAME) are expanded using the container’s environment. If a variable +The image’s ENTRYPOINT is used if this is not provided. +Variable references $(VAR_NAME) are expanded using the Sidecar’s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. “$$(VAR_NAME)” will produce the string literal “$(VAR_NAME)”. Escaped references will never be expanded, regardless @@ -706,8 +1437,8 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Periodic probe of container service readiness. +
Periodic probe of Sidecar service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
@@ -874,7 +1605,7 @@ Kubernetes core/v1.ProbeStartupProbe indicates that the Pod has successfully initialized. +
StartupProbe indicates that the Pod the Sidecar is running in has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod’s lifecycle, @@ -894,7 +1625,7 @@ Kubernetes core/v1.Lifecycle
Actions that the management system should take in response to container lifecycle events. +
Actions that the management system should take in response to Sidecar lifecycle events. Cannot be updated.
Optional: Path at which the file to which the container’s termination message -will be written is mounted into the container’s filesystem. +
Optional: Path at which the file to which the Sidecar’s termination message +will be written is mounted into the Sidecar’s filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. @@ -928,9 +1659,9 @@ Kubernetes core/v1.TerminationMessagePolicy
Indicate how the termination message should be populated. File will use the contents of -terminationMessagePath to populate the container status message on both success and failure. -FallbackToLogsOnError will use the last chunk of container log output if the termination -message file is empty and the container exited with an error. +terminationMessagePath to populate the Sidecar status message on both success and failure. +FallbackToLogsOnError will use the last chunk of Sidecar log output if the termination +message file is empty and the Sidecar exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.
@@ -965,7 +1696,7 @@ Kubernetes core/v1.SecurityContextSecurityContext defines the security options the container should be run with. +
SecurityContext defines the security options the Sidecar should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
Whether this container should allocate a buffer for stdin in the container runtime. If this -is not set, reads from stdin in the container will always result in EOF. +
Whether this Sidecar should allocate a buffer for stdin in the container runtime. If this +is not set, reads from stdin in the Sidecar will always result in EOF. Default is false.
Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach -sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the +sessions. If stdinOnce is set to true, stdin is opened on Sidecar start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, -at which time stdin is closed and remains closed until the container is restarted. If this +at which time stdin is closed and remains closed until the Sidecar is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false
@@ -1011,7 +1742,7 @@ boolWhether this container should allocate a TTY for itself, also requires ‘stdin’ to be true. +
Whether this Sidecar should allocate a TTY for itself, also requires ‘stdin’ to be true. Default is false.
Name of the container specified as a DNS_LABEL. -Each container in a pod must have a unique name (DNS_LABEL). -Cannot be updated.
+Name of the Step specified as a DNS_LABEL. +Each Step in a Task must have a unique name.
Docker image name. -More info: https://kubernetes.io/docs/concepts/containers/images -This field is optional to allow higher level config management to default or override -container images in workload controllers like Deployments and StatefulSets.
+More info: https://kubernetes.io/docs/concepts/containers/imagesEntrypoint array. Not executed within a shell. -The docker image’s ENTRYPOINT is used if this is not provided. +The image’s ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container’s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. “$$(VAR_NAME)” will @@ -1122,7 +1850,7 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
onError
OnError defines the exiting behavior of a container on error -can be set to [ continue | stopAndFail ] -stopAndFail indicates exit the taskRun if the container exits with non-zero exit code -continue indicates continue executing the rest of the steps irrespective of the container exit code
+can be set to [ continue | stopAndFail ]Docker image name. +
Image reference name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.
@@ -1421,8 +2149,8 @@ container images in workload controllers like Deployments and StatefulSets.Entrypoint array. Not executed within a shell. -The docker image’s ENTRYPOINT is used if this is not provided. -Variable references $(VAR_NAME) are expanded using the container’s environment. If a variable +The image’s ENTRYPOINT is used if this is not provided. +Variable references $(VAR_NAME) are expanded using the Step’s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. “$$(VAR_NAME)” will produce the string literal “$(VAR_NAME)”. Escaped references will never be expanded, regardless @@ -1440,8 +2168,8 @@ More info: +Kubernetes core/v1.ResourceRequirements + + +
Compute Resources required by this Step. +Cannot be updated. +More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
+volumeMounts
Volumes to mount into the Step’s filesystem. Cannot be updated.
resources
Compute Resources required by this container. -Cannot be updated. -More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
+volumeDevices
volumeDevices is the list of block devices to be used by the Step.
+imagePullPolicy
Image pull policy. +One of Always, Never, IfNotPresent. +Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. +Cannot be updated. +More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
+securityContext
SecurityContext defines the security options the Step should be run with. +If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. +More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
+string
alias)+(Appears on:TaskRef) +
+TaskKind defines the type of Task used by the pipeline.
+Value | +Description | +
---|---|
"Task" |
+NamespacedTaskKind indicates that the task type has a namespaced scope. |
+
+(Appears on:PipelineTask) +
+TaskRef can be used to refer to a specific instance of a task.
+Field | +Description |
---|---|
-volumeMounts + name - -[]Kubernetes core/v1.VolumeMount - +string |
-(Optional)
- Pod volumes to mount into the container’s filesystem. -Cannot be updated. +Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names |
-volumeDevices + kind - -[]Kubernetes core/v1.VolumeDevice + +TaskKind |
-(Optional)
- volumeDevices is the list of block devices to be used by the container. +TaskKind indicates the kind of the task, namespaced or cluster scoped. |
-imagePullPolicy + apiVersion - -Kubernetes core/v1.PullPolicy - +string |
(Optional)
- Image pull policy. -One of Always, Never, IfNotPresent. -Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. -Cannot be updated. -More info: https://kubernetes.io/docs/concepts/containers/images#updating-images +API version of the referent |
-securityContext + ResolverRef - -Kubernetes core/v1.SecurityContext + +ResolverRef |
(Optional)
- SecurityContext defines the security options the container should be run with. -If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. -More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ +ResolverRef allows referencing a Task in a remote location +like a git repo. This field is only supported when the alpha +feature gate is enabled. |
WhenExpression allows a PipelineTask to declare expressions to be evaluated before the Task is run +to determine whether the Task should be executed or skipped
+Field | +Description | +
---|---|
+input + +string + + |
+
+ Input is the string for guard checking which can be a static input or an output from a parent Task + |
+
+operator + +k8s.io/apimachinery/pkg/selection.Operator + + |
+
+ Operator that represents an Input’s relationship to the values + |
+
+values + +[]string + + |
+
+ Values is an array of strings, which is compared against the input, for guard checking +It must be non-empty + |
+
[]github.com/tektoncd/pipeline/pkg/apis/pipeline/v1.WhenExpression
alias)+(Appears on:PipelineTask) +
+WhenExpressions are used to specify whether a Task should be executed or skipped +All of them need to evaluate to True for a guarded Task to be executed.
++(Appears on:PipelineTask) +
WorkspacePipelineTaskBinding describes how a workspace passed into the pipeline should be mapped to a task’s declared workspace.
@@ -2246,6 +3126,20 @@ RunSpecStatusstatusMessage
Status message for cancellation.
+retries
statusMessage
Status message for cancellation.
+retries
string
alias)
++(Appears on:RunSpec) +
+RunSpecStatusMessage defines human readable status messages for the TaskRun.
+@@ -4066,6 +4982,20 @@ TaskRunSpecStatus
statusMessage
Status message for cancellation.
+timeout
string
alias)+(Appears on:Step) +
+OnErrorType defines a list of supported exiting behavior of a container on error
+Value | +Description | +
---|---|
"continue" |
+Continue indicates continue executing the rest of the steps irrespective of the container exit code + |
+
"stopAndFail" |
+StopAndFail indicates exit the taskRun if the container exits with non-zero exit code + |
+
@@ -6613,8 +7566,8 @@ string
Name of the container specified as a DNS_LABEL. -Each container in a pod must have a unique name (DNS_LABEL). +
Name of the Sidecar specified as a DNS_LABEL. +Each Sidecar in a Task must have a unique name (DNS_LABEL). Cannot be updated.
Docker image name. -More info: https://kubernetes.io/docs/concepts/containers/images -This field is optional to allow higher level config management to default or override -container images in workload controllers like Deployments and StatefulSets.
+Image name to be used by the Sidecar. +More info: https://kubernetes.io/docs/concepts/containers/images
Entrypoint array. Not executed within a shell. -The docker image’s ENTRYPOINT is used if this is not provided. -Variable references $(VAR_NAME) are expanded using the container’s environment. If a variable +The image’s ENTRYPOINT is used if this is not provided. +Variable references $(VAR_NAME) are expanded using the Sidecar’s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. “$$(VAR_NAME)” will produce the string literal “$(VAR_NAME)”. Escaped references will never be expanded, regardless @@ -6662,7 +7613,7 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Periodic probe of container service readiness. +
Periodic probe of Sidecar service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
@@ -6830,7 +7781,7 @@ Kubernetes core/v1.ProbeStartupProbe indicates that the Pod has successfully initialized. +
StartupProbe indicates that the Pod the Sidecar is running in has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod’s lifecycle, @@ -6850,7 +7801,7 @@ Kubernetes core/v1.Lifecycle
Actions that the management system should take in response to container lifecycle events. +
Actions that the management system should take in response to Sidecar lifecycle events. Cannot be updated.
Optional: Path at which the file to which the container’s termination message -will be written is mounted into the container’s filesystem. +
Optional: Path at which the file to which the Sidecar’s termination message +will be written is mounted into the Sidecar’s filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. @@ -6884,9 +7835,9 @@ Kubernetes core/v1.TerminationMessagePolicy
Indicate how the termination message should be populated. File will use the contents of -terminationMessagePath to populate the container status message on both success and failure. -FallbackToLogsOnError will use the last chunk of container log output if the termination -message file is empty and the container exited with an error. +terminationMessagePath to populate the Sidecar status message on both success and failure. +FallbackToLogsOnError will use the last chunk of Sidecar log output if the termination +message file is empty and the Sidecar exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.
@@ -6921,7 +7872,7 @@ Kubernetes core/v1.SecurityContextSecurityContext defines the security options the container should be run with. +
SecurityContext defines the security options the Sidecar should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
Whether this container should allocate a buffer for stdin in the container runtime. If this -is not set, reads from stdin in the container will always result in EOF. +
Whether this Sidecar should allocate a buffer for stdin in the container runtime. If this +is not set, reads from stdin in the Sidecar will always result in EOF. Default is false.
Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach -sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the +sessions. If stdinOnce is set to true, stdin is opened on Sidecar start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, -at which time stdin is closed and remains closed until the container is restarted. If this +at which time stdin is closed and remains closed until the Sidecar is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false
@@ -6967,7 +7918,7 @@ boolWhether this container should allocate a TTY for itself, also requires ‘stdin’ to be true. +
Whether this Sidecar should allocate a TTY for itself, also requires ‘stdin’ to be true. Default is false.
Name of the container specified as a DNS_LABEL. -Each container in a pod must have a unique name (DNS_LABEL). -Cannot be updated.
+Name of the Step specified as a DNS_LABEL. +Each Step in a Task must have a unique name.
Docker image name. -More info: https://kubernetes.io/docs/concepts/containers/images -This field is optional to allow higher level config management to default or override -container images in workload controllers like Deployments and StatefulSets.
+Image reference name to run for this Step. +More info: https://kubernetes.io/docs/concepts/containers/images
Entrypoint array. Not executed within a shell. -The docker image’s ENTRYPOINT is used if this is not provided. +The image’s ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container’s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. “$$(VAR_NAME)” will @@ -7237,7 +8185,7 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Deprecated. This field will be removed in a future release. Periodic probe of container service readiness. -Container will be removed from service endpoints if the probe fails. +Step will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
@@ -7409,7 +8357,7 @@ Kubernetes core/v1.ProbeDeprecated. This field will be removed in a future release. -DeprecatedStartupProbe indicates that the Pod has successfully initialized. +DeprecatedStartupProbe indicates that the Pod this Step runs in has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod’s lifecycle, @@ -7443,14 +8391,7 @@ string
Deprecated. This field will be removed in a future release. -Optional: Path at which the file to which the container’s termination message -will be written is mounted into the container’s filesystem. -Message written is intended to be brief final status, such as an assertion failure message. -Will be truncated by the node if greater than 4096 bytes. The total message length across -all containers will be limited to 12kb. -Defaults to /dev/termination-log. -Cannot be updated.
+Deprecated. This field will be removed in a future release and can’t be meaningfully used.
Deprecated. This field will be removed in a future release. -Indicate how the termination message should be populated. File will use the contents of -terminationMessagePath to populate the container status message on both success and failure. -FallbackToLogsOnError will use the last chunk of container log output if the termination -message file is empty and the container exited with an error. -The log output is limited to 2048 bytes or 80 lines, whichever is smaller. -Defaults to File. -Cannot be updated.
+Deprecated. This field will be removed in a future release and can’t be meaningfully used.
SecurityContext defines the security options the container should be run with. +
SecurityContext defines the security options the Step should be run with. If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
onError
OnError defines the exiting behavior of a container on error -can be set to [ continue | stopAndFail ] -stopAndFail indicates exit the taskRun if the container exits with non-zero exit code -continue indicates continue executing the rest of the steps irrespective of the container exit code
+can be set to [ continue | stopAndFail ]Deprecated. This field will be removed in a future release. -DeprecatedName of the container specified as a DNS_LABEL. -Each container in a pod must have a unique name (DNS_LABEL). +Default name for each Step specified as a DNS_LABEL. +Each Step in a Task must have a unique name. Cannot be updated.
Docker image name. +
Default image name to use for each Step. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.
@@ -7796,7 +8730,7 @@ container images in workload controllers like Deployments and StatefulSets. (Optional)Entrypoint array. Not executed within a shell. The docker image’s ENTRYPOINT is used if this is not provided. -Variable references $(VAR_NAME) are expanded using the container’s environment. If a variable +Variable references $(VAR_NAME) are expanded using the Step’s environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. “$$(VAR_NAME)” will produce the string literal “$(VAR_NAME)”. Escaped references will never be expanded, regardless @@ -7814,8 +8748,8 @@ More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Deprecated. This field will be removed in a future release. -Whether this container should allocate a buffer for stdin in the container runtime. If this -is not set, reads from stdin in the container will always result in EOF. +Whether this Step should allocate a buffer for stdin in the container runtime. If this +is not set, reads from stdin in the Step will always result in EOF. Default is false.
Deprecated. This field will be removed in a future release. -Whether this container should allocate a DeprecatedTTY for itself, also requires ‘stdin’ to be true. +Whether this Step should allocate a DeprecatedTTY for itself, also requires ‘stdin’ to be true. Default is false.
statusMessage
Status message for cancellation.
+timeout
TaskRunSpecStatus defines the taskrun spec status the user can provide
string
alias)+(Appears on:TaskRunSpec) +
+TaskRunSpecStatusMessage defines human readable status messages for the TaskRun.
+Value | +Description | +
---|---|
"TaskRun cancelled as the PipelineRun it belongs to has been cancelled." |
+TaskRunCancelledByPipelineMsg indicates that the PipelineRun of which this +TaskRun was a part of has been cancelled. + |
+
diff --git a/pkg/apis/pipeline/v1/container_types.go b/pkg/apis/pipeline/v1/container_types.go index c2e041faa04..9293aae9e3a 100644 --- a/pkg/apis/pipeline/v1/container_types.go +++ b/pkg/apis/pipeline/v1/container_types.go @@ -129,9 +129,7 @@ type Step struct { // OnError defines the exiting behavior of a container on error // can be set to [ continue | stopAndFail ] - // stopAndFail indicates exit the taskRun if the container exits with non-zero exit code - // continue indicates continue executing the rest of the steps irrespective of the container exit code - OnError string `json:"onError,omitempty"` + OnError OnErrorType `json:"onError,omitempty"` // Stores configuration for the stdout stream of the step. // +optional StdoutConfig *StepOutputConfig `json:"stdoutConfig,omitempty"` @@ -140,6 +138,16 @@ type Step struct { StderrConfig *StepOutputConfig `json:"stderrConfig,omitempty"` } +// OnErrorType defines a list of supported exiting behavior of a container on error +type OnErrorType string + +const ( + // StopAndFail indicates exit the taskRun if the container exits with non-zero exit code + StopAndFail OnErrorType = "stopAndFail" + // Continue indicates continue executing the rest of the steps irrespective of the container exit code + Continue OnErrorType = "continue" +) + // StepOutputConfig stores configuration for a step output stream. type StepOutputConfig struct { // Path to duplicate stdout stream to on container's local filesystem. diff --git a/pkg/apis/pipeline/v1/openapi_generated.go b/pkg/apis/pipeline/v1/openapi_generated.go index daef5876129..07bdf51d812 100644 --- a/pkg/apis/pipeline/v1/openapi_generated.go +++ b/pkg/apis/pipeline/v1/openapi_generated.go @@ -1774,7 +1774,7 @@ func schema_pkg_apis_pipeline_v1_Step(ref common.ReferenceCallback) common.OpenA }, "onError": { SchemaProps: spec.SchemaProps{ - Description: "OnError defines the exiting behavior of a container on error can be set to [ continue | stopAndFail ] stopAndFail indicates exit the taskRun if the container exits with non-zero exit code continue indicates continue executing the rest of the steps irrespective of the container exit code", + Description: "OnError defines the exiting behavior of a container on error can be set to [ continue | stopAndFail ]", Type: []string{"string"}, Format: "", }, diff --git a/pkg/apis/pipeline/v1/swagger.json b/pkg/apis/pipeline/v1/swagger.json index a21868e0b3f..57d41951799 100644 --- a/pkg/apis/pipeline/v1/swagger.json +++ b/pkg/apis/pipeline/v1/swagger.json @@ -872,7 +872,7 @@ "default": "" }, "onError": { - "description": "OnError defines the exiting behavior of a container on error can be set to [ continue | stopAndFail ] stopAndFail indicates exit the taskRun if the container exits with non-zero exit code continue indicates continue executing the rest of the steps irrespective of the container exit code", + "description": "OnError defines the exiting behavior of a container on error can be set to [ continue | stopAndFail ]", "type": "string" }, "resources": { diff --git a/pkg/apis/pipeline/v1/task_validation.go b/pkg/apis/pipeline/v1/task_validation.go index 8133330c950..fe44cc859c7 100644 --- a/pkg/apis/pipeline/v1/task_validation.go +++ b/pkg/apis/pipeline/v1/task_validation.go @@ -242,7 +242,7 @@ func validateStep(ctx context.Context, s Step, names sets.String) (errs *apis.Fi } if s.OnError != "" { - if s.OnError != "continue" && s.OnError != "stopAndFail" { + if s.OnError != Continue && s.OnError != StopAndFail { errs = errs.Also(&apis.FieldError{ Message: fmt.Sprintf("invalid value: %v", s.OnError), Paths: []string{"onError"}, diff --git a/pkg/apis/pipeline/v1/task_validation_test.go b/pkg/apis/pipeline/v1/task_validation_test.go index fee9ec14d45..be234561e7c 100644 --- a/pkg/apis/pipeline/v1/task_validation_test.go +++ b/pkg/apis/pipeline/v1/task_validation_test.go @@ -1389,14 +1389,14 @@ func TestStepOnError(t *testing.T) { }{{ name: "valid step - valid onError usage - set to continue - alpha API", steps: []v1.Step{{ - OnError: "continue", + OnError: v1.Continue, Image: "image", Args: []string{"arg"}, }}, }, { name: "valid step - valid onError usage - set to stopAndFail - alpha API", steps: []v1.Step{{ - OnError: "stopAndFail", + OnError: v1.StopAndFail, Image: "image", Args: []string{"arg"}, }}, diff --git a/pkg/apis/pipeline/v1beta1/container_conversion.go b/pkg/apis/pipeline/v1beta1/container_conversion.go index d6ed1f60cb4..51826057c54 100644 --- a/pkg/apis/pipeline/v1beta1/container_conversion.go +++ b/pkg/apis/pipeline/v1beta1/container_conversion.go @@ -28,7 +28,7 @@ func (s Step) convertTo(ctx context.Context, sink *v1.Step) { w.convertTo(ctx, &new) sink.Workspaces = append(sink.Workspaces, new) } - sink.OnError = s.OnError + sink.OnError = (v1.OnErrorType)(s.OnError) sink.StdoutConfig = (*v1.StepOutputConfig)(s.StdoutConfig) sink.StderrConfig = (*v1.StepOutputConfig)(s.StderrConfig) @@ -59,7 +59,7 @@ func (s *Step) convertFrom(ctx context.Context, source v1.Step) { new.convertFrom(ctx, w) s.Workspaces = append(s.Workspaces, new) } - s.OnError = source.OnError + s.OnError = (OnErrorType)(source.OnError) s.StdoutConfig = (*StepOutputConfig)(source.StdoutConfig) s.StderrConfig = (*StepOutputConfig)(source.StderrConfig) } diff --git a/pkg/apis/pipeline/v1beta1/container_types.go b/pkg/apis/pipeline/v1beta1/container_types.go index a01a2a9abee..624a1c373f5 100644 --- a/pkg/apis/pipeline/v1beta1/container_types.go +++ b/pkg/apis/pipeline/v1beta1/container_types.go @@ -188,9 +188,7 @@ type Step struct { // OnError defines the exiting behavior of a container on error // can be set to [ continue | stopAndFail ] - // stopAndFail indicates exit the taskRun if the container exits with non-zero exit code - // continue indicates continue executing the rest of the steps irrespective of the container exit code - OnError string `json:"onError,omitempty"` + OnError OnErrorType `json:"onError,omitempty"` // Stores configuration for the stdout stream of the step. // +optional @@ -200,6 +198,16 @@ type Step struct { StderrConfig *StepOutputConfig `json:"stderrConfig,omitempty"` } +// OnErrorType defines a list of supported exiting behavior of a container on error +type OnErrorType string + +const ( + // StopAndFail indicates exit the taskRun if the container exits with non-zero exit code + StopAndFail OnErrorType = "stopAndFail" + // Continue indicates continue executing the rest of the steps irrespective of the container exit code + Continue OnErrorType = "continue" +) + // StepOutputConfig stores configuration for a step output stream. type StepOutputConfig struct { // Path to duplicate stdout stream to on container's local filesystem. diff --git a/pkg/apis/pipeline/v1beta1/openapi_generated.go b/pkg/apis/pipeline/v1beta1/openapi_generated.go index 9cbb127dcff..4dd0215c9e7 100644 --- a/pkg/apis/pipeline/v1beta1/openapi_generated.go +++ b/pkg/apis/pipeline/v1beta1/openapi_generated.go @@ -3368,7 +3368,7 @@ func schema_pkg_apis_pipeline_v1beta1_Step(ref common.ReferenceCallback) common. }, "onError": { SchemaProps: spec.SchemaProps{ - Description: "OnError defines the exiting behavior of a container on error can be set to [ continue | stopAndFail ] stopAndFail indicates exit the taskRun if the container exits with non-zero exit code continue indicates continue executing the rest of the steps irrespective of the container exit code", + Description: "OnError defines the exiting behavior of a container on error can be set to [ continue | stopAndFail ]", Type: []string{"string"}, Format: "", }, diff --git a/pkg/apis/pipeline/v1beta1/swagger.json b/pkg/apis/pipeline/v1beta1/swagger.json index 3b9fc949168..190dc539c5c 100644 --- a/pkg/apis/pipeline/v1beta1/swagger.json +++ b/pkg/apis/pipeline/v1beta1/swagger.json @@ -1822,7 +1822,7 @@ "default": "" }, "onError": { - "description": "OnError defines the exiting behavior of a container on error can be set to [ continue | stopAndFail ] stopAndFail indicates exit the taskRun if the container exits with non-zero exit code continue indicates continue executing the rest of the steps irrespective of the container exit code", + "description": "OnError defines the exiting behavior of a container on error can be set to [ continue | stopAndFail ]", "type": "string" }, "ports": { diff --git a/pkg/apis/pipeline/v1beta1/task_conversion_test.go b/pkg/apis/pipeline/v1beta1/task_conversion_test.go index 0613683a67f..5b8c5a79ee0 100644 --- a/pkg/apis/pipeline/v1beta1/task_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/task_conversion_test.go @@ -95,7 +95,7 @@ func TestTaskConversion(t *testing.T) { Script: "echo hello", Timeout: &metav1.Duration{Duration: time.Hour}, Workspaces: []v1beta1.WorkspaceUsage{{Name: "workspace"}}, - OnError: "continue", + OnError: v1beta1.Continue, StdoutConfig: &v1beta1.StepOutputConfig{Path: "/path"}, StderrConfig: &v1beta1.StepOutputConfig{Path: "/another-path"}, }}, diff --git a/pkg/apis/pipeline/v1beta1/task_validation.go b/pkg/apis/pipeline/v1beta1/task_validation.go index f669c8ffe68..065b5404e6c 100644 --- a/pkg/apis/pipeline/v1beta1/task_validation.go +++ b/pkg/apis/pipeline/v1beta1/task_validation.go @@ -243,9 +243,8 @@ func validateStep(ctx context.Context, s Step, names sets.String) (errs *apis.Fi } } - // validate static values in onError if specified - onError can only be set to continue or stopAndFail if s.OnError != "" { - if !isParamRefs(s.OnError) && s.OnError != "continue" && s.OnError != "stopAndFail" { + if !isParamRefs(string(s.OnError)) && s.OnError != Continue && s.OnError != StopAndFail { errs = errs.Also(&apis.FieldError{ Message: fmt.Sprintf("invalid value: %v", s.OnError), Paths: []string{"onError"}, @@ -603,7 +602,7 @@ func validateStepVariables(ctx context.Context, step Step, prefix string, vars s errs = errs.Also(validateTaskVariable(v.MountPath, prefix, vars).ViaField("MountPath").ViaFieldIndex("volumeMount", i)) errs = errs.Also(validateTaskVariable(v.SubPath, prefix, vars).ViaField("SubPath").ViaFieldIndex("volumeMount", i)) } - errs = errs.Also(validateTaskVariable(step.OnError, prefix, vars).ViaField("onError")) + errs = errs.Also(validateTaskVariable(string(step.OnError), prefix, vars).ViaField("onError")) return errs } diff --git a/pkg/apis/pipeline/v1beta1/task_validation_test.go b/pkg/apis/pipeline/v1beta1/task_validation_test.go index 9231840b9e6..93325ecf95b 100644 --- a/pkg/apis/pipeline/v1beta1/task_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/task_validation_test.go @@ -1501,14 +1501,14 @@ func TestStepOnError(t *testing.T) { }{{ name: "valid step - valid onError usage - set to continue", steps: []v1beta1.Step{{ - OnError: "continue", + OnError: v1beta1.Continue, Image: "image", Args: []string{"arg"}, }}, }, { name: "valid step - valid onError usage - set to stopAndFail", steps: []v1beta1.Step{{ - OnError: "stopAndFail", + OnError: v1beta1.StopAndFail, Image: "image", Args: []string{"arg"}, }}, @@ -1516,7 +1516,7 @@ func TestStepOnError(t *testing.T) { name: "valid step - valid onError usage - set to a task parameter", params: []v1beta1.ParamSpec{{ Name: "CONTINUE", - Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeString, StringVal: "continue"}, + Default: &v1beta1.ArrayOrString{Type: v1beta1.ParamTypeString, StringVal: string(v1beta1.Continue)}, }}, steps: []v1beta1.Step{{ OnError: "$(params.CONTINUE)", diff --git a/pkg/container/step_replacements.go b/pkg/container/step_replacements.go index 846b12b00fe..1640e749ce9 100644 --- a/pkg/container/step_replacements.go +++ b/pkg/container/step_replacements.go @@ -24,7 +24,7 @@ import ( // ApplyStepReplacements applies variable interpolation on a Step. func ApplyStepReplacements(step *v1beta1.Step, stringReplacements map[string]string, arrayReplacements map[string][]string) { step.Script = substitution.ApplyReplacements(step.Script, stringReplacements) - step.OnError = substitution.ApplyReplacements(step.OnError, stringReplacements) + step.OnError = (v1beta1.OnErrorType)(substitution.ApplyReplacements(string(step.OnError), stringReplacements)) if step.StdoutConfig != nil { step.StdoutConfig.Path = substitution.ApplyReplacements(step.StdoutConfig.Path, stringReplacements) } diff --git a/pkg/entrypoint/entrypointer.go b/pkg/entrypoint/entrypointer.go index 92a13219a21..e80ecac1226 100644 --- a/pkg/entrypoint/entrypointer.go +++ b/pkg/entrypoint/entrypointer.go @@ -37,9 +37,7 @@ import ( // RFC3339 with millisecond const ( - timeFormat = "2006-01-02T15:04:05.000Z07:00" - ContinueOnError = "continue" - FailOnError = "stopAndFail" + timeFormat = "2006-01-02T15:04:05.000Z07:00" ) // Entrypointer holds fields for running commands with redirected @@ -77,7 +75,7 @@ type Entrypointer struct { // OnError defines exiting behavior of the entrypoint // set it to "stopAndFail" to indicate the entrypoint to exit the taskRun if the container exits with non zero exit code // set it to "continue" to indicate the entrypoint to continue executing the rest of the steps irrespective of the container exit code - OnError string + OnError v1beta1.OnErrorType // StepMetadataDir is the directory for a step where the step related metadata can be stored StepMetadataDir string } @@ -162,7 +160,7 @@ func (e Entrypointer) Go() error { switch { case err != nil && e.BreakpointOnFailure: logger.Info("Skipping writing to PostFile") - case e.OnError == ContinueOnError && errors.As(err, &ee): + case e.OnError == v1beta1.Continue && errors.As(err, &ee): // with continue on error and an ExitError, write non-zero exit code and a post file exitCode := strconv.Itoa(ee.ExitCode()) output = append(output, v1beta1.PipelineResourceResult{ diff --git a/pkg/entrypoint/entrypointer_test.go b/pkg/entrypoint/entrypointer_test.go index cb9abe44979..faa365a670a 100644 --- a/pkg/entrypoint/entrypointer_test.go +++ b/pkg/entrypoint/entrypointer_test.go @@ -355,32 +355,33 @@ func TestEntrypointer_ReadBreakpointExitCodeFromDisk(t *testing.T) { func TestEntrypointer_OnError(t *testing.T) { for _, c := range []struct { - desc, postFile, onError string - runner Runner - expectedError bool + desc, postFile string + onError v1beta1.OnErrorType + runner Runner + expectedError bool }{{ desc: "the step is exiting with 1, ignore the step error when onError is set to continue", runner: &fakeExitErrorRunner{}, postFile: "step-one", - onError: ContinueOnError, + onError: v1beta1.Continue, expectedError: true, }, { desc: "the step is exiting with 0, ignore the step error irrespective of no error with onError set to continue", runner: &fakeRunner{}, postFile: "step-one", - onError: ContinueOnError, + onError: v1beta1.Continue, expectedError: false, }, { desc: "the step is exiting with 1, treat the step error as failure with onError set to stopAndFail", runner: &fakeExitErrorRunner{}, expectedError: true, postFile: "step-one", - onError: FailOnError, + onError: v1beta1.StopAndFail, }, { desc: "the step is exiting with 0, treat the step error (but there is none) as failure with onError set to stopAndFail", runner: &fakeRunner{}, postFile: "step-one", - onError: FailOnError, + onError: v1beta1.StopAndFail, expectedError: false, }} { t.Run(c.desc, func(t *testing.T) { @@ -407,7 +408,7 @@ func TestEntrypointer_OnError(t *testing.T) { t.Fatalf("Entrypointer didn't fail") } - if c.onError == ContinueOnError { + if c.onError == v1beta1.Continue { switch { case fpw.wrote == nil: t.Error("Wanted post file written, got nil") @@ -422,7 +423,7 @@ func TestEntrypointer_OnError(t *testing.T) { } } - if c.onError == FailOnError { + if c.onError == v1beta1.StopAndFail { switch { case fpw.wrote == nil: t.Error("Wanted post file written, got nil") diff --git a/pkg/pod/entrypoint.go b/pkg/pod/entrypoint.go index e1e57d4ad98..7be9863f54e 100644 --- a/pkg/pod/entrypoint.go +++ b/pkg/pod/entrypoint.go @@ -28,7 +28,6 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/pipeline" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" - "github.com/tektoncd/pipeline/pkg/entrypoint" "gomodules.xyz/jsonpatch/v2" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -138,11 +137,11 @@ func orderContainers(commonExtraEntrypointArgs []string, steps []corev1.Containe if taskSpec != nil { if taskSpec.Steps != nil && len(taskSpec.Steps) >= i+1 { if taskSpec.Steps[i].OnError != "" { - if taskSpec.Steps[i].OnError != entrypoint.ContinueOnError && taskSpec.Steps[i].OnError != entrypoint.FailOnError { + if taskSpec.Steps[i].OnError != v1beta1.Continue && taskSpec.Steps[i].OnError != v1beta1.StopAndFail { return nil, fmt.Errorf("task step onError must be either %s or %s but it is set to an invalid value %s", - entrypoint.ContinueOnError, entrypoint.FailOnError, taskSpec.Steps[i].OnError) + v1beta1.Continue, v1beta1.StopAndFail, taskSpec.Steps[i].OnError) } - argsForEntrypoint = append(argsForEntrypoint, "-on_error", taskSpec.Steps[i].OnError) + argsForEntrypoint = append(argsForEntrypoint, "-on_error", string(taskSpec.Steps[i].OnError)) } if taskSpec.Steps[i].Timeout != nil { argsForEntrypoint = append(argsForEntrypoint, "-timeout", taskSpec.Steps[i].Timeout.Duration.String()) diff --git a/pkg/pod/entrypoint_test.go b/pkg/pod/entrypoint_test.go index fd6a8370287..c1309f637d8 100644 --- a/pkg/pod/entrypoint_test.go +++ b/pkg/pod/entrypoint_test.go @@ -24,7 +24,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" - "github.com/tektoncd/pipeline/pkg/entrypoint" "github.com/tektoncd/pipeline/test/diff" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -358,9 +357,9 @@ func TestEntryPointOnError(t *testing.T) { }{{ taskSpec: v1beta1.TaskSpec{ Steps: []v1beta1.Step{{ - OnError: entrypoint.ContinueOnError, + OnError: v1beta1.Continue, }, { - OnError: entrypoint.FailOnError, + OnError: v1beta1.StopAndFail, }}, }, wantContainers: []corev1.Container{{