mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-14 14:01:26 +00:00
348 lines
12 KiB
Go
348 lines
12 KiB
Go
// Copyright 2018 Drone.IO Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package testdata
|
|
|
|
var TagHook = []byte(`
|
|
{
|
|
"object_kind": "tag_push",
|
|
"ref": "refs/tags/v1.0.0",
|
|
"before": "0000000000000000000000000000000000000000",
|
|
"after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
|
|
"user_id": 1,
|
|
"user_name": "John Smith",
|
|
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s=80",
|
|
"project_id": 1,
|
|
"project":{
|
|
"name":"Example",
|
|
"description":"",
|
|
"web_url":"http://example.com/jsmith/example",
|
|
"avatar_url":"http://example.com/uploads/project/avatar/555/Outh-20-Logo.jpg",
|
|
"git_ssh_url":"git@example.com:jsmith/example.git",
|
|
"git_http_url":"http://example.com/jsmith/example.git",
|
|
"namespace":"Jsmith",
|
|
"visibility_level":0,
|
|
"path_with_namespace":"jsmith/example",
|
|
"default_branch":"develop",
|
|
"homepage":"http://example.com/jsmith/example",
|
|
"url":"git@example.com:jsmith/example.git",
|
|
"ssh_url":"git@example.com:jsmith/example.git",
|
|
"http_url":"http://example.com/jsmith/example.git"
|
|
},
|
|
"repository":{
|
|
"name": "jsmith",
|
|
"url": "ssh://git@example.com/jsmith/example.git",
|
|
"description": "",
|
|
"homepage": "http://example.com/jsmith/example",
|
|
"git_http_url":"http://example.com/jsmith/example.git",
|
|
"git_ssh_url":"git@example.com:jsmith/example.git",
|
|
"visibility_level":0
|
|
},
|
|
"commits": [],
|
|
"total_commits_count": 0
|
|
}
|
|
`)
|
|
|
|
var LegacyTagHook = []byte(`
|
|
{
|
|
"object_kind": "tag_push",
|
|
"ref": "refs/tags/v1.0.0",
|
|
"before": "0000000000000000000000000000000000000000",
|
|
"after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
|
|
"user_id": 1,
|
|
"user_name": "John Smith",
|
|
"project_id": 1,
|
|
"repository": {
|
|
"name": "jsmith",
|
|
"url": "ssh://git@example.com/jsmith/example.git",
|
|
"description": "",
|
|
"homepage": "http://example.com/jsmith/example",
|
|
"git_http_url":"http://example.com/jsmith/example.git",
|
|
"git_ssh_url":"git@example.com:jsmith/example.git",
|
|
"visibility_level":0
|
|
},
|
|
"commits": [
|
|
{
|
|
"id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
|
|
"message": "Update Catalan translation to e38cb41.",
|
|
"timestamp": "2011-12-12T14:27:31+02:00",
|
|
"url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
|
|
"author": {
|
|
"name": "Jordi Mallach",
|
|
"email": "jordi@softcatala.org"
|
|
}
|
|
},
|
|
{
|
|
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"message": "fixed readme",
|
|
"timestamp": "2012-01-03T23:36:29+02:00",
|
|
"url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"author": {
|
|
"name": "GitLab dev user",
|
|
"email": "gitlabdev@dv6700.(none)"
|
|
}
|
|
}
|
|
],
|
|
"total_commits_count": 4
|
|
}
|
|
`)
|
|
|
|
var MergeRequestHook = []byte(`
|
|
{
|
|
"object_kind": "merge_request",
|
|
"user": {
|
|
"name": "Administrator",
|
|
"username": "root",
|
|
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
|
|
},
|
|
"object_attributes": {
|
|
"id": 99,
|
|
"target_branch": "master",
|
|
"source_branch": "ms-viewport",
|
|
"source_project_id": 14,
|
|
"author_id": 51,
|
|
"assignee_id": 6,
|
|
"title": "MS-Viewport",
|
|
"created_at": "2013-12-03T17:23:34Z",
|
|
"updated_at": "2013-12-03T17:23:34Z",
|
|
"st_commits": null,
|
|
"st_diffs": null,
|
|
"milestone_id": null,
|
|
"state": "opened",
|
|
"merge_status": "unchecked",
|
|
"target_project_id": 14,
|
|
"iid": 1,
|
|
"description": "",
|
|
"source":{
|
|
"name":"Awesome Project",
|
|
"description":"Aut reprehenderit ut est.",
|
|
"web_url":"http://example.com/awesome_space/awesome_project",
|
|
"avatar_url":"http://example.com/uploads/project/avatar/555/Outh-20-Logo.jpg",
|
|
"git_ssh_url":"git@example.com:awesome_space/awesome_project.git",
|
|
"git_http_url":"http://example.com/awesome_space/awesome_project.git",
|
|
"namespace":"Awesome Space",
|
|
"visibility_level":20,
|
|
"path_with_namespace":"awesome_space/awesome_project",
|
|
"default_branch":"master",
|
|
"homepage":"http://example.com/awesome_space/awesome_project",
|
|
"url":"http://example.com/awesome_space/awesome_project.git",
|
|
"ssh_url":"git@example.com:awesome_space/awesome_project.git",
|
|
"http_url":"http://example.com/awesome_space/awesome_project.git"
|
|
},
|
|
"target": {
|
|
"name":"Awesome Project",
|
|
"description":"Aut reprehenderit ut est.",
|
|
"web_url":"http://example.com/awesome_space/awesome_project",
|
|
"avatar_url":"http://example.com/uploads/project/avatar/555/Outh-20-Logo.jpg",
|
|
"git_ssh_url":"git@example.com:awesome_space/awesome_project.git",
|
|
"git_http_url":"http://example.com/awesome_space/awesome_project.git",
|
|
"namespace":"Awesome Space",
|
|
"visibility_level":20,
|
|
"path_with_namespace":"awesome_space/awesome_project",
|
|
"default_branch":"develop",
|
|
"homepage":"http://example.com/awesome_space/awesome_project",
|
|
"url":"http://example.com/awesome_space/awesome_project.git",
|
|
"ssh_url":"git@example.com:awesome_space/awesome_project.git",
|
|
"http_url":"http://example.com/awesome_space/awesome_project.git"
|
|
},
|
|
"last_commit": {
|
|
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"message": "fixed readme",
|
|
"timestamp": "2012-01-03T23:36:29+02:00",
|
|
"url": "http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"author": {
|
|
"name": "GitLab dev user",
|
|
"email": "gitlabdev@dv6700.(none)"
|
|
}
|
|
},
|
|
"work_in_progress": false,
|
|
"url": "http://example.com/diaspora/merge_requests/1",
|
|
"action": "open",
|
|
"assignee": {
|
|
"name": "User1",
|
|
"username": "user1",
|
|
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
|
|
}
|
|
}
|
|
}
|
|
`)
|
|
|
|
var LegacyMergeRequestHook = []byte(`
|
|
{
|
|
"object_kind": "merge_request",
|
|
"user": {
|
|
"name": "Administrator",
|
|
"username": "root",
|
|
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
|
|
},
|
|
"object_attributes": {
|
|
"id": 99,
|
|
"target_branch": "master",
|
|
"source_branch": "ms-viewport",
|
|
"source_project_id": 14,
|
|
"author_id": 51,
|
|
"assignee_id": 6,
|
|
"title": "MS-Viewport",
|
|
"created_at": "2013-12-03T17:23:34Z",
|
|
"updated_at": "2013-12-03T17:23:34Z",
|
|
"st_commits": null,
|
|
"st_diffs": null,
|
|
"milestone_id": null,
|
|
"state": "opened",
|
|
"merge_status": "unchecked",
|
|
"target_project_id": 14,
|
|
"iid": 1,
|
|
"description": "",
|
|
"source": {
|
|
"name": "awesome_project",
|
|
"ssh_url": "ssh://git@example.com/awesome_space/awesome_project.git",
|
|
"http_url": "http://example.com/awesome_space/awesome_project.git",
|
|
"visibility_level": 20,
|
|
"namespace": "awesome_space"
|
|
},
|
|
"target": {
|
|
"name": "awesome_project",
|
|
"ssh_url": "ssh://git@example.com/awesome_space/awesome_project.git",
|
|
"http_url": "http://example.com/awesome_space/awesome_project.git",
|
|
"visibility_level": 20,
|
|
"namespace": "awesome_space"
|
|
},
|
|
"last_commit": {
|
|
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"message": "fixed readme",
|
|
"timestamp": "2012-01-03T23:36:29+02:00",
|
|
"url": "http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"author": {
|
|
"name": "GitLab dev user",
|
|
"email": "gitlabdev@dv6700.(none)"
|
|
}
|
|
},
|
|
"url": "http://example.com/diaspora/merge_requests/1",
|
|
"action": "open"
|
|
}
|
|
}
|
|
`)
|
|
|
|
var PushHook = []byte(`
|
|
{
|
|
"object_kind": "push",
|
|
"before": "95790bf891e76fee5e1747ab589903a6a1f80f22",
|
|
"after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"ref": "refs/heads/master",
|
|
"user_id": 4,
|
|
"user_name": "John Smith",
|
|
"user_email": "john@example.com",
|
|
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
|
|
"project_id": 15,
|
|
"project":{
|
|
"name":"Diaspora",
|
|
"description":"",
|
|
"web_url":"http://example.com/mike/diaspora",
|
|
"avatar_url":"http://example.com/uploads/project/avatar/555/Outh-20-Logo.jpg",
|
|
"git_ssh_url":"git@example.com:mike/diaspora.git",
|
|
"git_http_url":"http://example.com/mike/diaspora.git",
|
|
"namespace":"Mike",
|
|
"visibility_level":0,
|
|
"path_with_namespace":"mike/diaspora",
|
|
"default_branch":"develop",
|
|
"homepage":"http://example.com/mike/diaspora",
|
|
"url":"git@example.com:mike/diasporadiaspora.git",
|
|
"ssh_url":"git@example.com:mike/diaspora.git",
|
|
"http_url":"http://example.com/mike/diaspora.git"
|
|
},
|
|
"repository":{
|
|
"name": "Diaspora",
|
|
"url": "git@example.com:mike/diasporadiaspora.git",
|
|
"description": "",
|
|
"homepage": "http://example.com/mike/diaspora",
|
|
"git_http_url":"http://example.com/mike/diaspora.git",
|
|
"git_ssh_url":"git@example.com:mike/diaspora.git",
|
|
"visibility_level":0
|
|
},
|
|
"commits": [
|
|
{
|
|
"id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
|
|
"message": "Update Catalan translation to e38cb41.",
|
|
"timestamp": "2011-12-12T14:27:31+02:00",
|
|
"url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
|
|
"author": {
|
|
"name": "Jordi Mallach",
|
|
"email": "jordi@softcatala.org"
|
|
},
|
|
"added": ["CHANGELOG"],
|
|
"modified": ["app/controller/application.rb"],
|
|
"removed": []
|
|
},
|
|
{
|
|
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"message": "fixed readme",
|
|
"timestamp": "2012-01-03T23:36:29+02:00",
|
|
"url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"author": {
|
|
"name": "GitLab dev user",
|
|
"email": "gitlabdev@dv6700.(none)"
|
|
},
|
|
"added": ["CHANGELOG"],
|
|
"modified": ["app/controller/application.rb"],
|
|
"removed": []
|
|
}
|
|
],
|
|
"total_commits_count": 4
|
|
}
|
|
`)
|
|
|
|
var LegacyPushHook = []byte(`
|
|
{
|
|
"object_kind": "push",
|
|
"before": "95790bf891e76fee5e1747ab589903a6a1f80f22",
|
|
"after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"ref": "refs/heads/master",
|
|
"user_id": 4,
|
|
"user_name": "John Smith",
|
|
"user_email": "john@example.com",
|
|
"project_id": 15,
|
|
"repository": {
|
|
"name": "Diaspora",
|
|
"url": "git@example.com:mike/diasporadiaspora.git",
|
|
"description": "",
|
|
"homepage": "http://example.com/mike/diaspora",
|
|
"git_http_url":"http://example.com/mike/diaspora.git",
|
|
"git_ssh_url":"git@example.com:mike/diaspora.git",
|
|
"visibility_level":0
|
|
},
|
|
"commits": [
|
|
{
|
|
"id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
|
|
"message": "Update Catalan translation to e38cb41.",
|
|
"timestamp": "2011-12-12T14:27:31+02:00",
|
|
"url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
|
|
"author": {
|
|
"name": "Jordi Mallach",
|
|
"email": "jordi@softcatala.org"
|
|
}
|
|
},
|
|
{
|
|
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"message": "fixed readme",
|
|
"timestamp": "2012-01-03T23:36:29+02:00",
|
|
"url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
|
|
"author": {
|
|
"name": "GitLab dev user",
|
|
"email": "gitlabdev@dv6700.(none)"
|
|
}
|
|
}
|
|
],
|
|
"total_commits_count": 4
|
|
}
|
|
`)
|