mirror of
https://github.com/whyour/qinglong.git
synced 2026-11-03 16:19:11 +08:00
fix: preserve prerelease version in health build identity (#3112)
This commit is contained in:
@@ -28,7 +28,7 @@ const backend = read(path.resolve(__dirname, '../app.js'));
|
||||
const root = process.env.QL_DIR || path.resolve(__dirname, '../../..');
|
||||
const version = read(path.join(root, 'version.yaml'))
|
||||
?.toString()
|
||||
.match(/^\uFEFF?version:\s*["']?(\d+\.\d+\.\d+)/m)?.[1];
|
||||
.match(/^\uFEFF?version:\s*["']?(\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?)/m)?.[1];
|
||||
|
||||
export const runtimeBuild = Object.freeze({
|
||||
instanceId: randomUUID(),
|
||||
|
||||
@@ -32,7 +32,7 @@ test('a running process retains its own build identity when installed files chan
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ql-runtime-build-'));
|
||||
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
||||
fs.mkdirSync(path.join(root, 'static/build'), { recursive: true });
|
||||
fs.writeFileSync(path.join(root, 'version.yaml'), 'version: 2.24.0');
|
||||
fs.writeFileSync(path.join(root, 'version.yaml'), 'version: 2.24.0-dev.0');
|
||||
fs.writeFileSync(path.join(root, 'static/build/app.js'), 'old backend');
|
||||
fs.writeFileSync(
|
||||
path.join(root, 'static/build-info.json'),
|
||||
@@ -45,7 +45,7 @@ test('a running process retains its own build identity when installed files chan
|
||||
JSON.stringify({ sourceCommit: 'b'.repeat(40) }),
|
||||
);
|
||||
fs.writeFileSync(path.join(root, 'version.yaml'), 'version: 2.25.0');
|
||||
assert.equal(running.version, '2.24.0');
|
||||
assert.equal(running.version, '2.24.0-dev.0');
|
||||
assert.equal(running.sourceCommit, 'a'.repeat(40));
|
||||
assert.equal(
|
||||
running.backendSha256,
|
||||
|
||||
Reference in New Issue
Block a user