Skip to content

Commit 62521c9

Browse files
author
Morven Cao
authored
fix work generation from received cloudevents. (#175)
Signed-off-by: Morven Cao <lcao@redhat.com>
1 parent c3b3f06 commit 62521c9

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

pkg/cloudevents/clients/work/agent/codec/manifestbundle.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package codec
33
import (
44
"encoding/json"
55
"fmt"
6+
67
"github.com/bwmarrin/snowflake"
78
cloudevents "github.com/cloudevents/sdk-go/v2"
89
cloudeventstypes "github.com/cloudevents/sdk-go/v2/types"
@@ -142,9 +143,7 @@ func (c *ManifestBundleCodec) Decode(evt *cloudevents.Event) (*workv1.ManifestWo
142143
metaObj.ResourceVersion = ""
143144
// The resourceVersion in cloudevent actually sematically equals to generation, since it increments when
144145
// spec changes
145-
if metaObj.Generation == 0 {
146-
metaObj.Generation = int64(resourceVersion)
147-
}
146+
metaObj.Generation = int64(resourceVersion)
148147
if metaObj.Annotations == nil {
149148
metaObj.Annotations = map[string]string{}
150149
}

0 commit comments

Comments
 (0)