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

Fixed NPE when setting selector explicitly to null from groovy #200

Conversation

cconnert
Copy link
Contributor

When doing e.g.

def selector = someCondition ? specific(BUILD)) : null;
copyArtifacts(fingerprintArtifacts: true, selector: selector, projectName: "someProject")

leads to:

Also:   org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: xyz
java.lang.NullPointerException
	at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:482)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

though I would expect to get the default (aka. stable) artifact selector.

Testing done

No, please add a dedicated unit test

Submitter checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
    Options
  2. Ensure that the pull request title represents the desired changelog entry
    Options
  3. Please describe what you did
    Options
  4. Link to relevant issues in GitHub or Jira
    Options
  5. Link to relevant pull requests, esp. upstream and downstream changes
    Options
  6. Ensure you have provided tests - that demonstrates feature works or fixes the issue
    Options

@cconnert cconnert requested a review from a team as a code owner August 10, 2023 08:28
@cconnert cconnert force-pushed the bugfix/NPE_when_selector_set_null_from_groovy branch from 17762da to 0a8c964 Compare August 10, 2023 08:35
@allancth allancth merged commit 3d31132 into jenkinsci:master Aug 11, 2023
16 checks passed
@MarkEWaite MarkEWaite added the bug label Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants