In Automatics, test execution happens within Jenkins. Please follow below steps to create and configure Jenkins Job for test execution.

1. Create Jenkins Job

  • From Jenkins, select option “New Item” and specify name of the job to be created and select “OK”. The job name should be similar to one configured in Automatics Orchestration for parameter 'JOB_NAME_PREFIX' in System Configuration page. For eg: If job name configured in Orchestration is 'AUTO_JOB', then job name to be provided should be AUTO_JOB1. More jobs can be created for test execution depending on the number of devices available for testing, number of parallel executions required and system resources. Subsequent jobs will have names as AUTO_JOB2, AUTO_JOB3 etc and they can be created by cloning the initial job.
  • Update the total count of jobs created for test execution in Automatics Orchestration in Resource Details Page for parameter 'Maximum Parallel Jobs'. Automatics Orchestration Setup#ResourceDetails.


2. Configure Jenkins Job

  • Click on newly created Jenkins job and click on Configure option. Job configuration can be edited now.

Configure Build Parameters

In General section

  • Check the “Discard old builds”.
  • Select Log Rotation and we can keep the days of build and Max # of builds.
  • Check the "This project is parameterized".

  • Please configure following String build parameters in job.


    Build ParameterDescription
    filterTestIdsProvides test script ids for execution in comma separated format
    filterTestTypeProvides test type to which test scripts belongs to
    updateRdkPortalIf execution result to be updated to CI portal, then this will set to true, other wise false.
    settopList

    Provides device mac addresses on which test to be executed in comma separated format.

    For non-qt tests, only one device can be provided for execution.

    For qt tests, multiple devices can be provided for execution.

    JMD_IDProvides the Job Manager Id. This is for identifying each execution job in Orchestration
    BUILD_NAME

    Provides RDK build name.

     For non-quick tests, it is expected that device is loaded with this build.

    And, for quick tests this is the build to be loaded in device as part of quick test.

    executionModeProvides execution environment details. Some of the expected values are RDKV and RDKB
    grProvides the test repository name to be cloned for test execution.
    grbProvides the test repository branch name to be cloned for test execution.
    end_point

    Provides details on type of device used for testing. Valid values are RACK_DEVICE and DESK_BOX.

    If the device hardware can be managed via a rack system, then end point will be RACK_DEVICE,

    otherwise DESK_DEVICE

    Configure Source Code Management

  • Under Source Code Management, Select option 'GIT'.
    • Specify Repository base url in the format 'https://code.rdkcentral.com/r/rdk/tools/automatics/${gr}', where the remaining path of the repository is provided during test execution via the build parameter 'gr'.
    • Add the branch specifier as '*/${grb}', where the repository branch is provided during test execution via the build parameter 'grb'.

Configure Build 

     Configure Shell Script for Partner Java API dependency

Configuring shell script is required only if Partner Java API based project is implemented and that needs to be integrated with Automatics for test execution. Otherwise, this configuration can be skipped.

Before configuring this step in Jenkins, it is required that the Partner Java API project is developed and deployed in Partner's self hosted repository.

Copy the script file pre-test-config.sh and keep it in Jenkins VM. And configure it as shown below. Here, the script is copied to location /mnt/scripts in Jenkins VM.

The parameters to the script are 

-g - Expects the group id of partner java api maven artifact.

-a - Expects the artifact id of partner java api maven artifact.

-v - Expects the version of partner java api maven artifact.

The Jenkins job will clone the test project and then will execute below script. This script will add partner java dependency to test project pom.xml at runtime. After this script is executed, maven goal for test execution will be executed.

Under Build section, please click on 'Add build step' and select option 'Shell Script'.

     Configure Maven Goal for Test Execution

    • Under Build section, please click on 'Add build step' and select option 'Invoke top-level Maven targets'. Then, add below maven command in Goals section
Goals 

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_base_url}/automatics.properties -Dproperties.file.token={Base 64 encrypted login id and password separated by colon }

properties.file.token parameter is used to authenticate automatics properties. The token should be base 64 encrypted with login id and password separated by colon format.
example: admin:automatics when we encrypt it, the value will be YWRtaW46YXV0b21hdGljcw==


    • Click on Advanced option,
      • Add the below JVM Options 
        JDK17 JVM Options
        --add-opens=java.base/java.lang=ALL-UNNAMED
        --add-opens=java.base/java.lang.reflect=ALL-UNNAMED
        --add-opens=java.base/java.util=ALL-UNNAMED
        --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
        --add-opens=java.base/java.io=ALL-UNNAMED
        --add-opens=java.management/javax.management=ALL-UNNAMED
        --add-opens=java.desktop/sun.font=ALL-UNNAMED
        --add-opens=java.base/sun.reflect.generics.parser=ALL-UNNAMED
        --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
        --add-opens=java.base/java.time=ALL-UNNAMED
        --add-opens=java.base/java.time.format=ALL-UNNAMED
        --add-exports=java.base/sun.util.calendar=ALL-UNNAMED
        --add-exports=java.base/sun.security.action=ALL-UNNAMED
        --add-exports=java.xml/jdk.xml.internal=ALL-UNNAMED
        --add-opens
        java.base/java.net=ALL-UNNAMED
        --add-opens
        java.base/java.lang.invoke=ALL-UNNAMED
      • Select option 'Inject Build Variables'.
      • Override maven default settings, if required only. 

Configure Post-Build Actions

 Configure post build actions as shown below to view the execution logs and html reports.

Configure Archive the Artifacts


Configure Delete the workspace when build is done

    • Click on Apply and Save button.
  • No labels