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

Use correct version of ubi config file for population #140

Merged
merged 5 commits into from
Oct 24, 2019

Conversation

JayZ12138
Copy link
Contributor

This resloves #138
A new attr is added to Repo class and it will be populated while
searching repos.

After all config files are loaded, it now creates a config map, which
helps find the right config file for the repo to populate.

@JayZ12138
Copy link
Contributor Author

Tests will be added/modified later.

# then it's not a mainline repo, use platform_full_version instead.
version = repo_set.out_repos.rpm.ubi_config_version \
or repo_set.out_repos.rpm.platform_full_version
right_config = self.ubiconfig_map.get(version, {}).get(config.filename)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem to fulfill following acceptance criteria:

if ubi config is not available for given version, fallback to default version ("7" for ubi7, "8" for ubi8 )

In ubi config repo there will always be 'default' branches ubi7 and ubi8 where you need to fallback if config for required version isn't available. And if I read it correctly, it can assign None to right_config var which will lead ubipop to crash. This can happen for both DOT and mainline repos.

Or there can be some "best effort" mechanism which can select the latest available config < required version, if required config is not available. But this is not needed now I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this. I wasn't sure what's 'default version'.
I'm still confused about why 'version' could be None? could you elaborate on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, isn't platform_full_version always available?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, I misread.
yeah, right_config could be None and it leads to the push crashing. I saw that in the first place and I didn't do any exception for it, because I think it should fail in this case, means there's a major error in config repo, we should fail this push.
Do you think we should ignore and continue push?

Copy link
Member

Choose a reason for hiding this comment

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

Good question.
Well these default branches (ubi7, ubi8) should be always available.
If they are not available, I'd like to see at least an error message logged so ubipop can populate as much as it can.

@JayZ12138
Copy link
Contributor Author

I'm not sure why CI passed...
I'm going to introduce fake loader to ubiconfig, which would make tests much easier.

@JayZ12138
Copy link
Contributor Author

run tests

@@ -26,6 +26,10 @@ class RepoMissing(Exception):
pass


class ConfigMissing(Exception):
Copy link
Contributor

Choose a reason for hiding this comment

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

MissingConfig sounds better

Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine, conforms to existing scheme

# config file could also be missing for specific version, then the
# default config file will be used.
version = ubi_config_version or platform_full_version
right_config = self.ubiconfig_map\
Copy link
Contributor

Choose a reason for hiding this comment

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

Break only on or, this is hard to read, but not a big deal.

@rbikar
Copy link
Member

rbikar commented Oct 23, 2019

@JayZ12138
Do you plan any changes in this PR after release-engineering/ubi-config#57 is merged?

@JayZ12138
Copy link
Contributor Author

@JayZ12138
Do you plan any changes in this PR after release-engineering/ubi-config#57 is merged?

Yes.

This resloves release-engineering#138
A new attr is added to Repo class and it will be populated while
searching repos.

After all config files are loaded, it now creates a config map, which
helps find the right config file for the repo to populate.
config file for specific version might not available, it should fall
back to load the config file from default version.
@JayZ12138
Copy link
Contributor Author

run tests

@JayZ12138
Copy link
Contributor Author

run tests

@JayZ12138
Copy link
Contributor Author

Run tests

@JayZ12138
Copy link
Contributor Author

run tests

@@ -26,6 +26,10 @@ class RepoMissing(Exception):
pass


class ConfigMissing(Exception):
Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine, conforms to existing scheme

@JayZ12138 JayZ12138 merged commit e658f0c into release-engineering:master Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants