Skip to content

Commit 57a1f32

Browse files
committed
Remove TaskRuns and Runs Fields of PipelineRunStatus
This commit removes `status.taskruns` and `status.runs` and their corresponding test cases.
1 parent d2f075a commit 57a1f32

15 files changed

+17
-894
lines changed

docs/pipeline-api.md

-36
Original file line numberDiff line numberDiff line change
@@ -9612,9 +9612,6 @@ ParamValue
96129612
</table>
96139613
<h3 id="tekton.dev/v1beta1.PipelineRunRunStatus">PipelineRunRunStatus
96149614
</h3>
9615-
<p>
9616-
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.PipelineRunStatusFields">PipelineRunStatusFields</a>)
9617-
</p>
96189615
<div>
96199616
<p>PipelineRunRunStatus contains the name of the PipelineTask for this CustomRun or Run and the CustomRun or Run&rsquo;s Status</p>
96209617
</div>
@@ -9942,36 +9939,6 @@ Kubernetes meta/v1.Time
99429939
</tr>
99439940
<tr>
99449941
<td>
9945-
<code>taskRuns</code><br/>
9946-
<em>
9947-
<a href="#tekton.dev/v1beta1.PipelineRunTaskRunStatus">
9948-
map[string]*github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRunTaskRunStatus
9949-
</a>
9950-
</em>
9951-
</td>
9952-
<td>
9953-
<em>(Optional)</em>
9954-
<p>Deprecated - use ChildReferences instead.
9955-
map of PipelineRunTaskRunStatus with the taskRun name as the key</p>
9956-
</td>
9957-
</tr>
9958-
<tr>
9959-
<td>
9960-
<code>runs</code><br/>
9961-
<em>
9962-
<a href="#tekton.dev/v1beta1.PipelineRunRunStatus">
9963-
map[string]*github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1.PipelineRunRunStatus
9964-
</a>
9965-
</em>
9966-
</td>
9967-
<td>
9968-
<em>(Optional)</em>
9969-
<p>Deprecated - use ChildReferences instead.
9970-
map of PipelineRunRunStatus with the run name as the key</p>
9971-
</td>
9972-
</tr>
9973-
<tr>
9974-
<td>
99759942
<code>pipelineResults</code><br/>
99769943
<em>
99779944
<a href="#tekton.dev/v1beta1.PipelineRunResult">
@@ -10068,9 +10035,6 @@ map[string]string
1006810035
</table>
1006910036
<h3 id="tekton.dev/v1beta1.PipelineRunTaskRunStatus">PipelineRunTaskRunStatus
1007010037
</h3>
10071-
<p>
10072-
(<em>Appears on:</em><a href="#tekton.dev/v1beta1.PipelineRunStatusFields">PipelineRunStatusFields</a>)
10073-
</p>
1007410038
<div>
1007510039
<p>PipelineRunTaskRunStatus contains the name of the PipelineTask for this TaskRun and the TaskRun&rsquo;s Status</p>
1007610040
</div>

pkg/apis/pipeline/v1beta1/openapi_generated.go

+2-58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/pipeline/v1beta1/pipelinerun_types.go

