Vcpkg Asset Cache
Cache all vcpkg assets (sources) in a single place to improve build reliability. Don't let some unreliable mirror service interrupt development or CI work.
Logo by DALL-E
This tool uses the Vcpkg asset cache feature (experimental) and attempts to download all assets for a given point in time of Vcpkg.
Fork the repo and run the tool yourself to populate a cache for your own projects.
Why do this?
If your project depends on multiple hosts for its source code assets then the probability that you can successfully download your assets is the product of the hosts' reliability (success probability decreases with each host you add). Caching all files in a single, more reliable host can increase your chances of a successful build.
Consider 3 hosts:
Host | Reliability | Expected Days Downtime per Year |
---|---|---|
A | 99% | 3.65 |
B | 98% | 7.3 |
C | 99.9% | 0.365 |
A project that depends on hosts A, B, and C can expect up to 11.2 days of downtime per year. If you could cache all assets on a host that had 99.99% uptime then the project can expect 0.0365 days of build downtime per year.
How to use
Central Hosting
I'm currently experimenting with hosting caches in an Azure Storage account that is publicly accessible. If it becomes too popular I might need help with hosting.
Set the following variables in your development/CI environment to start using the read-only public cache immediately:
bash:
export X_VCPKG_ASSET_SOURCES="x-azurl,https://djurekvcpkgcachebuilder.blob.core.windows.net/vcpkg-assets,,read"
pwsh:
$env:X_VCPKG_ASSET_SOURCES="x-azurl,https://djurekvcpkgcachebuilder.blob.core.windows.net/vcpkg-assets,,read"
When you run vcpkg install
with this environment variable set, vcpkg will
attempt to download source assets from the blob storage account.
Fork and run it yourself
- Fork the repo
- Set up Azure Resources
- Create a storage account with a blob container named
vcpkg-assets
- Create an AAD App
- Setup OIDC for GitHub and Azure
- Assign the
Storage Blob Data Contributor
role to the AAD app in the storage account
- Create a storage account with a blob container named
- Set up GitHub Actions in the repo:
- Create an environment named
build-cache
in the environment... - Create secrets using AAD app info:
AZURE_CLIENT_ID
,AZURE_TENANT_ID
,AZURE_SUBSCRIPTION_ID
- Create variable:
STORAGE_ACCOUNT_NAME
with the value of the storage account created in previous steps (e.g.myvcpkgcache
, leaveblob.core.windows.net
off)
- Create an environment named
- Run the manual
Populate
GitHub Actions Workflow (it'll take a long time)
Contribute
Check out issues, assign yourself and open a Pull Request. Issues are vague so comment if any questions come up.
Support
This tool is provided as-is with no support. This is a personal project and not a Microsoft-supported tool. There is no warranty or SLA. Use at your own risk.
License
See LICENSE