Skip to content
Back to search

alibabacloud-aiops-skills

Official Alibaba Cloud Agent Skills collection, providing AI agents with rich Alibaba Cloud product capabilities and general-purpose tooling.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026. Its scripts were only partly scanned.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/aliyun/alibabacloud-aiops-skills with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/aliyun/alibabacloud-aiops-skills'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/aliyun-alibabacloud-aiops-skills/badge.svg)](/listings/aliyun-alibabacloud-aiops-skills)

HTML

<a href="/listings/aliyun-alibabacloud-aiops-skills"><img src="/api/listings/aliyun-alibabacloud-aiops-skills/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Install Skills with npx

# Install a single Skill
npx skills add aliyun/alibabacloud-aiops-skills --skill <skill-name>

# Install all Alibaba Cloud Skills
npx skills add aliyun/alibabacloud-aiops-skills

# Install stable release (default)
npx skills add aliyun/alibabacloud-aiops-skills --skill <skill-name>

# Install latest beta
npx skills add https://github.com/aliyun/alibabacloud-aiops-skills/tree/preview --skill <skill-name>

# Install a specific historical version (rollback)
npx skills add https://github.com/aliyun/alibabacloud-aiops-skills/tree/<skill-name>-<version> --skill <skill-name>

# Install a specific beta version
npx skills add https://github.com/aliyun/alibabacloud-aiops-skills/tree/<skill-name>-<beta-version> --skill <skill-name>

Manual installation

# Clone the repository
git clone https://github.com/aliyun/alibabacloud-aiops-skills.git

# Point npx skills at the Skill directory
npx skills add <path>/alibabacloud-aiops-skills/skills/<skill-name>

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 95 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Alibaba Cloud Skills
  2. **English** | [简体中文](README-CN.md)
  3. Official Alibaba Cloud Agent Skills collection, providing AI agents with rich Alibaba Cloud product capabilities and general-purpose tooling.
  4. ## Overview
  5. This repository contains a set of officially maintained Agent Skills to help developers use Alibaba Cloud products and services more efficiently. Each Skill is designed and tested for stability and reliability.
  6. ## Skills list
  7. Alibaba Cloud product Skills — to be updated.
  8. ## Installation
  9. ### Install Skills with npx
  10. ```bash
  11. # Install a single Skill
  12. npx skills add aliyun/alibabacloud-aiops-skills --skill <skill-name>
  13. # Install all Alibaba Cloud Skills
  14. npx skills add aliyun/alibabacloud-aiops-skills
  15. # Install stable release (default)
  16. npx skills add aliyun/alibabacloud-aiops-skills --skill <skill-name>
  17. # Install latest beta
  18. npx skills add https://github.com/aliyun/alibabacloud-aiops-skills/tree/preview --skill <skill-name>
  19. # Install a specific historical version (rollback)
  20. npx skills add https://github.com/aliyun/alibabacloud-aiops-skills/tree/<skill-name>-<version> --skill <skill-name>
  21. # Install a specific beta version
  22. npx skills add https://github.com/aliyun/alibabacloud-aiops-skills/tree/<skill-name>-<beta-version> --skill <skill-name>
  23. ```
  24. ### Manual installation
  25. ```bash
  26. # Clone the repository
  27. git clone https://github.com/aliyun/alibabacloud-aiops-skills.git
  28. # Point npx skills at the Skill directory
  29. npx skills add <path>/alibabacloud-aiops-skills/skills/<skill-name>
  30. ```
  31. ## Authentication and configuration
  32. Skills related to Alibaba Cloud products require credentials. The following methods are supported:
  33. **AccessKey authentication**
  34. ```bash
  35. # Set environment variables
  36. export ALIBABACLOUD_ACCESS_KEY_ID=<your-access-key-id>
  37. export ALIBABACLOUD_ACCESS_KEY_SECRET=<your-access-key-secret>
  38. ```
  39. **Aliyun CLI profile authentication**
  40. ```bash
  41. # ~/.aliyun/config.json
  42. aliyun configure [--profile <PROFILE_NAME>] [--mode <AUTHENTICATE_MODE>]
  43. ```
  44. **Security notes**
  45. - **AccessKey authentication** and **AccessKey credentials via the Aliyun CLI profile** are intended for local, personal testing only, to reduce the risk of exposing plaintext AccessKey pairs.
  46. - For services running in the cloud, **EcsRamRole** credentials in the Aliyun CLI profile are strongly recommended. See the [EcsRamRole configuration guide][EcsRamRole].
  47. ## Issues
  48. [Open an issue][issue]. Issues that do not follow the guidelines may be closed immediately.
  49. ## Related
  50. - [Alibaba Cloud website][url]
  51. ## License
  52. [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)
  53. Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
  54. ## Legal
  55. All Skills provided in this repository are open-source projects intended to give developers rich Agent capability extensions and help you manage cloud resources more efficiently. They are governed by the [MIT License](https://spdx.org/licenses/MIT.html). Before you use any Skills from this platform, read the [legal terms](https://terms.alicdn.com/legal-agreement/terms/b_platform_service_agreement/20260330114515787/20260330114515787.html?spm=2263e3e9.11c91e34.0.0.64924106EfoiZy) carefully and understand the risks. By downloading, installing, or running any Skills from this platform in any way, you acknowledge that you have read and agree to bear all operational risks and that you are solely responsible for any consequences arising from use of this code.
  56. [issue]: https://github.com/aliyun/alibabacloud-aiops-skills/issues/new
  57. [url]: https://www.alibabacloud.com
  58. [EcsRamRole]: https://www.alibabacloud.com/help/zh/cli/configure-credentials#6344dd9ddapvg
skills/analyticscomputing/sc/alibabacloud-flink-workspace-ops/scripts/e2e_test.py · Bundled script · 628 lines · 2 findings marked
  1. #!/usr/bin/env python3
  2. """
  3. End-to-end live test for all 75 CLI subcommands.
  4. Executes real API calls in dependency order, using resources created in
  5. earlier steps. Prints a summary table at the end.
  6. Usage:
  7. cd scripts/
  8. export ALIBABA_CLOUD_ACCESS_KEY_ID=...
  9. export ALIBABA_CLOUD_ACCESS_KEY_SECRET=...
  10. python3 e2e_test.py
  11. """
  12. import json
  13. import subprocess
  14. import sys
  15. import time
  16. WS = "f9bbbc0f55ed4d"
  17. NS = "jz-test-default"
  18. REGION = "cn-beijing"
  19. DEPLOY_TARGET = "default-queue"
  20. ENGINE = "vvr-8.0.11-flink-1.17"
  21. COMMON = ["-w", WS, "-n", NS, "-r", REGION]
  22. results = [] # (scenario, cmd, pass/fail, notes)
  23. def cli(*args, expect_success=True, timeout=60):
  24. """Run flink_ververica_ops.py and return parsed JSON."""
  25. cmd = [sys.executable, "flink_ververica_ops.py"] + list(args)
  26. try:
  27. r = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
  28. except subprocess.TimeoutExpired:
  29. return {"success": False, "error": {"message": f"CLI timeout after {timeout}s"}, "_timeout": True}
  30. # Try to parse JSON from stdout
  31. out = r.stdout.strip()
  32. if not out:
  33. # Check stderr for traceback
  34. if "Traceback" in r.stderr or "TypeError" in r.stderr:
  35. return {"_crash": True, "_stderr": r.stderr, "success": False}
  36. return {"success": False, "_stderr": r.stderr, "_stdout": ""}
  37. try:
  38. data = json.loads(out)
  39. except json.JSONDecodeError:
  40. return {"success": False, "_raw": out}
  41. return data
  42. def record(scenario, cmd_name, result, notes=""):
  43. api_ok = result.get("success", False)
  44. crash = result.get("_crash", False)
  45. is_timeout = result.get("_timeout", False)
  46. if crash:
  47. status = "CRASH"
  48. notes = result.get("_stderr", "")[:120]
  49. elif is_timeout:
  50. status = "TIMEOUT"
  51. notes = notes or "CLI process timed out"
  52. elif api_ok:
  53. # Check nested data.success (API-level)
  54. inner = result.get("data", {})
  55. if isinstance(inner, dict) and inner.get("success") is False:
  56. status = "API_ERR"
  57. notes = notes or inner.get("errorMessage", "")[:100]
  58. else:
  59. status = "PASS"
  60. else:
  61. status = "FAIL"
  62. err = result.get("error", {})
  63. notes = notes or err.get("message", str(result)[:100])
  64. results.append((scenario, cmd_name, status, notes))
  65. mark = {"PASS": "+", "API_ERR": "~", "FAIL": "x", "CRASH": "!", "TIMEOUT": "T"}[status]
  66. print(f" [{mark}] {cmd_name}: {status} {notes[:80]}")
  67. return result
  68. def jd(obj):
  69. return json.dumps(obj, ensure_ascii=False)
  70. def get_data(result, key=None):
  71. """Extract nested data from API response."""
  72. d = result.get("data", {})
  73. if isinstance(d, dict) and "data" in d:
  74. d = d["data"]
  75. if key:
  76. return d.get(key) if isinstance(d, dict) else None
  77. return d
  78. def wait_for_job_state(deployment_id, job_id, target_states, timeout=120):
  79. """Poll job state until it reaches one of target_states."""
  80. start = time.time()
  81. while time.time() - start < timeout:
  82. r = cli("get_job", *COMMON, "--deployment_id", deployment_id, "--job_id", job_id)
  83. data = get_data(r)
  84. state = ""
  85. if isinstance(data, dict):
  86. status = data.get("status", {})
  87. if isinstance(status, dict):
  88. state = status.get("currentJobStatus", "") or status.get("state", "")
  89. if not state:
  90. state = data.get("state", "")
  91. if state in target_states:
  92. return state
  93. print(f" >> ... job state = {state or '?'}, waiting...")
  94. time.sleep(5)
  95. return "TIMEOUT"
  96. # ═════════════════════════════════════════════════════════════════════
  97. # Scenario A: W5 Workspace Admin (13 commands)
  98. # ═════════════════════════════════════════════════════════════════════
  99. print("\n=== Scenario A: W5 Workspace Admin ===")
  100. # A1: list_members
  101. r = cli("list_members", *COMMON)
  102. record("W5", "list_members", r)
  103. # A2: create_member
  104. r = cli("create_member", *COMMON, "--member", "123456789012", "--role", "viewer", "--confirm")
  105. record("W5", "create_member", r)
  106. # A3: get_member
  107. r = cli("get_member", *COMMON, "--member", "123456789012")
  108. record("W5", "get_member", r)
  109. # A4: update_member
  110. r = cli("update_member", *COMMON, "--member", "123456789012", "--role", "editor", "--confirm")
  111. record("W5", "update_member", r)
  112. # A5: delete_member
  113. r = cli("delete_member", *COMMON, "--member", "123456789012", "--confirm")
  114. record("W5", "delete_member", r)
  115. # A6: list_variables
  116. r = cli("list_variables", *COMMON)
  117. record("W5", "list_variables", r)
  118. # A7: create_variable (needs 'kind' field)
  119. var_body = {"name": "test_cli_e2e", "value": "hello", "kind": "Plain"}
  120. r = cli("create_variable", *COMMON, "--body_json", jd(var_body), "--confirm")
  121. record("W5", "create_variable", r)
  122. # A8: update_variable
  123. var_body_upd = {"name": "test_cli_e2e", "value": "updated", "kind": "Plain"}
  124. r = cli("update_variable", *COMMON, "--var_name", "test_cli_e2e", "--body_json", jd(var_body_upd), "--confirm")
  125. record("W5", "update_variable", r)
  126. # A9: delete_variable
  127. r = cli("delete_variable", *COMMON, "--var_name", "test_cli_e2e", "--confirm")
  128. record("W5", "delete_variable", r)
  129. # A10: list_deploy_targets
  130. r = cli("list_deploy_targets", *COMMON)
  131. record("W5", "list_deploy_targets", r)
  132. # A11: create_deploy_target (V2 needs Resource with fixedResource)
  133. target_body = {"resource": {"fixedResource": {"cpu": 2.0, "memory": "8Gi"}}}
  134. r = cli("create_deploy_target", *COMMON, "--name", "test-cli-target", "--body_json", jd(target_body), "--confirm")
  135. record("W5", "create_deploy_target", r, "may fail if namespace lacks resource quota")
  136. # A12: update_deploy_target
  137. r = cli("update_deploy_target", *COMMON, "--target_name", "test-cli-target", "--body_json", jd(target_body), "--confirm")
  138. record("W5", "update_deploy_target", r)
  139. # A13: delete_deploy_target
  140. r = cli("delete_deploy_target", *COMMON, "--target_name", "test-cli-target", "--confirm")
  141. record("W5", "delete_deploy_target", r)
  142. # ═════════════════════════════════════════════════════════════════════
  143. # Scenario B: W1 SQL Development (15 commands)
  144. # ═════════════════════════════════════════════════════════════════════
  145. print("\n=== Scenario B: W1 SQL Development ===")
  146. # B1: create_folder
  147. r = cli("create_folder", *COMMON, "--folder_name", "e2e_test_folder", "--confirm")
  148. record("W1", "create_folder", r)
  149. folder_id = get_data(r, "folderId") or "unknown"
  150. # B2: get_folder
  151. r = cli("get_folder", *COMMON, "--folder_id", folder_id)
  152. record("W1", "get_folder", r)
  153. # B3: update_folder
  154. r = cli("update_folder", *COMMON, "--folder_id", folder_id, "--folder_name", "e2e_folder_renamed", "--confirm")
  155. record("W1", "update_folder", r)
  156. # B4: create_draft
  157. r = cli("create_draft", *COMMON,
  158. "--name", "e2e_test_draft",
  159. "--content", "CREATE TEMPORARY TABLE t (id INT) WITH ('connector'='datagen'); SELECT * FROM t;",
  160. "--folder_id", folder_id,
  161. "--engine_version", ENGINE,
  162. "--execution_mode", "STREAMING",
  163. "--confirm")
  164. record("W1", "create_draft", r)
  165. draft_id = get_data(r, "deploymentDraftId") or "unknown"
  166. # B5: get_draft
  167. r = cli("get_draft", *COMMON, "--draft_id", draft_id)
  168. record("W1", "get_draft", r)
  169. # B6: update_draft
  170. r = cli("update_draft", *COMMON, "--draft_id", draft_id,
  171. "--content", "SELECT 1 AS val;",
  172. "--confirm")
  173. record("W1", "update_draft", r)
  174. # B7: list_drafts
  175. r = cli("list_drafts", *COMMON)
  176. record("W1", "list_drafts", r)
  177. # B8: get_draft_lock
  178. r = cli("get_draft_lock", *COMMON, "--draft_id", draft_id)
  179. record("W1", "get_draft_lock", r)
  180. # B9: validate_sql
  181. r = cli("validate_sql", *COMMON, "--statement", "SELECT 1")
  182. record("W1", "validate_sql", r)
  183. # B10: validate_draft (async, needs deployment_target_name)
  184. r = cli("validate_draft", *COMMON, "--draft_id", draft_id, "--deployment_target", DEPLOY_TARGET)
  185. record("W1", "validate_draft", r)
  186. ticket_validate = get_data(r, "ticketId")
  187. # B11: get_validate_result
  188. if ticket_validate:
  189. time.sleep(2)
  190. r = cli("get_validate_result", *COMMON, "--ticket_id", ticket_validate)
  191. record("W1", "get_validate_result", r)
  192. else:
  193. record("W1", "get_validate_result", {"success": True, "data": {}}, "skipped - no validate ticket")
  194. # B12: deploy_draft (async)
  195. r = cli("deploy_draft", *COMMON, "--draft_id", draft_id, "--deployment_target", DEPLOY_TARGET, "--confirm")
  196. record("W1", "deploy_draft", r)
  197. ticket_deploy = get_data(r, "ticketId")
  198. # B13: get_deploy_result
  199. if ticket_deploy:
  200. time.sleep(2)
  201. r = cli("get_deploy_result", *COMMON, "--ticket_id", ticket_deploy)
  202. record("W1", "get_deploy_result", r)
  203. else:
  204. record("W1", "get_deploy_result", {"success": True, "data": {}}, "skipped - no deploy ticket")
  205. # B14: delete_draft
  206. r = cli("delete_draft", *COMMON, "--draft_id", draft_id, "--confirm")
  207. record("W1", "delete_draft", r)
  208. # B15: delete_folder
  209. r = cli("delete_folder", *COMMON, "--folder_id", folder_id, "--confirm")
  210. record("W1", "delete_folder", r)
  211. # ═════════════════════════════════════════════════════════════════════
  212. # Scenario C: W2 Deployment + Job lifecycle (26 commands)
  213. # ═════════════════════════════════════════════════════════════════════
  214. print("\n=== Scenario C: W2 Deployment + Job lifecycle ===")
  215. # C1: list_deployments (empty)
  216. r = cli("list_deployments", *COMMON)
  217. record("W2", "list_deployments", r)
  218. # C2: create_deployment -- a real streaming SQL deployment
  219. dep_body = {
  220. "name": "e2e-cli-test-dep",
  221. "deploymentTarget": {"name": DEPLOY_TARGET, "mode": "PER_JOB"},
  222. "engineVersion": ENGINE,
  223. "executionMode": "STREAMING",
  224. "logging": {"loggingProfile": "default"},
  225. "artifact": {
  226. "kind": "SQLSCRIPT",
  227. "sqlArtifact": {
  228. "sqlScript": "CREATE TEMPORARY TABLE src (id INT, ts TIMESTAMP(3), WATERMARK FOR ts AS ts) WITH ('connector'='datagen','rows-per-second'='1'); CREATE TEMPORARY TABLE sink (id INT, ts TIMESTAMP(3)) WITH ('connector'='blackhole'); INSERT INTO sink SELECT * FROM src;"
  229. }
  230. }
  231. }
  232. r = cli("create_deployment", *COMMON, "--body_json", jd(dep_body), "--confirm")
  233. record("W2", "create_deployment", r)
  234. dep_data = get_data(r)
  235. dep_id = ""
  236. if isinstance(dep_data, dict):
  237. dep_id = dep_data.get("deploymentId", "") or dep_data.get("metadata", {}).get("deploymentId", "")
  238. if not dep_id:
  239. # Fallback: look inside result.data.data
  240. raw = r.get("data", {})
  241. if isinstance(raw, dict) and isinstance(raw.get("data"), dict):
  242. dep_id = raw["data"].get("deploymentId", "")
  243. print(f" >> deployment_id = {dep_id}")
  244. # C3: get_deployment
  245. r = cli("get_deployment", *COMMON, "--deployment_id", dep_id)
  246. record("W2", "get_deployment", r)
  247. # C4: update_deployment
  248. upd_body = {"description": "e2e test deployment - updated"}
  249. r = cli("update_deployment", *COMMON, "--deployment_id", dep_id, "--body_json", jd(upd_body), "--confirm")
  250. record("W2", "update_deployment", r)
  251. # C5: search_by_name
  252. r = cli("search_by_name", *COMMON, "--name", "e2e-cli-test-dep")
  253. record("W2", "search_by_name", r)
  254. # C6: search_by_label
  255. r = cli("search_by_label", *COMMON, "--label_key", "test", "--label_value", "true")
  256. record("W2", "search_by_label", r, "empty result expected")
  257. # C7: search_by_ip
  258. r = cli("search_by_ip", *COMMON, "--ip", "10.0.0.1")
  259. record("W2", "search_by_ip", r, "empty or error expected")
  260. # C8: get_events
  261. r = cli("get_events", *COMMON, "--deployment_id", dep_id)
  262. record("W2", "get_events", r)
  263. # C9: generate_resource_plan (async)
  264. r = cli("generate_resource_plan", *COMMON, "--deployment_id", dep_id)
  265. record("W2", "generate_resource_plan", r)
  266. ticket_rp = get_data(r, "ticketId")
  267. # C10: get_resource_plan_result
  268. if ticket_rp:
  269. time.sleep(3)
  270. r = cli("get_resource_plan_result", *COMMON, "--ticket_id", ticket_rp)
  271. record("W2", "get_resource_plan_result", r)
  272. else:
  273. record("W2", "get_resource_plan_result", {"success": True, "data": {}}, "skipped - no ticket")
  274. # C11: start_job
  275. r = cli("start_job", *COMMON, "--deployment_id", dep_id, "--restore_strategy", "NONE", "--confirm")
  276. record("W2", "start_job", r)
  277. job_data = get_data(r)
  278. job_id = ""
  279. if isinstance(job_data, dict):
  280. job_id = job_data.get("jobId", "") or job_data.get("jobID", {}).get("jobId", "")
  281. if not job_id:
  282. raw = r.get("data", {})
  283. if isinstance(raw, dict) and isinstance(raw.get("data"), dict):
  284. job_id = raw["data"].get("jobId", "")
  285. print(f" >> job_id = {job_id}")
  286. # Wait for job to be RUNNING (or at least STARTING)
  287. if job_id:
  288. print(" >> waiting for job to reach RUNNING state...")
  289. state = wait_for_job_state(dep_id, job_id, ["RUNNING", "FAILING", "FAILED", "CANCELLING", "FINISHED"], timeout=120)
  290. print(f" >> job state = {state}")
  291. # C12: get_job
  292. if job_id:
  293. r = cli("get_job", *COMMON, "--deployment_id", dep_id, "--job_id", job_id)
  294. record("W2", "get_job", r)
  295. else:
  296. record("W2", "get_job", {"success": True, "data": {}}, "skipped - no job_id")
  297. # C13: list_jobs
  298. r = cli("list_jobs", *COMMON, "--deployment_id", dep_id)
  299. record("W2", "list_jobs", r)
  300. # C14: get_start_log
  301. r = cli("get_start_log", *COMMON, "--deployment_id", dep_id, "--job_id", job_id or "dummy")
  302. record("W2", "get_start_log", r)
  303. # C15: diagnose_job
  304. if job_id:
  305. r = cli("diagnose_job", *COMMON, "--deployment_id", dep_id, "--job_id", job_id)
  306. record("W2", "diagnose_job", r)
  307. else:
  308. record("W2", "diagnose_job", {"success": True, "data": {}}, "skipped - no job_id")
  309. # C16: hot_update_job
  310. if job_id:
  311. r = cli("hot_update_job", *COMMON, "--deployment_id", dep_id, "--job_id", job_id, "--confirm")
  312. record("W2", "hot_update_job", r)
  313. else:
  314. record("W2", "hot_update_job", {"success": True, "data": {}}, "skipped - no job_id")
  315. # C17: get_hot_update_result
  316. if job_id:
  317. r = cli("get_hot_update_result", *COMMON, "--deployment_id", dep_id, "--job_id", job_id)
  318. record("W2", "get_hot_update_result", r)
  319. else:
  320. record("W2", "get_hot_update_result", {"success": True, "data": {}}, "skipped - no job_id")
  321. # C18: create_savepoint (need running job)
  322. r = cli("create_savepoint", *COMMON, "--deployment_id", dep_id, "--confirm")
  323. record("W2", "create_savepoint", r)
  324. sp_data = get_data(r)
  325. sp_id = ""
  326. if isinstance(sp_data, dict):
  327. sp_id = sp_data.get("savepointId", "")
  328. if not sp_id:
  329. raw = r.get("data", {})
  330. if isinstance(raw, dict) and isinstance(raw.get("data"), dict):
  331. sp_id = raw["data"].get("savepointId", "")
  332. print(f" >> savepoint_id = {sp_id}")
  333. # Wait a bit for savepoint
  334. if sp_id:
  335. time.sleep(5)
  336. # C19: get_savepoint
  337. if sp_id:
  338. r = cli("get_savepoint", *COMMON, "--savepoint_id", sp_id)
  339. record("W2", "get_savepoint", r)
  340. else:
  341. record("W2", "get_savepoint", {"success": True, "data": {}}, "skipped - no savepoint_id")
  342. # C20: list_savepoints
  343. r = cli("list_savepoints", *COMMON, "--deployment_id", dep_id)
  344. record("W2", "list_savepoints", r)
  345. # C21: get_lineage
  346. r = cli("get_lineage", *COMMON)
  347. record("W2", "get_lineage", r)
  348. # C22: flink_api_proxy (use the deployment as resource)
  349. if job_id:
  350. r = cli("flink_api_proxy", *COMMON,
  351. "--flink_api_path", "/overview",
  352. "--resource_type", "jobs",
  353. "--resource_id", dep_id)
  354. record("W2", "flink_api_proxy", r)
  355. else:
  356. record("W2", "flink_api_proxy", {"success": True, "data": {}}, "skipped - no running job")
  357. # C23: stop_job
  358. if job_id:
  359. r = cli("stop_job", *COMMON, "--deployment_id", dep_id, "--job_id", job_id, "--stop_strategy", "NONE", "--confirm")
  360. record("W2", "stop_job", r)
  361. # Wait for job to transition to CANCELLED
  362. print(" >> waiting for job to stop...")
  363. wait_for_job_state(dep_id, job_id, ["CANCELLED", "FAILED", "FINISHED"], timeout=60)
  364. else:
  365. record("W2", "stop_job", {"success": True, "data": {}}, "skipped - no job_id")
  366. # C24: delete_savepoint
  367. if sp_id:
  368. r = cli("delete_savepoint", *COMMON, "--savepoint_id", sp_id, "--confirm")
  369. record("W2", "delete_savepoint", r)
  370. else:
  371. record("W2", "delete_savepoint", {"success": True, "data": {}}, "skipped - no savepoint_id")
  372. # C25: delete_job (must be in CANCELLED/FAILED/FINISHED state)
  373. if job_id:
  374. # Wait and retry for job to be in terminal state
  375. for attempt in range(3):
  376. r = cli("delete_job", *COMMON, "--deployment_id", dep_id, "--job_id", job_id, "--confirm")
  377. if r.get("success") and not (isinstance(r.get("data", {}), dict) and r["data"].get("success") is False):
  378. break
  379. print(f" >> delete_job attempt {attempt+1} failed, waiting...")
  380. time.sleep(10)
  381. record("W2", "delete_job", r)
  382. else:
  383. record("W2", "delete_job", {"success": True, "data": {}}, "skipped - no job_id")
  384. # C26: delete_deployment
  385. for attempt in range(3):
  386. r = cli("delete_deployment", *COMMON, "--deployment_id", dep_id, "--confirm")
  387. if r.get("success") and not (isinstance(r.get("data", {}), dict) and r["data"].get("success") is False):
  388. break
  389. print(f" >> delete_deployment attempt {attempt+1} failed, waiting...")
  390. time.sleep(10)
  391. record("W2", "delete_deployment", r)
  392. # ═════════════════════════════════════════════════════════════════════
  393. # Scenario D: W3 Session Cluster (7 commands)
  394. # ═════════════════════════════════════════════════════════════════════
  395. print("\n=== Scenario D: W3 Session Cluster ===")
  396. # D1: list_session_clusters
  397. r = cli("list_session_clusters", *COMMON)
  398. record("W3", "list_session_clusters", r)
  399. # D2: create_session_cluster
  400. sc_body = {
  401. "name": "e2e-cli-test-sc",
  402. "workspace": WS,
  403. "engineVersion": ENGINE,
  404. "deploymentTargetName": DEPLOY_TARGET,
  405. "logging": {"loggingProfile": "default"},
  406. "basicResourceSetting": {
  407. "parallelism": 1,
  408. "jobmanagerResourceSettingSpec": {"cpu": 1.0, "memory": "4Gi"},
  409. "taskmanagerResourceSettingSpec": {"cpu": 1.0, "memory": "4Gi"}
  410. }
  411. }
  412. r = cli("create_session_cluster", *COMMON, "--body_json", jd(sc_body), "--confirm")
  413. record("W3", "create_session_cluster", r)
  414. sc_data = get_data(r)
  415. sc_name = sc_data.get("name", "e2e-cli-test-sc") if isinstance(sc_data, dict) else "e2e-cli-test-sc"
  416. # Find the cluster_id - check the register args
  417. # The CLI uses --cluster_id for session cluster operations
  418. sc_id = sc_data.get("sessionClusterId", "") if isinstance(sc_data, dict) else ""
  419. print(f" >> session_cluster name={sc_name}, id={sc_id}")
  420. # D3: get_session_cluster
  421. r = cli("get_session_cluster", *COMMON, "--cluster_id", sc_name)
  422. record("W3", "get_session_cluster", r)
  423. # D4: update_session_cluster
  424. sc_upd = {"engineVersion": ENGINE, "deploymentTargetName": DEPLOY_TARGET}
  425. r = cli("update_session_cluster", *COMMON, "--cluster_id", sc_name, "--body_json", jd(sc_upd), "--confirm")
  426. record("W3", "update_session_cluster", r)
  427. # D5: start_session_cluster
  428. r = cli("start_session_cluster", *COMMON, "--cluster_id", sc_name, "--confirm")
  429. record("W3", "start_session_cluster", r)
  430. # Wait for cluster to start
  431. print(" >> waiting for session cluster to start...")
  432. time.sleep(15)
  433. # D6: stop_session_cluster
  434. r = cli("stop_session_cluster", *COMMON, "--cluster_id", sc_name, "--confirm")
  435. record("W3", "stop_session_cluster", r)
  436. # Wait for cluster to stop
  437. time.sleep(10)
  438. # D7: delete_session_cluster
  439. r = cli("delete_session_cluster", *COMMON, "--cluster_id", sc_name, "--confirm")
  440. record("W3", "delete_session_cluster", r)
  441. # ═════════════════════════════════════════════════════════════════════
  442. # Scenario E: W4 Dev Resources (14 commands)
  443. # ═════════════════════════════════════════════════════════════════════
  444. print("\n=== Scenario E: W4 Dev Resources ===")
  445. # E1: list_engine_versions
  446. r = cli("list_engine_versions", *COMMON)
  447. record("W4", "list_engine_versions", r)
  448. # E2: get_catalogs
  449. r = cli("get_catalogs", *COMMON)
  450. record("W4", "get_catalogs", r)
  451. # E3: get_databases
  452. r = cli("get_databases", *COMMON, "--catalog_name", "vvp")
  453. record("W4", "get_databases", r)
  454. # E4: get_tables
  455. r = cli("get_tables", *COMMON, "--catalog_name", "vvp", "--database_name", "default")
  456. record("W4", "get_tables", r)
  457. # E5: execute_sql
  458. r = cli("execute_sql", *COMMON, "--statement", "SHOW CATALOGS", "--confirm")
  459. record("W4", "execute_sql", r)
  460. # E6: get_udf_artifacts
  461. r = cli("get_udf_artifacts", *COMMON)
  462. record("W4", "get_udf_artifacts", r)
  463. # E7: create_udf_artifact (needs a real JAR url, will timeout or get API error)
  464. udf_body = {"jarUrl": "https://dummy.oss-cn-beijing.aliyuncs.com/test.jar", "name": "e2e-test-udf"}
    • Dismissed after review: Links to a Windows program from code, which is how droppers fetch their payload
    • Line 561 on GitHub
  465. r = cli("create_udf_artifact", *COMMON, "--body_json", jd(udf_body), "--confirm", timeout=30)
  466. record("W4", "create_udf_artifact", r, "expected: timeout/error - no real jar")
  467. # E8: update_udf_artifact (will fail - no artifact exists)
  468. r = cli("update_udf_artifact", *COMMON, "--udf_artifact_name", "e2e-test-udf", "--body_json", jd(udf_body), "--confirm")
  469. record("W4", "update_udf_artifact", r, "expect API error - artifact not found")
  470. # E9: delete_udf_artifact
  471. r = cli("delete_udf_artifact", *COMMON, "--udf_artifact_name", "e2e-test-udf", "--confirm")
  472. record("W4", "delete_udf_artifact", r, "expect API error - artifact not found")
  473. # E10: register_udf_function
  474. udf_fn = {"className": "com.test.E2eUdf", "functionName": "e2e_udf", "udfArtifactName": "e2e-test-udf"}
  475. r = cli("register_udf_function", *COMMON, "--body_json", jd(udf_fn), "--confirm")
  476. record("W4", "register_udf_function", r, "expect API error - artifact not found")
  477. # E11: delete_udf_function
  478. r = cli("delete_udf_function", *COMMON, "--function_name", "e2e_udf", "--class_name", "com.test.E2eUdf", "--udf_artifact_name", "e2e-test-udf", "--confirm")
  479. record("W4", "delete_udf_function", r, "expect API error - function not found")
  480. # E12: list_connectors
  481. r = cli("list_connectors", *COMMON)
  482. record("W4", "list_connectors", r)
  483. # E13: register_connector
  484. r = cli("register_connector", *COMMON, "--body_json", '{"jarUrl":"https://dummy.oss-cn-beijing.aliyuncs.com/conn.jar"}', "--confirm", timeout=30)
    • Dismissed after review: Links to a Windows program from code, which is how droppers fetch their payload
    • Line 587 on GitHub
  485. record("W4", "register_connector", r, "expected: timeout/error - no real jar")
  486. # E14: delete_connector
  487. r = cli("delete_connector", *COMMON, "--connector_name", "e2e-test-connector", "--confirm")
  488. record("W4", "delete_connector", r)
  489. # ═════════════════════════════════════════════════════════════════════
  490. # Summary
  491. # ═════════════════════════════════════════════════════════════════════
  492. print("\n" + "=" * 80)
  493. print("FINAL RESULTS")
  494. print("=" * 80)
  495. pass_count = sum(1 for _, _, s, _ in results if s == "PASS")
  496. api_err_count = sum(1 for _, _, s, _ in results if s == "API_ERR")
  497. fail_count = sum(1 for _, _, s, _ in results if s == "FAIL")
  498. crash_count = sum(1 for _, _, s, _ in results if s == "CRASH")
  499. timeout_count = sum(1 for _, _, s, _ in results if s == "TIMEOUT")
  500. total = len(results)
  501. print(f"\n{'Scenario':<6} {'Command':<30} {'Status':<10} Notes")
  502. print("-" * 80)
  503. for scenario, cmd, status, notes in results:
  504. print(f"{scenario:<6} {cmd:<30} {status:<10} {notes[:40]}")
  505. print("-" * 80)
  506. print(f"Total: {total} | PASS: {pass_count} | API_ERR: {api_err_count} | FAIL: {fail_count} | TIMEOUT: {timeout_count} | CRASH: {crash_count}")
  507. print(f"\nPASS = SDK call succeeded and API returned success")
  508. print(f"API_ERR = SDK call succeeded but API returned business error (e.g. resource not found)")
  509. print(f"FAIL = SDK call returned error envelope (connectivity/auth)")
  510. print(f"TIMEOUT = CLI process timed out (expected for fake JAR URLs)")
  511. print(f"CRASH = Python TypeError/Traceback (BUG!)")
  512. if crash_count > 0:
  513. print("\n!!! CRASHES DETECTED - BUGS TO FIX !!!")
  514. for scenario, cmd, status, notes in results:
  515. if status == "CRASH":
  516. print(f" {scenario}/{cmd}: {notes}")
  517. sys.exit(1 if crash_count > 0 else 0)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.