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

actions from TransientActionFactories are saved in Builds.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core

      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>
      

       

          [JENKINS-51584] actions from TransientActionFactories are saved in Builds.

          James Nord created issue -
          James Nord made changes -
          Description Original: {{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).

           
          {code:java}
          <?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.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
          <target>hudson.model.Queue$WaitingItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
          </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
          <com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
          <target>hudson.model.Queue$BuildableItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
          </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
          <jenkins.metrics.impl.TimeInQueueAction plugin="metrics@3.1.2.12">
          <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\source\github\cloudbees\bluesteel\bluesteel-cjoc\work\workspace\free</workspace>
          <hudsonVersion>2.107.3-cb-1</hudsonVersion>
          <scm class="hudson.scm.NullChangeLogParser"/>
          <culprits class="com.google.common.collect.EmptyImmutableSortedSet"/>
          </build>
          {code}
           
          New: {{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).

           
          {code:title=build.xml|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.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
          <target>hudson.model.Queue$WaitingItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
          </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
          <com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
          <target>hudson.model.Queue$BuildableItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
          </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
          <jenkins.metrics.impl.TimeInQueueAction plugin="metrics@3.1.2.12">
          <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\source\github\cloudbees\bluesteel\bluesteel-cjoc\work\workspace\free</workspace>
          <hudsonVersion>2.107.3-cb-1</hudsonVersion>
          <scm class="hudson.scm.NullChangeLogParser"/>
          <culprits class="com.google.common.collect.EmptyImmutableSortedSet"/>
          </build>
          {code}
           
          James Nord made changes -
          Description Original: {{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).

           
          {code:title=build.xml|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.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
          <target>hudson.model.Queue$WaitingItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
          </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
          <com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
          <target>hudson.model.Queue$BuildableItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
          </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
          <jenkins.metrics.impl.TimeInQueueAction plugin="metrics@3.1.2.12">
          <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\source\github\cloudbees\bluesteel\bluesteel-cjoc\work\workspace\free</workspace>
          <hudsonVersion>2.107.3-cb-1</hudsonVersion>
          <scm class="hudson.scm.NullChangeLogParser"/>
          <culprits class="com.google.common.collect.EmptyImmutableSortedSet"/>
          </build>
          {code}
           
          New: {{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).

           
          {code:title=build.xml|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.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
                      <target>hudson.model.Queue$WaitingItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
                  </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
                  <com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
                      <target>hudson.model.Queue$BuildableItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
                  </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
                  <jenkins.metrics.impl.TimeInQueueAction plugin="metrics@3.1.2.12">
                      <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\source\github\cloudbees\bluesteel\bluesteel-cjoc\work\workspace\free</workspace>
              <hudsonVersion>2.107.3-cb-1</hudsonVersion>
              <scm class="hudson.scm.NullChangeLogParser"/>
              <culprits class="com.google.common.collect.EmptyImmutableSortedSet"/>
          </build>
          {code}
           
          James Nord made changes -
          Description Original: {{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).

           
          {code:title=build.xml|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.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
                      <target>hudson.model.Queue$WaitingItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
                  </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
                  <com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction plugin="bluesteel-cjoc@1.2.7-SNAPSHOT">
                      <target>hudson.model.Queue$BuildableItem:hudson.model.FreeStyleProject@11e31cdf[free]:5</target>
                  </com.cloudbees.opscenter.server.bluesteel.action.BlueSteelUrlAction>
                  <jenkins.metrics.impl.TimeInQueueAction plugin="metrics@3.1.2.12">
                      <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\source\github\cloudbees\bluesteel\bluesteel-cjoc\work\workspace\free</workspace>
              <hudsonVersion>2.107.3-cb-1</hudsonVersion>
              <scm class="hudson.scm.NullChangeLogParser"/>
              <culprits class="com.google.common.collect.EmptyImmutableSortedSet"/>
          </build>
          {code}
           
          New: {{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).

           
          {code:title=build.xml|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>
          {code}
           

          Oleg Nenashev added a comment -

          Weird, but I cannot reproduce it.
          Please provide version of Jenkins and other plugins you have installed.

          Oleg Nenashev added a comment - Weird, but I cannot reproduce it. Please provide version of Jenkins and other plugins you have installed.

          James Nord added a comment -

          weired yes
          it affects 2.107 2.121 and possibly much older.

          I have a fix I am testing (3 character changes) and is easily reproducible

          James Nord added a comment - weired yes it affects 2.107 2.121 and possibly much older. I have a fix I am testing (3 character changes) and is easily reproducible
          CloudBees Inc. made changes -
          Remote Link New: This issue links to "CloudBees Internal CJP-8826 (Web Link)" [ 20759 ]

          James Nord added a comment -

          PR with unit test. code fix to follow.

          James Nord added a comment - PR with unit test. code fix to follow.
          James Nord made changes -
          Remote Link New: This issue links to "PR#3462 (Web Link)" [ 20766 ]

          James Nord added a comment - - edited

          BlueOcean has run into this issue, see linked tickets and the craxy workaround

          James Nord added a comment - - edited BlueOcean has run into this issue, see linked tickets and the craxy workaround

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

              Created:
              Updated:
              Resolved: