dry-orange-3870
04/17/2025, 9:48 PM- uses: tespkg/actions-cache@v1
env:
AWS_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: ${{ inputs.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws_secret_access_key }}
with:
bucket: my-bucket
use-fallback: false
key: ${{ hashFiles('locks/*.lock.jsonc') }}
# cache directories based on the docs here: <https://www.pantsbuild.org/prerelease/docs/using-pants/using-pants-in-ci#directories-to-cache>
path: |
~/.cache/nce
~/.cache/pants/named_caches
~/.cache/pants/lmdb_store
# <https://github.com/pantsbuild/actions/tree/main/init-pants/>
- uses: pantsbuild/actions/init-pants@v10
There's a couple issues here:
1. The init-pants action is still going to use the GitHub cache to cache some things (thereby making this hard to test)
2. The tespkg/actions-cache wrote something to S3 bucket after an initial run of this. But on a subsequent run (where I changed a test file to trigger the test to run), it built the PEX from scratch and ran the test, but afterwards, didn't upload anything back to the bucket. This makes me think something about the paths I'm providing is wrong.
Does anyone have any suggestions?fierce-truck-19259
04/17/2025, 10:28 PMdry-orange-3870
04/18/2025, 3:24 PMdry-orange-3870
04/18/2025, 3:28 PMelegant-florist-94385
04/21/2025, 11:23 AMbazel-remote-cache on your own infra (somewhere that your github runners can communicate to). You'll supply your own backing storage to it, since its just a frontend. (It can just use its local filesystem as the storage, but then it gets lost if you need to restart the container or something).
You can do a trial run of this by simply running bazel-remote-cache locally using docker on your own system, and then setting your local dev checkout of your repo to have pants do "remote caching" where the url is localhost:<whatever-port>fierce-truck-19259
04/22/2025, 5:12 PMWould we run bazel-remote inside of our github action, or would I need to spin it up as a service on our own infra?You would host bazel-remote on your infra but with a storage backend like S3
dry-orange-3870
04/22/2025, 5:55 PMelegant-florist-94385
04/22/2025, 6:05 PMfierce-truck-19259
04/22/2025, 6:06 PMLooks like Bazel supports just using GCS directly without any additional infra. Does Pants support this as well?Yes pants support REAPI, so the bazel-remote backend support is unrelated to pants, and yes it support AWS, GCS etc out of the box
fierce-truck-19259
04/22/2025, 6:10 PMso it might just work out of the box. Its probably something that hasn't been tested beforeWe are running exactly that, so it has, if you host a bazel-remote with a gcs backend it will work. However, you might want to calculate if your should run your github runners in-infra as well because of the egress/ingress cost of cache communication from githubs own runners. We host our own github-runners to have near-cache as well.
fierce-truck-19259
04/22/2025, 6:18 PMdry-orange-3870
04/22/2025, 6:24 PMfierce-truck-19259
04/22/2025, 6:27 PMfierce-truck-19259
04/22/2025, 6:28 PMfierce-truck-19259
04/22/2025, 6:29 PMfierce-truck-19259
04/22/2025, 6:29 PMfierce-truck-19259
04/22/2025, 6:36 PMdry-orange-3870
04/23/2025, 2:51 PMbazel-remote into the GitHub action runner. It's a pre-built binary, so it takes less than ten seconds to download the binary and start bazel-remote . We're using S3 as the backing data store currently
⢠The cache hit experience is much improved now. However, for situations where we run a large number of tests, we end up spending a decent chunk of time waiting for bazel-remote to download the results from S3.
⢠Long term, we're going to set up bazel-remote on our own infra as a long running service so it can cache things to disk instead of hitting S3 all of the time
⢠Longer term, we're going to move the GitHub action runners into our own infra for a variety of reasonsdry-orange-3870
04/23/2025, 2:51 PMWe host our own github-runners to have near-cache as well.@fierce-truck-19259 What are you using to pull this off? Seems like there's a few different options available
fierce-truck-19259
04/23/2025, 2:53 PM@fierce-truck-19259 What are you using to pull this off? Seems like there's a few different options availableHost runners on the infra https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners Host bazel-remote on the same infra Use a backing store for bazel-remote that is also on that same infra
fierce-truck-19259
04/23/2025, 2:58 PMfierce-truck-19259
04/23/2025, 3:01 PM