jenkinsci / coordinator-plugin

Make deployment done by a single click.
https://plugins.jenkins.io/coordinator/
Other
16 stars 10 forks source link

Preventing null pointer due to not building via parameterized triggers #42

Closed philmadden83 closed 7 years ago

philmadden83 commented 7 years ago

resolves: https://github.com/jenkinsci/coordinator-plugin/issues/37 resolves: https://github.com/jenkinsci/coordinator-plugin/issues/38

Problem

Null pointer being thrown due none parameterized build triggers.

Manually triggering a coordinator job does not throw an error as the action is providing a currently required parameter; "executionPlan". This parameter offers a chance to provide an alternative execution plan for a single build.

Screen showing the ability to provide an alternative to the configured execution plan

screen shot 2016-11-30 at 7 22 54 pm

Triggers such as SCM polling do not provide the "executionPlan" parameter nor any others and therefore do not have ParametersAction actions, thus causes the NPE.

Provided fix

Use the configured execution plan as the default execution plan unless the user or a parameterized plugin has provided an alternative execution plan via the "executionPlan" parameter.

Notes

This PR also fixes an issue of an alert box appearing when trying to render a specific build's execution plan due to a similar issue. If a past build was not triggered in a parameterized way you would see the below.

screen shot 2016-11-30 at 7 12 58 pm
philmadden83 commented 7 years ago

Failing tests due to fix now allowing jobs to succeed. I'll re-open once tests are fixed.

philmadden83 commented 7 years ago

D'oh. Moved the TreeNodeUtils.mergeState4Execution call inside the if statement for parameterized builds only.

ace-han commented 7 years ago

Impressive. 😎 👍

@philmadden83 Would you like to accept our invitation to join this project?

I've already sent you one, hope you will like it

ace-han commented 7 years ago

@philmadden83 I will release a version 1.3 this coming weekend, thx a million for your effort.

philmadden83 commented 7 years ago

@ace-han Sure I will join. I didn't seem to receive the invite email though. Would you mind resending? Thanks!