Jenkins Configuration

Modified on Wed, 14 Feb 2024 at 10:33 AM

TABLE OF CONTENTS



Installing Jenkins 

To download and install Jenkins, click here.


Prerequisites

After installing Jenkins, ensure you have the following plugins installed:

  • Parameterized Trigger plugin -Install this plugin to enable parameterized builds. This plugin allows you to trigger new builds upon completion of existing builds.
  • Copy To Slave Plugin or Copy data to workspace - Install this plugin for efficient data transfer between master/controller and slave nodes in your Jenkins environment.
  • Node and Label parameter plugin -Install this plugin to use node and label parameters in your build configurations.
  • Git plugin-Install this Git plugin to integrate Git repositories with Jenkins for source code management.

    You can install these plugins from the Jenkins dashboard by navigating to 'Manage Jenkins' > 'Manage Plugins' > 'Available' tab. For more details, refer to the article Installing a plugin.
    Ensure that these plugins are installed and configured according to your project requirements.



Working with a Project

Creating a New Folder for a Project

Perform the following:


  1. Navigate to the Dashboard and select “New View” .
  2. In the ‘View Name’ textbox, enter your ‘project name’. For example, 'TheAlgoQA'.
    Make sure to provide the folder name without any spaces and also, you can rename the folder by clicking the Rename icon in the left pane.
  3. Choose either “List View” or “My View” based on your requirement to view the corresponding page.

  4. Click OK to create a new folder.


Creating a New Job within 'TheAlgoQA' Project Folder

Perform the following  to create a new job named "DownloadAlgoQAJob" within the "TheAlgoQA" project folder in Jenkins. This job helps you to download scripts from a Git repository and distribute them to machines for execution. In this case, machine is referred to virtual machine where you execute your scripts.


  1. In the Dashboard, select the ProjectName (TheAlgoQA) in the breadcrumbs.
  2. In the left pane, click  “New Item” or the associated icon.

  3. The following screen appears. In this screen, enter the project name (DownloadAlgoQAJob) into Enter an item name textbox.
     

  4. Choose “Freestyle project” option and then select OK to view the following screen:


  5. Source Code Management

    Select Git option in the Source Code Management section to enter Git repository details. In the following screen, enter Repository URL > select none > enter the branch specifier and click Save.

  6. Configure Build Steps - Select Build tab or navigate to the Build section to view the following screen. In this screen, enter the project name to build and the nodes details as shown.
    In Jenkins, when configuring the DistributeAlgoQA project and providing require Node details, you are setting up the process for distributing scripts to a machine. This allows you to specify how the scripts must be distributed and executed on different nodes or machines within the Jenkins environment.



  7. Configuring the nodes
    This process allows you to specify where the distributed scripts must be executed within the Jenkins environment.

    Perform the following:

    1. In the Dashboard screen, select Mange Jenkins in the left pane.

    2. Select Manage Nodes and Clouds in the System Configuration section.

    3. Select New Node from the left pane.

    4. In New Node screen, enter the node name, select Permanent Agent option to connect permanently to the Controller/Master and click OK.

    5. In the Node Details screen, enter the details as shown in the screenshot. Note that while entering the number of executors it is recommended to ensure that the number of executors in Jenkins does not exceed the number of virtual CPUs available. Click Save. 




  8. To log in to the virtual machine (VM) using Remote Desktop Protocol (RDP) and connect it to Jenkins, perform the following:

    1. Use commands to initiate an RDP connection to the VM. For example:

      On Windows, you can use mstsc command with appropriate parameters to connect to the VM.

      On Linux, you can use xfreerdp or rdesktop commands.


    2. Establish Connection:


      Once the RDP connection is established, execute scripts on the VM to interact with Jenkins.

      Make sure to install a Jenkins CLI tool on the VM to interact with Jenkins remotely. This tool allows you to trigger builds, query job statuses, and perform other Jenkins-related tasks.

      Note: The steps outlined in the previous steps for logging in to the virtual machine (VM) and connecting it to Jenkins may vary depending on the specific environment and configurations.


  9. Adding a build step
    Repeat the steps described in creating a project folder and creating a new Job until step 4. and then enter the following details of the required test scripts as shown:


  10. To execute commands using a Linux machine, perform the following:

    1. After creating a job , navigate to Build section under General Tab. 

    2. Select Add build step drop down to select Execute Shell option as shown:

    3. Run the Maven commands to execute scripts
      Make sure you set the path similar to following example:
      cd /home/centos/Jenkins/workspace/DistributeAlgoQA/AlgoQA 
       

    4. Save the configurations.
      The projects created will be displayed as follows: 

  11. Executing the scripts

    Perform the following: 

    1. Navigate to AlgoQA Job created earlier. 

    2. Select 'Build with Parameters' option in the left pane. 

    3. Enter the test case tags into FeatureList text box, Feature name and Node details.

    4. Click Build.

    5. Click the link corresponding to the latest build in the Build History section

    6. Click the Console Output link on the left pane to view the output for the commands you entered. The console output indicates that Jenkins is successfully executing the commands.
































Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article