mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
The eight tools were eight Go programs, each with its own copy of the Go runtime, the MongoDB driver and the tools' shared packages: about 105 MB in every bundle, image and snap. wekan/mongo-tools-patches now also publishes mongo-tools-<platform>, all eight in one program of about 15 MB. releases/fetch-mongo-tools.sh puts it in a bundle with a launcher per tool - a three-line shell script on Linux and macOS, a .cmd on Windows - so mongodump keeps working from $SNAP/bin, the bundle and PATH. Launchers rather than symlinks, because a symlink has to survive zip -r, Docker COPY, snapcraft and every user's unzip. Until the newest mongo-tools-patches release has mongo-tools-<platform>, it fetches the eight per-tool assets as before. It first removes the tools a repacked bundle inherited from amd64, so a platform without tools ships none rather than the wrong CPU's. Every bundle job in release-all.yml, repack-bundle-for-arch.sh and build-release-bundle.sh use it; the snaps move mongo-tools into bin/ with its launchers; the telemetry audit scans mongo-tools as a tool; the Windows single EXE unpacks the .cmd launchers; the preflight and the URL check accept the one program. tests/fetchMongoTools.test.cjs serves the release from a local HTTP server and checks the launchers run the program with their arguments, the Windows .cmd files, the per-tool fallback, and (negative) that inherited amd64 tools are removed, that a checksum mismatch is refused, and that no workflow or snap recipe downloads the tools itself. releaseBinaryFreshness now finds the newest-release URL in the helper; workflowFailureDiagnostics required an ::error:: beside each new exit. Thanks to xet7 !
102 lines
3.2 KiB
JavaScript
102 lines
3.2 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const read = relative => fs.readFileSync(path.join(root, relative), 'utf8');
|
|
const workflow = read('.github/workflows/release-all.yml');
|
|
const resolver = read('releases/resolve-node-source.sh');
|
|
const checks = read('releases/check-arch-binaries.sh');
|
|
const repack = read('releases/repack-bundle-for-arch.sh');
|
|
const composeVariants = [
|
|
'docker-compose.yml',
|
|
'docker-compose-ferretdb-v1-postgresql.yml',
|
|
'docker-compose-ferretdb-v1-mysql.yml',
|
|
'docker-compose-ferretdb-v1-mariadb.yml',
|
|
'docker-compose-ferretdb-v1-sap-hana.yml',
|
|
];
|
|
|
|
for (const [name, source] of [
|
|
['release workflow', workflow],
|
|
['architecture preflight', checks],
|
|
['architecture repack', repack],
|
|
]) {
|
|
assert.doesNotMatch(
|
|
source,
|
|
/wekan\/FerretDB\/releases\/download\/v\d/,
|
|
`${name} must not pin an old FerretDB release`,
|
|
);
|
|
assert.doesNotMatch(
|
|
source,
|
|
/wekan\/mongo-tools-patches\/releases\/download\/v\d/,
|
|
`${name} must not pin old MongoDB Database Tools`,
|
|
);
|
|
}
|
|
|
|
assert.match(
|
|
workflow,
|
|
/wekan\/FerretDB\/releases\/latest\/download\/ferretdb-amd64/,
|
|
'the primary bundle must fetch the newest FerretDB release',
|
|
);
|
|
// The workflow fetches the tools through releases/fetch-mongo-tools.sh (one
|
|
// program, mongo-tools-<platform>, instead of eight), so the newest-release
|
|
// URL lives in that helper now; the workflow is checked for calling it.
|
|
assert.match(
|
|
workflow,
|
|
/releases\/fetch-mongo-tools\.sh" \.build\/bundle amd64/,
|
|
'the primary workflow must fetch the database tools through the helper',
|
|
);
|
|
assert.match(
|
|
read('releases/fetch-mongo-tools.sh'),
|
|
/wekan\/mongo-tools-patches\/releases\/latest\/download/,
|
|
'the primary workflow must fetch the newest database-tool release',
|
|
);
|
|
assert.doesNotMatch(
|
|
read('releases/fetch-mongo-tools.sh'),
|
|
/wekan\/mongo-tools-patches\/releases\/download\/v\d/,
|
|
'the database-tool helper must not pin an old release',
|
|
);
|
|
assert.match(
|
|
resolver,
|
|
/index\.json, which lists every release newest first/,
|
|
'Node resolution must begin with the newest maintained Node release',
|
|
);
|
|
assert.match(
|
|
resolver,
|
|
/PATCHES="https:\/\/github\.com\/wekan\/node-patches\/releases\/download"/,
|
|
'fallback Node binaries must come from node-patches releases',
|
|
);
|
|
assert.match(
|
|
resolver,
|
|
/url="\$\{PATCHES\}\/\$\{V\}\/\$\{asset\}"/,
|
|
'node-patches must use the newest Node version currently being considered',
|
|
);
|
|
|
|
for (const file of composeVariants) {
|
|
const compose = read(file);
|
|
assert.match(
|
|
compose,
|
|
/RELEASE_FILE=\/data\/bin\/ferretdb\.release/,
|
|
`${file} must remember which FerretDB release its volume contains`,
|
|
);
|
|
assert.match(
|
|
compose,
|
|
/CACHED_RELEASE=.*RELEASE_FILE/,
|
|
`${file} must compare the cached binary with the requested release`,
|
|
);
|
|
assert.match(
|
|
compose,
|
|
/ferretdb-.*\.sha256sum/,
|
|
`${file} must verify the downloaded FerretDB binary`,
|
|
);
|
|
assert.match(
|
|
compose,
|
|
/mv "\$\$BIN\.new" "\$\$BIN"/,
|
|
`${file} must replace a verified download atomically`,
|
|
);
|
|
}
|
|
|
|
console.log('releaseBinaryFreshness: 31 assertions passed');
|