Getting started with Jenkins and Node

Gergely Nemeth
RisingStack Blog
Published in
3 min readAug 30, 2014

All my latest articles can be found at the RisingStack blog.

What is Jenkins?

Jenkins is an application that monitors executions of repeated jobs, such as building a software project. Jenkins focuses on two main areas:

  • building/testing software projects continuously
  • monitoring executions of externally-run jobs.

Jenkins is great for setting up continuous integration/deployment. It is written in Java, but is a general purpose tool, so setting up with Node is a piece of cake.

Preparing the server

In order to test our Node projects with Jenkins, we will need Jenkins, Node and Git installed. There is a detailed manual on how to setup it on various systems here.

Also, if you are using ansible, the following simple playbook should do the trick:

—-
# This playbook deploys Jenkins
- name: Setting up roles
hosts: jenkins
user: root
vars:
nodejs_version : “0.11.13"
roles:
 — Ansibles.git
— avanov.jenkins
 — JasonGiedymin.nodejs
tags:
 — setup

If everything went ok, you should be seeing Jenkins’ welcome screen at your server’s 8080 port.

Setting up Jenkins

First, set up a user at Manage Jenkins > Manage Users.

By default, Jenkins does not use any authentication — fix that asap! Go to Manage Jenkins then click Setup Security.

Here check the following items:

  • Jenkins’ own user database (but not Allow users to sign up)
  • Matrix-based security

Make sure, the Git plugin is installed too (Manage Jenkins > Manage Plugins).

Now you should be good to go!

Setting up your first Node project

To do so, click on New Item, then choose Build a free-style software project.

At the next dialog, go for Source Code Management and choose Git (or any other). Here, set up the necessary credentials, then choose Add build step > Execute Shell.

That’s it! After clicking Save then Build now, your first build should start!

Next Up

In the next post we will discover how pipelines can be built in Jenkins for continuous integration/delivery.

About us

RisingStack is a Node.js consulting company specialised in API development and empowering businesses to be successful with Node.js by trainings, consulting and development.

--

--

Gergely Nemeth
RisingStack Blog

Engineering Manager | Built @RisingStack, @GodaddyOSS @BaseWebReact | Find me at https://nemethgergely.com