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 Java 11

    • Refer following web page to get detailed steps to install Java 11 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:

    • 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:

    • 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.

    • 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. 

    • 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".

  • 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.

         

  • 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


  • No labels

2 Comments

  1. Regarding the "Jenkins" setup, why not deploying it within Tomcat with a jenkins.war file? 

  2. This is a mistake in the screenshot regarding the script: 
    import jenkins.model.Jnekins >> import jenkins.model.Jenkins

    import jenkins.model.Jenkins
    def instance = Jenkins.instance
    instance.setCrumbIssuer(null)