Jenkins and Maven Contd..
- Setting different Java or other tools in jenkins
- Manage Jenkins => Global Tool Configuration => JDK
Lets create a jenkins freestyle project to build game of life
- General Section: General information about project
- Source Code Management: This section is about version control information of the project
- Build Triggers: When to trigger the build
- Build Environment:
- Build Steps: What has to be done to build the project
- Post Build Actions: What has to be done After Build
- Save the project now
- Lets explore home directory of jenkins
JENKINS_HOME
- Lets view the contents of config.xml. This file is representation of the job which we configured in the free style i.e. UI
- When we build the project, jenkins create a folder with project’s name in workspace, this folder is referred as workspace for the job
- Lets configure for Game of life
- When we run the project we get unit test results (Postbuild actions => Publish Test Results)
- To show the artifact we can use (Post Build Actions => Archive the artifacts)
Plugin in Jenkins
- A plugin to jenkins is an additional functionality provided.
- Installing plugin will add functionality for jenkins not installation on the
jenkins master node
- To Manage Plugins
Build Executors
- A Build Executor on a Jenkins node determines how many projects can be built parallely
- A individual project by default gets only one executor, if you want to change this, Execute concurrent builds in the General section
- Every node in Jenkins can be configured with number of executors
- Manage Nodes => Select the Node => Configure => Number of executors
- Manage Nodes => Select the Node => Configure => Number of executors
Jenkins Distributed Builds
- Jenkins has two types of nodes
- Master node: This is the node where we install jenkins
- Node: This is the node on which we can run the job which matches the label defintion.
- Adding more nodes increases number of executors which means we can build more projects
Lets add one node which is linux (ubuntu) to the master
- This vm has username and password. we can also configure username and key based ubuntu instances
- In jenkins we have credentials which supports
- username and password
- username and key
- Manage Jenkins => Manage Credentials
- To configure node: Manage Jenkins => Manage Nodes
- Ensure on the node JDK 11 and above is installed
- Now lets check whether spring petclinic works on node 1 or not
Exercise
- Try building a dotnet project Refer Here and node js project Refer Here