execute shell step skipped completely in jenkins

前端 未结 3 1151
旧巷少年郎
旧巷少年郎 2021-02-14 09:20

I can\'t seem to run a build execute shell step in Jenkins. I\'ve worked with Hudson in the past on windows and I was able to create shell/batch steps without a problem but I s

3条回答
  •  梦如初夏
    2021-02-14 10:20

    It looks like Jenkins is not being able to redirect the output from the system. What version of Java are you using? If you're using OpenJDK, could you try with Sun Java/Sun JDK?

    First test to try to check if anything is executing at all: add the following to your "Execute Shell"

    #!/bin/bash
    echo "HELLO WORLD" > /tmp/testfile
    

    Run this and check if there is a /tmp/testfile in on your Linux system, and if it contains the HELLO WORLD text, it means your script is in fact executing.

    Which version of Jenkins do you have?

    The last good version that I can attest to (last one I know works well at least for us) is 1.447. If you're not using that one, would you be able to try with it?

    Also, could you add #!/bin/sh or #!/bin/bash before echo hi on your "Execute Shell" for the Linux system and see if that works.

    Also, try running a script using source /path/to/script and see if that works. The script should contain #!/bin/sh or #!/bin/bash as the first line, just to see if that makes a difference.

    Note: none of this should be required, but is helpful just to get more information on what's going on. Couldn't fit all this into a comment. I'll update my answer based on your answers to the above, or delete if I can't get anything..

提交回复
热议问题