logs.gokuls.in

4 pull requests merged across 2 repos

Offline-Protocol/offline-protocol-sdk

Main's CI is red and #670 cannot go green, and macos-14 is retired on November 2. This carries #670's commit plus the fixes for both, so merging it also lands #670.

Main (Python Wheel (windows-x86_64), run 41192023539): a timing flake. test_a_slow_call_leaves_the_loop_ticking_and_other_calls_waiting assumed a 1 s stall outlasted its setup; on a slow runner b waited only 0.25 s. The stall is now a gate the test releases, so every step runs inside it. Without the call lock the rewritten test fails.

#670 (Python Wheel (macos-arm64) on macos-15): two separate causes, measured with a probe on both images.

macos-14macos-15
gethostbyaddr("127.0.0.1")2 ms35 s
zeroconf self-discovery, IPVersion.Allfoundnot found in 10 s
zeroconf self-discovery, IPVersion.V4Onlyfoundfound
  • Five http_front/test_demo.py tests: HTTPServer.server_bind calls getfqdn, so the demo provider sat in reverse DNS past every test timeout. It now skips the lookup, whose result it never read.
  • test_a_host_advertised_over_dns_sd_is_found_and_proved: the test now skips when a zeroconf-only probe cannot see its own advertisement. The probe does not touch PeerStreamManager, so a fault in the manager still fails the test.

Not proved: discovery uses IPVersion.All in peer_stream_manager.py and dnssd_bridge.py. It works on macOS 26 hardware, but the cause on the runner was not isolated, so a real macOS 15 machine is unverified, and DNS-SD discovery has no CI coverage on that image.

Update from the green run (682c673e): the macOS wheel job reported 1148 passed and 4 skipped, the same 4 as before, so the DNS-SD test ran and passed on macos-15 this time and the skip did not fire. The zeroconf failure therefore varies between runs of that image rather than holding on every one; the table above is one probe, and the skip exists for the runs where it recurs.

bahdotsh/wrkflw

Problem

Running real workflows showed that much of the expression language silently evaluated to the wrong value. Failed expressions are replaced with an empty string, so these showed up as confusing failures later in a job, or steps that skipped without explanation.

ExpressionBeforeAfter
join(fromJSON('["a","b"]'), '+')["a"+"b"]a+b
fromJSON('{"a":{"b":1}}').a.b').a.b }} (}} in the string ended the expression)1
format('{{x}} {0}', 'v') {0}', 'v') }}{x} v
toJSON(fromJSON('[1,2]'))"[1,2]"a JSON array
github.event.labels.*.name, x[0], env['A']parse error, so emptysupported
'' == 0, null == falsefalsetrue
github.run_number > 5 (string vs number)always falsenumeric comparison
0x10, 1e3, -1parse error, so emptysupported
if: hashFiles('x') != ''always wrongworks
format('k-{0}', hashFiles('x'))k-k-<hash>

Changes

  • Add ExprValue::Array; fromJSON now returns real values, and matrix sequences and mappings keep their structure.
  • Parse .name, .*, [expr] and [*] after any value, and bracket access on contexts.
  • Coerce mixed-type comparisons to numbers, as GitHub does.
  • Find the end of ${{ }} with a quote-aware scan instead of a regex.
  • Expand hashFiles() in compound expressions and step if: conditions.
  • Function names are case-insensitive, and format() handles {{ and }}.

Behaviour changes worth reviewing

  • hashFiles with no match now returns '', not the hash of empty input. A test pinned the old value, but the documented behaviour is an empty string, and != '' existence checks depend on it. Cache keys for missing files change as a result.
  • join() on a plain string now returns it unchanged rather than replacing commas.
  • Arrays render as JSON in string contexts where GitHub prints Array. This matches how objects already behave here and is what resolve_matrix_expressions reads.

Deliberately kept divergences

  • 'true' == true stays true. GitHub would coerce to NaN, but wrkflw stores typed inputs as strings, so strict rules would break inputs.flag == true.
  • fromJSON still passes non-JSON text through. && and || don't short-circuit here, so erroring would break x != '' && fromJSON(x).

Testing

New unit tests cover each row above; cargo test --workspace and clippy -D warnings pass. End to end under Podman, the workflow with an assertion for each of these expressions passes every expression and hashFiles step. Its last step fails on runner.os, a separate pre-existing bug: containers report the host OS. That is fixed in its own PR.

Adds --runtime kubernetes, which runs each workflow step as a pod in the cluster kubectl points at. Closes #66.

wrkflw run --runtime kubernetes --k8s-context gpu --k8s-namespace ci \
  --k8s-node-selector accelerator=a100 \
  --k8s-resource nvidia.com/gpu=1 \
  .github/workflows/train.yml

How it works

Each step gets one pod. An init container waits while the mounts are streamed into emptyDir volumes as tar. The step then runs, and a sidecar keeps the pod alive so the mounts can be streamed back. That is how GITHUB_OUTPUT, artifacts and workspace changes reach the next step.

It shells out to kubectl, so existing kubeconfigs, auth plugins and proxies keep working and there is no new client dependency. The runtime is never auto-detected and never falls back to emulation, because a GPU job silently running on a laptop is worse than a failed run.

