yussuf
yussuf

Reputation: 635

jenkins can't finish build script that executes a "while true" loop

we are using a self-made build server (based on Ubuntu 12.04) to build an embedded linux project. We are successfully using this server for some time now without problems by logging in via ssh and executing a build script which performs the necessary build stuff.

We would like to automate the builds with jenkins. We actually thought this should be quite easy as the jenkins job would simply call the build script to do the job.

However, it fails and hangs forever on a certain while loop within the build script. The while loop looks like this (it is used to accept default suggestions from make config)

file: create.sh

#!/bin/sh
[... other stuff]
echo Configure project sources ...
(while true ; do echo ; done
) | make config_config >> $WORKDIR/project.log 2>&1
echo Debug output to see that this line is reached ...
[... other stuff]

create.sh is called from some other script (build.sh) which is again called from some other script (like simple-build.sh). This is because create.sh uses some environment variables which are setup by build.sh for the specific build environment and simple-build.sh calls the build.sh script to set up the environment for the build server. So a builder can simply login and call "simple-build.sh" and everything is done without any further settings.

If the script is called from jenkins, the console output looks like:

jenkins console output

[... other stuff]
Configure project sources ...

and then... it hangs forever and does not finish until the process is aborted manually in jenkins. If the while loop is removed, and e.g. replaced with a certain amount of sleep and echo to enter return, it works. However, it would be good to not change the build script (the same while loop approach is used several times in the scripts..)

Any ideas why this while loop is causing trouble? Is it even the while loop or do we miss something else here?

Upvotes: 1

Views: 2559

Answers (1)

Abubaker Siddique
Abubaker Siddique

Reputation: 139

since yes is working try "echo y" in your script. I think your make is expecting y and you are passing nothing.

(while true ; do echo y; done
) | make config_config >> $WORKDIR/project.log 2>&1

Thanks

Upvotes: 1

Related Questions