Latexmk: command not found with Gitalb CI

Viewed 191

I am trying to make a repository in Gitlab with a CI that automatically compiles a .tex file to a PDF.

Using the Gtilab Template for LaTeX (https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/gitlab/ci/templates/LaTeX.gitlab-ci.yml) therefore my .gtilab-ci.yml looks as follows.

variables:
 
  LATEX_IMAGE: listx/texlive:2020

build:
  image: $LATEX_IMAGE
  script:
    - latexmk -pdf

  artifacts:
    paths:
      - "main.pdf"

Also in my main repository there is a main.tex obviously.

On committing a change the job starts as assumed, but it fails while trying to execute the script. I attach the log for reference here:

Running with gitlab-runner 14.5.1 (de104fcd)
  on selenium
Preparing the "shell" executor 00:00
Using Shell executor...
Preparing environment 00:00
Running on selenium...
Getting source from Git repository 00:00
Fetching changes with git depth set to 50...
Bestehendes Git-Repository in /some/anonymised/path neuinitialisiert
Checking out 4f46c62b as feature-setup...
Skipping Git submodules setup
Executing "step_script" stage of the job script 00:00
$ latexmk -pdf
bash: Zeile 120: latexmk: Kommando nicht gefunden.
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit status 1

I am fairly new to the CI/CD implementation with Gitlab in general. So I am unsure what to further debug and where the problem may be.

Thanks in advance!

1 Answers

The job is using the GitLab shell executor (from the log: Preparing the "shell" executor 00:00) which would run the script commands on the local machine rather than in the Docker container specified.

Some solutions would be to:

  • Install the GitLab docker runner on your host (preferable option), or
  • Install texlive onto the local machine running the gitlab-runner
Related