Skip to content

Commit fa3e64e

Browse files
authored
fix(hadron-build): Check if evergreen channels are matching the expectation before uploading the release (#2607)
Both evergreen stable and testing are currently picking up the changes in the x.x-releases branches and basically racing to release Compass disregarding if they should. This checks the project against the release channel to make sure that stable doesn't publish beta releases and vice versa
1 parent bce5d89 commit fa3e64e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/hadron-build/commands/upload.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,31 @@ exports.handler = function(argv) {
8383
return;
8484
}
8585

86+
if (process.env.CI && !process.env.EVERGREEN_PROJECT) {
87+
cli.warn('Trying to publish a release from non-Evergreen CI environment');
88+
return;
89+
}
90+
91+
if (process.env.EVERGREEN_PROJECT) {
92+
const projectChannel = process.env.EVERGREEN_PROJECT.split('-').pop();
93+
if (!['stable', 'testing'].includes(projectChannel)) {
94+
cli.warn(
95+
`Trying to publish a release from unsupported Evergreen project. Expected stable or testing, got ${projectChannel}`
96+
);
97+
return;
98+
}
99+
const channelToProjectMap = {
100+
testing: 'beta'
101+
};
102+
const mappedChannel = channelToProjectMap[projectChannel] || projectChannel;
103+
if (target.channel !== mappedChannel) {
104+
cli.warn(
105+
`Trying to publish a release from mismatched channel. Expected ${target.channel}, got ${mappedChannel}`
106+
);
107+
return;
108+
}
109+
}
110+
86111
target.assets = target.assets.filter(function(asset) {
87112
// eslint-disable-next-line no-sync
88113
var exists = fs.existsSync(asset.path);

0 commit comments

Comments
 (0)