-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to define cache ID explicitely #257
Comments
@realdadfish I was not aware that some env vars are resolved before being passed to the plugin. Are you using the pipeline step or the wrapper? |
I'm using the pipeline step. Again, I think the easiest would be to differentiate between cache path and cache identity. The cache path can be configured to be anything by the consumer, even some workspace-specific absolute path. The cache identity on the other hand should really be chosen explicitely and not be derived from something else implicitely. |
I see your point, but I am not sure why you consider that as a bug. You can use absolute paths but if they differ from agent to agent, then this is it the way the plugin works right now. Instead of passing a absolute path, you could just use a relative one, no? If you really need env vars you need to make sure that you are not evaluating them before passing the string to the plugin (e.g. instead of |
Well, it's undocumented that the plugin behaves this way. IMHO it should be documented that the identity of the cache is computed from the path and the name of the cache.
Am 10. Februar 2024 14:45:49 MEZ schrieb repolevedavaj ***@***.***>:
I see your point, but I am not sure why you consider that as a bug. You can use absolute paths but if they differ from agent to agent, then this is it the way the plugin works right now. Instead of passing a absolute path, you could just use a relative one, no?
If you really need env vars you need to make sure that you are not evaluating them before passing the string to the plugin (e.g. instead of `"$WORKSPACE/some-path"`, use `'$WORKSPACE/some-path'`). Before actually using the path, the plugin will evaluate all env vars, but this happens after generating the id.
--
Reply to this email directly or view it on GitHub:
#257 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
--
Thomas Keller - https://thomaskeller.biz
|
Yes, I agree. The way the caching is actually working is quite undocumented. |
Jenkins and plugins versions report
not applicable
What Operating System are you using (both controller, and any agents involved in the problem)?
not applicable
Reproduction steps
Expected Results
Cache identity should not be reliant on the path to the data that are stored, but just some unique, user-chosen identifier.
Actual Results
Cache identity is reliant on the path.
Anything else?
In
ArbitraryFileCache.java
the base name of the cache is generated as follows:Now, if one follows the documentation of the plugin stating
and configures this variable to be
$WORKSPACE/some-path
, the absolute, node-specific and even more problematic, job-specific path to the workspace is set topath
. This results in the problem that a fallback to a "default" cache can never succeed, as the new jobs / branches$WORKSPACE
of course resides somewhere else. The plugin then outputs this, even though there does exist a cache in the configured S3 bucket for the default branch:Are you interested in contributing a fix?
No response
The text was updated successfully, but these errors were encountered: