bndr/gojenkins

params in buildJob not working

Open

#164 创建于 2018年12月13日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Go (454 fork)github user discovery
help wanted

仓库指标

Star
 (903 star)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南