Worth a close look

  • $ escaping. Kubernetes expands $(VAR) and collapses $$ in args and env values, so echo $$ reached the shell as echo $. Every $ is now doubled in the manifest.
  • Copy-out mirrors the pod. A step's rm has to stay deleted, so this code removes host files based on what a workflow left in a pod. It rejects paths that leave the target, never follows symlinks, and prunes only after the whole archive has unpacked. Only the job's own workspace and GITHUB_* directories are pruned. User container.volumes directories only gain files, and a single-path volume stays in the pod.
  • Pod lifetime. The sidecar never exits, so every pod carries activeDeadlineSeconds. After kill -9 of wrkflw, the cluster stopped the orphan with DeadlineExceeded.

Separate fix: per-job GITHUB_* files

The second commit also changes existing runtimes. All parallel jobs shared one set of GITHUB_ENV and GITHUB_OUTPUT files, and the engine truncates them after every step, so jobs lost each other's values. A workflow with three parallel jobs failed 3 of 3 runs on Docker before this and passed 3 of 3 after. It is a separate commit so it can be reviewed or reverted on its own.

Testing

Run against a kind cluster (v1.37, arm64) with a local registry, on the final code:

AreaResult
Outputs, env files, GITHUB_PATH, artifacts across jobs, custom shells, step failurePass
Long paths, unicode, empty dirs, binary hashes, modes, mtimes, deletions, type changesPass
Composite actions, secrets (not in logs), job containers and volumes, GitLab pipelinesPass
Dockerfile action, docker:// action, setup-python through --k8s-registryPass
Three parallel jobs, 5 consecutive runs5 of 5 pass
Bad image, missing namespace, unschedulable pod, timeout with a parallel job still runningClear errors, sibling job unaffected
Ctrl+C during parallel jobs, 3 timesNo live pods left
TUI run, runtime cyclingPass

cargo fmt, clippy with -D warnings, --no-default-features and cargo test --workspace --all-features (953 tests) pass locally.

Not tested: a real GPU node, a multi-node cluster, or a remote cluster. Node selectors and resource requests were confirmed in the live pod spec with CPU and memory only, so nvidia.com/gpu scheduling has never actually run.

Known limits

All of these are documented in the README.

  • Images must run as root to write the workspace, which matches GitHub's requirement for container actions. Namespaces enforcing the restricted Pod Security Standard are not supported.
  • The workspace syncs per step, so large workspaces cost time on every step.
  • Mounts are copies, so parallel jobs sharing a host volume do not see each other's writes.
  • Secrets reach the pod as plain env vars.
  • Logs arrive when a step ends, as one combined stream.

Public API changes

RuntimeType gains a Kubernetes variant and ExecutionConfig gains a kubernetes field. Both are public in crates published to crates.io, so exhaustive matches and struct literals downstream need updating. Release this as a minor version bump.

Existing bugs found, not fixed here

  • upload-artifact with path: dist/ fails on every runtime. dist/* works.
  • GitLab job-level image: is ignored on every runtime, so jobs run in ubuntu:latest.
  • Ctrl+C exits with status 0.

What

Adds -P/--platform LABEL=IMAGE, the same idea as act's flag, so runs-on labels can run in an image of your choice without editing the workflow:

wrkflw run -P ubuntu-latest=catthehacker/ubuntu:act-latest .github/workflows/ci.yml
export WRKFLW_PLATFORM=ubuntu-latest=catthehacker/ubuntu:act-latest

Image order is job container:, then --platform, then the built-in table. The default stays ubuntu:latest, because the act image is about 1.6 GB against about 130 MB.

The option is global, because bare wrkflw opens the TUI with no subcommand. It applies to run, watch, the TUI, matrix jobs and reusable workflows.

Two bugs the feature exposed

Steps on act images never ran. docker.rs treated any image matching catthehacker and act- as macOS emulation and wrapped commands in bash -l -c, which discarded them. With the override, run: exit 7 reported success. This also affected ubuntu-*-medium runners today. The macOS runners map to rust:latest, so the heuristic was stale, and it is removed. See BREAKING_CHANGES.md.

setup-node was shadowed. The act image puts its bundled Node first on PATH, so setup-node with version 20 still ran v24. Combined images now put /usr/local/bin and /usr/bin first. This changes the Dockerfile hash, so existing combined images rebuild once.

Decisions for review

  • runs-on: ${{ matrix.os }} is resolved for override matching only. The built-in table still sees the raw label and falls back to ubuntu:latest. Resolving it there would send windows-latest matrix legs to a Windows image, which is a separate change.
  • There is no config file option. wrkflw has no config file today, and WRKFLW_PLATFORM covers not repeating the flag.

Testing

cargo fmt --check, clippy with -D warnings, the no-default-features check and cargo test --workspace --all-features all pass, with 902 tests and 0 failures.

End-to-end runs used the Docker runtime against Podman's Docker-compatible socket on arm64 macOS:

ScenarioResult
exit 7 on act imageFails, passed before the fix
setup-node 20 on act imageRuns v20, ran v24 before the fix
setup-node 20 on default imageRuns v20
Matrix with one overridden legEach leg uses its own image
Job container: with overrideContainer wins
Reusable workflowOverride applies
WRKFLW_PLATFORM, set and emptyApplied, and ignored when empty
--runtime podmanOverride applies

Not run end to end: watch, the TUI and real Docker Engine. watch and the TUI use the same ExecutionConfig, and only their argument passing is covered by compilation.

Unrelated issue seen while testing: RUNNER_OS reports the host OS, so it is macOS inside Linux containers on a Mac. That happens on plain ubuntu:latest too and isn't changed here.