Riveter

Riveter connects Azure to Shortcut. And LaunchDarkly. And Slack.

https://atlas-x.visualstudio.com/Atlas/_git/riveter

When a pull request is created in Azure, it looks in the pull request and commits for any shortcut style tags, and adds a comment in shortcut to that effect.

Supported shortcut style tags are:

This also has a few jobs that send reminders to slack for Bugs & LaunchDarkly.

Developing

  1. Copy ./config.local.example.js to ./config.local.js.
    Get an Azure API key from https://atlas-x.visualstudio.com/_usersSettings/tokens
    Get a clubhouse API key from https://app.clubhouse.io/fulcrum/settings/account/api-tokens

  2. npm install

  3. npm run start:dev

Configuration

Webhooks are defined per project, but at the moment configured across the board: https://atlas-x.visualstudio.com/Atlas/_settings/serviceHooks

They should point to https://riveter.fulcrumpro.com/api/azure/pullRequestWebhook

There are special headers which are required for this to work. Copy from other projects that have this setup otherwise it won't be recognized.

Default Header: PullSecret: <secret> defined in config.local.js

Deploying

  1. ssh to riveter.fulcrumpro.com
  2. cd riveter
  3. npm run deploy

Example Pull Request Message:

Method: POST
URI: https://riveter.fulcrumpro.com/api/azure/pullRequestWebhook
HTTP Version: 1.1
Headers:
{
  Content-Type: application/json; charset=utf-8,
  PullSecret: <secret>
}
Content:
{
  {
  "subscriptionId": "89cd8084-f8e5-4111-84ae-b2ec3c927288",
  "notificationId": 5,
  "id": "ccf02894-e2dc-4a39-92dd-cd5d95ca5fc8",
  "eventType": "git.pullrequest.created",
  "publisherId": "tfs",
  "message": {
    "text": "Jon Gregorowicz created pull request 1272 (https://app.clubhouse.io/fulcrum/story/2910/link-azure-pull-requests-to-clubhouse-stories) in riveter\r\nhttps://dev.azure.com/atlas-x/Atlas/_git/riveter/",
    "html": "Jon Gregorowicz created <a href=\"https://dev.azure.com/atlas-x/Atlas/_git/riveter/pullrequest/1272\">pull request 1272</a> (https://app.clubhouse.io/fulcrum/story/2910/link-azure-pull-requests-to-clubhouse-stories) in <a href=\"https://dev.azure.com/atlas-x/Atlas/_git/riveter/\">riveter</a>",
    "markdown": "Jon Gregorowicz created [pull request 1272](https://dev.azure.com/atlas-x/Atlas/_git/riveter/pullrequest/1272) (https://app.clubhouse.io/fulcrum/story/2910/link-azure-pull-requests-to-clubhouse-stories) in [riveter](https://dev.azure.com/atlas-x/Atlas/_git/riveter/)"
  },
  "detailedMessage": {
    "text": "Jon Gregorowicz created pull request 1272 (https://app.clubhouse.io/fulcrum/story/2910/link-azure-pull-requests-to-clubhouse-stories) in riveter\r\nhttps://dev.azure.com/atlas-x/Atlas/_git/riveter/",
    "html": "Jon Gregorowicz created <a href=\"https://dev.azure.com/atlas-x/Atlas/_git/riveter/pullrequest/1272\">pull request 1272</a> (https://app.clubhouse.io/fulcrum/story/2910/link-azure-pull-requests-to-clubhouse-stories) in <a href=\"https://dev.azure.com/atlas-x/Atlas/_git/riveter/\">riveter</a>",
    "markdown": "Jon Gregorowicz created [pull request 1272](https://dev.azure.com/atlas-x/Atlas/_git/riveter/pullrequest/1272) (https://app.clubhouse.io/fulcrum/story/2910/link-azure-pull-requests-to-clubhouse-stories) in [riveter](https://dev.azure.com/atlas-x/Atlas/_git/riveter/)"
  },
  "resource": {
    "repository": {
      "id": "abf9a94b-f465-4889-8d29-00ad5acc30ef",
      "name": "riveter",
      "url": "https://dev.azure.com/atlas-x/ae89e035-14af-44ed-ab15-4d55fbb9814f/_apis/git/repositories/abf9a94b-f465-4889-8d29-00ad5acc30ef",
      "project": {
        "id": "ae89e035-14af-44ed-ab15-4d55fbb9814f",
        "name": "Atlas",
        "url": "https://dev.azure.com/atlas-x/_apis/projects/ae89e035-14af-44ed-ab15-4d55fbb9814f",
        "state": "wellFormed",
        "revision": 64048060,
        "visibility": "private",
        "lastUpdateTime": "2019-11-09T16:44:41.87Z"
      },
      "size": 88018,
      "remoteUrl": "https://atlas-x@dev.azure.com/atlas-x/Atlas/_git/riveter",
      "sshUrl": "git@ssh.dev.azure.com:v3/atlas-x/Atlas/riveter",
      "webUrl": "https://dev.azure.com/atlas-x/Atlas/_git/riveter"
    },
    "pullRequestId": 1272,
    "codeReviewId": 1272,
    "status": "active",
    "createdBy": {
      "displayName": "Jon Gregorowicz",
      "url": "https://spsprodeus22.vssps.visualstudio.com/A54a2938a-ffcb-4b56-bbaa-4b6ddee75ece/_apis/Identities/e1bfac42-2c46-654c-8586-e480ae10e93b",
      "_links": {
        "avatar": {
          "href": "https://dev.azure.com/atlas-x/_apis/GraphProfile/MemberAvatars/aad.ZTFiZmFjNDItMmM0Ni03NTRjLTg1ODYtZTQ4MGFlMTBlOTNi"
        }
      },
      "id": "e1bfac42-2c46-654c-8586-e480ae10e93b",
      "uniqueName": "jon@atlas-x.com",
      "imageUrl": "https://dev.azure.com/atlas-x/_api/_common/identityImage?id=e1bfac42-2c46-654c-8586-e480ae10e93b",
      "descriptor": "aad.ZTFiZmFjNDItMmM0Ni03NTRjLTg1ODYtZTQ4MGFlMTBlOTNi"
    },
    "creationDate": "2020-04-18T21:02:40.503232Z",
    "title": "https://app.clubhouse.io/fulcrum/story/2910/link-azure-pull-requests-to-clubhouse-stories",
    "sourceRefName": "refs/heads/pull-request-tests",
    "targetRefName": "refs/heads/master",
    "mergeStatus": "succeeded",
    "isDraft": false,
    "mergeId": "e7cf517c-9ce8-4f74-b6cc-b4e3d1b8e83f",
    "lastMergeSourceCommit": {
      "commitId": "a09835c308bfc87ddb03ceae970965281ec2e1c3",
      "url": "https://dev.azure.com/atlas-x/ae89e035-14af-44ed-ab15-4d55fbb9814f/_apis/git/repositories/abf9a94b-f465-4889-8d29-00ad5acc30ef/commits/a09835c308bfc87ddb03ceae970965281ec2e1c3"
    },
    "lastMergeTargetCommit": {
      "commitId": "92ccd0a06acc84e5f46903d6ec408be055977e86",
      "url": "https://dev.azure.com/atlas-x/ae89e035-14af-44ed-ab15-4d55fbb9814f/_apis/git/repositories/abf9a94b-f465-4889-8d29-00ad5acc30ef/commits/92ccd0a06acc84e5f46903d6ec408be055977e86"
    },
    "lastMergeCommit": {
      "commitId": "a6b59d9ce3db6aa080040241407cf5220420c68a",
      "author": {
        "name": "Jon Gregorowicz",
        "email": "jon@atlas-x.com",
        "date": "2020-04-18T21:02:40Z"
      },
      "committer": {
        "name": "Jon Gregorowicz",
        "email": "jon@atlas-x.com",
        "date": "2020-04-18T21:02:40Z"
      },
      "comment": "Merge pull request 1272 from pull-request-tests into master",
      "url": "https://dev.azure.com/atlas-x/ae89e035-14af-44ed-ab15-4d55fbb9814f/_apis/git/repositories/abf9a94b-f465-4889-8d29-00ad5acc30ef/commits/a6b59d9ce3db6aa080040241407cf5220420c68a"
    },
    "reviewers": [],
    "url": "https://dev.azure.com/atlas-x/ae89e035-14af-44ed-ab15-4d55fbb9814f/_apis/git/repositories/abf9a94b-f465-4889-8d29-00ad5acc30ef/pullRequests/1272",
    "_links": {
      "web": {
        "href": "https://dev.azure.com/atlas-x/Atlas/_git/riveter/pullrequest/1272"
      },
      "statuses": {
        "href": "https://dev.azure.com/atlas-x/ae89e035-14af-44ed-ab15-4d55fbb9814f/_apis/git/repositories/abf9a94b-f465-4889-8d29-00ad5acc30ef/pullRequests/1272/statuses"
      }
    },
    "supportsIterations": true,
    "artifactId": "vstfs:///Git/PullRequestId/ae89e035-14af-44ed-ab15-4d55fbb9814f%2fabf9a94b-f465-4889-8d29-00ad5acc30ef%2f1272"
  },
  "resourceVersion": "1.0",
  "resourceContainers": {
    "collection": {
      "id": "c542906d-c03f-4c7e-a0a0-7832c0f23473",
      "baseUrl": "https://dev.azure.com/atlas-x/"
    },
    "account": {
      "id": "54a2938a-ffcb-4b56-bbaa-4b6ddee75ece",
      "baseUrl": "https://dev.azure.com/atlas-x/"
    },
    "project": {
      "id": "ae89e035-14af-44ed-ab15-4d55fbb9814f",
      "baseUrl": "https://dev.azure.com/atlas-x/"
    }
  },
  "createdDate": "2020-04-18T21:02:46.9603065Z"
}
}