diff --git a/.github/workflows/cijoe_docker.yml b/.github/workflows/cijoe_docker.yml index 9f7c3048..03b8a008 100644 --- a/.github/workflows/cijoe_docker.yml +++ b/.github/workflows/cijoe_docker.yml @@ -16,7 +16,7 @@ on: env: DOCKER_IMAGE: ghcr.io/${{ github.repository_owner }}/cijoe-docker - DOCKER_TAG: v0.9.56 + DOCKER_TAG: v0.9.57 jobs: build_and_push: diff --git a/src/cijoe/core/__init__.py b/src/cijoe/core/__init__.py index 8c9f177c..2be9c1be 100644 --- a/src/cijoe/core/__init__.py +++ b/src/cijoe/core/__init__.py @@ -1 +1 @@ -__version__ = "0.9.56" +__version__ = "0.9.57" diff --git a/src/cijoe/core/scripts/wait_for_ssh.py b/src/cijoe/core/scripts/wait_for_transport.py similarity index 72% rename from src/cijoe/core/scripts/wait_for_ssh.py rename to src/cijoe/core/scripts/wait_for_transport.py index 62499c5d..69c723b6 100644 --- a/src/cijoe/core/scripts/wait_for_ssh.py +++ b/src/cijoe/core/scripts/wait_for_transport.py @@ -1,34 +1,56 @@ #!/usr/bin/env python3 """ -Wait for SSH transport state (up or down) -========================================= - -This script is useful in CIJOE workflows where you want to block until a remote -transport becomes available (e.g., after a reboot) or until it goes away (e.g., -while shutting down). A common usecase would look like the below steps in -a workflow: - -- name: reboot - run: shutdown -r now - -- name: wait_for_down - uses: wait_for_transport - with: - state: "down" - timeout: 60 - -- name: wait_for_up - uses: wait_for_transport - with: - state: "up" - timeout: 300 - -The transport is considered "up" if a trivial command can be executed -successfully over it. For portability across Linux, macOS, BSD, and Windows, the -probe command used is: hostname. - -Retargetable: True ------------------- +Wait for Transport State (Up or Down) +===================================== + +This script is useful in CIJOE workflows where execution should block until a +transport becomes available (e.g., after a reboot) or unavailable (e.g., during +shutdown). + +Transport Configuration +----------------------- + +Transports are defined in ``config.toml`` under the key +``cijoe.transport.{transport_name}``. For example:: + + [cijoe.transport.ssh] + username = "foo" + hostname = "bar" + +Note: ``ssh`` is a transport **name**, not a transport type. +So, ``transport_name = "ssh"``. + +Example Use Case +---------------- + +A typical workflow might look like:: + + - name: reboot + run: shutdown -r now + + - name: wait_for_down + uses: wait_for_transport + with: + state: "down" + timeout: 60 + + - name: wait_for_up + uses: wait_for_transport + with: + state: "up" + timeout: 300 + +Transport State Detection +------------------------- + +The transport is considered *up* if a simple command can be executed +successfully over it. To ensure portability across Linux, macOS, BSD, and +Windows, the ``hostname`` command is used as the probe. + +Retargetable +------------ + +**True** """ import logging as log diff --git a/src/cijoe/qemu/workflows/example_workflow_guest_aarch64.yaml b/src/cijoe/qemu/workflows/example_workflow_guest_aarch64.yaml index 5b7586c6..1aaddfbd 100644 --- a/src/cijoe/qemu/workflows/example_workflow_guest_aarch64.yaml +++ b/src/cijoe/qemu/workflows/example_workflow_guest_aarch64.yaml @@ -36,7 +36,7 @@ steps: guest_name: generic-uefi-tcg-aarch64 - name: guest_wait_start - uses: core.wait_for_ssh + uses: core.wait_for_transport with: transport_name: qemu_guest timeout: 120 diff --git a/src/cijoe/qemu/workflows/example_workflow_guest_x86_64.yaml b/src/cijoe/qemu/workflows/example_workflow_guest_x86_64.yaml index cb605dd5..87c57486 100644 --- a/src/cijoe/qemu/workflows/example_workflow_guest_x86_64.yaml +++ b/src/cijoe/qemu/workflows/example_workflow_guest_x86_64.yaml @@ -36,7 +36,7 @@ steps: guest_name: generic-bios-kvm-x86_64 - name: guest_wait_start - uses: core.wait_for_ssh + uses: core.wait_for_transport with: transport_name: qemu_guest timeout: 120