diff --git a/gitops/snapshot.go b/gitops/snapshot.go index f7e97ca54..952e6c6bb 100644 --- a/gitops/snapshot.go +++ b/gitops/snapshot.go @@ -678,7 +678,7 @@ func IsSnapshotCreatedByPACPushEvent(snapshot *applicationapiv1alpha1.Snapshot) return metadata.HasLabelWithValue(snapshot, PipelineAsCodeEventTypeLabel, PipelineAsCodePushType) || metadata.HasLabelWithValue(snapshot, PipelineAsCodeEventTypeLabel, PipelineAsCodeGLPushType) || !metadata.HasLabel(snapshot, PipelineAsCodeEventTypeLabel) || - !metadata.HasLabel(snapshot, PipelineAsCodePullRequestAnnotation) + !metadata.HasLabel(snapshot, PipelineAsCodePullRequestAnnotation) && !IsGroupSnapshot(snapshot) } // IsSnapshotCreatedBySamePACEvent checks if the two snapshot are created by the same PAC event diff --git a/gitops/snapshot_test.go b/gitops/snapshot_test.go index 7f0b95dca..5fa8777e0 100644 --- a/gitops/snapshot_test.go +++ b/gitops/snapshot_test.go @@ -844,6 +844,7 @@ var _ = Describe("Gitops functions for managing Snapshots", Ordered, func() { }) It("Testing annotating snapshot", func() { + hasSnapshot.Labels[gitops.PipelineAsCodeEventTypeLabel] = gitops.PipelineAsCodePullRequestType componentSnapshotInfos := []gitops.ComponentSnapshotInfo{ { Component: "com1", @@ -862,6 +863,8 @@ var _ = Describe("Gitops functions for managing Snapshots", Ordered, func() { Expect(err).ToNot(HaveOccurred()) Expect(componentSnapshotInfos).To(HaveLen(2)) Expect(snapshot.Labels[gitops.SnapshotTypeLabel]).To(Equal("group")) + Expect(gitops.IsSnapshotCreatedByPACPushEvent(snapshot)).To(BeFalse()) + }) It("Testing UnmarshalJSON", func() {