Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new event commit status creation and webhook implementation #27151

Merged
merged 12 commits into from
Nov 7, 2024

Conversation

lunny
Copy link
Member

@lunny lunny commented Sep 20, 2023

This PR introduces a new event which is similar as Github's. When a new commit status submitted, the event will be trigged. That means, now we can receive all feedback from CI/CD system in webhooks or other notify systems.

ref: https://docs.github.com/en/webhooks/webhook-events-and-payloads#status

Fix #20749

@lunny lunny added the type/enhancement An improvement of existing functionality label Sep 20, 2023
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 20, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 20, 2023
@anbraten
Copy link
Contributor

Looks like a nice idea to have a webhook event for this. However the original idea behind the issue was rather to get an internal notification (shown when clicking on the bell in the UI) for failed PR status reports. So a CI like gitea actions would send a PR status update and if that is a failed one it would create a new notification entry in the list.

@lunny
Copy link
Member Author

lunny commented Sep 21, 2023

Looks like a nice idea to have a webhook event for this. However the original idea behind the issue was rather to get an internal notification (shown when clicking on the bell in the UI) for failed PR status reports. So a CI like gitea actions would send a PR status update and if that is a failed one it would create a new notification entry in the list.

The UI notification could be another PR because it will need more work, maybe it can be based on #27058

@lunny lunny added this to the 1.22.0 milestone Sep 27, 2023
@denyskon denyskon added topic/webhooks giteabot/update-branch Hint for the bot that it should update a PR with the latest state on main labels Oct 22, 2023
@GiteaBot GiteaBot removed the giteabot/update-branch Hint for the bot that it should update a PR with the latest state on main label Oct 22, 2023
@denyskon denyskon self-requested a review October 22, 2023 16:25
@denyskon
Copy link
Member

@lunny Could you please explain this change? I don't understand which action is triggered by this method in the end......

@lunny
Copy link
Member Author

lunny commented Dec 11, 2023

@lunny Could you please explain this change? I don't understand which action is triggered by this method in the end......

This event is triggered by a new commit status submitted to Gitea. Currently only webhook notfier implement it so then when a commit status has been submitted, a webhook will be triggered.

@denyskon
Copy link
Member

@lunny I don't manage to trigger a webhook. Do I misunderstand you? I run a workflow on a repo, which succeeds or fails. I have a Telegram webhook which triggers on commit, but not on workflow success/failure

@lunny
Copy link
Member Author

lunny commented Dec 21, 2023

@lunny I don't manage to trigger a webhook. Do I misunderstand you? I run a workflow on a repo, which succeeds or fails. I have a Telegram webhook which triggers on commit, but not on workflow success/failure

There is no CI/CD success/failure message directly. But we can use commit status success/failure with context and commitid to know whether/which the task success/failure.

@denyskon
Copy link
Member

Yes, but do I have to activate it separately somewhere to also get commit status over webhook?
I only get the new commit message

@denyskon
Copy link
Member

Ping :) Would really like to be able to review this before 1.22. Do I misunderstand something, or does it currently not fully work?

modules/structs/hook.go Outdated Show resolved Hide resolved
modules/structs/hook.go Outdated Show resolved Hide resolved
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 8, 2024
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 8, 2024
@denyskon
Copy link
Member

denyskon commented Mar 8, 2024

@lunny I still am not able to trigger a webhook notification. What do I need to do to be able to test it?

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 8, 2024
@lunny
Copy link
Member Author

lunny commented Mar 8, 2024

@lunny I still am not able to trigger a webhook notification. What do I need to do to be able to test it?

Sorry, I think it's not finished when you tested it. I think it's ready now.

@lunny lunny modified the milestones: 1.22.0, 1.23.0 Mar 29, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label May 14, 2024
@denyskon
Copy link
Member

denyskon commented Jul 3, 2024

@lunny Still no success. If the feature is working as intended for you, could you please provide some instructions how to test it properly?

@lunny lunny marked this pull request as ready for review November 5, 2024 15:50
@lunny lunny modified the milestones: 1.24.0, 1.23.0 Nov 5, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 7, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 7, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Nov 7, 2024
@lunny lunny enabled auto-merge (squash) November 7, 2024 06:24
@lunny lunny merged commit 331e878 into go-gitea:main Nov 7, 2024
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Nov 7, 2024
@lunny lunny deleted the lunny/commit_status_webhook branch November 7, 2024 06:46
zjjhot added a commit to zjjhot/gitea that referenced this pull request Nov 10, 2024
* giteaofficial/main:
  Refactor sidebar label selector (go-gitea#32460)
  Fix mermaid diagram height when initially hidden (go-gitea#32457)
  Add reviewers selection to new pull request (go-gitea#32403)
  Fix issue sidebar (go-gitea#32455)
  Refactor language menu and dom utils (go-gitea#32450)
  Fix broken releases when re-pushing tags (go-gitea#32435)
  Refactor issue page info (go-gitea#32445)
  Split issue sidebar into small templates (go-gitea#32444)
  Only provide the commit summary for Discord webhook push events (go-gitea#32432)
  Add new event commit status creation and webhook implementation (go-gitea#27151)
  Support quote selected comments to reply (go-gitea#32431)
  Move AddCollabrator and CreateRepositoryByExample to service layer (go-gitea#32419)

# Conflicts:
#	templates/repo/issue/view_content/context_menu.tmpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/L Denotes a PR that changes 100-499 lines, ignoring generated files. topic/webhooks type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a notification on status update failures
7 participants