UNPKG

@seqera/node-red-seqera

Version:

Node-RED nodes for interacting with the Seqera Platform API

227 lines (226 loc) 6.51 kB
[ { "id": "4df5f9d400dd75bb", "type": "tab", "label": "Studio on run fail + Slack webhook", "disabled": false, "info": "This workflow has three parts to it:\n\n1. Launch and monitor a workflow\n - Just a manual click trigger, in reality you should set this up to some other automation\n2. On failure, create a Seqera Studio\n - Create + start a Studio with VSCode and the Data Link mounted\n3. Send a message to a Slack workflow webhook\n - Includes workflow status and a button that links to either the workflow run details (on success) or the new Seqera Studios for debugging (on failure)\n\nThis workflow needs some setup:\n\n- All Seqera nodes need a Seqera configuration to be assigned\n- Data Links, Pipelines, and Compute Environments need to be entered\n- Slack workflow needs to be created and webook URL entered.", "env": [] }, { "id": "5e9693fb789c345d", "type": "seqera-workflow-launch", "z": "4df5f9d400dd75bb", "name": "", "seqera": "", "launchpadName": "", "launchpadNameType": "str", "paramsKey": "{}", "paramsKeyType": "json", "workspaceId": "", "workspaceIdType": "str", "sourceWorkspaceId": "", "sourceWorkspaceIdType": "str", "x": 470, "y": 200, "wires": [["88b2f041aea3f4ed"]] }, { "id": "88b2f041aea3f4ed", "type": "seqera-workflow-monitor", "z": "4df5f9d400dd75bb", "name": "", "seqera": "", "workflowId": "workflowId", "workflowIdType": "msg", "workspaceId": "", "workspaceIdType": "str", "keepPolling": true, "poll": 5, "pollUnits": "seconds", "x": 670, "y": 200, "wires": [[], ["9a70f56ce844492a"], ["2fa9726c10d0693e"]] }, { "id": "f5aa0497e12be097", "type": "http request", "z": "4df5f9d400dd75bb", "name": "Slack webhook", "method": "POST", "ret": "txt", "paytoqs": "body", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 920, "y": 380, "wires": [[]] }, { "id": "9a70f56ce844492a", "type": "change", "z": "4df5f9d400dd75bb", "name": "Set webhook payload on success", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\t \"msg\": \"Workflow \" & payload.workflow.projectName & \" (\" & payload.workflow.runName & \"): Status \" & payload.workflow.status & \"\\n\\n Click the button below to view the workflow:\",\t \"button_link\": \"https://cloud.seqera.io/orgs/\" & payload.orgName & \"/workspaces/\" & payload.workspaceName & \"/watch/\" & payload.workflow.id\t}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 660, "y": 340, "wires": [["f5aa0497e12be097"]] }, { "id": "c3ed62a9d56c9e0c", "type": "inject", "z": "4df5f9d400dd75bb", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 300, "y": 200, "wires": [["5e9693fb789c345d"]] }, { "id": "e44f398ad3323d36", "type": "change", "z": "4df5f9d400dd75bb", "name": "Set webook payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\t \"msg\": \"Workflow \" & $flowContext(\"workflow_output.workflow.projectName\") & \" (\" & $flowContext(\"workflow_output.workflow.runName\") & \"): Status \" & $flowContext(\"workflow_output.workflow.status\") & \"\\n\\n Click the button below to open a Seqera Studios session to debug:\",\t \"button_link\": payload.studio.studioUrl\t}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 700, "y": 400, "wires": [["f5aa0497e12be097"]] }, { "id": "ccef54b9f05de7ba", "type": "comment", "z": "4df5f9d400dd75bb", "name": "Webhook setup", "info": "To make the automated Slack message, first you need to create a Slack Workflow.\nSelelct _\"From a webhook\"_ as the trigger.\n\nThen configure with some input variables and a button, and copy the webhook URL.\n\nPaste the webhook URL into the node below, using a `POST` request.", "x": 920, "y": 340, "wires": [] }, { "id": "97db250691c6f2ba", "type": "seqera-studios-create", "z": "4df5f9d400dd75bb", "name": "", "seqera": "", "studioName": "\"debug-pipeline-run-\" & payload.workflow.id", "studioNameType": "jsonata", "description": "", "descriptionType": "str", "containerUri": "public.cr.seqera.io/platform/data-studio-vscode:1.93.1-0.8", "containerUriType": "str", "computeEnvId": "", "computeEnvIdType": "str", "mountData": [], "mountDataType": "str", "cpu": "2", "cpuType": "num", "memory": "8192", "memoryType": "num", "gpu": "0", "gpuType": "num", "condaEnvironment": "", "condaEnvironmentType": "str", "lifespanHours": "", "lifespanHoursType": "num", "isPrivate": false, "isPrivateType": "bool", "spot": false, "spotType": "bool", "autoStart": true, "autoStartType": "bool", "workspaceId": "", "workspaceIdType": "str", "x": 500, "y": 400, "wires": [["e44f398ad3323d36"]] }, { "id": "2fa9726c10d0693e", "type": "change", "z": "4df5f9d400dd75bb", "name": "Save payload on fail", "rules": [ { "t": "set", "p": "workflow_output", "pt": "flow", "to": "payload", "tot": "msg", "dc": true }, { "t": "set", "p": "payload", "pt": "msg", "to": "payload", "tot": "msg", "dc": true } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 300, "y": 400, "wires": [["97db250691c6f2ba"]] }, { "id": "549d57f453c711c1", "type": "comment", "z": "4df5f9d400dd75bb", "name": "Manual trigger", "info": "This is a manual trigger to start the workflow (click the blue square).\nIn reality, you will trigger this workflow by some other automation flow.", "x": 290, "y": 160, "wires": [] } ]