Introduction

Automatics provides Build and deployment pipeline by making use of Jenkins scripts for creating pipeline jobs to build Automatics projects like Orchestration, properties,Device Manager , Device manager UI and giving Docker images as final output. The build job will pull the code of each Automatics Project from CMF repo and build the war files using maven, then the corresponding docker images will be created

Automatics Automated build and deployment Repo

Repo : https://code.rdkcentral.com/r/admin/repos/rdk/tools/automatics/dev-ops

Branch : rdk-next

Sub folder : 

  • Build : automationScripts\build\
  • Deployment : automationScripts\deployment\
  • Jenkins Setup : jenkinsServerSetup\

Pre-Requisites

Jenkins Server Setup :

  1. A VM should be available and an user with root access should be available
  2. Git should be installed in the VM.

Build & Deployment of Automatics: 

  1. A VM should be available and Jenkins server should be installed in it.
  2. Also the below applications should be installed in the VM.
    1. Docker -  The below commands can be used for installing docker in a VM
Commands to Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
    1. Maven - version 3
    2. JDK - 17
  1. Create a new user group in the VM named "docker" and add the Jenkins user to this user groups the below commands can be referred for the same
    1. Create the docker group.

      $ sudo groupadd docker
      
    2. Add your user to the docker group.

      $ sudo usermod -aG docker $USER
      
    3. Log out and log back in so that your group membership is re-evaluated.

      If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take effect.

      On a desktop Linux environment such as X Windows, log out of your session completely and then log back in.

      On Linux, you can also run the following command to activate the changes to groups:

      $ newgrp docker 
      
    4. Verify that you can run docker commands without sudo.

      $ docker run hello-world
      

      This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.

  2. Access to pull the docker base image like tomcat, mysql from dockerhub should be available. If access cannot be provided then those images should be available locally in the Jenkins VM for building docker images of Automatics tools.

Jenkins Server Setup

  1. Clone the above repo and go to the directory "jenkinsServerSetup\"
  2. Here you will find a file named "install_jenkins_server.sh" 
  3. Execute this shell script as sudo. This will install Docker and pull the Jenkins server image from docker hub 
  4. Then it will install all the necessary dependencies link maven, and Jenkins plugins.
  5. Also Automatics Core & RDKB Utils build jobs as well as Build and Deployments jobs will be created.
  6. When executing the shell script it will ask for the inputs like the port in which the Jenkins server needs to be started. Please input those details during execution
  7. Once the jenkins server setup is completed. Open the browser and give the public ip and port(or domain name if you have one) in URL box which will open the jenkins webpage. For example if your public ip address is 192.168.91.44 and jenkins server is started on 8909 the give the URL as "192.168.91.44:8909", you will get the page like below 
  8. Now open "Manage Jenkins" option→ "Security" → Under Security Realm, select Jenkins’ own user database → In the Authorization section, select Logged-in users can do anything. → Unselect Allow anonymous read access. → Click Save to save your changes.
    1.  
  9. Now go inside the already created jobs in Jenkins and modify the necessary configurations like maven repo URL, Shell script file paths etc

Jenkins Pipeline Manual Setup

  1. Login to Jenkins webpage
  2. Click on New Item button at the Left hand side menu
  3. Now Enter the name of the pipeline job and select pipeline option from below and click OK, as shown in the image below
  4. Navigate to the pipeline menu in the options and select "Pipeline script from SCM" in the drop down menu under the header definition. Then select the option Git for SCM. After that provide the Repo URL credentials and the branch. Then click save
    1. when adding the script path the path to the Jenkinsfile from the home directory of the repo should be provided. For the example the repo is "https://code.rdkcentral.com/r/rdk/tools/automatics/dev-ops" then the script path should be entered as "automationScripts/build/Jenkinsfile"


The above steps can be used for creating the build pipeline similarly the same steps could be used for creating the deployment pipeline as well.

Running the jobs

  • Build Job

To pull the code from the repository and building the Docker images of each tools the below parameters as shown in the sample images should be populated.






  1. "BUILD_AUTOMATICS_ORCHESTRATION" check box should be ticked for orchestration build to run
  2. In the subsequent steps give the Repo URL, its branch and credentials for Git repo(if any)
  3. Similarly enter the details for Automatics Properties , Device manager and Device manager UI
  4. At last press the Build button to start the build


Deployment Job


This job will get the details of VM's in which each of the tools - Orchestration, Automatics Properties ,Device Manager,device manager UI should be deployed including the user details for logging in to the VM's and deploy the docker images of the corresponding tools. All the VM's should have the SSH connection to the Jenkins VM for executing the commands as well as copying the docker images from Jenkins VM.  All the tools can be deployed in one execution or each one can be executed individually based on the selection of check box provided. Sample images of the deployment job are as follows



Provide all the fields based on the description provided against each field and press the build button to build the job.

Mandatory Automatics Configurations for Test Execution

The below configurations needs to be available in Automatics Orchestration, Automatics Properties, Device Manager and Jenkins jobs inorder to trigger a successful Test case execution from Automatics Orchestration

Jenkins Jobs

The below set of jobs will be created after successful completion of Automated Build and Deployment execution.

Configure all the jenkins jobs with below mentioned details 

Jenkins Job Name

Configuration to be

done in Jenkins Jobs

Steps carryout

the configuration

Automatics_Build_JobNIL
Automatics_Deployment_jobNIL
CI_Automatics_Code_Deploy_And_3.0_Api_ParserNIL
CI_Api_Parser_Automatics_CoreConfigure automatics properties URL in 
the JAVA_OPTS "-Dautomatics.properties.file=Automatics_Props_URL_Tobe_Added_here"
Under Goals of BUILD Tab
  1. Open the job by clicking the job name
  2. In the menus at the left click configure button
  3. Now click the Build tab at the top
  4. Now replace "Automatics_Props_URL_Tobe_Added_here" this string with the actual automatics properties URL in the Goals text field under " Invoke top-level Maven targets " menu
CI_Api_Parser_RDKB_Utils
CI_Api_Parser_RDKV_Utils
CI_Api_Parser_Scriptless_Automation
JOB1
Deploy_Automatics_CoreConfigure your private repo(this is for storing the maven dependencies for automatics) URL in 
the JAVA_OPTS "-DaltDeploymentRepository=REPO_URL_TOBE_ADDED_HERE"
Under Goals of BUILD Tab


  1. Open the job by clicking the job name
  2. In the menus at the left click configure button
  3. Now click the Build tab at the top
  4. Now replace "REPO_URL_TOBE_ADDED_HERE" this string with the private repo(this is for storing the maven dependencies for automatics) URL in the Goals text field under " Invoke top-level Maven targets " menu



Deploy_RDKB_Utils
Deploy_RDKV_Utils
Deploy_RPi_Partner_Java_API

After completing the above set of configuration "CI_Automatics_Code_Deploy_And_3.0_Api_Parser" job should be executed. This job will build and deploy all the automatics dependencies to the repo and run the parsers needed for Automatics Scriptless automation (Automatics 3.0). After that "Deploy_RPi_Partner_Java_API" job needs to be executed. Once all these jobs are executed successfully it is good to go with jenkins job configuration for Automatics

Automatics Orchestration

System Configuration

The below mandatory system configurations needs to be done in Automatics orchestration for running a first dummy Test execution and result verification from automatics.

System Config ParamDescription

DEFAULT_SYNDICATION_PARTNER

Default syndication partner. Eg: Company name

SYNDICATION_PARTNERS

Syndication partner names in comma separated format.  Eg: Company name1, Company name2

DEVICE_INVENTORY_BASE_URL

Base URL which is having the rest implementation of device management

EXECUTION_ENVIRONMENT_TYPES

Execution environment types in comma separated format. Supported values are RDKV, RDKB

AUTOMATICS_BASE_URLBase URL of Automatics Orchestration Application
MICROSERVICE_URLBase URL of Scriptless Service

Device Models

The device model needs to be configured and you can see this document for adding device model to automatics orchestration Automatics Orchestration Setup#DeviceModels

Resource Details

Resource details holds the configuration like the URL of jenkins server which needs to be configured in automatics for triggering the job execution and you can see this document for adding resource details to automatics orchestration Automatics Orchestration Setup#ResourceDetails

Automatics Properties

All the mandatory properties mentioned in the document Automatics Properties should be configured in automatics properties for the successful execution of a test case.


  • No labels