简体   繁体   中英

How Does Jenkins Deal With Interactive Shell Scripts?

I am writing a couple Linux shell scripts that move some code around and it would be nice and simple if these could be interactive.

The drawback is I would like to execute some of these scripts in Jenkins and am not entirely sure of how Jenkins handles user prompts within the script. I haven't been able to find much of anything on this and don't have the resources to just go ahead and test it, so any advice would be appreciated.

Thanks guys

If a command that Jenkins executes expects input, it will just sit there and wait for the input. The job will hang and you'll need to kill it manually. One way of coping with this is to pipe the expected input into the command, eg

echo "input" | command

or

command < file_with_input

You can run the interactive shell script from Jenkins.

Here is the documentation for that:

http://www.buildengineers.org:8080/display/Tools/Running+interactive+Shell+Script+in+Jenkins

Using <<LimitString option, you can run the shell script from command line.

you can give the inputs in execution section in the jenkins configuration.

hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM