-
Notifications
You must be signed in to change notification settings - Fork 220
enable ability to index new chart data for the same chart version #556
Conversation
Previously, chart-repo skipped indexing any chart versions previous indexed based on the repo, name and version. However, if a user modifies a chart version without bumping a new version, the changes are not taken into account. This changes chart-repo to skip based on the above AND the digest of the chart package so that packages with a new digest are correctly updated. See also vmware-tanzu/kubeapps#659 fixes helm#555 Signed-off-by: Adnan Abdulhussein <adnan@bitnami.com>
Signed-off-by: Adnan Abdulhussein <adnan@bitnami.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
@@ -315,7 +315,7 @@ func fetchAndImportFiles(dbSession datastore.Session, name string, r repo, cv ch | |||
chartFilesID := fmt.Sprintf("%s/%s-%s", r.Name, name, cv.Version) | |||
db, closer := dbSession.DB() | |||
defer closer() | |||
if err := db.C(chartFilesCollection).FindId(chartFilesID).One(&chartFiles{}); err == nil { | |||
if err := db.C(chartFilesCollection).Find(bson.M{"_id": chartFilesID, "digest": cv.Digest}).One(&chartFiles{}); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding a comment explaining the logic behind this query?
@@ -369,7 +369,7 @@ func fetchAndImportFiles(dbSession datastore.Session, name string, r repo, cv ch | |||
log.WithFields(log.Fields{"name": name, "version": cv.Version}).Info("values.yaml not found") | |||
} | |||
|
|||
db.C(chartFilesCollection).Insert(chartFiles) | |||
db.C(chartFilesCollection).UpsertId(chartFilesID, chartFiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, explaining that if we get to this point is because we either don't have a chart for that version, or we do have it but with different digest.
I personally don't like upserts much in general because its context sometimes can be difficult to understand, also, in some cases it could cause side effects. In any case, a comment like my suggestion above might be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in some cases it could cause side effects
I agree in some cases, but I think in this case it should be fine since we are updating the entry with a full struct, and not doing a partial update.
Signed-off-by: Adnan Abdulhussein <adnan@bitnami.com>
Previously, chart-repo skipped indexing any chart versions previous indexed
based on the repo, name and version. However, if a user modifies a chart
version without bumping a new version, the changes are not taken into
account. This changes chart-repo to skip based on the above AND the digest
of the chart package so that packages with a new digest are correctly
updated.
See also vmware-tanzu/kubeapps#659
fixes #555