Change the trigger of plot job to a timer 99/19599/1
authoremaclee <lee.anjella.macabuhay@est.tech>
Thu, 12 Oct 2023 19:19:51 +0000 (20:19 +0100)
committeremaclee <lee.anjella.macabuhay@est.tech>
Thu, 12 Oct 2023 19:19:51 +0000 (20:19 +0100)
     - remove the trigger from post build
     - add the timer as a trigger build
     - modify the charts for timestamp

Issue-ID: CPS-1753
Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech>
Change-Id: I6013bc0c3497b18b4570b55c49887e7d2e3c9042

jjb/onap/cps/cps-performance-test-jobs.yaml
jjb/onap/cps/prepare-performance-tests-data.sh
jjb/onap/global-templates-onap-java.yaml

index 2bb52452c875a6333d1533420028209b6e0c7049..ecbdd3c03aa60ba1f01252ccfe5b845cd57ab3ff 100644 (file)
     jobs:
       - 'onap-{project-name}-{stream}-performance-test-java'
 
-    publishers:
-        - trigger:
-              project: 'onap-cps-performance-tests-plots'
-
 - project:
     name: cps-tests-plots
     project: cps
     project-name: cps
+    timer: "15 4 * * *"
 
     jobs:
         - 'onap-{project-name}-performance-tests-plots'
\ No newline at end of file
index cfc3a9ec5654359f2d7e90eb2d9a5943002f157d..1b4b61f29182cccf2b298ba6c936102dec15426c 100644 (file)
@@ -20,8 +20,8 @@ read_datatreees_pattern="^.*Read datatrees using openroadm root.*"
 update_datanodes_pattern="^.*Update 100 data nodes.*"
 batch_delete_pattern="^.*Batch delete 100 whole lists.*"
 
-all_patterns=("$creating_bookstore_pattern" "$read_datatreees_pattern" "$update_datanodes_pattern" "$batch_delete_pattern")
 new_data=""
+JENKINS_JOB_URL="https://jenkins.nordix.org/job/onap-cps-master-performance-test-java"
 
 # Get latest build
 getLatestBuild() {
@@ -32,8 +32,7 @@ getLatestBuild() {
 latestBuild=$(getLatestBuild)
 consoleText=""
 lastRecordedBuild=""
-dateOfLastRecordedBuild=""
-JENKINS_JOB_URL="https://jenkins.nordix.org/job/onap-cps-master-performance-test-java"
+timestampOfLastRecordedBuild=""
 
 # Create and add header to the file
 createAndAddHeader() {
@@ -48,6 +47,7 @@ createAndAddHeader() {
     fi
 }
 
+# Get the console text from specific build of the performance job
 getConsoleText() {
     buildToRead=$1
     consoleURL="${JENKINS_JOB_URL}/${buildToRead}/consoleText"
@@ -100,9 +100,10 @@ getAndRecordDataResults() {
         echo "New data added"
     fi
     lastRecordedBuild=$buildNumber
-    dateOfLastRecordedBuild=$(curl -s "${JENKINS_JOB_URL}/${lastRecordedBuild}/api/json" | jq -r '.timestamp' | xargs -I {} date -d "@{}")
+    timestampOfLastRecordedBuild=$(curl -s "${JENKINS_JOB_URL}/${lastRecordedBuild}/api/json" | jq -r '.timestamp')
+       formattedTimestampOfLastBuild=$(date -d "@$((timestampOfLastRecordedBuild / 1000))" "+%B %e, %Y at %H:%M")
     echo "last Recorded build: $lastRecordedBuild"
-    echo "date of last recorded build: $dateOfLastRecordedBuild"
+    echo "date of last recorded build: $formattedTimestampOfLastBuild"
 }
 
 buildStaticReport() {
@@ -142,8 +143,8 @@ EOT
 
 buildHTMLReport() {
 
-    chartTitle1="$1"
-    chartFileName1="$2"   # Get the chart file name as the first parameter
+    chartTitle1="$1" # i.e Get the chart file name as the first parameter
+    chartFileName1="$2"
 
     chartTitle2="$3"
     chartFileName2="$4"
@@ -154,7 +155,7 @@ buildHTMLReport() {
     chartTitle4="$7"
     chartFileName4="$8"
 
-    reportTitle="$9"     # Get the report title as the second parameter
+    reportTitle="$9"     # i.e Get the report title as the ninth parameter
 
 cat <<EOT > "index.html"
 <!DOCTYPE html>
@@ -164,8 +165,7 @@ cat <<EOT > "index.html"
 </head>
 <body>
     <h1 style="text-align: center;">$reportTitle</h1>
-    <h4>Last recorded build number:                    $lastRecordedBuild</h4>
-       <h4>Date of the last recoded build:             $dateOfLastRecordedBuild</h4>
+    <h4>Last updated for performance job build no. $lastRecordedBuild on $formattedTimestampOfLastBuild</h4>
     <table align="center">
         <tr> <!-- First Row -->
             <td align="center">
@@ -205,8 +205,7 @@ buildPageReport() {
     </head>
     <body>
         <h1>$reportTitle</h1>
-        <h4>Last recorded build number:                        $lastRecordedBuild</h4>
-           <h4>Date of the last recoded build:         $dateOfLastRecordedBuild</h4>
+        <h4>Last updated for performance job build no. $lastRecordedBuild on $formattedTimestampOfLastBuild</h4>
         <img src="$chartFileName" alt="Graph Image">
     </body>
     </html>
@@ -247,7 +246,7 @@ cd $WORKSPACE
 getLatestBuild
 if [ -z "$(ls -A)" ]; then
        # Calculate the starting value for the loop
-        startValue=$((latestBuild - 70))
+        startValue=$((latestBuild - 100))
 
         # Start the loop from startValue up to latestBuild
         for ((i=startValue; i<=latestBuild; i++)); do
index bede66704433f34ad8b8f44b558de66b1de86b4b..5bc3b8588fc00252e9d740b12bb787be1739bd93 100644 (file)
       - shell:
           !include-raw-escape: ./verify-jobs.sh
 
-    publishers:
-      - trigger:
-          project: 'onap-cps-performance-tests-plots'
-
 # csits for diferent projects are different so need to have special handling
 - job-template:
     name: 'onap-policy-docker-{stream}-csit-java'