starting on stash

45

Upload: colleenfry

Post on 27-Jun-2015

265 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Starting on Stash
Page 2: Starting on Stash

STEFAN KOHLER • CONSULTANT • 42 BV • @STEFANKOHLER

Starting on Stash

Page 3: Starting on Stash

Who am I

Page 4: Starting on Stash

• 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

Notifyr

Page 6: Starting on Stash

Just text by itself, for impact.

Page 7: Starting on Stash

Badgr

Page 8: Starting on Stash

Just text by itself, for impact.

Page 9: Starting on Stash

The Idea

Page 10: Starting on Stash

Write down your ideas, to make them real and

make room for new ideas

Page 11: Starting on Stash

• Another add-on available?

• It is a requested feature?

• JIRA

• Answers

• Contact a Product Manager

Research your idea

Page 12: Starting on Stash

JIRA Votes

Page 13: Starting on Stash

Notifyr Idea

Page 14: Starting on Stash

Indexer

Events

Hooks

Getting Hooked

Page 15: Starting on Stash

Custom scripts that are executed when certain

actions occur.

HOOKS

Page 16: Starting on Stash

Repository Hooks

Page 17: Starting on Stash

• Pre-receive

• Asynchronous Post-receive

• Merge-checks

SECTION TITLE 1

Available HooksHOOKS

BLOCKING

BLOCKING

Page 18: Starting on Stash

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

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

Indexer

Events

Hooks

Getting Hooked

Page 21: Starting on Stash

Events are triggered throughout Stash, just

listen for them!

EVENTS

Page 22: Starting on Stash

SECTION TITLE 1

Available EventsEVENTS

Page 23: Starting on Stash

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

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

Indexer

Events

Hooks

Getting Hooked

Page 26: Starting on Stash

Get in the Stash indexing pipeline to get data from, or add data to a commit

INDEXER

Page 27: Starting on Stash

INDEXER

Page 28: Starting on Stash

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

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

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

Got Service?

Page 32: Starting on Stash

Services allow you to get and add data from and to

Stash

Page 33: Starting on 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

Page 34: Starting on Stash

Serviceshttps://developer.atlassian.com/static/

javadoc/stash/latest/api

Page 35: Starting on Stash

Access to services

public class BadgrChangesetIndex implements ChangesetIndexer {

public BadgrChangesetIndex( HistoryService historyService, LoggingService loggingService) {

this.historyService = checkNotNull(historyService); ... }

}

Page 36: Starting on Stash

Look the part

Page 37: Starting on Stash

Atlassian Design Guidelines

Page 38: Starting on Stash

Soy is the best thing that happened to templates

Page 39: Starting on Stash

• One template for server and client side

• Separation between logic and display

• Reuse of widgets

• JavaScript

Soy

Page 40: Starting on Stash

AUI comes with Soy widgets!

Page 41: Starting on Stash

Next...

Page 42: Starting on Stash

Documentation and Examples

Page 43: Starting on Stash

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

Thank you!

STEFAN KOHLER • CONSULTANT • 42 BV • @STEFANKOHLER

Page 45: Starting on Stash

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