Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/repo: inject chart metadata(name/version) into storage object #362

Merged
merged 3 commits into from
Nov 12, 2020

Conversation

scbizu
Copy link
Contributor

@scbizu scbizu commented Aug 9, 2020

e.g.: 0.0.1-SNAPSHOT-1 , it is a valid semver format but cannot be parsed properly (returns chart version 1 rather than 0.0.1-SNAPSHOT-1 )

Fix #220

Remark

I think I should add some more annotations here:

Since deleting chart from index file should always delete the cache by chartname and chartversion , but the non-semver(or the chart not follow our parsing rules exactly) chart will be badly parsed the version with a incorrect number (as I comment in #220 (comment)) . To resolve this issue , we should keep this chart version metadata within the all cache lifecycle , more closely , for the cached chart , we should add the metadata just after the cache inited (and store it in the storage.StorageObject.Metadata) , if so , the diff from cache and server storage will carry with the chart version , and then the server.regenerateRepositoryIndex will correctly regenerate the latest state of the server storage in cache.

@kobynet
Copy link

kobynet commented Sep 8, 2020

@scbizu This will fix the problem with strict semantic versioning deletion, but the bigger problem is why to allow a chart creation that cannot be deleted? just like 1.0-SNAPSHOT+PR-102

@scbizu
Copy link
Contributor Author

scbizu commented Sep 8, 2020

@scbizu This will fix the problem with strict semantic versioning deletion, but the bigger problem is why to allow a chart creation that cannot be deleted? just like 1.0-SNAPSHOT+PR-102

I think It's just a bug ? Or you ask why not use strict semantic versioning deletion before ? I don't know. Maybe chartmuseum itself allows the non-semantic charts ?

@kobynet
Copy link

kobynet commented Sep 8, 2020

@scbizu This will fix the problem with strict semantic versioning deletion, but the bigger problem is why to allow a chart creation that cannot be deleted? just like 1.0-SNAPSHOT+PR-102

I think It's just a bug ? Or you ask why not use strict semantic versioning deletion before ? I don't know. Maybe chartmuseum itself allows the non-semantic charts ?

In your code at https://github.com/helm/chartmuseum/pull/362/files#diff-e4a78696e7b46c8d2418e143d91eb293R119
You check for strict semantic versioning, but the bug still exists for versions which are not strict semver just like 1.0-SNAPSHOT+PR-102 , we are not able to delete such versions even after your fix.

@scbizu
Copy link
Contributor Author

scbizu commented Sep 8, 2020

@scbizu This will fix the problem with strict semantic versioning deletion, but the bigger problem is why to allow a chart creation that cannot be deleted? just like 1.0-SNAPSHOT+PR-102

I think It's just a bug ? Or you ask why not use strict semantic versioning deletion before ? I don't know. Maybe chartmuseum itself allows the non-semantic charts ?

In your code at https://github.com/helm/chartmuseum/pull/362/files#diff-e4a78696e7b46c8d2418e143d91eb293R119
You check for strict semantic versioning, but the bug still exists for versions which are not strict semver just like 1.0-SNAPSHOT+PR-102 , we are not able to delete such versions even after your fix.

XD sorry for my misunderstanding . I will take a look at this , maybe we can have a solution with this case , but I think it's better for you to use a valid strict version rather than the no strict one.

@kobynet
Copy link

kobynet commented Sep 8, 2020

@scbizu This will fix the problem with strict semantic versioning deletion, but the bigger problem is why to allow a chart creation that cannot be deleted? just like 1.0-SNAPSHOT+PR-102

I think It's just a bug ? Or you ask why not use strict semantic versioning deletion before ? I don't know. Maybe chartmuseum itself allows the non-semantic charts ?

In your code at https://github.com/helm/chartmuseum/pull/362/files#diff-e4a78696e7b46c8d2418e143d91eb293R119
You check for strict semantic versioning, but the bug still exists for versions which are not strict semver just like 1.0-SNAPSHOT+PR-102 , we are not able to delete such versions even after your fix.

XD sorry for my misunderstanding . I will take a look at this , maybe we can have a solution with this case , but I think it's better for you to use a valid strict version rather than the no strict one.

I totally agree regarding having strict semantic versioning, was just wondering why fixing just the deletion of valid semver 2.0 and not fixing the general deletion bug :)

@scbizu
Copy link
Contributor Author

scbizu commented Sep 8, 2020

The previous code here is to find the proper version to delete but has the bad version detection for some cases , so I replace this code with the semver version detection for better readability and understanding.

(But I totally forget the non-strict semantic version :-| )

Maybe I should switch to another workaround.

@jdolitsky
Copy link
Contributor

