Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

enable ability to index new chart data for the same chart version #556

Merged
merged 3 commits into from
Nov 2, 2018

Conversation

prydonius
Copy link
Member

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

Adnan Abdulhussein added 2 commits November 1, 2018 15:07
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>
@helm-bot helm-bot added the size/S label Nov 1, 2018
Copy link
Contributor

@migmartri migmartri left a 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 {
Copy link
Contributor

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)
Copy link
Contributor

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.

Copy link
Member Author

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>
@helm-bot helm-bot added size/S and removed size/S labels Nov 1, 2018
@prydonius prydonius merged commit 57349ff into helm:master Nov 2, 2018
@prydonius prydonius deleted the 555-chart-repo-digest branch November 2, 2018 20:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chart file metadata doesn't change for same version numbers
3 participants