This repository is for the Build a Node.js and React app with npm tutorial in the Jenkins User Documentation.
The repository contains a simple Node.js and React application which generates a web page with the content "Welcome to React" and is accompanied by a test to check that the application renders satisfactorily.
The jenkins
directory contains an example of the Jenkinsfile
(i.e. Pipeline)
you'll be creating yourself during the tutorial and the scripts
subdirectory
contains shell scripts with commands that are executed when Jenkins processes
the "Test" and "Deliver" stages of your Pipeline.
Login to Jenkins server and download sonarscanner to the /opt directory.
$ cd /opt
$ wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip
$ unzip sonar-scanner-cli-4.2.0.1873-linux.zip
$ mv sonar-scanner-cli-4.2.0.1873-linux sonar-scanner
This will the set to global configuration.
$ export PATH=/opt/sonar-scanner/bin:$PATH
$ sonar-scanner –version
- Go to Manage Jenkins > Global Tool Configuration.
- Find SonarQube Scanner and click on SonarQube Scanner.
- Input any Name and the path of sonar scanner.
- Unselect the Install automatically.
- Then, Save configurations.
- Go to Jenkins > New Item > Pipeline.
- Input any name for your Job
- Input the details below on the configuration.
- Definition: Pipeline script from SCM
- SCM: Git
- Repostiries: Git URL and Git Credentials
- Branches to Build: */master ("depends on your preference")
- Script Path: Jenkinsfile