Skip to content

Latest commit

 

History

History
104 lines (73 loc) · 3.11 KB

asset-caching.md

File metadata and controls

104 lines (73 loc) · 3.11 KB
title description author ms.author ms.date ms.topic zone_pivot_group_filename zone_pivot_groups
Tutorial: Set up a vcpkg asset cache
Learn to set up a local asset cache to mirror download assets.
vicroms
viromer
01/10/2024
tutorial
zone-pivot-groups.json
shell-selections

Tutorial: Set up a vcpkg asset cache

All asset caches are configured through the X_VCPKG_ASSET_SOURCES environment variable. The value of X_VCPKG_ASSET_SOURCES follows a specific configuration syntax.

In this tutorial you'll learn how to:

[!div class="checklist"]

Prerequisites

  • A terminal
  • vcpkg

1 - Create an asset cache directory

You can use the Azure Blob Storage backend "x-azurl", to store assets. Alternatively, you can use a filesystem directories to store your download assets, including network locations. To do so, you need to use the file:// protocol in your asset cache URL.

In this tutorial, you'll create a local asset cache location to store downloaded artifacts. If you have an Azure DevOps Blob Storage you want to use instead, replace the URL and provide a SAS token as the second parameter in the configuration string.

  1. Create a directory to serve as an asset cache location (substitute with any locations of your choosing):

::: zone pivot="shell-powershell, shell-cmd"

mkdir D:\vcpkg\asset-cache

::: zone-end ::: zone pivot="shell-bash"

mkdir /home/vcpkg/asset-cache

::: zone-end

2 - Configure X_VCPKG_ASSET_SOURCES

Next set the value of X_VCPKG_ASSET_SOURCES as follows:

::: zone pivot="shell-powershell"

$env:X_VCPKG_ASSET_SOURCES="clear;x-azurl,file://D:/vcpkg/asset-cache,,readwrite"

::: zone-end ::: zone pivot="shell-cmd"

set X_VCPKG_ASSET_SOURCES="clear;x-azurl,file://D:/vcpkg/asset-cache,,readwrite"

::: zone-end

::: zone pivot="shell-cmd, shell-powershell" This X_VCPKG_ASSET_SOURCES configuration adds the following source strings:

  • clear, disables any previously configured asset cache
  • x-azurl,file://C:/vcpkg/asset-cache,,readwrite, sets a filesystem asset cache, located in D:\vcpkg\asset-cache, with read-write permissions. ::: zone-end

::: zone pivot="shell-bash"

export X_VCPKG_ASSET_SOURCES="clear;x-azurl,file:///home/vcpkg/asset-cache,,readwrite"

This X_VCPKG_ASSET_SOURCES configuration adds the following source strings:

  • clear, disables any previously configured asset cache
  • x-azurl,file:///home/vcpkg/asset-cache,,readwrite, sets a filesystem asset cache, located in home/vcpkg/asset-cache, with read-write permissions.

::: zone-end

Next steps

Here are other tasks to try next: