fix(backend): Caching - Make the cache key depend on output names and paths (#4675)

* Caching - Make the cache key depend on output names and paths

Output artifact/parameter names and paths are important and need to be considered.

* Fixed the test
This commit is contained in:
Alexey Volkov 2021-03-22 22:30:43 -07:00 committed by GitHub
parent c36efb2ca5
commit 5fbf2249fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -220,6 +220,7 @@ func generateCacheKeyFromTemplate(template string) (string, error) {
"volumeMounts": nil,
},
"inputs": nil,
"outputs": nil, // Output artifact/parameter names and paths are important and need to be considered. We can include the whole section since Argo does not seem to put the artifact s3 specifications here, leaving them in archiveLocation.
"volumes": nil,
"initContainers": nil,
"sidecars": nil,

View File

@ -205,9 +205,9 @@ func TestSetImage(t *testing.T) {
func TestMutatePodIfCachedWithTeamplateCleanup(t *testing.T) {
executionCache := &model.ExecutionCache{
ExecutionCacheKey: "f5fe913be7a4516ebfe1b5de29bcb35edd12ecc776b2f33f10ca19709ea3b2f0",
ExecutionCacheKey: "5a20e3f2e74863b363291953082d9812a58e25f7117bface1c76d40ef0ee88fc",
ExecutionOutput: "testOutput",
ExecutionTemplate: `Cache key was calculated from this: {"container":{"command":["echo", "Hello"],"image":"python:3.7"}}`,
ExecutionTemplate: `Cache key was calculated from this: {"container":{"command":["echo", "Hello"],"image":"python:3.7"},"outputs":"anything"}`,
MaxCacheStaleness: -1,
}
fakeClientManager.CacheStore().CreateExecutionCache(executionCache)