text 当试图从Jenkins运行shell时,如何解决“sudo:没有tty存在且没有指定askpass程序”

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 当试图从Jenkins运行shell时,如何解决“sudo:没有tty存在且没有指定askpass程序”相关的知识,希望对你有一定的参考价值。

Running shell scripts that have contain sudo commands in them from jenkins might not run as expected. To fix this, follow along
Simple steps:
1. On ubuntu based systems, run " $ sudo visudo "
2. this will open /etc/sudoers file.
3. If your jenkins user is already in that file, then modify to look like this:

jenkins ALL=(ALL) NOPASSWD: ALL
4. save the file by doing Ctrl+O  (dont save in tmp file. save in /etc/sudoers, confirm overwrite)
5. Exit by doing Ctrl+X
6. Relaunch your jenkins job 
7. you shouldnt see that error message again :)

以上是关于text 当试图从Jenkins运行shell时,如何解决“sudo:没有tty存在且没有指定askpass程序”的主要内容,如果未能解决你的问题,请参考以下文章

jenkins跳过shell执行错误

当单元测试失败时,Jenkins 成功(Rails)

当使用“sudo su”时,jenkins在ssh上执行shell

当两者都在运行时,如何将消息从一个 shell 脚本发送到另一个 shell 脚本?

如何利用jenkins git shell脚本自动部署服务

詹金斯从工件加载文件时出错