hubot jenkins.coffee存储松弛的用户ID

时间:2017-08-30 14:39:41

标签: jenkins coffeescript slack hubot

当hubot回复请求时,我无法为存储松弛用户ID的位置提供资金。我希望hubot将该值与job命令一起传递给jenkins。通过params对象将其粘贴到请求上

  robot.respond /j(?:enkins)? build ([\w\.\-_ ]+)(, (.+))?/i, (msg) ->
    jenkinsBuild(msg, false)

是否在msg对象中?

jenkinsBuild = (msg, buildWithEmptyParameters) ->
    url = process.env.HUBOT_JENKINS_URL
    job = querystring.escape msg.match[1]
    params = msg.match[3]
    command = if buildWithEmptyParameters then "buildWithParameters" else "build"
    path = if params then "#{url}/job/#{job}/buildWithParameters?#{params}" else "#{url}/job/#{job}/#{command}"

    req = msg.http(path)

1 个答案:

答案 0 :(得分:0)

post

中找出答案

slackid是msg.message.user.name