Skip to content

Integrate gotap for execution and verification #33

@mmaelicke

Description

@mmaelicke

Summary

tool-runner should detect and use gotap when available in container images, mirroring the plan for gorun (see tool-spec/gorun#3). When gotap is present, invoke it for execution to benefit from its validation and metadata capabilities. Otherwise, fall back to the current direct CMD execution.

Current State

  • Spec discovery: cat /src/tool.yml in a throwaway container
  • Execution: Starts container with image default CMD; no command override
  • Input: Writes inputs.json with parameters + data (aligned with current spec)
  • Environment: Sets TOOL_RUN=tool.name for legacy templates
  • gotap usage: None

High-Level Plan

Goal: If gotap is detected inside the container, use it for execution. Otherwise, keep current behaviour.

Phase 1: Probe for gotap

Before running a tool, probe the container:

  1. Create a short-lived container from the image
  2. Run gotap --version (or which gotap if no version flag exists)
  3. Exit code 0 = gotap present

Implementation notes:

  • New function in toolbox_runner/: probe_gotap(docker_client, image_name) -> bool
  • Probe could run: client.containers.run(image, command="command -v gotap || which gotap || true", remove=True) and check stdout

Phase 2: Dual execution paths in runner.run()

In toolbox_runner/runner.py:

  1. Call probe before creating the run container
  2. If gotap found: override the run to use gotap as entrypoint
    • command="gotap run <tool_name> --input-file /in/inputs.json" (or equivalent docker-py syntax)
  3. If gotap not found: keep current behaviour (no command override, image CMD)

Input file: tool-runner already writes inputs.json with the correct format. Pass --input-file /in/inputs.json when invoking gotap.

Tasks Checklist

  • Add probe_gotap(client, image_name) -> bool (or use gotap --version when added to gotap)
  • Branch runner.run() on probe result
  • When using gotap: override container command to ["gotap", "run", tool_name, "--input-file", "/in/inputs.json"]
  • Ensure /out mount exists (already the case) for gotap metadata output
  • Test with gotap-based image (e.g. tool_template_python) and non-gotap image

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions