Skip to content

ego-component/ejenkins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ejenkins

License: MIT Example

About

A Jenkins API Client implemented in Golang based on Jenkins doc.

Installation

go get github.com/ego-component/ejenkins

Configuration

[jenkins]
addr = "http://127.0.0.1:8080" # your jenkins server address
username = "admin"
credential = "PasswordOrTokenGoesHere"
readtimeout = "2s" # timeout seconds for requesting jenkins api
debug = false # enable debug mode or not.
rawdebug = false # show raw request and response data during requesting api

Usage

// assume you have below toml configuration
var conf = `
[jenkins]
addr = "http://127.0.0.1:8080"
username = "admin"
credential = "PasswordOrTokenGoesHere"
`
// load configuration above
if err := econf.LoadFromReader(strings.NewReader(conf), toml.Unmarshal); err != nil {
    panic("LoadFromReader fail," + err.Error())
}

// init ejenkins component
jenkinsC := ejenkins.Load("jenkins").Build()

// Make calls against desired resources:
// get jenkins server basic info:
serverInfo, err := jenkinsC.Info()
// get a job
job, err := jenkinsC.GetJob("jobName", "...[parent folders]")
// invoke building process of a job
build, err := job.Invoke(payload, buildParams, securityToken)

Examples

See more examples in here

About

Jenkins API Client for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages