Build server prototype (integration with GitHub / NuGet / etc)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
micro-build-server/README.md

3.2 KiB

micro-build-server

Motivation

TeamCity forces us to separately configure every branch on TeamCity server, which introduces an unreasonable friction for our short-lived feature dev branches, and would also force us to purchase the most expensive subscription because the cheaper ones come with a very limited number of branch configurations.

Since all our services are built more or less in a similar way, it is not very difficult to create our own build server, which is done in this repository.

Development

Install Node.js v6.

Run npm install in BuildServer directory.

Create app.ts based on app.ts.example.

To check code style or types, use npm test.

Setting up the server

Install Node.js v6.

Copy to the server build artifacts (contents of the bin\Release folder) of DotNetBuilder.

Add Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed (can be extracted out of 6.0.4 release on NuGet) and Microsoft.VisualStudio.Setup.Configuration.Interop, PublicKeyToken=b03f5f7f11d50a3a assemblies to GAC.

Clone the repo (git clone).

Run npm install in BuildServer directory.

Create app.ts based on app.ts.example (in order to use it in IIS set the value port: process.env["PORT"]). Values of gitpath, releasepath, tmpcodepath should be as short as possible.

Check that app.ts is correct by running npm test.

Build by npm build or npm run build.

Run by npm start or node app. In order to use in IIS, install iisnode, and create a new website in IIS, pointing to the BuildServer directory (the one with Web.config).

Depending on the system, you might also have to install Microsoft .NET Targeting Pack and appropriate version of Windows SDK to the server.

Updating the server

git pull origin master
npm test
npm run build

Usage

In the settings of a target repository (and all its forks), add a webhook pointing to https://micro-build-server/github/postreceive.

In target repository, create an mbs.pos file with contents of the following form:

{
	"type": "sequential",
	"params": {
		"tasks": [
			{
				"type": "dotnetbuild",
				"params": {
					"solution": "Legacy.Processing.Common.sln",
					"forceCodeAnalysis": "true"
				}
			},
			{
				"type": "dotnetnugetprocess",
				"params": {
					"masterRepoOwner": "Legacy",
					"nuspecName": "Legacy.Processing.Common",
					"major": "4"
				}
			}
		]
	}
}

All supported task types and their parameters are declared in BuildServer\lib\tasks.

In order to implement a new task type, create a new yourtaskname.ts in that directory.

This will automatically add build status comments to your PRs, and automatically close PRs when needed.

In order to display a badge with the build status for the relevant branch, add the following line to README.md of the target repository:

![Status](https://micro.build.server/status.svg)

Or alternatively, manually go to the page with the build report, by changing the URL in the address bar from https://github.enterprise/what/ever to https://micro.build.server/github.enterprise/what/ever.

In both cases, it will display the build status of the relevant branch or commit.