[Stash] Is there a way to set default values for repository settings?

Is it somehow possible to set default values for the repository settings for newly created repositories? (e.g. reject force push plugin enabled, pull requests require at least one approver and all tasks to be resolved)

Also, is there any way to bulk-apply settings to all existing repositories within a project?

3 answers

1 accepted

This widget could not be displayed.

No - it isn't (see https://jira.atlassian.com/browse/STASH-3597 or https://jira.atlassian.com/browse/STASH-3787 or https://jira.atlassian.com/browse/STASH-4323)

 

The only way to bulk-apply settings I know is by scripting the API or writing an own STASH-plugin ...

 

I am a bit confused now. Are you in the process of making this happen or not? Default settings on the server level and/or the project level would be very useful. The bulk-applying would also be great. We just upgraded Stash and I had to manually switch on the "Requires all tasks to be resolved" in about a hundred repos. Not very fun on the web interface. (If there is/were a central config file storing these settings, that would make life much easier.)

I wrote perl modules, implementing the needed API-functionality / REST-interface and a script to ensure certain repository settings. These scripts are for internal use only yet (containing some internals ...) and aren't in a state to be publishable - I have not any plans (nor permission) to publish this yet ...

Ours are in Ruby, but for the same reason I cannot publish them just yet. I will check if we can make these open source!

@Atlassian: Judging by the relatively elaborate workarounds posted here, I think this would be something to implement. ;) @Everybody else, thanks for the tips. So far it does not annoy me enough to write a script for it.

This widget could not be displayed.

Hi Balazs,

We have solved this with a cron-job running on the Stash server while waiting for STASH-3597 to be implemented.

The cron-job runs every 5 minutes and uses the REST API to

  • verify hook settings in each repository
  • if a hook has been disabled, it will be re-enabled
  • if a hook-config has changed it will be corrected
  • repo specific configs such as "Branch Strategy" settings is corrected
  • other plugin configurations (if possible by the plugin API)

It uses a structure where each project is defined and the various repo settings are specific per project. 

The main benefits are that we can centrally manage this and ensure repos are correct configured. Another great effect is that when a new repo is created in a project it takes just a few minutes and then it is automatically configured according to the project specification!

NOTE: if you have a lot of repos you may want to monitor this cron-job. It takes a while for it to execute when you scale it.

Hope this helped!

Cheers,

// Svante

 

 

We use a similar setup - unless we run our job manually. We mostly use this to ensure that "force push" is not accepted by STASH ... (miost of our user knew that force push is not a thing to do - but some might do it by accident - if it wouldn't be disabled from STASH-side...)

This widget could not be displayed.

Hi,

You might be interested in our new Stash plug-in Repository Templates for Stash which allows you to configure a repository as a template to copy all repository settings (hooks settings, pull request settings, permissions, ...) from this template over to newly created repositories (and to existing repositories as well).

Kind regards,
Michael

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,310 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you