十七、Jenkins(centos7系统)运行python3代码
source /usr/python/envs/everyday/bin/activate #激活python3 虚拟环境
创建虚拟环境:https://blog.csdn.net/qq_42846555/article/details/131579627
source /usr/python/envs/everyday/bin/activate #激活python3 虚拟环境
#读取版本号和更新版本号
version_info="{'version':'v1.1.0.web','build_number':'$BUILD_NUMBER','version_file':r'${WORKSPACE}/public/version.txt','version_type':'alpha','BUILD_TIME':'$BUILD_TIMESTAMP'}"
python3 /jenkins/jks/version_number_reading_and_writing.py "$version_info"
#打包vue项目
rm -rf dist
npm install --registry=https://registry.npmmirror.com
npm run build:prod
#发送构建完成消息
notice="{'BUILD_URL':'$BUILD_URL','JOB_NAME':'$JOB_NAME[dev]','BUILD_NUMBER':'$BUILD_NUMBER','SCM_CHANGELOG':'$SCM_CHANGELOG','SERVES_URL':'http://192.168.1.202:8062','Package_URL':'${JOB_URL}ws/dist/*zip*/dist.zip','WEBHOOK':'https://open.feishu.cn/openapis/bot/v2/hook/2d0b6','version_file':r'${WORKSPACE}/public/version.txt','BUILD_TIME':'$BUILD_TIMESTAMP'}"
python3 /jenkins/jks/send_notice.py "$notice"
deactivate #退出python3 虚拟环境