如果你是刚拿到一台mini,又刚好是只有无线鼠标。这里有个小技巧,通过键盘来让mini链接鼠标
https://www.cnblogs.com/xiaoqi/p/docker-jenkins-cicd.html
1、安装Docker
- 下载Docker 下载地址
2、搭建jenkins环境
http://www.cnblogs.com/zhanggui/p/6227832.html
附:
卸载Jenkins
更改jenkins主题
一些采坑记录
jenkins jobs迁移
3、安装Jenkins相关插件
jenkins初始化如果选的是新手的话,会默认安装一些常用的插件
- Git
- Gradle
- Git Parameter
- TAPD Plugin
4、安装Xcode、AndroidStudio、VSCode
5、安装ReactNative环境
// 安装brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update // 更新brew
brew doctor // 确保brew是安全可靠的
// 使用brew安装node和npm
brew install node
brew install npm
// 安装nrm来管理npm源
npm install nrm -g
nrm add taobao https://registry.npm.taobao.org/ // 添加淘宝源
// 安装react-native环境
npm install -g yarn react-native-cli
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
// 安装Cocopods(Xcode包管理工具)
sudo gem install cocoapods
pod install
// 如果pod install执行失败,就执行下面的,失败了就多执行几次
pod setup
// 私服sinopia配置
# 添加npm私有源
nrm add sinopia 私有服务地址
# 切换到私有源
nrm use sinopia
# 登录私有源
npm login
Username: 私有服务用户名
Password: 私有服务密码
Email: 私有服务邮箱
// 需要对@符号的库进行重定向到npm的公服,不然无法解析,会报错
npm config set "@babel:registry" http://registry.npmjs.org/
npm config set "@sentry:registry" http://registry.npmjs.org/
npm config set "@react-navigation:registry" http://registry.npmjs.org/
npm config set "@react-native-community:registry" http://registry.npmjs.org/
npm config set "@jest:registry" http://registry.npmjs.org/
npm config set "@cnakazawa:registry" http://registry.npmjs.org/
npm config set "@types:registry" http://registry.npmjs.org/
6、Facebook依赖库的配置
- 下载FacebookSDK
- 把FacebookSDK放入
~/Documents/
目录下 - 把Bolts、FBSDKCoreKit、FBSDKLoginKit、FBSDKShareKit拖到工程的Frameworks目录下
- ok
https://developers.facebook.com/docs/ios/getting-started/
7、fastlane安装
// 安装xcode命令行工具(如果安装了Xcode,该工具会自动安装)
xcode-select --install
// 安装ruby版本管理工具rvm
curl -L get.rvm.io | bash -s stable
// 更新ruby到2.4.1
rvm install 2.4.1
rvm use 2.4.1
// 安装fastlane
sudo gem install fastlane -NV
常见错误和解决方案:
- fastlane安装中遇到的问题
- "Could not find bundler" error
执行 gem install bundle
- Unable to locate Xcode. Please make sure to have Xcode installed on your machine
在Xcode中没有设置“Command Line Tools”:打开Xcode偏好设置,选择"Locations"选项卡,选择相应的“Command Line Tools”即可
8、fastlane配置
配置git
iOS使用fastlane match来管理代码签名
使用fastlane match自动和手动管理证书
iOS 用fastlane进行团队证书管理
Fastlane证书管理(二):match
常见错误和解决方案
-
Could not retrieve response as fastlane runs in non-interactive mode
问题分析:
这个问题是由于本地有持续集成的环境变量,导致交互模式的命令会不去执行,所以解决办法就是在执行命令前先把这些环境变量取消
问题解决:
unset TRAVIS CI JENKINS_HOME JENKINS_URL APPCENTER_BUILD_ID && 你的命令
fastlane源码中的判断
9、jenkins 中 shell 脚本
暂时不公布
10、基于钉钉办公软件做打包推送
- 在jenkins构建后操作中添加两个
Post build task
- 打包成功的脚本
if [ ${SendNotification} == true ];then
# 钉钉自定义机器人access_token
API_KEY="xxxx"
SERVER_LIST=$(cat $JENKINS_HOME/jobs/$JOB_NAME/builds/lastSuccessfulBuild/log | tr "," "\n" | grep "SSH: Disconnecting configuration" | awk -F" " 'BEGIN{ORS=","} {print $4}'|sed 's/.$//'| sed "s/,grep,Disconnecting//")
# 发送消息到钉钉
curl "https://oapi.dingtalk.com/robot/send?access_token=${API_KEY}" -H 'Content-Type: application/json' -d '{"msgtype": "markdown", "markdown": {"title":"有新包出炉啦(iBer)","text": "
<font color=#3396FA>'${BUILD_USER}'</font> 执行 <font color=#3396FA>'${JOB_NAME}'</font> 打包 **<font color=#3396FA>成功</font>**
> CodeBranch:'${GIT_BRANCH}'\n
> AppVersion:'${AppVersion}'\n
> AppBuild:'${AppBuild}'\n
> ProjectType:'${ProjectType}'\n
> ReleaseType:'${ReleaseType}'\n
[查看APP>>](https://www.pgyer.com/my)
"}}'
fi
- 打包失败的脚本
if [ ${SendNotification} == true ];then
# 钉钉自定义机器人access_token
API_KEY="xxxx"
SERVER_LIST=$(cat $JENKINS_HOME/jobs/$JOB_NAME/builds/lastSuccessfulBuild/log | tr "," "\n" | grep "SSH: Disconnecting configuration" | awk -F" " 'BEGIN{ORS=","} {print $4}'|sed 's/.$//'| sed "s/,grep,Disconnecting//")
curl "https://oapi.dingtalk.com/robot/send?access_token=${API_KEY}" -H 'Content-Type: application/json' -d '{"msgtype": "markdown", "markdown": {"title":"打包失败啦(iBer)","text": "
<font color=#FD5C2D>'${BUILD_USER}'</font> 执行 <font color=#FD5C2D>'${JOB_NAME}'</font> 打包 **<font color=#FD5C2D>失败</font>**
> CodeBranch:'${GIT_BRANCH}'\n
> AppVersion:'${AppVersion}'\n
> AppBuild:'${AppBuild}'\n
> ProjectType:'${ProjectType}'\n
> ReleaseType:'${ReleaseType}'\n
[查看错误信息>>]('${BUILD_URL}')
"}}'
fi
11、基于企业微信办公软件做打包推送
- 在jenkins构建后操作中添加两个
Post build task
- 打包成功的脚本
if [ ${SendNotification} == true ];then
# 企业微信机器人api_key
API_KEY="xxxx"
SERVER_LIST=$(cat $JENKINS_HOME/jobs/$JOB_NAME/builds/lastSuccessfulBuild/log | tr "," "\n" | grep "SSH: Disconnecting configuration" | awk -F" " 'BEGIN{ORS=","} {print $4}'|sed 's/.$//'| sed "s/,grep,Disconnecting//")
# 发送消息到企业微信
curl -s -X POST \
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"info\">'${BUILD_USER}'</font> 执行 <font color=\"info\">'${JOB_NAME}'</font> 打包 **<font color=\"info\">成功</font>**
> CodeBranch:'${GIT_BRANCH}'
> AppVersion:'${AppVersion}'
> AppBuild:'${AppBuild}'
> ProjectType:'${ProjectType}'
> ReleaseType:'${ReleaseType}'
[查看APP>>](https://www.pgyer.com/my)"
}
}'
fi
- 打包失败的脚本
if [ ${SendNotification} == true ];then
# 企业微信机器人api_key
API_KEY="xxxx"
SERVER_LIST=$(cat $JENKINS_HOME/jobs/$JOB_NAME/builds/lastSuccessfulBuild/log | tr "," "\n" | grep "SSH: Disconnecting configuration" | awk -F" " 'BEGIN{ORS=","} {print $4}'|sed 's/.$//'| sed "s/,grep,Disconnecting//")
curl -s -X POST \
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"warning\">'${BUILD_USER}'</font> 执行 <font color=\"warning\">'${JOB_NAME}'</font> 打包 **<font color=\"warning\">失败</font>**
> CodeBranch:'${GIT_BRANCH}'
> AppVersion:'${AppVersion}'
> AppBuild:'${AppBuild}'
> ProjectType:'${ProjectType}'
> ReleaseType:'${ReleaseType}'
> HotType:'${HotType}'
> HotBundle:'${HotBundle}'
[查看错误信息>>]('${BUILD_URL}'console)"
}
}'
fi
12、给局域网其他机器访问
13、RN报错收集
- Android 报 glog-0.3.4/test-driver Couldn’t follow symbolic link
解决方案:在项目根目录下执行下面命令
unlink node_modules/react-native/third-party/glog-0.3.4/test-driver
- Xcode10降到Xcode9.4
网友评论