Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

...

Jenkins is used by Automatics for following activities. 

  • To perform test execution

...

  • .
  • To deploy Automatics Core to maven artifact repository.

Jenkins Setup

Steps to be taken care during Jenkins configuration

  • Install

    Jenkins
  • Configure Java 1.8 and Maven 3
  • Select Manage Jenkins and select Configure System
  • Create jenkins job with name configured in Automatics orchestration.

...

  • Java 17

    • Refer following web page to get detailed steps to install Java 17 on Linux.

Automatics Orchestration Setup#JDK17

  • Install Jenkins

Follow below steps to install and configure Jenkins in Linux

    • Enable the Jenkins repository. To do that, import the GPG key using the following curl command.

"curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo"

Sample Output:

Image Added

    • And add the repository to your system with:

"sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key"


    • Once the repository is enabled, install the latest stable version of Jenkins by running cmd:

"sudo yum install jenkins"

    • After the installation process is completed, start the Jenkins service with:

"systemctl start jenkins"


    • To check whether it started successfully run:

"systemctl status jenkins"

Sample Output:

Image Added

    • Finally enable the Jenkins service to start on system boot.

"sudo systemctl enable jenkins"

  • Setting Up Jenkins

    • To set up your new Jenkins installation, open your browser and type your domain or IP address followed by port 8080:

"http://your_ip_or_domain:8080"

    • A screen similar to the following will appear, prompting you to enter the Administrator password that is created during the installation.

Image Added

    • Use the following command to print the password on your terminal.

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

You should see a 32-character long alphanumeric password.

    • Copy the password from your terminal, paste it into the Administrator password field and click Continue.
    • On the next screen, you will be asked whether you want to install the suggested plugins or to select specific plugins. Click on the Install suggested plugins box, and the installation process will start immediately. 

Image Added

Image Added

    • Once the installation is complete, you will be prompted to set up the first administrative user. Fill out all required information and click Save and Continue.
    • On the next page, you will be asked to set the URL for the Jenkins instance. The URL field will be populated with an automatically generated URL.
    • To complete the setup confirm the URL by clicking on the Save and Finish button.



  • Follow below steps to Disable CSRF protection by setting system property 'hudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION' set to true. More details available at https://www.jenkins.io/doc/book/security/csrf-protection/ .

    • To disable CSRF it can be done with groovy  , Navigate to  "Manage Jenkins > Script Console " in Jenkins.
    • Enter the list of commands shown in the below screenshot and click on "Run".

Image Added

  • To view the generated HTML logs by the testcases properly please follow the below steps to see the generated HTML logs by modifying, the CSP header sent by Jenkins by setting the Java System property.More details available at https://www.jenkins.io/doc/book/security/configuring-content-security-policy/ 
    • To unset the header please Navigate to  "Manage Jenkins > Script Console " in Jenkins.
    • Please use the property "System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")" in Jenkins.

Image Added         

  • Install Maven 3

Refer following webpage to setup Maven 3 on Linux.

Automatics Orchestration Setup#Maven3

Jenkins Job for Test Execution

Automatics performs test execution in Jenkins. Following page will provide details on creating Jenkins job for test execution.

Jenkins Job for Test Execution

Jenkins Job for Automatics Core Deployment

As part of Automatics setup, partner has to deploy automatics core in their own self hosted maven artifact repository. Automatics-core artifact to be deployed will be generated in format format 'automatics-core-{version}.jar'.

Following page will provide details on creating Jenkins job for Automatics Core deployment.

Automatics Core : Jenkins Deployment Job configuration

...

 Configuring Jenkins Job

Steps to be taken care during job configuration.

  • From Jenkins select “New Item”, Specify name of the new job to be created.
  • If we want to clone from existing job, we can give name of the existing job in the Copy from text box present in the bottom and select “OK”

In General section

  • Check the “Discard old builds”.
  • Select Log Rotation and we can keep the days of build and Max # of builds.
  • Please configure String parameters filterTestIds, filterTestType, updateRdkPortal, settopList, JMD_ID, BUILD_NAME, executionMode, gr,grb in job
  • Under Source Code Management, Select GIT and specify Repository base url.
  • Under Pre Steps in Build section, please add below

...

pom.xml

...

clean install -U exec:java -DskipTests=true -DretryByDefault=false -DbuildType=RDK -Dhttps.protocols=TLSv1.1,TLSv1.2 -Dsun.security.ssl.allowUnsafeRenegotiation=true -Dautomatics.properties.file={automatics.properties.url }

...