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

Change information unavailable when using workflow plugin

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • p4-plugin
    • None
    • P4 Plugin 1.3.1

      Even though the changelog.xml file for the build has a changelist in it:

      All I see on the build summary page is:

      I am using the workflow plugin. The input to the checkout call is:

      00:00:01.526 [scm_sync_stream] sync_settings:[$class:PerforceScm, poll:false, credential:7779d639-7544-48ae-83d7-183216a1422f, populate:[$class:ForceCleanImpl, have:true, modtime:false, quiet:false, pin:140731], workspace:[$class:StreamWorkspaceImpl, charset:none, format:jenkins-brhel7ac-scm_test-RE_main, pinHost:false, streamName://RE/main]]

      I added some debug output to the workflow and found that the P4ChangeEntry object is missing all of the information, but ChangeLogSet.isEmptSet() returned false:

      00:00:09.627 [find_prop] search_list:[files, affectedFiles] obj:org.jenkinsci.plugins.p4.changes.P4ChangeEntry@32605bff obj.prop:[changeTime:2015-09-11 06:19:30, date:Fri Sep 11 18:19:30 CDT 2015, id:null, files:[], commitId:null, msgEscaped:, timestamp:-1, shelved:false, maxLimit:50, msg:, class:class org.jenkinsci.plugins.p4.changes.P4ChangeEntry, jobs:[], msgAnnotated:, fileLimit:false, changeNumber:null, label:false, affectedPaths:[], clientId:, author:null, parent:org.jenkinsci.plugins.p4.changes.P4ChangeSet@5437dc2f]

      Also, I am not sure if this is related to the same issue or not, but when there are two checkout calls, it creates to change summary lists and two "Label this build" links on the build summary page.

          [JENKINS-30425] Change information unavailable when using workflow plugin

          Paul Allen added a comment -

          Yes I have seen this too. It seems that the Workflow plugin does not share the environment outside of the scope of a build (Run class).
          There is another job open on the environment issue, on the p4 plugin and Jenkins Workflow/SCM core JENKINS-24141.

          I was thinking of perhaps showing the change numbers as links to Swarm (or your chosen Repo Browser) if the connection is off-line. At least that will provide a stop gap until the Workflow gets fixed.

          Paul Allen added a comment - Yes I have seen this too. It seems that the Workflow plugin does not share the environment outside of the scope of a build (Run class). There is another job open on the environment issue, on the p4 plugin and Jenkins Workflow/SCM core JENKINS-24141 . I was thinking of perhaps showing the change numbers as links to Swarm (or your chosen Repo Browser) if the connection is off-line. At least that will provide a stop gap until the Workflow gets fixed.

          Michael Rose added a comment -

          I think there is something going on in p4 plugin also. I just saw that the changeset was properly populated when there were new changes since the last build. It seems that the "No connection" message only occurs when there are no changes.
          I think there are 2 problems:

          1. P4 plugin returns a badly populated ChangelogSet when the follow is true: 1. there are no changes since the previous build; 2. The previous build was successful. In this case, it should return an empty changeset.
          2. The build summary page lists the changeset each time checkout is called. This for the most part is correct behavior. The issue here is that it does not respect the changelog property. Checkouts where the changlog property is set to false still appear on the summary page.

          Michael Rose added a comment - I think there is something going on in p4 plugin also. I just saw that the changeset was properly populated when there were new changes since the last build. It seems that the "No connection" message only occurs when there are no changes. I think there are 2 problems: P4 plugin returns a badly populated ChangelogSet when the follow is true: 1. there are no changes since the previous build; 2. The previous build was successful. In this case, it should return an empty changeset. The build summary page lists the changeset each time checkout is called. This for the most part is correct behavior. The issue here is that it does not respect the changelog property. Checkouts where the changlog property is set to false still appear on the summary page.

          Paul Allen added a comment -

          Looks like the changelog XML file is not fully populated (i.e an int and not a change object):

          BAD (no change):

          <?xml version='1.0' encoding='UTF-8'?>
          <changelog>
          	<entry>
          		<changenumber>8665</changenumber>
          	</entry>
          </changelog>
          

          GOOD (with a change):

          <?xml version='1.0' encoding='UTF-8'?>
          <changelog>
          	<entry>
          		<changenumber><changeInfo>8665</changeInfo>
          		<clientId>local-main-in</clientId>
          		<msg>Submitted by Jenkins. Build: jenkins-local-main-171</msg>
          		<changeUser>pallen</changeUser>
          		<changeTime>2015-09-09 03:28:07</changeTime>
          		<shelved>false</shelved>
          		<files>
          		<file endRevision="95" action="EDIT" depot="%2F%2Fdepot%2Fupdate.me" />
          		</files>
          		</changenumber>
          	</entry>
          

          BTW: 'Changelog property'? Where is this property? It's not something I recognise.

          Paul Allen added a comment - Looks like the changelog XML file is not fully populated (i.e an int and not a change object): BAD (no change): <?xml version='1.0' encoding='UTF-8'?> <changelog> <entry> <changenumber>8665</changenumber> </entry> </changelog> GOOD (with a change): <?xml version='1.0' encoding='UTF-8'?> <changelog> <entry> <changenumber><changeInfo>8665</changeInfo> <clientId>local-main-in</clientId> <msg>Submitted by Jenkins. Build: jenkins-local-main-171</msg> <changeUser>pallen</changeUser> <changeTime>2015-09-09 03:28:07</changeTime> <shelved>false</shelved> <files> <file endRevision="95" action="EDIT" depot="%2F%2Fdepot%2Fupdate.me" /> </files> </changenumber> </entry> BTW: 'Changelog property'? Where is this property? It's not something I recognise.

          Michael Rose added a comment -

          I didn't realize that the changelog is supposed to have a lot more information inside of it. The changelog I attached a couple days ago was also bad then. Any idea why this happens?

          Also, I could have sworn there was a toggle field to disable/enable the changelog in the Snippet Generator at one point, but I am not seeing it now.

          Michael Rose added a comment - I didn't realize that the changelog is supposed to have a lot more information inside of it. The changelog I attached a couple days ago was also bad then. Any idea why this happens? Also, I could have sworn there was a toggle field to disable/enable the changelog in the Snippet Generator at one point, but I am not seeing it now.

          Paul Allen added a comment -

          There is an area of code that looks for the last build and tries to generate a change object from a change number or label string (CheckoutTask). Looks like it needs a rewrite as the code has been touched many times, the tricky part is there are quite a lot of corner cases to test as it depends on the last build/current build status and the change type (change/label/shelf).

          Paul Allen added a comment - There is an area of code that looks for the last build and tries to generate a change object from a change number or label string (CheckoutTask). Looks like it needs a rewrite as the code has been touched many times, the tricky part is there are quite a lot of corner cases to test as it depends on the last build/current build status and the change type (change/label/shelf).

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java
          src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java
          src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeParser.java
          src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeSet.java
          src/main/java/org/jenkinsci/plugins/p4/changes/P4Revision.java
          src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java
          src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java
          src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java
          src/main/java/org/jenkinsci/plugins/p4/tasks/PollTask.java
          http://jenkins-ci.org/commit/p4-plugin/db6a58b335191a95dc80775cf7818f470eada7a8
          Log:
          Use a P4Revision object and not int/String as Object.

          In sure that there is no ambiguity with the revision specifier. Should
          fix change summary when using the Workflow plugin.

          JENKINS-30425

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeParser.java src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeSet.java src/main/java/org/jenkinsci/plugins/p4/changes/P4Revision.java src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java src/main/java/org/jenkinsci/plugins/p4/tasks/PollTask.java http://jenkins-ci.org/commit/p4-plugin/db6a58b335191a95dc80775cf7818f470eada7a8 Log: Use a P4Revision object and not int/String as Object. In sure that there is no ambiguity with the revision specifier. Should fix change summary when using the Workflow plugin. JENKINS-30425

          Michael Rose added a comment - - edited

          Installing https://jenkins.ci.cloudbees.com/job/plugins/job/p4-plugin/241 produces the following error for all of my projects (matrix and workflow).

          Started by upstream project "re/review_main" build number 652
          originally caused by:
          Started by user Michael Rose
          Building remotely on brhel7ac (x86_64-Linux-RHEL7 linux) in workspace /jenkins/workspace/re/review_main/ARCH/x86_64-Linux-RHEL7/BUILDSYSTEM/p4b/FORM/gcc
          (p4):cmd:... p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4___
          p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc

          (p4):stop:5

          P4 Task: establishing connection.
          ... server: foo
          ... node: bar
          (p4):cmd:... p4 info
          p4 info

          (p4):stop:6
          (p4):cmd:... p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4___
          p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc

          (p4):stop:7
          (p4):cmd:... p4 client -i
          p4 client -i

          Client jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc saved.

          (p4):stop:8
          (p4):cmd:... p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4___
          p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc

          (p4):stop:9
          (p4):cmd:... p4 client -i
          p4 client -i

          Client jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc saved.

          (p4):stop:10
          ... client: jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc
          (p4):cmd:... p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4___
          p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc

          (p4):stop:5
          (p4):cmd:... p4 counter change
          p4 counter change

          (p4):stop:6
          (p4):cmd:... p4 changes -m1 //jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTE___
          p4 changes -m1 //jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc/...

          Change 141791 on 2015/09/18 by ecrist@re-main 'User should be allowed to set o'
          (p4):stop:7
          Building on Node: brhel7ac
          java.io.IOException: remote file operation failed: /jenkins/workspace/re/review_main/ARCH/x86_64-Linux-RHEL7/BUILDSYSTEM/p4b/FORM/gcc at hudson.remoting.Channel@41314efb:brhel7ac: java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper@43109790
          at hudson.FilePath.act(FilePath.java:987)
          at hudson.FilePath.act(FilePath.java:969)
          at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:331)
          at hudson.scm.SCM.checkout(SCM.java:485)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
          at hudson.model.Run.execute(Run.java:1744)
          at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:374)
          Caused by: java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper@43109790
          at hudson.remoting.UserRequest.serialize(UserRequest.java:169)
          at hudson.remoting.UserRequest.<init>(UserRequest.java:63)
          at hudson.remoting.Channel.call(Channel.java:751)
          at hudson.FilePath.act(FilePath.java:980)
          ... 11 more
          Caused by: java.io.NotSerializableException: org.jenkinsci.plugins.p4.changes.P4Revision
          at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
          at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
          at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
          at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
          at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
          at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
          at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
          at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
          at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
          at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
          at hudson.remoting.UserRequest._serialize(UserRequest.java:158)
          at hudson.remoting.UserRequest.serialize(UserRequest.java:167)
          ... 14 more
          Recording test results

          Michael Rose added a comment - - edited Installing https://jenkins.ci.cloudbees.com/job/plugins/job/p4-plugin/241 produces the following error for all of my projects (matrix and workflow). Started by upstream project "re/review_main" build number 652 originally caused by: Started by user Michael Rose Building remotely on brhel7ac (x86_64-Linux-RHEL7 linux) in workspace /jenkins/workspace/re/review_main/ARCH/x86_64-Linux-RHEL7/BUILDSYSTEM/p4b/FORM/gcc (p4):cmd:... p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4___ p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc (p4):stop:5 P4 Task: establishing connection. ... server: foo ... node: bar (p4):cmd:... p4 info p4 info (p4):stop:6 (p4):cmd:... p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4___ p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc (p4):stop:7 (p4):cmd:... p4 client -i p4 client -i Client jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc saved. (p4):stop:8 (p4):cmd:... p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4___ p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc (p4):stop:9 (p4):cmd:... p4 client -i p4 client -i Client jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc saved. (p4):stop:10 ... client: jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc (p4):cmd:... p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4___ p4 client -o jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc (p4):stop:5 (p4):cmd:... p4 counter change p4 counter change (p4):stop:6 (p4):cmd:... p4 changes -m1 //jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTE___ p4 changes -m1 //jenkins-brhel7ac-re-review_main-ARCH-x86_64-Linux-RHEL7-BUILDSYSTEM-p4b-FORM-gcc/... Change 141791 on 2015/09/18 by ecrist@re-main 'User should be allowed to set o' (p4):stop:7 Building on Node: brhel7ac java.io.IOException: remote file operation failed: /jenkins/workspace/re/review_main/ARCH/x86_64-Linux-RHEL7/BUILDSYSTEM/p4b/FORM/gcc at hudson.remoting.Channel@41314efb:brhel7ac: java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper@43109790 at hudson.FilePath.act(FilePath.java:987) at hudson.FilePath.act(FilePath.java:969) at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:331) at hudson.scm.SCM.checkout(SCM.java:485) at hudson.model.AbstractProject.checkout(AbstractProject.java:1276) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532) at hudson.model.Run.execute(Run.java:1744) at hudson.matrix.MatrixRun.run(MatrixRun.java:146) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) Caused by: java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper@43109790 at hudson.remoting.UserRequest.serialize(UserRequest.java:169) at hudson.remoting.UserRequest.<init>(UserRequest.java:63) at hudson.remoting.Channel.call(Channel.java:751) at hudson.FilePath.act(FilePath.java:980) ... 11 more Caused by: java.io.NotSerializableException: org.jenkinsci.plugins.p4.changes.P4Revision at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at hudson.remoting.UserRequest._serialize(UserRequest.java:158) at hudson.remoting.UserRequest.serialize(UserRequest.java:167) ... 14 more Recording test results

          Paul Allen added a comment -

          Looks like I forgot to make the new class P4review Serializable. Just making the change now...

          Paul Allen added a comment - Looks like I forgot to make the new class P4review Serializable. Just making the change now...

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/changes/P4Revision.java
          http://jenkins-ci.org/commit/p4-plugin/a885a6497dccb130437fda9014af0adcb61ba64b
          Log:
          Make P4Revision Serializable.

          JENKINS-30425

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/changes/P4Revision.java http://jenkins-ci.org/commit/p4-plugin/a885a6497dccb130437fda9014af0adcb61ba64b Log: Make P4Revision Serializable. JENKINS-30425

            p4paul Paul Allen
            mrose Michael Rose
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: