updated examples

This commit is contained in:
stewartshea
2026-07-06 15:43:49 -04:00
parent d5b86fed87
commit 9ffb28d773
17 changed files with 569 additions and 76 deletions
@@ -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 `<qualifiers>-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://<host>/<org>/<your-private-codecollection>.git
ref: main
```
Then reconcile (Flux example):
```bash
flux reconcile hr runwhen-local -n <runner-namespace> --with-source
```
> **Requires runwhen-local with `platform: runwhen` support** (RW-1355). Until that
> release lands, generation rules using `platform: runwhen` will not render SLXs.
@@ -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
@@ -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
@@ -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
@@ -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: aW1wb3J0IHN1YnByb2Nlc3MKaW1wb3J0IGpzb24KCmRlZiBtYWluKCk6CiAgICBpc3N1ZXMgPSBbXQogICAgdG90YWwgPSAwCiAgICBmYWlsZWQgPSAwCiAgICAKICAgIHRyeToKICAgICAgICByZXN1bHQgPSBzdWJwcm9jZXNzLnJ1bigKICAgICAgICAgICAgWyJ1bmFtZSIsICItYSJdLCBjYXB0dXJlX291dHB1dD1UcnVlLCB0ZXh0PVRydWUsIHRpbWVvdXQ9MTAKICAgICAgICApCiAgICAgICAgdG90YWwgKz0gMQogICAgICAgIGtlcm5lbF9pbmZvID0gcmVzdWx0LnN0ZG91dC5zdHJpcCgpCiAgICAgICAgaWYgcmVzdWx0LnJldHVybmNvZGUgPT0gMDoKICAgICAgICAgICAgaXNzdWVzLmFwcGVuZCh7CiAgICAgICAgICAgICAgICAiaXNzdWUgdGl0bGUiOiAiS2VybmVsIGluZm8gY29sbGVjdGVkIHN1Y2Nlc3NmdWxseSIsCiAgICAgICAgICAgICAgICAiaXNzdWUgZGVzY3JpcHRpb24iOiBmIktlcm5lbCBpbmZvIHJldHJpZXZlZDoge2tlcm5lbF9pbmZvfSIsCiAgICAgICAgICAgICAgICAiaXNzdWUgc2V2ZXJpdHkiOiA0LAogICAgICAgICAgICAgICAgImlzc3VlIG5leHQgc3RlcHMiOiAiTm8gYWN0aW9uIG5lZWRlZC4gSW5mb3JtYXRpb25hbCBjaGVjay4iLAogICAgICAgICAgICB9KQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIGZhaWxlZCArPSAxCiAgICAgICAgICAgIGlzc3Vlcy5hcHBlbmQoewogICAgICAgICAgICAgICAgImlzc3VlIHR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kluZm9ybWF0aW9uYWwuIFJldmlldyBkZXRhaWxzIGluIGRlc2NyaXB0aW9uLiIsCiAgICB9KQogICAgcmV0dXJuIGlzc3Vlcw==
...
- name: INTERPRETER
value: python
...
- name: CONFIG_ENV_MAP
value: '{}'
- name: SECRET_ENV_MAP
value: '[]'
- name: TIMEOUT_SECONDS
value: '300'
+28
View File
@@ -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/)