Skip to content

Correctly use volume driver for all volumes

Mitar requested to merge mitar/gitlab-runner:volume-driver into main

What does this MR do?

It seems volume driver is not used for build and cache volumes at all. The reason is that it is configured only on the container, but build and cache volumes are added independently from the container.

Why was this MR needed?

I was unable to use a custom volume driver. I was getting the following error:

ERROR: Job failed (system failure): prepare environment: Error response from daemon: create runner-myekspesu-project-53842776-concurrent-0-f53ba868f2f8ba07-cache-c33bcaa1fd2c77edfc3893b41966cea8: driver 'local' already has volume 'runner-myekspesu-project-53842776-concurrent-0-f53ba868f2f8ba07-cache-c33bcaa1fd2c77edfc3893b41966cea8': volume name must be unique (docker.go:613:0s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

Notice that it takes about local driver, despite me setting a custom volume driver for the runner.

What's the best way to test this MR?

Configure any custom volume driver using volume-driver option for the runner. Try to run a job.

What are the relevant issue numbers?

!3620 (merged) added volume driver options in a similar way. I have improved !3620 (merged) slightly as part of this MR as well because there is no need to pass volume driver options through function arguments as they are available on the manager itself.

!365 (merged) added support for volume driver but it looks there are no tests for that. So this feature regressed through time it seems.

Merge request reports