-16
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,6 @@ func (pr *PipelineRunStatus) GetCondition(t apis.ConditionType) *apis.Condition
351351
// and set the started time to the current time
352352
func (pr *PipelineRunStatus) InitializeConditions(c clock.PassiveClock) {
353353
started := false
354-
if pr.TaskRuns == nil {
355-
pr.TaskRuns = make(map[string]*PipelineRunTaskRunStatus)
356-
}
357-
if pr.Runs == nil {
358-
pr.Runs = make(map[string]*PipelineRunRunStatus)
359-
}
360354
if pr.StartTime.IsZero() {
361355
pr.StartTime = &metav1.Time{Time: c.Now()}
362356
started = true
@@ -422,16 +416,6 @@ type PipelineRunStatusFields struct {
422416
// CompletionTime is the time the PipelineRun completed.
423417
CompletionTime *metav1.Time `json:"completionTime,omitempty"`
424418

425-
// Deprecated - use ChildReferences instead.
426-
// map of PipelineRunTaskRunStatus with the taskRun name as the key
427-
// +optional
428-
TaskRuns map[string]*PipelineRunTaskRunStatus `json:"taskRuns,omitempty"`
429-
430-
// Deprecated - use ChildReferences instead.
431-
// map of PipelineRunRunStatus with the run name as the key
432-
// +optional
433-
Runs map[string]*PipelineRunRunStatus `json:"runs,omitempty"`
434-
435419
// PipelineResults are the list of results written out by the pipeline task's containers
436420
// +optional
437421
// +listType=atomic

pkg/apis/pipeline/v1beta1/pipelinerun_types_test.go

-16
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ func TestInitializePipelineRunConditions(t *testing.T) {
7676
}
7777
p.Status.InitializeConditions(testClock)
7878

79-
if p.Status.TaskRuns == nil {
80-
t.Fatalf("PipelineRun TaskRun status not initialized correctly")
81-
}
82-
83-
if p.Status.Runs == nil {
84-
t.Fatalf("PipelineRun Run status not initialized correctly")
85-
}
86-
8779
if p.Status.StartTime.IsZero() {
8880
t.Fatalf("PipelineRun StartTime not initialized correctly")
8981
}
@@ -92,8 +84,6 @@ func TestInitializePipelineRunConditions(t *testing.T) {
9284
if condition.Reason != v1beta1.PipelineRunReasonStarted.String() {
9385
t.Fatalf("PipelineRun initialize reason should be %s, got %s instead", v1beta1.PipelineRunReasonStarted.String(), condition.Reason)
9486
}
95-
p.Status.TaskRuns["fooTask"] = &v1beta1.PipelineRunTaskRunStatus{}
96-
p.Status.Runs["bahTask"] = &v1beta1.PipelineRunRunStatus{}
9787

9888
// Change the reason before we initialize again
9989
p.Status.SetCondition(&apis.Condition{
@@ -104,12 +94,6 @@ func TestInitializePipelineRunConditions(t *testing.T) {
10494
})
10595

10696
p.Status.InitializeConditions(testClock)
107-
if len(p.Status.TaskRuns) != 1 {
108-
t.Fatalf("PipelineRun TaskRun status getting reset")
109-
}
110-
if len(p.Status.Runs) != 1 {
111-
t.Fatalf("PipelineRun Run status getting reset")
112-
}
11397

11498
newCondition := p.Status.GetCondition(apis.ConditionSucceeded)
11599
if newCondition.Reason != "not just started" {

pkg/apis/pipeline/v1beta1/swagger.json

-28
Original file line numberDiff line numberDiff line change
@@ -1215,13 +1215,6 @@
12151215
"description": "Provenance contains some key authenticated metadata about how a software artifact was built (what sources, what inputs/outputs, etc.).",
12161216
"$ref": "#/definitions/v1beta1.Provenance"
12171217
},
1218-
"runs": {
1219-
"description": "Deprecated - use ChildReferences instead. map of PipelineRunRunStatus with the run name as the key",
1220-
"type": "object",
1221-
"additionalProperties": {
1222-
"$ref": "#/definitions/v1beta1.PipelineRunRunStatus"
1223-
}
1224-
},
12251218
"skippedTasks": {
12261219
"description": "list of tasks that were skipped due to when expressions evaluating to false",
12271220
"type": "array",
@@ -1242,13 +1235,6 @@
12421235
"startTime": {
12431236
"description": "StartTime is the time the PipelineRun is actually started.",
12441237
"$ref": "#/definitions/v1.Time"
1245-
},
1246-
"taskRuns": {
1247-
"description": "Deprecated - use ChildReferences instead. map of PipelineRunTaskRunStatus with the taskRun name as the key",
1248-
"type": "object",
1249-
"additionalProperties": {
1250-
"$ref": "#/definitions/v1beta1.PipelineRunTaskRunStatus"
1251-
}
12521238
}
12531239
}
12541240
},
@@ -1290,13 +1276,6 @@
12901276
"description": "Provenance contains some key authenticated metadata about how a software artifact was built (what sources, what inputs/outputs, etc.).",
12911277
"$ref": "#/definitions/v1beta1.Provenance"
12921278
},
1293-
"runs": {
1294-
"description": "Deprecated - use ChildReferences instead. map of PipelineRunRunStatus with the run name as the key",
1295-
"type": "object",
1296-
"additionalProperties": {
1297-
"$ref": "#/definitions/v1beta1.PipelineRunRunStatus"
1298-
}
1299-
},
13001279
"skippedTasks": {
13011280
"description": "list of tasks that were skipped due to when expressions evaluating to false",
13021281
"type": "array",
@@ -1317,13 +1296,6 @@
13171296
"startTime": {
13181297
"description": "StartTime is the time the PipelineRun is actually started.",
13191298
"$ref": "#/definitions/v1.Time"
1320-
},
1321-
"taskRuns": {
1322-
"description": "Deprecated - use ChildReferences instead. map of PipelineRunTaskRunStatus with the taskRun name as the key",
1323-
"type": "object",
1324-
"additionalProperties": {
1325-
"$ref": "#/definitions/v1beta1.PipelineRunTaskRunStatus"
1326-
}
13271299
}
13281300
}
13291301
},

pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go

-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/reconciler/pipelinerun/pipelinerun.go

+1-65
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func (c *Reconciler) resolvePipelineState(
310310
for _, task := range tasks {
311311
// We need the TaskRun name to ensure that we don't perform an additional remote resolution request for a PipelineTask
312312
// in the TaskRun reconciler.
313-
trName := resources.GetTaskRunName(pr.Status.TaskRuns, pr.Status.ChildReferences, task.Name, pr.Name)
313+
trName := resources.GetTaskRunName(pr.Status.ChildReferences, task.Name, pr.Name)
314314

315315
vp, err := getVerificationPolicies(ctx, c.verificationPolicyLister, pr.Namespace)
316316
if err != nil {
@@ -1317,12 +1317,6 @@ func (c *Reconciler) updatePipelineRunStatusFromInformer(ctx context.Context, pr
13171317
}
13181318

13191319
func updatePipelineRunStatusFromChildObjects(ctx context.Context, logger *zap.SugaredLogger, pr *v1beta1.PipelineRun, taskRuns []*v1beta1.TaskRun, runObjects []v1beta1.RunObject) error {
1320-
// Clear any TaskRuns and Runs present in the status.
1321-
// This can occur if the value of "embedded-status" flag was modified during PipelineRun execution prior to its removal.
1322-
// TODO: https://github.com/tektoncd/pipeline/issues/6090 cleanup the checks for `status.taskruns` and
1323-
// `status.runs` and refactor the helper functions to be combined
1324-
pr.Status.Runs = nil
1325-
pr.Status.TaskRuns = nil
13261320
updatePipelineRunStatusFromChildRefs(logger, pr, taskRuns, runObjects)
13271321

13281322
return validateChildObjectsInPipelineRunStatus(ctx, pr.Status)
@@ -1395,64 +1389,6 @@ func filterRunsForPipelineRunStatus(logger *zap.SugaredLogger, pr *v1beta1.Pipel
13951389
return names, taskLabels, gvks, statuses
13961390
}
13971391

1398-
// updatePipelineRunStatusFromTaskRuns takes a PipelineRun and a list of TaskRuns within that PipelineRun, and updates
1399-
// the PipelineRun's .Status.TaskRuns.
1400-
func updatePipelineRunStatusFromTaskRuns(logger *zap.SugaredLogger, pr *v1beta1.PipelineRun, trs []*v1beta1.TaskRun) {
1401-
// If no TaskRun was found, nothing to be done. We never remove taskruns from the status
1402-
if len(trs) == 0 {
1403-
return
1404-
}
1405-
1406-
if pr.Status.TaskRuns == nil {
1407-
pr.Status.TaskRuns = make(map[string]*v1beta1.PipelineRunTaskRunStatus)
1408-
}
1409-
1410-
taskRuns := filterTaskRunsForPipelineRunStatus(logger, pr, trs)
1411-
1412-
// Loop over all the TaskRuns associated to Tasks
1413-
for _, taskrun := range taskRuns {
1414-
lbls := taskrun.GetLabels()
1415-
pipelineTaskName := lbls[pipeline.PipelineTaskLabelKey]
1416-
1417-
if _, ok := pr.Status.TaskRuns[taskrun.Name]; !ok {
1418-
// This taskrun was missing from the status.
1419-
// Add it without conditions, which are handled in the next loop
1420-
logger.Infof("Found a TaskRun %s that was missing from the PipelineRun status", taskrun.Name)
1421-
pr.Status.TaskRuns[taskrun.Name] = &v1beta1.PipelineRunTaskRunStatus{
1422-
PipelineTaskName: pipelineTaskName,
1423-
Status: &taskrun.Status,
1424-
}
1425-
}
1426-
}
1427-
}
1428-
1429-
func updatePipelineRunStatusFromCustomRunsOrRuns(logger *zap.SugaredLogger, pr *v1beta1.PipelineRun, runObjects []v1beta1.RunObject) {
1430-
// If no RunObject was found, nothing to be done. We never remove runs from the status
1431-
if len(runObjects) == 0 {
1432-
return
1433-
}
1434-
if pr.Status.Runs == nil {
1435-
pr.Status.Runs = make(map[string]*v1beta1.PipelineRunRunStatus)
1436-
}
1437-
1438-
// Get the names, their task label values, and their status objects for all CustomRuns or Runs associated with the PipelineRun
1439-
names, taskLabels, _, statuses := filterRunsForPipelineRunStatus(logger, pr, runObjects)
1440-
1441-
// Loop over all the elements and populate the status map
1442-
for idx := range names {
1443-
name := names[idx]
1444-
taskLabel := taskLabels[idx]
1445-
crStatus := statuses[idx]
1446-
if _, ok := pr.Status.Runs[name]; !ok {
1447-
// This run was missing from the status.
1448-
pr.Status.Runs[name] = &v1beta1.PipelineRunRunStatus{
1449-
PipelineTaskName: taskLabel,
1450-
Status: crStatus,
1451-
}
1452-
}
1453-
}
1454-
}
1455-
14561392
func updatePipelineRunStatusFromChildRefs(logger *zap.SugaredLogger, pr *v1beta1.PipelineRun, trs []*v1beta1.TaskRun, runObjects []v1beta1.RunObject) {
14571393
// If no TaskRun or RunObject was found, nothing to be done. We never remove child references from the status.
14581394
// We do still return an empty map of TaskRun/Run names keyed by PipelineTask name for later functions.

pkg/reconciler/pipelinerun/pipelinerun_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -5973,7 +5973,6 @@ func getPipelineRun(pr, p string, status corev1.ConditionStatus, reason string,
59735973
},
59745974
},
59755975
},
5976-
PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{TaskRuns: map[string]*v1beta1.PipelineRunTaskRunStatus{}},
59775976
},
59785977
}
59795978
for k, v := range tr {

0 commit comments

Comments
 (0)