diff --git a/pkg/validate/sourceurl.go b/pkg/validate/sourceurl.go index c85e81aaa7..570defef69 100644 --- a/pkg/validate/sourceurl.go +++ b/pkg/validate/sourceurl.go @@ -31,7 +31,6 @@ func NewSourceURL(client client.Client, build *build.Build) *SourceURLRef { // that the spec.source.url exists. This validation only applies // to endpoints that do not require authentication. func (s SourceURLRef) ValidatePath(ctx context.Context) error { - // TODO: double check this new code if s.Build.Spec.Source.Type == build.GitType { gitSource := s.Build.Spec.Source.GitSource if gitSource.CloneSecret == nil && gitSource.URL != "" { diff --git a/test/e2e/v1beta1/common_test.go b/test/e2e/v1beta1/common_test.go index 1ab129c4ef..bfa39c97a5 100644 --- a/test/e2e/v1beta1/common_test.go +++ b/test/e2e/v1beta1/common_test.go @@ -137,6 +137,7 @@ func amendBuild(identifier string, b *buildv1beta1.Build) { // retrieveBuildAndBuildRun will retrieve the build and buildRun func retrieveBuildAndBuildRun(testBuild *utils.TestBuild, namespace string, buildRunName string) (*buildv1beta1.Build, *buildv1beta1.BuildRun, error) { + // TODO: double check the following function content. buildRun, err := testBuild.LookupBuildRun(types.NamespacedName{Name: buildRunName, Namespace: namespace}) if err != nil { Logf("Failed to get BuildRun %q: %s", buildRunName, err) diff --git a/test/integration/build_to_secrets_test.go b/test/integration/build_to_secrets_test.go index c62d235a0a..4cb0efb714 100644 --- a/test/integration/build_to_secrets_test.go +++ b/test/integration/build_to_secrets_test.go @@ -278,147 +278,6 @@ var _ = Describe("Integration tests Build and referenced Secrets", func() { }) }) - // 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(v1beta1.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(v1beta1.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(v1beta1.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(v1beta1.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.GitSource.CloneSecret, 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(v1beta1.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(v1beta1.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(v1beta1.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(v1beta1.SucceedStatus)) - // }) - // }) Context("when multiple builds reference a secret with annotations for the spec.source", func() { It("should validate the Builds after secret deletion", func() {