gitlab-cigitlab-cegitlab-pages

Gitlab pages always shows 404 error when opening artifacts


We use a self hosted gitlab ce (Omnibus-Installation on Ubuntu 22.04) for our project repository. The bundled nginx is disabled, because there are other services running that also use the webserver. nginx configuration is this one taken from gitlab recipes

Now I want to view the generated html reports from phpunit, sitespeed.io, pa11y-ci, etc. that are stored as artifacts without downloading them first. So I actived gitlab pages, but everytime I click on an html file in the artifacts browser I get the message, that I'm redirected to an external url and when I click on the link I'm getting a 404 error.

gitlab runs under git.domain.de, pages url is glp.domain.de

Displayed Artifacts-URL on pages looks like this: https://project.glp.domain.de/-/shop/-/jobs/5511/artifacts/tests/.phpunit-coverage/report/index.html

I've enabled gitlab pages in /etc/gitlab/gitlab.rb with access control and executed gitlab-ctl reconfigure without any errors. Pages are enabled in the settings for the project, the project is non-public.

These are all changes I made to the default gitlab configuration in gitlab.rb:

grep "^[^#;]" gitlab.rb
external_url 'https://git.domain.de'
gitlab_rails['time_zone'] = 'Europe/Berlin'
gitlab_rails['trusted_proxies'] = ['111.222.333.444', '127.0.0.1']
web_server['external_users'] = ['www-data']
nginx['enable'] = false
pages_external_url "https://glp.domain.de/"
gitlab_pages['enable'] = true
gitlab_pages['access_control'] = true
alertmanager['flags'] = {
  'cluster.advertise-address' => "127.0.0.1:9093",
}

The phpunit-job looks like this:

phpunit:
    stage: test
    only:
        - branches
    script:
        - docker exec web ci/run-phpunit.sh
        - grep -o -a -m 1 -h -E "[0-9]+\.[0-9]+% covered" tests/.phpunit-coverage/report/index.html

    coverage: '/^\s*\d+.\d+\% covered/'
    artifacts:
        when: always
        paths:
            - tests/.phpunit-coverage/
        expire_in: 1 week

We only want to browse the artifacts report, do I nevertheless have to insert a pages stage / job for displaying artifacts via pages?

I've activated verbose logging for pages: gitlab_pages['log_verbose'] = true but no useful messages show up

Currently I'm running out of ideas, what could be wrong in my setup, so any help would be appreciated.


Solution

  • Solution: I missed to copy the gitlab-pages configuration file from gitlab to nginx. After I copied /var/opt/gitlab/nginx/conf/gitlab-pages.conf there, adapted it to our needs and activated it, everything now works as expected.