@andrian.yablonskyy/thub-agent 1.0.24 → 1.0.26

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 CHANGED
@@ -55,6 +55,7 @@ Key options for `thub run`:
55
55
  | `--docker-image <name>` | SW only: a Docker image the Client runs as the DUT instead of its own `sw.image` (the Client must allow it: `sw.allowJobImages`). |
56
56
  | `--git-repo <url> [<branch>\|<tag>\|<commit>]` | A git repository the Client clones (default ref: the default branch); the command runs in the checkout. |
57
57
  | `--depth <n>` | With `--git-repo`: commits to fetch, default `1`; `0` = full history. |
58
+ | `--git-options <string>` | With `--git-repo`: extra git options placed between `git` and its subcommand on the Client, e.g. `'-c core.sshCommand="ssh -i ~/.ssh/lab_key -p 2222"'`. Shell-quoted (no shell run). Stored with the job, so reference key files rather than inlining secrets. |
58
59
  | `--suite <name>` | Passed to the command as `THUB_SUITE`. |
59
60
  | `--arg <value>` | Extra argument for the command, as `"$@"` (repeatable). |
60
61
  | `--timeout <dur>` | e.g. `30m`, default `30m`. |
package/README.pdf CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrian.yablonskyy/thub-agent",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "TestHub Agent CLI — the single entry point CI/CD and developers use to submit and follow test jobs",
5
5
  "bin": {
6
6
  "thub": "./src/cli.js"
@@ -12,7 +12,7 @@
12
12
  "lint:fix": "eslint . --fix"
13
13
  },
14
14
  "dependencies": {
15
- "@andrian.yablonskyy/thub-common": "*",
15
+ "@andrian.yablonskyy/thub-common": "^1.0.26",
16
16
  "commander": "^13.1.0"
17
17
  },
18
18
  "devDependencies": {
package/src/cli.js CHANGED
@@ -17,7 +17,8 @@
17
17
 
18
18
  const { Command } = require('commander'),
19
19
  {
20
- ApiClient, EXIT_CODES, ACTIVE_JOB_STATES, exitCodeForJobState, PACKAGES, fetchLatestVersion, isNewer, isValidVersion, formatDateTime
20
+ ApiClient, EXIT_CODES, ACTIVE_JOB_STATES, exitCodeForJobState, PACKAGES, fetchLatestVersion, isNewer, isValidVersion, formatDateTime,
21
+ splitArgs
21
22
  } = require('@andrian.yablonskyy/thub-common'),
22
23
  { resolveConnection, resolveGroup, resolveUser, writeConfigFile, readConfigFile } = require('./config'),
23
24
  { parseDurationSec } = require('./duration'),
@@ -76,6 +77,17 @@ function taskFromOptions(opts){
76
77
  if (opts.depth !== undefined && !opts.gitRepo){
77
78
  throw usageError('--depth only applies to --git-repo');
78
79
  }
80
+ if (opts.gitOptions !== undefined && !opts.gitRepo){
81
+ throw usageError('--git-options only applies to --git-repo');
82
+ }
83
+ if (opts.gitOptions){
84
+ try {
85
+ splitArgs(opts.gitOptions);
86
+ }
87
+ catch (err){
88
+ throw usageError(`--git-options: ${err.message}`);
89
+ }
90
+ }
79
91
  if (opts.gitRepo){
80
92
  const [url, ref, ...extra] = opts.gitRepo;
81
93
  if (extra.length){
@@ -85,7 +97,7 @@ function taskFromOptions(opts){
85
97
  if (!Number.isInteger(depth) || depth < 0){
86
98
  throw usageError(`--depth ${opts.depth}: must be a whole number (0 = full history)`);
87
99
  }
88
- task.git = { url, ...(ref ? { ref } : {}), depth };
100
+ task.git = { url, ...(ref ? { ref } : {}), depth, ...(opts.gitOptions ? { options: opts.gitOptions } : {}) };
89
101
  }
90
102
  return task;
91
103
  }
@@ -96,6 +108,17 @@ function usageError(message){
96
108
 
97
109
  function fail(err){
98
110
  console.error(`Error: ${err.message}`);
111
+ // The Coordinator validates the spec with its own thub-common: an unknown
112
+ // field means it's older than this Agent.
113
+ if (/Invalid job spec.*must NOT have additional properties/.test(err.message)){
114
+ let url = 'the configured URL';
115
+ try {
116
+ ({ url } = resolveConnection(program.opts()));
117
+ }
118
+ catch { /* keep the generic wording */ }
119
+ console.error(`Hint: the Coordinator at ${url} doesn't know an option ` +
120
+ `this Agent (v${version}) sent — update the Coordinator (dashboard → Update app, or npm i -g @andrian.yablonskyy/thub-coordinator@latest).`);
121
+ }
99
122
  process.exit(err.status && Number.isInteger(err.status) && err.status < 100 ? err.status : EXIT_CODES.USAGE);
100
123
  }
101
124
 
@@ -143,6 +166,11 @@ program
143
166
  '(https://, ssh://, git:// or user@host:path; default ref: the default branch)'
144
167
  )
145
168
  .option('--depth <n>', 'With --git-repo: how many commits to fetch (default 1; 0 = full history)')
169
+ .option(
170
+ '--git-options <string>',
171
+ 'With --git-repo: extra git options, placed between `git` and its subcommand on the Client (shell-quoted, no shell run), ' +
172
+ 'e.g. \'-c core.sshCommand="ssh -i ~/.ssh/lab_key -p 2222"\'. Stored with the job — reference key files, don\'t inline secrets'
173
+ )
146
174
  .option('--suite <name>', 'Test suite name, passed to --command as THUB_SUITE', 'default')
147
175
  .option('--arg <value>', 'Extra argument for --command, as "$@" (repeatable)', collectRepeatable, [])
148
176
  .option('--timeout <duration>', 'e.g. 30m, 1h', '30m')