From 25ae1f7f7233deeefe793028552cb22f85b71d86 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 19 Aug 2021 14:41:02 -0400 Subject: CI: Include a timestamp in the Azure ccache key Caches on Azure are immutable - so if a cache changes, but its key does not, then the cache is not updated. Include a timestamp in the ccache key so that we always push an updated cache from the master branch. Then use a subkey without the timestamp to pull the cache. We use a similar trick on GitHub Actions. --- Meta/Azure/Caches.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Meta/Azure') diff --git a/Meta/Azure/Caches.yml b/Meta/Azure/Caches.yml index 5ecfe58d68..99a9b1aa27 100644 --- a/Meta/Azure/Caches.yml +++ b/Meta/Azure/Caches.yml @@ -6,6 +6,10 @@ parameters: ccache_version: 1 # Increment this number if CI has trouble with ccache. steps: + - script: | + echo "##vso[task.setvariable variable=timestamp]$(date -u +"%Y%m%d%H%M_%S")" + displayName: 'Stamps' + - ${{ if ne(parameters.arch, 'Lagom') }}: - ${{ if eq(parameters.toolchain, 'clang') }}: - task: Cache@2 @@ -22,7 +26,9 @@ steps: - task: Cache@2 inputs: - key: '"ccache" | "${{ parameters.os }}" | "${{ parameters.arch }}" | "${{ parameters.toolchain }}" | "${{ parameters.ccache_version }}"' + key: '"ccache" | "${{ parameters.os }}" | "${{ parameters.arch }}" | "${{ parameters.toolchain }}" | "${{ parameters.ccache_version }}" | "$(timestamp)"' + restoreKeys: | + "ccache" | "${{ parameters.os }}" | "${{ parameters.arch }}" | "${{ parameters.toolchain }}" | "${{ parameters.ccache_version }}" path: $(CCACHE_DIR) displayName: 'Compiler Cache' -- cgit v1.2.3