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

actions from TransientActionFactories are saved in Builds.

    XMLWordPrintable

Details

    Description

      Actions created from a TransientActionFactory are persisted in a Run when they should never be persisted.

       

      If you have a TAF that creates an action for any ModelItem then on {{FreeStyleBuild}}s you will end up with 3 duplicate Actions displayed (and 2 will be persisted in the build.xml)

       

      One is created for the hudson.model.Queue$WaitingItem one for the hudson.model.Queue$BuildableItem and the last one for the actual build (which is the one that is not persisted).

       

      build.xml
      <?xml version='1.1' encoding='UTF-8'?>
      <build>
          <actions>
              <hudson.model.CauseAction>
                  <causeBag class="linked-hash-map">
                      <entry>
                          <hudson.model.Cause_-UserIdCause>
                              <userId>james</userId>
                          </hudson.model.Cause_-UserIdCause>
                          <int>1</int>
                      </entry>
                  </causeBag>
              </hudson.model.CauseAction>
              <com.myco.myplugin.MyAction>
                  <target>hudson.model.Queue$WaitingItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
              </com.myco.myplugin.MyAction>
              <com.myco.myplugin.MyAction>
                  <target>hudson.model.Queue$BuildableItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
              </com.myco.myplugin.MyAction>
              <jenkins.metrics.impl.TimeInQueueAction>
                  <queuingDurationMillis>9</queuingDurationMillis>
              </jenkins.metrics.impl.TimeInQueueAction>
          </actions>
          <queueId>5</queueId>
          <timestamp>1527599156095</timestamp>
          <startTime>1527599156104</startTime>
          <result>SUCCESS</result>
          <duration>3225</duration>
          <charset>windows-1252</charset>
          <keepLog>false</keepLog>
          <builtOn></builtOn>
          <workspace>C:\workarea\yplugin\work\workspace\free</workspace>
          <hudsonVersion>2.107.3</hudsonVersion>
          <scm class="hudson.scm.NullChangeLogParser"/>
          <culprits class="com.google.common.collect.EmptyImmutableSortedSet"/>
      </build>
      

       

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: James Nord
            Path:
            test/src/test/java/jenkins/model/TransientActionFactoryTest.java
            http://jenkins-ci.org/commit/jenkins/c4215dc6ad5f974c740bed925aaba655b27e453a
            Log:
            JENKINS-51584 Improve unit test to show allocation trace.

            improve the unit test to show the allocation trace on failure.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: test/src/test/java/jenkins/model/TransientActionFactoryTest.java http://jenkins-ci.org/commit/jenkins/c4215dc6ad5f974c740bed925aaba655b27e453a Log: JENKINS-51584 Improve unit test to show allocation trace. improve the unit test to show the allocation trace on failure.

            Code changed in jenkins
            User: James Nord
            Path:
            core/src/main/java/hudson/model/Queue.java
            core/src/main/java/hudson/model/queue/WorkUnitContext.java
            http://jenkins-ci.org/commit/jenkins/8ca803819bbd7f5ecaf44179680d6694999e74d4
            Log:
            JENKINS-51584 do not store actions from TransientActionFactory.

            The code was updated to use the non deprecated getAllActions() to obtain
            the list of actions, however this was persisted in the actions causing
            the actions from TransientActionFactories to be persisted in Builds.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: core/src/main/java/hudson/model/Queue.java core/src/main/java/hudson/model/queue/WorkUnitContext.java http://jenkins-ci.org/commit/jenkins/8ca803819bbd7f5ecaf44179680d6694999e74d4 Log: JENKINS-51584 do not store actions from TransientActionFactory. The code was updated to use the non deprecated getAllActions() to obtain the list of actions, however this was persisted in the actions causing the actions from TransientActionFactories to be persisted in Builds.

            Code changed in jenkins
            User: James Nord
            Path:
            core/src/main/java/hudson/model/Queue.java
            core/src/main/java/hudson/model/queue/WorkUnitContext.java
            test/src/test/java/jenkins/model/TransientActionFactoryTest.java
            http://jenkins-ci.org/commit/jenkins/d4737b2b60438ce0e3cb7a8a6f26675f7c880914
            Log:
            Merge pull request #3462 from jtnord/JENKINS-51584

            JENKINS-51584 Actions from a TransientActionFactory should not be persisted

            Compare: https://github.com/jenkinsci/jenkins/compare/8872b44cc882...d4737b2b6043
            *NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

            Functionality will be removed from GitHub.com on January 31st, 2019.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: core/src/main/java/hudson/model/Queue.java core/src/main/java/hudson/model/queue/WorkUnitContext.java test/src/test/java/jenkins/model/TransientActionFactoryTest.java http://jenkins-ci.org/commit/jenkins/d4737b2b60438ce0e3cb7a8a6f26675f7c880914 Log: Merge pull request #3462 from jtnord/ JENKINS-51584 JENKINS-51584 Actions from a TransientActionFactory should not be persisted Compare: https://github.com/jenkinsci/jenkins/compare/8872b44cc882...d4737b2b6043 * NOTE: * This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.
            oleg_nenashev Oleg Nenashev added a comment -

            Fixed in 2.126

            oleg_nenashev Oleg Nenashev added a comment - Fixed in 2.126

            Code changed in jenkins
            User: James Nord
            Path:
            core/src/main/java/hudson/model/Queue.java
            core/src/main/java/hudson/model/queue/WorkUnitContext.java
            test/src/test/java/jenkins/model/TransientActionFactoryTest.java
            http://jenkins-ci.org/commit/jenkins/4f576414b544a3d78e7156e6b1d1b12ed7406455
            Log:
            Merge pull request #3462 from jtnord/JENKINS-51584

            JENKINS-51584 Actions from a TransientActionFactory should not be persisted

            (cherry picked from commit d4737b2b60438ce0e3cb7a8a6f26675f7c880914)

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: core/src/main/java/hudson/model/Queue.java core/src/main/java/hudson/model/queue/WorkUnitContext.java test/src/test/java/jenkins/model/TransientActionFactoryTest.java http://jenkins-ci.org/commit/jenkins/4f576414b544a3d78e7156e6b1d1b12ed7406455 Log: Merge pull request #3462 from jtnord/ JENKINS-51584 JENKINS-51584 Actions from a TransientActionFactory should not be persisted (cherry picked from commit d4737b2b60438ce0e3cb7a8a6f26675f7c880914)

            People

              Unassigned Unassigned
              teilo James Nord
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: