Skip to content

Conversation

@shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Feb 19, 2024

Description

Feature spec: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Webhooks

Webhooks allow external services to be notified when certain events happen.

To implement and make Webhook work as an event bus, changes have been made to publish messages on multiple active message buses.
Fixes #6778

Documentation PR: apache/cloudstack-documentation#385

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

Screenshot from 2024-02-20 13-54-49
Screenshot from 2024-02-20 13-55-19
Screenshot from 2024-02-20 13-56-31

How Has This Been Tested?

How did you try to break this feature and the system with this change?

shwstppr and others added 22 commits February 13, 2024 11:55
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
Signed-off-by: Abhishek Kumar <[email protected]>
@codecov
Copy link

codecov bot commented Feb 19, 2024

Codecov Report

Attention: Patch coverage is 58.53324% with 605 lines in your changes are missing coverage. Please review.

Project coverage is 31.34%. Comparing base (a0b642c) to head (b054e0c).
Report is 1 commits behind head on main.

Files Patch % Lines
.../cloudstack/mom/webhook/WebhookApiServiceImpl.java 62.42% 80 Missing and 41 partials ⚠️
ui/src/views/tools/CreateWebhook.vue 0.00% 82 Missing ⚠️
ui/src/components/view/WebhookDeliveriesTab.vue 0.00% 69 Missing ⚠️
ui/src/components/view/TestWebhookDeliveryView.vue 0.00% 52 Missing ⚠️
...che/cloudstack/mom/webhook/WebhookServiceImpl.java 69.86% 37 Missing and 7 partials ⚠️
.../cloudstack/mom/webhook/WebhookDeliveryThread.java 74.80% 23 Missing and 9 partials ⚠️
...rg/apache/cloudstack/mom/webhook/vo/WebhookVO.java 49.18% 31 Missing ⚠️
ui/src/config/section/tools.js 0.00% 30 Missing ⚠️
ui/src/views/tools/TestWebhookDelivery.vue 0.00% 22 Missing ⚠️
ui/src/components/view/SearchView.vue 5.26% 18 Missing ⚠️
... and 19 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8674      +/-   ##
============================================
+ Coverage     30.91%   31.34%   +0.43%     
- Complexity    33734    34355     +621     
============================================
  Files          5404     5432      +28     
  Lines        380289   381645    +1356     
  Branches      55489    55655     +166     
============================================
+ Hits         117550   119634    +2084     
+ Misses       247104   246194     -910     
- Partials      15635    15817     +182     
Flag Coverage Δ
simulator-marvin-tests 25.20% <68.63%> (+0.66%) ⬆️
uitests 4.31% <1.38%> (-0.03%) ⬇️
unit-tests 16.89% <18.97%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 9818

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Signed-off-by: Abhishek Kumar <[email protected]>
@blueorangutan
Copy link

Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 9820

@shwstppr
Copy link
Contributor Author

shwstppr commented Jun 7, 2024

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9822

@shwstppr
Copy link
Contributor Author

shwstppr commented Jun 7, 2024

@blueorangutan test

@blueorangutan
Copy link

@shwstppr a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10391)

@shwstppr
Copy link
Contributor Author

shwstppr commented Jun 8, 2024

@blueorangutan test

@blueorangutan
Copy link

@shwstppr a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-10394)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 44993 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8674-t10394-kvm-centos7.zip
Smoke tests completed. 134 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@rohityadavcloud rohityadavcloud merged commit be552fd into apache:main Jun 10, 2024
@rohityadavcloud rohityadavcloud deleted the add-feature-webhooks branch June 10, 2024 05:10
rohityadavcloud pushed a commit to apache/cloudstack-documentation that referenced this pull request Jun 10, 2024
* feature: webhooks

Documentation for apache/cloudstack#8674

* changes

Signed-off-by: Abhishek Kumar <[email protected]>

* changes

Signed-off-by: Abhishek Kumar <[email protected]>

* changes

Signed-off-by: Abhishek Kumar <[email protected]>

* Update source/adminguide/events/webhooks.rst

* note regarding duplicate event deliveries

Signed-off-by: Abhishek Kumar <[email protected]>

* note on self-signed https payload url

Signed-off-by: Abhishek Kumar <[email protected]>

---------

Signed-off-by: Abhishek Kumar <[email protected]>
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jun 17, 2024
* api,server,ui: weebhoks feature

Signed-off-by: Abhishek Kumar <[email protected]>

* fix

Signed-off-by: Abhishek Kumar <[email protected]>

* fix

Signed-off-by: Abhishek Kumar <[email protected]>

