Upload
atlassian
View
1.280
Download
2
Tags:
Embed Size (px)
DESCRIPTION
How do you write a JIRA plugin that works across 4.2, 4.3 and 4.4? How can you find the metadata for the JIRA issue creation form? How can you create the issue itself, and attach the screenshot? And how is this going to change in JIRA 5.0 and beyond? This talk will cover all this, and more!
Citation preview
Saturday, 1 October 2011
Howʼd you do that?
Ian GrunertDeveloper, Atlassian
Bonfire
2Saturday, 1 October 2011
Agenda
3Saturday, 1 October 2011
• What is Bonfire?
Agenda
3Saturday, 1 October 2011
• What is Bonfire?• Building plugins for
multiple JIRA versions
Agenda
3Saturday, 1 October 2011
• What is Bonfire?• Building plugins for
multiple JIRA versions
• JIRA integration in Bonfire - problems and solutions
Agenda
3Saturday, 1 October 2011
What is Bonfire?
4Saturday, 1 October 2011
• Exploratory testing tool
What is Bonfire?
4Saturday, 1 October 2011
• Exploratory testing tool
• JIRA plugin targeting multiple JIRA versions
What is Bonfire?
4Saturday, 1 October 2011
• Exploratory testing tool
• JIRA plugin targeting multiple JIRA versions
• Browser extension for major browsers
What is Bonfire?
4Saturday, 1 October 2011
• Browser extension - JIRA client
• Submit bug reports directly from your browser
Bonfire -> JIRA Integration
5Saturday, 1 October 2011
• JIRA Plugin - track and manage testing activities
• Test Sessions• Session Notes• http://
www.atlassian.com/bonfire
Bonfire -> JIRA Integration
6Saturday, 1 October 2011
Building multiple JIRA version supported plugins"
7Saturday, 1 October 2011
• Why?
Building multiple JIRA version supported plugins"
7Saturday, 1 October 2011
• Why?• Problem points?
Building multiple JIRA version supported plugins"
7Saturday, 1 October 2011
• Why?• Problem points?• Some Solutions.
Building multiple JIRA version supported plugins"
7Saturday, 1 October 2011
• Increase the size of your market
• Should try and support two versions back.
Maximise your customer base
8
Earlier 4.0 4.1 4.2 4.3
Saturday, 1 October 2011
• Deploy to multiple internal instances
• For example, https://support.atlassian.com/ is 4.3, where as https://jira.atlassian.com/ is 4.4.
Multiple JIRA instances
9Saturday, 1 October 2011
• Test against EAPs!• Give feedback.• Participate in API building• Support JIRA 5.0 from
launch
Be ready for upgrades
10Saturday, 1 October 2011
Problems
11Saturday, 1 October 2011
• Java API changes
Problems
11Saturday, 1 October 2011
• Java API changes• JS and Markup changes
Problems
11Saturday, 1 October 2011
• Java API changes• JS and Markup changes• Testing across multiple
versions
Problems
11Saturday, 1 October 2011
Branching
12Saturday, 1 October 2011
• Cleaner code
Branching
12Saturday, 1 October 2011
• Cleaner code• Is this good or bad?
Branching
12Saturday, 1 October 2011
• Cleaner code• Is this good or bad?
• Overhead
Branching
12Saturday, 1 October 2011
• Cleaner code• Is this good or bad?
• Overhead• Builds
Branching
12Saturday, 1 October 2011
• Cleaner code• Is this good or bad?
• Overhead• Builds• Merging
Branching
12Saturday, 1 October 2011
• Cleaner code• Is this good or bad?
• Overhead• Builds• Merging• Testing
Branching
12Saturday, 1 October 2011
One build, multiple versions
13Saturday, 1 October 2011
One build, multiple versions
13
• Messier code
Saturday, 1 October 2011
One build, multiple versions
13
• Messier code• No merging
Saturday, 1 October 2011
One build, multiple versions
13
• Messier code• No merging• Shipping one jar
Saturday, 1 October 2011
One build, multiple versions
13
• Messier code• No merging• Shipping one jar• All tests in one branch
Saturday, 1 October 2011
One build, multiple versions
13
• Messier code• No merging• Shipping one jar• All tests in one branch• Know when touching
problem areas
Saturday, 1 October 2011
Six multi-version plugin techniques
14Saturday, 1 October 2011
1. CI using AMPS
Six multi-version plugin techniques
14Saturday, 1 October 2011
1. CI using AMPS2. Javascript / Markup changes - AJS.version
Six multi-version plugin techniques
14Saturday, 1 October 2011
1. CI using AMPS2. Javascript / Markup changes - AJS.version3. Non-compile breaking API changes - BuildUtilsInfo
Six multi-version plugin techniques
14Saturday, 1 October 2011
1. CI using AMPS2. Javascript / Markup changes - AJS.version3. Non-compile breaking API changes - BuildUtilsInfo4. UI location changes - Web fragment conditions
Six multi-version plugin techniques
14Saturday, 1 October 2011
1. CI using AMPS2. Javascript / Markup changes - AJS.version3. Non-compile breaking API changes - BuildUtilsInfo4. UI location changes - Web fragment conditions5. Compile breaking changes - Reflection
Six multi-version plugin techniques
14Saturday, 1 October 2011
1. CI using AMPS2. Javascript / Markup changes - AJS.version3. Non-compile breaking API changes - BuildUtilsInfo4. UI location changes - Web fragment conditions5. Compile breaking changes - Reflection6. Compile breaking changes - Dynamic module types
Six multi-version plugin techniques
14Saturday, 1 October 2011
• Run CI against all supported versions• Use testGroups in AMPS to facilitate this
• Quickly identify compile-time issues introduced
Continuous Integration
15Saturday, 1 October 2011
16Saturday, 1 October 2011
17Saturday, 1 October 2011
• AJS.version to find AUIʼs version, split the code path• https://developer.atlassian.com/display/AUI/AUI
+Version+Matrix
JavaScript / Markup changes
18Saturday, 1 October 2011
19Saturday, 1 October 2011
20Saturday, 1 October 2011
• BuildUtilsInfo in JIRA can be used to find the JIRA version and split the code path
Querying JIRA version
21Saturday, 1 October 2011
• Allows you to define a boolean condition as to whether or not a web-fragment shows up• IsPriorToJIRAVersion condition to only show web
fragments in certain JIRA versions (uses BuildUtilsInfo)
Web-fragment Conditions
22Saturday, 1 October 2011
Example
23Saturday, 1 October 2011
• Use this: • To load a class only present in later versions of JIRA• To load a class that changes names across JIRA
versions
Compile breaking changes - Reflection"
24Saturday, 1 October 2011
Example
25Saturday, 1 October 2011
Example
26Saturday, 1 October 2011
• JIRA 5.0 removes OSUser entirely
• Replaced with Crowd user• Large scale compile time
breaking changes
How does this look in JIRA 5?
27Saturday, 1 October 2011
• Approach taken by Bonfire was to drop 4.2 support, and remove as much OSUser as possible• Some instances of OSUser couldnʼt be removed
(IssueTabPanel for example)• Then create a branch, and change the imports for the
branch
We tried branching
28Saturday, 1 October 2011
• In JIRA 4.3 / 4.4, use special methods to get crowd user object• jiraAuthContext.getUser for OSUser• jiraAuthContext.getLoggedInUser() for Crowd User
• OSUser based methods are deprecated in 4.3 / 4.4
Deprecation pains
29Saturday, 1 October 2011
• In JIRA 5.0, the better 4.3/4.4 Crowd user methods are now deprecated (moved to nicer named methods)• Doing the right thing yields
lots of warnings
Deprecation pains
30Saturday, 1 October 2011
• For the same reasons outlined before• No eyes on JIRA 5.0 changes• Merge pain• Multiple jars• How can we fix this?
Branching sucks!
31Saturday, 1 October 2011
• Don Brown created jira4-compat to allow Speakeasy to support 4.2 -> 5.0 without branching
• Uses dynamic plugin module types to allow for new, cross version compatible module types
• 4 maven modules, compile different maven modules based on JIRA version
• FactoryBean Spring Component to inject the correct dependency
Dynamic module types
32Saturday, 1 October 2011
1. Multi-version support - you should be doing it!2. Donʼt have to branch to do multi-version.3. The documentation can help!http://confluence.atlassian.com/display/JIRA/Plugin+Developer+Notes+for+JIRA+5.0
Bonfire multi-version experiences - takeaways
33Saturday, 1 October 2011
Bonfire remote JIRA integration
34Saturday, 1 October 2011
Bonfire remote JIRA integration
35Saturday, 1 October 2011
Bonfire remote JIRA integration
35
1. Authentication
Saturday, 1 October 2011
Bonfire remote JIRA integration
35
1. Authentication2. Issue metadata
Saturday, 1 October 2011
Bonfire remote JIRA integration
35
1. Authentication2. Issue metadata3. Issue Creation
Saturday, 1 October 2011
Authentication
36
• Canʼt store the password• Ideally, single step
authentication
Saturday, 1 October 2011
Authentication
37
• Use JIRA REST• Returns a cookie• Use cookie for all future
requests• Re-authenticate on
cookie timeout
Saturday, 1 October 2011
• Need metadata to draw the issue creation form
• XML-RPC• Missing fields• Could not create on some
instances
Issue metadata
38Saturday, 1 October 2011
• Now on custom REST• Bad: extra code• Good: In control, works on
all instances, can add new Bonfire specific features
Issue metadata
39Saturday, 1 October 2011
• XML-RPC• Gaps filled with REST
(e.g. labels)• SOAP for attachments
Issue creation
40Saturday, 1 October 2011
• Now on custom REST• Bad: extra code• Good: In control, works on
all instances, can add new Bonfire specific features
• Déjà vu?
Issue creation
41Saturday, 1 October 2011
• In JIRA 5.0, neither custom REST resource would be required
Good news, everyone!
42Saturday, 1 October 2011
1. Test on real / complex data! (use atlas-create-home-zip)
2. Favour REST3. Donʼt fear custom REST resources
Bonfire Remote API experiences - takeaways
43Saturday, 1 October 2011
Thank you!
Saturday, 1 October 2011