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
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.
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. )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.