Skip to content

Source project not cloned or gitlab-runner is confused about builds_dir

Summary

Brief: The shell executor either does not create the folder where the source is to be cloned OR attempts to change to the wrong folder.

Longer: I have a very simple .gitlab-ci.yml to build a LaTeX document using gitlab-runner configured to use the shell executor. The build fails as gitlab-runner attempts to change directory into <working-directory>/builds/<short-token>/<concurrent-id>/<namespace>/<project-name>, a folder that does not exist. If I check on the server, I note that <working-directory>/builds/<short-token>/<concurrent-id>/<namespace>/<project-name>.tmp exists.

Steps to reproduce

  1. Create a gitlab-runner instance configured to use the shell executor and with the tag latex.
  2. Create a .gitlab-ci.yml in a project with the following:
pdf:
  script:
  - pdflatex my-document
  artifacts:
    paths:
    - my-document.pdf
  tags:
    - latex

Actual behavior

Build fails with the following error message:

Running with gitlab-runner 11.9.0 (692ae235)
  on <my-host> <short-token>
Using Shell executor...
Running on <my-host>...
bash: line 70: cd: /home/gitlab-runner/builds/<short-token>/0/<my-project>: No such file or directory
ERROR: Job failed: exit status 1

Expected behavior

I would expect the /home/gitlab-runner/builds/<short-token>/0/<my-project> folder to be created, and the source project to be cloned in there. Instead, /home/gitlab-runner/builds/<short-token>/0/<my-project>.tmp does exist, with only a CI_SERVER_TLS_CA_FILE file in it.

Relevant logs and/or screenshots

In addition to the above, here is the gitlab-runner's log (slightly edited to remain anonymous):

Mar 27 11:16:13 <my-host> gitlab-runner[18991]: Checking for jobs... received                       job=12 repo_url=https://<my-host>/<my-project>.git runner=<short-token>
Mar 27 11:16:13 <my-host> su[30669]: (to gitlab-runner) root on none
Mar 27 11:16:13 <my-host> su[30669]: pam_unix(su:session): session opened for user gitlab-runner by (uid=0)
Mar 27 11:16:14 <my-host> su[30669]: pam_unix(su:session): session closed for user gitlab-runner
Mar 27 11:16:14 <my-host> gitlab-runner[18991]: WARNING: Job failed: exit status 1                  duration=259.968974ms job=12 project=29 runner=<short-token>
Mar 27 11:16:14 <my-host> gitlab-runner[18991]: ERROR: Failed to process runner                     builds=0 error=exit status 1 executor=shell runner=<short-token>

Environment description

This is an omnibus installation on a private server. I'm using the Debian packages from https://packages.gitlab.com/gitlab/gitlab-ce/debian/ jessie main and https://packages.gitlab.com/runner/gitlab-runner/debian/ jessie main.

Version 11.9.0 of both gitlab and gitlab-runner are installed.

Used GitLab Runner version

# gitlab-runner --version
Version:      11.9.0
Git revision: 692ae235
Git branch:   11-9-stable
GO version:   go1.8.7
Built:        2019-03-22T12:02:58+0000
OS/Arch:      linux/amd64
Edited by Pascal Giard