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

Clean broken entries from the Bazel cache #8668

Merged
merged 2 commits into from
Jan 28, 2021
Merged

Clean broken entries from the Bazel cache #8668

merged 2 commits into from
Jan 28, 2021

Conversation

cocreature
Copy link
Contributor

This is hopefully a somewhat reasonable workaround for the "output not
created" errors that keep annoying us.

For now, this is just part of the hourly cronjob but we could move it
somewhere else if desired.

changelog_begin
changelog_end

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@cocreature
Copy link
Contributor Author

@garyverhaegen-da do we have delete permissions on the gcp token? if not, we probably need a new token for this.

This is hopefully a somewhat reasonable workaround for the "output not
created" errors that keep annoying us.

For now, this is just part of the hourly cronjob but we could move it
somewhere else if desired.

changelog_begin
changelog_end
@cocreature
Copy link
Contributor Author

Obligatory note that while I tested this locally, I couldn’t test deletions.

Copy link
Contributor

@aherrmann-da aherrmann-da left a comment

Choose a reason for hiding this comment

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

Great work! Thanks for digging into this!

@garyverhaegen-da
Copy link
Contributor

@garyverhaegen-da do we have delete permissions on the gcp token? if not, we probably need a new token for this.

Yes, CI has full access to the bazel cache, because I was apparently not able to remove its delete permission.

azure-cron.yml Outdated
./bazel-bin/ci/cron/cron bazel-cache --age 90 --delete
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
Copy link
Contributor

Choose a reason for hiding this comment

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

These are not the keys you're looking for.

You want:

        env:
          GCRED: $(GOOGLE_APPLICATION_CREDENTIALS_CONTENT)

and you also need to replicate the logic from bash-lib, either in the Bash script here or in your Haskell code. (Or call Bash from Haskell, but some people find that messy.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Duh, I clearly should have taken a look at the credentials instead of blindly copying the docs cron. Thanks for catching it!

azure-cron.yml Outdated
# 90 minutes should provide enough overlap for an hourly
# cronjob.
./bazel-bin/ci/cron/cron bazel-cache --age 90 --delete
gcs ./bazel-bin/ci/cron/cron bazel-cache --age 90 --delete
Copy link
Contributor

Choose a reason for hiding this comment

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

As it stands this would end up running gsutil ./bazel-bin/ci/cron bazel-cache --age 90 --delete, but I like the idea. Perhaps it's worth changing bash-lib so that gcs really is the with-gcs-credentials type of wrapper you're going for here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I just realized that, I copied the logic for now instead of calling gcs. Do you want to align them in this PR or separately?

Copy link
Contributor

Choose a reason for hiding this comment

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

Separately is fine, I've made a note of it. I don't want to delay this.

changelog_begin
changelog_end
@mergify mergify bot merged commit c89e003 into main Jan 28, 2021
@mergify mergify bot deleted the clean-cache branch January 28, 2021 17:57
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.

3 participants