Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions make/deploy.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions scripts/create-deployment-blueprint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/crd/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down
Loading