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

Unable to replace action in StepAtomNode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Trivial
    • Resolution: Unresolved
    • Component/s: core, pipeline
    • Labels:
      None
    • Environment:
      Jenkins 2.235.4
    • Similar Issues:

      Description

      Hello Folks,

      Executing the next Jenkins Script trying to replace ErrorAction by WarningAction (like ignore error) for FlowNode (for both running pipeline and stopped pipeline):

      import org.jenkinsci.plugins.workflow.actions.ErrorAction
      import org.jenkinsci.plugins.workflow.actions.WarningAction
      
      println(Jenkins.instance.getItem("test-job").getBuild('16').getExecution().getNode('1339'))
      println(Jenkins.instance.getItem("test-job").getBuild('16').getExecution().getNode('1339').getActions())
      
      Jenkins.instance.getItem("test-job").getBuild('16').getExecution().getNode('1339').replaceActions(ErrorAction, new WarningAction(Result.UNSTABLE).withMessage('Test'))
      

      And getting the next result:

      StepAtomNode[id=1339, exec=CpsFlowExecution[Owner[test-job/16:test-job #16]]]
      [org.jenkinsci.plugins.workflow.cps.actions.ArgumentsActionImpl@e10ec52, org.jenkinsci.plugins.workflow.actions.TimingAction@5bf750d3, org.jenkinsci.plugins.workflow.support.actions.LogStorageAction@441f9903, org.jenkinsci.plugins.workflow.actions.ErrorAction@756bc98e]
      java.lang.UnsupportedOperationException
      	at java.util.concurrent.CopyOnWriteArrayList$COWIterator.remove(CopyOnWriteArrayList.java:1182)
      	at java.util.AbstractCollection.removeAll(AbstractCollection.java:376)
      	at hudson.model.Actionable.replaceActions(Actionable.java:307)
      	at hudson.model.Actionable$replaceActions$2.call(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
      	at Script1.run(Script1.groovy:5)
      	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
      	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
      	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
      	at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
      	at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
      	at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
      	at hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
      	at jenkins.model.Jenkins._doScript(Jenkins.java:4513)
      	at jenkins.model.Jenkins.doScript(Jenkins.java:4484)
      	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
      	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
      	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
      	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
      	at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
      ...
      

      Seems it's about https://github.com/jenkinsci/jenkins/blob/jenkins-2.235.4/core/src/main/java/hudson/model/Actionable.java#L307

      current.removeAll(old);
      

        Attachments

          Issue Links

            Activity

            Hide
            raihaan Raihaan Shouhell added a comment -

            From my understanding this is the same as https://issues.jenkins.io/browse/JENKINS-64438

            can you update to the latest workflow-api

            Show
            raihaan Raihaan Shouhell added a comment - From my understanding this is the same as https://issues.jenkins.io/browse/JENKINS-64438 can you update to the latest workflow-api
            Hide
            sparshev Sergei Parshev added a comment -

            Thank you, looks related. Will check how it's going

            Show
            sparshev Sergei Parshev added a comment - Thank you, looks related. Will check how it's going

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              sparshev Sergei Parshev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: