Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/rulesets/branches/default-branch-required.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
"strict_required_status_checks_policy": true,
"do_not_enforce_on_create": false,
"required_status_checks": [
{
"context": "unittest-complete",
"integration_id": 15368
},
{
"context": "crucible-ci-complete",
"integration_id": 15368
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/crucible-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,21 @@ jobs:
.github/workflows/crucible-ci.yaml
.github/workflows/fork-check.yaml
.github/workflows/controller-build.yaml
.github/workflows/unittest.yaml
docs/**
engine/engine-script-library.py
engine/engine-script.py
userenvs/rhel-ai-*.json
- name: Display changes
run: echo '${{ toJSON(steps.filter.outputs) }}' | jq .

call-real-core-release-crucible-ci:
call-unittest:
needs: changes
if: ${{ github.event.pull_request.head.repo.fork != true && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.only-docs != 'true') }}
uses: ./.github/workflows/unittest.yaml

call-real-core-release-crucible-ci:
needs: [ changes, call-unittest ]
if: ${{ github.event.pull_request.head.repo.fork != true && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.only-docs != 'true') }}
uses: perftool-incubator/crucible-ci/.github/workflows/core-release-crucible-ci.yaml@main
with:
ci_target: "rickshaw"
Expand All @@ -55,7 +59,7 @@ jobs:
uses: perftool-incubator/crucible-ci/.github/workflows/faux-core-release-crucible-ci.yaml@main

crucible-ci-complete:
needs: [ call-real-core-release-crucible-ci, call-faux-core-release-crucible-ci ]
needs: [ call-unittest, call-real-core-release-crucible-ci, call-faux-core-release-crucible-ci ]
if: always()
runs-on: ubuntu-latest
steps:
Expand Down
58 changes: 3 additions & 55 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,15 @@
name: unittest

on:
pull_request:
branches: [ master ]
workflow_call:
workflow_dispatch:

concurrency:
group: ${{ github.ref }}/unittest
cancel-in-progress: true
permissions:
contents: read

jobs:
changes:
runs-on: ubuntu-latest
outputs:
only-docs: ${{ steps.filter.outputs.only_modified }}
steps:
- uses: actions/checkout@v4
- id: filter
uses: tj-actions/changed-files@v47
with:
files: |
LICENSE
*.md
**/*.md
.github/rulesets/**
.github/workflows/run-crucible-tracking.yaml
.github/workflows/crucible-merged.yaml
.github/workflows/crucible-ci.yaml
.github/workflows/fork-check.yaml
.github/workflows/controller-build.yaml
.github/workflows/unittest.yaml
docs/**
engine/engine-script-library.py
engine/engine-script.py
userenvs/rhel-ai-*.json
- name: Display changes
run: echo '${{ toJSON(steps.filter.outputs) }}' | jq .

blockbreaker:
runs-on: ubuntu-latest
needs: changes
if: ${{ github.event.pull_request.head.repo.fork != true && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.only-docs != 'true') }}
steps:
- uses: actions/checkout@v4

Expand All @@ -65,8 +34,6 @@ jobs:

rickshaw-run-tests:
runs-on: ubuntu-latest
needs: changes
if: ${{ github.event.pull_request.head.repo.fork != true && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.only-docs != 'true') }}
steps:
- uses: actions/checkout@v4

Expand All @@ -86,22 +53,3 @@ jobs:
with:
name: rickshaw-run-tests-report
path: report.html

faux-unittest:
runs-on: ubuntu-latest
needs: changes
if: ${{ github.event.pull_request.head.repo.fork != true && github.event_name != 'workflow_dispatch' && needs.changes.outputs.only-docs == 'true' }}
steps:
- run: echo "faux-unittest-complete"

unittest-complete:
runs-on: ubuntu-latest
needs: [ blockbreaker, rickshaw-run-tests, faux-unittest ]
if: always()
steps:
- name: Check Results
if: >-
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')
run: exit 1
- run: echo "unittest-complete"
76 changes: 24 additions & 52 deletions endpoints/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
save_received_messages as _tb_save_received_messages,
ROADBLOCK_EXITS,
)
from toolbox.roadblock import do_roadblock as _tb_do_roadblock

ROADBLOCK_HOME = os.environ.get('ROADBLOCK_HOME')
if ROADBLOCK_HOME is None:
Expand All @@ -53,7 +54,6 @@
print("ERROR: <ROADBLOCK_HOME>/roadblock.py ('%s') does not exist!" % (p))
exit(2)
sys.path.append(str(Path(ROADBLOCK_HOME)))
from roadblock import roadblock
from roadblock import VERBOSE_DEBUG_LEVEL

roadblock_exits = ROADBLOCK_EXITS
Expand Down Expand Up @@ -620,6 +620,11 @@ def do_roadblock(roadblock_id = None, label = None, timeout = None, messages = N
"""
Run a roadblock

Thin endpoint-specific wrapper around toolbox.roadblock.do_roadblock():
adds the pre-connect ping diagnostic and message stream logging that
callers of this function rely on, then delegates the actual roadblock
mechanics to the shared implementation also used by engine_lib.py.

Args:
roadblock_id (str): The base ID to use as part of the roadblock's name
label (str): The name of the roadblock to participate in
Expand All @@ -643,37 +648,17 @@ def do_roadblock(roadblock_id = None, label = None, timeout = None, messages = N
raise ValueError("No roadblock label specified")

logger.info("Processing roadblock '%s'" % (label), stacklevel = 2)
uuid = "%s:%s" % (roadblock_id, label)
logger.info("[%s] Roadblock uuid is '%s'" % (label, uuid))

if timeout is None:
timeout = 300
logger.info("[%s] No roadblock timeout specified, defaulting to %d" % (label, timeout))
else:
logger.info("[%s] Roadblock timeout set to %d" % (label, timeout))

if messages is None:
logger.info("[%s] No roadblock messages to send" % (label))
else:
logger.info("[%s] Sending roadblock messages %s" % (label, messages))

if wait_for is None:
logger.info("[%s] No roadblock wait-for" % (label))
else:
wait_for_log = tempfile.mkstemp(suffix = "log")
os.close(wait_for_log[0])
wait_for_log = wait_for_log[1]
logger.info("[%s] Going to run this wait-for command: %s" % (label, wait_for))
logger.info("[%s] Going to log wait-for to this file: %s" % (label, wait_for_log))

if not abort is None and not abort is False:
logger.info("[%s] Going to send an abort" % (label))

msgs_log_file = msgs_dir + "/" + label + ".json"
logger.info("[%s] Logging messages to: %s" % (label, msgs_log_file))

redis_server = "localhost"
leader = "controller"

result = run_local("ping -w 10 -c 4 " + redis_server)
ping_log_msg = "[%s] Pinged redis server '%s' with return code %d:\nstdout:\n%sstderr:\n%s" % (label, redis_server, result.exited, result.stdout, result.stderr)
Expand All @@ -682,44 +667,31 @@ def do_roadblock(roadblock_id = None, label = None, timeout = None, messages = N
else:
logger.info(ping_log_msg)

my_roadblock = roadblock(None, None)
my_roadblock.set_uuid(uuid)
my_roadblock.set_role("follower")
my_roadblock.set_follower_id(follower_id)
my_roadblock.set_leader_id(leader)
my_roadblock.set_timeout(timeout)
my_roadblock.set_redis_server(redis_server)
my_roadblock.set_redis_password(redis_password)
my_roadblock.set_abort(abort)
my_roadblock.set_message_log(msgs_log_file)
my_roadblock.set_user_messages(messages)
if not wait_for is None:
my_roadblock.set_wait_for_cmd(wait_for)
my_roadblock.set_wait_for_log(wait_for_log)
if connection_watchdog:
my_roadblock.set_connection_watchdog("enabled")
else:
my_roadblock.set_connection_watchdog("disabled")

rc = my_roadblock.run_it()
rc, _ = _tb_do_roadblock(roadblock_id = roadblock_id,
label = label,
role = "follower",
follower_id = follower_id,
leader_id = "controller",
timeout = timeout,
redis_server = redis_server,
redis_password = redis_password,
messages = messages,
abort = abort,
connection_watchdog = connection_watchdog,
msgs_dir = msgs_dir,
wait_for = wait_for)
result_log_msg = "[%s] Roadblock resulted in return code %d" % (label, rc)
if rc != 0:
logger.error(result_log_msg)
else:
logger.info(result_log_msg)

stream = ""
with open(msgs_log_file, "r", encoding = "ascii") as msgs_log_file_fp:
for line in msgs_log_file_fp:
stream += line
logger.info("[%s] Logged messages from roadblock:\n%s" % (label, stream))

if not wait_for is None:
if os.path.exists(msgs_log_file):
stream = ""
with open(wait_for_log, "r", encoding = "ascii") as wait_for_log_fp:
for line in wait_for_log_fp:
stream += line
logger.info("[%s] Wait-for log from raodblock:\n%s" % (label, stream))
with open(msgs_log_file, "r", encoding = "ascii") as msgs_log_file_fp:
for line in msgs_log_file_fp:
stream += line
logger.info("[%s] Logged messages from roadblock:\n%s" % (label, stream))

logger.info("[%s] Returning %d" % (label, rc))
return rc
Expand Down
Loading
Loading