Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40258

New pipeline behavior crashes if client renamed

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • p4-plugin
    • None

      If you have an existing pipeline job and then change the workspace names in the Jenkinsfile, the build exits with:

      [Pipeline] End of Pipeline
      java.lang.NullPointerException
      at org.jenkinsci.plugins.p4.tagging.TagAction.getLastChange(TagAction.java:201)
      at org.jenkinsci.plugins.p4.PerforceScm.calculateChanges(PerforceScm.java:471)
      at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:429)
      at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
      ...cut...
      Finished: FAILURE

      From:

      public static P4Revision getLastChange(Run<?, ?> run, TaskListener listener, String client) {
      	P4Revision last = null;
       
      	List<TagAction> actions = lastActions(run, listener);
      	if (actions == null || client == null || client.isEmpty()) {
      		return last;
      	}
       
      	// look for action matching view
      	for (TagAction action : actions) {
      		if (client.equals(action.getClient())) {
      			last = action.getBuildChange();
      		}
      	}
       
      	listener.getLogger().println("Found last change " + last.toString() + " on client " + client);
      	return last;
      }
      

            p4karl Karl Wirth
            p4karl Karl Wirth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: