有段时间没有调试jenkins代码发布功能了,今天对线上的业务进行发布功能的调试,jenkins平台之前已搭建,但因为代码一直在调试代码,今天才开始着手发布脚本的处理。碰到了一些报错,不过兵来将挡,水来土掩,有问题一个个解决:本文地址:http://www.04007.cn/article/738.html,未经许可,不得转载.
1.报错fab: not found,解决办法:未安装fabric模块本文地址:http://www.04007.cn/article/738.html,未经许可,不得转载.
[04007.test] $ /bin/sh -xe /tmp/jenkins3185626724958871636.sh + fab -f deploy/fabfile.py development deploy /tmp/jenkins3185626724958871636.sh: 2: /tmp/jenkins3185626724958871636.sh: fab: not found Build step 'Execute shell' marked build as failure Finished: FAILURE user@test:/opt/www/04007.cn# pip install fabric Installing collected packages: cffi, pynacl, cryptography, bcrypt, paramiko, invoke, fabric Found existing installation: cffi 1.1.0 Uninstalling cffi-1.1.0: Successfully uninstalled cffi-1.1.0 Found existing installation: cryptography 1.7.1 Uninstalling cryptography-1.7.1: Successfully uninstalled cryptography-1.7.1 Successfully installed bcrypt-3.1.7 cffi-1.13.2 cryptography-2.8 fabric-2.5.0 invoke-1.3.0 paramiko-2.7.1 pynacl-1.3.0本文地址:http://www.04007.cn/article/738.html,未经许可,不得转载.
2.安装fabric模块之后发布报错:Can't find any collection named 'fabfile'。在google上才知道farric2.x版本的改动挺大,不再使用fab -f 而是使用fab -r.本文地址:http://www.04007.cn/article/738.html,未经许可,不得转载.
+ fab -f deploy/fabfile.py development deploy Can't find any collection named 'fabfile'! Build step 'Execute shell' marked build as failure Finished: FAILURE #This is indeed changed! Now with newer version of Fabric 2.x you must use -r instead of -f. This is based on pyinvoke check this link pyInvoke For example: if you are in dir A and your fabfile is in dir B you will be able to call your fabfile tasks by executing this command from the command-line:fab -r path yourTaskName本文地址:http://www.04007.cn/article/738.html,未经许可,不得转载.
3.但在执行修改之后再报错:ImportError: No module named api,此还是上面fabric新版本的原因。于是重新安装了fabric本文地址:http://www.04007.cn/article/738.html,未经许可,不得转载.
from fabric.api import * ImportError: No module named api Build step 'Execute shell' marked build as failure Finished: FAILURE #指定安装fabric==1.14.0版本, user@test:/opt/www/04007.cn# pip install fabric==1.14.0 Collecting fabric==1.14.0 Installing collected packages: fabric Found existing installation: fabric 2.5.0 Uninstalling fabric-2.5.0: Successfully uninstalled fabric-2.5.0 Successfully installed fabric-1.14.0本文地址:http://www.04007.cn/article/738.html,未经许可,不得转载.
然后就调试到了python脚本中了。在使用中发现我之前发过的一篇jenkins发布脚本文章: http://www.04007.cn/article/586.html 中的exclude功能不能用。今天在这里进行了修复。本文地址:http://www.04007.cn/article/738.html,未经许可,不得转载.
本文地址:http://www.04007.cn/article/738.html 未经许可,不得转载. 手机访问本页请扫描下方二维码:
|