From d106dd8a3576afe81f16b9085210376600c20c99 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Mon, 30 Jun 2025 14:00:03 -0400 Subject: [PATCH 1/2] README.md: fix docs for submit_request They were out-of-sync with the actual API Assisted-by: claude-4-sonnet --- README.md | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 5dc98c4..f095f6e 100644 --- a/README.md +++ b/README.md @@ -70,34 +70,26 @@ just start Submit a FMF test request to Testing Farm. **Parameters:** -- `url` (required): Git repository URL containing FMF metadata -- `ref` (optional): Branch, tag, or commit to test -- `merge_sha` (optional): Target commit SHA for merge testing -- `path` (optional): Path to metadata tree root -- `plan_name` (optional): Specific test plan to execute -- `plan_filter` (optional): Filter for tmt plans -- `test_name` (optional): Specific test to execute -- `test_filter` (optional): Filter for tmt tests -- `environments` (optional): Test environment configurations -- `notification` (optional): Notification settings -- `settings` (optional): Additional request settings -- `user` (optional): User information +- `url` (required): Git repository URL containing the TMT metadata +- `compose` (required): Compose to run tests against +- `ref` (optional): Git branch, tag or commit specifying the desired git revision +- `metadata_root_dir` (optional): Path to the metadata tree root directory. By default git repository root +- `arch` (optional): Architecture to test against, by default 'x86_64' +- `plan_name` (optional): Selected plans to be executed. Can be a regular expression +- `test_name` (optional): Select tests to be executed. Can be a regular expression +- `context` (optional): TMT context variables as key-value pairs +- `environment` (optional): TMT environment variables as key-value pairs **Example:** ```json { "url": "https://github.com/example/test-repo", + "compose": "fedora-39", "ref": "main", - "path": "/tests", - "environments": [ - { - "arch": "x86_64", - "os": "fedora-38", - "variables": { - "TEST_VAR": "test_value" - } - } - ] + "arch": "x86_64", + "environment": { + "TEST_VAR": "test_value" + } } ``` From eec514d6a8677eeb34f2cd74af9895b82eae28ca Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Mon, 30 Jun 2025 14:11:25 -0400 Subject: [PATCH 2/2] Support Brew builds in test requests - Modified server.py to accept and process `brew_builds`, allowing users to specify Brew builds as task IDs or NVR strings. --- README.md | 4 +++- cockpit | 1 + testing_farm_mcp/server.py | 31 ++++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 160000 cockpit diff --git a/README.md b/README.md index f095f6e..436bdb9 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ Submit a FMF test request to Testing Farm. - `test_name` (optional): Select tests to be executed. Can be a regular expression - `context` (optional): TMT context variables as key-value pairs - `environment` (optional): TMT environment variables as key-value pairs +- `brew_builds` (optional): List of Brew builds to test against. Each item can be a task ID (int) or NVR string (e.g., ['httpd-2.4.54-1.el9', 12345]) **Example:** ```json @@ -89,7 +90,8 @@ Submit a FMF test request to Testing Farm. "arch": "x86_64", "environment": { "TEST_VAR": "test_value" - } + }, + "brew_builds": ["httpd-2.4.54-1.el9"] } ``` diff --git a/cockpit b/cockpit new file mode 160000 index 0000000..961e105 --- /dev/null +++ b/cockpit @@ -0,0 +1 @@ +Subproject commit 961e1052870d2cdcf72efb5b8eccd29bc55f8f4f diff --git a/testing_farm_mcp/server.py b/testing_farm_mcp/server.py index 6cf981f..023b307 100644 --- a/testing_farm_mcp/server.py +++ b/testing_farm_mcp/server.py @@ -87,6 +87,15 @@ async def submit_request( # noqa: PLR0913 description="TMT environment variables as key-value pairs (e.g., {'ROOTLESS_USER': 'ec2-user'}).", ), ] = None, + brew_builds: Annotated[ + list[int | str] | None, + Field( + description=( + "List of Brew builds to test against. Each item can be a task ID (int) or NVR string" + " (e.g., ['httpd-2.4.54-1.el9', 12345])." + ), + ), + ] = None, ) -> dict[str, Any]: """Submit a test request to Testing Farm. @@ -103,6 +112,7 @@ async def submit_request( # noqa: PLR0913 arch: Architecture to test against context: TMT context variables as key-value pairs environment: TMT environment variables as key-value pairs + brew_builds: List of Brew builds to test against (task IDs or NVRs) Returns: Testing Farm request creation response @@ -110,13 +120,32 @@ async def submit_request( # noqa: PLR0913 client = TestingFarmClient() try: # Build environment configuration - env_config = { + env_config: dict[str, Any] = { "arch": arch, "os": { "compose": compose, }, } + # Build artifacts list + artifacts = [] + + # Add Brew build artifacts if specified + if brew_builds: + for brew_build in brew_builds: + # Convert int task IDs to strings + build_id = str(brew_build) + + brew_artifact = { + "type": "redhat-brew-build", + "id": build_id, + } + artifacts.append(brew_artifact) + + # Add artifacts to environment configuration if any are specified + if artifacts: + env_config["artifacts"] = artifacts + # Add TMT configuration if context or environment variables are provided if context or environment: tmt_config = {}