Best practices to avoid Jenkins error: sudo: no tty present and no askpass program specified
The no tty thing (requiretty
in sudoers) is the real issue.
Basically, comment out the following lines in your /etc/sudoers file:
#Defaults requiretty#Defaults !visiblepw
Other ways to get it to work:
Defaults !requiretty
Or per user:
Defaults:jenkins !requiretty
A more detailed answer is this answer to this question on the Unix & Linux Stack Exchange site:
One thing you can do is to get Jenkins to run a script, for example 'run.sh', then from inside this script you can start makefiles, and make sure that there are no sudo commands inside the makefiles.
It is a bit of a hassle, but at least you are not risking changing security settings