用jenkins打包往各节点自动发布代码时,遇到如下问题:

eie_info\\middlewares\\redirect_middleware.py', 'A    eie_info\\middlewares\\user_agents.py', 'A    eie_info\\scrapy.cfg', '已导出版本 37042。']
export success
 in modifyConfig
conf dir: C:\Users\Administrator\.jenkins\workspace\conf\eie_info
['settings.py']
eie_info\eie_info\settings.py
SSH: Connecting from host [WIN-0D1U3P9CTTC]
SSH: Connecting with configuration [10.101.3.167] ...
SSH: Disconnecting configuration [10.101.3.167] ...
ERROR: Exception when publishing, exception message [Permission denied]
Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
Checking console output
Build step 'Jenkins Text Finder' changed build result to FAILURE
Finished: FAILURE

从提示来看,应该是权限问题。在configure中检查发现,jenkins ssh 10.101.3.167是用test用户远程的,而非root用户。

在发布路径下查看发包的工程权限,如下图所示。原来eie_info只有root用户才有权限操作,ssh远程发布项目时test用户无法覆盖eie_info导致发布失败,故只要删除eie_info项目或者给项目test完全权限,问题即可解决,如下。

 

修改后,jekins可以发布成功!

export success
 in modifyConfig
conf dir: C:\Users\Administrator\.jenkins\workspace\conf\eie_info
['settings.py']
eie_info\eie_info\settings.py
SSH: Connecting from host [WIN-0D1U3P9CTTC]
SSH: Connecting with configuration [10.101.3.167] ...
SSH: Disconnecting configuration [10.101.3.167] ...
SSH: Transferred 76 file(s)
Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
Checking console output
C:\Users\Administrator\.jenkins\jobs\eie_info\builds\15\log:
Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
Finished: SUCCESS

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