Skip to content

Commit

Permalink
Move GitHub status check inside retry loop
Browse files Browse the repository at this point in the history
The download script will poll the CircleCI endpoint until the build job
is complete; it should also poll the GitHub status endpoint if the
build job hasn't been spawned yet.
  • Loading branch information
acdlite committed Feb 3, 2021
1 parent a85bff4 commit bffa377
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:
# branch. Once they do, replace with `merge-base HEAD origin/master`
command: |
git fetch origin master
echo "$(merge-base HEAD origin/master)"
echo "$(git merge-base HEAD origin/master)"
cd ./scripts/release && yarn && cd ../../
scripts/release/download-experimental-build.js --commit=6b8d4ca
mv ./build2 ./base-build
Expand Down
12 changes: 7 additions & 5 deletions scripts/release/get-build-id-for-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ async function getBuildIdForCommit(sha) {
if (status.state === 'failure') {
throw new Error(`Build job for commit failed: ${sha}`);
}
if (Date.now() < retryLimit) {
await wait(POLLING_INTERVAL);
continue retry;
}
throw new Error('Exceeded retry limit. Build job is still pending.');
}
}
if (state === 'pending') {
if (Date.now() < retryLimit) {
await wait(POLLING_INTERVAL);
continue retry;
}
throw new Error('Exceeded retry limit. Build job is still pending.');
}
throw new Error('Could not find build for commit: ' + sha);
}
}
Expand Down

0 comments on commit bffa377

Please sign in to comment.