* changes

Signed-off-by: Abhishek Kumar <[email protected]>

* registry of message busses

* test bus

Signed-off-by: Abhishek Kumar <[email protected]>

* refactor

Signed-off-by: Abhishek Kumar <[email protected]>

* test

Signed-off-by: Abhishek Kumar <[email protected]>

* fix and refactor

Signed-off-by: Abhishek Kumar <[email protected]>

* changes for webhook dispatch history

Signed-off-by: Abhishek Kumar <[email protected]>

* changes, initial ui

Signed-off-by: Abhishek Kumar <[email protected]>

* improvements

Signed-off-by: Abhishek Kumar <[email protected]>

* changes for account webhook cleanup

Signed-off-by: Abhishek Kumar <[email protected]>

* fix remaining event bus usage

Signed-off-by: Abhishek Kumar <[email protected]>

* changes for testing webhook dispatch

Signed-off-by: Abhishek Kumar <[email protected]>

* wip

Signed-off-by: Abhishek Kumar <[email protected]>

* fix test

Signed-off-by: Abhishek Kumar <[email protected]>

* make element

Signed-off-by: Abhishek Kumar <[email protected]>

* missing

Signed-off-by: Abhishek Kumar <[email protected]>

* buid fix

* fix lint

Signed-off-by: Abhishek Kumar <[email protected]>

* changes for project delete check

Signed-off-by: Abhishek Kumar <[email protected]>

* fix

Signed-off-by: Abhishek Kumar <[email protected]>

* add collapse in create

Signed-off-by: Abhishek Kumar <[email protected]>

* ui fix and refactor for eventditributor publish

Signed-off-by: Abhishek Kumar <[email protected]>

* update org.json and add json validation

Signed-off-by: Abhishek Kumar <[email protected]>

* schema fixes

Signed-off-by: Abhishek Kumar <[email protected]>

* wordings

Signed-off-by: Abhishek Kumar <[email protected]>

* ui: improve progress button

Signed-off-by: Abhishek Kumar <[email protected]>

* ui improvements

Signed-off-by: Abhishek Kumar <[email protected]>

* remove unrelated change

Signed-off-by: Abhishek Kumar <[email protected]>

* search and count

Signed-off-by: Abhishek Kumar <[email protected]>

* add payloadurl in info

Signed-off-by: Abhishek Kumar <[email protected]>

* positive progress

Signed-off-by: Abhishek Kumar <[email protected]>

* fix hmac key

Signed-off-by: Abhishek Kumar <[email protected]>

* create webhook form fixes

Signed-off-by: Abhishek Kumar <[email protected]>

* refactor, address feedback

Signed-off-by: Abhishek Kumar <[email protected]>

* indentation

Signed-off-by: Abhishek Kumar <[email protected]>

* fix filters

Signed-off-by: Abhishek Kumar <[email protected]>

* remove test eventbus

Signed-off-by: Abhishek Kumar <[email protected]>

* default scope be Local

Signed-off-by: Abhishek Kumar <[email protected]>

* add lifecycle smoke test

Signed-off-by: Abhishek Kumar <[email protected]>

* add test for webhook deliveries

Signed-off-by: Abhishek Kumar <[email protected]>

* refactor

Signed-off-by: Abhishek Kumar <[email protected]>

* fix lint

Signed-off-by: Abhishek Kumar <[email protected]>

* refactor - losgs and others

Signed-off-by: Abhishek Kumar <[email protected]>

* unit tests

Signed-off-by: Abhishek Kumar <[email protected]>

* fix lint

Signed-off-by: Abhishek Kumar <[email protected]>

* build fix

Signed-off-by: Abhishek Kumar <[email protected]>

* smoke test fix, log refactor

Signed-off-by: Abhishek Kumar <[email protected]>

* get bean from all components

Signed-off-by: Abhishek Kumar <[email protected]>

* ui: missing label

Signed-off-by: Abhishek Kumar <[email protected]>

* address review comments

Signed-off-by: Abhishek Kumar <[email protected]>

* add some more tests

Signed-off-by: Abhishek Kumar <[email protected]>

* lint

Signed-off-by: Abhishek Kumar <[email protected]>

* rename setting

Signed-off-by: Abhishek Kumar <[email protected]>

* upgrade: move 4.19.0->4.20.0 to 4.19.1->4.20.0

* fix test delivery layout

Signed-off-by: Abhishek Kumar <[email protected]>

* fix webhook secret display

Signed-off-by: Abhishek Kumar <[email protected]>

* add http to payloadurl when no scheme

Signed-off-by: Abhishek Kumar <[email protected]>

