[PR #11859] [MERGED] Closes #8958: Add webhook support for jobs #13858

Closed
opened 2025-12-29 23:21:12 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/11859
Author: @jeremystretch
Created: 2/28/2023
Status: Merged
Merged: 3/8/2023
Merged by: @jeremystretch

Base: featureHead: 8958-job-webhooks


📝 Commits (4)

  • 19c1691 Add type_job_start & type_job_end to Webhook
  • 331d22b Replace JobResult.set_status() with terminate()
  • d23ef2d Add trigger_webhooks() to JobResult
  • 1e027fc Undo change to default status for object type_* fields on Webhook

📊 Changes

18 files changed (+260 additions, -100 deletions)

View changed files

📝 docs/models/extras/webhook.md (+11 -5)
📝 netbox/core/jobs.py (+3 -2)
📝 netbox/extras/api/serializers.py (+4 -3)
📝 netbox/extras/constants.py (+9 -1)
📝 netbox/extras/filtersets.py (+2 -2)
📝 netbox/extras/forms/bulk_edit.py (+8 -0)
📝 netbox/extras/forms/bulk_import.py (+3 -3)
📝 netbox/extras/forms/filtersets.py (+21 -4)
📝 netbox/extras/forms/model_forms.py (+3 -1)
📝 netbox/extras/management/commands/runscript.py (+11 -13)
netbox/extras/migrations/0088_jobresult_webhooks.py (+23 -0)
📝 netbox/extras/models/models.py (+64 -18)
📝 netbox/extras/reports.py (+4 -10)
📝 netbox/extras/scripts.py (+19 -27)
📝 netbox/extras/tables/tables.py (+11 -4)
📝 netbox/extras/tests/test_filtersets.py (+49 -3)
📝 netbox/extras/webhooks_worker.py (+7 -4)
📝 netbox/templates/extras/webhook.html (+8 -0)

📄 Description

Closes: #8958

  • Introduces two new event types for webhooks: job_start and job_end
  • Replace the set_status() method on JobResult with terminate()
  • Extend the start() and terminate() methods on JobResult to handle webhook queueing
  • Script and Report classes now inherit from WebhooksMixin
  • snapshots becomes a conditional key in webhook payload (as it pertains only to object changes)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/11859 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 2/28/2023 **Status:** ✅ Merged **Merged:** 3/8/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `8958-job-webhooks` --- ### 📝 Commits (4) - [`19c1691`](https://github.com/netbox-community/netbox/commit/19c169159ff4d97df66ac7d91e7c88616be79117) Add type_job_start & type_job_end to Webhook - [`331d22b`](https://github.com/netbox-community/netbox/commit/331d22b2d3e9207f4b6a107f744dbc1e0457c9be) Replace JobResult.set_status() with terminate() - [`d23ef2d`](https://github.com/netbox-community/netbox/commit/d23ef2de61e07688b6455450c980e7a3ae6395a1) Add trigger_webhooks() to JobResult - [`1e027fc`](https://github.com/netbox-community/netbox/commit/1e027fc8fbf4268cc691e47c48ed4e7c4b3324cb) Undo change to default status for object type_* fields on Webhook ### 📊 Changes **18 files changed** (+260 additions, -100 deletions) <details> <summary>View changed files</summary> 📝 `docs/models/extras/webhook.md` (+11 -5) 📝 `netbox/core/jobs.py` (+3 -2) 📝 `netbox/extras/api/serializers.py` (+4 -3) 📝 `netbox/extras/constants.py` (+9 -1) 📝 `netbox/extras/filtersets.py` (+2 -2) 📝 `netbox/extras/forms/bulk_edit.py` (+8 -0) 📝 `netbox/extras/forms/bulk_import.py` (+3 -3) 📝 `netbox/extras/forms/filtersets.py` (+21 -4) 📝 `netbox/extras/forms/model_forms.py` (+3 -1) 📝 `netbox/extras/management/commands/runscript.py` (+11 -13) ➕ `netbox/extras/migrations/0088_jobresult_webhooks.py` (+23 -0) 📝 `netbox/extras/models/models.py` (+64 -18) 📝 `netbox/extras/reports.py` (+4 -10) 📝 `netbox/extras/scripts.py` (+19 -27) 📝 `netbox/extras/tables/tables.py` (+11 -4) 📝 `netbox/extras/tests/test_filtersets.py` (+49 -3) 📝 `netbox/extras/webhooks_worker.py` (+7 -4) 📝 `netbox/templates/extras/webhook.html` (+8 -0) </details> ### 📄 Description ### Closes: #8958 - Introduces two new event types for webhooks: `job_start` and `job_end` - Replace the `set_status()` method on `JobResult` with `terminate()` - Extend the `start()` and `terminate()` methods on `JobResult` to handle webhook queueing - `Script` and `Report` classes now inherit from `WebhooksMixin` - `snapshots` becomes a conditional key in webhook payload (as it pertains only to object changes) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:21:12 +01:00
adam closed this issue 2025-12-29 23:21:12 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13858