fix(dev-infra): wait for changelog to cherry pick to next branch (#40605)

Wait for the cherry-picked changelog to be merged into the next
branch before completing the task.

PR Close #40605
This commit is contained in:
Joey Perrott 2021-01-27 13:30:04 -08:00 committed by Misko Hevery
parent 9746751603
commit dceede4f80
4 changed files with 18 additions and 7 deletions

View File

@ -5885,11 +5885,13 @@ class ReleaseAction {
return false;
}
// Create a cherry-pick pull request that should be merged by the caretaker.
const { url } = yield this.pushChangesToForkAndCreatePullRequest(nextBranch, `changelog-cherry-pick-${newVersion}`, commitMessage, `Cherry-picks the changelog from the "${stagingBranch}" branch to the next ` +
const { url, id } = yield this.pushChangesToForkAndCreatePullRequest(nextBranch, `changelog-cherry-pick-${newVersion}`, commitMessage, `Cherry-picks the changelog from the "${stagingBranch}" branch to the next ` +
`branch (${nextBranch}).`);
info(green(` ✓ Pull request for cherry-picking the changelog into "${nextBranch}" ` +
'has been created.'));
info(yellow(` Please ask team members to review: ${url}.`));
// Wait for the Pull Request to be merged.
yield this.waitForPullRequestToBeMerged(id);
return true;
});
}

View File

@ -450,7 +450,7 @@ export abstract class ReleaseAction {
}
// Create a cherry-pick pull request that should be merged by the caretaker.
const {url} = await this.pushChangesToForkAndCreatePullRequest(
const {url, id} = await this.pushChangesToForkAndCreatePullRequest(
nextBranch, `changelog-cherry-pick-${newVersion}`, commitMessage,
`Cherry-picks the changelog from the "${stagingBranch}" branch to the next ` +
`branch (${nextBranch}).`);
@ -459,6 +459,10 @@ export abstract class ReleaseAction {
` ✓ Pull request for cherry-picking the changelog into "${nextBranch}" ` +
'has been created.'));
info(yellow(` Please ask team members to review: ${url}.`));
// Wait for the Pull Request to be merged.
await this.waitForPullRequestToBeMerged(id);
return true;
}

View File

@ -93,7 +93,8 @@ describe('common release action logic', () => {
// it is properly appended. Also expect a pull request to be created in the fork.
repo.expectChangelogFetch(branchName, fakeReleaseNotes)
.expectFindForkRequest(fork)
.expectPullRequestToBeCreated('master', fork, forkBranchName, 200);
.expectPullRequestToBeCreated('master', fork, forkBranchName, 200)
.expectPullRequestWait(200);
// Simulate that the fork branch name is available.
fork.expectBranchRequest(forkBranchName, null);
@ -119,7 +120,8 @@ describe('common release action logic', () => {
// it is properly appended. Also expect a pull request to be created in the fork.
repo.expectChangelogFetch(branchName, customReleaseNotes)
.expectFindForkRequest(fork)
.expectPullRequestToBeCreated('master', fork, forkBranchName, 200);
.expectPullRequestToBeCreated('master', fork, forkBranchName, 200)
.expectPullRequestWait(200);
// Simulate that the fork branch name is available.
fork.expectBranchRequest(forkBranchName, null);
@ -138,7 +140,8 @@ describe('common release action logic', () => {
// it is properly appended. Also expect a pull request to be created in the fork.
repo.expectChangelogFetch(branchName, `non analyzable changelog`)
.expectFindForkRequest(fork)
.expectPullRequestToBeCreated('master', fork, forkBranchName, 200);
.expectPullRequestToBeCreated('master', fork, forkBranchName, 200)
.expectPullRequestWait(200);
// Simulate that the fork branch name is available.
fork.expectBranchRequest(forkBranchName, null);
@ -166,7 +169,8 @@ describe('common release action logic', () => {
// it is properly appended. Also expect a pull request to be created in the fork.
repo.expectChangelogFetch(branchName, fakeReleaseNotes)
.expectFindForkRequest(fork)
.expectPullRequestToBeCreated('master', fork, forkBranchName, 200);
.expectPullRequestToBeCreated('master', fork, forkBranchName, 200)
.expectPullRequestWait(200);
// Simulate that the fork branch name is available.
fork.expectBranchRequest(forkBranchName, null);

View File

@ -194,7 +194,8 @@ export async function expectStagingAndPublishWithCherryPick(
.expectTagToBeCreated(expectedTagName, 'STAGING_COMMIT_SHA')
.expectReleaseToBeCreated(`v${expectedVersion}`, expectedTagName)
.expectChangelogFetch(expectedBranch, getChangelogForVersion(expectedVersion))
.expectPullRequestToBeCreated('master', fork, expectedCherryPickForkBranch, 300);
.expectPullRequestToBeCreated('master', fork, expectedCherryPickForkBranch, 300)
.expectPullRequestWait(300);
// In the fork, we make the staging and cherry-pick branches appear as
// non-existent, so that the PRs can be created properly without collisions.