Skip to content

Commit

Permalink
fix: continue using latestTag.sha as base; make delay actually work (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Apr 3, 2020
1 parent a56ea70 commit 9e9acb0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
19 changes: 0 additions & 19 deletions src/release-pr.ts
Expand Up @@ -103,26 +103,7 @@ export class ReleasePR {
this.gh = this.gitHubInstance(options.octokitAPIs);
}

async delay({ms = 3000}) {
new Promise((resolve, reject) => {
setTimeout(() => {
return resolve();
}, ms);
});
}

async run() {
// TODO: this temporarily resolves a race condition between creating a release
// and updating tags on the release PR. This should be replaced by a queuing
// mechanism to delay/retry this request.
if (this.snapshot) {
checkpoint(
'snapshot: sleeping for 10 seconds...',
CheckpointType.Success
);
await this.delay({ms: 10000});
checkpoint('snapshot: finished sleeping', CheckpointType.Success);
}
const pr: GitHubReleasePR | undefined = await this.gh.findMergedReleasePR(
this.labels
);
Expand Down
26 changes: 25 additions & 1 deletion src/releasers/java-yoshi.ts
Expand Up @@ -124,6 +124,15 @@ export class Version {
}
}

async function delay({ms = 3000}) {
console.log(process.env.NODE_ENV);
new Promise(resolve => {
setTimeout(() => {
return resolve();
}, ms);
});
}

export class JavaYoshi extends ReleasePR {
protected async _run() {
const versionsManifestContent = await this.gh.getFileContents(
Expand All @@ -138,6 +147,17 @@ export class JavaYoshi extends ReleasePR {
);
if (this.snapshot) {
this.labels = ['type: process'];
// TODO: this temporarily resolves a race condition between creating a release
// and updating tags on the release PR. This should be replaced by a queuing
// mechanism to delay/retry this request.
if (this.snapshot) {
checkpoint(
'snapshot: sleeping for 15 seconds...',
CheckpointType.Success
);
await delay({ms: 15000});
checkpoint('snapshot: finished sleeping', CheckpointType.Success);
}
}

const latestTag: GitHubTag | undefined = await this.gh.latestTag();
Expand All @@ -150,7 +170,7 @@ export class JavaYoshi extends ReleasePR {
},
]
: await this.commits(latestTag ? latestTag.sha : undefined, 100, true);
const prSHA = commits[0].sha;
let prSHA = commits[0].sha;

const cc = new ConventionalCommits({
commits,
Expand All @@ -176,6 +196,7 @@ export class JavaYoshi extends ReleasePR {
// 2. they always update a patch with the -SNAPSHOT suffix.
// 3. they're haunted.
if (this.snapshot) {
prSHA = latestTag!.sha;
candidate.version = `${candidate.version}-SNAPSHOT`;
changelogEntry =
'### Updating meta-information for bleeding-edge SNAPSHOT release.';
Expand Down Expand Up @@ -255,6 +276,9 @@ export class JavaYoshi extends ReleasePR {
);
});

console.info(
`attempting to open PR latestTagSha = ${latestTag!.sha} prSha = ${prSHA}`
);
await this.openPR(
prSHA!,
`${changelogEntry}\n---\n`,
Expand Down

0 comments on commit 9e9acb0

Please sign in to comment.