Jenkins 很方便,公司使用SVN不是GIT所以跟在保哥課程提到的方式不一樣,當然環境也是相異的(保哥是以MSBuild環境介紹),在LAMP中套用也沒有太多相異點,以此做個紀錄...
PS. 在Azure基本型A0安裝Jenkins貌似會自己Shutdown,改成A1後就正常了~很傻眼但正常就好,不曉得是1/4 CPU關係還是750M記憶體太少,總之改了很多地方都沒改善,機器等級提升就FIX囉。
Installation
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
Upgrade
sudo apt-get update
sudo apt-get install jenkins
Plugin
Once installed like this, you can update to the later version of Jenkins (when it comes out) by running the following commands:
install Subversion Plug-in
Authorized
sudo su jenkins -s /bin/bash
ssh-keygen -t rsa
scp /var/lib/jenkins/.ssh/id_rsa.pub account@remoteServer:jenkins.pub
cat /home/account/jenkins.pub >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
TEST
rsync -vzucPrl --delete-after -e ssh /SourcePath/ account@remoteServerIP:/TargetPath/
最近的雲端主機認證改成pem檔,所以rsync指令得改改如下,好處是上述的Authorized的程序可以免了:
rsync -vzucPrl -e "ssh -i 'remoteserver.pem' -o 'StrictHostKeyChecking=no'" /SourcePath/ account@remoteServerIP:/TargetPath/
補充: 執行後發現若檔案存在但變更資料是少量的RSYNC會跳過該檔,所以加上-c做checksum雖然會比較慢但總比沒更新到好,畢竟FIX Bug有時候改的只是幾個BYTE而已。
沒有留言:
張貼留言