【问题标题】:Build failure in JENKINSJENKINS 中的构建失败
【发布时间】:2020-03-05 10:02:38
【问题描述】:

我在 JENKINS 中安排作业时遇到问题。以下命令在有和没有 SUDO 的 TERMINAL(Mac) 中都可以正常工作(必须输入密码)。

如果没有 Sudo,我会收到“不允许操作”错误。

在我在 JENKINS 中得到的构建语句和错误下方,谁能帮我解决它?

export PYTHONPATH=${PYTHONPATH:-"/Users/it/Documents/google_crawler"}
cd /Users/it/Documents/google_crawler
sudo python3 PLA_Google_continious_execution.py

也代替这个“sudo python3 PLA_Google_continious_execution.py”尝试了“sudo python3 PLA_Google_continious_execution.py -S“密码”“但结果相同。

错误:

09:45:47 Started by timer
09:45:47 Running as SYSTEM
09:45:47 Building in workspace /Users/it/.jenkins/workspace/google_crawler
09:45:47 [google_crawler] $ /bin/sh -xe /var/folders/t2/sk1vw_mn7mz7ncjw75lzh7r40000gn/T/jenkins4461665640429805517.sh
09:45:48 + export PYTHONPATH=/Users/it/Documents/google_crawler
09:45:48 + PYTHONPATH=/Users/it/Documents/google_crawler
09:45:48 + cd /Users/it/Documents/google_crawler
09:45:48 + sudo python3 PLA_Google_continious_execution.py
09:45:48 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
09:45:48 Build step 'Execute shell' marked build as failure
09:45:48 Finished: FAILURE

谁能指导一下。

【问题讨论】:

    标签: python python-3.x jenkins jenkins-pipeline


    【解决方案1】:

    sudo:需要终端才能读取密码

    使用这个:

    echo YOURPASSWORD | sudo -S python3 PLA_Google_continious_execution.py
    

    【讨论】:

    • 感谢您的更新,但它对我不起作用。在给出你所说的之后,我得到“操作不允许”和“文件无法打开”错误。任何对此有何建议?
    猜你喜欢
    • 2021-11-30
    • 1970-01-01
    • 2015-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多