From 51b470df78b1b31a3bf144ee8e0678775e0a3142 Mon Sep 17 00:00:00 2001 From: Anh Hoang Nguyen Date: Mon, 18 Sep 2023 17:45:51 -0400 Subject: [PATCH] Added example payload, updated the pipeline file --- example-payload.json | 181 +++++++++++++++++++++++++++++++++++++++++++ pipeline.groovy | 2 +- 2 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 example-payload.json diff --git a/example-payload.json b/example-payload.json new file mode 100644 index 0000000..b7ab62e --- /dev/null +++ b/example-payload.json @@ -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" + } +} \ No newline at end of file diff --git a/pipeline.groovy b/pipeline.groovy index 1d4db1a..7a437e9 100644 --- a/pipeline.groovy +++ b/pipeline.groovy @@ -40,7 +40,7 @@ pipeline { def jsonPayload = jsonSlurper.parseText(payload) 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 COMMIT_HASH=jsonPayload.after COMPARE_URL=jsonPayload.compare_url