Atlassian JIRA Plugin 및 REST API를 이용한 기능 확장

Post on 22-Feb-2017

1.300 views 5 download

Transcript of Atlassian JIRA Plugin 및 REST API를 이용한 기능 확장

우리 회사 업무 시스템과 아틀라시안의 만남- Build Atlassian add-ons -

권봉진 부장 , 오픈소스컨설팅

2

목차1. Atlassian add-ons2. Deveolper Environment 3. Atlassian Plugin SDK4. Plugin Development Steps5. Example #1 - Helloworld Plugin6. Example #2 - Telegram Plugin7. REST APIs & Example

예제소스 : https://github.com/OpenSourceConsulting/atlassian-apps

3

1. Atlassian add-ons

Atlassian add-ons

- Plugin add-ons- Atlassian Connect add-ons

Integration

- REST APIs 제공

4

1. Atlassian add-ons

CustomLink Menu 추가

Custom 메뉴 & 화면 추가

내부 데이터 및 변경 event 를 외부 시스템으로 전송

Atlassian 내부 데이터를업무시스템에 표시

업무시스템에서Jira 이슈 생성

업무시스템에서Jira 계정 생성 / 조회

Pluginadd-ons

Connectadd-ons

REST APIs

Use Case

Atlassian Marketplace

5

2. Developer Environment

Java SDK + Atlassian Plugin SDK + IDE (Eclipse)ver 1.7 ver 6.1.0

Lunar

Plugin project 생성 Jira 자동 설치및 실행

Plugin 자동 설치

참고 : https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project

6

2. Developer Environment - Set up the JDK

1. Download and Install JDK2. JAVA_HOME 환경변수에 JDK 설치경로 등록3. PATH 환경변수에 JAVA_HOME/bin 경로 추가

7

2. Developer Environment - Set up the Atlassian Plugin SDK

1. Download : https://marketplace.atlassian.com/plugins/atlassian-plugin-sdk-windows/server/overview2. Run the installer EXE3. 설치완료후 Window 재시작4. 윈도우 cmd 창을 열고 ‘ atlas-version’ 명령으로 아래와 같이 출력되면 정상임 .

8

2. Developer Environment - Set up the Eclipse

1. Download and Install Eclipse IDE for Java EE (Lunar)2. JDK 설정 .

3. Maven 설정

9

3. Atlassian Plugin SDK

참고 : https://developer.atlassian.com/docs/developer-tools/working-with-the-sdk/command-reference

10

3. Atlassian Plugin SDK– Commands

SDK Commands Description

atlas-create-jira-plugin jira plugin project 를 생성한다 .

atlas-mvn eclipse:eclipse eclipse project meta data 생성 .

atlas-create-jira-plugin-module

jira plugin module 을 추가한다 .

atlas-run jira plugin project 폴더 안에서 실행되어서 plugin build 에서부터 plugin 이 자동 설치된 jira 를 설치 및 실행해준다 .

atlas-run-standalone atlassian 제품 를 자동 설치 및 실행해준다 .

11

3. Atlassian Plugin SDK– Create Plugin Project

입력항목

12

3. Atlassian Plugin SDK - Plugin Modules

• Plugin add-on 은 반드시 하나 이상의 plugin module 을 포함해야 한다 .• atlas-create-<app>-plugin-module or annotation 으로 추가

13

• atlas-create-jira-plugin

• atlas-mvn eclipse:eclipse• delete .classpath file• Import Project• convert Maven Project

• atlas-create-jira-plugin-module • or using annotation

• atlas-run or atlas-package• or maven build on Eclipse

• atlas-run ( on Local Jira)• or add add-ons to Jira (file upload)

4. Plugin Development Steps

Project 생성

Eclipse import

Plugin module 추가 및기능 구현

Build

Plugin 설치

14

4. Plugin Development Steps – Step #2 : Eclipse import

atlas-mvn eclipse:eclipse- Eclipse 에서 인식할수 있는 eclipse project metadata 를 생성해준다 .- eclipse java project 로 생성됨 .

.classpath 파일 삭제- old version eclipse 기반 .classpath file 삭제 .

Convert to Maven Project

Import Project

15

Example #1 - HelloWorld Plugin

동영상 시연- JIRA 에 Custom Menu 생성하기 -

https://youtu.be/fgdJ1U52Ypc

17

Example #2 -Telegram 연동 Plugin

Project 생성

Eclipse import

Plugin module 추가 및기능 구현

Build

Plugin 설치

atlas-create-jira-plugin

18

Example #2 -Telegram 연동 Plugin

Project 생성

Eclipse import

Plugin module 추가 및기능 구현

Build

Plugin 설치

delete.classpath

19

Example #2 -Telegram 연동 Plugin : annotation 기반

Project 생성

Eclipse import

Plugin module 추가 및기능 구현

Build

Plugin 설치

atlas-create-jira-plugin-module 대신 annotation 사용

20

Example #2 -Telegram 연동 Plugin : command 기반

Project 생성

Eclipse import

Plugin module 추가 및기능 구현

Build

Plugin 설치

atlas-create-jira-plugin-module 사용

src/main/resources/atlassian-plugin.xml

@ExportAsService@Named@ComponentImport@Inject사용안함

21

Example #2 -Telegram 연동 Plugin

Project 생성

Eclipse import

Plugin module 추가 및기능 구현

Build

Plugin 설치

동영상 시연https://youtu.be/BEEBblaYyrM

22

Atlassian REST APIs

REST APIs

http

사내 업무시스템

• JIRA REST APIs• Confluence REST APIs• FishEye/Crucible REST

APIs• Bamboo REST APIs• Stash REST APIs• Crowd REST APIs

참고 : https://developer.atlassian.com/docs/atlassian-platform-common-components/rest-api-development

23

REST API Browser

참고 : https://developer.atlassian.com/docs/developer-tools/using-the-rest-api-browser

administration console > System > ADVANCED > REST API Browser

24

Atlassian REST APIs - Authentication

• Basic Authentication (JIRA 5.0 이상 )https://en.wikipedia.org/wiki/Basic_access_authentication https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-basic-authentication

• OAuth (JIRA 5.0 이상 )https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-oauth-authentication

• Session Authentication

Example Basic Authentication

26

Atlassian REST APIs - Example

• 이슈 목록 조회하기• REST API : jira/rest/api/2/search

• request parameter samplejql=assignee=fred

Apache HttpComponents

27

Atlassian REST APIs - Example

• 이슈 생성하기• REST API : jira/rest/api/2/issue

• rquest parameter sample

28

Atlassian REST APIs - Example

• Basic Authentication Logic

Authentication .

29

Atlassian REST APIs - Example

동영상 시연https://youtu.be/vAwUohBgF3s

30

감사합니다 !!