"panic: runtime error: invalid memory address or nil pointer dereference" during local job execution

Summary

Running a job locally fails with a segfault. The problem does not occur in the pipeline. This problem currently blocks troubleshooting other problems in our pipeline as it crashes the job before it exits.

Steps to reproduce

  1. git clone https://github.com/dschuessler/gitlab-runner-bug-reproduction
  2. cd gitlab-runner-bug-reproduction
  3. Start Docker for Mac
  4. gitlab-runner exec docker e2e-test
.gitlab-ci.yml
stages:
  - test
 
e2e-test:
  stage: test
  image: cypress/browsers:chrome69
  tags:
    - docker
    - e2e
  script:
    - echo "test"
  artifacts:
    when: always
    paths:
      - client/web/e2e-test/cypress/videos/*.mp4
      - client/web/e2e-test/cypress/screenshots/**/*.png
    expire_in: 1 week
  

Actual behavior

The job crashes with a segfault.

Expected behavior

The job runs without a segfault.

Relevant logs and/or screenshots

Runtime platform                                    arch=amd64 os=darwin pid=32611 revision=003fe500 version=12.7.1
fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Running with gitlab-runner 12.7.1 (003fe500)
Using Docker executor with image cypress/browsers:chrome69 ...
Pulling docker image cypress/browsers:chrome69 ...
Using docker image sha256:1488d8e6b757444738cf03ddb0a7a90b3c3d86eec3edc3139592b40630826e58 for cypress/browsers:chrome69 ...
Running on runner--project-0-concurrent-0 via MacBook-Air...
Fetching changes...
Initialized empty Git repository in /builds/project-0/.git/
Created fresh repository.
From /path/to/repo
 * [new branch]      master     -> origin/master
Checking out 12907e11 as master...

Skipping Git submodules setup
$ echo "test"
test
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x19196db]

goroutine 39 [running]:
gitlab.com/gitlab-org/gitlab-runner/common.(*Build).executeUploadReferees(0xc00036d180, 0x25f6080, 0xc0002a0980, 0xbf861dfb93d47a20, 0x850b0e05, 0x3139660, 0xbf861dff63639200, 0x412a501d2, 0x3139660)
        /private/tmp/gitlab-runner-20200130-72861-v9mm2x/src/gitlab.com/gitlab-org/gitlab-runner/common/build.go:336 +0x35b
gitlab.com/gitlab-org/gitlab-runner/common.(*Build).executeScript(0xc00036d180, 0x25f6080, 0xc0002a0980, 0x26091e0, 0xc0003c8800, 0x0, 0x0)
        /private/tmp/gitlab-runner-20200130-72861-v9mm2x/src/gitlab.com/gitlab-org/gitlab-runner/common/build.go:297 +0x1fc
gitlab.com/gitlab-org/gitlab-runner/common.(*Build).run.func1(0xc0000ba6c0, 0xc00036d180, 0x25f6080, 0xc0002a0980, 0x26091e0, 0xc0003c8800)
        /private/tmp/gitlab-runner-20200130-72861-v9mm2x/src/gitlab.com/gitlab-org/gitlab-runner/common/build.go:401 +0x56
created by gitlab.com/gitlab-org/gitlab-runner/common.(*Build).run
        /private/tmp/gitlab-runner-20200130-72861-v9mm2x/src/gitlab.com/gitlab-org/gitlab-runner/common/build.go:400 +0x214

Environment description

Local machine

macOS 10.14.6

Docker Desktop 2.2.0.0 (42247)

Used GitLab Runner version

Version:      12.7.1
Git revision: 003fe500
Git branch:   12-7-stable
GO version:   go1.13.7
Built:        2020-01-30T08:53:31+00:00
OS/Arch:      darwin/amd64