cat Dockerfile | docker build -t jenkins -
mkdir -p /git /data/jenkins/jobs
id=$(docker run -v /git:/git -v /data/jenkins/jobs:/data/jenkins/jobs -d jenkins)
echo "jenkins running in container $id listening on port $(docker port $id 8080)"
mkdir -p /git/golang_project.git
cd /git/golang_project.git && git init --bare
Jenkins is bound to the port specified in jenkins running in container
.
Use /git/golang_project.git
as your git repository
Use this as Execute shell
task:
#!/bin/bash
set -e
make test
make
Enable build artifacts in Post-build Actions. Use bin/*
as pattern. Obviously you should place your go binaries in bin/ when building.
git remote add build <user>@<serverip>:/git/golang_project.git
git push build master
Click on Build Now
in Jenkins.
- Enable SCM polling
- Create a post commit hook