artifacts owned by root make runner unable to delete extracted files

Summary

Our pipeline crosscompiles for target hardware on a docker runner and then tests the binaries on target hardware by passing artifacts. In the docker container the files are owned by root wheras on the target hardware (aarch64) we use the shell executor with a selfcompiled gitlab-runner 10.5.0~beta.362.gf6f376b7 started from a systemd script with ExecStart=/usr/bin/gitlab-runner "run" "--working-directory" "/home/gitlab-runner" "--config" "/etc/gitlab-runner/config.toml" "--service" "gitlab-runner" "--syslog" "--user" "gitlab-runner".

The runner on aarch64 can't delete the downloaded artifacts as they are owned by root in the archive.

Steps to reproduce

  • Create and upload artifacts owned by root
  • Use shell executor with unprivileged user to process these artifacts further

Actual behavior

The build directory is not properly cleaned when a new job is run: warning: failed to remove some/directory/from/artifacts

Expected behavior

The runner should be able to cleanup even though the artifacts are owned by root - perhaps it should chown them to the unprivileged user after extraction?

Relevant logs and/or screenshots

see above

Environment description

see above

Used GitLab Runner version

Version:      10.5.0~beta.362.gf6f376b7
Git revision: f6f376b7
Git branch:   master
GO version:   go1.10rc1
Built:        2018-02-02T11:33:58+00:00
OS/Arch:      linux/arm64