We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
通过如下方式执行Jenkins Build,无法拿到具体的Build信息.
func job_build(jenkins *gojenkins.Jenkins,ctx context.Context,jobname string) { jobarr := strings.Split(jobname, "/") newjobname := strings.Join(jobarr,"/job/") qid,err := jenkins.BuildJob(ctx,newjobname,nil) if err != nil {panic(err)} build, err := jenkins.GetBuildFromQueueID(ctx, qid) if err != nil {panic(err)} for build.IsRunning(ctx) { time.Sleep(5000 * time.Millisecond) build.Poll(ctx) } fmt.Printf("build number %d with result: %v\n", build.GetBuildNumber(), build.GetResult())
gojenkins的版本是v1.1.0 jenkins的版本是2.4.36
The text was updated successfully, but these errors were encountered:
GetBuildFromQueueID函数 已经获取了build内容,可以直接使用
func (j *Jenkins) GetBuildFromQueueID(ctx context.Context, job *Job, queueid int64) (*Build, error) { task, err := j.GetQueueItem(ctx, queueid) if err != nil { return nil, err } // Jenkins queue API has about 4.7second quiet period for task.Raw.Executable.Number == 0 { time.Sleep(1000 * time.Millisecond) _, err = task.Poll(ctx) if err != nil { return nil, err } } build, err := job.GetBuild(ctx, task.Raw.Executable.Number) if err != nil { return nil, err } return build, nil }
Sorry, something went wrong.
No branches or pull requests
通过如下方式执行Jenkins Build,无法拿到具体的Build信息.
gojenkins的版本是v1.1.0
jenkins的版本是2.4.36
The text was updated successfully, but these errors were encountered: