Continuous Delivery with Go: Part 1

Continuous Delivery is a piece of the startup world that's still not well served by most open source alternatives. Jenkins has brought a whole world of mysterious failures into my life, and the emergent players in the CI space (drone, codeship, circleci) etc. haven't brought a seamless experience to the build pipeline space yet. A few of these tools are very flexible and can probably support your needs, but will require about as much work to customize as rolling your own.

Go is a tool that came out of the ThoughtWorks project CruiseControl, and reflects their belief in continuous delivery.

Setup
#If you don't have a java runtime, let's get one. There's some UI you're going to need to click on. 
sudo apt-get install python-software-properties  
sudo add-apt-repository ppa:webupd8team/java  
sudo apt-get update  
sudo apt-get install oracle-java8-installer

#You need unzip too.
apt-get install unzip

#Get go-server 
wget http://download.go.cd/gocd-deb/go-server-14.2.0-377.deb  
sudo dpkg -i go-server-14.2.0-377.deb 

#Get go-agent (we're installing it on the same server)
wget http://download.go.cd/gocd-deb/go-agent-14.2.0-377.deb  
sudo dpkg -i go-agent-14.2.0-377.deb  

At this point, if you need to stop or start the go server, you should be able to do so using standard linux service tools.

# Starting the process
sudo service go-server start  
sudo service go-agent start

# If you need to stop the process
sudo service go-server stop  
sudo service go-agent stop  

One last thing you may want to do is set up authentication. I used the password file approach, documented in the file based authentication section of the docs. The one thing to note is that it uses plain SHA for the passwords, so you need to use a different password then you use for other services.

Making a Pipeline

Now, you should be able to see your go instance in the browser at host:8153/go. Name your pipeline and then at the next step, you can add a set of materials that your repository depends on. In this case, I wanted to add a github repository, however initially an error reminded me git wasn't installed.

sudo apt-get install git  

and then you'll need to generate ssh keys and add them to your github for your go user.

sudo -u go /bin/bash # become go user.  
ssh-keygen -t rsa -C "go@yourdomain.com"  
cat id_rsa.pub  

Copy the output of the pub key into github's deploy keys. Then try the ls-command on the repo you want to be able to acces

#For example, this is one of my repos. 
git ls-remote git@github.com:estsauver/geojson-schema.git  

Then I defined a build stage that I wanted to execute. There's built in support for ant and rake, but any shell command you want can be executed that is supported by the server running the agent.

In part 2, we'll install docker and build images that don't require any non docker dependencies, and can be tested locally.