hubot-github-tfs

0.9.4 • Public • Published

Build Status

hubot-github-tfs

A Hubot script to integrate GitHub and Microsoft Team Foundation Server (TFS). You can now automatically trigger a TFS build following a push on a pull request and get the build result back.

Installation

  • In hubot project repo, run:

npm install hubot-github-tfs --save

  • Then add hubot-github-tfs to your external-scripts.json:
[
  "hubot-github-tfs"
]
  • Set the following environment variables in the shell where Hubot is running
Variable Required/Optional Comments
HUBOT_TFS_SERVER required Ip or DNS name of the TFS server
HUBOT_TFS_USERNAME required TFS username
HUBOT_TFS_PASSWORD required Password of the TFS user
HUBOT_TFS_GITHUB_PAT optional Personal Access Token of the GitHub user with repo:status permission. This will be used to update the pull request status.
HUBOT_TFS_PROTOCOL optional default to https
HUBOT_TFS_PORT optional default to 80 for http and 443 for https
HUBOT_TFS_URL_PREFIX optional default to /
HUBOT_TFS_DEFAULT_COLLECTION optional default to defaultcollection
  • Create a webhook on your GitHub repo for the Push event with the following URL :
http://<hubot_server>/hubot/github-tfs/build/<room>
  • Create a webhook on TFS with the following URL so Hubot can receive the notification back
http://<hubot_server>/hubot/github-tfs/build-result/<room>
  • Make sure the IIS server running TFS as basic authentication enabled.

Sample Interactions

Get some help

**user1**>> hubot tfs-build help
**hubot**>>Here's what I can do with TFS builds :
tfs-build list builds for <project>
tfs-build list builds for <project> from <collection>
tfs-build queue <project> with def=<definition id>
tfs-build queue <project> from <collection> with def=<definition id> branch=<branch name>
tfs-build list definitions for <project>
tfs-build list definitions for <project> from <collection>
tfs-build rem all
tfs-build rem about <org>/<repo>
tfs-build forget about <org>/<repo>
tfs-build rem <org>/<repo> builds with <project>/<definition id>
tfs-build rem <org>/<repo> builds with <project>/<definition id> from <collection>

List builds

**user1**>> hubot tfs-build list builds for SpidersFromMars
**hubot**>>
----------------------------------------------------------------------------------------
| Build       | Status   | Result  | Branch             | Definition                   |
----------------------------------------------------------------------------------------
|20160407.2   |completed |succeeded|master              |SpidersFromMars on github.com |
|20160407.1   |completed |failed   |master              |SpidersFromMars on github.com |
|20160331.19  |completed |succeeded|master              |SpidersFromMars on Octodemo   |
|20160331.18  |completed |failed   |master              |SpidersFromMars on Octodemo   |
|20160331.17  |completed |succeeded|syntaxerror         |SpidersFromMars on Octodemo   |
|20160331.16  |completed |failed   |synataxerror        |SpidersFromMars on Octodemo   |
----------------------------------------------------------------------------------------

List build definitions for a project

**user1**>> hubot tfs-build list definitions for SpidersFromMars
**hubot**>> Found 1 results for SpidersFromMars in
**hubot**>>
--------------------------------------
| ID  | Name                         |
--------------------------------------
|1    |SpidersFromMars on Octodemo   |
--------------------------------------

Remind me which build definition is used to automatically trigger the build of a repository

**user1**>> hubot tfs-build rem about OctoCheese/SpidersFromMars
**hubot**>> OctoCheese/SpidersFromMars builds with defaultcollection/SpidersFromMars/1

Automatically build in TFS following a push in GitHub

**user1**>> hubot tfs-build rem OctoCheese/SpidersFromMars builds with SpidersFromMars/1
**hubot**>> Saved build setting for SpidersFromMars. Now building with defaultcollection/SpidersFromMars/1

Note : The build definition id 1 was retrieved with the list definitions command

Whenever a push happens on this repo, Hubot will comment in the room specified in the webhook URL and trigger the registered build.

**hubot**>> @helaili just pushed code on OctoCheese/SpidersFromMars/testTFS. Requesting a TFS build with defaultcollection/SpidersFromMars/1

Readme

Keywords

Package Sidebar

Install

npm i hubot-github-tfs

Weekly Downloads

1

Version

0.9.4

License

MIT

Last publish

Collaborators

  • helaili