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

WorkUnitContext.actions does not populate for Pipeline steps

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I found this while filing JENKINS-37809. It seems like WorkUnitContext objects created by Pipeline steps do not have their parameters storied in the .actions field. The plugin works by calling getCurrentWorkUnit() on a node's Executor, uses that WorkUnit's .context to get the WorkUnitContext object, then gets its parameters by referencing the .actions field. That field is populated for builds running on executors for Freestyle jobs, but does not for Pipeline jobs.

      I don't really know much Java or understand the internal workings of Jenkins, so I'm afraid I can't supply much more detail than that. I put as many relevant details as I could in JENKINS-37809 and decided to file a bug with the main pipeline component, as it seems like that is where the underlying issue exists.

      Thanks!

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            A Pipeline node block creates a PlaceholderTask, which is distinct from the WorkflowJob that represents the project as a whole. I am not sure which Action you are looking for specifically, but I would not expect there to be any here. ParametersAction would be associated with the WorkflowRun, not a PlaceholderExecutable within it. Anyway it seems dubious that this is really what you should be basing decisions on. I am not sure what the freestyle feature is intended to accomplish but it possibly does not translate.

            Show
            jglick Jesse Glick added a comment - A Pipeline node block creates a PlaceholderTask , which is distinct from the WorkflowJob that represents the project as a whole. I am not sure which Action you are looking for specifically, but I would not expect there to be any here. ParametersAction would be associated with the WorkflowRun , not a PlaceholderExecutable within it. Anyway it seems dubious that this is really what you should be basing decisions on. I am not sure what the freestyle feature is intended to accomplish but it possibly does not translate.
            Hide
            jglick Jesse Glick added a comment -

            Possibly there is just no API for this. SubTask has getOwnerTask, but Executable has no getOwnerExecutable. Would require a core change to have a place to even offer the link from a PlaceholderExecutable to a WorkflowRun.

            Show
            jglick Jesse Glick added a comment - Possibly there is just no API for this. SubTask has getOwnerTask , but Executable has no getOwnerExecutable . Would require a core change to have a place to even offer the link from a PlaceholderExecutable to a WorkflowRun .
            Hide
            alunsford Aaron Lunsford added a comment -

            Hey Jesse, thanks for the response. The intended use case was to get the parameters and their values from the currently running builds in a pipeline project. WorkUnitContext.actions seemed to be the way to do that in the past, but it doesn't look like the api supports it for pipelines.

            In any case, thanks for taking a look. Much appreciated.

            Show
            alunsford Aaron Lunsford added a comment - Hey Jesse, thanks for the response. The intended use case was to get the parameters and their values from the currently running builds in a pipeline project. WorkUnitContext.actions seemed to be the way to do that in the past, but it doesn't look like the api supports it for pipelines. In any case, thanks for taking a look. Much appreciated.
            Hide
            yeluolei Rurui Ye added a comment -

            this is still a blocking issue for jenkins, way does it resolved?

            Show
            yeluolei Rurui Ye added a comment - this is still a blocking issue for jenkins, way does it resolved?
            Hide
            jglick Jesse Glick added a comment -

            Rurui Ye see above comments. Jenkins is behaving as designed.

            Show
            jglick Jesse Glick added a comment - Rurui Ye see above comments. Jenkins is behaving as designed.

              People

              Assignee:
              jglick Jesse Glick
              Reporter:
              alunsford Aaron Lunsford
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: