Fork me on GitHub
#circleci
<
2021-06-29
>
vemv11:06:02

I think I ran into a use case for which there's no syntax I want a restore_cache cache key that will last 24h. Rationale being, I don't want to spam an API provider with one request per build. But a permament cache wouldn't be useful either since the API's results can change over time. This is the section that describes the possible syntaxes:

vemv11:06:40

the Environment choice would almost cut it

vemv11:06:53

but it needs fiddling with contexts

borkdude11:06:57

perhaps you can use the current date as part of the key...?

vemv11:06:34

yes, that's what I'm seeking but circle's syntax seemingly doesn't allow to embed the output of an arbitrary command there

vemv11:06:49

a few things could work for me: * ability to use the output of arbitrary commands * allow vanilla env vars, not from contexts * add something akin to epoch, just not so fine-grained

conormcd11:06:02

The easiest way around that is to echo the output into a file and then use the checksum of that file.

👆 3
💡 2
vemv11:06:22

I gave it a think and it doesn't sound like it would work for my use case. I need to cache an internal cache dir (this API uses such a cache locally), not a result set. The API itself must be called in every run; caching results would be incorrect In any case I'd really appreciate the declarativeness of saying "dir foo should be cached for 1 day"

borkdude11:06:21

@vemv you can use multiple parts in a key so you could make the key based on dir foo + a file where you write the current date?

👀 2
vemv12:06:05

@borkdude that worked! and it's pretty thin. might have been what @conormcd suggested? Not sure if I was interpreting incorrectly what he said. Either way thank you both!

👍 2