• 解决jenkins shell执行sonar-scanner提示命令存在的问题


    通过jenkins的以下三个方式去执行sonar-scanner,抛如下错误。

    Help for feature: Send files or execute commands over SSH before the build starts
         

    command [cd /home/xxx/code/CODE/xxx/xxx
    sonar-scanner...
    bash: sonar-scanner: command not found
    SSH: EXEC: completed after 200 ms
    SSH: Disconnecting configuration [zftest] ...
    ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [127]]
    Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
    Finished: UNSTABLE

    原因是:jenkins编译项目,不继承linux环境变量 ~/.bash_profile  ~/.bashrc  /etc/profile,导致在执行shell脚本,提示命令找不到!

    解决方法:在服务器执行ln -sv /usr/local/sonar-scanner/bin/sonar-scanner /usr/local/bin/sonar-scanner

  • 相关阅读:
    linux -- 部署java服务器(3) linux安装redis
    linux 安装php8
    linux mysql查看日志
    linux mysql常用的命令
    perl heredoc
    perl数值进制
    提问的智慧
    How to ask question the smart way
    PERL命令行
    图灵/异步图书
  • 原文地址:https://www.cnblogs.com/freestudy/p/10288166.html
Copyright © 2020-2023  润新知