Skip to content

Commit

Permalink
Remove deprecated TaskRun.Status.ResourceResults.ResourceRef field
Browse files Browse the repository at this point in the history
See #2694.

The `TaskRun.Status.ResourceResults.ResourceRef` field was only ever used for its own `Name` field, and as part of #2694, a new field, `TaskRun.Status.ResourceResults.ResourceName` was added to replace `...ResourceRef.Name` with a more semantically appropriate field. This change finishes the work by removing the deprecated `TaskRun.Status.ResourceResults.ResourceRef`.

This has been scheduled for removal since April 2021.

Signed-off-by: Andrew Bayer <[email protected]>
  • Loading branch information
abayer authored and tekton-robot committed Jun 15, 2022
1 parent d92a253 commit fcbeb45
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 95 deletions.
14 changes: 4 additions & 10 deletions cmd/git-init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,13 @@ func main() {
resourceName := os.Getenv("TEKTON_RESOURCE_NAME")
output := []v1beta1.PipelineResourceResult{
{
Key: "commit",
Value: commit,
ResourceRef: &v1beta1.PipelineResourceRef{
Name: resourceName,
},
Key: "commit",
Value: commit,
ResourceName: resourceName,
},
{
Key: "url",
Value: fetchSpec.URL,
ResourceRef: &v1beta1.PipelineResourceRef{
Name: resourceName,
},
Key: "url",
Value: fetchSpec.URL,
ResourceName: resourceName,
},
}
Expand Down
6 changes: 0 additions & 6 deletions cmd/imagedigestexporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,11 @@ func main() {
Key: "digest",
Value: digest.String(),
ResourceName: imageResource.Name,
ResourceRef: &v1beta1.PipelineResourceRef{
Name: imageResource.Name,
},
})
output = append(output, v1beta1.PipelineResourceResult{
Key: "url",
Value: imageResource.URL,
ResourceName: imageResource.Name,
ResourceRef: &v1beta1.PipelineResourceRef{
Name: imageResource.Name,
},
})

}
Expand Down
3 changes: 1 addition & 2 deletions docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ being deprecated.

| Feature Being Deprecated | Deprecation Announcement | [API Compatibility Policy](https://github.com/tektoncd/pipeline/tree/main/api_compatibility_policy.md) | Earliest Date or Release of Removal |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|-------------------------------------|
| [The `TaskRun.Status.ResourceResults.ResourceRef` field is deprecated and will be removed.](https://github.com/tektoncd/pipeline/issues/2694) | [v0.14.0](https://github.com/tektoncd/pipeline/releases/tag/v0.14.0) | Beta | April 30 2021 |
| [The `PipelineRun.Spec.ServiceAccountNames` field is deprecated and will be removed.](https://github.com/tektoncd/pipeline/issues/2614) | [v0.15.0](https://github.com/tektoncd/pipeline/releases/tag/v0.15.0) | Beta | May 15 2021 |
| [`PipelineRunCancelled` is deprecated and will be removed](https://github.com/tektoncd/pipeline/issues/4611) | [v0.25.0](https://github.com/tektoncd/pipeline/releases/tag/v0.25.0) | Beta | July 12 2022 |
| [`PipelineResources` are deprecated.](https://github.com/tektoncd/community/blob/main/teps/0074-deprecate-pipelineresources.md) | [v0.30.0](https://github.com/tektoncd/pipeline/releases/tag/v0.30.0) | Alpha | Dec 20 2021 |
| [The `PipelineRun.Status.TaskRuns` and `PipelineRun.Status.Runs` fields are deprecated and will be removed.](https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md) | v0.35.0 | Beta | Jan 25, 2023 |
| [PipelineRun.Timeout is deprecated and will be removed](https://github.com/tektoncd/community/blob/main/teps/0046-finallytask-execution-post-timeout.md) | v0.36.0 (to be released) | Beta | Feb 25, 2023 |

| [Several fields of Task.Step are deprecated](https://github.com/tektoncd/pipeline/issues/4737) | v0.36.0 (to be released) | Beta | Feb 25, 2023 |
| [Several fields of Task.Step are deprecated](https://github.com/tektoncd/pipeline/issues/4737) | v0.36.0 (to be released) | Beta | Feb 25, 2023 |
3 changes: 1 addition & 2 deletions docs/pipelineruns.md
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,7 @@ taskRuns:
podName: triggers-release-nightly-frwmw-build-pod
resourcesResult:
- key: commit
resourceRef:
name: git-source-triggers-frwmw
resourceName: git-source-triggers-frwmw
value: 9ab5a1234166a89db352afa28f499d596ebb48db
startTime: "2020-05-04T02:05:07Z"
steps:
Expand Down
9 changes: 3 additions & 6 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ For an example of what this output looks like:
resourcesResult:
- key: digest
value: sha256:a08412a4164b85ae521b0c00cf328e3aab30ba94a526821367534b81e51cb1cb
resourceRef:
name: skaffold-image-leeroy-web
resourceName: skaffold-image-leeroy-web
```

### Description
Expand Down Expand Up @@ -380,8 +379,7 @@ When used as an input, the Git resource includes the exact commit fetched in the
resourceResults:
- key: commit
value: 6ed7aad5e8a36052ee5f6079fc91368e362121f7
resourceRef:
name: skaffold-git
resourceName: skaffold-git
```

#### Using a fork
Expand Down Expand Up @@ -663,8 +661,7 @@ status:
resourcesResult:
- key: "digest"
value: "sha256:eed29cd0b6feeb1a92bc3c4f977fd203c63b376a638731c88cacefe3adb1c660"
resourceRef:
name: skaffold-image-leeroy-web
resourceName: skaffold-image-leeroy-web
# ...
```

Expand Down
2 changes: 1 addition & 1 deletion examples/v1alpha1/taskruns/cloud-event.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ spec:
print("Got it!")
taskrun = json.loads(response.read().decode('utf-8'))
digest = taskrun['taskRun']['status']['resourcesResult'][0]['value']
image_name = taskrun['taskRun']['status']['resourcesResult'][0]['resourceRef']['name']
image_name = taskrun['taskRun']['status']['resourcesResult'][0]['resourceName']
print("Got digest %s for image %s" % (digest, image_name))
if image_name == "myimage" and digest:
break
Expand Down
2 changes: 1 addition & 1 deletion examples/v1beta1/taskruns/cloud-event.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ spec:
print("Got it!")
taskrun = json.loads(response.read().decode('utf-8'))
digest = taskrun['taskRun']['status']['resourcesResult'][0]['value']
image_name = taskrun['taskRun']['status']['resourcesResult'][0]['resourceRef']['name']
image_name = taskrun['taskRun']['status']['resourcesResult'][0]['resourceName']
print("Got digest %s for image %s" % (digest, image_name))
if image_name == "myimage" and digest:
break
Expand Down
8 changes: 0 additions & 8 deletions pkg/apis/pipeline/v1beta1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions pkg/apis/pipeline/v1beta1/resource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,10 @@ type PipelineResourceBinding struct {

// PipelineResourceResult used to export the image name and digest as json
type PipelineResourceResult struct {
Key string `json:"key"`
Value string `json:"value"`
ResourceName string `json:"resourceName,omitempty"`
// The field ResourceRef should be deprecated and removed in the next API version.
// See https://github.com/tektoncd/pipeline/issues/2694 for more information.
ResourceRef *PipelineResourceRef `json:"resourceRef,omitempty"`
ResultType ResultType `json:"type,omitempty"`
Key string `json:"key"`
Value string `json:"value"`
ResourceName string `json:"resourceName,omitempty"`
ResultType ResultType `json:"type,omitempty"`
}

// ResultType used to find out whether a PipelineResourceResult is from a task result or not
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/pipeline/v1beta1/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,6 @@
"resourceName": {
"type": "string"
},
"resourceRef": {
"description": "The field ResourceRef should be deprecated and removed in the next API version. See https://github.com/tektoncd/pipeline/issues/2694 for more information.",
"$ref": "#/definitions/v1beta1.PipelineResourceRef"
},
"type": {
"type": "integer",
"format": "int32"
Expand Down
9 changes: 1 addition & 8 deletions pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fcbeb45

Please sign in to comment.