-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
propose dev reload (similar to Quarkus) (#516)
Following up on similar idea from #513, and the "_Report on: Kubernetes + Event Driven Ansible using Rulebooks_" document shared with the team, this PR proposes a "dev reload" similar to [Quarkus dev mode](https://quarkus.io/guides/maven-tooling#dev-mode), that will monitor for rulebook changes and auto-reload when supplied on cli with `--dev`. In the following, I provide a demo of its use. "alternative 0" with the command line parameter NOT supplied, behaves as before:  Now I launch the same, but with `--dev` command line parameter:  it does not auto-terminate, and waits for file changes. Now I want to modify from using the generic source to the webhook source:  I wanted to send analogous events as those from the generic source, but through the webhook by using the postman application, but my rule is not triggering anymore 🤔 ... [this was intentional for the purpose of the demo] Ah yes! 😉 I should update the condition to reflect accordingly:  In the previous screenshot, I just: 1. changed the rulebook 2. saved the rulebook 3. the ansible-rulebook dev mode downscaled and restarted automatically As I send the same event from postman:  It is now working as expected. I hope this demo exemplify the intended workflow of the proposed dev mode for ansible-rulebook, inspired by Quarkus dev mode. --------- Co-authored-by: Alex <[email protected]> Co-authored-by: Madhu Kanoor <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
98345aa
commit 97cad8c
Showing
7 changed files
with
159 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Ruleset 1 | ||
hosts: all | ||
sources: | ||
- generic: | ||
payload: | ||
- action: "value_a" | ||
rules: | ||
- name: Matching for value_a | ||
condition: event.action == "value_a" | ||
action: | ||
debug: | ||
msg: "Rule 1: I matched for value_a" | ||
- name: Matching for value_b | ||
condition: event.action == "value_b" | ||
action: | ||
debug: | ||
msg: "Rule 2: I have now matched for value_b" |
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
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