Per-repository Stash plugin configuration without hooks

Daniel Sobral July 16, 2013

To handle problems mentioned here and here, I wrote a plugin that listen on pull request events and then does a POST to a pre-defined URL. Since I'll need different URLs for each repository, I need to, somehow, create a per-repository configuration for my plugin.

That seems trivial enough to do if I were using a hook, but, unfortunately, no hook covers my use case.

How can I create configuration screens per-repository, and the retrieve these settings?

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
cofarrell
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.
July 17, 2013

Hi Daniel,

The best example to look at would be the following plugin:

https://bitbucket.org/atlassianlabs/stash-refchange-settings-plugin

You may also want to look at a few other UI examples here, although they don't store any settings. A list of all the Stash example plugins can be found here:

http://atlassian.bitbucket.org/#stash

Just in general most of this relies on general Atlassian plugin components, which has plenty of documention (ie you might have more lucking searching for JIRA/Confluence than just Stash).

Let me know if you get stuck or have any questions.

Charles

PS. We do have plans to make adding plugins that save general settings as streamlined as hooks, but we haven't had the time to make that possible.

Daniel Sobral July 17, 2013

Thanks. I have been using that plugin as reference -- and all the other resources you mentioned, in fact --, though it uses the old widget.aui library and the completely undocumented soy templates, plus a lot of completely undocumented APIs. It has not been an easy task at all, despite how close it comes that my needs.

I might also add that looking at that plugin and at this tutorial, one would be hard pressed to tell what they have in common, despite the fact that the tutorial is essentially teaching most of what the refchange plugin is doing.

And, as a final note, I could not find a single other plugin that stores state and is not a hook plugin. Having other plugins to compare against each other would have made the task easier.

0 votes
Daniel Szabo February 15, 2015

Hi Daniel,

Since then, did you manage to write this piece of plugin? I am facing with the same issue here, I want to write a simple plugin that listens to server events (so it is not a git hook) and configure settings per repository. I cannot find any useful information that I can start with, when I am new to stash plugin development. I cannot even find any documentation about these soy templates.

Thanks!

 

0 votes
Carl Myers
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.
August 22, 2013

For more code youc an look at that might be helpful, I have just open-sourced my stashbot plugin. It does per-repository configurations which are not done as hooks and persists them using active objects. Check out https://github.com/palantir/stashbot

TAGS
AUG Leaders

Atlassian Community Events