Gitlab页面在访问时抛出404

时间:2019-09-29 09:44:40

标签: gitlab gitlab-ci gitlab-pages

我有一个名为以下项目的小组项目(托管在Gitlab中):gitlab.com/my-group/my-project。

我在测试过程中生成了覆盖率报告,并使用Gi​​tlab CI将其保存为工件。这是Gitlab CI配置:

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

当我打开部署阶段作业时,可以看到正在创建的工件。这是屏幕截图:Artifact file structure。所有文件都在工件的/ public目录下。

现在,当我转到https://my-group.gitlab.io/my-project时,我会不断收到404。

我不确定我在这里缺少什么步骤。有人可以帮我阐明一下这个问题吗?

谢谢!

1 个答案:

答案 0 :(得分:2)

项目本身有三个basic requirements

  • 项目必须命名为group.gitlab.io(如果您希望它成为基础域)
  • 工作必须在公共目录中创建工件
  • 职位必须称为pages

由于您的工作当前称为deploy-pages,因此很可能是最后一个需要修复的问题。只需将其重命名为pages

您会知道何时一切正常,因为在“设置”>“页面”下,它将告诉您链接发布到的链接。