What causes the GitLab Pages step `pages:deploy` to fail in CI/CD, and how can I debug it?

Here’s my CI/CD config for GitLab pages, running on GitLab.com:

image: nixos/nix:latest

variables:
  GIT_SUBMODULE_STRATEGY: recursive

pages:
  stage: deploy
  cache:
    paths:
      - dist-newstyle
  script:
    - nix-shell --run shake
  artifacts:
    paths:
      - dist
  only: 
    - master

It completes successfully, and saves build artifacts to /dist. Yet the following step, pages:deploy, fails, and is retried five more times, each time failing again.

From what I can tell, there are no logs for pages:deploy, which is marked as external.

I expect this to pass, but it fails.

I’ve looked through the Troubleshooting CI/CD and can’t find anything relevant to this issue.

This is on the private repo lilielbe_WebDevel, if that helps anyone. It’s just a static website which uses the Haskell build tool Shake to create a directory of HTML pages.

Hi @JonathanReeve

GitLab pages only looks for files in a directory called public. If you change your config to:

pages:
  stage: deploy
  cache:
    paths:
      - dist-newstyle
  script:
    - nix-shell --run shake
    - mv dist public
  artifacts:
    paths:
      - public
  only: 
    - master

or similar, then I think you’ve got a good chance of this working!

Regards,

Sarah

running gitlab 14.4 I observe the same behavior with artifact’s well stored in public so I don’t understand…

I have similar issue,
my deployment used to work.

now it passes “pages” and fails “pages:deploy”
The content is larger now, I just added about 50 “.md” files, describing some tables in a DB.
are there a size limitation? if so, how can I see and adjust those?

I did not change the “.gitlab-ci.yml” file, it is:

default:
  image: python:3.8-buster
  before_script:
    - pip3.8 install -r requirements.txt
  tags:
    - mkdocs

test:
  stage: test
  script:
    - mkdocs build --strict --verbose --site-dir test
  artifacts:
    paths:
      - test
  except:
    - master

pages:
  stage: deploy
  script:
    - mkdocs build --strict --verbose
  artifacts:
    paths:
      - public
  only:
    - master

Any thought? ideas how to solve this ?
thanks

mkdocs doesn’t build into the public by default, it uses site. You either need to add mv site public in your final pages job, or you need to run mkdocs with mkdocs -d public.

I think that the mkdocs.yml specify the site location
Also, it did work fine till yesterday.

Did you mean to replace: - mkdocs build --strict --verbose
with - mkdocs build --strict --verbose -d public in the .gitlab-ci.yml pages section ? tried it, It does not appear to solve the issue

mkdocs.yml:

site_name: "Feature Data Store"
site_url: http://....
site_dir: public

theme:
  name: "material"
  palette:
    primery: purple
    accent: teal
  features:
    - search.suggest
    - search.highlight
    - navigation.top
    - toc.integrate
    - navigation.tabs
  hljs_languages:
      - yaml
      - python
      - sql
      - cypher
      - json
      - java
      - gcode
      - groovy
      - tex
      - pgsql
      - r
      - scala

plugins:
  - search:
      separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;'
  - mkdocstrings

markdown_extensions:
  - admonition
  - attr_list
  - def_list
  - tables
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tasklist:
      clickable_checkbox: true

I believe it was a number of documents…
I remove a folder with many .md files, and this solved the issue

1 Like

I’m glad you fixed it, but that does sound surprising. How many documents did you have?

there were quit many documents, 364, a description of tables in a data-lake DB, one doc for each table

1 Like