{"format_version": 1,"id": "code_runner","name": "Runner","plural": "Runners","builtin": true,"visibility": "owner","columns": [ {"key": "device_id","type": "text","readonly": true }, {"key": "enabled","type": "bool","readonly": true }, {"key": "labels_json","type": "longtext","readonly": true }, {"key": "capacity","type": "number","readonly": true }, {"key": "ai_levels","type": "longtext","readonly": true }, {"key": "name","name": "Name","type": "text" }, {"key": "line","name": "Labels and last word","type": "text","readonly": true }, {"key": "quiet","name": "Quiet","type": "text","readonly": true }, {"key": "health","name": "Health","type": "choice","choices": ["working","quiet" ],"readonly": true }, {"key": "labels","name": "Labels","type": "text","readonly": true }, {"key": "last_seen_at","name": "Last asked for work","type": "date","readonly": true }, {"key": "created_at","name": "Registered","type": "date","readonly": true }, {"key": "version","name": "Version","type": "text","readonly": true } ],"instructions": "The runners that take the CI jobs your repositories ask for, most recently heard from first. A runner not heard from in a week is quiet; removing one stops it being handed jobs and revokes its registration token. A runner is a machine that takes the CI jobs your repositories ask for, and it registers against the Mac serving you with a token made by New runner token on this list. The token is shown once and revoked on first use; an unused one lasts 24 hours. Cotton never puts it on a row and cannot show it again.","tables": [ {"name": "cotton_machine_runners","columns": [ {"name": "id","type": "TEXT","default": null,"nullable": true,"primary_key": true,"declaration": "\n id TEXT PRIMARY KEY","position": 0 }, {"name": "workspace_id","type": "TEXT","default": null,"nullable": false,"primary_key": false,"declaration": "\n workspace_id TEXT NOT NULL","position": 1 }, {"name": "device_id","type": "TEXT","default": null,"nullable": false,"primary_key": false,"declaration": "\n device_id TEXT NOT NULL CHECK (length(trim(device_id)) > 0)","position": 2 }, {"name": "enabled","type": "INTEGER","default": "1","nullable": false,"primary_key": false,"declaration": "\n enabled INTEGER NOT NULL DEFAULT 1 CHECK (enabled IN (0, 1))","position": 3 }, {"name": "labels_json","type": "TEXT","default": "'[\"cotton-checks-mac:host\"]'","nullable": false,"primary_key": false,"declaration": "\n labels_json TEXT NOT NULL DEFAULT '[\"cotton-checks-mac:host\"]'","position": 4 }, {"name": "capacity","type": "INTEGER","default": "1","nullable": false,"primary_key": false,"declaration": "\n capacity INTEGER NOT NULL DEFAULT 1 CHECK (capacity BETWEEN 1 AND 4)","position": 5 }, {"name": "created_at","type": "TEXT","default": null,"nullable": false,"primary_key": false,"declaration": "\n created_at TEXT NOT NULL","position": 6 }, {"name": "updated_at","type": "TEXT","default": null,"nullable": false,"primary_key": false,"declaration": "\n updated_at TEXT NOT NULL","position": 7 }, {"name": "_hlc","type": "TEXT","default": "''","nullable": false,"primary_key": false,"declaration": "\n _hlc TEXT NOT NULL DEFAULT ''","position": 8 }, {"name": "_born","type": "TEXT","default": null,"nullable": true,"primary_key": false,"declaration": "\n _born TEXT","position": 9 }, {"name": "ai_levels","type": "TEXT","default": "'[]'","nullable": false,"primary_key": false,"declaration": " ai_levels TEXT NOT NULL DEFAULT '[]' CHECK (json_valid(ai_levels) AND json(ai_levels) IN ('[]', '[1]', '[2]', '[3]', '[1,2]', '[1,3]', '[2,1]', '[2,3]', '[3,1]', '[3,2]', '[1,2,3]', '[1,3,2]', '[2,1,3]', '[2,3,1]', '[3,1,2]', '[3,2,1]'))","position": 10 } ],"constraints": [ {"declaration": "\n UNIQUE (workspace_id, device_id)","position": 11 }, {"declaration": "\n CHECK (json_type(labels_json) = 'array')","position": 12 }, {"declaration": "\n CHECK (json_array_length(labels_json) BETWEEN 1 AND 3)","position": 13 }, {"declaration": "\n FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n ","position": 14 } ],"prefix": "CREATE TABLE IF NOT EXISTS cotton_machine_runners (","suffix": ")","indexes": ["CREATE INDEX IF NOT EXISTS idx_cotton_machine_runners_device ON cotton_machine_runners (workspace_id, device_id)","CREATE INDEX IF NOT EXISTS idx_cotton_machine_runners_author ON cotton_machine_runners (substr(_hlc, 20), _hlc)" ],"full_text": [],"triggers": [] } ],"picture": null,"engine": "code","title": "name","date": null,"project": null,"order": null,"slip": {"title": "name","subtitle": "line","trailing": null,"photo": null,"toggle": null,"caption": {"columns": ["quiet" ] } },"tile": {"face": "slip-list" },"page": [ {"heading": null,"columns": ["name","line","quiet","labels","last_seen_at","created_at","version" ] } ],"readonly_when": "created_at","add": false,"list_route": "/code/runners","scope": "personal","setup": true,"group": {"column": "health","sections": [ {"heading": null,"values": ["working" ] }, {"heading": "Not heard from in a week","values": ["quiet" ] } ] },"empty": {"title": "No runners registered yet.","message": "Make one with New runner token above, and register it with that." },"create": {"label": "New runner token","path": "/code/runners/token" },"delete": false,"commands": [ {"id": "mint_token","label": "Make token","kind": "create","method": "code.mintRunnerToken","bindings": {"name": "name" },"receipt": "Token made","object": "link","form": true,"reveals": {"answer": "secret","title": "Your runner token","note": "Copy it now. Cotton shows it only once. It expires after 24 hours or its first use." } }, {"id": "remove","label": "Remove","kind": "delete","method": "code.revokeRunner","destructive": true,"confirm": "It stops being handed jobs and its registration token stops working. Registering it again is a new token.","bindings": {"uuid": "$id" },"receipt": "Removed the runner {name}","does": "destroys","object": "bin" }, {"id": "remove_quiet","label": "Remove the {count} quiet runners","kind": "delete","method": "code.removeQuietRunners","destructive": true,"confirm": "Remove {count} runners not heard from in over a week? Each stops being handed jobs and its registration token stops working. A machine that is still in use registers again with a new token.","bindings": {"expectedCount": "$count" },"when": {"health": "quiet" },"receipt": "Removed {count} quiet runners","does": "destroys","object": "bin","list": {"at_least": 2 } } ],"parts": {"shape": "sheet","head": {"facts": ["created_at" ] },"links": [],"lists": [],"acts": {"main": "mint_token","more": [],"away": "remove" },"cards": [ {"column": "labels" }, {"column": "last_seen_at" }, {"column": "version" } ] }}