android使用jenkins自動構建
阿新 • • 發佈:2018-11-23
首先安裝jenkins,前面已經介紹了,如果不想用docker叢集的模式,也可以在docker直接起jenkins
環境:mac一臺
1:安裝docker:Docker.dmg官網下載即可
mkdir -p /Users/xxx/develop/jenkins //掛載jenkins家目錄
docker run -p 8080:8080 -p 50000:50000 -d -v /Users/xxx/develop/jenkins:/var/jenkins_home -e TZ=‘Asia/Shanghai’ --restart=always jenkins/jenkins
一行命令jenkins就起來了
然後開啟瀏覽器 127.0.0.1:8080 記得輸入密碼,如果找不到可以使用下面的命令
find / -name initialAdminPassword
2:下面主要介紹jenkins配置:
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105000116333.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105000222783.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
以上配置均在agent節點安裝好jdk和gradle,然後連線本機作為agent(也可以遠端伺服器)
mac開啟ssh:
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
然後配置連線agent憑據:
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/2018110500060633.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105000628961.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/2018110500071438.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105001028647.png)
同時需要設定ANDROID_HOME
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105001126944.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105001154606.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105001752220.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105001808303.png)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/2018110510474484.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
好了,開始構建我們的測試專案
建立一個自由風格專案
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105001541609.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105001717623.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105002035705.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105002050672.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
看下我們構建後的日誌輸出:
![在這裡插入圖片描述](https://img-blog.csdnimg.cn/20181105002310181.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM1Mjk5ODYz,size_16,color_FFFFFF,t_70)
好了,成功了!
歡迎留言