Check create when fire the artifact event (#20832)

fixes #20828

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
Co-authored-by: Shengwen YU <yshengwen@vmware.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2024-08-12 11:16:21 +08:00 committed by GitHub
parent 79886dfcce
commit 4ad86b300a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,16 +173,18 @@ func (c *controller) Ensure(ctx context.Context, repository, digest string, opti
} }
} }
} }
// fire event if created {
e := &metadata.PushArtifactEventMetadata{ // fire event for create
Ctx: ctx, e := &metadata.PushArtifactEventMetadata{
Artifact: artifact, Ctx: ctx,
} Artifact: artifact,
}
if option != nil && len(option.Tags) > 0 { if option != nil && len(option.Tags) > 0 {
e.Tag = option.Tags[0] e.Tag = option.Tags[0]
}
notification.AddEvent(ctx, e)
} }
notification.AddEvent(ctx, e)
return created, artifact.ID, nil return created, artifact.ID, nil
} }