Skip to content

Commit

Permalink
Merge pull request #975 from hongweiliu17/STONEINTG-1110
Browse files Browse the repository at this point in the history
fix(STONEINTG-1110): fix for IsSnapshotCreatedByPACPushEvent
  • Loading branch information
hongweiliu17 authored Jan 8, 2025
2 parents 5c3f925 + 76bbd60 commit 7744cfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gitops/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions gitops/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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() {
Expand Down

0 comments on commit 7744cfb

Please sign in to comment.