@andrian.yablonskyy/thub-agent 1.0.26 → 1.0.27

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
@@ -56,6 +56,7 @@ Key options for `thub run`:
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
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. |
59
+ | `--env <vars>` | Environment variables for every command the Client runs for the job (git, docker login, `--command`): `NAME=value[,NAME=value]`, repeatable; `--env NAME` alone takes the value from your shell. `DOCKER_REGISTRY` + `DOCKER_USERNAME` + `DOCKER_PASSWORD`: the Client logs in to that registry first (`docker login … --password-stdin`). Values reach only the Client running the job; the Coordinator masks them and drops them when the job ends. |
59
60
  | `--suite <name>` | Passed to the command as `THUB_SUITE`. |
60
61
  | `--arg <value>` | Extra argument for the command, as `"$@"` (repeatable). |
61
62
  | `--timeout <dur>` | e.g. `30m`, default `30m`. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrian.yablonskyy/thub-agent",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
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": "^1.0.26",
15
+ "@andrian.yablonskyy/thub-common": "^1.0.27",
16
16
  "commander": "^13.1.0"
17
17
  },
18
18
  "devDependencies": {
package/src/cli.js CHANGED
@@ -18,7 +18,8 @@
18
18
  const { Command } = require('commander'),
19
19
  {
20
20
  ApiClient, EXIT_CODES, ACTIVE_JOB_STATES, exitCodeForJobState, PACKAGES, fetchLatestVersion, isNewer, isValidVersion, formatDateTime,
21
- splitArgs
21
+ splitArgs,
22
+ parseEnvList
22
23
  } = require('@andrian.yablonskyy/thub-common'),
23
24
  { resolveConnection, resolveGroup, resolveUser, writeConfigFile, readConfigFile } = require('./config'),
24
25
  { parseDurationSec } = require('./duration'),
@@ -99,6 +100,16 @@ function taskFromOptions(opts){
99
100
  }
100
101
  task.git = { url, ...(ref ? { ref } : {}), depth, ...(opts.gitOptions ? { options: opts.gitOptions } : {}) };
101
102
  }
103
+ let env;
104
+ try {
105
+ env = parseEnvList(opts.env);
106
+ }
107
+ catch (err){
108
+ throw usageError(err.message);
109
+ }
110
+ if (Object.keys(env).length){
111
+ task.env = env;
112
+ }
102
113
  return task;
103
114
  }
104
115
 
@@ -171,6 +182,15 @@ program
171
182
  'With --git-repo: extra git options, placed between `git` and its subcommand on the Client (shell-quoted, no shell run), ' +
172
183
  'e.g. \'-c core.sshCommand="ssh -i ~/.ssh/lab_key -p 2222"\'. Stored with the job — reference key files, don\'t inline secrets'
173
184
  )
185
+ .option(
186
+ '--env <vars>',
187
+ 'Environment variables for every command the Client runs for the job (git, docker login, --command): ' +
188
+ 'NAME=value[,NAME=value] (repeatable; a value may contain commas); --env NAME alone takes its value from this shell. ' +
189
+ 'With DOCKER_REGISTRY, DOCKER_USERNAME and DOCKER_PASSWORD the Client first logs in to that registry. ' +
190
+ 'Values reach only the Client running the job; the Coordinator masks them and drops them when the job ends',
191
+ collectRepeatable,
192
+ []
193
+ )
174
194
  .option('--suite <name>', 'Test suite name, passed to --command as THUB_SUITE', 'default')
175
195
  .option('--arg <value>', 'Extra argument for --command, as "$@" (repeatable)', collectRepeatable, [])
176
196
  .option('--timeout <duration>', 'e.g. 30m, 1h', '30m')
package/src/streaming.js CHANGED
@@ -77,6 +77,9 @@ async function followJob(client, jobId, { fromSeq = 0, waitMode = false, print =
77
77
  else if (event === 'state'){
78
78
  print(`-- ${data.state}${data.resource ? ' on ' + data.resource : ''} --`);
79
79
  }
80
+ else if (event === 'waiting'){
81
+ print(`-- waiting: ${data.reason} --`);
82
+ }
80
83
  else if (event === 'end'){
81
84
  print(`\nJob finished: ${data.state}`);
82
85
  if (data.artifactsUrl){