Jenkins构建项目遇到的问题总结

4.2.1  Windows下,Jenkins运行python项目

https://www.jianshu.com/p/f6edbaaa8a0d

4.2.2  配置不同类型的项目的操作步骤

http://testingpai.com/article/1609225132204

4.2.3  提示找不到python.exe命令,要在Jenkins配置环境变量

https://www.cnblogs.com/lizhe860/p/10087955.html

https://blog.csdn.net/xxlovesht/article/details/81415158

配置环境变量

 

 

 

 

 

 

4.2.4  ModuleNotFoundError: No module named 'allure_pytest.plugin'

原因分析:

当程序在本地可以运行并可生成报告,但是在jenkins里面提示找不到pytest库之类的,这种情况多半是pycharm工具第三方插件安装在默认的路径中,没有跟python环境的路径一致。所以jenkins找不到,本地pycharm可以找到。

解决方法:

需要手动去pytest库(删除整个路径),删除后,在cmd中使用命令安装,安装的同时可以看到路径跟python的安装路径是一致的。

 

本机的安装路径,分成了三个:

 

另一个是python安装路径下的虚拟路径下

 

还有一个C盘下的安装路径

 

要在这三个路径里面排查,allure-pytest安装在不是python路径下,然后将其手动删除,然后在python路径下,使用命令pip install allure-pytest,重新安装

参考文章: https://www.cnblogs.com/fanxianhua/p/14379728.html

 

4.2.5 构建时Failed to initialize: Bad git executable

项目保存到git,构建的时候,提示git相关的内容报错:

ImportError: Failed to initialize: Bad git executable.

The git executable must be specified in one of the following ways:

    - be included in your $PATH

    - be set via $GIT_PYTHON_GIT_EXECUTABLE

- explicitly set via git.refresh()

验证可解决问题的方法

在执行run.py文件加上: os.environ["GIT_PYTHON_REFRESH"] = "quiet"

在执行的run.py文件加上:

 

可参考文章:https://blog.csdn.net/qq_40981822/article/details/113732838

 

4.2.6  找不到自行命名的模块,提示找不到项目

需要在系统设置下设置全局变量

https://blog.csdn.net/zy_1107615451/article/details/81133721

PYTHONPATH: 放的就是路径

 

4.2.7  生成allure报告,提示“命令行较长,生成报告失败”

Allure command命令工具没有安装成功,可以直接使用本地的地址

 

 

posted on 2022-05-25 21:06  刚刚好1  阅读(1315)  评论(0编辑  收藏  举报

导航