从此贴开始整理工作中遇到的奇怪需求和奇怪问题。。。。
1、同时出adhoc和appstore包
需求:满足发布iOS版本的时候同时出adhoc和appstore包
解决:使用gym出archive版本,然后用两种exoptionplist同时出ipa包。
1 2 3 4
| DEVELOPER_DIR="/Applications/Xcode.app" xcodebuild -exportArchive -archivePath ${archive_path} -exportPath ${ipa_name_adhoc} -exportOptionsPlist ${ExoptionPlist_adhoc}
|
遇到问题:appstore包可以正常出,但是adhoc包出不来failed,报错提示为:
1 2 3 4
| DEDistribution: Step failed: <IDEDistributionThinningStep: 0x7fda446c5d90>: Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo=0x7fda44b61b80 {NSLocalizedDescription=No applicable devices found.} error: exportArchive: No applicable devices found.
|
问题解决:
1 2
| sudo gem install CFPropertyList rvm use system
|
期间可能会遇到fastlane命令失效的情况,重装fastlane即可。注意rvm use system
之前需要通过rvm list
验证一下,如果有多个ruby版本可以删除不需要的版本,通过sudo remove ruby xxxx
进行。
2、优化git parameter同步分支和TAG速度
需求:使用git parameter同步分支和TAG速度太慢,而且最重要的是git parameter不支持Multiple SCMs来拉取代码。
解决:使用插件Dynamic Choice Parameter,并加入groovy脚本
1 2 3 4 5 6 7 8
| #!/usr/bin/groovy def gettags = ("git ls-remote -h 【git repo地址】").execute() text = gettags.in.text.readLines() branch = text.collect{it.split()[1]} //这里的branch可以随意匹配,我这里是为了只取branch,去掉包含sandbox分支 branch_text = branch.grep(~/refs\/heads.*/).grep(~/^((?!(sandbox)).)*$/) .collect{el->el.replaceAll("refs/heads/", "")} branch_text.unique()
|
遇到问题:对groovy的正则匹配使用不熟悉,感觉groovy作为脚本语言,的确使用上更加便捷,对于groovy的语法,可以参考https://my.oschina.net/wstone/blog/389449。
3、jenkins执行ruby -v和slave上执行ruby -v版本不一致
问题:jenkins上执行pilot upload -d一直提示没有这个参数,但是本地执行却没有报错。
分析:出现的原因可能是之前执行过一句话:
现象是jenkins执行ruby -v是2.2.0版本,然后我在slave上执行rvm list,看不到ruby 2.2.0的版本,只交代最后的解决的过程,其他不表了。
1 2
| 只要在执行slave上打包命令之前加上 #!/bin/bash -xl
|
4、jenkins执行gradlew打包,虽然BUILD FAILED,但是结果仍然是SUCCESS
需求:在构建任务过程中,如若出现BUILD FAILED,则告知打包是失败的。
解决:使用插件Jenkins Text Finder
1 2
| 勾选Also serach the console output Regular expression 填写BUILD FAILED
|
这样就能把构建失败的结果告知出来。
5、在使用python flask模块过程中,已经安装了flask库的情况下,依然有报错
报错提示:
1 2 3 4 5 6
| Traceback (most recent call last): File "test.py", line 1, in <module> from flask import Flask File "/home/pi/programs/flask.py", line 1, in <module> from flask import Flask ImportError: cannot import name Flask
|
解决:让我对pyc有了稍微深的一点理解,我的python也不到家,需要补的东西太多,时间不够,继续努力吧。。。。。
1
| Delete your local files that you named flask.py flask.pyc
|
6、需要配置一个可以让外网访问的端口号
(1)检查端口是否打开,以8000
为例:
(2)检查linux版本:
(3)确认debian版本添加开启端口号:
1 2
| sudo iptables -A INPUT -p tcp --dport 8000 --jump ACCEPT iptables-save
|
(4)隐藏执行python flask命令:
1
| gunicorn router:app -p router.pid -b 0.0.0.0:8000 -D
|
(5)取到pid,并kill应用进程:
1 2 3
| cd workspace cat router.pid kill `cat router.pid`
|