diff --git a/README.md b/README.md index 88d1ed6..e5e475e 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,19 @@ from `rw-generic-codecollection`). ``` codebundles/ - gcp-bucket-crossplane-health/ # rules + templates only, no *.robot + gcp-bucket-crossplane-health/ # kubernetes platform + k8s-kubectl-cmd runtime .runwhen/ generation-rules/gcp-bucket-crossplane-health.yaml templates/ gcp-bucket-crossplane-health-slx.yaml gcp-bucket-crossplane-health-sli.yaml gcp-bucket-crossplane-health-taskset.yaml + stg-workspace-smoke/ # platform: runwhen + tool-builder runtime (RW-1353 E2E) + .runwhen/ + generation-rules/stg-workspace-smoke.yaml + templates/ + stg-workspace-smoke-slx.yaml + stg-workspace-smoke-taskset.yaml docs/ 01-overview.md 02-generation-rules-only-pattern.md diff --git a/codebundles/stg-workspace-smoke/.runwhen/README.md b/codebundles/stg-workspace-smoke/.runwhen/README.md new file mode 100644 index 0000000..e6dfc69 --- /dev/null +++ b/codebundles/stg-workspace-smoke/.runwhen/README.md @@ -0,0 +1,97 @@ + # Staging Workspace Smoke Check + + Verify tool-builder runtime can execute a simple custom task against the stg-test workspace. + + **Bundle:** `stg-workspace-smoke` · **Task title:** `Run staging workspace smoke check` · + **Runtime:** tool-builder (python) + + ## 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 `-stg-smoke` + - **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; 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." + ), + } + ] + ``` + + ### 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:** `logs-bulk` + - **Owners:** {{workspace.owner_email}} + + ## Provenance + + - Generated by `runwhen-platform-mcp` `render_codecollection_skill` vlocal-e2e-test +- Source workspace: `stg-test` +- Generated at: `2026-07-02T21:13:33Z` + + ## 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/stg-workspace-smoke/.runwhen/generation-rules/stg-workspace-smoke.yaml b/codebundles/stg-workspace-smoke/.runwhen/generation-rules/stg-workspace-smoke.yaml new file mode 100644 index 0000000..19005e7 --- /dev/null +++ b/codebundles/stg-workspace-smoke/.runwhen/generation-rules/stg-workspace-smoke.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: stg-smoke + qualifiers: + - workspace + baseTemplateName: stg-workspace-smoke + levelOfDetail: detailed + outputItems: + - type: slx + - type: runbook + templateName: stg-workspace-smoke-taskset.yaml 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 new file mode 100644 index 0000000..948825f --- /dev/null +++ b/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-slx.yaml @@ -0,0 +1,27 @@ +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 new file mode 100644 index 0000000..4b1b4ae --- /dev/null +++ b/codebundles/stg-workspace-smoke/.runwhen/templates/stg-workspace-smoke-taskset.yaml @@ -0,0 +1,27 @@ +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' + - name: GEN_CMD + value: 'aW1wb3J0IG9zCgoKZGVmIG1haW4oKToKICAgIHdvcmtzcGFjZSA9IG9zLmVudmlyb24uZ2V0KCJXT1JLU1BBQ0VfTkFNRSIsICJ1bmtub3duIikKICAgIGxvY2F0aW9uID0gb3MuZW52aXJvbi5nZXQoIkxPQ0FUSU9OX05BTUUiLCAidW5rbm93biIpCiAgICByZXR1cm4gWwogICAgICAgIHsKICAgICAgICAgICAgImlzc3VlIHRpdGxlIjogIlN0YWdpbmcgc21va2UgY2hlY2sgcGFzc2VkIiwKICAgICAgICAgICAgImlzc3VlIGRlc3JpcHRpb24iOiAoCiAgICAgICAgICAgICAgICBmIlRvb2wtYnVpbGRlciBzbW9rZSBzY3JpcHQgcmFuIG9uIHdvcmtzcGFjZT17d29ya3NwYWNlfSAiCiAgICAgICAgICAgICAgICBmImxvY2F0aW9uPXtsb2NhdGlvbn0uIgogICAgICAgICAgICApLAogICAgICAgICAgICAiaXNzdWUgc2V2ZXJpdHkiOiA0LAogICAgICAgICAgICAiaXNzdWUgbmV4dCBzdGVwcyI6ICgKICAgICAgICAgICAgICAgICJObyBhY3Rpb24gcmVxdWlyZWQg4oCUIHRoaXMgaXMgYW4gaW5mb3JtYXRpb25hbCBzbW9rZSB0ZXN0LiIKICAgICAgICAgICAgKSwKICAgICAgICB9CiAgICBdCg==' + - name: INTERPRETER + 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 new file mode 100644 index 0000000..b81fde8 --- /dev/null +++ b/codebundles/stg-workspace-smoke/README.md @@ -0,0 +1,26 @@ +# stg-workspace-smoke + +Custom Discovery CodeCollection bundle generated from MCP tool-builder output. + +- **Alias:** Staging Workspace Smoke Check +- **Platform:** `runwhen` +- **Resource types:** workspace + +## Layout + +``` +.runwhen/ + README.md # Human-readable review (decoded script + match rules) + generation-rules/ + stg-workspace-smoke.yaml + templates/ + stg-workspace-smoke-slx.yaml + stg-workspace-smoke-taskset.yaml +``` + +See `.runwhen/README.md` for the full review artifact intended for PR reviewers. + +## 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/)