-
Notifications
You must be signed in to change notification settings - Fork 270
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
Refactor get_suse_container_urls using data structure for each distri #13141
Conversation
$dotversion = "${dotversion}.0" if $dotversion !~ /\./; # 15 -> 15.0 | ||
my $version = shift // get_required_var('VERSION'); | ||
my $arch = shift // get_required_var('ARCH'); | ||
my $distri = shift // get_required_var('DISTRI'); | ||
|
||
my @untested_images = (); |
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.
Please also rename to totest
so it's consistent.
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.
untested_images
as well as released_images
came from a previous team agreement. i dont want to interfere and change them. i think it is messy to change the names frequently. in the other side i think the variable names in the structure are quite good and they do not mess with the already implementation.
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.
I like your totest_
and released_
prefixes. But I'd like to use the same prefixes everywhere.
Maybe another point: I'd rename %registries
to %images
and released_registry
to released_image
and totest_registry
to totest_image
.
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.
@jlausuch @Vogtinator can you help here so we agree on same convention and use it everywhere?
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.
Ping. I would still be for unifying those names. E.g. released_images
and totest_images
as in urls.pm
.
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.
Let's just not forget about it.
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.
My objection is that arbitrary change of the variable names or unrelated request of the scope is bad practice. The reason is because usually you trigger side effects and it might cause a chain of reactions+additional checks,VR and etc. Second, you request to rename some variables, unrelated to the scope of this PR, which as for beginning they are not bad ones and the discussion should be in the case the PR have made changes on them. Which it doesnt and a very important reason of it is that there was a PR which reviewed and approved (requester was one of them) after a long talk on the rocket.chat if i remember. i just think is really bad to approve something and someone changed it without a good "reason". this causes more issues and inconsistency in the reviews and waste our time.
tespa. i would like to leave it as it is for the reasons i just mentioned. and you can decide later what its destiny will be :)
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.
I am in favor of renaming %registries to %images.
this is a definition think that i try to address here. the image name and the image registry is not exactly the same. The image registry is the uri of the image where is stored. When we execute podman run hello-world
, the runtime will check the image-name in the registry and then at the docker registry from convention. in both cases it looks on localhost:5000/hello-world
and docker.io/hello-world
. this is the registry and the hash provides obviously the registry-name rather the image-name. i thought to force this convention as for me it is confusing when we do not use the same terminology.
this change is ready for review
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.
Just call it hash
:D .
Sorry for the joke, but this is just another "tab or spaces" discussion.. I don't care about the name.
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.
My objection is that arbitrary change of the variable names or unrelated request of the scope is bad practice. The reason is because usually you trigger side effects and it might cause a chain of reactions+additional checks,VR and etc. Second, you request to rename some variables, unrelated to the scope of this PR, which as for beginning they are not bad ones and the discussion should be in the case the PR have made changes on them. Which it doesnt and a very important reason of it is that there was a PR which reviewed and approved (requester was one of them) after a long talk on the rocket.chat if i remember. i just think is really bad to approve something and someone changed it without a good "reason". this causes more issues and inconsistency in the reviews and waste our time.
tespa. i would like to leave it as it is for the reasons i just mentioned. and you can decide later what its destiny will be :)
I agree with this, it's not something for this PR as I mentioned.
This so far looks great to me! |
dcd2b30
to
c65ae8f
Compare
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.
"+202 -57", 145 more lines while also being less flexible :-/
Having a hash of subs means that it's not just plain data, but still code, IMO the shorter code was simpler, but that's just my view.
It's no longer possible to distinguish between "not available, skip" (e.g. 15.2 PowerPC) and "not known, abort" (none of the cases match).
The biggest issue IMO however is that it needs manual changes for every new version of SLE or Leap, while currently it handles later version of known distributions automatically.
Actually, that is possible. |
Yes, it's more code but it's also more clear. I am in favor of this format. Maybe, in the future we could put it in json/yaml/xml format in data directory and just read it here, so we don't create so many lines of code with that big hash. Something similar to what we do for journal_check test. But it's fine if that is done later. |
I have approach this problem organizing the data into a hash. The data structure can hold information explicitly, so it is more ease to handle. Each <distri><version> hold three information - released - totest - available_arch I use anonumous functions for `registries` to provide flexibility. For instance you can choose the different registry based on aarch. or it is possible to modify the sub to return an array in the future. I tried to group some of the versions as they provide commonalities but regular hash accept scalar as a key. Signed-off-by: Ioannis Bonatakis <ybonatakis@suse.com>
17ed2bc
to
f18bab5
Compare
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 biggest issue IMO however is that it needs manual changes for every new version of SLE or Leap, while currently it handles later version of known distributions automatically.
Is still valid
Sorry i thought that @jlausuch has answered on that and seems to be in favor of this structure. is this somehow different? My opinion is that this is a more neat approach because you can "describe" what is your data. there is a trade off with the procedural logic. the writing/reading is getting harder because the decision made by mixing version, distri and arch. the task was to simplify this. To avoid manual changes we could use this struct a little bit different.
or something like that. |
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.
For me is good, only that I agree to change the registries variable name to images, more clear what contains
Yes, I am in favor. If we need to add new releases it won't be a big deal, maybe once or twice a year? For new releases there are actually bigger changes we need to do, adding a few lines here is not that much of a problem. The only thing against having this hash here is just that it takes too much lines in a |
#13141 (comment). feel free to suggests something different. for instance %images_uri but i still think that registries describes it just fine. |
Either |
It seems this is being blocked because of the hash name. Let's just let people vote: I vote for |
I vote for %images, %registries confuses for me |
are we going to vote for each review conflict? i even proposed another name... and i will add a few here in case you want to pick something from that which will define the hash uniquely
Again consider that the hash is not a private variable and it is worth to give a better name than %images |
%images_uri +1 |
`get_suse_container_urls` takes named params now as requested. With this commit, apply this to the files that has explicit impact, as they use positional one Signed-off-by: Ioannis Bonatakis <ybonatakis@suse.com>
72cee52
to
ecb65e0
Compare
First comes First Served?? :) this change is ready for review |
This is in my opinion out of scope of this PR and also quite complex problem as we test prerelease versions too. |
follow up ticket to address manual changes to the hash https://progress.opensuse.org/issues/98658 |
This seems responsible for the staging failures, like |
I have approach this problem organizing the data into a hash. The data
structure can hold information explicitly, so it is more ease to handle.
Each hold three information
I use anonumous functions for
registries
to provide flexibility. For instanceyou can choose the different registry based on aarch. or it is possible to
modify the sub to return an array in the future.
I tried to group some of the versions as they provide commonalities but regular
hash accept scalar as a key.
Verification run: