-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): include releaser name in application artifacts COMPASS-7888 (#…
- Loading branch information
Showing
7 changed files
with
147 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
Alena Khineika <[email protected]> Alena Khineika <> | ||
Alena Khineika <[email protected]> Alena Khineika <[email protected]> | ||
Alena Khineika <[email protected]> Alena Khineika <unknown> | ||
Anna Henningsen <[email protected]> Anna Henningsen <[email protected]> | ||
Anna Henningsen <[email protected]> Anna Henningsen <[email protected]> | ||
Anna Henningsen <[email protected]> Anna Henningsen <[email protected]> | ||
Alena Khineika <[email protected]> Alena Khineika <[email protected]> | ||
Alena Khineika <[email protected]> Alena Khineika <> | ||
Alena Khineika <[email protected]> <[email protected]> | ||
Alena Khineika <[email protected]> Alena Khineika <unknown> | ||
Anna Henningsen <[email protected]> Anna Henningsen <[email protected]> | ||
Anna Henningsen <[email protected]> Anna Henningsen <[email protected]> | ||
Anna Henningsen <[email protected]> Anna Henningsen <[email protected]> | ||
Anna Henningsen <[email protected]> <[email protected]> | ||
Anna Herlihy <[email protected]> aherlihy <[email protected]> | ||
Anna Herlihy <[email protected]> anna herlihy <[email protected]> | ||
Basit Chonka <[email protected]> <[email protected]> | ||
Brahm Gardner <[email protected]> brahmgardner <[email protected]> | ||
Fred Truman <[email protected]> Fred Truman <[email protected]> | ||
Greenkeeper[bot] <[email protected]> Greenkeeper <[email protected]> | ||
Himanshu Singh <[email protected]> <[email protected]> | ||
Irina Shestak <[email protected]> Irina Shestak <[email protected]> | ||
Irina Shestak <[email protected]> Irina Shestak <[email protected]> | ||
Irina Shestak <[email protected]> lrlna <[email protected]> | ||
|
@@ -17,32 +21,39 @@ Jonathan Balsano <[email protected]> Jonathan Balsano <jonathan.balsano | |
Jonathan Balsano <[email protected]> Jonathan Balsano <[email protected]> | ||
Joy Sampoonachot <[email protected]> Joy Sampoonachot <[email protected]> | ||
Joy Sampoonachot <[email protected]> Joy Sampoonachot <[email protected]> | ||
Kevin Mas Ruiz <[email protected]> <[email protected]> | ||
Kevin Meyer <[email protected]> kevinat10gen <[email protected]> | ||
Le Roux Bodenstein <[email protected]> <[email protected]> | ||
Lucas Hrabovsky <[email protected]> Lucas Hrabovsky <[email protected]> | ||
Marc Schäffner-Gurney <[email protected]> Marc Schaffner-Gurney <[email protected]> | ||
Massimiliano Marcon <[email protected]>Massimiliano Marcon <[email protected]> | ||
Matt Cotter <[email protected]> Matt Cotter <[email protected]> | ||
Matt Fairbrass <[email protected]> Matt Fairbrass <[email protected]> | ||
Matt Kangas <[email protected]> Matt Kangas <[email protected]> | ||
Maurizio Casimirri <[email protected]> Maurizio Casimirri <[email protected]> | ||
Maurizio Casimirri <[email protected]> [email protected] <[email protected]> | ||
Maurizio Casimirri <[email protected]> mcasimir <[email protected]> | ||
Maurizio Casimirri <[email protected]> Maurizio Casimirri <[email protected]> | ||
Maurizio Casimirri <[email protected]> Maurizio Casimirri <[email protected]> | ||
Maurizio Casimirri <[email protected]> [email protected] <[email protected]> | ||
Maurizio Casimirri <[email protected]> mcasimir <[email protected]> | ||
Maurizio Casimirri <[email protected]> <[email protected]> | ||
Michael Rose <[email protected]> rosem <[email protected]> | ||
Paul Thurlow <[email protected]> Paul Thurlow <[email protected]> | ||
Paula Stachova <[email protected]> <[email protected]> | ||
Preston Vasquez <[email protected]> Preston Vasquez <[email protected]> | ||
Rhys Howell <rhys@[email protected]> Anemy <rhys@[email protected]> | ||
Rhys Howell <rhys@[email protected]> Rhys <[email protected]> | ||
Rhys Howell <rhys@[email protected]> Rhys Howell <[email protected]> | ||
Rhys Howell <[email protected]> Rhys Howell <rhys@[email protected]> | ||
Rhys Howell <[email protected]> Anemy <rhys@[email protected]> | ||
Rhys Howell <[email protected]> <[email protected]> | ||
Rhys Howell <[email protected]> Rhys Howell <[email protected]> | ||
Satya Sinha <[email protected]> Satya <[email protected]> | ||
Satya Sinha <[email protected]> satyasinha <[email protected]> | ||
Sean Oh <[email protected]> Sean Oh <[email protected]> | ||
Sergey Petushkov <[email protected]> Sergey <[email protected]> | ||
Sergey Petushkov <[email protected]> Sergey Petushkov <[email protected]> | ||
Sergey Petushkov <[email protected]> Sergey <[email protected]> | ||
Sergey Petushkov <[email protected]> Sergey Petushkov <[email protected]> | ||
Sergey Petushkov <[email protected]> <[email protected]> | ||
snyk-bot[bot] <[email protected]> snyk-bot <[email protected]> | ||
Thomas Rueckstiess <[email protected]> Thomas Rückstieß <[email protected]> | ||
Thomas Rueckstiess <[email protected]> Thomas Rueckstiess <[email protected]> | ||
Thomas Rueckstiess <[email protected]> Thomas Rueckstiess <[email protected]> | ||
Waley <[email protected]> Waley <[email protected]> | ||
Waley <[email protected]> Waley Chen <[email protected]> | ||
Yonatan Schreiber <[email protected]> yonatan <[email protected]> | ||
Yonatan Schreiber <[email protected]> yonatan s <[email protected]> | ||
Yonatan Schreiber <[email protected]> yonatan s <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ program | |
.command('beta') | ||
.description('Starts a new beta') | ||
.option('--merge-branch <mergeBranch>', 'branch to merge', 'main') | ||
.option('--submitter <name>', 'github username of the releaser', '') | ||
.option( | ||
'--next-ga [nextGa]', | ||
'next ga version, default to the next GA version in Jira' | ||
|
@@ -32,6 +33,10 @@ program | |
if (!options.mergeBranch) { | ||
throw new Error('mergeBranch is required'); | ||
} | ||
if (!options.submitter) { | ||
throw new Error('submitter is required'); | ||
} | ||
const publisher = getReleasePublisher(options.submitter); | ||
|
||
const nextGa = options.nextGa || (await getNextGaVersionInJira()); | ||
|
||
|
@@ -62,13 +67,14 @@ program | |
console.info(`Promoting ${currentCompassPackageVersion} to ${nextBeta}`); | ||
|
||
await syncWithBranch(options.mergeBranch); | ||
await bumpAndPush(nextBeta, BETA_RELEASE_BRANCH); | ||
await bumpAndPush(nextBeta, BETA_RELEASE_BRANCH, publisher); | ||
}); | ||
|
||
program | ||
.command('ga') | ||
.description('Starts a new GA') | ||
.option('--release-ticket <releaseTicket>') | ||
.option('--submitter <name>', 'github username of the releaser', '') | ||
.option( | ||
'--merge-branch <mergeBranch>', | ||
'branch to merge', | ||
|
@@ -83,6 +89,10 @@ program | |
if (!options.mergeBranch) { | ||
throw new Error('mergeBranch is required'); | ||
} | ||
if (!options.submitter) { | ||
throw new Error('submitter is required'); | ||
} | ||
const publisher = getReleasePublisher(options.submitter); | ||
|
||
const nextGa = await getReleaseVersionFromTicket(options.releaseTicket); | ||
|
||
|
@@ -104,7 +114,7 @@ program | |
} | ||
|
||
console.info(`Promoting ${currentCompassPackageVersion} to ${nextGa}`); | ||
await bumpAndPush(nextGa, GA_RELEASE_BRANCH); | ||
await bumpAndPush(nextGa, GA_RELEASE_BRANCH, publisher); | ||
}); | ||
|
||
program.parseAsync(); | ||
|
@@ -159,8 +169,37 @@ async function gitCheckout(branchName) { | |
}); | ||
} | ||
|
||
async function bumpAndPush(nextVersion, releaseBranch) { | ||
await execFile('npm', ['version', nextVersion], { cwd: compassPackagePath }); | ||
async function getReleasePublisher(submitter) { | ||
const publisherData = ( | ||
await execFile( | ||
'git', | ||
['check-mailmap', `<${submitter}@users.noreply.github.com>`], | ||
{ | ||
cwd: monorepoRoot, | ||
encoding: 'utf8', | ||
} | ||
) | ||
).stdout.trim(); | ||
|
||
if (!publisherData.match(/^[^<]+<[^@>][email protected]>/)) { | ||
throw new Error( | ||
`Could not translate username ${submitter} to recognized authorized email (${publisherData})` | ||
); | ||
} | ||
return publisherData; | ||
} | ||
|
||
async function bumpAndPush(nextVersion, releaseBranch, publisher) { | ||
await execFile('npm', ['version', '--no-git-tag-version', nextVersion], { | ||
cwd: compassPackagePath, | ||
}); | ||
await fs.writeFile( | ||
compassPackageJsonPath, | ||
JSON.stringify({ | ||
...JSON.parse(await fs.readFile(compassPackageJsonPath, 'utf8')), | ||
releasePublisher: publisher, | ||
}) | ||
); | ||
await execFile('git', ['add', compassPackageJsonPath, `package-lock.json`], { | ||
cwd: monorepoRoot, | ||
}); | ||
|
@@ -174,6 +213,26 @@ async function bumpAndPush(nextVersion, releaseBranch) { | |
cwd: monorepoRoot, | ||
}); | ||
await execFile('git', ['push', '--tags'], { cwd: monorepoRoot }); | ||
|
||
const currentBranch = ( | ||
await execFile('git', ['branch', '--show-current'], { | ||
cwd: monorepoRoot, | ||
encoding: 'utf8', | ||
}) | ||
).stdout.trim(); | ||
await execFile( | ||
'gh', | ||
[ | ||
'workflow', | ||
'run', | ||
'codeql.yml', | ||
'-R', | ||
'mongodb-js/compass', | ||
'-r', | ||
currentBranch, | ||
], | ||
{ cwd: monorepoRoot } | ||
); | ||
} | ||
|
||
// NOTE: if there are more "unreleased" versions it will | ||
|