• Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Major Major
    • run-condition-plugin
    • None

      Run conditions should be passed Launcher object so that the conditions may be allowed to run scripts within the build, e.g call a Shell or groovy script.

      Current implementations are

      public abstract boolean runPrebuild(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception;

      public abstract boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception;

      These should be extended to
      (final AbstractBuild<?, ?> build, final BuildListener listener, final Launcher launcher)

          [JENKINS-12982] Run conditions should be passed Launcher object

          cjo9900 added a comment -

          Having looked at the code in more places I see that there are several places that do not have a launcher present in the first place, i.e Dependency.shouldTriggerBuild(AbstractBuild build, TaskListener listener, List<Action> actions), Prebuild(AbstractBuild build, TaskListener listener)

          However I think that a launcher can be created within the condition using the following

          runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception;
          {
          Launcher launcher = build.getWorkspace().createLauncher(listener);
          /* some action here */
          }

          This is untried code, but is a better alternative than altering all of the existing uses.

          If this is a usable solution close the issue.

          http://javadoc.jenkins-ci.org/hudson/model/AbstractBuild.html
          http://javadoc.jenkins-ci.org/hudson/FilePath.html#createLauncher(hudson.model.TaskListener)

          cjo9900 added a comment - Having looked at the code in more places I see that there are several places that do not have a launcher present in the first place, i.e Dependency.shouldTriggerBuild(AbstractBuild build, TaskListener listener, List<Action> actions), Prebuild(AbstractBuild build, TaskListener listener) However I think that a launcher can be created within the condition using the following runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception; { Launcher launcher = build.getWorkspace().createLauncher(listener); /* some action here */ } This is untried code, but is a better alternative than altering all of the existing uses. If this is a usable solution close the issue. http://javadoc.jenkins-ci.org/hudson/model/AbstractBuild.html http://javadoc.jenkins-ci.org/hudson/FilePath.html#createLauncher(hudson.model.TaskListener )

          cjo9900 added a comment -

          Closed as not required Launcher can be created from build and listener.

          cjo9900 added a comment - Closed as not required Launcher can be created from build and listener.

            cjo9900 cjo9900
            cjo9900 cjo9900
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: