Skip to content
  • Steve Xuereb's avatar
    Fix permissions of docker volumes created by Runner · 20c6b603
    Steve Xuereb authored
    By default when you mount a Docker volume to a container it gets the
    `755` permissions, meaning that anybody can read from it but users who
    aren't root, can't write to it. Before
    https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/1989 be
    used to run
    [cache-init](https://gitlab.com/gitlab-org/gitlab-runner/-/blob/25bde74c/commands/helpers/cache_init.go)
    on the directory before the volume was created, this is no longer the
    case. This breaks a lot of users script that used to write to the
    volumes that were mounted, and is a fairly big regression.
    
    Create a new pkg `permission` that handles updating permissions to the
    volumes that we create, and make it more explicit that we are updating
    the permissions of the volumes, as before it wasn't very clear that it
    was being done. The permissions is implemented both for Linux and
    Windows, currently the windows one is noop because the goal of this
    commit is to fix the regression we never supported this on Windows and
    will be tackled in
    https://gitlab.com/gitlab-org/gitlab-runner/-/issues/25480.
    
    Add an integration test so that we make sure we never have this issue
    anymore.
    
    closes https://gitlab.com/gitlab-org/gitlab-runner/-/issues/25440
    20c6b603