Jenkins
-
安裝java8 jdk
sudo apt-get update sudo apt-get install openjdk-8-jdkgit
-
安裝jenkins
sudo apt-get update sudo apt-get install jenkins
問題:
-
在ubuntu 18.04上測試發現。使用官網linux ununtu安裝方法安裝之後。啓動jenkins成功,並且開啓防火牆以及阿里雲安全組也配置了8080端口。任然無法通過ip:8080訪問jenkins
解決:卸載重新安裝
-
卸載
# 服務 sudo apt-get remove jenkins # 安裝包,注意這裏如果不是ubuntu那就yum sudo apt-get remove --auto-remove jenkins # 配置和數據 sudo apt-get purge jenkins sudo apt-get purge --auto-remove jenkins
-
apt-get直接安裝,不配置其他內容
sudo apt-get install jenkins
-
-
-
啓動jenkins
sudo systemctl start jenkins 或 sudo /etc/init.d/jenkins [start|restart|stop]
- 當遇到
Job for jenkins.service failed because the control process exited with error code.
報錯,運行systemctl status jenkins.service
查看詳細報錯內容
- 當遇到
-
jenkins配置修改
vim /etc/default/jenkins
-
jenkins初始密碼文件地址
/var/lib/jenkins/secrets/initialAdminPassword
-
jenkins插件安裝速度慢
-
jenkins輸入密碼之後頁面一直加載(被牆)https://www.cnblogs.com/yoyoketang/p/12115432.html
按照以上方法並未找到文件。
- 輸入ip:8080/pluginManager/advanced
- 修改Update Site爲
http://mirror.xmission.com/jenkins/updates/update-center.json
- 點擊submit之後,重啓jenkins服務
-
更改下載源https://cloud.tencent.com/developer/article/1563303
vim /var/lib/jenkins/updates/default.json
- 輸入
:
,然後輸入1,$s/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g
- 再輸入
1,$s/http:\/\/www.google.com/https:\/\/www.baidu.com/g
- 保存退出
:wq
- 重啓jenkins服務
-
-
jenkins漢化
http://ip:8080/pluginManager/available
安裝locale和Localization: Chinese (Simplified)插件- 重啓服務
-
Jenkins 拉取git代碼失敗
確認是否添加git憑據
插件
pipeline
有多種類型,多分支流水線
和gitHub Organization
可以讀取項目中Jenkinsfile
執行構建,其餘均需手動加入構建
例子
-
使用github webhooks觸發腳本自動構建
在jenkins上設置好身份驗證令牌之後,在github-》setteing-》webhook中設置
-
發送郵件
-
Manage jenkins -> configure system -> jenkins location設置郵箱,不設置,會出現問題2中場景
-
本文用qq郵箱,需開啓qq郵箱smtp,詳情請google
-
Manage jenkins -> configure system->Extended E-mail Notification設置smtp信息
- 注意打開 Allow sending to unregistered users,否則會出現問題1場景
- 某些情況還需配置郵件通知(使用默認郵件通知)
- 測試郵箱是否可以發送成功
- 在項目的配置中選擇editable email notification,配置發送郵箱
-
問題
-
Not sending mail to unregistered user [email protected] because your SCM claimed this was associated with a user ID ‘xxx’ which your security realm does not recognize; you may need changes in your SCM plugin
-
Failed to send to email(測試郵件是否可以成功發送的時候,一直報錯Can’t send command to SMTP host)
manage jenkins -> configure system ->jenkins location 設置系統管理員郵箱即可