Gitlab Pages throw 404 when accessed

浪子不回头ぞ 提交于 2021-01-28 04:20:44

问题


I have a group project with the following name (hosted in Gitlab): gitlab.com/my-group/my-project.

I have generated coverage reports during testing and saved them as artifacts using Gitlab CI. Here is Gitlab CI config:

test:
  stage: test
  image: node:11
  before_script:
    - npm install -g yarn
    - yarn
  cache:
    paths:
      - node_modules/
  script:
    - yarn lint
    - yarn test --all --coverage src/
  except:
    - tags
  artifacts:
    paths:
      - coverage/
  coverage: '/Statements\s+\:\s+(\d+\.\d+)%/'

deploy-pages:
  stage: deploy
  dependencies:
    - test
  script:
    - mv coverage/ public/
  artifacts:
    paths:
      - public/
    expire_in: 30 days
  except:
    - tags

When I open deploy stage job, I can see the artifact being created. Here is the screenshot: . All the files are under /public directory in the artifact.

Now, when I go to: https://my-group.gitlab.io/my-project, I keep getting 404.

I am not sure what step I am missing here. Can someone shed some light on this issue for me?

Thanks!


回答1:


There are three basic requirements for the project itself:

  • project must be named group.gitlab.io (if you want it to be the base domain)
  • job must create artifact in public directory
  • job must be called pages

Most likely it's the last one that needs fixing since your job is currently called deploy-pages. Simply rename that to pages.

You'll know when you got everything working because under Settings > Pages, it will tell you the link where it's published to.



来源:https://stackoverflow.com/questions/58154069/gitlab-pages-throw-404-when-accessed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!