stash filesize hook plugin

Hi,

We are trying restrict commits that contain files over a certain size and found this resource: https://bitbucket.org/atlassianlabs/stash-filesize-hook-plugin

This is exactly what we need but unfortunately we do not know how to set this up. Unfortunately I'm a sysadmin and not a programmer so I'm not sure what I need to do with the source to get this setup to work properly with stash... any instrictions or direction would be greatly appreciated!

Thanks!

6 answers

Hi James,

I've uploaded a compiled jar to the Bitbucket repository for you:

https://bitbucket.org/atlassianlabs/stash-filesize-hook-plugin/downloads

You should be able to upload that on the plugins administration screen, and then the hook will be visible in the repository hook page which can be enabled per-repository (and a maximum size configured).

Let me know if you have any questions, although I do need to mention that this isn't an official plugin and as such we don't support it in our normal capacity.

Cheers,

Charles

Thank you so much Charles! We'll give it a shot, appreciate your help with this!

This plugin is wonderful, however it seems to have been broken by Stash 2.5. Changes in the API?

The configure screen gets stuck while I see that this AJAX request

https://my.server.com/stash/rest/api/latest/projects/TEST/repos/test/settings/hooks/com.atlassian.stash.stash-filesize-hook-plugin%3AfileSizeHook/settings

is returning "204 No Content".... Not what the plugin expects?

Hi Daniel,

The API around hooks shouldn't have changed at all in 2.5. Also, that request is generic across all hooks, so that would mean that everything else was broken too. Are you seeing an error in either your Stash logs (in the home directory), or an error in the Javascript (ie when you open your Chrome console)?

Charles

Hi Charles, thanks for the quick answer. What I am seeing is that when I either try to enable or configure the hook in a repo the configure screen stays stuck in the "turning wheel" symbol. The only HTTP request I see the one I mention, that returns a "204". However, the same request is done with Stash 2.4.1, where it returns 204 too but the configure screen does show up. BTW, I'm also having problems with the stash-editor-plugin and "Instant Edit for Stash" plugins in 2.5, so I guess something must have changed...

Hi Daniel,

That does't sound right. Again, is there anything in your Javascript console, or an error in the $STASH_HOME/log/atlassian-stash.log file? I can confirm that the hooks on our 2.5 production server are working as expected.

Charles

Ummm, I'm getting the same situation with the HipChat notification plugin, so it is surely not a problem with you plugin, sorry about that. I don't know, I just updated as usual and just as I started this started happening. As I said, also the edit in place plugins stopped working... strange. ps: I don't seem to be able to post a comment (nothing happens) so I have to post a new "answer".

Daniel,

Sorry, I can't help you without more information. I need the logs from your browser and/or Stash (see above). Lastly, have you tried to clear your browser cache? Does it happen to other users or just you?

Charles

Aha, there are two Javascript errors loading the "hooks" screen. No errors when clicking the button, but of course the error had already happened previously > TypeError: obj is undefined >https://foo.ecmwf.int/stash/s/d41d8cd98f00b204e9800998ecf8427e/en-1988229788/9e87d57/11/11/_/download/superbatch/js/batch.js > Line 584 > TypeError: loader is undefined > https://foo.ecmwf.int/stash/projects/TEST/repos/test/settings/hooks > Line 118
OK, finally found the problem. The ReadMe Parser plugin was interfering, generating the Javascript error and preventing the filesize plugin to work properly. Deactivated the ReadMe Parser and now it all works as usual. Sorry for the noise here.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 06, 2018 in Bitbucket

Do you use Bitbucket Cloud and Jira Cloud? If so, let us know!

Hi Community, I'm Julia and I'm on the Jira Software Cloud marketing team!  We're looking for companies or teams using Bitbucket Cloud and Jira Software Cloud. If your team fits the t...

109 views 6 3
Join discussion

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