-- 幾個月前的學習筆記,懶得再翻譯回來了html
Continuous Integrationjava
Automatically buildlinux
Expose problems earlier.git
Common module management.github
Internal Maven Server makes building process faster.web
Set up the standard of the whole life circle of Soft Ware development.shell
Code Review Process setupapache
Build triggercentos
Automatically deploytomcat
Automatically test run : (Front end and Back End (Unit Test Framework integration))
base platforms setup
gitlab , nexus,jenkins , maven
CentOS
root @ qazwsx%1984416ssh
work dir :/home/soft
open /etc/profile
,add below text to the end
PATH=/var/opt/gitlab/git-data/repositories:$PATH export PATH
rpm -ivh
jdk-8u65-linux-x64.rpmin this case , we use the nexus 2 because it’s more friendly with maven then nexus 31
tar -xvf
nexus-latest-bundle.tar.gz/home/soft/nexus-extract/nexus-2.13.0-01/bin/nexus
vi /etc/sysconfig/iptables
add this to the end : -A INPUT -p tcp -m sate --state NEW -m tcp --dport 8081 -j ACCEPT
or ,simply turn off the iptable service by service iptables stop
<!-- release to --> <distributionManagement> <repository> <id>releases</id> <name>releases</name> <url>http://172.16.3.64:8081/nexus/content/repositories/releases/</url> </repository> </distributionManagement>
mvn help:effective-settings
to ensure that which file is currently effective)<mirror> <id>nexus-internal</id> <mirrorOf>*</mirrorOf><!-- means this nexus server would take over all the pull request from maven--> <name>nexus-internal</name> <url>http://172.16.3.64:8081/nexus/content/groups/public/</url> </mirror>
<server> <id>releases</id> <username>admin</username> <password>admin123</password> </server>
/var/opt/gitlab
/var/opt/gitlab/git-data
/etc/gitlab/gitlab.rb
gitlab-ctl
to manage the application (start,stop,tail,etc)
To change the port
vi /etc/gitlab/gitlab.rb
- Find session # GitLab Unicorn #
- Modify
unicorn['listen'] = '127.0.0.1'
,unicorn['port'] = 8090
- Apply changes :
sudo gitlab-ctl reconfigure
- Check logs
sudo gitlab-ctl tail
- Set git user’s default shell to bash :
usermod -s /bin/bash git
root
;After installation has been done,you can use that to login into the system.C:\Users\bob\.ssh>
Execute command : ssh-keygen -t rsa
C:\Users\bob\.ssh>ls id_rsa id_rsa.pub known_hosts type %userprofile%\.ssh\id_rsa.pub | clip
Go to GitLab User Profile Page,add a SSH Key like below (the key’s already in your clip)
About ssh no-pwd verify login:
After your execute the commandssh-keygen -t rsa
The generated 3 files : id_rsa, id_rsa.pub , known hosts are bound together on the client side ,and it must be under client side’s user folder (in this case :C:\Users\bob\.ssh
).
After you gave out the public keyid_rsa.pub
to the server side , where did it go?
it’s been added to the end of the file of/var/opt/gitlab/.ssh/authorized_keys
on the server side
nohup java -jar jenkins.war &
. ssh-keygen -t rsa
press ENTER till it’s done.*(this will gen 2 files 「id_rsa」,」id_rsa.pub」 under default user home 「/home/bob/.ssh」,cat id_rsa
and you’ll see the private key content )http://172.16.3.64:8180/jenkins/gitlab/build_now/eclipse_maven_web
Jenkins:
Install plugin Gitlab Hook Plugin on Jenkins ,see Usage
配置 –> Gitlab Web Hook
check the option : Trigger build also when pushing to merged branches
Project Configuration
參數化構建過程,do as follow
;
go to Branches to build
fill in with$BRANCH_TO_BUILD
enable tomcat manage console
<role rolename="tomcat"/> <role rolename="role1"/> <role rolename="admin"/> <role rolename="admin-script"/> <role rolename="manager-gui"/> <role rolename="manager-script"/> <role rolename="manager"/> <role rolename="admin-gui"/> <user username="tomcat" password="tomcat" roles="manager,manager-gui,tomcat,role1,admin,admin-gui,manager-script,admin-script"/>
tomcat/tomcat would be the user Jenkins’d use.
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
wget http://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz
install git
tar -zxvf git-2.9.0.tar.gz
cd git2.9
./configure
make
make install
git version
add git accounts on server side
useradd -g git git
passwd git
-f
means also delete user’s folder) userdel -f git
create a test repository directory
mkdir /home/soft/git/repo1
git init --bare project.git
grand authority
sudo chown -R git:git project.git
ssh setting (client side)
ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub root@192.168.56.1:~/
or you can pass your rsa key in text ,after key generating,do
cat rsa.pub
and you’ll see the rsa key content,
pass it to server admin,and he shall write that into/home/git/.ssh/authorized_keys
(real path might depends)
verify uploaded file(server side): ls ~/id_rsa.pub
try it on client side
mkdir testrepo1 cd testrepo1 git clone git@172.16.3.64:/home/soft/git/repo1/project.git