📜 ⬆️ ⬇️

Another CCnet + SVN Manual

Cruise Control is one of a fairly large number of CI (continuous integration) systems. It's about how to set it up to communicate with SVN and deploy a site to .NET.

First, a little about the tasks of the CC on this server:


Next will be posted pieces of the configuration file, with comments on each at least somehow interesting line. In pieces, the full working config is actually laid out.
')
So, block internal secirty:
<internalSecurity> <users> <passwordUser name="Dude"> <display>Dude the Builder</display> <password>blah-blah-blah</password> </passwordUser> </users> <permissions> <rolePermission name="Builders"> <forceBuild>Allow</forceBuild> <defaultRight>Deny</defaultRight> <viewProject>Allow</viewProject> <users> <userName> <name>Dude</name> </userName> </users> </rolePermission> </permissions> </internalSecurity> 


Parameters from the category of the simplest - Username, how to display it in the system and, finally, the password.
The permissions permissions are, strictly speaking, the creation of a group of users. Force build - the ability to run the build manually, view project - the ability to view projects. Both are desirable to add for the user who will work with the system. Color users - add a user to the group. That's all, briefly in terms of security.

Next begins the project branch. For convenience, it will be divided into several blocks.
The first part is the main announcement.
 <project name="mysite"><workingDirectory>C:\develop\CCnet\mysiteCCnetMain</workingDirectory> <artifactDirectory>C:\develop\CCnet\mysiteCCnetArtifacts</artifactDirectory> 

With the first and second lines, everything is simple - this is the declaration of the project name, and the working folder of the project. The third folder sometimes introduces in doubt. So - there are stored byproducts of the build - logs, for example.

The second part is the source control.
  <sourcecontrol type="svn"> <executable>C:\Program Files (x86)\VisualSVN Server\bin\svn.exe</executable> <trunkUrl>https://127.0.0.1:443/svn/someproject</trunkUrl> <username>user</username> <password>passwd</password> </sourcecontrol> 

Where you specify the path to the executable file that can pick up files from the repository, the path to the project repository itself (in this case it was on the same machine, which is not necessary), it is important to specify users with access to a specific repository in user and passwd .

The third part is the tasks branch. In this thread are commands for fulfillment. In it, you can call, for example, even your own scripts.
  <exec> <executable>iisreset</executable> <buildArgs>/stop</buildArgs> </exec> 

We stop IIS to solve possible problems of simultaneous use of resources (in my case, this can be done later, right before copying to the folder to IIS, however, it is often useful to turn it off in advance. Of course, if compiling and downloading the project does not take astronomical time). In principle, only a single project can be turned off. Read more about this in the links below.

 <msbuild> <executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable> <projectFile>mysite.sln</projectFile > <buildArgs> /p:Configuration=Debug </buildArgs> <targets>ReBuild</targets > <timeout>600</timeout > </msbuild> 

Unfortunately, I don’t have much to say about this block. The link to the executable file, the name of the file that is transferred to it (the actual relative path to it from workingfirektory), the call parameters and the time allotted for compilation.

  <exec> <executable>robocopy.exe</executable> <baseDirectory>C:\develop\CCnet\mysiteCCnetMain</baseDirectory> <buildArgs>.\ C:\Inetpub\vhosts\mysite\httpdocs *.* /E /XA:H /PURGE /XO /XD ".svn" /NDL /NC /NS /NP</buildArgs> <buildTimeoutSeconds>300</buildTimeoutSeconds> <successExitCodes>1,0</successExitCodes> </exec> 

Robokopi is a standard console utility for copying, starting with win7 / 2008, since I had the second - I did not bother to download the link. So - the parameters.
executable - either as it is for new windows, or file path for old ones.
baseDirectory - The folder that robokopi will consider starting.
buildargs - in order -. \ - means that we will be copying directly from the starting folder.
The second parameter - the path to the folder - where to copy. *. * - copy mask. further in order
/ E - recursive copying of subdirectories
/ XA: H - copy hidden files
/ PURGE - Substitution removal
/ Xo - Do not copy old
/ XD "" Exclude the directory specified in quotes from copying
/ NDL / NC / NS / NP - do not show the copy report

buildTimeoutSeconds - time to execute. Sometimes it is not enough, which can also be a mistake.
successExitCodes - exit codes for which we consider the operation successful. You can just leave it like that.

  <exec> <executable>iisreset</executable> <buildArgs>/start</buildArgs> </exec> 


Run back IIS. At the end of the tasks.

And, finally, the last but no less important part - the admission to the project:

 <security type="defaultProjectSecurity"> <defaultRight>Deny</defaultRight> <permissions> <rolePermission name="Builders" ref="Builders" /> </permissions> </security> 

Here, in fact, the default access rule is declared, and the group that is allowed to manage the project.

A little about the pitfalls I have encountered.


The first problem is a lack of trust in the SVN certificate.
Solution: Log in to the system from under the user under which ccnet runs, make it out of the svn update console, from the required repository. And when there is a question about a certificate, enter p - what will accept permanent

The second problem - RPC. Server crashes with RPC unavailable.
Solution: In fact - the parameters were incorrectly specified.

The remaining problems did not cause unobvious approaches to the solution.

Used literature:
Omar Al Zabir article

Source: https://habr.com/ru/post/131279/


All Articles