-
Notifications
You must be signed in to change notification settings - Fork 46
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
check if version is missing from config.yml #223
Conversation
Signed-off-by: SSE4 <[email protected]>
It reads version as is (as strong). Now it checks there is no error after
version was added to the config.
…On Mon, 24 Aug 2020 at 11:27, Javier G. Sogo ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In tests/test_hooks/conan-center/test_conan-center.py
<#223 (comment)>:
> + tools.save(os.path.join("all", "conandata.yml"), content=conandata)
+ output = self.conan(['export', 'all', ***@***.***/test'])
+ self.assertIn("ERROR: [CONFIG.YML HAS NEW VERSION (KB-H052)] The version \"2.0\" exists in",
+ output)
+
+ config = textwrap.dedent("""
+ versions:
+ 1.0:
+ folder:all
+ 2.0:
+ folder:all
+ """)
+ tools.save("config.yml", content=config)
+ output = self.conan(['export', 'all', ***@***.***/test'])
+ self.assertNotIn("ERROR: [CONFIG.YML HAS NEW VERSION (KB-H052)] The version \"2.0\" exists in",
+ output)
Why the ERROR now? Is it because it is reading the version as a float?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#223 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGUOXCGM7KSRCSXBXOIB4LSCIP5PANCNFSM4QI3IHHQ>
.
|
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.
assertNotIn
🤦 ...too early in the morning...
I am not sure about having this check in the hook, as the config.yml file is something specific to conan-center-index. Maybe this is a check we should do in the pipeline itself. wdyt @jgsogo? |
@danimtb but this is conan-center hook, right? anyway, if there is no config.yml, the check will not run, so it's harmless |
I agree that hooks shouldn't use |
versions_conandata = conandata_yml['sources'].keys() | ||
versions_config = config_yml['versions'].keys() | ||
|
||
for version in versions_conandata: |
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.
The opposite also can occur. I can remember one or two cases where the user created a config.yml with more versions but the conandata.yml had only one, like preparing for the future.
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.
but didn't it fail anyway? because there are no sources in conandata, so source method should have failed
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.
We can add the opposite check in the future (even for this same hook).
conan-center hooks are already strongly CCI specific anyway, e.g. we check if the homepage is set to CCI And for the sake of transparency and open source I would actually suggest to implement even more into the hooks =) |
this is a common mistake to add a new version to the
conandata.yml
, but forget to add it to theconfig.yml
.as result, CI doesn't build the newly added version, and we don't know if it actually passed the CI.
it's very easy to miss during the review, so I've decided to add an automatic check for human error.
NOTE: it's not needed to add the opposite case - version is added to the
config.yml
but not to theconandata.yml
, as it would fail anyway during the attempt to fetch sources.docs: conan-io/conan-center-index#2640