diff --git a/make/deploy.mk b/make/deploy.mk index c7697ff89..08b732728 100644 --- a/make/deploy.mk +++ b/make/deploy.mk @@ -29,6 +29,9 @@ export FN_RUNNER_WARM_UP_POD_CACHE ?= true # Enable v1alpha2 PackageRevision support (CRD install + controller flag + reconciler) export CREATE_V1ALPHA2_RPKG ?= false +# Push draft & proposed PR's to git rather than DB only +export DB_PUSH_DRAFTS_TO_GIT ?= false + # Reconciler configuration ALL_RECONCILERS=packagevariants,packagevariantsets,repositories ifndef RECONCILERS @@ -52,6 +55,7 @@ run-in-kind: load-images-to-kind deployment-config deploy-current-config run-in-kind-v1alpha2: IMAGE_REPO=porch-kind## Build and deploy porch into a kind cluster with DB cache and v1alpha2 PackageRevision CRD creation run-in-kind-v1alpha2: PORCH_CACHE_TYPE=DB run-in-kind-v1alpha2: CREATE_V1ALPHA2_RPKG=true +run-in-kind-v1alpha2: DB_PUSH_DRAFTS_TO_GIT=true run-in-kind-v1alpha2: load-images-to-kind deployment-config deploy-current-config .PHONY: run-in-kind-v1alpha2-no-controller diff --git a/scripts/create-deployment-blueprint.sh b/scripts/create-deployment-blueprint.sh index 028267b4b..86c4364b8 100755 --- a/scripts/create-deployment-blueprint.sh +++ b/scripts/create-deployment-blueprint.sh @@ -217,6 +217,15 @@ function enable_db_push_drafts_to_git() { --match-name porch-server \ --match-namespace porch-system \ -- by-value="--db-push-drafts-to-git=false" put-value="--db-push-drafts-to-git=true" + + # The repository controller builds its own DB cache, which is the one used by the + # v1alpha2 PackageRevision path, so it needs the flag flipped separately. + kpt fn eval ${DESTINATION} \ + --image ${SEARCH_REPLACE_IMG} \ + --match-kind Deployment \ + --match-name porch-controllers \ + --match-namespace porch-system \ + -- by-value="--repositories.push-drafts-to-git=false" put-value="--repositories.push-drafts-to-git=true" } function enable_v1alpha2_packagerevisions() { diff --git a/test/e2e/crd/lifecycle_test.go b/test/e2e/crd/lifecycle_test.go index 20a4a0e2e..4fc3a53ff 100644 --- a/test/e2e/crd/lifecycle_test.go +++ b/test/e2e/crd/lifecycle_test.go @@ -198,10 +198,8 @@ var _ = Describe("Lifecycle", Ordered, Label("lifecycle"), func() { // --- Git branch cleanup tests (require push-drafts-to-git=true) --- // These tests auto-skip when push-drafts-to-git is not enabled. - // Known gap: dbPackageRevision.Delete only calls git delete for Published - // packages. Draft/proposed branches are not cleaned up. Tracked as Issue 36. - PIt("should clean up draft git branch when a Draft package is deleted", func() { + It("should clean up draft git branch when a Draft package is deleted", func() { By("creating a draft package") pr := newPackageRevision(env.Namespace, env.RepoName, "del-draft-br", "v1", withInit("draft branch cleanup")) Expect(k8sClient.Create(env.Ctx, pr)).To(Succeed()) @@ -225,7 +223,7 @@ var _ = Describe("Lifecycle", Ordered, Label("lifecycle"), func() { }).WithTimeout(defaultTimeout).Should(Not(ContainElement(ContainSubstring("del-draft-br")))) }) - PIt("should clean up proposed git branch when a Proposed package is deleted", func() { + It("should clean up proposed git branch when a Proposed package is deleted", func() { By("creating and proposing a package") pr := newPackageRevision(env.Namespace, env.RepoName, "del-prop-br", "v1", withInit("proposed branch cleanup")) Expect(k8sClient.Create(env.Ctx, pr)).To(Succeed())