-
Notifications
You must be signed in to change notification settings - Fork 217
Support expanding variables in openqa-clone-job #6655
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
base: master
Are you sure you want to change the base?
Conversation
df0b34f
to
af8a1d5
Compare
Related progress issue: https://progress.opensuse.org/issues/182645
Related progress issue: https://progress.opensuse.org/issues/182645
af8a1d5
to
88d4ae2
Compare
@@ -28,6 +30,9 @@ sub verify_incident_repos ($url_handler, $incident_repos) { | |||
my @incident_urls; | |||
my $ua = $url_handler->{ua}; | |||
foreach my $incident (split(/,/, $incident_repos)) { | |||
die |
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 don't think it is good idea , maybe just print warning instead ? It reminds me story around #6468 which showed us that it is not always good thing to decide on behalf of caller if it is make sense to continue . I still see some cases where no matter that incident repos are not expanded run still make sense . For example some VRs where I simply skip use of this variables
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 wouldn't mind the die
. If we continue here we would probably just run into a hard failure later so failing fast is probably the best thing to do here.
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.
@Martchus what about the case when I clone job for some VR and simply skip install of updates ? We doing it quite often and just not bother about content of this variables
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.
And then you still use --check-repos
and the checks pass despite the incomplete content of the variables? If that's the case then it should probably be a warning. Maybe you can give a concrete example of how you invoke openqa-clone-job
so we're sure we're talking about the same thing.
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.
And then you still use --check-repos and the checks pass despite the incomplete content of the variables?
ah sorry I didn't realize that . so it will die only if --check-repos
flag will be used ?
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've just double-checked and code in CloneJobSUSE.pm
is only executed if --check-repos
is present.
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.
ok than I am agree that we need to die here
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6655 +/- ##
=======================================
Coverage 99.19% 99.19%
=======================================
Files 398 398
Lines 40800 40809 +9
=======================================
+ Hits 40472 40481 +9
Misses 328 328 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Not repeating my comments from #6654. In cases like this it would probably make sense to just open on PR.
@@ -28,6 +30,9 @@ sub verify_incident_repos ($url_handler, $incident_repos) { | |||
my @incident_urls; | |||
my $ua = $url_handler->{ua}; | |||
foreach my $incident (split(/,/, $incident_repos)) { | |||
die | |||
"URL '$incident' contains an unexpanded variable. Specify the necessary variables at the command line for expansion. See https://open.qa/docs/#_variable_expansion for details" | |||
if $incident =~ /%/; |
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 %
sign is commonly used in URL encoding so this check seems quite wrong.
|
||
our @EXPORT = qw(detect_maintenance_update); | ||
|
||
sub collect_incident_repos ($url_handler, $settings) { | ||
OpenQA::JobSettings::expand_placeholders($settings); |
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.
This function should probably return whether some placeholders could not be expanded. Don't do this by checking for a %
as mentioned in the other comment.
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.
Ok. I suggest we do
first to ensure that the worker has no problems with the return value of expanding and then I can try to incorporate that here.
@@ -28,6 +30,9 @@ sub verify_incident_repos ($url_handler, $incident_repos) { | |||
my @incident_urls; | |||
my $ua = $url_handler->{ua}; | |||
foreach my $incident (split(/,/, $incident_repos)) { | |||
die |
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 wouldn't mind the die
. If we continue here we would probably just run into a hard failure later so failing fast is probably the best thing to do here.
@@ -28,6 +30,9 @@ sub verify_incident_repos ($url_handler, $incident_repos) { | |||
my @incident_urls; | |||
my $ua = $url_handler->{ua}; | |||
foreach my $incident (split(/,/, $incident_repos)) { | |||
die | |||
"URL '$incident' contains an unexpanded variable. Specify the necessary variables at the command line for expansion. See https://open.qa/docs/#_variable_expansion for details" |
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.
This needs a trailing \n
, otherwise Perl prints a line number and it looks like a mistake in the program itself:
"URL '$incident' contains an unexpanded variable. Specify the necessary variables at the command line for expansion. See https://open.qa/docs/#_variable_expansion for details" | |
"URL '$incident' contains an unexpanded variable. Specify the necessary variables at the command line for expansion. See https://open.qa/docs/#_variable_expansion for details\n" |
Related progress issue: https://progress.opensuse.org/issues/182645
After: