Skip to content

propose iterative dev tips - #513

Open
tarilabs wants to merge 1 commit into
ansible:mainfrom
tarilabs:tarilabs-20230524
Open

tarilabs wants to merge 1 commit into
ansible:mainfrom
tarilabs:tarilabs-20230524

Conversation

@tarilabs

Copy link
Copy Markdown
Contributor

Proposing adding per $subject based on modest personal experience new to this world 😅

For instance this helped me realise the generic source:

Screenshot 2023-05-24 at 12 36 19 (2)

when compared to the webhook does not want the .payload.:
Screenshot 2023-05-24 at 12 37 01 (2)

and used some unicode tricks to better notice the lines I was looking for:
Screenshot 2023-05-24 at 12 37 32 (2)

The suggested flow in the docs imho helps in order not to having to retrigger the command manually.

mkanoor added a commit that referenced this pull request Sep 7, 2023
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:
![Screenshot 2023-05-25 at 14 44
15](https://github.com/ansible/ansible-rulebook/assets/1699252/96b315f3-b80a-433b-b8ab-b01bbd2b3b80)

Now I launch the same, but with `--dev` command line parameter:

![Screenshot 2023-05-25 at 14 46
06](https://github.com/ansible/ansible-rulebook/assets/1699252/69d09563-a13d-4f5f-85f0-5ac6ec87118d)

it does not auto-terminate, and waits for file changes.
Now I want to modify from using the generic source to the webhook
source:

![Screenshot 2023-05-25 at 14 46
48](https://github.com/ansible/ansible-rulebook/assets/1699252/cd333090-0c3c-45b6-b6c5-52998c504fb1)

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:

![Screenshot 2023-05-25 at 14 47
05](https://github.com/ansible/ansible-rulebook/assets/1699252/15775338-7088-47e0-a066-4726c1cbb56e)

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:

![Screenshot 2023-05-25 at 14 47
11](https://github.com/ansible/ansible-rulebook/assets/1699252/0460a667-8ede-4a30-aa62-4d949f75c0c9)

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 <aizquier@redhat.com>
Co-authored-by: Madhu Kanoor <mkanoor@redhat.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant