From 8ba167ad294dbd3bf5ae7459cf6da8a32a78bcc5 Mon Sep 17 00:00:00 2001 From: encalada Date: Wed, 24 Jan 2024 16:02:16 +0100 Subject: [PATCH] Adjust integration tests Move them to beta Small fix on test/v1beta1_samples files --- test/integration/build_to_buildruns_test.go | 99 +++----- test/integration/build_to_git_test.go | 116 ++++++--- test/integration/build_to_secrets_test.go | 229 ++++-------------- test/integration/build_to_taskruns_test.go | 32 +-- test/integration/buildrun_cleanup_test.go | 63 ++--- test/integration/buildruns_to_sa_test.go | 24 +- .../integration/buildruns_to_taskruns_test.go | 54 ++--- .../buildstrategy_to_taskruns_test.go | 36 ++- .../clusterbuildstrategy_to_taskruns_test.go | 10 +- test/integration/integration_suite_test.go | 3 +- test/v1beta1_samples/buildstrategy_samples.go | 24 +- test/v1beta1_samples/catalog.go | 12 +- .../clusterbuildstrategy_samples.go | 16 +- 13 files changed, 304 insertions(+), 414 deletions(-) diff --git a/test/integration/build_to_buildruns_test.go b/test/integration/build_to_buildruns_test.go index ccae8c58a2..d397322558 100644 --- a/test/integration/build_to_buildruns_test.go +++ b/test/integration/build_to_buildruns_test.go @@ -5,7 +5,6 @@ package integration_test import ( - "fmt" "strings" corev1 "k8s.io/api/core/v1" @@ -14,18 +13,17 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" + test "github.com/shipwright-io/build/test/v1beta1_samples" ) var _ = Describe("Integration tests Build and BuildRuns", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build - buildRunObject *v1alpha1.BuildRun + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build + buildRunObject *v1beta1.BuildRun buildSample []byte buildRunSample []byte ) @@ -83,9 +81,9 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Reason).To(Equal("BuildRunTimeout")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Message).To(ContainSubstring("failed to finish within")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Reason).To(Equal("BuildRunTimeout")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Message).To(ContainSubstring("failed to finish within")) }) }) @@ -107,9 +105,9 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Reason).To(Equal("BuildRunTimeout")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Message).To(ContainSubstring("failed to finish within")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Reason).To(Equal("BuildRunTimeout")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Message).To(ContainSubstring("failed to finish within")) }) It("should be able to override the build output", func() { @@ -193,9 +191,9 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { br, err := tb.GetBR(buildRunObject.Name) Expect(err).To(BeNil()) Expect(br.Status.CompletionTime).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Type).To(Equal(v1alpha1.Succeeded)) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionUnknown)) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Reason).To( + Expect(br.Status.GetCondition(v1beta1.Succeeded).Type).To(Equal(v1beta1.Succeeded)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionUnknown)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Reason).To( // BuildRun reason can be ExceededNodeResources // if the Tekton TaskRun Pod is queued due to // insufficient cluster resources. @@ -225,9 +223,9 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { br, err := tb.GetBR(buildRunObject.Name) Expect(err).To(BeNil()) Expect(br.Status.StartTime).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Reason).To(Equal("BuildNotFound")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Message).To(ContainSubstring("not found")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Reason).To(Equal("BuildNotFound")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Message).To(ContainSubstring("not found")) }) }) @@ -251,9 +249,9 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Reason).To(Equal("BuildRegistrationFailed")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Message).To(ContainSubstring("Build is not registered correctly")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Reason).To(Equal("BuildRegistrationFailed")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Message).To(ContainSubstring("Build is not registered correctly")) }) }) @@ -283,9 +281,9 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { Expect(err).To(BeNil()) Expect(br.Status.CompletionTime).ToNot(BeNil()) Expect(br.Status.StartTime).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Reason).To(Equal("BuildNotFound")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Message).To(ContainSubstring("not found")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Reason).To(Equal("BuildNotFound")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Message).To(ContainSubstring("not found")) }) }) @@ -381,8 +379,7 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { }) - It("does not deletes the buildrun if the annotation is changed", func() { - + It("does not deletes the buildrun if retention atBuildDeletion is changed", func() { Expect(tb.CreateBuild(buildObject)).To(BeNil()) buildObject, err = tb.GetBuildTillValidation(buildObject.Name) @@ -401,7 +398,7 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { Expect(err).To(BeNil()) // we modify the annotation so automatic delete does not take place - data := []byte(fmt.Sprintf(`{"metadata":{"annotations":{"%s":"false"}}}`, v1alpha1.AnnotationBuildRunDeletion)) + data := []byte(`{"spec":{"retention":{"atBuildDeletion":false}}}`) _, err = tb.PatchBuild(BUILD+tb.Namespace, data) Expect(err).To(BeNil()) @@ -412,38 +409,6 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { Expect(err).To(BeNil()) Expect(ownerReferenceNames(br.OwnerReferences)).ShouldNot(ContainElement(buildObject.Name)) - }) - It("does not deletes the buildrun if the annotation is removed", func() { - - Expect(tb.CreateBuild(buildObject)).To(BeNil()) - - buildObject, err = tb.GetBuildTillValidation(buildObject.Name) - Expect(err).To(BeNil()) - - autoDeleteBuildRun, err := tb.Catalog.LoadBRWithNameAndRef( - BUILDRUN+tb.Namespace, - BUILD+tb.Namespace, - []byte(test.MinimalBuildRun), - ) - Expect(err).To(BeNil()) - - Expect(tb.CreateBR(autoDeleteBuildRun)).To(BeNil()) - - _, err = tb.GetBRTillStartTime(autoDeleteBuildRun.Name) - Expect(err).To(BeNil()) - - // we remove the annotation so automatic delete does not take place, "/" is escaped by "~1" in a JSON pointer - data := []byte(fmt.Sprintf(`[{"op":"remove","path":"/metadata/annotations/%s"}]`, strings.ReplaceAll(v1alpha1.AnnotationBuildRunDeletion, "/", "~1"))) - _, err = tb.PatchBuildWithPatchType(BUILD+tb.Namespace, data, types.JSONPatchType) - Expect(err).To(BeNil()) - - err = tb.DeleteBuild(BUILD + tb.Namespace) - Expect(err).To(BeNil()) - - br, err := tb.GetBRTillNotOwner(BUILDRUN+tb.Namespace, buildObject.Name) - Expect(err).To(BeNil()) - Expect(ownerReferenceNames(br.OwnerReferences)).ShouldNot(ContainElement(buildObject.Name)) - }) It("does delete the buildrun after several modifications of the annotation", func() { @@ -462,25 +427,25 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { Expect(tb.CreateBR(autoDeleteBuildRun)).To(BeNil()) // we modify the annotation for the automatic deletion to not take place - data := []byte(fmt.Sprintf(`{"metadata":{"annotations":{"%s":"false"}}}`, v1alpha1.AnnotationBuildRunDeletion)) + data := []byte(`{"spec":{"retention":{"atBuildDeletion":false}}}`) _, err = tb.PatchBuild(BUILD+tb.Namespace, data) Expect(err).To(BeNil()) patchedBuild, err := tb.GetBuild(BUILD + tb.Namespace) Expect(err).To(BeNil()) - Expect(patchedBuild.Annotations[v1alpha1.AnnotationBuildRunDeletion]).To(Equal("false")) + Expect(*patchedBuild.Spec.Retention.AtBuildDeletion).To(Equal(false)) _, err = tb.GetBRTillStartTime(autoDeleteBuildRun.Name) Expect(err).To(BeNil()) // we modify the annotation one more time, to validate that the build should be deleted this time - data = []byte(fmt.Sprintf(`{"metadata":{"annotations":{"%s":"true"}}}`, v1alpha1.AnnotationBuildRunDeletion)) + data = []byte(`{"spec":{"retention":{"atBuildDeletion":true}}}`) _, err = tb.PatchBuild(BUILD+tb.Namespace, data) Expect(err).To(BeNil()) patchedBuild, err = tb.GetBuild(BUILD + tb.Namespace) Expect(err).To(BeNil()) - Expect(patchedBuild.Annotations[v1alpha1.AnnotationBuildRunDeletion]).To(Equal("true")) + Expect(*patchedBuild.Spec.Retention.AtBuildDeletion).To(Equal(true)) br, err := tb.GetBRTillOwner(BUILDRUN+tb.Namespace, buildObject.Name) Expect(err).To(BeNil()) @@ -509,7 +474,7 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.BuildNameInvalid)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.BuildNameInvalid)) Expect(*buildObject.Status.Message).To(ContainSubstring("must be no more than 63 characters")) }) }) @@ -535,8 +500,8 @@ var _ = Describe("Integration tests Build and BuildRuns", func() { Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) }) }) diff --git a/test/integration/build_to_git_test.go b/test/integration/build_to_git_test.go index 0f0cefdc80..5fb1f74a12 100644 --- a/test/integration/build_to_git_test.go +++ b/test/integration/build_to_git_test.go @@ -7,8 +7,8 @@ package integration_test import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" + test "github.com/shipwright-io/build/test/v1beta1_samples" corev1 "k8s.io/api/core/v1" "k8s.io/utils/pointer" ) @@ -16,8 +16,8 @@ import ( var _ = Describe("Integration tests Build and referenced Source url", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build ) // Load the ClusterBuildStrategies before each test case BeforeEach(func() { @@ -47,7 +47,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) buildObject.ObjectMeta.Annotations["build.shipwright.io/verify.repository"] = "true" - buildObject.Spec.Source.URL = pointer.String("http://github.com/shipwright-io/sample-go") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "http://github.com/shipwright-io/sample-go", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) @@ -55,8 +60,8 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { buildObject, err := tb.GetBuildTillRegistration(buildName, corev1.ConditionTrue) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) }) @@ -72,7 +77,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { ) Expect(err).To(BeNil()) - buildObject.Spec.Source.URL = pointer.String("http://github.com/shipwright-io/sample-go-fake") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "http://github.com/shipwright-io/sample-go-fake", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) // wait until the Build finish the validation @@ -80,8 +90,8 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) // skip validation due to empty annotation Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) }) @@ -98,7 +108,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) buildObject.ObjectMeta.Annotations["build.shipwright.io/verify.repository"] = "true" - buildObject.Spec.Source.URL = pointer.String("https://github.com/shipwright-io/sample-go") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "https://github.com/shipwright-io/sample-go", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) @@ -106,8 +121,8 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { buildObject, err := tb.GetBuildTillRegistration(buildName, corev1.ConditionTrue) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) }) @@ -123,7 +138,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { ) Expect(err).To(BeNil()) - buildObject.Spec.Source.URL = pointer.String("https://github.com/shipwright-io/sample-go-fake") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "https://github.com/shipwright-io/sample-go-fake", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) // wait until the Build finish the validation @@ -131,8 +151,8 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) // skip validation due to empty annotation Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) }) @@ -149,7 +169,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) buildObject.ObjectMeta.Annotations["build.shipwright.io/verify.repository"] = "true" - buildObject.Spec.Source.URL = pointer.String("foobar") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "foobar", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) @@ -158,7 +183,7 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) // this one is validating file protocol Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.RemoteRepositoryUnreachable)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.RemoteRepositoryUnreachable)) Expect(*buildObject.Status.Message).To(Equal("invalid source url")) }) }) @@ -176,7 +201,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) buildObject.ObjectMeta.Annotations["build.shipwright.io/verify.repository"] = "false" - buildObject.Spec.Source.URL = pointer.String("foobar") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "foobar", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) // wait until the Build finish the validation @@ -184,8 +214,8 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) // skip validation due to false annotation Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) }) @@ -202,7 +232,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) buildObject.ObjectMeta.Annotations["build.shipwright.io/verify.repository"] = "true" - buildObject.Spec.Source.URL = pointer.String("https://github.yourco.com/org/build-fake") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "https://github.yourco.com/org/build-fake", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) @@ -212,7 +247,7 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) // Because github enterprise always require authentication, this validation will fail while // the repository could not be found. - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.RemoteRepositoryUnreachable)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.RemoteRepositoryUnreachable)) Expect(*buildObject.Status.Message).To(ContainSubstring("no such host")) }) @@ -228,10 +263,15 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) buildObject.ObjectMeta.Annotations["build.shipwright.io/verify.repository"] = "true" - buildObject.Spec.Source.URL = pointer.String("https://github.yourco.com/org/build-fake") - buildObject.Spec.Source.Credentials = &corev1.LocalObjectReference{Name: "foobar"} - - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Source.Credentials.Name, buildObject.Namespace) + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "https://github.yourco.com/org/build-fake", + CloneSecret: pointer.String("foobar"), + }, + } + + sampleSecret := tb.Catalog.SecretWithAnnotation(*buildObject.Spec.Source.GitSource.CloneSecret, buildObject.Namespace) Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) Expect(tb.CreateBuild(buildObject)).To(BeNil()) @@ -242,8 +282,8 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { // Because this build references a source secret, Build controller will skip this validation. Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) }) @@ -260,7 +300,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) buildObject.ObjectMeta.Annotations["build.shipwright.io/verify.repository"] = "true" - buildObject.Spec.Source.URL = pointer.String("git@github.com:shipwright-io/build-fake.git") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "git@github.com:shipwright-io/build-fake.git", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) @@ -270,7 +315,7 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { // Because sourceURL with git@ format implies that authentication is required, // this validation will be skipped and build will be successful. Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.RemoteRepositoryUnreachable)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.RemoteRepositoryUnreachable)) Expect(*buildObject.Status.Message).To(Equal("the source url requires authentication")) }) }) @@ -288,7 +333,12 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { Expect(err).To(BeNil()) buildObject.ObjectMeta.Annotations["build.shipwright.io/verify.repository"] = "true" - buildObject.Spec.Source.URL = pointer.String("ssh://github.com/shipwright-io/build-fake.git") + buildObject.Spec.Source = v1beta1.Source{ + Type: v1beta1.GitType, + GitSource: &v1beta1.Git{ + URL: "ssh://github.com/shipwright-io/build-fake.git", + }, + } Expect(tb.CreateBuild(buildObject)).To(BeNil()) @@ -298,7 +348,7 @@ var _ = Describe("Integration tests Build and referenced Source url", func() { // Because sourceURL with ssh format implies that authentication is required, // this validation will be skipped and build will be successful. Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.RemoteRepositoryUnreachable)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.RemoteRepositoryUnreachable)) Expect(*buildObject.Status.Message).To(Equal("the source url requires authentication")) }) }) diff --git a/test/integration/build_to_secrets_test.go b/test/integration/build_to_secrets_test.go index dcb476ecaf..4cb0efb714 100644 --- a/test/integration/build_to_secrets_test.go +++ b/test/integration/build_to_secrets_test.go @@ -9,16 +9,16 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" + test "github.com/shipwright-io/build/test/v1beta1_samples" corev1 "k8s.io/api/core/v1" ) var _ = Describe("Integration tests Build and referenced Secrets", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build ) // Load the ClusterBuildStrategies before each test case BeforeEach(func() { @@ -47,7 +47,7 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { ) Expect(err).To(BeNil()) - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Output.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithAnnotation(*buildObject.Spec.Output.PushSecret, buildObject.Namespace) Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) @@ -57,17 +57,17 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err := tb.GetBuildTillValidation(buildName) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) // delete a secret - Expect(tb.DeleteSecret(buildObject.Spec.Output.Credentials.Name)).To(BeNil()) + Expect(tb.DeleteSecret(*buildObject.Spec.Output.PushSecret)).To(BeNil()) // assert that the validation happened one more time buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionFalse) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecOutputSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", buildObject.Spec.Output.Credentials.Name))) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SpecOutputSecretRefNotFound)) + Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", *buildObject.Spec.Output.PushSecret))) }) It("should validate when a missing secret is recreated", func() { @@ -86,10 +86,10 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err := tb.GetBuildTillValidation(buildName) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecOutputSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", buildObject.Spec.Output.Credentials.Name))) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SpecOutputSecretRefNotFound)) + Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", *buildObject.Spec.Output.PushSecret))) - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Output.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithAnnotation(*buildObject.Spec.Output.PushSecret, buildObject.Namespace) // generate resources Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) @@ -98,7 +98,7 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionTrue) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) }) }) @@ -114,7 +114,7 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { ) Expect(err).To(BeNil()) - sampleSecret := tb.Catalog.SecretWithoutAnnotation(buildObject.Spec.Output.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithoutAnnotation(*buildObject.Spec.Output.PushSecret, buildObject.Namespace) // generate resources Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) @@ -124,10 +124,10 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err := tb.GetBuildTillValidation(buildName) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) // delete a secret - Expect(tb.DeleteSecret(buildObject.Spec.Output.Credentials.Name)).To(BeNil()) + Expect(tb.DeleteSecret(*buildObject.Spec.Output.PushSecret)).To(BeNil()) // assert that the validation happened one more time buildObject, err = tb.GetBuild(buildName) @@ -151,10 +151,10 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err := tb.GetBuildTillValidation(buildName) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecOutputSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", buildObject.Spec.Output.Credentials.Name))) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SpecOutputSecretRefNotFound)) + Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", *buildObject.Spec.Output.PushSecret))) - sampleSecret := tb.Catalog.SecretWithoutAnnotation(buildObject.Spec.Output.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithoutAnnotation(*buildObject.Spec.Output.PushSecret, buildObject.Namespace) // generate resources Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) @@ -163,8 +163,8 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionFalse) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecOutputSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", buildObject.Spec.Output.Credentials.Name))) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SpecOutputSecretRefNotFound)) + Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", *buildObject.Spec.Output.PushSecret))) }) It("should validate when a missing secret is recreated with annotation", func() { @@ -183,29 +183,29 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err := tb.GetBuildTillValidation(buildName) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecOutputSecretRefNotFound)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SpecOutputSecretRefNotFound)) Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", "fake-secret"))) - sampleSecret := tb.Catalog.SecretWithoutAnnotation(buildObject.Spec.Output.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithoutAnnotation(*buildObject.Spec.Output.PushSecret, buildObject.Namespace) // generate resources Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) // validate build status again Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecOutputSecretRefNotFound)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SpecOutputSecretRefNotFound)) Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", "fake-secret"))) // we modify the annotation so automatic delete does not take place - data := []byte(fmt.Sprintf(`{"metadata":{"annotations":{"%s":"true"}}}`, v1alpha1.AnnotationBuildRefSecret)) + data := []byte(fmt.Sprintf(`{"metadata":{"annotations":{"%s":"true"}}}`, v1beta1.AnnotationBuildRefSecret)) - _, err = tb.PatchSecret(buildObject.Spec.Output.Credentials.Name, data) + _, err = tb.PatchSecret(*buildObject.Spec.Output.PushSecret, data) Expect(err).To(BeNil()) // // assert that the validation happened one more time buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionTrue) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) Expect(*buildObject.Status.Message).To(Equal("all validations succeeded")) }) }) @@ -222,7 +222,7 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { ) Expect(err).To(BeNil()) - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Source.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithAnnotation(*buildObject.Spec.Source.GitSource.CloneSecret, buildObject.Namespace) Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) @@ -232,18 +232,18 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err := tb.GetBuildTillValidation(buildName) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) Expect(*buildObject.Status.Message).To(Equal("all validations succeeded")) // delete a secret - Expect(tb.DeleteSecret(buildObject.Spec.Source.Credentials.Name)).To(BeNil()) + Expect(tb.DeleteSecret(*buildObject.Spec.Source.GitSource.CloneSecret)).To(BeNil()) // assert that the validation happened one more time buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionFalse) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecSourceSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", buildObject.Spec.Source.Credentials.Name))) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SpecSourceSecretRefNotFound)) + Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", *buildObject.Spec.Source.GitSource.CloneSecret))) }) It("should validate when a missing secret is recreated", func() { @@ -265,7 +265,7 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { // Status reason sometimes returns message "there are no secrets in namespace..." // Expect(buildObject.Status.Reason).To(Equal(fmt.Sprintf("secret %s does not exist", buildObject.Spec.Source.Credentials.Name))) - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Source.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithAnnotation(*buildObject.Spec.Source.GitSource.CloneSecret, buildObject.Namespace) // generate resources Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) @@ -274,151 +274,10 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionTrue) Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) }) }) - Context("when a build reference a secret with annotations for the spec builder", func() { - It("should validate the Build after secret deletion", func() { - - // populate Build related vars - buildName := BUILD + tb.Namespace - buildObject, err = tb.Catalog.LoadBuildWithNameAndStrategy( - buildName, - STRATEGY+tb.Namespace, - []byte(test.BuildWithBuilderRefSecret), - ) - Expect(err).To(BeNil()) - - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Builder.Credentials.Name, buildObject.Namespace) - - Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) - - Expect(tb.CreateBuild(buildObject)).To(BeNil()) - - // wait until the Build finish the validation - buildObject, err := tb.GetBuildTillValidation(buildName) - Expect(err).To(BeNil()) - Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - - // delete a secret - Expect(tb.DeleteSecret(buildObject.Spec.Builder.Credentials.Name)).To(BeNil()) - - // assert that the validation happened one more time - buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionFalse) - Expect(err).To(BeNil()) - Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecBuilderSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", buildObject.Spec.Builder.Credentials.Name))) - }) - - It("should validate when a missing secret is recreated", func() { - // populate Build related vars - buildName := BUILD + tb.Namespace - buildObject, err = tb.Catalog.LoadBuildWithNameAndStrategy( - buildName, - STRATEGY+tb.Namespace, - []byte(test.BuildWithBuilderRefSecret), - ) - Expect(err).To(BeNil()) - - Expect(tb.CreateBuild(buildObject)).To(BeNil()) - - // wait until the Build finish the validation - buildObject, err := tb.GetBuildTillValidation(buildName) - Expect(err).To(BeNil()) - Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SpecBuilderSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", buildObject.Spec.Builder.Credentials.Name))) - - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Builder.Credentials.Name, buildObject.Namespace) - - // generate resources - Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) - - // assert that the validation happened one more time - buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionTrue) - Expect(err).To(BeNil()) - Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - }) - }) - - Context("when a build reference multiple secrets with annotations for a build instance", func() { - It("should validate the Build after secret deletion", func() { - - // populate Build related vars - buildName := BUILD + tb.Namespace - buildObject, err = tb.Catalog.LoadBuildWithNameAndStrategy( - buildName, - STRATEGY+tb.Namespace, - []byte(test.BuildWithMultipleRefSecrets), - ) - Expect(err).To(BeNil()) - - specSourceSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Source.Credentials.Name, buildObject.Namespace) - specBuilderSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Builder.Credentials.Name, buildObject.Namespace) - - Expect(tb.CreateSecret(specSourceSecret)).To(BeNil()) - Expect(tb.CreateSecret(specBuilderSecret)).To(BeNil()) - - Expect(tb.CreateBuild(buildObject)).To(BeNil()) - - // wait until the Build finish the validation - buildObject, err := tb.GetBuildTillValidation(buildName) - Expect(err).To(BeNil()) - Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - - // delete a secret - Expect(tb.DeleteSecret(specSourceSecret.Name)).To(BeNil()) - Expect(tb.DeleteSecret(specBuilderSecret.Name)).To(BeNil()) - - buildObject, err = tb.GetBuildTillMessageContainsSubstring(buildName, "missing secrets are") - Expect(err).To(BeNil()) - Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.MultipleSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(ContainSubstring(specSourceSecret.Name)) - Expect(*buildObject.Status.Message).To(ContainSubstring(specBuilderSecret.Name)) - - }) - - It("should validate when a missing secret is recreated", func() { - // populate Build related vars - buildName := BUILD + tb.Namespace - buildObject, err = tb.Catalog.LoadBuildWithNameAndStrategy( - buildName, - STRATEGY+tb.Namespace, - []byte(test.BuildWithMultipleRefSecrets), - ) - Expect(err).To(BeNil()) - - Expect(tb.CreateBuild(buildObject)).To(BeNil()) - - // wait until the Build finish the validation - buildObject, err := tb.GetBuildTillValidation(buildName) - Expect(err).To(BeNil()) - Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.MultipleSecretRefNotFound)) - Expect(*buildObject.Status.Message).To(ContainSubstring("missing secrets are")) - Expect(*buildObject.Status.Message).To(ContainSubstring(buildObject.Spec.Source.Credentials.Name)) - Expect(*buildObject.Status.Message).To(ContainSubstring(buildObject.Spec.Builder.Credentials.Name)) - - specSourceSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Source.Credentials.Name, buildObject.Namespace) - specBuilderSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Builder.Credentials.Name, buildObject.Namespace) - - // generate resources - Expect(tb.CreateSecret(specSourceSecret)).To(BeNil()) - Expect(tb.CreateSecret(specBuilderSecret)).To(BeNil()) - - // assert that the validation happened one more time - buildObject, err = tb.GetBuildTillRegistration(buildName, corev1.ConditionTrue) - Expect(err).To(BeNil()) - Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - }) - }) Context("when multiple builds reference a secret with annotations for the spec.source", func() { It("should validate the Builds after secret deletion", func() { @@ -440,7 +299,7 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { ) Expect(err).To(BeNil()) - specSourceSecret := tb.Catalog.SecretWithAnnotation(firstBuildObject.Spec.Source.Credentials.Name, firstBuildObject.Namespace) + specSourceSecret := tb.Catalog.SecretWithAnnotation(*firstBuildObject.Spec.Source.GitSource.CloneSecret, firstBuildObject.Namespace) Expect(tb.CreateSecret(specSourceSecret)).To(BeNil()) @@ -451,12 +310,12 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { o, err := tb.GetBuildTillValidation(firstBuildName) Expect(err).To(BeNil()) Expect(*o.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*o.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*o.Status.Reason).To(Equal(v1beta1.SucceedStatus)) o, err = tb.GetBuildTillValidation(secondBuildName) Expect(err).To(BeNil()) Expect(*o.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*o.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*o.Status.Reason).To(Equal(v1beta1.SucceedStatus)) // delete a secret Expect(tb.DeleteSecret(specSourceSecret.Name)).To(BeNil()) @@ -465,15 +324,15 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { o, err = tb.GetBuildTillRegistration(firstBuildName, corev1.ConditionFalse) Expect(err).To(BeNil()) Expect(*o.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*o.Status.Reason).To(Equal(v1alpha1.SpecSourceSecretRefNotFound)) - Expect(*o.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", firstBuildObject.Spec.Source.Credentials.Name))) + Expect(*o.Status.Reason).To(Equal(v1beta1.SpecSourceSecretRefNotFound)) + Expect(*o.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", *firstBuildObject.Spec.Source.GitSource.CloneSecret))) // assert that the validation happened one more time o, err = tb.GetBuildTillRegistration(secondBuildName, corev1.ConditionFalse) Expect(err).To(BeNil()) Expect(*o.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*o.Status.Reason).To(Equal(v1alpha1.SpecSourceSecretRefNotFound)) - Expect(*o.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", secondBuildObject.Spec.Source.Credentials.Name))) + Expect(*o.Status.Reason).To(Equal(v1beta1.SpecSourceSecretRefNotFound)) + Expect(*o.Status.Message).To(Equal(fmt.Sprintf("referenced secret %s not found", *secondBuildObject.Spec.Source.GitSource.CloneSecret))) }) It("should validate the Builds when a missing secret is recreated", func() { // populate Build related vars @@ -506,7 +365,7 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionFalse)) - specSourceSecret := tb.Catalog.SecretWithAnnotation(firstBuildObject.Spec.Source.Credentials.Name, firstBuildObject.Namespace) + specSourceSecret := tb.Catalog.SecretWithAnnotation(*firstBuildObject.Spec.Source.GitSource.CloneSecret, firstBuildObject.Namespace) // generate resources Expect(tb.CreateSecret(specSourceSecret)).To(BeNil()) @@ -515,12 +374,12 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { o, err := tb.GetBuildTillRegistration(firstBuildName, corev1.ConditionTrue) Expect(err).To(BeNil()) Expect(*o.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*o.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*o.Status.Reason).To(Equal(v1beta1.SucceedStatus)) o, err = tb.GetBuildTillRegistration(secondBuildName, corev1.ConditionTrue) Expect(err).To(BeNil()) Expect(*o.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*o.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) + Expect(*o.Status.Reason).To(Equal(v1beta1.SucceedStatus)) }) }) }) diff --git a/test/integration/build_to_taskruns_test.go b/test/integration/build_to_taskruns_test.go index 6766cfcd3b..706f485502 100644 --- a/test/integration/build_to_taskruns_test.go +++ b/test/integration/build_to_taskruns_test.go @@ -9,16 +9,16 @@ import ( . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" - utils "github.com/shipwright-io/build/test/utils/v1alpha1" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" + utils "github.com/shipwright-io/build/test/utils/v1beta1" + test "github.com/shipwright-io/build/test/v1beta1_samples" ) var _ = Describe("Integration tests Build and TaskRun", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build - buildRunObject *v1alpha1.BuildRun + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build + buildRunObject *v1beta1.BuildRun buildSample, buildRunSample []byte ) @@ -74,8 +74,8 @@ var _ = Describe("Integration tests Build and TaskRun", func() { Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) It("should be successful with label value as empty string", func() { @@ -89,8 +89,8 @@ var _ = Describe("Integration tests Build and TaskRun", func() { Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) It("should be successful with annotation", func() { @@ -104,8 +104,8 @@ var _ = Describe("Integration tests Build and TaskRun", func() { Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) It("should be successful with label", func() { @@ -119,8 +119,8 @@ var _ = Describe("Integration tests Build and TaskRun", func() { Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) It("should be successful with both label and annotation", func() { @@ -139,8 +139,8 @@ var _ = Describe("Integration tests Build and TaskRun", func() { Expect(err).To(BeNil()) Expect(*buildObject.Status.Registered).To(Equal(corev1.ConditionTrue)) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.SucceedStatus)) - Expect(*buildObject.Status.Message).To(Equal(v1alpha1.AllValidationsSucceeded)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.SucceedStatus)) + Expect(*buildObject.Status.Message).To(Equal(v1beta1.AllValidationsSucceeded)) }) }) diff --git a/test/integration/buildrun_cleanup_test.go b/test/integration/buildrun_cleanup_test.go index f5ba42d993..a79d700562 100644 --- a/test/integration/buildrun_cleanup_test.go +++ b/test/integration/buildrun_cleanup_test.go @@ -8,17 +8,18 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" + test "github.com/shipwright-io/build/test/v1beta1_samples" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/utils/pointer" ) var _ = Describe("Integration tests for retention limits and ttls for succeeded buildruns.", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build - buildRunObject *v1alpha1.BuildRun + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build + buildRunObject *v1beta1.BuildRun buildSample []byte buildRunSample []byte ) @@ -72,7 +73,7 @@ var _ = Describe("Integration tests for retention limits and ttls for succeeded br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) _, err = tb.GetBRTillNotFound(buildRunObject.Name, time.Second*1, time.Second*15) Expect(apierrors.IsNotFound(err)).To(BeTrue()) }) @@ -95,7 +96,7 @@ var _ = Describe("Integration tests for retention limits and ttls for succeeded Expect(tb.CreateBR(buildRunObject)).To(BeNil()) br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) _, err = tb.GetBRTillNotFound(buildRunObject.Name, time.Second*1, time.Second*15) Expect(apierrors.IsNotFound(err)).To(BeTrue()) }) @@ -110,11 +111,11 @@ var _ = Describe("Integration tests for retention limits and ttls for succeeded It("Should not find the buildrun few seconds after it fails", func() { - buildRunObject.Spec.BuildRef.Name = "non-existent-buildref" + buildRunObject.Spec.Build.Name = pointer.String("non-existent-buildref") Expect(tb.CreateBR(buildRunObject)).To(BeNil()) br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) _, err = tb.GetBRTillNotFound(buildRunObject.Name, time.Second*1, time.Second*15) Expect(apierrors.IsNotFound(err)).To(BeTrue()) }) @@ -139,7 +140,7 @@ var _ = Describe("Integration tests for retention limits and ttls for succeeded Expect(tb.CreateBR(buildRunObject)).To(BeNil()) br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) // Make the TTL 5 seconds br.Spec.Retention.TTLAfterSucceeded.Duration = time.Second * 5 @@ -168,13 +169,13 @@ var _ = Describe("Integration tests for retention limits and ttls for succeeded Expect(tb.CreateBR(buildRunObject)).To(BeNil()) br1, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br1.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) + Expect(br1.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) // Create second buildrun buildRunObject.Name = BUILDRUN + tb.Namespace + "-2" Expect(tb.CreateBR(buildRunObject)).To(BeNil()) br2, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br2.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) + Expect(br2.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) _, err = tb.GetBRTillNotFound(BUILDRUN+tb.Namespace+"-1", time.Second*1, time.Second*5) Expect(apierrors.IsNotFound(err)).To(BeTrue()) @@ -200,7 +201,7 @@ var _ = Describe("Integration tests for retention limits and ttls for succeeded br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) _, err = tb.GetBRTillNotFound(buildRunObject.Name, time.Second*1, time.Second*15) Expect(apierrors.IsNotFound(err)).To(BeTrue()) @@ -233,31 +234,31 @@ var _ = Describe("Integration tests for retention limits and ttls for succeeded // Create 1 failed buildrun buildRunObject.Name = BUILDRUN + tb.Namespace + "-fail-1" str := "false" - falseParam := v1alpha1.ParamValue{Name: "exit-command", SingleValue: &v1alpha1.SingleValue{Value: &str}} - buildRunObject.Spec.ParamValues = []v1alpha1.ParamValue{falseParam} + falseParam := v1beta1.ParamValue{Name: "exit-command", SingleValue: &v1beta1.SingleValue{Value: &str}} + buildRunObject.Spec.ParamValues = []v1beta1.ParamValue{falseParam} err = tb.CreateBR(buildRunObject) // Wait for buildrun completion br1, err := tb.GetBRTillCompletion(BUILDRUN + tb.Namespace + "-success-1") Expect(err).To(BeNil()) - Expect(br1.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) + Expect(br1.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) br2, err := tb.GetBRTillCompletion(BUILDRUN + tb.Namespace + "-success-2") Expect(err).To(BeNil()) - Expect(br2.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) + Expect(br2.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionTrue)) br3, err := tb.GetBRTillCompletion(BUILDRUN + tb.Namespace + "-fail-1") Expect(err).To(BeNil()) - Expect(br3.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br3.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) // Create 1 failed buildrun. buildRunObject.Name = BUILDRUN + tb.Namespace + "-fail-2" - buildRunObject.Spec.ParamValues = []v1alpha1.ParamValue{falseParam} + buildRunObject.Spec.ParamValues = []v1beta1.ParamValue{falseParam} err = tb.CreateBR(buildRunObject) Expect(err).To(BeNil()) br4, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br4.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br4.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) // Check that the older failed buildrun has been deleted while the successful buildruns exist _, err = tb.GetBRTillNotFound(BUILDRUN+tb.Namespace+"-fail-1", time.Second*1, time.Second*5) @@ -273,9 +274,9 @@ var _ = Describe("Integration tests for retention limits and ttls for succeeded var _ = Describe("Integration tests for retention limits and ttls of buildRuns that fail", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build - buildRunObject *v1alpha1.BuildRun + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build + buildRunObject *v1beta1.BuildRun buildSample []byte buildRunSample []byte ) @@ -308,8 +309,8 @@ var _ = Describe("Integration tests for retention limits and ttls of buildRuns t buildRunObject, err = tb.Catalog.LoadBRWithNameAndRef(BUILDRUN+tb.Namespace, BUILD+tb.Namespace, buildRunSample) Expect(err).To(BeNil()) str := "false" - falseParam := v1alpha1.ParamValue{Name: "exit-command", SingleValue: &v1alpha1.SingleValue{Value: &str}} - buildRunObject.Spec.ParamValues = []v1alpha1.ParamValue{falseParam} + falseParam := v1beta1.ParamValue{Name: "exit-command", SingleValue: &v1beta1.SingleValue{Value: &str}} + buildRunObject.Spec.ParamValues = []v1beta1.ParamValue{falseParam} } }) @@ -331,7 +332,7 @@ var _ = Describe("Integration tests for retention limits and ttls of buildRuns t br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) _, err = tb.GetBRTillNotFound(buildRunObject.Name, time.Second*1, time.Second*15) Expect(apierrors.IsNotFound(err)).To(BeTrue()) }) @@ -356,7 +357,7 @@ var _ = Describe("Integration tests for retention limits and ttls of buildRuns t Expect(tb.CreateBR(buildRunObject)).To(BeNil()) br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) // Make the TTL 5 seconds br.Spec.Retention.TTLAfterFailed.Duration = time.Second * 5 @@ -383,7 +384,7 @@ var _ = Describe("Integration tests for retention limits and ttls of buildRuns t br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) _, err = tb.GetBRTillNotFound(buildRunObject.Name, time.Second*1, time.Second*15) Expect(apierrors.IsNotFound(err)).To(BeTrue()) }) @@ -405,7 +406,7 @@ var _ = Describe("Integration tests for retention limits and ttls of buildRuns t br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) _, err = tb.GetBRTillNotFound(buildRunObject.Name, time.Second*1, time.Second*15) Expect(apierrors.IsNotFound(err)).To(BeTrue()) @@ -430,13 +431,13 @@ var _ = Describe("Integration tests for retention limits and ttls of buildRuns t Expect(tb.CreateBR(buildRunObject)).To(BeNil()) br1, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br1.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br1.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) // Create second buildrun buildRunObject.Name = BUILDRUN + tb.Namespace + "-2" Expect(tb.CreateBR(buildRunObject)).To(BeNil()) br2, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br2.Status.GetCondition(v1alpha1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) + Expect(br2.Status.GetCondition(v1beta1.Succeeded).Status).To(Equal(corev1.ConditionFalse)) _, err = tb.GetBRTillNotFound(BUILDRUN+tb.Namespace+"-1", time.Second*1, time.Second*5) Expect(apierrors.IsNotFound(err)).To(BeTrue()) diff --git a/test/integration/buildruns_to_sa_test.go b/test/integration/buildruns_to_sa_test.go index 85e998bb03..4f3c1749b6 100644 --- a/test/integration/buildruns_to_sa_test.go +++ b/test/integration/buildruns_to_sa_test.go @@ -14,16 +14,16 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/wait" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" + test "github.com/shipwright-io/build/test/v1beta1_samples" ) var _ = Describe("Integration tests BuildRuns and Service-accounts", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build - buildRunObject *v1alpha1.BuildRun + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build + buildRunObject *v1beta1.BuildRun buildSample []byte buildRunSample []byte ) @@ -82,7 +82,7 @@ var _ = Describe("Integration tests BuildRuns and Service-accounts", func() { return false } - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Output.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithAnnotation(*buildObject.Spec.Output.PushSecret, buildObject.Namespace) Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) @@ -100,7 +100,7 @@ var _ = Describe("Integration tests BuildRuns and Service-accounts", func() { Expect(err).To(BeNil()) // Verify that the sa have our Build specified secret - Expect(contains(sa.Secrets, buildObject.Spec.Output.Credentials.Name)).To(BeTrue()) + Expect(contains(sa.Secrets, *buildObject.Spec.Output.PushSecret)).To(BeTrue()) _, err = tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) @@ -130,7 +130,7 @@ var _ = Describe("Integration tests BuildRuns and Service-accounts", func() { return false } - sampleSecret := tb.Catalog.SecretWithAnnotation(buildObject.Spec.Output.Credentials.Name, buildObject.Namespace) + sampleSecret := tb.Catalog.SecretWithAnnotation(*buildObject.Spec.Output.PushSecret, buildObject.Namespace) Expect(tb.CreateSecret(sampleSecret)).To(BeNil()) @@ -148,7 +148,7 @@ var _ = Describe("Integration tests BuildRuns and Service-accounts", func() { Expect(err).To(BeNil()) // Verify that the sa have our Build specified secret - Expect(contains(sa.Secrets, buildObject.Spec.Output.Credentials.Name)).To(BeTrue()) + Expect(contains(sa.Secrets, *buildObject.Spec.Output.PushSecret)).To(BeTrue()) // cancel the br err = wait.PollImmediate(1*time.Second, 4*time.Second, func() (done bool, err error) { @@ -158,7 +158,7 @@ var _ = Describe("Integration tests BuildRuns and Service-accounts", func() { return false, nil } - bro.Spec.State = v1alpha1.BuildRunRequestedStatePtr(v1alpha1.BuildRunStateCancel) + bro.Spec.State = v1beta1.BuildRunRequestedStatePtr(v1beta1.BuildRunStateCancel) err = tb.UpdateBR(bro) if err != nil { GinkgoT().Logf("error on br update: %s\n", err.Error()) @@ -168,7 +168,7 @@ var _ = Describe("Integration tests BuildRuns and Service-accounts", func() { }) Expect(err).To(BeNil()) - expectedReason := v1alpha1.BuildRunStateCancel + expectedReason := v1beta1.BuildRunStateCancel actualReason, err := tb.GetBRTillDesiredReason(buildRunObject.Name, expectedReason) Expect(err).To(BeNil(), fmt.Sprintf("failed to get desired BuildRun reason; expected %s, got %s", expectedReason, actualReason)) @@ -246,7 +246,7 @@ var _ = Describe("Integration tests BuildRuns and Service-accounts", func() { br, _ := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - buildRunCondition := br.Status.GetCondition(v1alpha1.Succeeded) + buildRunCondition := br.Status.GetCondition(v1beta1.Succeeded) Expect(buildRunCondition).ToNot(BeNil()) Expect(buildRunCondition.Status).To(Equal(corev1.ConditionFalse)) diff --git a/test/integration/buildruns_to_taskruns_test.go b/test/integration/buildruns_to_taskruns_test.go index 8d75f6ec49..33362d15f8 100644 --- a/test/integration/buildruns_to_taskruns_test.go +++ b/test/integration/buildruns_to_taskruns_test.go @@ -14,9 +14,9 @@ import ( . "github.com/onsi/gomega" pipelineapi "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" "github.com/shipwright-io/build/pkg/reconciler/buildrun/resources" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + test "github.com/shipwright-io/build/test/v1beta1_samples" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -27,14 +27,14 @@ import ( var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build - buildRunObject *v1alpha1.BuildRun + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build + buildRunObject *v1beta1.BuildRun buildSample []byte buildRunSample []byte ) - var setupBuildAndBuildRun = func(buildDef []byte, buildRunDef []byte, strategy ...string) (watch.Interface, *v1alpha1.Build, *v1alpha1.BuildRun) { + var setupBuildAndBuildRun = func(buildDef []byte, buildRunDef []byte, strategy ...string) (watch.Interface, *v1beta1.Build, *v1beta1.BuildRun) { var strategyName = STRATEGY + tb.Namespace if len(strategy) > 0 { @@ -42,7 +42,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { } timeout := int64(tb.TimeOut.Seconds()) - buildRunWatcher, err := tb.BuildClientSet.ShipwrightV1alpha1().BuildRuns(tb.Namespace).Watch(context.TODO(), metav1.ListOptions{TimeoutSeconds: &timeout}) + buildRunWatcher, err := tb.BuildClientSet.ShipwrightV1beta1().BuildRuns(tb.Namespace).Watch(context.TODO(), metav1.ListOptions{TimeoutSeconds: &timeout}) Expect(err).To(BeNil()) buildObject, err = tb.Catalog.LoadBuildWithNameAndStrategy(BUILD+tb.Namespace, strategyName, buildDef) @@ -117,14 +117,14 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { // use a fakeTime to simplify tests fakeTime := time.Date(1989, 05, 15, 00, 01, 01, 651387237, time.UTC) - var seq = []*v1alpha1.Condition{} + var seq = []*v1beta1.Condition{} for event := range buildRunWatcher.ResultChan() { if event.Type == watch.Error { GinkgoWriter.Write([]byte(fmt.Sprintf("Unexpected error event in watch: %v", event.Object))) continue } - condition := event.Object.(*v1alpha1.BuildRun).Status.GetCondition(v1alpha1.Succeeded) + condition := event.Object.(*v1beta1.BuildRun).Status.GetCondition(v1beta1.Succeeded) if condition != nil { condition.LastTransitionTime = metav1.Time{Time: fakeTime} seq = append(seq, condition) @@ -140,15 +140,15 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { Expect(len(seq) >= 2).To(Equal(true)) // ensure the conditions move eventually from unknown into running - Expect(seq).Should(ContainElement(&v1alpha1.Condition{ - Type: v1alpha1.Succeeded, + Expect(seq).Should(ContainElement(&v1beta1.Condition{ + Type: v1beta1.Succeeded, Status: corev1.ConditionUnknown, LastTransitionTime: metav1.Time{Time: fakeTime}, Reason: "Pending", Message: "Pending", })) - Expect(seq).Should(ContainElement(&v1alpha1.Condition{ - Type: v1alpha1.Succeeded, + Expect(seq).Should(ContainElement(&v1beta1.Condition{ + Type: v1beta1.Succeeded, Status: corev1.ConditionUnknown, LastTransitionTime: metav1.Time{Time: fakeTime}, Reason: "Running", @@ -164,7 +164,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { buildRun, err := tb.GetBRTillCompletion(buildRun.Name) Expect(err).ToNot(HaveOccurred()) - condition := buildRun.Status.GetCondition(v1alpha1.Succeeded) + condition := buildRun.Status.GetCondition(v1beta1.Succeeded) Expect(condition.Status).To(Equal(corev1.ConditionFalse)) Expect(condition.Reason).To(Equal("BuildRunTimeout")) Expect(condition.Message).To(Equal(fmt.Sprintf("BuildRun %s failed to finish within %v", buildRun.Name, build.Spec.Timeout.Duration))) @@ -184,7 +184,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { Expect(buildRun.Status.FailureDetails.Location.Pod).To(Equal(taskRun.Status.PodName)) Expect(buildRun.Status.FailureDetails.Location.Container).To(Equal("step-step-build-and-push")) - condition := buildRun.Status.GetCondition(v1alpha1.Succeeded) + condition := buildRun.Status.GetCondition(v1beta1.Succeeded) Expect(condition.Status).To(Equal(corev1.ConditionFalse)) Expect(condition.Reason).To(Equal("Failed")) Expect(condition.Message).To(ContainSubstring("buildrun step %s failed in pod %s", "step-step-build-and-push", taskRun.Status.PodName)) @@ -200,7 +200,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { buildRun, err := tb.GetBRTillCompletion(buildRun.Name) Expect(err).ToNot(HaveOccurred()) - condition := buildRun.Status.GetCondition(v1alpha1.Succeeded) + condition := buildRun.Status.GetCondition(v1beta1.Succeeded) Expect(condition.Status).To(Equal(corev1.ConditionTrue)) Expect(condition.Reason).To(Equal("Succeeded")) Expect(condition.Message).To(ContainSubstring("All Steps have completed executing")) @@ -297,7 +297,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { b, err := tb.GetBuildTillRegistration(buildObject.Name, corev1.ConditionFalse) Expect(err).To(BeNil()) Expect(*b.Status.Registered).To(Equal(corev1.ConditionFalse)) - Expect(*b.Status.Reason).To(Equal(v1alpha1.RemoteRepositoryUnreachable)) + Expect(*b.Status.Reason).To(Equal(v1beta1.RemoteRepositoryUnreachable)) Expect(*b.Status.Message).To(ContainSubstring("no such host")) _, err = tb.GetBRTillCompletion(buildRunObject.Name) @@ -351,7 +351,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { Context("when a standalone buildrun is created and the buildrun is cancelled", func() { var standAloneBuildRunSample []byte - var standaloneBuildRunObject *v1alpha1.BuildRun + var standaloneBuildRunObject *v1beta1.BuildRun BeforeEach(func() { standAloneBuildRunSample = []byte(test.MinimalOneOffBuildRun) @@ -369,9 +369,9 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { _, err = tb.GetTaskRunFromBuildRun(br.Name) Expect(err).ToNot(HaveOccurred()) - br.Spec.State = v1alpha1.BuildRunRequestedStatePtr(v1alpha1.BuildRunStateCancel) - data := []byte(fmt.Sprintf(`{"spec":{"state": "%s"}}`, v1alpha1.BuildRunStateCancel)) - br, err = tb.BuildClientSet.ShipwrightV1alpha1(). + br.Spec.State = v1beta1.BuildRunRequestedStatePtr(v1beta1.BuildRunStateCancel) + data := []byte(fmt.Sprintf(`{"spec":{"state": "%s"}}`, v1beta1.BuildRunStateCancel)) + br, err = tb.BuildClientSet.ShipwrightV1beta1(). BuildRuns(tb.Namespace). Patch(tb.Context, br.Name, types.MergePatchType, data, metav1.PatchOptions{}) Expect(err).ToNot(HaveOccurred()) @@ -379,9 +379,9 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { actualReason, err := tb.GetTRTillDesiredReason(br.Name, "TaskRunCancelled") Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to get desired reason; expected %s, got %s", "TaskRunCancelled", actualReason)) - actualReason, err = tb.GetBRTillDesiredReason(br.Name, v1alpha1.BuildRunStateCancel) - Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to get desired BuildRun reason; expected %s, got %s", v1alpha1.BuildRunStateCancel, actualReason)) - Expect(actualReason).To(Equal(v1alpha1.BuildRunStateCancel)) + actualReason, err = tb.GetBRTillDesiredReason(br.Name, v1beta1.BuildRunStateCancel) + Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to get desired BuildRun reason; expected %s, got %s", v1beta1.BuildRunStateCancel, actualReason)) + Expect(actualReason).To(Equal(v1beta1.BuildRunStateCancel)) }) }) @@ -408,7 +408,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { return false, nil } - bro.Spec.State = v1alpha1.BuildRunRequestedStatePtr(v1alpha1.BuildRunStateCancel) + bro.Spec.State = v1beta1.BuildRunRequestedStatePtr(v1beta1.BuildRunStateCancel) err = tb.UpdateBR(bro) if err != nil { GinkgoT().Logf("error on br update: %s\n", err.Error()) @@ -422,7 +422,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { actualReason, err := tb.GetTRTillDesiredReason(buildRunObject.Name, expectedReason) Expect(err).To(BeNil(), fmt.Sprintf("failed to get desired TaskRun reason; expected %s, got %s", expectedReason, actualReason)) - expectedReason = v1alpha1.BuildRunStateCancel + expectedReason = v1beta1.BuildRunStateCancel actualReason, err = tb.GetBRTillDesiredReason(buildRunObject.Name, expectedReason) Expect(err).To(BeNil(), fmt.Sprintf("failed to get desired BuildRun reason; expected %s, got %s", expectedReason, actualReason)) }) @@ -509,7 +509,7 @@ var _ = Describe("Integration tests BuildRuns and TaskRuns", func() { br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - condition := br.Status.GetCondition(v1alpha1.Succeeded) + condition := br.Status.GetCondition(v1beta1.Succeeded) Expect(condition.Status).To(Equal(corev1.ConditionFalse)) Expect(condition.Reason).To(Equal(resources.BuildRunNameInvalid)) Expect(condition.Message).To(Equal("must be no more than 63 characters")) diff --git a/test/integration/buildstrategy_to_taskruns_test.go b/test/integration/buildstrategy_to_taskruns_test.go index adc6064812..aefffa02b0 100644 --- a/test/integration/buildstrategy_to_taskruns_test.go +++ b/test/integration/buildstrategy_to_taskruns_test.go @@ -10,18 +10,18 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" - utils "github.com/shipwright-io/build/test/utils/v1alpha1" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" + utils "github.com/shipwright-io/build/test/utils/v1beta1" + test "github.com/shipwright-io/build/test/v1beta1_samples" pipelineapi "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" corev1 "k8s.io/api/core/v1" ) var _ = Describe("Integration tests BuildStrategies and TaskRuns", func() { var ( - bsObject *v1alpha1.BuildStrategy - buildObject *v1alpha1.Build - buildRunObject *v1alpha1.BuildRun + bsObject *v1beta1.BuildStrategy + buildObject *v1beta1.Build + buildRunObject *v1beta1.BuildRun secret *corev1.Secret configMap *corev1.ConfigMap buildSample []byte @@ -144,7 +144,7 @@ var _ = Describe("Integration tests BuildStrategies and TaskRuns", func() { } } - var constructBuildObjectAndWait = func(b *v1alpha1.Build) { + var constructBuildObjectAndWait = func(b *v1beta1.Build) { // Create the Build object in-cluster Expect(tb.CreateBuild(b)).To(BeNil()) @@ -153,7 +153,7 @@ var _ = Describe("Integration tests BuildStrategies and TaskRuns", func() { Expect(err).To(BeNil()) } - var constructBuildRunObjectAndWait = func(br *v1alpha1.BuildRun) { + var constructBuildRunObjectAndWait = func(br *v1beta1.BuildRun) { // Create the BuildRun object in-cluster Expect(tb.CreateBR(br)).To(BeNil()) @@ -309,9 +309,9 @@ var _ = Describe("Integration tests BuildStrategies and TaskRuns", func() { br, err := tb.GetBRTillCompletion(buildRunObjectWithReservedParams.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).GetReason()).To(Equal("RestrictedParametersInUse")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).GetMessage()).To(HavePrefix("The following parameters are restricted and cannot be set")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).GetMessage()).To(ContainSubstring("shp-sleep-time")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).GetReason()).To(Equal("RestrictedParametersInUse")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).GetMessage()).To(HavePrefix("The following parameters are restricted and cannot be set")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).GetMessage()).To(ContainSubstring("shp-sleep-time")) }) It("add params from buildRun if they are not defined in the Build", func() { @@ -356,7 +356,7 @@ var _ = Describe("Integration tests BuildStrategies and TaskRuns", func() { buildObject, err = tb.GetBuildTillValidation(buildObject.Name) Expect(err).To(BeNil()) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.RestrictedParametersInUse)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.RestrictedParametersInUse)) Expect(*buildObject.Status.Message).To(HavePrefix("The following parameters are restricted and cannot be set:")) Expect(*buildObject.Status.Message).To(ContainSubstring("shp-something")) }) @@ -377,7 +377,7 @@ var _ = Describe("Integration tests BuildStrategies and TaskRuns", func() { buildObject, err = tb.GetBuildTillValidation(buildObject.Name) Expect(err).To(BeNil()) - Expect(*buildObject.Status.Reason).To(Equal(v1alpha1.UndefinedParameter)) + Expect(*buildObject.Status.Reason).To(Equal(v1beta1.UndefinedParameter)) Expect(*buildObject.Status.Message).To(Equal("The following parameters are not defined in the build strategy: sleep-not")) }) @@ -483,9 +483,9 @@ var _ = Describe("Integration tests BuildStrategies and TaskRuns", func() { br, err := tb.GetBRTillCompletion(buildRunObject.Name) Expect(err).To(BeNil()) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).GetReason()).To(Equal("MissingParameterValues")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).GetMessage()).To(HavePrefix("The following parameters are required but no value has been provided:")) - Expect(br.Status.GetCondition(v1alpha1.Succeeded).GetMessage()).To(ContainSubstring("sleep-time")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).GetReason()).To(Equal("MissingParameterValues")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).GetMessage()).To(HavePrefix("The following parameters are required but no value has been provided:")) + Expect(br.Status.GetCondition(v1beta1.Succeeded).GetMessage()).To(ContainSubstring("sleep-time")) }) Context("when a taskrun fails with an error result", func() { @@ -601,9 +601,7 @@ var _ = Describe("Integration tests BuildStrategies and TaskRuns", func() { }) It("creates a TaskRun with Shipwright managed push", func() { - buildObject.Spec.Output.Credentials = &corev1.LocalObjectReference{ - Name: secret.Name, - } + buildObject.Spec.Output.PushSecret = &secret.Name Expect(tb.CreateBuild(buildObject)).ToNot(HaveOccurred()) buildObject, err = tb.GetBuildTillValidation(buildObject.Name) diff --git a/test/integration/clusterbuildstrategy_to_taskruns_test.go b/test/integration/clusterbuildstrategy_to_taskruns_test.go index 1fce846285..ca0793257a 100644 --- a/test/integration/clusterbuildstrategy_to_taskruns_test.go +++ b/test/integration/clusterbuildstrategy_to_taskruns_test.go @@ -8,15 +8,15 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/shipwright-io/build/pkg/apis/build/v1alpha1" - test "github.com/shipwright-io/build/test/v1alpha1_samples" + "github.com/shipwright-io/build/pkg/apis/build/v1beta1" + test "github.com/shipwright-io/build/test/v1beta1_samples" ) var _ = Describe("Integration tests ClusterBuildStrategies and TaskRuns", func() { var ( - cbsObject *v1alpha1.ClusterBuildStrategy - buildObject *v1alpha1.Build - buildRunObject *v1alpha1.BuildRun + cbsObject *v1beta1.ClusterBuildStrategy + buildObject *v1beta1.Build + buildRunObject *v1beta1.BuildRun buildSample []byte buildRunSample []byte ) diff --git a/test/integration/integration_suite_test.go b/test/integration/integration_suite_test.go index 75ae2bc70f..916fde550b 100644 --- a/test/integration/integration_suite_test.go +++ b/test/integration/integration_suite_test.go @@ -12,8 +12,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - // utils "github.com/shipwright-io/build/test/utils" - utils "github.com/shipwright-io/build/test/utils/v1alpha1" + utils "github.com/shipwright-io/build/test/utils/v1beta1" ) const ( diff --git a/test/v1beta1_samples/buildstrategy_samples.go b/test/v1beta1_samples/buildstrategy_samples.go index c74eb85ac5..d1fba62987 100644 --- a/test/v1beta1_samples/buildstrategy_samples.go +++ b/test/v1beta1_samples/buildstrategy_samples.go @@ -27,7 +27,7 @@ spec: args: - bud - --tag=$(params.shp-output-image) - - --file=$(build.dockerfile) + - --file=$(params.dockerfile) - $(params.shp-source-context) resources: limits: @@ -59,6 +59,11 @@ spec: volumeMounts: - name: buildah-images mountPath: /var/lib/containers/storage + parameters: + - name: dockerfile + description: The path to the Dockerfile to be used for building the image. + type: string + default: "Dockerfile" ` // MinimalBuildahBuildStrategyWithEnvs defines a @@ -153,7 +158,7 @@ spec: - --tls-verify=false - --layers - -f - - $(build.dockerfile) + - $(params.dockerfile) - -t - $(params.shp-output-image) - $(params.shp-source-context) @@ -167,6 +172,11 @@ spec: volumeMounts: - name: varlibcontainers mountPath: /var/lib/containers + parameters: + - name: dockerfile + description: The path to the Dockerfile to be used for building the image. + type: string + default: "Dockerfile" ` // BuildpacksBuildStrategySingleStep defines a @@ -183,7 +193,7 @@ spec: emptyDir: {} steps: - name: build - image: "$(build.builder.image)" + image: "$(params.builder-image)" workingDir: $(params.shp-source-root) command: - /cnb/lifecycle/builder @@ -205,6 +215,14 @@ spec: volumeMounts: - name: varlibcontainers mountPath: /var/lib/containers + parameters: + - name: dockerfile + description: The path to the Dockerfile to be used for building the image. + type: string + default: "Dockerfile" + - name: builder-image + description: The builder image. + type: string ` // BuildStrategyWithParameters is a strategy that uses a diff --git a/test/v1beta1_samples/catalog.go b/test/v1beta1_samples/catalog.go index 7834b10a43..62b4994801 100644 --- a/test/v1beta1_samples/catalog.go +++ b/test/v1beta1_samples/catalog.go @@ -252,8 +252,8 @@ func (c *Catalog) FakeClusterBuildStrategyNotFound(name string) error { // StubFunc is used to simulate the status of the Build // after a .Status().Update() call in the controller. This // receives a parameter to return an specific status state -func (c *Catalog) StubFunc(status corev1.ConditionStatus, reason build.BuildReason, message string) func(context context.Context, object client.Object, _ ...client.UpdateOption) error { - return func(context context.Context, object client.Object, _ ...client.UpdateOption) error { +func (c *Catalog) StubFunc(status corev1.ConditionStatus, reason build.BuildReason, message string) func(context context.Context, object client.Object, _ ...client.SubResourceUpdateOption) error { + return func(context context.Context, object client.Object, _ ...client.SubResourceUpdateOption) error { switch object := object.(type) { case *build.Build: Expect(*object.Status.Registered).To(Equal(status)) @@ -334,8 +334,8 @@ func (c *Catalog) StubBuildAndTaskRun( } // StubBuildStatusReason asserts Status fields on a Build resource -func (c *Catalog) StubBuildStatusReason(reason build.BuildReason, message string) func(context context.Context, object client.Object, _ ...client.UpdateOption) error { - return func(context context.Context, object client.Object, _ ...client.UpdateOption) error { +func (c *Catalog) StubBuildStatusReason(reason build.BuildReason, message string) func(context context.Context, object client.Object, _ ...client.SubResourceUpdateOption) error { + return func(context context.Context, object client.Object, _ ...client.SubResourceUpdateOption) error { switch object := object.(type) { case *build.Build: if object.Status.Message != nil && *object.Status.Message != "" { @@ -350,8 +350,8 @@ func (c *Catalog) StubBuildStatusReason(reason build.BuildReason, message string } // StubBuildRunStatus asserts Status fields on a BuildRun resource -func (c *Catalog) StubBuildRunStatus(reason string, name *string, condition build.Condition, status corev1.ConditionStatus, buildSpec build.BuildSpec, tolerateEmptyStatus bool) func(context context.Context, object client.Object, _ ...client.UpdateOption) error { - return func(context context.Context, object client.Object, _ ...client.UpdateOption) error { +func (c *Catalog) StubBuildRunStatus(reason string, name *string, condition build.Condition, status corev1.ConditionStatus, buildSpec build.BuildSpec, tolerateEmptyStatus bool) func(context context.Context, object client.Object, _ ...client.SubResourceUpdateOption) error { + return func(context context.Context, object client.Object, _ ...client.SubResourceUpdateOption) error { switch object := object.(type) { case *build.BuildRun: if !tolerateEmptyStatus { diff --git a/test/v1beta1_samples/clusterbuildstrategy_samples.go b/test/v1beta1_samples/clusterbuildstrategy_samples.go index 2e30046e92..4ba67066c3 100644 --- a/test/v1beta1_samples/clusterbuildstrategy_samples.go +++ b/test/v1beta1_samples/clusterbuildstrategy_samples.go @@ -17,7 +17,7 @@ spec: - name: buildah-images volumeSource: emptyDir: {} - buildSteps: + steps: - name: buildah-bud image: quay.io/containers/buildah:v1.33.2 workingDir: $(params.shp-source-root) @@ -75,7 +75,7 @@ spec: - name: buildah-images volumeSource: emptyDir: {} - buildSteps: + steps: - name: buildah-bud image: quay.io/containers/buildah:v1.33.2 workingDir: $(params.shp-source-root) @@ -129,7 +129,7 @@ kind: ClusterBuildStrategy metadata: name: kaniko spec: - buildSteps: + steps: - name: step-build-and-push image: gcr.io/kaniko-project/executor:v1.19.2 workingDir: $(params.shp-source-root) @@ -178,7 +178,7 @@ kind: ClusterBuildStrategy metadata: name: kaniko spec: - buildSteps: + steps: - name: step-build-and-push image: gcr.io/kaniko-project/executor:v1.19.2 workingDir: $(params.shp-source-root) @@ -229,7 +229,7 @@ spec: - name: exit-command description: "Exit command for the pod" default: "true" - buildSteps: + steps: - name: step-no-and-op image: alpine:latest workingDir: $(params.shp-source-root) @@ -269,7 +269,7 @@ kind: ClusterBuildStrategy metadata: name: noop spec: - buildSteps: + steps: - name: sleep30 image: alpine:latest command: @@ -296,7 +296,7 @@ metadata: kubectl.kubernetes.io/last-applied-configuration: anotherValue name: kaniko spec: - buildSteps: + steps: - name: step-build-and-push image: gcr.io/kaniko-project/executor:v1.19.2 workingDir: $(params.shp-source-root) @@ -348,7 +348,7 @@ spec: - name: sleep-time description: "time in seconds for sleeping" default: "1" - buildSteps: + steps: - name: sleep30 image: alpine:latest command: