0

我已经在 VSTS(是 Visual Studio Online)中设置了一个构建服务器,并连接了一个 webhook,以便在构建完成时向我发送一条消息。在 webhook 的设置中,您可以选择发送测试消息。在测试消息中,我收到以下标准消息:

{
"subscriptionId": "ccc5c22d-366f-4bcb-ae5e-9200fb756f71",
"notificationId": 4,
"id": "4a5d99d6-1c75-4e53-91b9-ee80057d4ce3",
"eventType": "build.complete",
"publisherId": "tfs",
"message": {
    "text": "Build ConsumerAddressModule_20150407.2 succeeded",
    "html": "Build <a href=\"https://fabrikam-fiber-inc.visualstudio.com/web/build.aspx?pcguid=5023c10b-bef3-41c3-bf53-686c4e34ee9e&amp;builduri=vstfs%3a%2f%2f%2fBuild%2fBuild%2f3\">ConsumerAddressModule_20150407.2</a> succeeded",
    "markdown": "Build [ConsumerAddressModule_20150407.2](https://fabrikam-fiber-inc.visualstudio.com/web/build.aspx?pcguid=5023c10b-bef3-41c3-bf53-686c4e34ee9e&builduri=vstfs%3a%2f%2f%2fBuild%2fBuild%2f3) succeeded"
},
"detailedMessage": {
    "text": "Build ConsumerAddressModule_20150407.2 succeeded",
    "html": "Build <a href=\"https://fabrikam-fiber-inc.visualstudio.com/web/build.aspx?pcguid=5023c10b-bef3-41c3-bf53-686c4e34ee9e&amp;builduri=vstfs%3a%2f%2f%2fBuild%2fBuild%2f3\">ConsumerAddressModule_20150407.2</a> succeeded",
    "markdown": "Build [ConsumerAddressModule_20150407.2](https://fabrikam-fiber-inc.visualstudio.com/web/build.aspx?pcguid=5023c10b-bef3-41c3-bf53-686c4e34ee9e&builduri=vstfs%3a%2f%2f%2fBuild%2fBuild%2f3) succeeded"
},
"resource": {
    "uri": "vstfs:///Build/Build/2",
    "id": 2,
    "buildNumber": "ConsumerAddressModule_20150407.1",
    "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/71777fbc-1cf2-4bd1-9540-128c1c71f766/_apis/build/Builds/2",
    "startTime": "2015-04-07T18:04:06.83Z",
    "finishTime": "2015-04-07T18:06:10.69Z",
    "reason": "manual",
    "status": "succeeded",
    "dropLocation": "#/3/drop",
    "drop": {
        "location": "#/3/drop",
        "type": "container",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/resources/Containers/3/drop",
        "downloadUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/resources/Containers/3/drop?api-version=1.0&$format=zip&downloadFileName=ConsumerAddressModule_20150407.1_drop"
    },
    "log": {
        "type": "container",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/resources/Containers/3/logs",
        "downloadUrl": "https://fabrikam-fiber-inc.visualstudio.com/_apis/resources/Containers/3/logs?api-version=1.0&$format=zip&downloadFileName=ConsumerAddressModule_20150407.1_logs"
    },
    "sourceGetVersion": "LG:refs/heads/master:600c52d2d5b655caa111abfd863e5a9bd304bb0e",
    "lastChangedBy": {
        "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
        "displayName": "Normal Paulk",
        "uniqueName": "fabrikamfiber16@hotmail.com",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
        "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
    },
    "retainIndefinitely": false,
    "hasDiagnostics": true,
    "definition": {
        "batchSize": 1,
        "triggerType": "none",
        "definitionType": "xaml",
        "id": 2,
        "name": "ConsumerAddressModule",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/71777fbc-1cf2-4bd1-9540-128c1c71f766/_apis/build/Definitions/2"
    },
    "queue": {
        "queueType": "buildController",
        "id": 4,
        "name": "Hosted Build Controller",
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/build/Queues/4"
    },
    "requests": [{
        "id": 1,
        "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/71777fbc-1cf2-4bd1-9540-128c1c71f766/_apis/build/Requests/1",
        "requestedFor": {
            "id": "d6245f20-2af8-44f4-9451-8107cb2767db",
            "displayName": "Normal Paulk",
            "uniqueName": "fabrikamfiber16@hotmail.com",
            "url": "https://fabrikam-fiber-inc.visualstudio.com/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
            "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
        }
    }]
},
"resourceVersion": "1.0",
"resourceContainers": {
    "collection": {
        "id": "c12d0eb8-e382-443b-9f9c-c52cba5014c2"
    },
    "account": {
        "id": "f844ec47-a9db-4511-8281-8b63f4eaf94e"
    },
    "project": {
        "id": "be9b3917-87e6-42a4-a549-2bc06a7a878f"
    }
},
"createdDate": "2016-05-13T08:58:44.4646153Z"

}

但是当我的构建完成时,我收到以下消息,但没有删除数据:

{
"subscriptionId": "xxxxxxxxx",
"notificationId": 5,
"id": "xxxxxxxxx",
"eventType": "build.complete",
"publisherId": "tfs",
"message": {
    "text": "Build 20160513.8 succeeded",
    "html": "Build <a href=\"https://xxxxxxx.visualstudio.com/web/build.aspx?pcguid=502f00bd-fd51-2500-8d26-255b5168c05f&amp;builduri=vstfs%3a%2f%2f%2fBuild%2fBuild%2f33\">20160513.8</a> succeeded",
    "markdown": "Build [20160513.8](https://xxxxxxx.visualstudio.com/web/build.aspx?pcguid=502f00bd-fd51-2500-8d26-255b5168c05f&builduri=vstfs%3a%2f%2f%2fBuild%2fBuild%2f33) succeeded"
},
"detailedMessage": {
    "text": "Build 20160513.8 succeeded",
    "html": "Build <a href=\"https://xxxxxxx.visualstudio.com/web/build.aspx?pcguid=502f00bd-fd51-2500-8d26-255b5168c05f&amp;builduri=vstfs%3a%2f%2f%2fBuild%2fBuild%2f33\">20160513.8</a> succeeded",
    "markdown": "Build [20160513.8](https://xxxxxxx.visualstudio.com/web/build.aspx?pcguid=502f00bd-fd51-2500-8d26-255b5168c05f&builduri=vstfs%3a%2f%2f%2fBuild%2fBuild%2f33) succeeded"
},
"resource": {
    "uri": "vstfs:///Build/Build/33",
    "id": 33,
    "buildNumber": "20160513.8",
    "url": "https://xxxxxxx.visualstudio.com/dac51a05-2653-2c88-bbb8-a5e0c5f202da/_apis/build/Builds/33",
    "startTime": "2016-05-13T10:30:32.9935539Z",
    "finishTime": "2016-05-13T10:31:23.0866251Z",
    "reason": "manual",
    "status": "succeeded",
    "drop": {},
    "log": {},
    "sourceGetVersion": "LG:refs/heads/master:b55bf2559e23258c89d1b22638b981ec8a295a25",
    "lastChangedBy": {
        "id": "02d2aa2c-2c22-22ff-89e8-ae2261221555",
        "displayName": "[DefaultCollection]\\Project Collection Service Accounts",
        "uniqueName": "vstfs:///Framework/IdentityDomain/502f00bd-fd51-2500-8d26-255b5168c05f\\Project Collection Service Accounts",
        "url": "https://xxxxxxx.vssps.visualstudio.com/_apis/Identities/02d2aa2c-2c22-22ff-89e8-ae2261221555",
        "imageUrl": "https://xxxxxxx.visualstudio.com/_api/_common/identityImage?id=02d2aa2c-2c22-22ff-89e8-ae2261221555"
    },
    "retainIndefinitely": false,
    "definition": {
        "definitionType": "xaml",
        "id": 2,
        "name": "Test Build Definition",
        "url": "https://xxxxxxx.visualstudio.com/dac51a05-2653-2c88-bbb8-a5e0c5f202da/_apis/build/Definitions/2"
    },
    "queue": {
        "queueType": "buildController",
        "id": 2,
        "name": "Hosted",
        "url": "https://xxxxxxx.visualstudio.com/_apis/build/Queues/2"
    },
    "requests": [{
        "id": 33,
        "url": "https://xxxxxxx.visualstudio.com/dac51a05-2653-2c88-bbb8-a5e0c5f202da/_apis/build/Requests/33",
        "requestedFor": {
            "id": "959a3925-ccf1-2299-be26-c91cf88c5ab5",
            "displayName": "MyName Surname",
            "uniqueName": "p.surname@xxxxxxx.nl"
        }
    }]
},
"resourceVersion": "1.0",
"createdDate": "2016-05-13T10:31:25.5990628Z"

}

有任何想法吗?

4

1 回答 1

0

我的解决方案是使用 REST API 来获取工件: GetBuildArtifacts

于 2016-05-13T12:45:18.440 回答