Skip to content

Commit fcc8453

Browse files
fix: tag webhook parse for code (#297)
* fix: tag webhook parse for code * fix: tag webhook parse for code * fix: tag webhook parse for code
1 parent 290c4aa commit fcc8453

11 files changed

+506
-28
lines changed

scm/driver/harness/testdata/webhooks/branch_create.json.golden

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"Ref": "refs/heads/new2",
3-
"Before": "0000000000000000000000000000000000000000",
4-
"After": "aeafa0e2e4ec6909ad75cb8fad57c0b1eb5986e6",
2+
"Ref": {
3+
"Name": "refs/heads/new2",
4+
"Sha": "aeafa0e2e4ec6909ad75cb8fad57c0b1eb5986e6"
5+
},
6+
"Action": "created",
57
"Repo": {
68
"ID": "13",
79
"Namespace": "",
@@ -15,25 +17,6 @@
1517
"Created": "0001-01-01T00:00:00Z",
1618
"Updated": "0001-01-01T00:00:00Z"
1719
},
18-
"Commit": {
19-
"Sha": "aeafa0e2e4ec6909ad75cb8fad57c0b1eb5986e6",
20-
"Message": "version 4",
21-
"Author": {
22-
"Name": "Admin",
23-
"Email": "[email protected]",
24-
"Date": "0001-01-01T00:00:00Z",
25-
"Login": "",
26-
"Avatar": ""
27-
},
28-
"Committer": {
29-
"Name": "Admin",
30-
"Email": "[email protected]",
31-
"Date": "0001-01-01T00:00:00Z",
32-
"Login": "",
33-
"Avatar": ""
34-
},
35-
"Link": ""
36-
},
3720
"Sender": {
3821
"ID": "0osgWsTZRsSZ8RWfjLRkEg",
3922
"Login": "0osgWsTZRsSZ8RWfjLRkEg",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"trigger": "branch_deleted",
3+
"repo": {
4+
"id": 16,
5+
"path": "kmpySmUISimoRrJL6NL73w/harness-core",
6+
"identifier": "harness-core",
7+
"default_branch": "develop",
8+
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
9+
"uid": "harness-core"
10+
},
11+
"principal": {
12+
"id": 2,
13+
"uid": "lv0euRhKRCyiXWzS7pOg6g",
14+
"display_name": "Admin",
15+
"email": "[email protected]",
16+
"type": "user",
17+
"created": 1701091219051,
18+
"updated": 1701091219051
19+
},
20+
"ref": {
21+
"name": "refs/heads/das",
22+
"repo": {
23+
"id": 16,
24+
"path": "kmpySmUISimoRrJL6NL73w/harness-core",
25+
"identifier": "harness-core",
26+
"default_branch": "develop",
27+
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
28+
"uid": "harness-core"
29+
}
30+
},
31+
"sha": "0000000000000000000000000000000000000000",
32+
"old_sha": "0f1835abe08473e07863540712d8389984b72dad",
33+
"forced": false
34+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"Ref": {
3+
"Name": "refs/heads/das",
4+
"Sha": "0000000000000000000000000000000000000000"
5+
},
6+
"Action": "deleted",
7+
"Repo": {
8+
"ID": "16",
9+
"Namespace": "",
10+
"Name": "harness-core",
11+
"Perm": null,
12+
"Branch": "develop",
13+
"Private": false,
14+
"Clone": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
15+
"CloneSSH": "",
16+
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
17+
"Created": "0001-01-01T00:00:00Z",
18+
"Updated": "0001-01-01T00:00:00Z"
19+
},
20+
"Sender": {
21+
"ID": "lv0euRhKRCyiXWzS7pOg6g",
22+
"Login": "lv0euRhKRCyiXWzS7pOg6g",
23+
"Name": "Admin",
24+
"Email": "[email protected]",
25+
"Avatar": "",
26+
"Created": "2023-11-27T05:20:19.051-08:00",
27+
"Updated": "2023-11-27T05:20:19.051-08:00"
28+
}
29+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"trigger": "tag_created",
3+
"repo": {
4+
"id": 16,
5+
"path": "kmpySmUISimoRrJL6NL73w/harness-core",
6+
"identifier": "harness-core",
7+
"default_branch": "develop",
8+
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
9+
"uid": "harness-core"
10+
},
11+
"principal": {
12+
"id": 2,
13+
"uid": "lv0euRhKRCyiXWzS7pOg6g",
14+
"display_name": "Admin",
15+
"email": "[email protected]",
16+
"type": "user",
17+
"created": 1701091219051,
18+
"updated": 1701091219051
19+
},
20+
"ref": {
21+
"name": "refs/tags/asd",
22+
"repo": {
23+
"id": 16,
24+
"path": "kmpySmUISimoRrJL6NL73w/harness-core",
25+
"identifier": "harness-core",
26+
"default_branch": "develop",
27+
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
28+
"uid": "harness-core"
29+
}
30+
},
31+
"sha": "3e4da2d65c3631c3e84b52fabe714c978aff540b",
32+
"head_commit": {
33+
"sha": "0f1835abe08473e07863540712d8389984b72dad",
34+
"message": "",
35+
"author": {
36+
"identity": {
37+
"name": "admin",
38+
"email": "[email protected]"
39+
},
40+
"when": "2024-03-01T07:54:35-08:00"
41+
},
42+
"committer": {
43+
"identity": {
44+
"name": "GitHub",
45+
"email": "[email protected]"
46+
},
47+
"when": "2024-03-01T07:54:35-08:00"
48+
},
49+
"added": [],
50+
"removed": [],
51+
"modified": []
52+
},
53+
"commit": {
54+
"sha": "0f1835abe08473e07863540712d8389984b72dad",
55+
"message": "",
56+
"author": {
57+
"identity": {
58+
"name": "Jenny James",
59+
"email": "[email protected]"
60+
},
61+
"when": "2024-03-01T07:54:35-08:00"
62+
},
63+
"committer": {
64+
"identity": {
65+
"name": "GitHub",
66+
"email": "[email protected]"
67+
},
68+
"when": "2024-03-01T07:54:35-08:00"
69+
},
70+
"added": [],
71+
"removed": [],
72+
"modified": []
73+
},
74+
"old_sha": "0000000000000000000000000000000000000000",
75+
"forced": false
76+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"Ref": {
3+
"Name": "refs/tags/asd",
4+
"Sha": "3e4da2d65c3631c3e84b52fabe714c978aff540b"
5+
},
6+
"Action": "created",
7+
"Repo": {
8+
"ID": "16",
9+
"Namespace": "",
10+
"Name": "harness-core",
11+
"Perm": null,
12+
"Branch": "develop",
13+
"Private": false,
14+
"Clone": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
15+
"CloneSSH": "",
16+
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
17+
"Created": "0001-01-01T00:00:00Z",
18+
"Updated": "0001-01-01T00:00:00Z"
19+
},
20+
"Sender": {
21+
"ID": "lv0euRhKRCyiXWzS7pOg6g",
22+
"Login": "lv0euRhKRCyiXWzS7pOg6g",
23+
"Name": "Admin",
24+
"Email": "[email protected]",
25+
"Avatar": "",
26+
"Created": "2023-11-27T05:20:19.051-08:00",
27+
"Updated": "2023-11-27T05:20:19.051-08:00"
28+
}
29+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"trigger": "tag_deleted",
3+
"repo": {
4+
"id": 16,
5+
"path": "kmpySmUISimoRrJL6NL73w/harness-core",
6+
"identifier": "harness-core",
7+
"default_branch": "develop",
8+
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
9+
"uid": "harness-core"
10+
},
11+
"principal": {
12+
"id": 2,
13+
"uid": "lv0euRhKRCyiXWzS7pOg6g",
14+
"display_name": "Admin",
15+
"email": "[email protected]",
16+
"type": "user",
17+
"created": 1701091219051,
18+
"updated": 1701091219051
19+
},
20+
"ref": {
21+
"name": "refs/tags/asd",
22+
"repo": {
23+
"id": 16,
24+
"path": "kmpySmUISimoRrJL6NL73w/harness-core",
25+
"identifier": "harness-core",
26+
"default_branch": "develop",
27+
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
28+
"uid": "harness-core"
29+
}
30+
},
31+
"sha": "0000000000000000000000000000000000000000",
32+
"old_sha": "3e4da2d65c3631c3e84b52fabe714c978aff540b",
33+
"forced": false
34+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"Ref": {
3+
"Name": "refs/tags/asd",
4+
"Sha": "0000000000000000000000000000000000000000"
5+
},
6+
"Action": "deleted",
7+
"Repo": {
8+
"ID": "16",
9+
"Namespace": "",
10+
"Name": "harness-core",
11+
"Perm": null,
12+
"Branch": "develop",
13+
"Private": false,
14+
"Clone": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
15+
"CloneSSH": "",
16+
"Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
17+
"Created": "0001-01-01T00:00:00Z",
18+
"Updated": "0001-01-01T00:00:00Z"
19+
},
20+
"Sender": {
21+
"ID": "lv0euRhKRCyiXWzS7pOg6g",
22+
"Login": "lv0euRhKRCyiXWzS7pOg6g",
23+
"Name": "Admin",
24+
"Email": "[email protected]",
25+
"Avatar": "",
26+
"Created": "2023-11-27T05:20:19.051-08:00",
27+
"Updated": "2023-11-27T05:20:19.051-08:00"
28+
}
29+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"trigger": "tag_updated",
3+
"repo": {
4+
"id": 16,
5+
"path": "kmpySmUISimoRrJL6NL73w/harness-core",
6+
"identifier": "harness-core",
7+
"default_branch": "develop",
8+
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
9+
"uid": "harness-core"
10+
},
11+
"principal": {
12+
"id": 2,
13+
"uid": "lv0euRhKRCyiXWzS7pOg6g",
14+
"display_name": "Admin",
15+
"email": "[email protected]",
16+
"type": "user",
17+
"created": 1701091219051,
18+
"updated": 1701091219051
19+
},
20+
"ref": {
21+
"name": "refs/tags/ddxas",
22+
"repo": {
23+
"id": 16,
24+
"path": "kmpySmUISimoRrJL6NL73w/harness-core",
25+
"identifier": "harness-core",
26+
"default_branch": "develop",
27+
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git",
28+
"uid": "harness-core"
29+
}
30+
},
31+
"sha": "700b3dab8e7a5cebf5e1ce54e7dd5bde60099912",
32+
"head_commit": {
33+
"sha": "700b3dab8e7a5cebf5e1ce54e7dd5bde60099912",
34+
"message": "Asd",
35+
"author": {
36+
"identity": {
37+
"name": "Abhinav Singh",
38+
"email": "[email protected]"
39+
},
40+
"when": "2024-03-07T03:18:51-08:00"
41+
},
42+
"committer": {
43+
"identity": {
44+
"name": "Abhinav Singh",
45+
"email": "[email protected]"
46+
},
47+
"when": "2024-03-07T03:18:51-08:00"
48+
},
49+
"added": [],
50+
"removed": [],
51+
"modified": []
52+
},
53+
"commits": [
54+
{
55+
"sha": "700b3dab8e7a5cebf5e1ce54e7dd5bde60099912",
56+
"message": "Asd",
57+
"author": {
58+
"identity": {
59+
"name": "Abhinav Singh",
60+
"email": "[email protected]"
61+
},
62+
"when": "2024-03-07T03:18:51-08:00"
63+
},
64+
"committer": {
65+
"identity": {
66+
"name": "Abhinav Singh",
67+
"email": "[email protected]"
68+
},
69+
"when": "2024-03-07T03:18:51-08:00"
70+
},
71+
"added": [],
72+
"removed": [],
73+
"modified": []
74+
}
75+
],
76+
"total_commits_count": 1,
77+
"commit": {
78+
"sha": "700b3dab8e7a5cebf5e1ce54e7dd5bde60099912",
79+
"message": "Asd",
80+
"author": {
81+
"identity": {
82+
"name": "Abhinav Singh",
83+
"email": "[email protected]"
84+
},
85+
"when": "2024-03-07T03:18:51-08:00"
86+
},
87+
"committer": {
88+
"identity": {
89+
"name": "Abhinav Singh",
90+
"email": "[email protected]"
91+
},
92+
"when": "2024-03-07T03:18:51-08:00"
93+
},
94+
"added": [],
95+
"removed": [],
96+
"modified": []
97+
},
98+
"old_sha": "0f1835abe08473e07863540712d8389984b72dad",
99+
"forced": true
100+
}

0 commit comments

Comments
 (0)