Skip to content

Commit

Permalink
Check create when fire the artifact event (goharbor#20832)
Browse files Browse the repository at this point in the history
fixes goharbor#20828

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Co-authored-by: Shengwen YU <yshengwen@vmware.com>
Signed-off-by: kunal-511 <yoyokvunal@gmail.com>
  • Loading branch information
2 people authored and kunal-511 committed Aug 22, 2024
1 parent ac036dc commit 3a1e897
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/controller/artifact/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,18 @@ func (c *controller) Ensure(ctx context.Context, repository, digest string, opti
}
}
}
// fire event
e := &metadata.PushArtifactEventMetadata{
Ctx: ctx,
Artifact: artifact,
}
if created {
// fire event for create
e := &metadata.PushArtifactEventMetadata{
Ctx: ctx,
Artifact: artifact,
}

if option != nil && len(option.Tags) > 0 {
e.Tag = option.Tags[0]
if option != nil && len(option.Tags) > 0 {
e.Tag = option.Tags[0]
}
notification.AddEvent(ctx, e)
}
notification.AddEvent(ctx, e)
return created, artifact.ID, nil
}

Expand Down

0 comments on commit 3a1e897

Please sign in to comment.