Crazy pens: how we write plugins for the Atlassian platform

Hello everyone, I'm a Java developer at YuMoney.





In this article, I want to talk about how you can profit from optimizing existing tools in the company, why it is worth doing it, and where it is better to start. Using the example of the Atlassian stack and the Bitbucket plugin that we use at UMoney, I will tell and show everything in detail. Go!





If you remember the development of software in the 70s and 80s, giant computers and machines in which engineers placed punched cards come to mind. There were instructions, they were executed, some kind of result was obtained. And of course, in such a system there was no logging, no CI / CD, no containerization.





A photograph of the recent past
A photograph of the recent past

Over time, the development developed, and in the early 2000s we were already collecting war files (if we talk about the Java stack) and deploying them like this, CI / CD began to emerge.





Modern development is already a giant technology stack.





Zoo of tools
Zoo of tools

. , , , pipeline CI/CD, . . , Telegram ,  GitHub, GitLab, Bitbucket โ€” .





Money , . .





  • Telegram-, , . , , -, DevOps, , , . , .





  • - . , , , .   Atlassian.





  • Bitbucket-. , , code review, โ€” Bitbucket code review tools.  , Bitbucket, Confluence Jira , - . Bitbucket, GitHub Git.





, Bitbucket, GitHub, GitLab, , . , Bitbucket , REST API SDK. GitHub GitHub Actions โ€” .





? , , , โ€” , .





- โ€” , .





โ€” . , . , , . , .





โ€”   . โ€” , , open source , .





Bitbucket code review tools โ€”

Bitbucket code review tools. , , code review.





Code review is the process of reviewing code, finding bugs in it and how to fix them.
Code review โ€” ,

code review , , .   .





Java. Atlassian SDK โ€” Java. Atlassian REST API, . โ€” , -, . , , .









, โ€” , . pull request โ€” , , , .





pull request





pull request, , , , . , pull request, pull request. , checked, approve pull request, , pull request โ€” .





pull request pull request





, pull request pull request. , . pull request pull request, .





merge check





, , GitHub flow, . merge check . hotfix, . , , โ€” develop. pull request develop, , hotfix .





20 , .






ยซ code review ยป. , .





. Atlassian , , .





โ€” Atlassian . , , , - . Atlassian Developer Community โ€” - .





Atlassian-





.





  1. Atlassian Plugin SDK.





  2. .





  3. .





  4. .





  5. .





Atlassian Plugin SDK





Atlassian Plugin SDK. : Java, Maven. SDK . โ€” exe-  , SDK.





Linux, , .





. โ€” . , atlas version , . , Atlassian Plugin SDK , .





โ€” , , Atlassian Plugin SDK Maven central repository, Maven, . IDE atlassian Maven, . , Atlassian, โ€” .





maven-





SDK, .





Atlassian create Bitbucket plugin ( ). , Maven-, , .., . ( : https://github.com/GSkoba/bitbucket-plugin). .





Java Maven pom-, Bitbucket Atlassian, Bitbucket Parent Dependency Manager, . 





, UI ORM-.





Java , - .





src, โ€” Atlassian-plugin.xml. - Spring โ€” , , , -, pom.xml. , , .





, Bitbucket โ€” , UI, , , JavaScript.





, IDE , , Maven home directory Maven, Atlassian Plugin SDK. , โ€” IDE , .





, Atlassian.xml, , , โ€” .









atlas-mvn โ€” Maven, Maven SDK.





Atlassian-





, . โ€” , Bitbucket- .





SDK version run standalone. , .





-, .





โ€” localhost:7990/bitbucket. , , โ€” admin/admin. , , , . , .





, manage apps.





, , Bitbucket . . - โ€” , .





Bitbucket-:





  • UI.





  • Bitbucket.





  • Pull Request Hook.





  • Pull Request Merge Check.





  • .





UI





, , , UI , UI . , , , Selenium, , . -, , .





Query Parameter





Description





web.items





Web Item Client Web Item





web.panels





Web Panel Client Web Panel





web.sections





Web Section Client Web Section





URL, debug mode , . : https://<your Bitbucket Server instance>/projects?web.items&web.panels&web.sections. id-.





Debug mode
Debug mode

, UI โ€” . , UI , , .





, , , build, . , Jenkins build. Jira . โ€” UI-, pull requests.





UI. โ€” soy, . React- . - , , , . JavaScript , extension point โ€” .





Plugin example

Bitbucket





Bitbucket-? โ€” -, , . UI Bitbucket , . :





EventListener , endpoint โ€” , . , . . , , Telegram- โ€” Pull Request Hook. โ€” . :





Interface





Description





PostRepositoryHook<T extends RepositoryHookRequest>





,





PreRepositoryHook<T extends RepositoryHookRequest>





,





RepositoryMergeCheck





,





generic โ€” , .





.





, . , Bitbucket -, .





, , โ€” .





Trigger





Corresponding request type





BRANCH_CREATE





BranchCreationHookRequest





BRANCH_DELETE





BranchDeletionHookRequest





FILE_EDIT





FileEditHookRequest





MERGE





MergeHookRequest





PULL_REQUEST_MERGE





PullRequestMergeHookRequest





REPO_PUSH





RepositoryPushHookRequest





TAG_CREATE





TagCreationHookRequest





TAG_DELETE





TagDeletionHookRequest





hook .





Pull Request Merge Check





โ€” . ( ) : you shall not pass! ( , ). .





- โ€” , , , . , , : ยซ, , , -, , , , , , - ยป.





โ€” . , Gradle-, .





, , , , pull request.





MergeCheck.





RepositoryMergeCheck, preUpdate. . context request , Git flow, , .









Bitbucket- , Bitbucket-. Atlassian ORM โ€” active objects. , DTO- โ€” , Todo.





Activebject dto. , , .





Money โ€” , , UI .





Marketplace





, .





vendor, , . , Atlassian โ€” .









, , Altassian-. Atlassian โ€” , . Atlassian:





โ€” https://github.com/GSkoba/bitbucket-plugin . , - , Bitbucket- , .





MoneyDay - -. : https://youtu.be/lZBF1QV4ChE.  





. , , . :) 








All Articles