From 9ffb28d77373739d20edead3dcab7ec54ee63122 Mon Sep 17 00:00:00 2001 From: stewartshea Date: Mon, 6 Jul 2026 15:43:49 -0400 Subject: [PATCH] updated examples --- .../.runwhen/{README.md => SKILL_TEMPLATE.md} | 39 +++------ .../.runwhen/raw_script.py | 19 +++++ .../templates/stg-workspace-smoke-slx.yaml | 53 ++++++------ .../stg-workspace-smoke-taskset.yaml | 43 +++++----- codebundles/stg-workspace-smoke/README.md | 6 +- .../.runwhen/SKILL_TEMPLATE.md | 80 +++++++++++++++++++ .../system-info-check-bash.yaml | 23 ++++++ .../.runwhen/raw_script.sh | 62 ++++++++++++++ .../templates/system-info-check-bash-slx.yaml | 26 ++++++ .../system-info-check-bash-taskset.yaml | 32 ++++++++ codebundles/system-info-check-bash/README.md | 28 +++++++ .../.runwhen/SKILL_TEMPLATE.md | 80 +++++++++++++++++++ .../generation-rules/system-info-check.yaml | 23 ++++++ .../system-info-check/.runwhen/raw_script.py | 45 +++++++++++ .../templates/system-info-check-slx.yaml | 26 ++++++ .../templates/system-info-check-taskset.yaml | 32 ++++++++ codebundles/system-info-check/README.md | 28 +++++++ 17 files changed, 569 insertions(+), 76 deletions(-) rename codebundles/stg-workspace-smoke/.runwhen/{README.md => SKILL_TEMPLATE.md} (71%) create mode 100644 codebundles/stg-workspace-smoke/.runwhen/raw_script.py create mode 100644 codebundles/system-info-check-bash/.runwhen/SKILL_TEMPLATE.md create mode 100644 codebundles/system-info-check-bash/.runwhen/generation-rules/system-info-check-bash.yaml create mode 100644 codebundles/system-info-check-bash/.runwhen/raw_script.sh create mode 100644 codebundles/system-info-check-bash/.runwhen/templates/system-info-check-bash-slx.yaml create mode 100644 codebundles/system-info-check-bash/.runwhen/templates/system-info-check-bash-taskset.yaml create mode 100644 codebundles/system-info-check-bash/README.md create mode 100644 codebundles/system-info-check/.runwhen/SKILL_TEMPLATE.md create mode 100644 codebundles/system-info-check/.runwhen/generation-rules/system-info-check.yaml create mode 100644 codebundles/system-info-check/.runwhen/raw_script.py create mode 100644 codebundles/system-info-check/.runwhen/templates/system-info-check-slx.yaml create mode 100644 codebundles/system-info-check/.runwhen/templates/system-info-check-taskset.yaml create mode 100644 codebundles/system-info-check/README.md diff --git a/codebundles/stg-workspace-smoke/.runwhen/README.md b/codebundles/stg-workspace-smoke/.runwhen/SKILL_TEMPLATE.md similarity index 71% rename from codebundles/stg-workspace-smoke/.runwhen/README.md rename to codebundles/stg-workspace-smoke/.runwhen/SKILL_TEMPLATE.md index e6dfc69..a693bc4 100644 --- a/codebundles/stg-workspace-smoke/.runwhen/README.md +++ b/codebundles/stg-workspace-smoke/.runwhen/SKILL_TEMPLATE.md @@ -5,6 +5,12 @@ **Bundle:** `stg-workspace-smoke` · **Task title:** `Run staging workspace smoke check` · **Runtime:** tool-builder (python) + > **Review artifact:** See `raw_script.py` in this directory + > for the decoded script content that reviewers and automated systems should + > inspect. Do **not** parse the base64-encoded `GEN_CMD` in the TaskSet template + > for review purposes — use this SKILL_TEMPLATE.md and the accompanying + > `raw_script.py` file instead. + ## When this SLX gets created - **Platform:** `runwhen` — workspace-builder matches RunWhen platform resources @@ -18,31 +24,8 @@ The task runs a python script via the shared `tool-builder` codebundle in `rw-generic-codecollection`. The workspace-builder renders the TaskSet template with - a base64-encoded `GEN_CMD` at deploy time; this file shows the decoded script for review. - - ### Script (decoded) - - ```python - import os - - -def main(): - workspace = os.environ.get("WORKSPACE_NAME", "unknown") - location = os.environ.get("LOCATION_NAME", "unknown") - return [ - { - "issue title": "Staging smoke check passed", - "issue description": ( - f"Tool-builder smoke script ran on workspace={workspace} " - f"location={location}." - ), - "issue severity": 4, - "issue next steps": ( - "No action required — this is an informational smoke test." - ), - } - ] - ``` + a base64-encoded `GEN_CMD` at deploy time; the decoded script is available in + `raw_script.py` in this directory for review. ### Environment variables @@ -69,13 +52,13 @@ def main(): - **Timeout:** 300s - **Access:** `read-only` · **Data:** `logs-bulk` - - **Owners:** {{workspace.owner_email}} + - **Owners:** shea@runwhen.com ## Provenance - - Generated by `runwhen-platform-mcp` `render_codecollection_skill` vlocal-e2e-test + - Generated by `runwhen-platform-mcp` `render_codecollection_skill` v0.0.0-dev - Source workspace: `stg-test` -- Generated at: `2026-07-02T21:13:33Z` +- Generated at: `2026-07-06T19:23:12Z` ## Deploying this codecollection diff --git a/codebundles/stg-workspace-smoke/.runwhen/raw_script.py b/codebundles/stg-workspace-smoke/.runwhen/raw_script.py new file mode 100644 index 0000000..7466988 --- /dev/null +++ b/codebundles/stg-workspace-smoke/.runwhen/raw_script.py @@ -0,0 +1,19 @@ +import os + + +def main(): + workspace = os.environ.get("WORKSPACE_NAME", "unknown") + location = os.environ.get("LOCATION_NAME", "unknown") + return [ + { + "issue title": "Staging smoke check passed", + "issue description": ( + f"Tool-builder smoke script ran on workspace={workspace} " + f"location={location}." + ), + "issue severity": 4, + "issue next steps": ( + "No action required — this is an informational smoke test." + ), + } + ] \ No newline at end of file diff --git a/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-slx.yaml b/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-slx.yaml index 948825f..227a25e 100644 --- a/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-slx.yaml +++ b/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-slx.yaml @@ -1,27 +1,26 @@ -apiVersion: runwhen.com/v1 -kind: ServiceLevelX -metadata: - name: {{slx_name}} - labels: - {% include "common-labels.yaml" %} - annotations: - {% include "common-annotations.yaml" %} -spec: - imageURL: https://storage.googleapis.com/runwhen-nonprod-shared-images/icons/runwhen.svg - alias: Staging Workspace Smoke Check - asMeasuredBy: >- - Tool Builder task via rw-generic-codecollection tool-builder runtime. - owners: - - {{workspace.owner_email}} - statement: >- - Verify tool-builder runtime can execute a simple custom task against the - stg-test workspace. - additionalContext: - qualified_name: "{{ match_resource.qualified_name }}" - tags: - - name: platform - value: runwhen - - name: access - value: read-only - - name: data - value: logs-bulk + apiVersion: runwhen.com/v1 + kind: ServiceLevelX + metadata: + name: {{slx_name}} + labels: + {% include "common-labels.yaml" %} + annotations: + {% include "common-annotations.yaml" %} + spec: + imageURL: https://storage.googleapis.com/runwhen-nonprod-shared-images/icons/runwhen.svg + alias: Staging Workspace Smoke Check + asMeasuredBy: >- + Tool Builder task via rw-generic-codecollection tool-builder runtime. + owners: + - {{workspace.owner_email}} + statement: >- + Verify tool-builder runtime can execute a simple custom task against the stg-test workspace. + additionalContext: + qualified_name: "{{ match_resource.qualified_name }}" + tags: + - name: platform + value: runwhen +- name: access + value: read-only +- name: data + value: logs-bulk diff --git a/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-taskset.yaml b/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-taskset.yaml index b104060..49405cf 100644 --- a/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-taskset.yaml +++ b/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-taskset.yaml @@ -1,27 +1,32 @@ -apiVersion: runwhen.com/v1 -kind: Runbook -metadata: - name: {{slx_name}} - labels: - {% include "common-labels.yaml" %} - annotations: - {% include "common-annotations.yaml" %} -spec: - location: {{default_location}} - codeBundle: - repoUrl: http://rw-airgap-cc-catalog-svc.runwhen-env-airgap:8080/git/rw-generic-codecollection.git - ref: main - pathToRobot: codebundles/tool-builder/runbook.robot - configProvided: - - name: TASK_TITLE - value: 'Run staging workspace smoke check' + apiVersion: runwhen.com/v1 + kind: Runbook + metadata: + name: {{slx_name}} + labels: + {% include "common-labels.yaml" %} + annotations: + {% include "common-annotations.yaml" %} + spec: + location: {{default_location}} + codeBundle: + repoUrl: https://github.com/runwhen-contrib/rw-generic-codecollection.git + ref: main + pathToRobot: codebundles/tool-builder/runbook.robot + configProvided: + - name: TASK_TITLE + value: Run staging workspace smoke check +... - name: GEN_CMD - value: 'aW1wb3J0IG9zCgoKZGVmIG1haW4oKToKICAgIHdvcmtzcGFjZSA9IG9zLmVudmlyb24uZ2V0KCJXT1JLU1BBQ0VfTkFNRSIsICJ1bmtub3duIikKICAgIGxvY2F0aW9uID0gb3MuZW52aXJvbi5nZXQoIkxPQ0FUSU9OX05BTUUiLCAidW5rbm93biIpCiAgICByZXR1cm4gWwogICAgICAgIHsKICAgICAgICAgICAgImlzc3VlIHRpdGxlIjogIlN0YWdpbmcgc21va2UgY2hlY2sgcGFzc2VkIiwKICAgICAgICAgICAgImlzc3VlIGRlc2NyaXB0aW9uIjogKAogICAgICAgICAgICAgICAgZiJUb29sLWJ1aWxkZXIgc21va2Ugc2NyaXB0IHJhbiBvbiB3b3Jrc3BhY2U9e3dvcmtzcGFjZX0gIgogICAgICAgICAgICAgICAgZiJsb2NhdGlvbj17bG9jYXRpb259LiIKICAgICAgICAgICAgKSwKICAgICAgICAgICAgImlzc3VlIHNldmVyaXR5IjogNCwKICAgICAgICAgICAgImlzc3VlIG5leHQgc3RlcHMiOiAoCiAgICAgICAgICAgICAgICAiTm8gYWN0aW9uIHJlcXVpcmVkIOKAlCB0aGlzIGlzIGFuIGluZm9ybWF0aW9uYWwgc21va2UgdGVzdC4iCiAgICAgICAgICAgICksCiAgICAgICAgfQogICAgXQo=' + value: aW1wb3J0IG9zCgoKZGVmIG1haW4oKToKICAgIHdvcmtzcGFjZSA9IG9zLmVudmlyb24uZ2V0KCJXT1JLU1BBQ0VfTkFNRSIsICJ1bmtub3duIikKICAgIGxvY2F0aW9uID0gb3MuZW52aXJvbi5nZXQoIkxPQ0FUSU9OX05BTUUiLCAidW5rbm93biIpCiAgICByZXR1cm4gWwogICAgICAgIHsKICAgICAgICAgICAgImlzc3VlIHRpdGxlIjogIlN0YWdpbmcgc21va2UgY2hlY2sgcGFzc2VkIiwKICAgICAgICAgICAgImlzc3VlIGRlc2NyaXB0aW9uIjogKAogICAgICAgICAgICAgICAgZiJUb29sLWJ1aWxkZXIgc21va2Ugc2NyaXB0IHJhbiBvbiB3b3Jrc3BhY2U9e3dvcmtzcGFjZX0gIgogICAgICAgICAgICAgICAgZiJsb2NhdGlvbj17bG9jYXRpb259LiIKICAgICAgICAgICAgKSwKICAgICAgICAgICAgImlzc3VlIHNldmVyaXR5IjogNCwKICAgICAgICAgICAgImlzc3VlIG5leHQgc3RlcHMiOiAoCiAgICAgICAgICAgICAgICAiTm8gYWN0aW9uIHJlcXVpcmVkIOKAlCB0aGlzIGlzIGFuIGluZm9ybWF0aW9uYWwgc21va2UgdGVzdC4iCiAgICAgICAgICAgICksCiAgICAgICAgfQogICAgXQ== +... - name: INTERPRETER - value: 'python' + value: python +... - name: CONFIG_ENV_MAP value: '{}' - name: SECRET_ENV_MAP value: '[]' - name: TIMEOUT_SECONDS value: '300' + + diff --git a/codebundles/stg-workspace-smoke/README.md b/codebundles/stg-workspace-smoke/README.md index b81fde8..f7605ab 100644 --- a/codebundles/stg-workspace-smoke/README.md +++ b/codebundles/stg-workspace-smoke/README.md @@ -10,7 +10,8 @@ Custom Discovery CodeCollection bundle generated from MCP tool-builder output. ``` .runwhen/ - README.md # Human-readable review (decoded script + match rules) + SKILL_TEMPLATE.md # Human-readable review (decoded script + match rules) + raw_script.py # Decoded script for reviewers and automated inspection generation-rules/ stg-workspace-smoke.yaml templates/ @@ -18,7 +19,8 @@ Custom Discovery CodeCollection bundle generated from MCP tool-builder output. stg-workspace-smoke-taskset.yaml ``` -See `.runwhen/README.md` for the full review artifact intended for PR reviewers. +See `.runwhen/SKILL_TEMPLATE.md` and `.runwhen/raw_script.py` for the review +artifacts intended for PR reviewers and automated systems. ## References diff --git a/codebundles/system-info-check-bash/.runwhen/SKILL_TEMPLATE.md b/codebundles/system-info-check-bash/.runwhen/SKILL_TEMPLATE.md new file mode 100644 index 0000000..ebf4600 --- /dev/null +++ b/codebundles/system-info-check-bash/.runwhen/SKILL_TEMPLATE.md @@ -0,0 +1,80 @@ + # System Info Check (Bash) + + The runner should report hostname, uptime, and disk space when queried. + + **Bundle:** `system-info-check-bash` · **Task title:** `Run system info check (bash)` · + **Runtime:** tool-builder (bash) + + > **Review artifact:** See `raw_script.sh` in this directory + > for the decoded script content that reviewers and automated systems should + > inspect. Do **not** parse the base64-encoded `GEN_CMD` in the TaskSet template + > for review purposes — use this SKILL_TEMPLATE.md and the accompanying + > `raw_script.sh` file instead. + + ## When this SLX gets created + + - **Platform:** `runwhen` — workspace-builder matches RunWhen platform resources + - **Resource types:** `workspace` + - **Match rules (plain English):** + - matches every resource (pattern `.+` on name) + - **Expected cardinality:** one SLX per matched resource, named `-system-info-che` + - **Qualifiers:** `workspace` + + ## What this SLX does + + The task runs a bash script via the shared `tool-builder` codebundle in + `rw-generic-codecollection`. The workspace-builder renders the TaskSet template with + a base64-encoded `GEN_CMD` at deploy time; the decoded script is available in + `raw_script.sh` in this directory for review. + + ### Environment variables + + | Name | Value | Notes | +|---|---|---| +| _(none)_ | | | + + + ### Secrets (names only — values live in RunWhen workspace secrets) + + | Name | Required | +|---|---| +| _(none)_ | no | + + + ### Runtime variables (user-supplied at run time) + + | Name | Default | Description | +|---|---|---| +| _(none)_ | | | + + + ## Operational metadata + + - **Timeout:** 300s + - **Access:** `read-only` · **Data:** `config` + - **Owners:** shea@runwhen.com + + ## Provenance + + - Generated by `runwhen-platform-mcp` `render_codecollection_skill` v0.0.0-dev +- Source workspace: `stg-test` +- Generated at: `2026-07-06T19:23:12Z` + + ## Deploying this codecollection + + Add to your runwhen-local runner `workspaceInfo.yaml`: + + ```yaml + codeCollections: + - repoURL: https:////.git + ref: main + ``` + + Then reconcile (Flux example): + + ```bash + flux reconcile hr runwhen-local -n --with-source + ``` + + > **Requires runwhen-local with `platform: runwhen` support** (RW-1355). Until that + > release lands, generation rules using `platform: runwhen` will not render SLXs. diff --git a/codebundles/system-info-check-bash/.runwhen/generation-rules/system-info-check-bash.yaml b/codebundles/system-info-check-bash/.runwhen/generation-rules/system-info-check-bash.yaml new file mode 100644 index 0000000..a2db8f8 --- /dev/null +++ b/codebundles/system-info-check-bash/.runwhen/generation-rules/system-info-check-bash.yaml @@ -0,0 +1,23 @@ +apiVersion: runwhen.com/v1 +kind: GenerationRules +spec: + platform: runwhen + generationRules: + - resourceTypes: + - workspace + matchRules: + - type: pattern + pattern: .+ + properties: + - name + mode: substring + slxs: + - baseName: system-info-che + qualifiers: + - workspace + baseTemplateName: system-info-check-bash + levelOfDetail: detailed + outputItems: + - type: slx + - type: runbook + templateName: system-info-check-bash-taskset.yaml diff --git a/codebundles/system-info-check-bash/.runwhen/raw_script.sh b/codebundles/system-info-check-bash/.runwhen/raw_script.sh new file mode 100644 index 0000000..9eb6f9d --- /dev/null +++ b/codebundles/system-info-check-bash/.runwhen/raw_script.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +main() { + issues='[]' + issue='' + total=0 + failed=0 + + name="$(uname -n 2>/dev/null || echo 'unknown')" + total=$((total + 1)) + if [ "$name" != "unknown" ]; then + issue=$(jq -n --arg n "$name" '{ + "issue title": "Hostname collected successfully", + "issue description": ("Hostname retrieved: " + $n), + "issue severity": 4, + "issue next steps": "No action needed. Informational check." + }') + issues=$(echo "$issues" | jq --argjson i "$issue" '. += [$i]') + else + failed=$((failed + 1)) + issue=$(jq -n '{ + "issue title": "Failed to collect hostname", + "issue description": "uname -n returned no output", + "issue severity": 2, + "issue next steps": "Check runner image and available commands." + }') + issues=$(echo "$issues" | jq --argjson i "$issue" '. += [$i]') + fi + + uptime_str="$(uptime 2>/dev/null || echo 'unavailable')" + total=$((total + 1)) + issue=$(jq -n --arg u "$uptime_str" '{ + "issue title": "Uptime collected", + "issue description": ("System uptime info: " + $u), + "issue severity": 4, + "issue next steps": "No action needed. Informational check." + }') + issues=$(echo "$issues" | jq --argjson i "$issue" '. += [$i]') + + disks=$(df -h / 2>/dev/null | tail -1 | awk '{print $4, $5}' || echo 'unknown') + total=$((total + 1)) + issue=$(jq -n --arg d "$disks" '{ + "issue title": "Disk space collected", + "issue description": ("Root filesystem available/full: " + $d), + "issue severity": 4, + "issue next steps": "No action needed. Informational check." + }') + issues=$(echo "$issues" | jq --argjson i "$issue" '. += [$i]') + + summary=$(jq -n \ + --arg t "$total" \ + --arg f "$failed" \ + '{ + "issue title": "System Info Check (Bash) — Summary", + "issue description": ("Checked " + $t + " system commands; " + $f + " failed."), + "issue severity": 4, + "issue next steps": "Informational. Review details in description." + }') + issues=$(echo "$issues" | jq --argjson i "$summary" '. += [$i]') + + echo "$issues" >&3 +} \ No newline at end of file diff --git a/codebundles/system-info-check-bash/.runwhen/templates/system-info-check-bash-slx.yaml b/codebundles/system-info-check-bash/.runwhen/templates/system-info-check-bash-slx.yaml new file mode 100644 index 0000000..b4f17d5 --- /dev/null +++ b/codebundles/system-info-check-bash/.runwhen/templates/system-info-check-bash-slx.yaml @@ -0,0 +1,26 @@ + apiVersion: runwhen.com/v1 + kind: ServiceLevelX + metadata: + name: {{slx_name}} + labels: + {% include "common-labels.yaml" %} + annotations: + {% include "common-annotations.yaml" %} + spec: + imageURL: https://storage.googleapis.com/runwhen-nonprod-shared-images/icons/runwhen.svg + alias: System Info Check (Bash) + asMeasuredBy: >- + Tool Builder task via rw-generic-codecollection tool-builder runtime. + owners: + - {{workspace.owner_email}} + statement: >- + The runner should report hostname, uptime, and disk space when queried. + additionalContext: + qualified_name: "{{ match_resource.qualified_name }}" + tags: + - name: platform + value: runwhen +- name: access + value: read-only +- name: data + value: config diff --git a/codebundles/system-info-check-bash/.runwhen/templates/system-info-check-bash-taskset.yaml b/codebundles/system-info-check-bash/.runwhen/templates/system-info-check-bash-taskset.yaml new file mode 100644 index 0000000..5abe724 --- /dev/null +++ b/codebundles/system-info-check-bash/.runwhen/templates/system-info-check-bash-taskset.yaml @@ -0,0 +1,32 @@ + apiVersion: runwhen.com/v1 + kind: Runbook + metadata: + name: {{slx_name}} + labels: + {% include "common-labels.yaml" %} + annotations: + {% include "common-annotations.yaml" %} + spec: + location: {{default_location}} + codeBundle: + repoUrl: https://github.com/runwhen-contrib/rw-generic-codecollection.git + ref: main + pathToRobot: codebundles/tool-builder/runbook.robot + configProvided: + - name: TASK_TITLE + value: Run system info check (bash) +... + - name: GEN_CMD + value: IyEvYmluL2Jhc2gKCm1haW4oKSB7CiAgICBpc3N1ZXM9J1tdJwogICAgaXNzdWU9JycKICAgIHRvdGFsPTAKICAgIGZhaWxlZD0wCgogICAgbmFtZT0iJCh1bmFtZSAtbiAyPi9kZXYvbnVsbCB8fCBlY2hvICd1bmtub3duJykiCiAgICB0b3RhbD0kKCh0b3RhbCArIDEpKQogICAgaWYgWyAiJG5hbWUiICE9ICJ1bmtub3duIiBdOyB0aGVuCiAgICAgICAgaXNzdWU9JChqcSAtbiAtLWFyZyBuICIkbmFtZSIgJ3sKICAgICAgICAgICAgImlzc3VlIHRpdGxlIjogIkhvc3RuYW1lIGNvbGxlY3RlZCBzdWNjZXNzZnVsbHkiLAogICAgICAgICAgICAiaXNzdWUgZGVzY3JpcHRpb24iOiAoIkhvc3RuYW1lIHJldHJpZXZlZDogIiArICRuKSwKICAgICAgICAgICAgImlzc3VlIHNldmVyaXR5IjogNCwKICAgICAgICAgICAgImlzc3VlIG5leHQgc3RlcHMiOiAiTm8gYWN0aW9uIG5lZWRlZC4gSW5mb3JtYXRpb25hbCBjaGVjay4iCiAgICAgICAgfScpCiAgICAgICAgaXNzdWVzPSQoZWNobyAiJGlzc3VlcyIgfCBqcSAtLWFyZ2pzb24gaSAiJGlzc3VlIiAnLiArPSBbJGldJykKICAgIGVsc2UKICAgICAgICBmYWlsZWQ9JCgoZmFpbGVkICsgMSkpCiAgICAgICAgaXNzdWU9JChqcSAtbiAnewogICAgICAgICAgICAiaXNzdWUgdGl0bGUiOiAiRmFpbGVkIHRvIGNvbGxlY3QgaG9zdG5hbWUiLAogICAgICAgICAgICAiaXNzdWUgZGVzY3JpcHRpb24iOiAidW5hbWUgLW4gcmV0dXJuZWQgbm8gb3V0cHV0IiwKICAgICAgICAgICAgImlzc3VlIHNldmVyaXR5IjogMiwKICAgICAgICAgICAgImlzc3VlIG5leHQgc3RlcHMiOiAiQ2hlY2sgcnVubmVyIGltY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gICJpc3N1ZSBuZXh0IHN0ZXBzIjogIk5vIGFjdGlvbiBuZWVkZWQuIEluZm9ybWF0aW9uYWwgY2hlY2suIgogICAgfScpCiAgICBpc3N1ZXM9JChlY2hvICIkaXNzdWVzIiB8IGpxIC0tYXJnanNvbiBpICIkaXNzdWUiICcuICs9IFskaV0nKQoKICAgIHN1bW1hcnk9JChqcSAtbiBcCiAgICAgICAgLS1hcmcgdCAiJHRvdGFsIiBcCiAgICAgICAgLS1hcmcgZiAiJGZhaWxlZCIgXAogICAgICAgICd7CiAgICAgICAgICAgICJpc3N1ZSB0aXRsZSI6ICJTeXN0ZW0gSW5mbyBDaGVjayAoQmFzaCkg4oCUIFN1bW1hcnkiLAogICAgICAgICAgICAiaXNzdWUgZGVzY3JpcHRpb24iOiAoIkNoZWNrZWQgIiArICR0ICsgIiBzeXN0ZW0gY29tbWFuZHM7ICIgKyAkZiArICIgZmFpbGVkLiIpLAogICAgICAgICAgICAiaXNzdWUgc2V2ZXJpdHkiOiA0LAogICAgICAgICAgICAiaXNzdWUgbmV4dCBzdGVwcyI6ICJJbmZvcm1hdGlvbmFsLiBSZXZpZXcgZGV0YWlscyBpbiBkZXNjcmlwdGlvbi4iCiAgICAgICAgfScpCiAgICBpc3N1ZXM9JChlY2hvICIkaXNzdWVzIiB8IGpxIC0tYXJnanNvbiBpICIkc3VtbWFyeSIgJy4gKz0gWyRpXScpCgogICAgZWNobyAiJGlzc3VlcyIgPiYzCn0= +... + - name: INTERPRETER + value: bash +... + - name: CONFIG_ENV_MAP + value: '{}' + - name: SECRET_ENV_MAP + value: '[]' + - name: TIMEOUT_SECONDS + value: '300' + + diff --git a/codebundles/system-info-check-bash/README.md b/codebundles/system-info-check-bash/README.md new file mode 100644 index 0000000..0fbbc6f --- /dev/null +++ b/codebundles/system-info-check-bash/README.md @@ -0,0 +1,28 @@ +# system-info-check-bash + +Custom Discovery CodeCollection bundle generated from MCP tool-builder output. + +- **Alias:** System Info Check (Bash) +- **Platform:** `runwhen` +- **Resource types:** workspace + +## Layout + +``` +.runwhen/ + SKILL_TEMPLATE.md # Human-readable review (decoded script + match rules) + raw_script.sh # Decoded script for reviewers and automated inspection + generation-rules/ + system-info-check-bash.yaml + templates/ + system-info-check-bash-slx.yaml + system-info-check-bash-taskset.yaml +``` + +See `.runwhen/SKILL_TEMPLATE.md` and `.runwhen/raw_script.sh` for the review +artifacts intended for PR reviewers and automated systems. + +## References + +- [Custom Discovery CodeCollection guide](https://docs.runwhen.com/guides/custom-discovery-codecollection/) +- [Tool Builder Runtime guide](https://docs.runwhen.com/guides/tool-builder-runtime/) diff --git a/codebundles/system-info-check/.runwhen/SKILL_TEMPLATE.md b/codebundles/system-info-check/.runwhen/SKILL_TEMPLATE.md new file mode 100644 index 0000000..312f4b5 --- /dev/null +++ b/codebundles/system-info-check/.runwhen/SKILL_TEMPLATE.md @@ -0,0 +1,80 @@ + # System Info Check + + The runner should report its kernel and system information when queried. + + **Bundle:** `system-info-check` · **Task title:** `Run system info check` · + **Runtime:** tool-builder (python) + + > **Review artifact:** See `raw_script.py` in this directory + > for the decoded script content that reviewers and automated systems should + > inspect. Do **not** parse the base64-encoded `GEN_CMD` in the TaskSet template + > for review purposes — use this SKILL_TEMPLATE.md and the accompanying + > `raw_script.py` file instead. + + ## When this SLX gets created + + - **Platform:** `runwhen` — workspace-builder matches RunWhen platform resources + - **Resource types:** `workspace` + - **Match rules (plain English):** + - matches every resource (pattern `.+` on name) + - **Expected cardinality:** one SLX per matched resource, named `-system-info-che` + - **Qualifiers:** `workspace` + + ## What this SLX does + + The task runs a python script via the shared `tool-builder` codebundle in + `rw-generic-codecollection`. The workspace-builder renders the TaskSet template with + a base64-encoded `GEN_CMD` at deploy time; the decoded script is available in + `raw_script.py` in this directory for review. + + ### Environment variables + + | Name | Value | Notes | +|---|---|---| +| _(none)_ | | | + + + ### Secrets (names only — values live in RunWhen workspace secrets) + + | Name | Required | +|---|---| +| _(none)_ | no | + + + ### Runtime variables (user-supplied at run time) + + | Name | Default | Description | +|---|---|---| +| _(none)_ | | | + + + ## Operational metadata + + - **Timeout:** 300s + - **Access:** `read-only` · **Data:** `config` + - **Owners:** shea@runwhen.com + + ## Provenance + + - Generated by `runwhen-platform-mcp` `render_codecollection_skill` v0.0.0-dev +- Source workspace: `stg-test` +- Generated at: `2026-07-06T19:12:44Z` + + ## Deploying this codecollection + + Add to your runwhen-local runner `workspaceInfo.yaml`: + + ```yaml + codeCollections: + - repoURL: https:////.git + ref: main + ``` + + Then reconcile (Flux example): + + ```bash + flux reconcile hr runwhen-local -n --with-source + ``` + + > **Requires runwhen-local with `platform: runwhen` support** (RW-1355). Until that + > release lands, generation rules using `platform: runwhen` will not render SLXs. diff --git a/codebundles/system-info-check/.runwhen/generation-rules/system-info-check.yaml b/codebundles/system-info-check/.runwhen/generation-rules/system-info-check.yaml new file mode 100644 index 0000000..2b441b2 --- /dev/null +++ b/codebundles/system-info-check/.runwhen/generation-rules/system-info-check.yaml @@ -0,0 +1,23 @@ +apiVersion: runwhen.com/v1 +kind: GenerationRules +spec: + platform: runwhen + generationRules: + - resourceTypes: + - workspace + matchRules: + - type: pattern + pattern: .+ + properties: + - name + mode: substring + slxs: + - baseName: system-info-che + qualifiers: + - workspace + baseTemplateName: system-info-check + levelOfDetail: detailed + outputItems: + - type: slx + - type: runbook + templateName: system-info-check-taskset.yaml diff --git a/codebundles/system-info-check/.runwhen/raw_script.py b/codebundles/system-info-check/.runwhen/raw_script.py new file mode 100644 index 0000000..34c08e4 --- /dev/null +++ b/codebundles/system-info-check/.runwhen/raw_script.py @@ -0,0 +1,45 @@ +import subprocess +import json + +def main(): + issues = [] + total = 0 + failed = 0 + + try: + result = subprocess.run( + ["uname", "-a"], capture_output=True, text=True, timeout=10 + ) + total += 1 + kernel_info = result.stdout.strip() + if result.returncode == 0: + issues.append({ + "issue title": "Kernel info collected successfully", + "issue description": f"Kernel info retrieved: {kernel_info}", + "issue severity": 4, + "issue next steps": "No action needed. Informational check.", + }) + else: + failed += 1 + issues.append({ + "issue title": "Failed to collect kernel info", + "issue description": f"uname command failed with return code {result.returncode}: {result.stderr.strip()}", + "issue severity": 2, + "issue next steps": "Check runner image and available commands.", + }) + except Exception as e: + failed += 1 + issues.append({ + "issue title": "Error collecting system info", + "issue description": f"Exception occurred: {str(e)}", + "issue severity": 2, + "issue next steps": "Investigate runner environment.", + }) + + issues.append({ + "issue title": "System Info Check — Summary", + "issue description": f"Checked {total} system commands; {failed} failed.", + "issue severity": 4, + "issue next steps": "Informational. Review details in description.", + }) + return issues \ No newline at end of file diff --git a/codebundles/system-info-check/.runwhen/templates/system-info-check-slx.yaml b/codebundles/system-info-check/.runwhen/templates/system-info-check-slx.yaml new file mode 100644 index 0000000..e9baa36 --- /dev/null +++ b/codebundles/system-info-check/.runwhen/templates/system-info-check-slx.yaml @@ -0,0 +1,26 @@ + apiVersion: runwhen.com/v1 + kind: ServiceLevelX + metadata: + name: {{slx_name}} + labels: + {% include "common-labels.yaml" %} + annotations: + {% include "common-annotations.yaml" %} + spec: + imageURL: https://storage.googleapis.com/runwhen-nonprod-shared-images/icons/runwhen.svg + alias: System Info Check + asMeasuredBy: >- + Tool Builder task via rw-generic-codecollection tool-builder runtime. + owners: + - {{workspace.owner_email}} + statement: >- + The runner should report its kernel and system information when queried. + additionalContext: + qualified_name: "{{ match_resource.qualified_name }}" + tags: + - name: platform + value: runwhen +- name: access + value: read-only +- name: data + value: config diff --git a/codebundles/system-info-check/.runwhen/templates/system-info-check-taskset.yaml b/codebundles/system-info-check/.runwhen/templates/system-info-check-taskset.yaml new file mode 100644 index 0000000..b0d8511 --- /dev/null +++ b/codebundles/system-info-check/.runwhen/templates/system-info-check-taskset.yaml @@ -0,0 +1,32 @@ + apiVersion: runwhen.com/v1 + kind: Runbook + metadata: + name: {{slx_name}} + labels: + {% include "common-labels.yaml" %} + annotations: + {% include "common-annotations.yaml" %} + spec: + location: {{default_location}} + codeBundle: + repoUrl: https://github.com/runwhen-contrib/rw-generic-codecollection.git + ref: main + pathToRobot: codebundles/tool-builder/runbook.robot + configProvided: + - name: TASK_TITLE + value: Run system info check +... + - name: GEN_CMD + value: aW1wb3J0IHN1YnByb2Nlc3MKaW1wb3J0IGpzb24KCmRlZiBtYWluKCk6CiAgICBpc3N1ZXMgPSBbXQogICAgdG90YWwgPSAwCiAgICBmYWlsZWQgPSAwCiAgICAKICAgIHRyeToKICAgICAgICByZXN1bHQgPSBzdWJwcm9jZXNzLnJ1bigKICAgICAgICAgICAgWyJ1bmFtZSIsICItYSJdLCBjYXB0dXJlX291dHB1dD1UcnVlLCB0ZXh0PVRydWUsIHRpbWVvdXQ9MTAKICAgICAgICApCiAgICAgICAgdG90YWwgKz0gMQogICAgICAgIGtlcm5lbF9pbmZvID0gcmVzdWx0LnN0ZG91dC5zdHJpcCgpCiAgICAgICAgaWYgcmVzdWx0LnJldHVybmNvZGUgPT0gMDoKICAgICAgICAgICAgaXNzdWVzLmFwcGVuZCh7CiAgICAgICAgICAgICAgICAiaXNzdWUgdGl0bGUiOiAiS2VybmVsIGluZm8gY29sbGVjdGVkIHN1Y2Nlc3NmdWxseSIsCiAgICAgICAgICAgICAgICAiaXNzdWUgZGVzY3JpcHRpb24iOiBmIktlcm5lbCBpbmZvIHJldHJpZXZlZDoge2tlcm5lbF9pbmZvfSIsCiAgICAgICAgICAgICAgICAiaXNzdWUgc2V2ZXJpdHkiOiA0LAogICAgICAgICAgICAgICAgImlzc3VlIG5leHQgc3RlcHMiOiAiTm8gYWN0aW9uIG5lZWRlZC4gSW5mb3JtYXRpb25hbCBjaGVjay4iLAogICAgICAgICAgICB9KQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIGZhaWxlZCArPSAxCiAgICAgICAgICAgIGlzc3Vlcy5hcHBlbmQoewogICAgICAgICAgICAgICAgImlzc3VlIHRpdGxlIjogIkZhaWxlZCB0byBjb2xsZWN0IGtlcm5lbCBpbmZvIiwKICAgICAgICAgICAgICAgICJpc3N1ZSBkZXNjcmlwdGlvbiI6IGY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: INTERPRETER + value: python +... + - name: CONFIG_ENV_MAP + value: '{}' + - name: SECRET_ENV_MAP + value: '[]' + - name: TIMEOUT_SECONDS + value: '300' + + diff --git a/codebundles/system-info-check/README.md b/codebundles/system-info-check/README.md new file mode 100644 index 0000000..6ad01a7 --- /dev/null +++ b/codebundles/system-info-check/README.md @@ -0,0 +1,28 @@ +# system-info-check + +Custom Discovery CodeCollection bundle generated from MCP tool-builder output. + +- **Alias:** System Info Check +- **Platform:** `runwhen` +- **Resource types:** workspace + +## Layout + +``` +.runwhen/ + SKILL_TEMPLATE.md # Human-readable review (decoded script + match rules) + raw_script.py # Decoded script for reviewers and automated inspection + generation-rules/ + system-info-check.yaml + templates/ + system-info-check-slx.yaml + system-info-check-taskset.yaml +``` + +See `.runwhen/SKILL_TEMPLATE.md` and `.runwhen/raw_script.py` for the review +artifacts intended for PR reviewers and automated systems. + +## References + +- [Custom Discovery CodeCollection guide](https://docs.runwhen.com/guides/custom-discovery-codecollection/) +- [Tool Builder Runtime guide](https://docs.runwhen.com/guides/tool-builder-runtime/)