Commit 5e5419db authored by Alessio Caiazza's avatar Alessio Caiazza

Enable Gitlab-Pages for subgroups

GitLab Pages supports projects hosted under a subgroup, but not subgroup
websites. That means that only the highest-level group supports

i.e.:
You created a group for your engineering department called
`engineering`, a subgroup for all your documentation websites called
`docs`,and a project within this subgroup is called `workflows`.
Your project URL is `https://gitlab.com/engineering/docs/workflows/`.
Once you enable GitLab Pages for this project, the site will live under
`https://engineering.gitlab.io/docs/workflows`.
parent 94d05e3c
...@@ -1531,7 +1531,7 @@ class Project < ActiveRecord::Base ...@@ -1531,7 +1531,7 @@ class Project < ActiveRecord::Base
end end
def pages_available? def pages_available?
Gitlab.config.pages.enabled && !namespace.subgroup? Gitlab.config.pages.enabled
end end
def remove_private_deploy_keys def remove_private_deploy_keys
......
---
title: Pages for subgroups
merge_request: 23505
author:
type: added
...@@ -164,9 +164,11 @@ and you can choose the group of people to be notified. ...@@ -164,9 +164,11 @@ and you can choose the group of people to be notified.
Here's a list of what you can't do with subgroups: Here's a list of what you can't do with subgroups:
- [GitLab Pages](../../project/pages/index.md) are not currently working for - [GitLab Pages](../../project/pages/index.md) supports projects hosted under
projects hosted under a subgroup. That means that only projects hosted under a subgroup, but not subgroup websites.
the first parent group will work. That means that only the highest-level group supports
[group websites](../../project/pages/introduction.html#user-or-group-pages),
although you can have project websites under a subgroup.
- It is not possible to share a project with a group that's an ancestor of - It is not possible to share a project with a group that's an ancestor of
the group the project is in. That means you can only share as you walk down the group the project is in. That means you can only share as you walk down
the hierarchy. For example, `group/subgroup01/project` **cannot** be shared the hierarchy. For example, `group/subgroup01/project` **cannot** be shared
......
...@@ -85,6 +85,12 @@ and a project within this group is called `blog`. Your project ...@@ -85,6 +85,12 @@ and a project within this group is called `blog`. Your project
URL is `https://gitlab.com/websites/blog/`. Once you enable URL is `https://gitlab.com/websites/blog/`. Once you enable
GitLab Pages for this project, the site will live under GitLab Pages for this project, the site will live under
`https://websites.gitlab.io/blog/`. `https://websites.gitlab.io/blog/`.
- You created a group for your engineering department called `engineering`,
a subgroup for all your documentation websites called `docs`,
and a project within this subgroup is called `workflows`. Your project
URL is `https://gitlab.com/engineering/docs/workflows/`. Once you enable
GitLab Pages for this project, the site will live under
`https://engineering.gitlab.io/docs/workflows`.
#### User and Group Websites #### User and Group Websites
...@@ -98,8 +104,7 @@ Once you enable GitLab Pages for your project, ...@@ -98,8 +104,7 @@ Once you enable GitLab Pages for your project,
your website will be published under `https://websites.gitlab.io`. your website will be published under `https://websites.gitlab.io`.
>**Note:** >**Note:**
GitLab Pages [does **not** support subgroups](../../group/subgroups/index.md#limitations). Support for subgroup project's websites was introduced in GitLab 11.8.
You can only create the highest level group website.
**General example:** **General example:**
......
...@@ -38,6 +38,7 @@ be served on. ...@@ -38,6 +38,7 @@ be served on.
| Group pages | `groupname.example.io` | `http(s)://groupname.example.io` | | Group pages | `groupname.example.io` | `http(s)://groupname.example.io` |
| Project pages owned by a user | `projectname` | `http(s)://username.example.io/projectname` | | Project pages owned by a user | `projectname` | `http(s)://username.example.io/projectname` |
| Project pages owned by a group | `projectname` | `http(s)://groupname.example.io/projectname`| | Project pages owned by a group | `projectname` | `http(s)://groupname.example.io/projectname`|
| Project pages owned by a subgroup | `subgroup/projectname` | `http(s)://groupname.example.io/subgroup/projectname`|
> **Warning:** > **Warning:**
> There are some known [limitations](#limitations) regarding namespaces served > There are some known [limitations](#limitations) regarding namespaces served
...@@ -494,8 +495,8 @@ don't redirect HTTP to HTTPS. ...@@ -494,8 +495,8 @@ don't redirect HTTP to HTTPS.
[rfc]: https://tools.ietf.org/html/rfc2818#section-3.1 "HTTP Over TLS RFC" [rfc]: https://tools.ietf.org/html/rfc2818#section-3.1 "HTTP Over TLS RFC"
GitLab Pages [does **not** support subgroups](../../group/subgroups/index.md#limitations). GitLab Pages [does **not** support group websites for subgroups](../../group/subgroups/index.md#limitations).
You can only create the highest level group website. You can only create the highest-level group website.
## Redirects in GitLab Pages ## Redirects in GitLab Pages
......
...@@ -28,10 +28,10 @@ describe Projects::PagesController do ...@@ -28,10 +28,10 @@ describe Projects::PagesController do
let(:group) { create(:group, :nested) } let(:group) { create(:group, :nested) }
let(:project) { create(:project, namespace: group) } let(:project) { create(:project, namespace: group) }
it 'returns a 404 status code' do it 'returns a 200 status code' do
get :show, params: request_params get :show, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(200)
end end
end end
end end
......
...@@ -3087,7 +3087,7 @@ describe Project do ...@@ -3087,7 +3087,7 @@ describe Project do
context 'when the project is in a subgroup' do context 'when the project is in a subgroup' do
let(:group) { create(:group, :nested) } let(:group) { create(:group, :nested) }
it { is_expected.to be(false) } it { is_expected.to be(true) }
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment