An open API service indexing awesome lists of open source software.

https://github.com/helaili/hubot-github-tfs

Hubot Script to interact with TFS
https://github.com/helaili/hubot-github-tfs

hubot hubot-script tfs

Last synced: 4 months ago
JSON representation

Hubot Script to interact with TFS

Awesome Lists containing this project

README

          

[![Build Status](https://travis-ci.org/helaili/hubot-github-tfs.svg?branch=master)](https://travis-ci.org/helaili/hubot-github-tfs)

# 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`:

```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/github-tfs/build/
```

- Create a webhook on TFS with the following URL so Hubot can receive the notification back
```
http:///hubot/github-tfs/build-result/
```

- Make sure the IIS server running TFS has 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
tfs-build list builds for from
tfs-build queue with def=
tfs-build queue from with def= branch=
tfs-build list definitions for
tfs-build list definitions for from
tfs-build rem all
tfs-build rem about /
tfs-build forget about /
tfs-build rem / builds with /
tfs-build rem / builds with / from
```

#### 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
```