@andrian.yablonskyy/thub-common 1.0.28 → 1.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrian.yablonskyy/thub-common",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Shared job-spec schema, state enums and a thin API client used by the Agent and Client",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -102,11 +102,10 @@ const DOCKER_IMAGE_PATTERN =
102
102
  }
103
103
  },
104
104
  // Environment variables (`--env NAME=value`) the Client sets for every
105
- // command it runs for the job — git, docker login, the job's command.
106
- // DOCKER_REGISTRY + DOCKER_USERNAME + DOCKER_PASSWORD: the Client logs in
107
- // to that registry first (README §8.1). Values are secrets as far as
108
- // the Coordinator is concerned: masked in the Agent API and dropped
109
- // from its database once the job ends.
105
+ // command it runs for the job — git and the job's command. No name
106
+ // means anything special. Values are secrets as far as the Coordinator
107
+ // is concerned: masked in the Agent API and dropped from its database
108
+ // once the job ends.
110
109
  env: {
111
110
  type: 'object',
112
111
  maxProperties: 64,
@@ -128,9 +127,6 @@ const DOCKER_IMAGE_PATTERN =
128
127
  // see README §7.1 "Dry-run the pipeline".
129
128
  dryRun: { type: 'boolean', default: false }
130
129
  }
131
- },
130
+ };
132
131
 
133
- // The job env variables the Client logs in to a Docker registry with.
134
- DOCKER_LOGIN_ENV = ['DOCKER_REGISTRY', 'DOCKER_USERNAME', 'DOCKER_PASSWORD'];
135
-
136
- module.exports = { jobSpecSchema, DOCKER_IMAGE_PATTERN, ENV_NAME_PATTERN, DOCKER_LOGIN_ENV };
132
+ module.exports = { jobSpecSchema, DOCKER_IMAGE_PATTERN, ENV_NAME_PATTERN };
@@ -15,7 +15,7 @@
15
15
 
16
16
  const Ajv = require('ajv'),
17
17
  addFormats = require('ajv-formats'),
18
- { jobSpecSchema, DOCKER_LOGIN_ENV } = require('./job-spec.schema'),
18
+ { jobSpecSchema } = require('./job-spec.schema'),
19
19
  { splitArgs } = require('./split-args');
20
20
 
21
21
  const ajv = new Ajv({ useDefaults: true, allErrors: true, strict: false });
@@ -55,8 +55,8 @@ function legacyShapeError(spec){
55
55
  const GIT_URL = /^(?:(?:https?|ssh|git):\/\/[^\s]+|[A-Za-z0-9._-]+@[A-Za-z0-9.-]+:[^\s]+)$/,
56
56
 
57
57
  // Job env names the Client sets itself for a job's commands (besides
58
- // THUB_*): git's safety settings, and the job's own Docker config dir.
59
- RESERVED_ENV = ['GIT_TERMINAL_PROMPT', 'GIT_ALLOW_PROTOCOL', 'DOCKER_CONFIG'];
58
+ // THUB_*): git's safety settings.
59
+ RESERVED_ENV = ['GIT_TERMINAL_PROMPT', 'GIT_ALLOW_PROTOCOL'];
60
60
 
61
61
  // Rules across fields, spelled out here rather than as schema if/then,
62
62
  // whose errors ("must match a schema in then") say little.
@@ -69,15 +69,10 @@ function crossFieldErrors(spec){
69
69
  errors.push('/git/url must be an https://, http://, ssh:// or git:// URL, or user@host:path');
70
70
  }
71
71
  const envNames = Object.keys(spec.env && typeof spec.env === 'object' ? spec.env : {}),
72
- reserved = envNames.filter((n) => /^THUB_/.test(n) || RESERVED_ENV.includes(n)),
73
- login = DOCKER_LOGIN_ENV.filter((n) => envNames.includes(n));
72
+ reserved = envNames.filter((n) => /^THUB_/.test(n) || RESERVED_ENV.includes(n));
74
73
  if (reserved.length){
75
74
  errors.push(`/env ${reserved.join(', ')}: set by the Client itself (THUB_*, ${RESERVED_ENV.join(', ')}) — use other names`);
76
75
  }
77
- if (login.length && login.length < DOCKER_LOGIN_ENV.length){
78
- errors.push(`/env a Docker registry login needs all of ${DOCKER_LOGIN_ENV.join(', ')} — missing ` +
79
- DOCKER_LOGIN_ENV.filter((n) => !login.includes(n)).join(', '));
80
- }
81
76
  if (spec.git?.options){
82
77
  try {
83
78
  splitArgs(spec.git.options);
@@ -97,4 +92,4 @@ function maskEnv(env){
97
92
 
98
93
  const MASKED = '***';
99
94
 
100
- module.exports = { validateJobSpec, maskEnv, DOCKER_LOGIN_ENV, JOB_ENV_MASK: MASKED };
95
+ module.exports = { validateJobSpec, maskEnv, JOB_ENV_MASK: MASKED };