Carry the build config key onto repository build definitions - #354
Carry the build config key onto repository build definitions#354melindash wants to merge 2 commits into
Conversation
|
Confirmed — on One ask: With those, I'd drop the new test file — its Happy to merge once that lands. |
Review feedback from @rhoerr on mage-os#354. tests/unit/utils.test.js was already named "should include key from b in result" and its comment said it verified the key, but the body only asserted the result length, so it passed through the whole bug. It now asserts the key. Adds key alongside ref in the repositoryBuildDefinition constructor tests, for both the default and provided cases. Drops tests/unit/release-refs-targeting.test.js. Its helper re-implemented the resolution order it was testing, so it exercised a copy of the logic rather than the real one and would not have caught a change to it. Verified the replacements fail without the constructor assignment: removing it fails 2 of 136 in those two files. Suite 894. Claude-Session: https://claude.ai/code/session_01HvYYeSXC7iC9jb81jMu2yv
Review feedback from @rhoerr on mage-os#354. tests/unit/utils.test.js was already named "should include key from b in result" and its comment said it verified the key, but the body only asserted the result length, so it passed through the whole bug. It now asserts the key. Adds key alongside ref in the repositoryBuildDefinition constructor tests, for both the default and provided cases. Drops tests/unit/release-refs-targeting.test.js. Its helper re-implemented the resolution order it was testing, so it exercised a copy of the logic rather than the real one and would not have caught a change to it. Verified the replacements fail without the constructor assignment: removing it fails 2 of 136 in those two files. Suite 894. Claude-Session: https://claude.ai/code/session_01HvYYeSXC7iC9jb81jMu2yv
0c0e68a to
8bf8204
Compare
mergeBuildConfigs constructs each instruction with Object.assign({key}, ...), but the repositoryBuildDefinition constructor never copied options.key, so instruction.key was always undefined.
That makes the per-repository branch of the release refs lookup in mageos-release.js unreachable:
if (releaseRefs['']) instruction.ref = releaseRefs[''];
if (releaseRefs[instruction.key]) instruction.ref = releaseRefs[instruction.key];
Only the global '*' override could ever apply, so a release could not build one repository from a different ref to the rest. With the key carried through,
module.exports = {'*': 'main', magento2: 'release/3.x'};
builds magento2 from a release branch while the other 24 repositories stay on main, which avoids having to create and maintain a branch group across every repository in releaseBuildConfig.
A full release build produces identical output with and without this change when tested locally.