Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create non existent branches #20

Closed
twhiston opened this issue Nov 29, 2017 · 7 comments
Closed

Create non existent branches #20

twhiston opened this issue Nov 29, 2017 · 7 comments

Comments

@twhiston
Copy link

Does it make sense to add the ability to create branches in the tool?

I ask because we want to use it to keep our repo settings in line as people create repos in our namesapce, therefore the ideal flow would be:

repo created > hook fired > gitlabform run > master branch is created and branch protection enabled.

@gdubicki
Copy link
Member

gdubicki commented Dec 6, 2017

Hi @twhiston , sorry for a late reply!

I'll take a look at how much work would this require and get back to you.

We are of course open to getting PR with this too. Just let me know if you want to work on this so that we don't duplicate our efforts. :)

@twhiston
Copy link
Author

Hi @gdubicki , thanks very much for the response, not sure that i have the bandwidth to work on this myself atm (sorry i know that sucks!), but if no one else has time in the New Year I might try to jump on it. If you do make an assessment of the effort required please do share it on here. The easiest way to deal with it manually is to commit some dummy file content with the api so that the branch can be created (a generic readme in this case), so that is how we are working around it currently before calling gitlabform to apply the settings that we need.

Thanks for an awesome tool!

@gdubicki gdubicki changed the title create non existant branches Create non existant branches Sep 21, 2018
@gdubicki gdubicki changed the title Create non existant branches Create non existent branches Sep 21, 2018
@lukasmrtvy
Copy link

Should be possible via https://docs.gitlab.com/ee/api/branches.html#create-repository-branch api endpoint, would be nice to implement this in gitlabform.

@amimas
Copy link
Collaborator

amimas commented Jul 25, 2023

I know it's an old post. Thought I'd leave my feedback on this feature request.

Do you still see a need for this feature @twhiston , @lukasmrtvy ?

I ask because we want to use it to keep our repo settings in line as people create repos in our namesapce, therefore the ideal flow would be:

repo created > hook fired > gitlabform run > master branch is created and branch protection enabled.

In my view, the above workflow doesn't make quite make sense. I assume people are creating repos in your namespace using Gitlab UI. I believe the default branch (i.e. main) is automatically created by GitLab and is also protected. So, I don't see why gitlabform would "create the protected" branch; unless your users are creating new repos using the option to not initialize the repo, which I imagine probably isn't the case.

There are also other feature request that seems to indicate if a branch doesn't exist, corresponding protection setting shouldn't be configured. Potentially these are conflicting requirement.

I'd probably tweak your workflow a bit differently. I used something like this:

  • Created a GitLab pipeline in a project that takes necessary input variable (i.e. project name, group id)
  • Users run this pipeline to create new project instead of doing it via GitLab UI
  • In this pipeline, project is created via GitLab's API
  • In the same pipeline, gitlabform runs after the project is created, which applies default config from the group level settings

Thoughts?

@twhiston
Copy link
Author

I don't work as an engineer any more, so I have no stake in this feature now I'm afraid.

@amimas
Copy link
Collaborator

amimas commented Oct 3, 2023

@gdubicki - should we close this issue since there aren't any activity and not many are looking for this feature.

@gdubicki
Copy link
Member

gdubicki commented Oct 3, 2023

Closing, but if anyone wants to actually implement this and discuss it first then please reopen!

@gdubicki gdubicki closed this as completed Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants