Commit a6132709 authored by Anton Akhmerov's avatar Anton Akhmerov

stop sharing and create projects within a subgroup (closes #4)

parent 2a4d4529
Pipeline #8540 passed with stages
in 44 seconds
......@@ -24,7 +24,7 @@ API_VERSION = 4
CI_API_TOKEN_SNIPPET = ('qt/skeleton', 'gitlab-api-token')
CI_API_TOKEN_VARIABLE = 'GITLAB_API_TOKEN'
SHARE_GROUP = 'qt'
PARENT_GROUP = 'qt'
MARKER_FILE = '.qt-research-project'
TEMPLATE_DIR = '.templates'
......@@ -73,12 +73,15 @@ def project_data_name():
def create_gitlab_project(client, name):
full_name = '/'.join((client.user.username, name))
full_name = '/'.join((PARENT_GROUP, client.user.username, name))
try:
group, = client.groups.get(PARENT_GROUP).subgroups.list(owned=True)
except Exception as e:
raise RuntimeError("You don't have an own subgroup!") from e
with status('creating project {} on {}'.format(full_name, GITLAB)):
project = client.projects.create(dict(name=name))
with status('giving master access to {} for group {}'
.format(full_name, SHARE_GROUP)):
project.share(client.groups.get(SHARE_GROUP).id, gitlab.MASTER_ACCESS)
project = client.projects.create(
dict(name=name, namespace_id=group.id)
)
with status('setting protected branch permissions'):
try:
project.protectedbranches.get('master').delete()
......
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