gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Copy branch configuration from the template

Open tomaswarynyca opened this issue 3 years ago • 13 comments

Description

Having a configuration for the main branch in a template should be copied when one creates a repository from that template. This was discussed at the time in #9126 but it was left abandoned, I create these issues to see if it can be reactivated because it is a functionality that is very useful to devops.

tomaswarynyca avatar Jan 11 '21 14:01 tomaswarynyca

are you sure that this is not already the case following #10803?

zeripath avatar Jan 12 '21 19:01 zeripath

I refer to the Branch Protection configuration. I have a template repository with x rules in the main branch, when I create a repository based on the template and copy the branch, the protection settings of that branch must be copied to the new repository.

tomaswarynyca avatar Jan 12 '21 19:01 tomaswarynyca

Hello! I am currently working on this (and I will re-open #9126, I forgot to keep the stalebot away 😓 )

One caveat is whitelisted users/teams, as those could be infeasible depending on who is using the template and what type of access they have compared to the template owner. For the initial version I don't think those will be carried over. Some fancy code could probably determine an intersection of valid values, but that's likely more complex than necessary. A follow-up could be made to add the intersection, if needed. 🙂

jolheiser avatar Jan 13 '21 16:01 jolheiser

You can read the template repositories, but maybe you have no permissions knows how the protected branches configured because this is a feature of owners of that repository.

@jolheiser I think this is a point we should be careful.

lunny avatar Jan 13 '21 16:01 lunny

Not all should be copied, but the main protected files, required approvals, status check, among others. Captura de pantalla_área-de-selección_20210113142343

tomaswarynyca avatar Jan 13 '21 17:01 tomaswarynyca

Hi, I saw that the pr was already made but was abandoned, it is a tool that I need at work, is it possible to implement it now?

tomaswarynyca avatar Jan 27 '21 03:01 tomaswarynyca

What makes you think #14334 is abandoned? 🤔

jolheiser avatar Jan 27 '21 04:01 jolheiser

What makes you think #14334 is abandoned?

The last commit was 13 days ago, I thought it was already finished As I had no news about the pr or issues I decided to send the message

tomaswarynyca avatar Jan 27 '21 13:01 tomaswarynyca

We are currently in a freeze to get 1.14 polished up, and the reference PR is slated for 1.15 as a result. It may take a while for it to get reviewed. 🙂

jolheiser avatar Jan 27 '21 20:01 jolheiser

When is it planned to release the final v1.14 to start with v1.15? I'm sorry if I'm pushing too hard, but I'm needing the function for several projects at work.

tomaswarynyca avatar Jan 29 '21 19:01 tomaswarynyca

Unfortunately it's very hard to pin down a day. We are entirely run by volunteer time, so the best we can do is a general timeframe.

The milestone for 1.14 is past due by 4 days (at time of this writing), however there will still need to be RCs prior to a stable release, etc.

If you are needing this sooner than later, I would suggest instead writing a script to copy branch protection from one repo to another in the interim. You can use the API to get branch protection from a repo, and then use the API to create branch protection for another repo.

jolheiser avatar Jan 29 '21 19:01 jolheiser

Ohh great I hadn't considered the option of using the API. So thanks for the functionality and I look forward to v1.15 to try it out.

tomaswarynyca avatar Jan 30 '21 03:01 tomaswarynyca

@tomaswarynyca have you created this script? I'm looking for the same functionality at my work.

ztrnr avatar Sep 12 '22 01:09 ztrnr

I just stumbled across this missing feature as well. Any update on getting branch protection policies to carry forward from a template?

GregJCook avatar Oct 26 '22 19:10 GregJCook

Is this still in the works? Just stumbled on this issue when creating a repo from my template and realising none of my branch protection rules had copied over

Calvin-Hill avatar Jan 11 '23 19:01 Calvin-Hill

Any news on this? same as @Calvin-Hill , found this while setting up a template

Barsay avatar Mar 06 '23 22:03 Barsay

Any further developments on this? Interested to get this setup...

w4dd325 avatar Jul 07 '23 16:07 w4dd325

this is a must have feature. I would like to copy master/main rule set from a repository to all other repositories

fuzunspm avatar Jul 10 '23 21:07 fuzunspm

Hello, This would be beneficial to our teams as well, looking forward to the implementation.

lmandon avatar Jul 18 '23 11:07 lmandon