Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

double MaximumBundleObjects and update tests #4899

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,11 @@ spec:
`"true"` in the `feature-flags` configmap, see [`install.md`](./install.md#customizing-the-pipelines-controller-behavior)**

You may also specify your `Task` reference using a `Tekton Bundle`. A `Tekton Bundle` is an OCI artifact that
contains Tekton resources like `Tasks` which can be referenced within a `taskRef`.
contains Tekton resources like `Tasks` which can be referenced within a `taskRef`.

There is currently a hard limit of 20 objects in a bundle.



```yaml
spec:
Expand Down
2 changes: 1 addition & 1 deletion pkg/remote/oci/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (
// TitleAnnotation is an OCI annotation for the bundle title
TitleAnnotation = "dev.tekton.image.name"
// MaximumBundleObjects defines the maximum number of objects in a bundle
MaximumBundleObjects = 10
MaximumBundleObjects = 20
)

// Resolver implements the Resolver interface using OCI images.
Expand Down
124 changes: 21 additions & 103 deletions pkg/remote/oci/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ func TestOCIResolver(t *testing.T) {
t.Fatal(err)
}

// setup to many objects in oci bundle test
toManyObjErr := fmt.Sprintf("contained more than the maximum %d allow objects", oci.MaximumBundleObjects)

var toManyObj []runtime.Object
for i := 0; i <= oci.MaximumBundleObjects; i++ {
name := fmt.Sprintf("%d-task", i)
obj := v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
}
toManyObj = append(toManyObj, &obj)
}

testcases := []struct {
name string
objs []runtime.Object
Expand Down Expand Up @@ -129,111 +147,11 @@ func TestOCIResolver(t *testing.T) {
},
},
{
name: "too-many-objects",
objs: []runtime.Object{
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "first-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "second-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "third-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "fourth-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "fifth-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "sixth-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "seventh-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "eighth-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "ninth-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "tenth-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
&v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{
Name: "eleventh-task",
},
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "Task",
},
},
},
name: "too-many-objects",
objs: toManyObj,
mapper: test.DefaultObjectAnnotationMapper,
listExpected: []remote.ResolvedObject{},
wantErr: "contained more than the maximum 10 allow objects",
wantErr: toManyObjErr,
},
{
name: "single-task-no-version",
Expand Down