@scbizu - can we prefix this PR with "WIP"?

@scbizu scbizu changed the title pkg/repo: fix bad parsing when chartversion has a int after the dash [WIP] pkg/repo: fix bad parsing when chartversion has a int after the dash Sep 14, 2020
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch from 7201663 to e1af552 Compare September 19, 2020 11:19
@helm-bot helm-bot added size/L and removed size/M labels Sep 19, 2020
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch from e1af552 to 7da6dde Compare September 19, 2020 12:15
@kobynet
Copy link

kobynet commented Oct 1, 2020

@scbizu Any update on this issue?

@scbizu
Copy link
Contributor Author

scbizu commented Oct 2, 2020

@kobynet just finish my side after store the chart version into Object metadata, and the PR is pending for merging chartmuseum/storage#51

If you are in hurry with this fix , could you self run the my patch , and check if it is ok :

  • pull my chartmuseum/storage branch (feature/object-meta) first
  • pull my helm/chartmuseum branch (fix/chartversion-int-after-dash) , the go.mod replace require you put storage and chartmuseum in the same directory.
  • and then install the new museum with make build-mac (or build-linux or build windows)
  • run the museum with bin/darwin/amd64/chartmuseum --debug --port=8080 \ --storage="local" \ --storage-local-rootdir="./chartstorage" to check if the issue is fixed

If you need a test docker image please at me , I think I can provide one.

@jdolitsky
Copy link
Contributor

That storage pr is now closed if you want to test here @scbizu

@scbizu
Copy link
Contributor Author

scbizu commented Oct 15, 2020

OK, I see it. I will add some more tests for this PR , thank u .

@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch from 7da6dde to 7199326 Compare October 16, 2020 18:39
@scbizu scbizu changed the title [WIP] pkg/repo: fix bad parsing when chartversion has a int after the dash pkg/repo: fix bad parsing when chartversion has a int after the dash Oct 16, 2020
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch 3 times, most recently from 89273e5 to 99cfdc3 Compare October 16, 2020 19:02
@scbizu scbizu changed the title pkg/repo: fix bad parsing when chartversion has a int after the dash pkg/repo: inject chart metadata(name/version) into storage object Oct 16, 2020
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch from 99cfdc3 to 9780110 Compare October 16, 2020 19:09
@scbizu
Copy link
Contributor Author

scbizu commented Oct 16, 2020

Finally all green , do you have time do some code review for me ? @jdolitsky

@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch 2 times, most recently from eacaffd to a00407c Compare October 17, 2020 04:28
…art version

Signed-off-by: scnace <scbizu@gmail.com>
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch 4 times, most recently from 32db8b7 to 46af326 Compare October 17, 2020 09:50
@helm-bot helm-bot added size/M and removed size/L labels Oct 17, 2020
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch 3 times, most recently from 4d0417b to cc62b99 Compare October 17, 2020 10:20
@helm-bot helm-bot added size/L and removed size/M labels Oct 17, 2020
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch from cc62b99 to 24cfe64 Compare October 17, 2020 10:27
@scbizu scbizu requested a review from jdolitsky October 17, 2020 10:31
…ame not found

Signed-off-by: scnace <scbizu@gmail.com>
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch from 24cfe64 to 24c2ee2 Compare October 17, 2020 10:33
@scbizu
Copy link
Contributor Author

scbizu commented Oct 17, 2020

@jdolitsky hihi I re-edit the acceptance , now it seems right .

Copy link
Contributor

@jdolitsky jdolitsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Will release new storage module, then we will update and merge

@jdolitsky jdolitsky added this to the v0.13.0 milestone Nov 12, 2020
Signed-off-by: scnace <scbizu@gmail.com>
@scbizu scbizu force-pushed the fix/chartversion-int-after-dash branch from 1ef6d5c to 7982fa5 Compare November 12, 2020 05:01
@scbizu
Copy link
Contributor Author

scbizu commented Nov 12, 2020

update the module dependency , but it seems like the dependabot will do it for me ? 🤔

@jdolitsky
Copy link
Contributor

@scbizu thanks, we can close the bot PRs if they are out of date now

@pixelicous
Copy link

@scbizu did you guys solve this issue? I still encounter it.. That problem and also the fact that even when deleting charts that do not exist that return deleted true

@scbizu
Copy link
Contributor Author

scbizu commented Nov 15, 2021

@scbizu did you guys solve this issue? I still encounter it.. That problem and also the fact that even when deleting charts that do not exist that return deleted true

@pixelicous Did you bump to the latest version ? Or can you provide us something more details ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting a chart that has a version number in its name via the API causes no removal from index
5 participants