Jenkins Shell Executable Argument on Windows












0















I have a Jenkins server (v 2.138) running on a Windows 7. I also have cygwin installed. The cygwin path is in the windows path, so Jenkins jobs can call cygwin executable.



My question is: why in Build action, when I set an "Execute shell" action, the resulting call (confirmed by the build console output) is something like:



sh -xe C:WindowsTEMPjenkins8280072687577604153.sh


I understand the temp script being generated from what I enter in the jobs configuration. What I don't understand is the "-xe" arguments passed to the sh.



From what I see, these options seems to print internal commands output. Similar to echo ON in windows? However, this has the adverse effect of polluting our build logs.



For example:



Job configuration:



echo X > a.txt
echo X > b.txt
echo X > c.txt
grep X $( find -name "*.txt" )


Resulting log:



+ echo X
+ echo X
+ echo X
++ find -name '*.txt'
+ grep X ./a.txt ./b.txt ./c.txt
./a.txt:X
./b.txt:X
./c.txt:X


If possible I would only like to get:



./a.txt:X
./b.txt:X
./c.txt:X


On my machine, I get:



$ sh --version
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


Therefore, I looked at the bash man page, but I cannot find any reference to -x or -e options.



Do you have any suggestion on how I could tell Jenkins to call the script directly, something like:



sh C:WindowsTEMPjenkins8280072687577604153.sh


Or if not possible, how I could inside my job, overwrite these settings to only print relevant console output, not anything intermediate.



Thanks!










share|improve this question



























    0















    I have a Jenkins server (v 2.138) running on a Windows 7. I also have cygwin installed. The cygwin path is in the windows path, so Jenkins jobs can call cygwin executable.



    My question is: why in Build action, when I set an "Execute shell" action, the resulting call (confirmed by the build console output) is something like:



    sh -xe C:WindowsTEMPjenkins8280072687577604153.sh


    I understand the temp script being generated from what I enter in the jobs configuration. What I don't understand is the "-xe" arguments passed to the sh.



    From what I see, these options seems to print internal commands output. Similar to echo ON in windows? However, this has the adverse effect of polluting our build logs.



    For example:



    Job configuration:



    echo X > a.txt
    echo X > b.txt
    echo X > c.txt
    grep X $( find -name "*.txt" )


    Resulting log:



    + echo X
    + echo X
    + echo X
    ++ find -name '*.txt'
    + grep X ./a.txt ./b.txt ./c.txt
    ./a.txt:X
    ./b.txt:X
    ./c.txt:X


    If possible I would only like to get:



    ./a.txt:X
    ./b.txt:X
    ./c.txt:X


    On my machine, I get:



    $ sh --version
    GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
    Copyright (C) 2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

    This is free software; you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.


    Therefore, I looked at the bash man page, but I cannot find any reference to -x or -e options.



    Do you have any suggestion on how I could tell Jenkins to call the script directly, something like:



    sh C:WindowsTEMPjenkins8280072687577604153.sh


    Or if not possible, how I could inside my job, overwrite these settings to only print relevant console output, not anything intermediate.



    Thanks!










    share|improve this question

























      0












      0








      0


      1






      I have a Jenkins server (v 2.138) running on a Windows 7. I also have cygwin installed. The cygwin path is in the windows path, so Jenkins jobs can call cygwin executable.



      My question is: why in Build action, when I set an "Execute shell" action, the resulting call (confirmed by the build console output) is something like:



      sh -xe C:WindowsTEMPjenkins8280072687577604153.sh


      I understand the temp script being generated from what I enter in the jobs configuration. What I don't understand is the "-xe" arguments passed to the sh.



      From what I see, these options seems to print internal commands output. Similar to echo ON in windows? However, this has the adverse effect of polluting our build logs.



      For example:



      Job configuration:



      echo X > a.txt
      echo X > b.txt
      echo X > c.txt
      grep X $( find -name "*.txt" )


      Resulting log:



      + echo X
      + echo X
      + echo X
      ++ find -name '*.txt'
      + grep X ./a.txt ./b.txt ./c.txt
      ./a.txt:X
      ./b.txt:X
      ./c.txt:X


      If possible I would only like to get:



      ./a.txt:X
      ./b.txt:X
      ./c.txt:X


      On my machine, I get:



      $ sh --version
      GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
      Copyright (C) 2016 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

      This is free software; you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.


      Therefore, I looked at the bash man page, but I cannot find any reference to -x or -e options.



      Do you have any suggestion on how I could tell Jenkins to call the script directly, something like:



      sh C:WindowsTEMPjenkins8280072687577604153.sh


      Or if not possible, how I could inside my job, overwrite these settings to only print relevant console output, not anything intermediate.



      Thanks!










      share|improve this question














      I have a Jenkins server (v 2.138) running on a Windows 7. I also have cygwin installed. The cygwin path is in the windows path, so Jenkins jobs can call cygwin executable.



      My question is: why in Build action, when I set an "Execute shell" action, the resulting call (confirmed by the build console output) is something like:



      sh -xe C:WindowsTEMPjenkins8280072687577604153.sh


      I understand the temp script being generated from what I enter in the jobs configuration. What I don't understand is the "-xe" arguments passed to the sh.



      From what I see, these options seems to print internal commands output. Similar to echo ON in windows? However, this has the adverse effect of polluting our build logs.



      For example:



      Job configuration:



      echo X > a.txt
      echo X > b.txt
      echo X > c.txt
      grep X $( find -name "*.txt" )


      Resulting log:



      + echo X
      + echo X
      + echo X
      ++ find -name '*.txt'
      + grep X ./a.txt ./b.txt ./c.txt
      ./a.txt:X
      ./b.txt:X
      ./c.txt:X


      If possible I would only like to get:



      ./a.txt:X
      ./b.txt:X
      ./c.txt:X


      On my machine, I get:



      $ sh --version
      GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
      Copyright (C) 2016 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

      This is free software; you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.


      Therefore, I looked at the bash man page, but I cannot find any reference to -x or -e options.



      Do you have any suggestion on how I could tell Jenkins to call the script directly, something like:



      sh C:WindowsTEMPjenkins8280072687577604153.sh


      Or if not possible, how I could inside my job, overwrite these settings to only print relevant console output, not anything intermediate.



      Thanks!







      windows jenkins cygwin






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 21:11









      mgouinmgouin

      14828




      14828
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289541%2fjenkins-shell-executable-argument-on-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289541%2fjenkins-shell-executable-argument-on-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python