Skip to content

Commit

Permalink
Merge branch 'main' into docs-mwtt
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Izquierdo authored Oct 4, 2023
2 parents f549587 + 53875da commit 6f4afda
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 14 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,26 @@ env:
QUAY_USER: ansible+eda_gha

jobs:
build-and-test-image:
if: github.repository == 'ansible/ansible-rulebook'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build local image
run: docker build -t localhost/ansible-rulebook:test .

- name: Run tests
run: >
docker run --rm -u 0 localhost/ansible-rulebook:test bash -c '
pip install -r requirements_test.txt &&
pytest -m "e2e" -n auto'
build-and-push-image:
needs: build-and-test-image
if: github.repository == 'ansible/ansible-rulebook'
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@ on:
push:
branches:
- "main"
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
branches:
- "main"
paths-ignore:
- "docs/**"
- "*.md"
workflow_dispatch:

jobs:
Expand Down
21 changes: 21 additions & 0 deletions docs/actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Run an Ansible playbook.
* - json_mode
- Boolean, sends the playbook events data to the stdout as json strings as they are processed by ansible-runner
- No
* - copy_files
- Boolean, copy the local playbook file to the ansible-runner project directory, this is not needed if you are running a playbook from an ansible collection.
- No


run_module
Expand Down Expand Up @@ -96,6 +99,21 @@ Run an Ansible module
* - extra_vars
- Additional vars to be passed into the playbook as extra vars.
- No
* - json_mode
- Boolean, sends the playbook events data to the stdout as json strings as they are processed by ansible-runner
- No
* - set_facts
- Boolean, the artifacts from the module execution are inserted back into the rule set as facts
- No
* - post_events
- Boolean, the artifacts from the module execution are inserted back into the rule set as events
- No
* - ruleset
- The name of the ruleset to post the event or assert the fact to, default is current rule set.
- No
* - var_root
- If the event is a deeply nested dictionary, the var_root can specify the key name whose value should replace the matching event value. The var_root can take a dictionary to account for data when we have multiple matching events.
- No

run_job_template
****************
Expand Down Expand Up @@ -312,6 +330,9 @@ retract_fact
* - ruleset
- The name of the rule set to retract the fact, default is the current rule set name
- No
* - partial
- The fact being requested to retracted is partial and doesn't have all the keys. Default is true
- No

Example:

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/test_match_multiple_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ async def test_match_multiple_rules():
and send the event messages to a websocket server
"""
# variables
host = "localhost"
host = "127.0.0.1"
endpoint = "/api/ws2"
proc_id = "42"
port = 31415
rulebook = utils.BASE_DATA_PATH / "rulebooks/test_match_multiple_rules.yml"
websocket_address = f"ws://localhost:{port}{endpoint}"
websocket_address = f"ws://127.0.0.1:{port}{endpoint}"
cmd = utils.Command(
rulebook=rulebook,
websocket=websocket_address,
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/test_non_alpha_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ async def test_non_alpha_numeric_keys():
and send the event messages to a websocket server
"""
# variables
host = "localhost"
host = "127.0.0.1"
endpoint = "/api/ws2"
proc_id = "42"
port = 31415
rulebook = utils.EXAMPLES_PATH / "82_non_alpha_keys.yml"
websocket_address = f"ws://localhost:{port}{endpoint}"
websocket_address = f"ws://127.0.0.1:{port}{endpoint}"
cmd = utils.Command(
rulebook=rulebook,
websocket=websocket_address,
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/test_run_module_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ async def test_run_module_output():
run_module and then used in a condition
"""
# variables
host = "localhost"
host = "127.0.0.1"
endpoint = "/api/ws2"
proc_id = "42"
port = 31415
rulebook = utils.EXAMPLES_PATH / "29_run_module.yml"
websocket_address = f"ws://localhost:{port}{endpoint}"
websocket_address = f"ws://127.0.0.1:{port}{endpoint}"
cmd = utils.Command(
rulebook=rulebook,
websocket=websocket_address,
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/test_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ async def test_websocket_messages():
send event messages to a websocket server
"""
# variables
host = "localhost"
host = "127.0.0.1"
endpoint = "/api/ws2"
proc_id = "42"
port = 31415
rulebook = (
utils.BASE_DATA_PATH / "rulebooks/websockets/test_websocket_range.yml"
)
websocket_address = f"ws://localhost:{port}{endpoint}"
websocket_address = f"ws://127.0.0.1:{port}{endpoint}"
cmd = utils.Command(
rulebook=rulebook,
websocket=websocket_address,
Expand Down

0 comments on commit 6f4afda

Please sign in to comment.