Skip to content

zbd20/jenkins-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jenkins-api

Go library that talks with Jenkins API. Supports AppEngine as well.

Install

go get github.com/medisafe/jenkins-api/jenkins

Usage

Initialize api connection
jenkinsApi := Init(&Connection{
	Username: "sromku",
	AccessToken: "001122334455667788",
	BaseUrl: "http://jenkins.sample.com:8080",
})
Get all jobs
jobs, err := jenkinsApi.GetJobs()
Get job
job, err := jenkinsApi.GetJob("android-mobile")
Get build

For example, build number 196 of job called android-mobile

build, err := jenkinsApi.GetBuild("android-mobile", 196)
Start new build

With params:

jenkinsApi.StartBuild("android-mobile", map[string]interface{} {
	"branch" : "master",
	"build" : "staging",
})
Build details
  • 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()

For AppEngine users

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,
})

Documentation

About

Go library that talks with Jenkins API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%