bndr/gojenkins

params in buildJob not working

Open

#164 opened on 2018年12月13日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)Go (454 forks)github user discovery
help wanted

Repository metrics

Stars
 (903 stars)
PR merge metrics
 (PR metrics pending)

説明

I have the follow code:

func main() {
	jenkins := gojenkins.CreateJenkins(nil, "http://localhost:8080/", "master", "master")
	jenkins, err := jenkins.Init()
	if err != nil {
		panic(err)
	}
	i, err := jenkins.BuildJob("github-api", "Tags", "@ID12345")
	if err != nil {
		panic(err)
	}
	fmt.Println(i)
}

but the params are not going to jenkins, go empty if I force the function to complete the parameters, these values ​​will go correctly for the jenkins example:

func (j *Jenkins) BuildJob(name string, options ...interface{}) (int64, error) {
	job := Job{Jenkins: j, Raw: new(JobResponse), Base: "/job/" + name}
	var params map[string]string
	if len(options) > 0 {
		params, _ = options[0].(map[string]string)
		params = map[string]string{}
		params["Tags"] = "@ID12345"
	}
	fmt.Println(params)
	return job.InvokeSimple(params)
}

コントリビューターガイド