mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 18:55:18 +01:00
Fix bug for replicating chart triggered by event (#11578)
Use the new event model to fix bug for replicating chart triggered by event Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
790064df2e
commit
e3cbfac0cc
@ -99,7 +99,11 @@ func (c *Controller) DeleteChartVersion(namespace, chartName, version string) er
|
||||
Repository: &model.Repository{
|
||||
Name: fmt.Sprintf("%s/%s", namespace, chartName),
|
||||
},
|
||||
Vtags: []string{version},
|
||||
Artifacts: []*model.Artifact{
|
||||
{
|
||||
Tags: []string{version},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -118,14 +118,14 @@ func modifyResponse(res *http.Response) error {
|
||||
}()
|
||||
|
||||
// Trigger harbor webhook
|
||||
if e != nil && e.Resource != nil && e.Resource.Metadata != nil && len(e.Resource.Metadata.Vtags) > 0 &&
|
||||
if e != nil && e.Resource != nil && e.Resource.Metadata != nil && len(e.Resource.Metadata.Artifacts) > 0 &&
|
||||
len(e.Resource.ExtendedInfo) > 0 {
|
||||
event := &n_event.Event{}
|
||||
metaData := &metadata.ChartUploadMetaData{
|
||||
ChartMetaData: metadata.ChartMetaData{
|
||||
ProjectName: e.Resource.ExtendedInfo["projectName"].(string),
|
||||
ChartName: e.Resource.ExtendedInfo["chartName"].(string),
|
||||
Versions: e.Resource.Metadata.Vtags,
|
||||
Versions: e.Resource.Metadata.Artifacts[0].Tags,
|
||||
OccurAt: time.Now(),
|
||||
Operator: e.Resource.ExtendedInfo["operator"].(string),
|
||||
},
|
||||
|
@ -507,7 +507,11 @@ func (cra *ChartRepositoryAPI) addEventContext(files []formFile, request *http.R
|
||||
"public": strconv.FormatBool(public),
|
||||
},
|
||||
},
|
||||
Vtags: []string{chartDetails.Metadata.Version},
|
||||
Artifacts: []*model.Artifact{
|
||||
{
|
||||
Tags: []string{chartDetails.Metadata.Version},
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtendedInfo: extInfo,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user