Last active
July 1, 2023 15:17
-
-
Save jrichardsz/3d55df91181e3fb83089d08ada6809a8 to your computer and use it in GitHub Desktop.
Sample json Payload from Gitlab WebHook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"object_kind": "push", | |
"event_name": "push", | |
"before": "ecb9ff44aa0", | |
"after": "fa61658291900e59df0", | |
"ref": "refs/heads/my_branch_name", | |
"checkout_sha": "fa61658291900e59df0", | |
"message": null, | |
"user_id": 220253, | |
"user_name": "JRichardsz", | |
"user_username": "Richardsz", | |
"user_email": "", | |
"user_avatar": "https://assets.gitlab-static.net/uploads/-/system/user/avatar/220253/agente3.png", | |
"project_id": 14796876, | |
"project": { | |
"id": 14796876, | |
"name": "gitlab_repository", | |
"description": "", | |
"web_url": "https://gitlab.com/Richardsz/gitlab_repository", | |
"avatar_url": null, | |
"git_ssh_url": "git@gitlab.com:Richardsz/gitlab_repository.git", | |
"git_http_url": "https://gitlab.com/Richardsz/gitlab_repository.git", | |
"namespace": "JRichardsz", | |
"visibility_level": 20, | |
"path_with_namespace": "Richardsz/gitlab_repository", | |
"default_branch": "master", | |
"ci_config_path": null, | |
"homepage": "https://gitlab.com/Richardsz/gitlab_repository", | |
"url": "git@gitlab.com:Richardsz/gitlab_repository.git", | |
"ssh_url": "git@gitlab.com:Richardsz/gitlab_repository.git", | |
"http_url": "https://gitlab.com/Richardsz/gitlab_repository.git" | |
}, | |
"commits": [ | |
{ | |
"id": "fa61658291900e59df0", | |
"message": "Update README.md", | |
"timestamp": "2019-10-13T16:44:05Z", | |
"url": "https://gitlab.com/Richardsz/gitlab_repository/commit/fa61658291900e59df0", | |
"author": { | |
"name": "JRichardsz", | |
"email": "jrichardsz.java@gmail.com" | |
}, | |
"added": [], | |
"modified": [ | |
"README.md" | |
], | |
"removed": [] | |
} | |
], | |
"total_commits_count": 1, | |
"push_options": {}, | |
"repository": { | |
"name": "gitlab_repository", | |
"url": "git@gitlab.com:Richardsz/gitlab_repository.git", | |
"description": "", | |
"homepage": "https://gitlab.com/Richardsz/gitlab_repository", | |
"git_http_url": "https://gitlab.com/Richardsz/gitlab_repository.git", | |
"git_ssh_url": "git@gitlab.com:Richardsz/gitlab_repository.git", | |
"visibility_level": 20 | |
} | |
} |
- First you need to create a simple post controller with java. It could be a simple servlet or something advanced with springboot
- Deploy it in some cloud. It is mandatory to have public access with IP, domain, or subdomain
- Then you need to configure the url in gitlab. Check this https://jrichardsz.github.io/devops/configure-webhooks-in-github-bitbucket-gitlab
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to retrieve this data once the push event is triggered by using java api from gitlab??