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

Add option to output executed commands to job console

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • managed-scripts-plugin
    • None
    • MAC OSX 10.8

      It would be great to have an option to output the executed commands into the job build console for debugging purposes. right now only STDOUT and STDERR are logged.

      for example i have a managed script like

      BUNDLE_NAME=$(/usr/libexec/PlistBuddy -c "Print CFBundleDisplayName" ${WORKSPACE}/${1})
      

      i call the managed script with the path to a plist as first argument with heavy usage of variables.

      the only output in the build console i get is

      Print: Entry, "CFBundleDisplayName", Does Not Exist
      

      it would be nice to have something like in the "normal" build step script execution like:

      ++ /usr/libexec/PlistBuddy -c 'Print CFBundleDisplayName' /the/path/to/the/plist/as/defined/by/argument.plist
      Print: Entry, "CFBundleDisplayName", Does Not Exist
      

      of course i can add some variable dumps, but this seems very tedious as this works very nicely in the normal "execute script" build step.

          [JENKINS-22918] Add option to output executed commands to job console

          the only reason why this works in the "normal" shell build step is when you do not define a shebang on the first line.
          If you don't do that, then every single line in the textbox is executed on its own an therefore the execution can be logged.
          If you add a shebang, then the full textbox is treated as a script (as this plugin does) and then you don't get the debug output either.

          Dominik Bartholdi added a comment - the only reason why this works in the "normal" shell build step is when you do not define a shebang on the first line. If you don't do that, then every single line in the textbox is executed on its own an therefore the execution can be logged. If you add a shebang, then the full textbox is treated as a script (as this plugin does) and then you don't get the debug output either.

          Jonas Kuepper added a comment -

          Hi Dominik,

          thanks for your answer.

          so i guess this is not possible, without a major overhaul? somthing like /bin/bash -x managed-scripname.sh is not possible?

          Thanks anyway
          Jonas

          Jonas Kuepper added a comment - Hi Dominik, thanks for your answer. so i guess this is not possible, without a major overhaul? somthing like /bin/bash -x managed-scripname.sh is not possible? Thanks anyway Jonas

            domi Dominik Bartholdi
            jonas_cpp Jonas Kuepper
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: