Support output variables for cache intelligence steps
under review
P
Psychological Firefly
Followup for support ticket: https://support.harness.io/hc/en-us/requests/83311
I'd like to be able to write conditional execution/control execution based on the status of the cache intelligence step. I cannot use expressions for these steps because their identifiers have hyphens in them.
Log In
N
Nofar Bluestein
marked this post as
under review
P
Psychological Firefly
Hey there,
Yes the primary use case here is to detect if there was a cache hit/miss, as well as what the source path is for the cache. Here's a code snippet that demonstrates the use case:
cache_hit="<+stage.spec.execution.steps.restore-cache-harness.status>"
echo "$cache_hit"
if [ "$cache_hit" == "Failure" ]; then
ensure cache path is clear if cache is missed
cache_path="<+stage.spec.execution.steps.restore-cache-harness.spec.sourcePaths>"
echo "cleaning cache path on cache miss $cache_path"
rm -rf "$cache_path"
fi
the tool I'm caching isn't exactly the cleanest with its cache usage, so trying to ensure it starts with a clean slate if cache intelligence didn't hit.
Thanks
Will
N
Nofar Bluestein
marked this post as
pending feedback
N
Nofar Bluestein
Hey Will,
Can you please explain the use case for needed the status of cache intelligence restore step? Are you trying to understand if there was a cache hit/miss? Do you need to know only whether is was successful or not, or do you need any specific information about what was restored?
Thank you ,
Nofar
N
Nofar Bluestein
marked this post as
next fiscal quarter