Skip to content

Commit

Permalink
[TEP-0091]support remote v1 task verification
Browse files Browse the repository at this point in the history
This commit adds the support for v1 task verification. Previously we
only support v1beta1 verificaiton.

Signed-off-by: Yongxuan Zhang [email protected]
  • Loading branch information
Yongxuanzhang authored and tekton-robot committed Jun 6, 2023
1 parent ee9a5e3 commit ec04eef
Show file tree
Hide file tree
Showing 4 changed files with 624 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docs/trusted-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ weight: 312

## Overview

Trusted Resources is a feature which can be used to sign Tekton Resources and verify them. Details of design can be found at [TEP--0091](https://github.com/tektoncd/community/blob/main/teps/0091-trusted-resources.md). This is an alpha feature and supports `v1beta1` version of `Task` and `Pipeline`.
Trusted Resources is a feature which can be used to sign Tekton Resources and verify them. Details of design can be found at [TEP--0091](https://github.com/tektoncd/community/blob/main/teps/0091-trusted-resources.md). This is an alpha feature and supports `v1beta1` version of `Task` and `Pipeline` and `v1` `Task`.

**Note**: Currently, trusted resources only support verifying Tekton resources that come from remote places i.e. git, OCI registry and Artifact Hub. To use [cluster resolver](./cluster-resolver.md) for in-cluster resources, make sure to set all default values for the resources before applied to cluster, because the mutating webhook will update the default fields if not given and fail the verification.

Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/taskrun/resources/taskref.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func readRuntimeObjectAsTask(ctx context.Context, obj runtime.Object, k8s kubern
case *v1beta1.ClusterTask:
return convertClusterTaskToTask(*obj), nil, nil
case *v1.Task:
// TODO(#6356): Support V1 Task verification
vr := trustedresources.VerifyResource(ctx, obj, k8s, refSource, verificationPolicies)
// Validation of beta fields must happen before the V1 Task is converted into the storage version of the API.
// TODO(#6592): Decouple API versioning from feature versioning
if err := obj.Spec.ValidateBetaFields(ctx); err != nil {
Expand All @@ -192,7 +192,7 @@ func readRuntimeObjectAsTask(ctx context.Context, obj runtime.Object, k8s kubern
if err := t.ConvertFrom(ctx, obj); err != nil {
return nil, nil, fmt.Errorf("failed to convert obj %s into Task", obj.GetObjectKind().GroupVersionKind().String())
}
return t, nil, nil
return t, &vr, nil
}
return nil, nil, errors.New("resource is not a task")
}
Expand Down
Loading

0 comments on commit ec04eef

Please sign in to comment.