Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2014

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

1 vote
Answer accepted
Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2014

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 ...

 

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2014

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.)

Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2014

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 ...

Svante Gustafsson Björkegren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2014

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!

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2014

@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.

0 votes
Mibex_Software
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2015

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

0 votes
Svante Gustafsson Björkegren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2014

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

 

 

Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2014

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...)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events