Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket Server: Adding merge check for frontend repository

jintoppy March 7, 2019

I want to do a lint check and also run my Jest unit test on the Pull Request on Bitbucket server. In Bitbucket cloud, pipeline option makes it easy to do. How to do the same in Bitbucket server?

 

Basically, I want to run the following commands, which needs NodeJS

npm run lint

npm run test

1 answer

1 accepted

0 votes
Answer accepted
Mikael Sandberg
Community Champion
March 7, 2019

Hi Jinto,

Welcome to Atlassian Community.

Bitbucket Server does not have pipelines, so you would have to rely on either Bamboo, Jenkins or another tool to run your tests. We are using Pull Request Notifier to trigger builds and tests in Jenkins when a pull request is created. You may also want to check out Code Review Assistant, it can run code analysis when a pull request is opened. I looked at it as a way of adding a template to the description field for a pull request.

jintoppy March 7, 2019

Hi Mikael,

Thanks for the quick reply.

If I use Jenkins to run all my tests for all the PRs, it will eat up all the CPU power of Jenkins server. I wanted to avoid that. I want this to be run inside Bitbucket server itself, so that, Jenkins can be used only to run my builds. 

Bitbucket pipeline(sadly only available in Bitbucket cloude) feature let me add any docker image and run all tasks. Is there any way, I can replicate this behavior in Bitbucket server? If container not possible, atleast is it possible to run the commands which I give? (Node commands like npm run lint, npm run test etc. )

Mikael Sandberg
Community Champion
March 7, 2019

Take a look at Code Review Assistant, that one allows you to run any external program to analyze your pull requests, so you should be able to add a container and run your tests.

jintoppy March 7, 2019

Thanks Mikael. This allows a fixed set of tools. Since ESLint is also involved, I can do the lint check with this. But, for running my unit test, I am using Jest. Is there any tool which helps in that? (I will be running npm run test which will use Jest to run the unit test)

Mikael Sandberg
Community Champion
March 7, 2019

The fixed set of tools are what is pre-configured in the app, but it also allows you to run any external program that you want:

Since version 1.8.0, Code Review Assistant is not restricted to the integrated static analyzers anymore, but instead is able to run any external program to analyze your pull requests.

jintoppy March 7, 2019

Oh. Great. Let me try it out then. Thanks so much. 

jintoppy March 7, 2019

I checked with Code Review Assistant Addon Support team. Since running the test requires packages to be installed (so, I have to do npm install), it is not possible it seems. 

Mikael Sandberg
Community Champion
March 8, 2019

Okay, in that case Bamboo or Jenkins would be your only option, unless you want to write your own app. Since you are concerned that the tests would hog up your Jenkins server, I would look into adding a new node/s that is dedicated for just your testing, that way your master Jenkins server can be used for other things.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events