Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip writing to the remote cache without API key #276

Merged
merged 3 commits into from
Nov 7, 2022

Conversation

avdv
Copy link
Member

@avdv avdv commented Nov 7, 2022

For foreign PRs (e.g. dependabot) access to the repository secrets is not permitted, so the API key for Buildbuddy ends up as empty.

This leads to an error later:

WARNING: BES was not properly closed
ERROR: The Build Event Protocol upload failed: Not retrying publishBuildEvents, no more attempts left: status='Status{code=UNAUTHENTICATED, description=failed to parse API key: missing API Key, cause=null}' UNAUTHENTICATED: UNAUTHENTICATED: failed to parse API key: missing API Key UNAUTHENTICATED: UNAUTHENTICATED: failed to parse API key: missing API Key

This PR is a simpler alternative to the approach taken in #248: instead of artificially drawing a line between pull_request and push events this change will just not try to write to the remote cache if the API key is not set (for whatever reason).

Update: I just noticed that dependabot actually does create a branch in this repository, which triggers a push. But still, it has no access to the repository secrets. So the approach in #248 would not fix this, IMO.

Fixes #243

For foreign PRs (e.g. dependabot) access to the repository secrets is not
permitted, so the API key for Buildbuddy ends up as empty.

This leads to an error later:
```
WARNING: BES was not properly closed
ERROR: The Build Event Protocol upload failed: Not retrying publishBuildEvents, no more attempts left: status='Status{code=UNAUTHENTICATED, description=failed to parse API key: missing API Key, cause=null}' UNAUTHENTICATED: UNAUTHENTICATED: failed to parse API key: missing API Key UNAUTHENTICATED: UNAUTHENTICATED: failed to parse API key: missing API Key
```
Make the workflow get triggered either by pushes to the default branch, by
pull requests targeting the default branch, or by manually triggering it from
Github's UI.
@avdv avdv changed the title Skip writing to the remote cache with no API key Skip writing to the remote cache without API key Nov 7, 2022
@avdv avdv requested a review from bryanhonof November 7, 2022 13:01
Copy link
Contributor

@bryanhonof bryanhonof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Could we perhaps also make this a successor to #248? I believe I've overengineered that one. 😅

@avdv avdv added the merge-queue merge on green CI label Nov 7, 2022
@avdv avdv mentioned this pull request Nov 7, 2022
@mergify mergify bot merged commit e2cdd08 into master Nov 7, 2022
@mergify mergify bot deleted the ci-build-buddy-readonly branch November 7, 2022 15:07
@mergify mergify bot removed the merge-queue merge on green CI label Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable CI runs on external PRs
2 participants