ikanban 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/pipeline.js +16 -2
  2. package/package.json +1 -1
package/lib/pipeline.js CHANGED
@@ -45,9 +45,17 @@ function parse(args) {
45
45
  return opts;
46
46
  }
47
47
 
48
+ const PLAN_NOTE = "Pipelines need Pro: this workspace's plan does not include them, so nothing was sent. The build goes on.";
49
+
48
50
  async function api(path, { base, token, method = "GET", body }) {
49
51
  const res = await ikanbanFetch(path, { base, token, method, body });
50
52
  const data = await res.json().catch(() => ({}));
53
+ if (res.status === 402) {
54
+ // Three-products pricing D7: Pipelines are Pro and up. Never fail a build over the plan.
55
+ const e = new Error(PLAN_NOTE);
56
+ e.plan = true;
57
+ throw e;
58
+ }
51
59
  if (!res.ok || data.success === false) throw new Error(`HTTP ${res.status}: ${data.message || "refused"}`);
52
60
  return data.data;
53
61
  }
@@ -185,8 +193,14 @@ async function run(args) {
185
193
  const conn = connection(opts);
186
194
  if (!opts.status) throw new Error("set --status (queued, running, passed, failed, skipped, held, cancelled)");
187
195
  const tid = await teamId(conn, conn.team);
188
- for (const t of conn.tasks) {
189
- await postEvent(conn, tid, t, { stage: opts.stage, status: opts.status, url: opts.url, commit_sha: opts.sha, detail: opts.detail });
196
+ try {
197
+ for (const t of conn.tasks) {
198
+ await postEvent(conn, tid, t, { stage: opts.stage, status: opts.status, url: opts.url, commit_sha: opts.sha, detail: opts.detail });
199
+ }
200
+ } catch (e) {
201
+ if (!e.plan) throw e;
202
+ console.error(`ikanban: ${e.message}`);
203
+ return 0;
190
204
  }
191
205
  console.log(`${opts.stage} ${opts.status}: ${conn.tasks.map((t) => (t.run ? `${t.task}@${t.run}` : t.task)).join(", ")}`);
192
206
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ikanban",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "iKanban CLI: AI and security scans of your own repo, with results filed into iKanban",
5
5
  "bin": { "ikanban": "bin/ikanban.js" },
6
6
  "files": ["bin", "lib", "hooks", "scanners", "README.md"],