Net Project builds a continuous integration environment based on Jenkins + Github + Mono
Read Catalogue
- 1 installation
- 2 configuration
- 3 Testing
On servers Redhat Enterprise 6.5, Jenkins and Mono were used to build a continuous integration environment for. NET projects on the gutub. Because the company's servers in the network, access to the external network through the agent, so in many steps are added to the agent, if your server can directly access the extranet, you can remove the agent.
Back to top 1 installation
The first thing to do is to install the necessary tools on the Redhat server.
1.1 Installing Java
- Check version first, requires 1.7 and above
Java–version
Java version "1.5.0" gij (GNU libgcj) version 4.4.6 20110731 (Red Hat 4.4.6-3)
sudo yum remove Java
Sudo–s Yum Install Java-1.7.0-openjdk–nogpgcheck
Sometimes an error occurs when a PGP check is made, so this parameter is added
1.2 Installing Jenkins
sudo wget-e "http_proxy=http://proxyip:8080"-o/etc/yum.repos.d/jenkins.repo Http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm--httpproxy "http_proxy=http://proxyip:8080"--import Https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install Jenkins
Note that the above are used proxy, if your server can directly connected to the network, you can remove the proxy
1.3 Installing Mono
为了方便测试 .net 的项目,我们安装下Mono:
$ sudo yum -y install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget$ cd /usr/local/src$ sudo wget http://download.mono-project.com/sources/mono/mono-4.0.1.44.tar.bz2$ sudo tar jxf mono-4.0.1.44.tar.bz2$ cd mono-4.0.1$ sudo ./configure --prefix=/opt/mono$ sudo make $ sudo make install
export PATH=$PATH:/opt/mono/binexport PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig
参考《http://help.octopusdeploy.com/discussions/problems/39756-install-mono-on-centos-66》
Back to top 2 configuration
2.1 Starting Jenkins
CD Jenkins
sudo java–jar Jenkis.war
If the following error occurs:
Javax.jmdns.impl.HostInfo Newhostinfo
Warning:could not intialize the host network interface on NULL because of an error:MDRADEL0:MDRADEL0:Name or service n OT known
Java.net.UnknownHostException:MDRADEL0:MDRADEL0:Name or service not known
You need to change the Hosts file
Vi/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
16.173.233.21 nis-sh-02
16.173.233.20 nis-sh-01
16.173.233.20 nis-sh-01
16.173.233.20 nis-sh-01
Change to the following content:
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 localhost MDRADEL0
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
16.173.233.21 nis-sh-02
16.173.233.20 nis-sh-01
16.173.233.20 nis-sh-01
16.173.233.20 nis-sh-01
This error, I did not take the matter first, but the subsequent operation on the interface will cause a lot of errors.
If you want to start Jenkins and want to do other things on the Redhat server, you can start Jenkins in the following way:
sudo service Jenkins start
When you're done, you can open Jenkins with http://serverip:8080 on your native browser:
2.2 Configuring the Jenkins installation Plugin
Turn on system Management – Plug-in management – optional plugins
If you find that it is empty, go to the lower-right corner of the "Advanced" tab and click "Get Now".
If click "Get Now" button times wrong:
Java.net.ConnectException:Connection timed in Java.net.PlainSocketImpl.socketConnect (Native Method) at Java.net.AbstractPlainSocketImpl.doConnect (abstractplainsocketimpl.java:339) at Java.net.AbstractPlainSocketImpl.connectToAddress (abstractplainsocketimpl.java:200) at Java.net.AbstractPlainSocketImpl.connect (abstractplainsocketimpl.java:182)
See if you want to set up a proxy:
Select Git, github plugin, and MSBuild installation in the optional plugins.
System settings
Turn on system Management – system settings, set git and msbuild options:
The note here is Path to MSBuild:/opt/mono/bin/xbuild
You cannot bring the. exe behind, or you will get an error when "Build Now" later: This file cannot be found. This path, after the installation of mono, use the following command to find out:
Whereis Xbuild
Xbuild:/opt/mono/bin/xbuild
2.3 Configuration Items
Create a " build a free-style software project"
- Fill in the information for the GIT project:
To add a build step, select the "Mono" that you created earlier:
Back to top of 3 test
Click "Build Now" on the left menu:
The result of build can be seen below the build history, and red is a failure.
If it fails, you can open the "Console Output" of this failed record to see why it failed:
I created the simplest unit test project, so there would be a Microsoft.VisualStudio.QualityTools.UnitTestFramework reference, because Redhat just installed mono and did not install The. NET Framework, so the reference cannot be found, so create a new directory, add the DLL to the project, and then refer to the DLL in this directory:
Click "Build Now" again to succeed.
Net Project builds a continuous integration environment based on Jenkins + Github + Mono