Absolute paths within cache:key:files results in HTTP 500 error
Summary
We recently introduced a change wherein Gitaly will return an error if an absolute path is utilized for the LastCommitForPath
method. This method is utilized here when building caches for CI purposes.
If an absolute path is used for the cache:key:files
attribute, this will now result in an error on the backend. Builds will silently fail if triggered via a push, but if triggered manually via the UI a 500 error will be produced.
Steps to reproduce
Create a project and utilize the following .gitlab-ci.yml
. Attempting to run a pipeline manually will result in a "something went wrong" error.
cache:
- key:
files:
- /tmp/test.txt
job:
script:
- echo ""
What is the current bug behavior?
Attempting to run a pipeline with a CI config containing an absolute path within cache:key:files
attribute results in a 500 error.
What is the expected correct behavior?
We should either:
- Add this scenario to the linter and produce a warning when present.
- Account for absolute pathing with this specific feature.
Relevant logs and/or screenshots
https://sentry.gitlab.net/gitlab/gitlabcom/issues/4193218 (internal use)
GRPC::InvalidArgument
3:path is an absolute path. debug_error_string:{UNKNOWN:Error received from peer {grpc_message:"path is an absolute path", grpc_status:3, created_time:"2023-09-18T09:20:25.430633795+00:00"}}
Output of checks
This bug happens on GitLab.com
Possible fixes
Workaround;
Removing the leading "slash" from the path.
Possible solution;
on the Rails side, ignore the leading /
.