Skip to content

Commit

Permalink
[TEP-0094] Promote taskrun.spec's stepSpecs and sidecarSpecs to beta
Browse files Browse the repository at this point in the history
Configuring of stepSpecs and sideCarSpecs was introduced in v0.34.0. This is
a crucial feature required by our customers when running Pipelines at large scale.
This promotes TEP-0094 to beta such that these features can be used by the task
authors and pipeline authors in a cluster when enable-api-fields is either set
to beta or alpha.
  • Loading branch information
khrm authored and tekton-robot committed Jun 27, 2024
1 parent b0138e7 commit 009c171
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 63 deletions.
2 changes: 1 addition & 1 deletion docs/additional-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ Features currently in "alpha" are:
| [Hermetic Execution Mode](./hermetic.md) | [TEP-0025](https://github.com/tektoncd/community/blob/main/teps/0025-hermekton.md) | [v0.25.0](https://github.com/tektoncd/pipeline/releases/tag/v0.25.0) | |
| [Windows Scripts](./tasks.md#windows-scripts) | [TEP-0057](https://github.com/tektoncd/community/blob/main/teps/0057-windows-support.md) | [v0.28.0](https://github.com/tektoncd/pipeline/releases/tag/v0.28.0) | |
| [Debug](./debug.md) | [TEP-0042](https://github.com/tektoncd/community/blob/main/teps/0042-taskrun-breakpoint-on-failure.md) | [v0.26.0](https://github.com/tektoncd/pipeline/releases/tag/v0.26.0) | |
| [Step and Sidecar Overrides](./taskruns.md#overriding-task-steps-and-sidecars) | [TEP-0094](https://github.com/tektoncd/community/blob/main/teps/0094-specifying-resource-requirements-at-runtime.md) | [v0.34.0](https://github.com/tektoncd/pipeline/releases/tag/v0.34.0) | |
| [StdoutConfig and StderrConfig](./tasks#redirecting-step-output-streams-with-stdoutConfig-and-stderrConfig) | [TEP-0011](https://github.com/tektoncd/community/blob/main/teps/0011-redirecting-step-output-streams.md) | [v0.38.0](https://github.com/tektoncd/pipeline/releases/tag/v0.38.0) | |
| [Trusted Resources](./trusted-resources.md) | [TEP-0091](https://github.com/tektoncd/community/blob/main/teps/0091-trusted-resources.md) | [v0.49.0](https://github.com/tektoncd/pipeline/releases/tag/v0.49.0) | `trusted-resources-verification-no-match-policy` |
| [Configure Default Resolver](./resolution.md#configuring-built-in-resolvers) | [TEP-0133](https://github.com/tektoncd/community/blob/main/teps/0133-configure-default-resolver.md) | [v0.46.0](https://github.com/tektoncd/pipeline/releases/tag/v0.46.0) | |
Expand Down Expand Up @@ -403,6 +402,7 @@ Features currently in "beta" are:
| [Task-level Resource Requirements](compute-resources.md#task-level-compute-resources-configuration) | [TEP-0104](https://github.com/tektoncd/community/blob/main/teps/0104-tasklevel-resource-requirements.md) | [v0.39.0](https://github.com/tektoncd/pipeline/releases/tag/v0.39.0) | [v0.53.0](https://github.com/tektoncd/pipeline/releases/tag/v0.53.0) | |
| [Reusable Steps via StepActions](./stepactions.md) | [TEP-0142](https://github.com/tektoncd/community/blob/main/teps/0142-enable-step-reusability.md) | [v0.54.0](https://github.com/tektoncd/pipeline/releases/tag/v0.54.0) | `enable-step-actions` |
| [Larger Results via Sidecar Logs](#enabling-larger-results-using-sidecar-logs) | [TEP-0127](https://github.com/tektoncd/community/blob/main/teps/0127-larger-results-via-sidecar-logs.md) | [v0.43.0](https://github.com/tektoncd/pipeline/releases/tag/v0.43.0) | [v0.61.0](https://github.com/tektoncd/pipeline/releases/tag/v0.61.0) | `results-from` |
| [Step and Sidecar Overrides](./taskruns.md#overriding-task-steps-and-sidecars) | [TEP-0094](https://github.com/tektoncd/community/blob/main/teps/0094-specifying-resource-requirements-at-runtime.md) | [v0.34.0](https://github.com/tektoncd/pipeline/releases/tag/v0.34.0) | | [v0.61.0](https://github.com/tektoncd/pipeline/releases/tag/v0.61.0) |

## Enabling larger results using sidecar logs

Expand Down
2 changes: 1 addition & 1 deletion docs/taskruns.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ and reasons.

### Configuring Task Steps and Sidecars in a TaskRun

**([alpha only](https://github.com/tektoncd/pipeline/blob/main/docs/additional-configs.md#alpha-features))**
**([beta only](https://github.com/tektoncd/pipeline/blob/main/docs/additional-configs.md#beta-features))**

A TaskRun can specify `StepSpecs` or `SidecarSpecs` to configure Step or Sidecar
specified in a Task. Only named Steps and Sidecars may be configured.
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1/pipelinerun_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,11 @@ func (ps *PipelineRunSpec) validatePipelineTimeout(timeout time.Duration, errorM

func validateTaskRunSpec(ctx context.Context, trs PipelineTaskRunSpec) (errs *apis.FieldError) {
if trs.StepSpecs != nil {
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "stepSpecs", config.AlphaAPIFields).ViaField("stepSpecs"))
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "stepSpecs", config.BetaAPIFields).ViaField("stepSpecs"))
errs = errs.Also(validateStepSpecs(trs.StepSpecs).ViaField("stepSpecs"))
}
if trs.SidecarSpecs != nil {
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "sidecarSpecs", config.AlphaAPIFields).ViaField("sidecarSpecs"))
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "sidecarSpecs", config.BetaAPIFields).ViaField("sidecarSpecs"))
errs = errs.Also(validateSidecarSpecs(trs.SidecarSpecs).ViaField("sidecarSpecs"))
}
if trs.ComputeResources != nil {
Expand Down
14 changes: 7 additions & 7 deletions pkg/apis/pipeline/v1/pipelinerun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
wantErr: apis.ErrMultipleOneOf("taskRunSpecs[0].stepSpecs[1].name"),
withContext: cfgtesting.EnableAlphaAPIFields,
}, {
name: "stepSpecs disallowed without alpha feature gate",
name: "stepSpecs disallowed without beta feature gate",
spec: v1.PipelineRunSpec{
PipelineRef: &v1.PipelineRef{Name: "foo"},
TaskRunSpecs: []v1.PipelineTaskRunSpec{
Expand All @@ -986,9 +986,9 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
},
},
withContext: cfgtesting.EnableStableAPIFields,
wantErr: apis.ErrGeneric("stepSpecs requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\"").ViaIndex(0).ViaField("taskRunSpecs"),
wantErr: apis.ErrGeneric("stepSpecs requires \"enable-api-fields\" feature gate to be \"alpha\" or \"beta\" but it is \"stable\"").ViaIndex(0).ViaField("taskRunSpecs"),
}, {
name: "sidecarSpec disallowed without alpha feature gate",
name: "sidecarSpec disallowed without beta feature gate",
spec: v1.PipelineRunSpec{
PipelineRef: &v1.PipelineRef{Name: "foo"},
TaskRunSpecs: []v1.PipelineTaskRunSpec{
Expand All @@ -1004,7 +1004,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
},
},
withContext: cfgtesting.EnableStableAPIFields,
wantErr: apis.ErrGeneric("sidecarSpecs requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\"").ViaIndex(0).ViaField("taskRunSpecs"),
wantErr: apis.ErrGeneric("sidecarSpecs requires \"enable-api-fields\" feature gate to be \"alpha\" or \"beta\" but it is \"stable\"").ViaIndex(0).ViaField("taskRunSpecs"),
}, {
name: "missing stepSpecs name",
spec: v1.PipelineRunSpec{
Expand Down Expand Up @@ -1077,7 +1077,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
"taskRunSpecs[0].stepSpecs.resources",
"taskRunSpecs[0].computeResources",
),
withContext: cfgtesting.EnableAlphaAPIFields,
withContext: cfgtesting.EnableBetaAPIFields,
}, {
name: "computeResources disallowed without beta feature gate",
spec: v1.PipelineRunSpec{
Expand Down Expand Up @@ -1140,7 +1140,7 @@ func TestPipelineRunSpec_Validate(t *testing.T) {
},
}},
},
withContext: cfgtesting.EnableAlphaAPIFields,
withContext: cfgtesting.EnableBetaAPIFields,
}, {
name: "valid sidecar and task-level (taskRunSpecs.resources) resource requirements configured",
spec: v1.PipelineRunSpec{
Expand All @@ -1163,7 +1163,7 @@ func TestPipelineRunSpec_Validate(t *testing.T) {
}},
}},
},
withContext: cfgtesting.EnableAlphaAPIFields,
withContext: cfgtesting.EnableBetaAPIFields,
}}

for _, ps := range tests {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1/taskrun_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ func (ts *TaskRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) {
errs = errs.Also(validateDebug(ts.Debug).ViaField("debug"))
}
if ts.StepSpecs != nil {
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "stepSpecs", config.AlphaAPIFields).ViaField("stepSpecs"))
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "stepSpecs", config.BetaAPIFields).ViaField("stepSpecs"))
errs = errs.Also(validateStepSpecs(ts.StepSpecs).ViaField("stepSpecs"))
}
if ts.SidecarSpecs != nil {
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "sidecarSpecs", config.AlphaAPIFields).ViaField("sidecarSpecs"))
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "sidecarSpecs", config.BetaAPIFields).ViaField("sidecarSpecs"))
errs = errs.Also(validateSidecarSpecs(ts.SidecarSpecs).ViaField("sidecarSpecs"))
}
if ts.ComputeResources != nil {
Expand Down
14 changes: 7 additions & 7 deletions pkg/apis/pipeline/v1/taskrun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ func TestTaskRun_Validate(t *testing.T) {
},
wc: cfgtesting.EnableAlphaAPIFields,
}, {
name: "alpha feature: valid step and sidecar specs",
name: "beta feature: valid step and sidecar specs",
taskRun: &v1.TaskRun{
ObjectMeta: metav1.ObjectMeta{Name: "tr"},
Spec: v1.TaskRunSpec{
Expand All @@ -435,7 +435,7 @@ func TestTaskRun_Validate(t *testing.T) {
}},
},
},
wc: cfgtesting.EnableAlphaAPIFields,
wc: cfgtesting.EnableBetaAPIFields,
}}
for _, ts := range tests {
t.Run(ts.name, func(t *testing.T) {
Expand Down Expand Up @@ -704,7 +704,7 @@ func TestTaskRunSpec_Invalidate(t *testing.T) {
wantErr: apis.ErrInvalidValue("turnOn is not a valid onFailure breakpoint value, onFailure breakpoint is only allowed to be set as enabled", "debug.breakpoints.onFailure"),
wc: cfgtesting.EnableAlphaAPIFields,
}, {
name: "stepSpecs disallowed without alpha feature gate",
name: "stepSpecs disallowed without beta feature gate",
spec: v1.TaskRunSpec{
TaskRef: &v1.TaskRef{
Name: "foo",
Expand All @@ -717,9 +717,9 @@ func TestTaskRunSpec_Invalidate(t *testing.T) {
}},
},
wc: cfgtesting.EnableStableAPIFields,
wantErr: apis.ErrGeneric("stepSpecs requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\""),
wantErr: apis.ErrGeneric("stepSpecs requires \"enable-api-fields\" feature gate to be \"alpha\" or \"beta\" but it is \"stable\""),
}, {
name: "sidecarSpec disallowed without alpha feature gate",
name: "sidecarSpec disallowed without beta feature gate",
spec: v1.TaskRunSpec{
TaskRef: &v1.TaskRef{
Name: "foo",
Expand All @@ -732,7 +732,7 @@ func TestTaskRunSpec_Invalidate(t *testing.T) {
}},
},
wc: cfgtesting.EnableStableAPIFields,
wantErr: apis.ErrGeneric("sidecarSpecs requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\""),
wantErr: apis.ErrGeneric("sidecarSpecs requires \"enable-api-fields\" feature gate to be \"alpha\" or \"beta\" but it is \"stable\""),
}, {
name: "duplicate stepSpecs names",
spec: v1.TaskRunSpec{
Expand Down Expand Up @@ -815,7 +815,7 @@ func TestTaskRunSpec_Invalidate(t *testing.T) {
"stepSpecs.resources",
"computeResources",
),
wc: cfgtesting.EnableAlphaAPIFields,
wc: cfgtesting.EnableBetaAPIFields,
}, {
name: "computeResources disallowed without beta feature gate",
spec: v1.TaskRunSpec{
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1beta1/pipelinerun_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ func (ps *PipelineRunSpec) validatePipelineTimeout(timeout time.Duration, errorM

func validateTaskRunSpec(ctx context.Context, trs PipelineTaskRunSpec) (errs *apis.FieldError) {
if trs.StepOverrides != nil {
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "stepOverrides", config.AlphaAPIFields).ViaField("stepOverrides"))
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "stepOverrides", config.BetaAPIFields).ViaField("stepOverrides"))
errs = errs.Also(validateStepOverrides(trs.StepOverrides).ViaField("stepOverrides"))
}
if trs.SidecarOverrides != nil {
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "sidecarOverrides", config.AlphaAPIFields).ViaField("sidecarOverrides"))
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "sidecarOverrides", config.BetaAPIFields).ViaField("sidecarOverrides"))
errs = errs.Also(validateSidecarOverrides(trs.SidecarOverrides).ViaField("sidecarOverrides"))
}
if trs.ComputeResources != nil {
Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ func TestPipelineRun_Validate(t *testing.T) {
},
},
}, {
name: "alpha feature: sidecar and step overrides",
name: "beta feature: sidecar and step overrides",
pr: v1beta1.PipelineRun{
ObjectMeta: metav1.ObjectMeta{
Name: "pr",
Expand Down Expand Up @@ -979,7 +979,7 @@ func TestPipelineRun_Validate(t *testing.T) {
},
},
},
wc: cfgtesting.EnableAlphaAPIFields,
wc: cfgtesting.EnableBetaAPIFields,
}}

