Class SetupDeployer

java.lang.Object
org.jenkinsci.plugins.slave_setup.SetupDeployer

public class SetupDeployer extends Object
Executes a deployment to all or a single node of the given fileset and executes the command line.
Author:
Frederik Fromm /// Modified by @author ByteHeed, Mikel Royo Gutierrez, Aaron Giovannini
  • Constructor Details

    • SetupDeployer

      public SetupDeployer()
  • Method Details

    • stringFy

      public static String stringFy(Object obj)
      Linked with Utils StringFy Useful to print object data into string
    • copyFiles

      public static boolean copyFiles(File localPath, FilePath remotePath) throws IOException, InterruptedException
      Copy localPath into remotePath and return boolean if operation succeded
      Returns:
      Boolean , true if everything went OK
      Throws:
      InterruptedException - BrokenPipe
      IOException - IO error while accesing disk
    • checkLabelsForComputerOrNull

      public static boolean checkLabelsForComputerOrNull(Computer c, SetupConfigItem item)
      Checks if this script should be executed on the target computer. If the computer is not set (on save of the jenkins configuration page) or if the label expression of the config matches with the given computer.
    • executeScriptOnSlave

      public static int executeScriptOnSlave(TaskListener listener, String script, FilePath root, EnvVars enviroment) throws IOException, InterruptedException
      Executes the given script on the given slave independently of their OSs.
      Parameters:
      listener - TaskListener of the job
      script - String script to execute
      root - Slave rootPath as jenkins.FilePath
      enviroment - Enviroment variables for this job on this node. From SetupDeployer.createEnvVars(L)
      Throws:
      InterruptedException - BrokenPipe
      IOException - IO error while accesing disk
    • executeScriptOnMaster

      public static int executeScriptOnMaster(TaskListener listener, String script, EnvVars enviroment)
      Executes the given script on Jenkins MasterNode with his envVars logging with given listener
      Parameters:
      script - Script to execute on Master
      listener - Job's listener handle
      enviroment - Enviroment's EnvVars from SetupDeployer.createEnvVarsForComputer(c)
      Returns:
      int R result from Utils.multiOSexecutor Launcher return.
    • createEnvVarsForComputer

      public static EnvVars createEnvVarsForComputer(Computer c)
      Gets the current enviroment variables for the given computer
      Parameters:
      c - Computer instance.
      Returns:
      Computer's EnvVars