Go library that talks with Jenkins API. Supports AppEngine as well.
go get github.com/medisafe/jenkins-api/jenkins
jenkinsApi := Init(&Connection{
Username: "sromku",
AccessToken: "001122334455667788",
BaseUrl: "http://jenkins.sample.com:8080",
})
jobs, err := jenkinsApi.GetJobs()
job, err := jenkinsApi.GetJob("android-mobile")
For example, build number 196 of job called android-mobile
build, err := jenkinsApi.GetBuild("android-mobile", 196)
With params:
jenkinsApi.StartBuild("android-mobile", map[string]interface{} {
"branch" : "master",
"build" : "staging",
})
-
Get user that triggered the build:
user, err := build.GetUser()
-
Get upstream job that triggered the build:
upstream, err := build.GetUpstreamJob()
-
Get param values by param name:
branchName, err := build.GetParamString("branch")
-
Get tests results:
testResults, err := build.GetTestResults()
Initialize and continue as usual
c := appengine.NewContext(r)
client := urlfetch.Client(c)
jenkinsApi := Init(&Connection{
Username: "sromku",
AccessToken: "001122334455667788",
BaseUrl: "http://jenkins.sample.com:8080",
Http: client,
})