通过Web API设置Hudson构建说明 [英] Set Hudson Build Description via Web API

查看:88
本文介绍了通过Web API设置Hudson构建说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可在Hudson版本上运行的Python脚本,希望能够以编程方式设置版本的描述.

I have a Python script that operates on Hudson builds and would love to be able to set the description of a build programmatically.

我可以在构建页面上单击添加描述"并填写表格,如何将一些数据发布到与表格相同的URL中?

I can click "Add Description" on a build's page and fill in the form, how can I POST some data to the same URL that form does?

推荐答案

弄明白了,需要将以下内容作为表单数据(内容类型application/x-www-form-urlencoded)发布到

Figured it out, need to POST the following as form data (content type application/x-www-form-urlencoded) to

http://myserver/hudson/job/thebuild/10/submitDescription

{"description": "Some Description for the build"}

在代码中:

def set_description(build_url, desc):
    req_data = urllib.urlencode({'description': desc})
    req = urllib2.Request(build_url + '/submitDescription', req_data)
    req.add_header('Content-Type', 'application/x-www-form-urlencoded')
    urllib2.urlopen(req)

这篇关于通过Web API设置Hudson构建说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