Skip to content
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-52390 Throw appropriate error when the code is not in node block #3

Merged
merged 1 commit into from
Jul 6, 2018

Conversation

nrayapati
Copy link
Member

@nrayapati nrayapati commented Jul 5, 2018

Description

  • Update examples to surround code with node.
  • Throw appropriate error when the code is not in node block.

See JENKINS-52390.

@nrayapati
Copy link
Member Author

nrayapati commented Jul 5, 2018

Instead of throwing java.lang.NullPointerException, it would now throw a valid error message

Before: 👎

[Pipeline] stage
[Pipeline] { (Remote SSH)
[Pipeline] sshCommand
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
[Office365connector] No webhooks to notify
java.lang.NullPointerException
	at org.jenkinsci.plugins.sshsteps.steps.CommandStep$Execution.run(CommandStep.java:71)
	at org.jenkinsci.plugins.sshsteps.util.SSHStepExecution$1$1.call(SSHStepExecution.java:77)
	at hudson.security.ACL.impersonate(ACL.java:290)
	at org.jenkinsci.plugins.sshsteps.util.SSHStepExecution$1.run(SSHStepExecution.java:72)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

After: 👍

[Pipeline] stage
[Pipeline] { (Remote SSH)
[Pipeline] sshCommand
Required context class hudson.Launcher is missing
Perhaps you forgot to surround the code with a step that provides this, such as: node
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
[Office365connector] No webhooks to notify
org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.Launcher is missing
	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:260)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:206)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)

@nrayapati nrayapati requested review from ghenkes and wwftw July 5, 2018 21:36
@nrayapati nrayapati self-assigned this Jul 5, 2018
@nrayapati
Copy link
Member Author

Thank you @wuchenwang

@nrayapati
Copy link
Member Author

Thank you @ghenkes

@nrayapati nrayapati merged commit e4d1b19 into master Jul 6, 2018
@nrayapati nrayapati deleted the JENKINS-52390 branch July 6, 2018 04:25
@nrayapati nrayapati added the enhancement New feature or request label Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants