- Notifications
You must be signed in to change notification settings - Fork673
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Description of the problem, including code/CLI snippetI am trying to create projects in subgroups by a python script using AndSettings -> * Repository* - >Protected branches looks like this: The creation of the project is done by
As a result I get a new project. The result of a
However, the
I get
with my main problem being: Expected BehaviorI would expect the Actual BehaviorThe Specifications
Is this the desired behavior? If so, how can I protect the |
BetaWas this translation helpful?Give feedback.
All reactions
As I have never used a template before, are you sure that using a template means it will create a protected branch?
Well, from my understanding the created project should be a quasi-copy of the template source. Also, I would expect any newly created project to have a protected main branch.
As a workaround you can protect the branch after creating the project:https://python-gitlab.readthedocs.io/en/stable/gl_objects/protected_branches.html#examples
Thanks, I saw that already. Re-tried it and now I can protected the main branch after project creation with
mainbranch = project.protectedbranches.create({'name': project.default_branch,'merge_access_level': gitlab.const.AccessLevel…
Replies: 2 comments 3 replies
-
My first thought is that it is an upstream GitLab issue.
Upstream API document:https://docs.gitlab.com/ee/api/projects.html#create-a-project As I have never used a template before, are you sure that using a template means it will create a protected branch? As a workaround you can protect the branch after creating the project:https://python-gitlab.readthedocs.io/en/stable/gl_objects/protected_branches.html#examples |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Well, from my understanding the created project should be a quasi-copy of the template source. Also, I would expect any newly created project to have a protected main branch.
Thanks, I saw that already. Re-tried it and now I can protected the main branch after project creation with
|
BetaWas this translation helpful?Give feedback.
All reactions
-
@raedma I went ahead and converted this to a discussion. As far as automatically creating a protected branch on project creation. I don't see any mention of protected branches in the upstream documentation (https://docs.gitlab.com/ee/api/projects.html#create-a-project ) when using the "create project" API. It appears that GitLab requires it to be a two-step process. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thx for the remark. I was just under the impression that it would be logical that the default branch is protected to limit the chances of something unwanted happing. Also, this is the default behavior in case you create a project (plain or from template) via the GitLab instance homepage. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I believe this has something to do with deveopers being able to create projects and then not being able push to them (https://gitlab.com/gitlab-org/gitlab/-/issues/31602). So this might be expected behavior. |
BetaWas this translation helpful?Give feedback.
All reactions
This discussion was converted from issue #3037 on November 14, 2024 16:18.