@andrian.yablonskyy/thub-agent 1.0.32 → 1.0.33
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.
- package/README.md +4 -4
- package/package.json +1 -1
- package/src/cli.js +9 -6
- package/src/streaming.js +0 -3
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ thub config set user "Your Name" # optional default --user
|
|
|
29
29
|
|
|
30
30
|
```
|
|
31
31
|
thub run [options] Submit a test job and follow its log
|
|
32
|
-
thub status <jobId> Show status; follow log if running,
|
|
32
|
+
thub status <jobId> Show status; follow log if running, verdict and test counts if done
|
|
33
33
|
thub cancel <jobId> Cancel a job
|
|
34
34
|
thub resources List resources and their status
|
|
35
35
|
thub jobs [--mine] [--state <s>] List recent jobs
|
|
@@ -68,7 +68,7 @@ Key options for `thub run`. **On the Client** names the environment variable the
|
|
|
68
68
|
| `--json` | Machine-readable output. | — (Agent only) |
|
|
69
69
|
|
|
70
70
|
- `thub run` prints the **job ID**, then streams logs until Ctrl-C. Ctrl-C detaches; the job keeps running on the Client.
|
|
71
|
-
- `thub status <jobId>` prints the current state; if active it keeps streaming, if done it prints the verdict and
|
|
71
|
+
- `thub status <jobId>` prints the current state; if active it keeps streaming, if done it prints the verdict, the command's exit code and the JUnit test counts. `--json` prints the job once and never follows it (see [Job status and PASS/FAIL](#job-status-and-passfail)).
|
|
72
72
|
|
|
73
73
|
Exit codes make the Agent usable as a CI step:
|
|
74
74
|
|
|
@@ -222,14 +222,14 @@ thub run --type sw --git-repo git@bitbucket.org:yourorg/tests.git main --depth 1
|
|
|
222
222
|
|
|
223
223
|
## Job status and PASS/FAIL
|
|
224
224
|
|
|
225
|
-
The verdict is `--command`'s exit code: `0` → **PASSED**, anything else → **FAILED**. ERROR, TIMEOUT, LOST and CANCELED mean the job didn't run to a verdict. JUnit XML written to `results/` or `artifacts/` in the work directory is
|
|
225
|
+
The verdict is `--command`'s exit code: `0` → **PASSED**, anything else → **FAILED**. ERROR, TIMEOUT, LOST and CANCELED mean the job didn't run to a verdict. JUnit XML written to `results/` or `artifacts/` in the work directory is summed into the job's `summary` by the Client. Nothing is uploaded: a job's files stay in its workspace on the Client, deleted when it ends — publish anything you need to keep from `--command`, e.g. to Artifactory.
|
|
226
226
|
|
|
227
227
|
**In CI:** `thub run … --wait` exits with the verdict code (table above): `0` PASSED, `1` FAILED, `2` infrastructure, `3` canceled.
|
|
228
228
|
|
|
229
229
|
**Check a job:**
|
|
230
230
|
|
|
231
231
|
```bash
|
|
232
|
-
thub status M-00125 # state; follows the log while active; then "Verdict: …" and
|
|
232
|
+
thub status M-00125 # state; follows the log while active; then "Verdict: …" and test counts; exit = verdict
|
|
233
233
|
thub jobs --mine --state FAILED
|
|
234
234
|
```
|
|
235
235
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -207,7 +207,7 @@ program
|
|
|
207
207
|
)
|
|
208
208
|
.option(
|
|
209
209
|
'--dry-run',
|
|
210
|
-
'Exercise the full pipeline (schedule, accept, state transitions, logs,
|
|
210
|
+
'Exercise the full pipeline (schedule, accept, state transitions, logs, result) ' +
|
|
211
211
|
'without the Client flashing/running anything for real',
|
|
212
212
|
false
|
|
213
213
|
)
|
|
@@ -252,7 +252,7 @@ program
|
|
|
252
252
|
|
|
253
253
|
program
|
|
254
254
|
.command('status')
|
|
255
|
-
.description('Show status; follow log if running,
|
|
255
|
+
.description('Show status; follow log if running, verdict and test counts if done')
|
|
256
256
|
.argument('<jobId>')
|
|
257
257
|
.option('--json', 'Print the job as JSON once, without following it; exit code: its verdict, or 5 while it\'s still active', false)
|
|
258
258
|
.action(async (jobId, opts) => {
|
|
@@ -274,10 +274,13 @@ program
|
|
|
274
274
|
return process.exit(code);
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
console.log(`
|
|
277
|
+
console.log(`Verdict: ${job.state}${job.exit_code != null ? ` (exit code ${job.exit_code})` : ''}`);
|
|
278
|
+
const s = job.summary;
|
|
279
|
+
if (s && Number.isFinite(s.total) && s.total > 0){
|
|
280
|
+
console.log(`Tests: ${s.total} total, ${s.passed} passed, ${s.failed} failed, ${s.skipped} skipped`);
|
|
281
|
+
}
|
|
282
|
+
if (job.message){
|
|
283
|
+
console.log(`Message: ${job.message}`);
|
|
281
284
|
}
|
|
282
285
|
process.exit(exitCodeForJobState(job.state));
|
|
283
286
|
}
|
package/src/streaming.js
CHANGED
|
@@ -82,9 +82,6 @@ async function followJob(client, jobId, { fromSeq = 0, waitMode = false, print =
|
|
|
82
82
|
}
|
|
83
83
|
else if (event === 'end'){
|
|
84
84
|
print(`\nJob finished: ${data.state}`);
|
|
85
|
-
if (data.artifactsUrl){
|
|
86
|
-
print(`Artifacts: ${data.artifactsUrl}`);
|
|
87
|
-
}
|
|
88
85
|
resolveOnce(exitCodeForJobState(data.state));
|
|
89
86
|
}
|
|
90
87
|
}
|