starting on stash
TRANSCRIPT
![Page 1: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/1.jpg)
![Page 2: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/2.jpg)
STEFAN KOHLER • CONSULTANT • 42 BV • @STEFANKOHLER
Starting on Stash
![Page 3: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/3.jpg)
Who am I
![Page 4: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/4.jpg)
• Atlassian Expert
• Add-on Developer and CodeGeist addict
• AUG Founder
• Author of Confluence book
Stefan Kohler
http://amzn.to/15xQIiT
![Page 5: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/5.jpg)
Notifyr
![Page 6: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/6.jpg)
Just text by itself, for impact.
![Page 7: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/7.jpg)
Badgr
![Page 8: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/8.jpg)
Just text by itself, for impact.
![Page 9: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/9.jpg)
The Idea
![Page 10: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/10.jpg)
Write down your ideas, to make them real and
make room for new ideas
![Page 11: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/11.jpg)
• Another add-on available?
• It is a requested feature?
• JIRA
• Answers
• Contact a Product Manager
Research your idea
![Page 12: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/12.jpg)
JIRA Votes
![Page 13: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/13.jpg)
Notifyr Idea
![Page 14: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/14.jpg)
Indexer
Events
Hooks
Getting Hooked
![Page 15: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/15.jpg)
Custom scripts that are executed when certain
actions occur.
HOOKS
![Page 16: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/16.jpg)
Repository Hooks
![Page 17: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/17.jpg)
• Pre-receive
• Asynchronous Post-receive
• Merge-checks
SECTION TITLE 1
Available HooksHOOKS
BLOCKING
BLOCKING
![Page 18: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/18.jpg)
SECTION TITLE 1HOOKS
<pre-receive-hook key="mySummitHook" name="Summit 2013 Pre-receive Hook" class="nl.stefankohler.stash.hook.MySummitHook">
<description> A pre-receive hook that will block all actions after the Summit Bash </description> </pre-receive-hook>
Pre receive hooka t l a s s i a n - p l u g i n . x m l
![Page 19: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/19.jpg)
SECTION TITLE 1HOOKS
public class MySummitHook implements PreReceiveHook { /** * Disables all actions after the Summit Bash. */ @Override public boolean onReceive(Repository repository, Collection<RefChange> refChanges, HookResponse hookResponse) { DateTime summitBash = new DateTime(2013, 10, 2, 19, 0); if (summitBash.isBeforeNow()) { hookResponse.err.println("Pushing is disabled " + "after the Summit Bash, don't drink & code!"); return false; } return true; }}
Pre receive hookM y S u m m i t H o o k . j a v a
![Page 20: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/20.jpg)
Indexer
Events
Hooks
Getting Hooked
![Page 21: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/21.jpg)
Events are triggered throughout Stash, just
listen for them!
EVENTS
![Page 22: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/22.jpg)
SECTION TITLE 1
Available EventsEVENTS
![Page 23: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/23.jpg)
Repository Push Eventa t l a s s i a n - p l u g i n . x m l
EVENTS
<component key="MySummitPushEvent" class="nl.stefankohler.stash.events.MySummitPushEvent"/>
![Page 24: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/24.jpg)
Repository Push EventM y S u m m i t P u s h E v e n t . j a v a
EVENTS
public class MySummitPushEvent {
@EventListener public void notifyTwitter( RepositoryPushEvent pushEvent) { twitterClient.tweet("A push was made to " + pushEvent.getRepository()) }
}
![Page 25: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/25.jpg)
Indexer
Events
Hooks
Getting Hooked
![Page 26: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/26.jpg)
Get in the Stash indexing pipeline to get data from, or add data to a commit
INDEXER
![Page 27: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/27.jpg)
INDEXER
![Page 28: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/28.jpg)
Don’t do expensive operations
Don’t handle the same changeset twice
Do consider memory usage
Do consider bulk processing
Do consider security
Dos & Don’tsINDEXER
![Page 29: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/29.jpg)
Changeset Indexera t l a s s i a n - p l u g i n . x m l
INDEXER
<changeset-indexer key="SummitIndexer" class="nl.stefankohler.stash.indexer.SummitIndexer"/>
![Page 30: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/30.jpg)
Changeset IndexerS u m m i t I n d e x e r . j a v a
INDEXER
public class SummitIndexer implements ChangesetIndexer { ... @Override public void onChangesetAdded( @Nonnull Changeset changeset, @Nonnull IndexingContext ctx) {
if (changeset.getMessage().contains("summit")) { ctx.put("duringSummit", true); }
} ...}
![Page 31: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/31.jpg)
Got Service?
![Page 32: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/32.jpg)
Services allow you to get and add data from and to
Stash
![Page 33: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/33.jpg)
Services
UserServ ice
His toryServ ice
Pro jec tServ ice
Users
Change h is tory
Pro jec t
Repos i toryServ icRepos i tory
![Page 34: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/34.jpg)
Serviceshttps://developer.atlassian.com/static/
javadoc/stash/latest/api
![Page 35: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/35.jpg)
Access to services
public class BadgrChangesetIndex implements ChangesetIndexer {
public BadgrChangesetIndex( HistoryService historyService, LoggingService loggingService) {
this.historyService = checkNotNull(historyService); ... }
}
![Page 36: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/36.jpg)
Look the part
![Page 37: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/37.jpg)
Atlassian Design Guidelines
![Page 38: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/38.jpg)
Soy is the best thing that happened to templates
![Page 39: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/39.jpg)
• One template for server and client side
• Separation between logic and display
• Reuse of widgets
• JavaScript
Soy
![Page 40: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/40.jpg)
AUI comes with Soy widgets!
![Page 41: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/41.jpg)
Next...
![Page 42: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/42.jpg)
Documentation and Examples
![Page 43: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/43.jpg)
Resources
#atlassiansummit
• http://developer.atlassian.com
• http://developer.atlassian.com/design
• https://developer.atlassian.com/stash/
• Use the source code for examples and reference
![Page 44: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/44.jpg)
Thank you!
STEFAN KOHLER • CONSULTANT • 42 BV • @STEFANKOHLER
![Page 45: Starting on Stash](https://reader034.vdocuments.us/reader034/viewer/2022052323/558de51b1a28ab07438b46a5/html5/thumbnails/45.jpg)
Text code below to 22333or visit http://bit.ly/19JRN5S
Starting on Stash
To join this session, send text 136888 to
AWESOME = 12
PRETTY GOOD = 11
NOT BAD = 10
MEH = Z
Rate this Talk