openvibers/openvibe-git Commits
Forge runner: per-file test limits stretch on a slower machine; two runs at once (#120)
Changes
@@@ -120,8 +120,17 @@ repositories) to `ov-node-01` (8 cores, 15 GB):lockfile → `npm ci`, a `package.json` alone → `npm install`; then `npm test`). A repository with no test scriptreports "Nothing to test here" instead of failing. A repository that needs more names its commands (Live skipsonnxruntime's CUDA download; Games runs typecheck and lint like its workflow).--- **Three runs at once** (`concurrency`, up to 8). The forge keeps one live run per repository, so they are always-- different repositories. Each worker claims as `<host>/<n>`.++- **Two runs at once** (`concurrency`, up to 8). The forge keeps one live run per repository, so they are always++ different repositories. Each worker claims as `<host>/<n>`. Three was tried first: three full suites on the node's++ four cores took Live 14 minutes and Network 18 (GitHub: 8 and 12), so it runs two. The test phase sets++ `OV_TEST_TIMEOUT_SCALE=2` (`testTimeoutScale`; openvibe-shared's test runner 4.323.0 and later stretch each file's++ limit by it), since a file's limit was set on GitHub's machines.++- **Same files, same verdict.** A push whose tree is exactly that of a run that already passed (a pull request merged++ onto an unmoved main) is recorded as passed at once, pointing at that run; nothing is tested twice. A run started by++ hand always runs.++- **Merging on it.** The ship script (`merge-after-ci.sh`) merges on a green `forge/test` without waiting for GitHub++ Actions, and refuses on a red one once the repository's main has passed on the forge (before that, a suite that++ cannot pass without the network does not block a merge GitHub would allow). The board is `/ci`.- **Work in memory.** The work directories are a tmpfs (`/var/lib/ovci/work`, 8 GB at most): an install's tens ofthousands of files never touch the disk, and a run's directory is gone when it ends.- **Installs kept per lockfile** (`runner/deps-cache.js`). After an install phase succeeds, what it made (every@@@ -9,7 +9,8 @@* "tokenFile": "~/.config/openvibe/git-ci.token",* "workRoot": "~/.cache/openvibe-git-ci",* "engine": "auto", // auto | podman | bwrap-- * "concurrency": 1, // runs at once (1-8); the shared node runs 3++ * "concurrency": 1, // runs at once (1-8); the shared node runs 2++ * "testTimeoutScale": 1, // OV_TEST_TIMEOUT_SCALE in the test phase (1-10; the node: 2)* "depsCache": "~/.cache/openvibe-git-ci/deps", // installs kept between runs ("" turns it off)* "depsCacheMb": 20480,* "sharedCache": "~/.cache/openvibe-git-ci/shared", // npm and pnpm download caches, install phase only ("" off)@@@ -67,6 +68,9 @@ function loadConfig(env = process.env) {engine: ['auto', 'podman', 'bwrap'].includes(raw.engine) ? raw.engine : 'auto',image: String(raw.image || 'docker.io/library/node:22-bookworm'),concurrency: int(raw.concurrency, 1, 1, 8),++ // The test phase's OV_TEST_TIMEOUT_SCALE (openvibe-shared/test-runner 4.323.0 and later): a runner slower or busier++ // than the machines a repository's per-file limits were set on stretches them (the shared node: 2).++ testTimeoutScale: Math.min(10, Math.max(1, Number(raw.testTimeoutScale) || 1)),// Installs kept between runs (runner/deps-cache.js) and the package managers' download caches. Both live on// disk: the page cache keeps the busy ones in memory and gives it back when something else needs it.depsCache: raw.depsCache === '' ? '' : expand(raw.depsCache || path.join(HOME, '.cache', 'openvibe-git-ci', 'deps')),@@@ -81,6 +81,7 @@ function createRunner({ cfg, api, log = console, clock = Date.now }) {say(`[git-ci-runner] sandbox: ${engine.why}; ${Object.keys(cfg.repos).length} repositories configured`);const deps = cfg.depsCache ? createDepsCache({ root: cfg.depsCache, maxMb: cfg.depsCacheMb, log: say }) : null;if (cfg.sharedCache) for (const sub of ['npm', 'pnpm-store']) fs.mkdirSync(path.join(cfg.sharedCache, sub), { recursive: true, mode: 0o700 });++ const testEnv = cfg.testTimeoutScale > 1 ? { OV_TEST_TIMEOUT_SCALE: String(cfg.testTimeoutScale) } : {};// Every phase running now, across the runs this runner holds at once: stop() ends them all.const activeKills = new Set();let stopping = false;@@@ -141,11 +142,11 @@ function createRunner({ cfg, api, log = console, clock = Date.now }) {if (engine.kind === 'podman') {return {command: 'podman',-- args: [...rootArgs, ...podmanArgs({ name, workspace: runDir, image: job.image, limits, proxySock, sharedCache: cfg.sharedCache || null, script: command })],++ args: [...rootArgs, ...podmanArgs({ name, workspace: runDir, image: job.image, limits, proxySock, sharedCache: cfg.sharedCache || null, testEnv, script: command })],kill: () => podmanCleanup(name, rootArgs),};}-- const wrapped = bwrapScope({ name, limits, args: bwrapArgs({ workspace: runDir, limits, proxySock, sharedCache: cfg.sharedCache || null, script: command }).args });++ const wrapped = bwrapScope({ name, limits, args: bwrapArgs({ workspace: runDir, limits, proxySock, sharedCache: cfg.sharedCache || null, testEnv, script: command }).args });return { command: wrapped.command, args: wrapped.args, kill: () => scopeCleanup(wrapped.killUnit) };};@@@ -108,7 +108,7 @@ ${command}/*** The podman command line for one phase. proxySock is null for the test phase (no network at all).*/--function podmanArgs({ name, workspace, image, limits, proxySock = null, sharedCache = null, script }) {++function podmanArgs({ name, workspace, image, limits, proxySock = null, sharedCache = null, testEnv = {}, script }) {const args = ['run', '--rm', '--name', name, '--pull=never', '--network=none','--cpus', String(limits.cpus), '--memory', `${limits.memory_mb}m`, '--memory-swap', `${limits.memory_mb}m`,@@@ -119,7 +119,7 @@ function podmanArgs({ name, workspace, image, limits, proxySock = null, sharedCa'--stop-timeout', '5',];const shared = proxySock ? sharedCache : null;-- for (const [key, value] of Object.entries(envList({ ...phaseEnv(proxySock), ...cacheEnv(shared) }))) args.push('-e', `${key}=${value}`);++ for (const [key, value] of Object.entries(envList({ ...phaseEnv(proxySock), ...cacheEnv(shared), ...(proxySock ? {} : testEnv) }))) args.push('-e', `${key}=${value}`);if (proxySock) args.push('-v', `${proxySock}:/run/ci-proxy.sock:rw`);if (shared) args.push('-v', `${shared}:${SHARED_CACHE}:rw`);args.push(image, '/bin/sh', '-c', script);@@@ -150,7 +150,7 @@ function bwrapEtc(workspace) {* The bubblewrap command line for one phase (no systemd scope here; the caller wraps it). Node is bound from* the running runner's own installation, because a workstation's Node is rarely in /usr.*/--function bwrapArgs({ workspace, limits, proxySock = null, sharedCache = null, script }) {++function bwrapArgs({ workspace, limits, proxySock = null, sharedCache = null, testEnv = {}, script }) {const node = fs.realpathSync(process.execPath);const prefix = path.dirname(path.dirname(node));const nodeInside = path.join('/opt/node', path.relative(prefix, node));@@@ -162,7 +162,7 @@ function bwrapArgs({ workspace, limits, proxySock = null, sharedCache = null, sc'--uid', String(UID), '--gid', String(GID), '--hostname', 'ci',];const shared = proxySock ? sharedCache : null;-- for (const [key, value] of Object.entries({ ...envList({ ...phaseEnv(proxySock), ...cacheEnv(shared) }), PATH: `${nodeBin}:/usr/local/bin:/usr/bin:/bin` })) {++ for (const [key, value] of Object.entries({ ...envList({ ...phaseEnv(proxySock), ...cacheEnv(shared), ...(proxySock ? {} : testEnv) }), PATH: `${nodeBin}:/usr/local/bin:/usr/bin:/bin` })) {args.push('--setenv', key, value);}args.push('--ro-bind', '/usr', '/usr');@@@ -177,7 +177,7 @@ function createPageRoutes(ctx) {r.get('/ci', h(async (req, res) => {const data = await ci.board({ limit: req.query.limit });res.set('Cache-Control', 'no-store');-- return page(req, res, ciViews.board({ ...data, runners: config.ci.boardRunners || 3 }), { title: 'CI', description: 'Every OpenVibers repository, tested on our own runner.', index: false });++ return page(req, res, ciViews.board({ ...data, runners: config.ci.boardRunners || 2 }), { title: 'CI', description: 'Every OpenVibers repository, tested on our own runner.', index: false });}));r.get('/machines', h(async (req, res) => {@@@ -126,14 +126,21 @@ const write = (file, text) => { fs.mkdirSync(path.dirname(file), { recursive: trconst podTest = podmanArgs({ name: 'n', workspace: ws, image: 'img', limits, proxySock: null, sharedCache: shared, script: 'true' });assert.ok(!podTest.some((x) => String(x).includes(':/cache')), 'podman\'s test phase gets no shared cache either');assert.match(installScript('npm ci'), /NODE_USE_ENV_PROXY=1/, 'Node\'s own fetch uses the proxy');++ // The test phase gets the timeout scale; the install phase does not.++ const scaledTest = bwrapArgs({ workspace: ws, limits, proxySock: null, testEnv: { OV_TEST_TIMEOUT_SCALE: '2' }, script: 'true' }).args;++ assert.strictEqual(scaledTest[scaledTest.indexOf('OV_TEST_TIMEOUT_SCALE') + 1], '2');++ const scaledInstall = bwrapArgs({ workspace: ws, limits, proxySock: path.join(ws, 'p.sock'), testEnv: { OV_TEST_TIMEOUT_SCALE: '2' }, script: 'true' }).args;++ assert.ok(!scaledInstall.includes('OV_TEST_TIMEOUT_SCALE'));++ assert.ok(podmanArgs({ name: 'n', workspace: ws, image: 'img', limits, proxySock: null, testEnv: { OV_TEST_TIMEOUT_SCALE: '2' }, script: 'true' }).includes('OV_TEST_TIMEOUT_SCALE=2'));assert.doesNotMatch(installScript('npm test', { proxy: false }), /NODE_USE_ENV_PROXY/);// ── The configuration ──const token = path.join(tmp, 'token');fs.writeFileSync(token, 'x'.repeat(40), { mode: 0o600 });const conf = path.join(tmp, 'ci.json');-- fs.writeFileSync(conf, JSON.stringify({ tokenFile: token, concurrency: 8, repos: { 'OpenVibers/OpenVibe.Live': {} } }));++ fs.writeFileSync(conf, JSON.stringify({ tokenFile: token, concurrency: 8, testTimeoutScale: 2, repos: { 'OpenVibers/OpenVibe.Live': {} } }));const cfg = loadConfig({ GIT_CI_CONFIG: conf });++ assert.strictEqual(cfg.testTimeoutScale, 2);assert.strictEqual(cfg.concurrency, 8);assert.ok(cfg.depsCache && cfg.sharedCache, 'both caches are on by default');assert.deepStrictEqual(registrations(cfg).map((r) => [r.full_name, r.install_command, r.test_command]), [['openvibers/openvibe.live', 'auto', 'auto']]);
@@ -120,8 +120,17 @@ repositories) to `ov-node-01` (8 cores, 15 GB):
@@ -120,8 +120,17 @@ repositories) to `ov-node-01` (8 cores, 15 GB):
lockfile → `npm ci`, a `package.json` alone → `npm install`; then `npm test`). A repository with no test script
lockfile → `npm ci`, a `package.json` alone → `npm install`; then `npm test`). A repository with no test script
reports "Nothing to test here" instead of failing. A repository that needs more names its commands (Live skips
reports "Nothing to test here" instead of failing. A repository that needs more names its commands (Live skips
onnxruntime's CUDA download; Games runs typecheck and lint like its workflow).
onnxruntime's CUDA download; Games runs typecheck and lint like its workflow).
-- **Three runs at once** (`concurrency`, up to 8). The forge keeps one live run per repository, so they are always
- different repositories. Each worker claims as `<host>/<n>`.
+- **Two runs at once** (`concurrency`, up to 8). The forge keeps one live run per repository, so they are always
+ different repositories. Each worker claims as `<host>/<n>`. Three was tried first: three full suites on the node's
+ four cores took Live 14 minutes and Network 18 (GitHub: 8 and 12), so it runs two. The test phase sets
+ `OV_TEST_TIMEOUT_SCALE=2` (`testTimeoutScale`; openvibe-shared's test runner 4.323.0 and later stretch each file's
+ limit by it), since a file's limit was set on GitHub's machines.
+- **Same files, same verdict.** A push whose tree is exactly that of a run that already passed (a pull request merged
+ onto an unmoved main) is recorded as passed at once, pointing at that run; nothing is tested twice. A run started by
+ hand always runs.
+- **Merging on it.** The ship script (`merge-after-ci.sh`) merges on a green `forge/test` without waiting for GitHub
+ Actions, and refuses on a red one once the repository's main has passed on the forge (before that, a suite that
+ cannot pass without the network does not block a merge GitHub would allow). The board is `/ci`.
- **Work in memory.** The work directories are a tmpfs (`/var/lib/ovci/work`, 8 GB at most): an install's tens of
- **Work in memory.** The work directories are a tmpfs (`/var/lib/ovci/work`, 8 GB at most): an install's tens of
thousands of files never touch the disk, and a run's directory is gone when it ends.
thousands of files never touch the disk, and a run's directory is gone when it ends.
- **Installs kept per lockfile** (`runner/deps-cache.js`). After an install phase succeeds, what it made (every
- **Installs kept per lockfile** (`runner/deps-cache.js`). After an install phase succeeds, what it made (every
@@ -9,7 +9,8 @@
@@ -9,7 +9,8 @@
* "tokenFile": "~/.config/openvibe/git-ci.token",
* "tokenFile": "~/.config/openvibe/git-ci.token",
* "workRoot": "~/.cache/openvibe-git-ci",
* "workRoot": "~/.cache/openvibe-git-ci",
* "engine": "auto", // auto | podman | bwrap
* "engine": "auto", // auto | podman | bwrap
- * "concurrency": 1, // runs at once (1-8); the shared node runs 3
+ * "concurrency": 1, // runs at once (1-8); the shared node runs 2
+ * "testTimeoutScale": 1, // OV_TEST_TIMEOUT_SCALE in the test phase (1-10; the node: 2)
* "depsCache": "~/.cache/openvibe-git-ci/deps", // installs kept between runs ("" turns it off)
* "depsCache": "~/.cache/openvibe-git-ci/deps", // installs kept between runs ("" turns it off)
* "depsCacheMb": 20480,
* "depsCacheMb": 20480,
* "sharedCache": "~/.cache/openvibe-git-ci/shared", // npm and pnpm download caches, install phase only ("" off)
* "sharedCache": "~/.cache/openvibe-git-ci/shared", // npm and pnpm download caches, install phase only ("" off)
@@ -67,6 +68,9 @@ function loadConfig(env = process.env) {
@@ -67,6 +68,9 @@ function loadConfig(env = process.env) {
engine: ['auto', 'podman', 'bwrap'].includes(raw.engine) ? raw.engine : 'auto',
engine: ['auto', 'podman', 'bwrap'].includes(raw.engine) ? raw.engine : 'auto',
image: String(raw.image || 'docker.io/library/node:22-bookworm'),
image: String(raw.image || 'docker.io/library/node:22-bookworm'),
concurrency: int(raw.concurrency, 1, 1, 8),
concurrency: int(raw.concurrency, 1, 1, 8),
+ // The test phase's OV_TEST_TIMEOUT_SCALE (openvibe-shared/test-runner 4.323.0 and later): a runner slower or busier
+ // than the machines a repository's per-file limits were set on stretches them (the shared node: 2).
+ testTimeoutScale: Math.min(10, Math.max(1, Number(raw.testTimeoutScale) || 1)),
// Installs kept between runs (runner/deps-cache.js) and the package managers' download caches. Both live on
// Installs kept between runs (runner/deps-cache.js) and the package managers' download caches. Both live on
// disk: the page cache keeps the busy ones in memory and gives it back when something else needs it.
// disk: the page cache keeps the busy ones in memory and gives it back when something else needs it.
depsCache: raw.depsCache === '' ? '' : expand(raw.depsCache || path.join(HOME, '.cache', 'openvibe-git-ci', 'deps')),
depsCache: raw.depsCache === '' ? '' : expand(raw.depsCache || path.join(HOME, '.cache', 'openvibe-git-ci', 'deps')),
@@ -81,6 +81,7 @@ function createRunner({ cfg, api, log = console, clock = Date.now }) {
@@ -81,6 +81,7 @@ function createRunner({ cfg, api, log = console, clock = Date.now }) {
say(`[git-ci-runner] sandbox: ${engine.why}; ${Object.keys(cfg.repos).length} repositories configured`);
say(`[git-ci-runner] sandbox: ${engine.why}; ${Object.keys(cfg.repos).length} repositories configured`);
const deps = cfg.depsCache ? createDepsCache({ root: cfg.depsCache, maxMb: cfg.depsCacheMb, log: say }) : null;
const deps = cfg.depsCache ? createDepsCache({ root: cfg.depsCache, maxMb: cfg.depsCacheMb, log: say }) : null;
if (cfg.sharedCache) for (const sub of ['npm', 'pnpm-store']) fs.mkdirSync(path.join(cfg.sharedCache, sub), { recursive: true, mode: 0o700 });
if (cfg.sharedCache) for (const sub of ['npm', 'pnpm-store']) fs.mkdirSync(path.join(cfg.sharedCache, sub), { recursive: true, mode: 0o700 });
+ const testEnv = cfg.testTimeoutScale > 1 ? { OV_TEST_TIMEOUT_SCALE: String(cfg.testTimeoutScale) } : {};
// Every phase running now, across the runs this runner holds at once: stop() ends them all.
// Every phase running now, across the runs this runner holds at once: stop() ends them all.
const activeKills = new Set();
const activeKills = new Set();
let stopping = false;
let stopping = false;
@@ -141,11 +142,11 @@ function createRunner({ cfg, api, log = console, clock = Date.now }) {
@@ -141,11 +142,11 @@ function createRunner({ cfg, api, log = console, clock = Date.now }) {
if (engine.kind === 'podman') {
if (engine.kind === 'podman') {
return {
return {
command: 'podman',
command: 'podman',
- args: [...rootArgs, ...podmanArgs({ name, workspace: runDir, image: job.image, limits, proxySock, sharedCache: cfg.sharedCache || null, script: command })],
+ args: [...rootArgs, ...podmanArgs({ name, workspace: runDir, image: job.image, limits, proxySock, sharedCache: cfg.sharedCache || null, testEnv, script: command })],
kill: () => podmanCleanup(name, rootArgs),
kill: () => podmanCleanup(name, rootArgs),
};
};
}
}
- const wrapped = bwrapScope({ name, limits, args: bwrapArgs({ workspace: runDir, limits, proxySock, sharedCache: cfg.sharedCache || null, script: command }).args });
+ const wrapped = bwrapScope({ name, limits, args: bwrapArgs({ workspace: runDir, limits, proxySock, sharedCache: cfg.sharedCache || null, testEnv, script: command }).args });
return { command: wrapped.command, args: wrapped.args, kill: () => scopeCleanup(wrapped.killUnit) };
return { command: wrapped.command, args: wrapped.args, kill: () => scopeCleanup(wrapped.killUnit) };
};
};
@@ -108,7 +108,7 @@ ${command}
@@ -108,7 +108,7 @@ ${command}
/**
/**
* The podman command line for one phase. proxySock is null for the test phase (no network at all).
* The podman command line for one phase. proxySock is null for the test phase (no network at all).
*/
*/
-function podmanArgs({ name, workspace, image, limits, proxySock = null, sharedCache = null, script }) {
+function podmanArgs({ name, workspace, image, limits, proxySock = null, sharedCache = null, testEnv = {}, script }) {
const args = [
const args = [
'run', '--rm', '--name', name, '--pull=never', '--network=none',
'run', '--rm', '--name', name, '--pull=never', '--network=none',
'--cpus', String(limits.cpus), '--memory', `${limits.memory_mb}m`, '--memory-swap', `${limits.memory_mb}m`,
'--cpus', String(limits.cpus), '--memory', `${limits.memory_mb}m`, '--memory-swap', `${limits.memory_mb}m`,
@@ -119,7 +119,7 @@ function podmanArgs({ name, workspace, image, limits, proxySock = null, sharedCa
@@ -119,7 +119,7 @@ function podmanArgs({ name, workspace, image, limits, proxySock = null, sharedCa
'--stop-timeout', '5',
'--stop-timeout', '5',
];
];
const shared = proxySock ? sharedCache : null;
const shared = proxySock ? sharedCache : null;
- for (const [key, value] of Object.entries(envList({ ...phaseEnv(proxySock), ...cacheEnv(shared) }))) args.push('-e', `${key}=${value}`);
+ for (const [key, value] of Object.entries(envList({ ...phaseEnv(proxySock), ...cacheEnv(shared), ...(proxySock ? {} : testEnv) }))) args.push('-e', `${key}=${value}`);
if (proxySock) args.push('-v', `${proxySock}:/run/ci-proxy.sock:rw`);
if (proxySock) args.push('-v', `${proxySock}:/run/ci-proxy.sock:rw`);
if (shared) args.push('-v', `${shared}:${SHARED_CACHE}:rw`);
if (shared) args.push('-v', `${shared}:${SHARED_CACHE}:rw`);
args.push(image, '/bin/sh', '-c', script);
args.push(image, '/bin/sh', '-c', script);
@@ -150,7 +150,7 @@ function bwrapEtc(workspace) {
@@ -150,7 +150,7 @@ function bwrapEtc(workspace) {
* The bubblewrap command line for one phase (no systemd scope here; the caller wraps it). Node is bound from
* The bubblewrap command line for one phase (no systemd scope here; the caller wraps it). Node is bound from
* the running runner's own installation, because a workstation's Node is rarely in /usr.
* the running runner's own installation, because a workstation's Node is rarely in /usr.
*/
*/
-function bwrapArgs({ workspace, limits, proxySock = null, sharedCache = null, script }) {
+function bwrapArgs({ workspace, limits, proxySock = null, sharedCache = null, testEnv = {}, script }) {
const node = fs.realpathSync(process.execPath);
const node = fs.realpathSync(process.execPath);
const prefix = path.dirname(path.dirname(node));
const prefix = path.dirname(path.dirname(node));
const nodeInside = path.join('/opt/node', path.relative(prefix, node));
const nodeInside = path.join('/opt/node', path.relative(prefix, node));
@@ -162,7 +162,7 @@ function bwrapArgs({ workspace, limits, proxySock = null, sharedCache = null, sc
@@ -162,7 +162,7 @@ function bwrapArgs({ workspace, limits, proxySock = null, sharedCache = null, sc
'--uid', String(UID), '--gid', String(GID), '--hostname', 'ci',
'--uid', String(UID), '--gid', String(GID), '--hostname', 'ci',
];
];
const shared = proxySock ? sharedCache : null;
const shared = proxySock ? sharedCache : null;
- for (const [key, value] of Object.entries({ ...envList({ ...phaseEnv(proxySock), ...cacheEnv(shared) }), PATH: `${nodeBin}:/usr/local/bin:/usr/bin:/bin` })) {
+ for (const [key, value] of Object.entries({ ...envList({ ...phaseEnv(proxySock), ...cacheEnv(shared), ...(proxySock ? {} : testEnv) }), PATH: `${nodeBin}:/usr/local/bin:/usr/bin:/bin` })) {
args.push('--setenv', key, value);
args.push('--setenv', key, value);
}
}
args.push('--ro-bind', '/usr', '/usr');
args.push('--ro-bind', '/usr', '/usr');
@@ -177,7 +177,7 @@ function createPageRoutes(ctx) {
@@ -177,7 +177,7 @@ function createPageRoutes(ctx) {
r.get('/ci', h(async (req, res) => {
r.get('/ci', h(async (req, res) => {
const data = await ci.board({ limit: req.query.limit });
const data = await ci.board({ limit: req.query.limit });
res.set('Cache-Control', 'no-store');
res.set('Cache-Control', 'no-store');
- return page(req, res, ciViews.board({ ...data, runners: config.ci.boardRunners || 3 }), { title: 'CI', description: 'Every OpenVibers repository, tested on our own runner.', index: false });
+ return page(req, res, ciViews.board({ ...data, runners: config.ci.boardRunners || 2 }), { title: 'CI', description: 'Every OpenVibers repository, tested on our own runner.', index: false });
}));
}));
r.get('/machines', h(async (req, res) => {
r.get('/machines', h(async (req, res) => {
@@ -126,14 +126,21 @@ const write = (file, text) => { fs.mkdirSync(path.dirname(file), { recursive: tr
@@ -126,14 +126,21 @@ const write = (file, text) => { fs.mkdirSync(path.dirname(file), { recursive: tr
const podTest = podmanArgs({ name: 'n', workspace: ws, image: 'img', limits, proxySock: null, sharedCache: shared, script: 'true' });
const podTest = podmanArgs({ name: 'n', workspace: ws, image: 'img', limits, proxySock: null, sharedCache: shared, script: 'true' });
assert.ok(!podTest.some((x) => String(x).includes(':/cache')), 'podman\'s test phase gets no shared cache either');
assert.ok(!podTest.some((x) => String(x).includes(':/cache')), 'podman\'s test phase gets no shared cache either');
assert.match(installScript('npm ci'), /NODE_USE_ENV_PROXY=1/, 'Node\'s own fetch uses the proxy');
assert.match(installScript('npm ci'), /NODE_USE_ENV_PROXY=1/, 'Node\'s own fetch uses the proxy');
+ // The test phase gets the timeout scale; the install phase does not.
+ const scaledTest = bwrapArgs({ workspace: ws, limits, proxySock: null, testEnv: { OV_TEST_TIMEOUT_SCALE: '2' }, script: 'true' }).args;
+ assert.strictEqual(scaledTest[scaledTest.indexOf('OV_TEST_TIMEOUT_SCALE') + 1], '2');
+ const scaledInstall = bwrapArgs({ workspace: ws, limits, proxySock: path.join(ws, 'p.sock'), testEnv: { OV_TEST_TIMEOUT_SCALE: '2' }, script: 'true' }).args;
+ assert.ok(!scaledInstall.includes('OV_TEST_TIMEOUT_SCALE'));
+ assert.ok(podmanArgs({ name: 'n', workspace: ws, image: 'img', limits, proxySock: null, testEnv: { OV_TEST_TIMEOUT_SCALE: '2' }, script: 'true' }).includes('OV_TEST_TIMEOUT_SCALE=2'));
assert.doesNotMatch(installScript('npm test', { proxy: false }), /NODE_USE_ENV_PROXY/);
assert.doesNotMatch(installScript('npm test', { proxy: false }), /NODE_USE_ENV_PROXY/);
// ── The configuration ──
// ── The configuration ──
const token = path.join(tmp, 'token');
const token = path.join(tmp, 'token');
fs.writeFileSync(token, 'x'.repeat(40), { mode: 0o600 });
fs.writeFileSync(token, 'x'.repeat(40), { mode: 0o600 });
const conf = path.join(tmp, 'ci.json');
const conf = path.join(tmp, 'ci.json');
- fs.writeFileSync(conf, JSON.stringify({ tokenFile: token, concurrency: 8, repos: { 'OpenVibers/OpenVibe.Live': {} } }));
+ fs.writeFileSync(conf, JSON.stringify({ tokenFile: token, concurrency: 8, testTimeoutScale: 2, repos: { 'OpenVibers/OpenVibe.Live': {} } }));
const cfg = loadConfig({ GIT_CI_CONFIG: conf });
const cfg = loadConfig({ GIT_CI_CONFIG: conf });
+ assert.strictEqual(cfg.testTimeoutScale, 2);
assert.strictEqual(cfg.concurrency, 8);
assert.strictEqual(cfg.concurrency, 8);
assert.ok(cfg.depsCache && cfg.sharedCache, 'both caches are on by default');
assert.ok(cfg.depsCache && cfg.sharedCache, 'both caches are on by default');
assert.deepStrictEqual(registrations(cfg).map((r) => [r.full_name, r.install_command, r.test_command]), [['openvibers/openvibe.live', 'auto', 'auto']]);
assert.deepStrictEqual(registrations(cfg).map((r) => [r.full_name, r.install_command, r.test_command]), [['openvibers/openvibe.live', 'auto', 'auto']]);