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
JENKINS-48155: gerrit-trigger-plugin does not repsect dynamicTriggerConfiguration flag #336
Conversation
@@ -246,13 +245,6 @@ private static String regexEscapted(char symbol) { | |||
public static List<GerritProject> fetch(String gerritTriggerConfigUrl, String serverName) | |||
throws IOException, ParseException { | |||
|
|||
if (gerritTriggerConfigUrl == null) { |
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 see no reason to remove this, it will just cause another MalformedURLException
to be thrown from the URL constructor with a more cryptic message.
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.
Because updateTriggerConfigURL was trigged only from once place and now we have a check directly in this place.
Should I keep it to double check?
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.
Well it's a public method so it's best to keep it I think :)
@@ -1731,14 +1733,6 @@ public void updateTriggerConfigURL() { | |||
String triggerInformationMessage = MessageFormat.format( | |||
"ParseException when fetching dynamic trigger url: {0}", pe.getMessage()); | |||
triggerInformationAction.setErrorMessage(triggerInformationMessage); | |||
} catch (MalformedURLException mue) { | |||
String logErrorMessage = MessageFormat.format( | |||
"MalformedURLException for project: {0} and URL: {1} Message: {2}", |
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.
Why is this removed? The user could still specify a malformed url in the config screen, and now the error will be harder to find.
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.
Agree, will restore.
@@ -1720,8 +1723,7 @@ public void updateTriggerConfigURL() { | |||
triggerInformationAction.setErrorMessage("Dynamic trigger configuration needs " | |||
+ "a specific configured server"); | |||
} else { | |||
List<GerritProject> fetchedProjects = GerritDynamicUrlProcessor.fetch(triggerConfigURL, serverName); | |||
dynamicGerritProjects = fetchedProjects; | |||
dynamicGerritProjects = GerritDynamicUrlProcessor.fetch(triggerConfigURL, serverName); |
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.
Why this change?
If there is an error now you will be stuck with not triggering on anything instead of at least triggering on what was parsed in the last fetch.
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.
if fetch
will raise a exception - assignment will not happen. Do not see any difference - just use one variable less.
@@ -59,6 +59,9 @@ public void run() { | |||
if (trigger == null) { | |||
return; | |||
} | |||
if (trigger.getTriggerConfigURL() == null || trigger.getTriggerConfigURL().isEmpty()) { |
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.
use StringUtils.isEmpty()
2eaa4c3
to
d2f78e4
Compare
…onfiguration flag If user does not want to use dynamic configuration anymore, let's assign the list of projects to empty list to avoid possible race conditions.
d2f78e4
to
756a09e
Compare
@rsandell Now it's the most conservative PR ever ;) |
If user does not want to use dynamic configuration anymore, let's assign
the list of projects to empty list to avoid possible race conditions.
Also instead of firing update with empty url, better to check it.