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
2 changes: 1 addition & 1 deletion .github/workflows/cijoe_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/cijoe/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.56"
__version__ = "0.9.57"
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down