sci-pants caching question (in CI). I think I am c...
# general
p
sci-pants caching question (in CI). I think I am caching the correct folders, but I it keeps downloading pants instead of using the local version, did directories change ? am I caching the wrong folders?
as an anecdote, this steps takes 38seconds... which as much as it takes to run the check and lint goals in some CI runs.... (since those are populated by the remote cache)
e
Keeps as in a re-run does it again? Or keeps as in ~frequentlyish? Each new scie-pants release (you apparently update to latest on every CI run), will invalidate
~/.cache/nce
If you pass
--version
to the script you could be pinning scie-pants and not suffering from the latter except when you choose to upgrade scie-pants deliberately.
If it's the former though, that sounds buggy and is unexpected.
p
so the cache key is based one the pants version (we basically read it from pants.toml and use that to generate the CI cache key)
e
I'm saying scie-pants has its own version
You're always yanking latest
That invalidates the cache / chooses a new subdir based on the sha256 of scie-pants itself.
p
because I am running the
pantsup.sh
right, so that causes the invalidation of pants itself ?
ok. so I can just not run this script if there is a binary in
~/bin
e
For a given latest version of scie-pants, when you invoke
pantsup.sh
without specifying a scie-pants version, that does this: + downloads latest scie-pants + forms a cache dir at
~/.cache/nce/<sha256 of the scie-pants binary>
+ looks under that last dir for a cached version of Pants X.Y.Z and installs it if missing
Thus, any scie-pants - not pants - bump, invalidates the cache.
You can run the script and pass
--version
- that would do it.
👍 1
It would keep scie-pants / its sha256 stable.
But, again, this all presumes frequentlyish vs on a re-run. Can you confirm which this is? Does a re-run miss the cache or no?
p
so if I ran pantsup.sh with the
--version
flag and the binary is already in the
~/bin
directory, I expect the script to be a no-op, but as far as I can tell... it downloads the
scie-pants
binary regardless....
is this the intended behavior ?
I don't see anywhere in the script something that checks if the launcher is already there (with the correct version) and avoids downloading it.
so I might need to still conditionally run the script....
e
I believe it's intended behavior. You might fix it though.
p
how would I check the version of the binary in
~/bin
? just running it w/ any flag just passes it to pants... so not sure how to detect check for a version of the binary itself.
in CI, I can probably get away w/ conditionally running the script, but it feels like a hack.