Performance plots for CPS in Jenkins
Things to know:
Jenkins Job project name is onap-cps-performance-tests-plots (https://jenkins.nordix.org/job/onap-cps-performance-tests-plots/)
To amend the job configuration which is managed by Jenkins Job Builder, you will need to download the infra/cicd repo and commit the changes.
Relevant files in the repo:
jjb/onap/cps/cps-performance-test-jobs.yaml
Initializes the creation of the project/job
jjb/onap/cps/prepare-performance-tests-data.sh
Contains the bash script that is run by the job
jjb/onap/global-templates-onap-java.yaml
Defines the job
Configures the HTML publisher to be added to the job as a post-build
Configures the performance tests job (onap-cps-master-performance-test-java, https://jenkins.nordix.org/job/onap-cps-master-performance-test-java/) to trigger the job 'onap-cps-performance-tests-plots' after stable build
The plot is created via the HTML publisher plugin in Jenkins
Jenkins does not allow the use of CSS and Javascript by default (unless security configurations for the server are changed)
IMPORTANT: Since the performance plot job is 'Managed by Jenkins Job Builder', all changes you create manually on the Jenkins API and not via Jenkins Job Builder will be discarded and set back to the default once the job is called via the defined trigger. Therefore, all modifications in the configuration must be made via modifying the repo files in order to update it via the Jenkins Job Builder.
Creating the performance plots via the HTML publisher plugin
The job runs by executing a shell script which follows the following steps:
Gets the latest build
If the current workspace is empty (which assumes to have no previous data anymore) then collect all other build information and call subsequent methods (see below) such as building plot and building static report methods; else if the current workspace is not empty then just call the subsequent methods
getConsoleText()
parameter- latest build number(integer)
uses curl to retrieve the console text on a specific build
buildPlotForCreateOperation(), buildPlotForReadOperation(), buildPlotForUpdateOperation(), buildPlotForBatchOperation()
parameter- build number (integer)
calls the method createAndAddHeader
creates the file (if does not exist) to store the data for the plot and adds the appropriate header for the data to be added
calls the method getAndRecordDataResults
parameters - relevant console text (string), pattern to match on the console text (string), data file name (string), build number (integer)
finds the information on the console text via the pattern given to collect the relevant data information (limit value, took value)
calculates the collected data appropriately (percentage)
records the result for the plot to use on the file given - if the result is the same as the last result, i.e. same build number