-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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-36748] Not process null Triggers #2463
Conversation
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
} | ||
} else { | ||
LOGGER.log(Level.WARNING, "The job {0} has a syntactically incorrect config and is missing the cron spec for a trigger", p.getFullName()); |
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 spec is optional for a Trigger IIUC.
Hence the check should be inside if (!(t instanceof SCMTrigger && scmd.synchronousPolling))
rather than outside it, or the log level and message should be adjusted.
@jtnord I think I correctly addressed your feedback. |
🐝 - a unit test would be great to prevent a regression... |
the fox is a bit overloaded by "improvement" changes, but LGTM |
Oh, 🐝 |
👎 for merging it without test. |
Issue wasn't closed https://issues.jenkins-ci.org/browse/JENKINS-36748 |
// don't let that cancel the polling activity. report and move on. | ||
LOGGER.log(Level.WARNING, t.getClass().getName() + ".run() failed for " + p, e); | ||
if (!(t instanceof SCMTrigger && scmd.synchronousPolling)) { | ||
if (t !=null && t.spec != null && t.tabs != 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.
tabs can't be 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.
Please describe the case when getTriggers().values()
may return 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.
tabs can be null
even when they should not, see the JIRA issue. basically an XML pushed with some missing fields, or JobDSL configuration without a cron...
getTriggers()
should not return null
- but hey this is about robustness and we have a similar patterns elsewhere in Jenkins for this.
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.
So where is the fix for real problem then?
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.
@jtnord if you get getTriggers()
, then values()
will be non null always. So you need check for getTriggers()
nullness firstly.
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.
So where is the fix for real problem then
t.tabs != null
We can not check and validate everything on disk, or created from XML as we have no schema to validate against, unless you have some suggestions here ?
getTriggers() should not return null - but hey this is about robustness and we have a similar patterns elsewhere in Jenkins for this.
I should be more careful when I type.
getTriggers()
could possibly contain a null value, rather than itself be null
, don;t ask me how or where, it was just deemed safe given we had to check tabs
to check more than the initially observered case.
if getTriggers
can return null then this needs a separate fix (and a separate JIRA as the way to reproduce this would be different).
Trigger API requires right trigger initialisation and usage, i annotated them long time ago. If ghprb (and i sure that is) is using APIs in wrong ways, then core shouldn't be hacked for it. |
Annotations can be violated in so many ways, they are compile time for code not run time. I think whilst we can argue about creating garbage until the cows come home (there are many ways to do it) I think we can agree that a single garbage job should not impact other jobs from working correctly - and this was actually the case here. |
waiting for test case then. |
It's coming. |
@jtnord @KostyaSha Per your request #2482 was created.
|
👎, this looks like the wrong fix. Basic validation of the content of fields like
|
I think you are trying to fix nulls where they shouldn't be at all. With such assumption every few lines in jenkins code will have null checks. |
Right, that is my point: it is better to fix malformed settings at the point of origin (configuration or deserialization). |
Which it does, in |
The main problem that I see for the right fix is that it needs to be done in XStream and even if I try to do there, we will not pick up the fix until some years happens and we update the pom. So either, we can revert this change or we merge the test case #2482 |
https://issues.jenkins-ci.org/browse/JENKINS-36748
@reviewbybees CC @jtnord