for _, ts := range tests {
Expand Down Expand Up @@ -1109,7 +1109,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
wantErr: apis.ErrMultipleOneOf("taskRunSpecs[0].stepOverrides[1].name"),
withContext: cfgtesting.EnableAlphaAPIFields,
}, {
name: "stepOverride disallowed without alpha feature gate",
name: "stepOverride disallowed without alpha or beta feature gate",
spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{Name: "foo"},
TaskRunSpecs: []v1beta1.PipelineTaskRunSpec{
Expand All @@ -1127,9 +1127,9 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
},
},
withContext: cfgtesting.EnableStableAPIFields,
wantErr: apis.ErrGeneric("stepOverrides requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\"").ViaIndex(0).ViaField("taskRunSpecs"),
wantErr: apis.ErrGeneric("stepOverrides requires \"enable-api-fields\" feature gate to be \"alpha\" or \"beta\" but it is \"stable\"").ViaIndex(0).ViaField("taskRunSpecs"),
}, {
name: "sidecarOverride disallowed without alpha feature gate",
name: "sidecarOverride disallowed without alpha or beta feature gate",
spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{Name: "foo"},
TaskRunSpecs: []v1beta1.PipelineTaskRunSpec{
Expand All @@ -1147,7 +1147,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
},
},
withContext: cfgtesting.EnableStableAPIFields,
wantErr: apis.ErrGeneric("sidecarOverrides requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\"").ViaIndex(0).ViaField("taskRunSpecs"),
wantErr: apis.ErrGeneric("sidecarOverrides requires \"enable-api-fields\" feature gate to be \"alpha\" or \"beta\" but it is \"stable\"").ViaIndex(0).ViaField("taskRunSpecs"),
}, {
name: "missing stepOverride name",
spec: v1beta1.PipelineRunSpec{
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/pipeline/v1beta1/taskrun_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ func (ts *TaskRunSpec) Validate(ctx context.Context) (errs *apis.FieldError) {
errs = errs.Also(validateDebug(ts.Debug).ViaField("debug"))
}
if ts.StepOverrides != nil {
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "stepOverrides", config.AlphaAPIFields).ViaField("stepOverrides"))
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "stepOverrides", config.BetaAPIFields).ViaField("stepOverrides"))
errs = errs.Also(validateStepOverrides(ts.StepOverrides).ViaField("stepOverrides"))
}
if ts.SidecarOverrides != nil {
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "sidecarOverrides", config.AlphaAPIFields).ViaField("sidecarOverrides"))
errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "sidecarOverrides", config.BetaAPIFields).ViaField("sidecarOverrides"))
errs = errs.Also(validateSidecarOverrides(ts.SidecarOverrides).ViaField("sidecarOverrides"))
}
if ts.ComputeResources != nil {
Expand Down
36 changes: 3 additions & 33 deletions pkg/apis/pipeline/v1beta1/taskrun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func TestTaskRun_Validate(t *testing.T) {
},
},
}, {
name: "alpha feature: valid step and sidecar overrides",
name: "beta feature: valid step and sidecar overrides",
taskRun: &v1beta1.TaskRun{
ObjectMeta: metav1.ObjectMeta{Name: "tr"},
Spec: v1beta1.TaskRunSpec{
Expand All @@ -465,7 +465,7 @@ func TestTaskRun_Validate(t *testing.T) {
}},
},
},
wc: cfgtesting.EnableAlphaAPIFields,
wc: cfgtesting.EnableBetaAPIFields,
}}
for _, ts := range tests {
t.Run(ts.name, func(t *testing.T) {
Expand Down Expand Up @@ -698,36 +698,6 @@ func TestTaskRunSpec_Invalidate(t *testing.T) {
},
wantErr: apis.ErrInvalidValue("turnOn is not a valid onFailure breakpoint value, onFailure breakpoint is only allowed to be set as enabled", "debug.breakpoints.onFailure"),
wc: cfgtesting.EnableAlphaAPIFields,
}, {
name: "stepOverride disallowed without alpha feature gate",
spec: v1beta1.TaskRunSpec{
TaskRef: &v1beta1.TaskRef{
Name: "foo",
},
StepOverrides: []v1beta1.TaskRunStepOverride{{
Name: "foo",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
},
}},
},
wc: cfgtesting.EnableStableAPIFields,
wantErr: apis.ErrGeneric("stepOverrides requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\""),
}, {
name: "sidecarOverride disallowed without alpha feature gate",
spec: v1beta1.TaskRunSpec{
TaskRef: &v1beta1.TaskRef{
Name: "foo",
},
SidecarOverrides: []v1beta1.TaskRunSidecarOverride{{
Name: "foo",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")},
},
}},
},
wc: cfgtesting.EnableStableAPIFields,
wantErr: apis.ErrGeneric("sidecarOverrides requires \"enable-api-fields\" feature gate to be \"alpha\" but it is \"stable\""),
}, {
name: "duplicate stepOverride names",
spec: v1beta1.TaskRunSpec{
Expand Down Expand Up @@ -940,7 +910,7 @@ func TestTaskRunSpec_Validate(t *testing.T) {
},
}},
},
wc: cfgtesting.EnableAlphaAPIFields,
wc: cfgtesting.EnableBetaAPIFields,
}}

for _, ts := range tests {
Expand Down

0 comments on commit 009c171

Please sign in to comment.