Date post: | 27-Jun-2015 |
Category: |
Technology |
Upload: | colleenfry |
View: | 264 times |
Download: | 0 times |
STEFAN KOHLER • CONSULTANT • 42 BV • @STEFANKOHLER
Starting on Stash
Who am I
• Atlassian Expert
• Add-on Developer and CodeGeist addict
• AUG Founder
• Author of Confluence book
Stefan Kohler
http://amzn.to/15xQIiT
Notifyr
Just text by itself, for impact.
Badgr
Just text by itself, for impact.
The Idea
Write down your ideas, to make them real and
make room for new ideas
• Another add-on available?
• It is a requested feature?
• JIRA
• Answers
• Contact a Product Manager
Research your idea
JIRA Votes
Notifyr Idea
Indexer
Events
Hooks
Getting Hooked
Custom scripts that are executed when certain
actions occur.
HOOKS
Repository Hooks
• Pre-receive
• Asynchronous Post-receive
• Merge-checks
SECTION TITLE 1
Available HooksHOOKS
BLOCKING
BLOCKING
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
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
Indexer
Events
Hooks
Getting Hooked
Events are triggered throughout Stash, just
listen for them!
EVENTS
SECTION TITLE 1
Available EventsEVENTS
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"/>
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()) }
}
Indexer
Events
Hooks
Getting Hooked
Get in the Stash indexing pipeline to get data from, or add data to a commit
INDEXER
INDEXER
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
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"/>
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); }
} ...}
Got Service?
Services allow you to get and add data from and to
Stash
Services
UserServ ice
His toryServ ice
Pro jec tServ ice
Users
Change h is tory
Pro jec t
Repos i toryServ icRepos i tory
Serviceshttps://developer.atlassian.com/static/
javadoc/stash/latest/api
Access to services
public class BadgrChangesetIndex implements ChangesetIndexer {
public BadgrChangesetIndex( HistoryService historyService, LoggingService loggingService) {
this.historyService = checkNotNull(historyService); ... }
}
Look the part
Atlassian Design Guidelines
Soy is the best thing that happened to templates
• One template for server and client side
• Separation between logic and display
• Reuse of widgets
• JavaScript
Soy
AUI comes with Soy widgets!
Next...
Documentation and Examples
Resources
#atlassiansummit
• http://developer.atlassian.com
• http://developer.atlassian.com/design
• https://developer.atlassian.com/stash/
• Use the source code for examples and reference
Thank you!
STEFAN KOHLER • CONSULTANT • 42 BV • @STEFANKOHLER
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