Added example payload, updated the pipeline file

This commit is contained in:
Anh Nguyen 2023-09-18 17:45:51 -04:00
parent f1d32f241c
commit 51b470df78
2 changed files with 182 additions and 1 deletions

181
example-payload.json Normal file
View File

@ -0,0 +1,181 @@
{
"ref": "refs/heads/main",
"before": "f1d32f241cf9c66d81312601259669d9450bab0a",
"after": "f1d32f241cf9c66d81312601259669d9450bab0a",
"compare_url": "https://nextgenerations-cities.encs.concordia.ca/gitea/a_nguyen/webhook-test/compare/f1d32f241cf9c66d81312601259669d9450bab0a...f1d32f241cf9c66d81312601259669d9450bab0a",
"commits": [
{
"id": "f1d32f241cf9c66d81312601259669d9450bab0a",
"message": "Update pipeline\n",
"url": "https://nextgenerations-cities.encs.concordia.ca/gitea/a_nguyen/webhook-test/commit/f1d32f241cf9c66d81312601259669d9450bab0a",
"author": {
"name": "Anh Hoang Nguyen",
"email": "anhhoang.nguyen@concordia.ca",
"username": ""
},
"committer": {
"name": "Anh Hoang Nguyen",
"email": "anhhoang.nguyen@concordia.ca",
"username": ""
},
"verification": null,
"timestamp": "0001-01-01T00:00:00Z",
"added": null,
"removed": null,
"modified": null
}
],
"total_commits": 1,
"head_commit": {
"id": "f1d32f241cf9c66d81312601259669d9450bab0a",
"message": "Update pipeline\n",
"url": "https://nextgenerations-cities.encs.concordia.ca/gitea/a_nguyen/webhook-test/commit/f1d32f241cf9c66d81312601259669d9450bab0a",
"author": {
"name": "Anh Hoang Nguyen",
"email": "anhhoang.nguyen@concordia.ca",
"username": ""
},
"committer": {
"name": "Anh Hoang Nguyen",
"email": "anhhoang.nguyen@concordia.ca",
"username": ""
},
"verification": null,
"timestamp": "0001-01-01T00:00:00Z",
"added": null,
"removed": null,
"modified": null
},
"repository": {
"id": 151,
"owner": {
"id": 38,
"login": "a_nguyen",
"login_name": "",
"full_name": "Anh Nguyen",
"email": "anhhoang.nguyen@concordia.ca",
"avatar_url": "https://secure.gravatar.com/avatar/7a2fd9eb59567837bdf39f20f554c62c?d=identicon",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2023-09-12T12:12:45-04:00",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "a_nguyen"
},
"name": "webhook-test",
"full_name": "a_nguyen/webhook-test",
"description": "",
"empty": false,
"private": false,
"fork": false,
"template": false,
"parent": null,
"mirror": false,
"size": 32,
"language": "",
"languages_url": "https://nextgenerations-cities.encs.concordia.ca/gitea/api/v1/repos/a_nguyen/webhook-test/languages",
"html_url": "https://nextgenerations-cities.encs.concordia.ca/gitea/a_nguyen/webhook-test",
"link": "",
"ssh_url": "gitea@localhost:a_nguyen/webhook-test.git",
"clone_url": "https://nextgenerations-cities.encs.concordia.ca/gitea/a_nguyen/webhook-test.git",
"original_url": "",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"open_pr_counter": 0,
"release_counter": 0,
"default_branch": "main",
"archived": false,
"created_at": "2023-09-12T17:46:53-04:00",
"updated_at": "2023-09-18T17:08:20-04:00",
"archived_at": "1969-12-31T19:00:00-05:00",
"permissions": {
"admin": false,
"push": false,
"pull": false
},
"has_issues": true,
"internal_tracker": {
"enable_time_tracker": true,
"allow_only_contributors_to_track_time": true,
"enable_issue_dependencies": true
},
"has_wiki": true,
"has_pull_requests": true,
"has_projects": true,
"has_releases": true,
"has_packages": true,
"has_actions": false,
"ignore_whitespace_conflicts": false,
"allow_merge_commits": true,
"allow_rebase": true,
"allow_rebase_explicit": true,
"allow_squash_merge": true,
"allow_rebase_update": true,
"default_delete_branch_after_merge": false,
"default_merge_style": "merge",
"default_allow_maintainer_edit": false,
"avatar_url": "",
"internal": false,
"mirror_interval": "",
"mirror_updated": "0001-01-01T00:00:00Z",
"repo_transfer": null
},
"pusher": {
"id": 38,
"login": "a_nguyen",
"login_name": "",
"full_name": "Anh Nguyen",
"email": "anhhoang.nguyen@concordia.ca",
"avatar_url": "https://secure.gravatar.com/avatar/7a2fd9eb59567837bdf39f20f554c62c?d=identicon",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2023-09-12T12:12:45-04:00",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "a_nguyen"
},
"sender": {
"id": 38,
"login": "a_nguyen",
"login_name": "",
"full_name": "Anh Nguyen",
"email": "anhhoang.nguyen@concordia.ca",
"avatar_url": "https://secure.gravatar.com/avatar/7a2fd9eb59567837bdf39f20f554c62c?d=identicon",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2023-09-12T12:12:45-04:00",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "a_nguyen"
}
}

View File

@ -40,7 +40,7 @@ pipeline {
def jsonPayload = jsonSlurper.parseText(payload) def jsonPayload = jsonSlurper.parseText(payload)
WEBHOOK_SENDER_EMAIL=jsonPayload.sender.email WEBHOOK_SENDER_EMAIL=jsonPayload.sender.email
WEBHOOK_SENDER_NAME=jsonPayload.sender.name WEBHOOK_SENDER_NAME=jsonPayload.sender.full_name
WEBHOOK_SENDER_LOGIN=jsonPayload.sender.login WEBHOOK_SENDER_LOGIN=jsonPayload.sender.login
COMMIT_HASH=jsonPayload.after COMMIT_HASH=jsonPayload.after
COMPARE_URL=jsonPayload.compare_url COMPARE_URL=jsonPayload.compare_url