* allow removing secretkey for webhook

Signed-off-by: Abhishek Kumar <[email protected]>

* fix update sslverification

Signed-off-by: Abhishek Kumar <[email protected]>

* disallow same payload url for same account

Signed-off-by: Abhishek Kumar <[email protected]>

* fix delivery with url w/o scheme

Signed-off-by: Abhishek Kumar <[email protected]>

* api: listApis should return params based on caller

Signed-off-by: Abhishek Kumar <[email protected]>

* wip changes

Signed-off-by: Abhishek Kumar <[email protected]>

* Update engine/schema/src/main/resources/META-INF/db/schema-41900to42000.sql

* remove unique constraint for now

Constraint is present in Java code validations

Signed-off-by: Abhishek Kumar <[email protected]>

* fixes

Signed-off-by: Abhishek Kumar <[email protected]>

* ui: add option to delete multiple deliveries

Signed-off-by: Abhishek Kumar <[email protected]>

* add filter for deliveries, delete api start/endtime support

Signed-off-by: Abhishek Kumar <[email protected]>

* do not throw error when no deliveries removed

Signed-off-by: Abhishek Kumar <[email protected]>

* ui: fix deliveries table column sorting, time filter cancel

Signed-off-by: Abhishek Kumar <[email protected]>

* remove isDebugEnabled wrapping

* merge fix

Signed-off-by: Abhishek Kumar <[email protected]>

---------

Signed-off-by: Abhishek Kumar <[email protected]>
Co-authored-by: Daan Hoogland <[email protected]>
Co-authored-by: Wei Zhou <[email protected]>
GaOrtiga pushed a commit to GaOrtiga/cloudstack-documentation that referenced this pull request Jun 28, 2024
* feature: webhooks

Documentation for apache/cloudstack#8674

* changes

Signed-off-by: Abhishek Kumar <[email protected]>

* changes

Signed-off-by: Abhishek Kumar <[email protected]>

* changes

Signed-off-by: Abhishek Kumar <[email protected]>

* Update source/adminguide/events/webhooks.rst

* note regarding duplicate event deliveries

Signed-off-by: Abhishek Kumar <[email protected]>

* note on self-signed https payload url

Signed-off-by: Abhishek Kumar <[email protected]>

---------

Signed-off-by: Abhishek Kumar <[email protected]>
@btzq
Copy link

btzq commented Aug 28, 2024

@shwstppr this is a great feature for us.
Does this include Healthcheck Fails for Virtual Routers?

@shwstppr
Copy link
Contributor Author

shwstppr commented Aug 28, 2024

@btzq I'm not sure if ACS currently publishes a separate event for router healthcheck fails but it does publish an event with type ROUTER.HEALTH.CHECKS which can be used in the webhook.

An example description of such event,

Router r-9-VM / 9974ef30-b2fe-4c05-a2e3-57d3cfaf0b4b has failing checks: gateways_check.py

@btzq
Copy link

btzq commented Aug 28, 2024

@shwstppr under events, i only could find this:

Screenshot 2024-08-28 at 1 38 10 PM

But it seems to be under (Level = INFO) (Type = Health Check)

@btzq
Copy link

btzq commented Aug 28, 2024

@shwstppr I think thats pretty good for us, we just need to have an alert when there is a failing health check.

Right now, we have to login in ACS every few minutes and check the UI. We dont have RabbitMQ/Kafka installed.

@shwstppr
Copy link
Contributor Author

@btzq that Type showing as Health check is a UI thing. If you check the API response it will have proper type,

    "listeventsresponse": {
        "count": 1,
        "event": [
            {
                "id": "36c995da-7b14-4083-9164-c486c7796b8c",
                "username": "system",
                "type": "ROUTER.HEALTH.CHECKS",
                "level": "INFO",
                "description": "Router r-9-VM / 9974ef30-b2fe-4c05-a2e3-57d3cfaf0b4b has failing checks: gateways_check.py",
                "account": "system",
                "domainid": "62a64961-4b15-11ef-953b-1e0054000142",
                "domain": "ROOT",
                "resourceid": "9974ef30-b2fe-4c05-a2e3-57d3cfaf0b4b",
                "resourcetype": "DomainRouter",
                "resourcename": "r-9-VM",
                "created": "2024-08-28T05:13:46+0000",
                "state": "Completed"
            }
        ]
    }

Maybe test creating a Global webhook and try there

@btzq
Copy link

btzq commented Aug 28, 2024

I see, Thank you @shwstppr excited to test this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If Kafka is turned on internal subs dont work

9 participants