Is it possible to divide jenkins allure reports by environment? - jenkins

i have a project in jenkins that runs automated scripts named "dp10_automation". Inside this project i have allure report.
Now i created two more projects "dp10_automation_dev" and "dp10_automation_uat" that runs every day and each one triggers "dp10_automation" in different environments, one runs in DEV and the other one in UAT.
I was wondering if there is any way that inside "dp10_automation_dev" and "dp10_automation_uat" i have allure reports with the data generated in "dp10_automation" from each environment.
So far i only have allure report in "dp10_automation" that have the data from all the runs in that project, DEV and UAT.
Is it possible to configure "dp10_automation_dev" and "dp10_automation_uat" so they get the allure results from "dp10_automation"?
This is how it's working today:
This is how i want it to work:

I was able to found a solution.
In dp10_auotmation i had to modify allure path in CLI to the other projects with this line: --alluredir=/data01/oracle/product/jenkins/workspace/${worksp}/allure-results
worksp is a variable that contains workspace name where the allure results should be saved.

Related

Jenkins - Selenium : Trying to get access to testng failed.xml.? Where will this file be located when scripts are ran through jenkins

Currently it consumes so much time to rerun the filed test cases from Jenkins in My LOCAL MACHINE.And most of the test would pass locally .
Is there anything I can do to cut short the time ?
TestNG generates all of the artifacts viz.,
Html reports
Emailable report
JUnit styled xml reports
TestNG XML reports
testng-failed.xml
by default in the output directory of your project. If its not defined, TestNG defaults to test-output folder.
When tests are run via build tools such as maven wherein you leverage the surefire plugin, then this output directory gets configured to point to target/surefire-reports directory.
So your testng-failed.xml if it gets generated, will be available in your $WORKSPACE\target\surefire-reports directory (Here $WORKSPACE represents your Jenkins job's workspace)

Jenkins display multiple JMeter report(.jtl) in single graph

In Jenkins, I have configured multiple JMeter scripts using maven-jmeter-plugin in single job. After execution, each JMeter script is generating its own report file(.jtl) in results folder.
I have also configured the Performance plugin of Jenkins to display the report after JMeter script execution.
My problem is, the Performance plugin is showing different graph for each .jtl file.
Current Graph
I need to report to be shown in single graph.
Expected Graph
Is there any plugin available to achieve the same?
if no, how can I update the current plugin to achieve merged graph?
There is Merge Results plugin which can be used for combining/comparing results of up to 4 different JMeter tests.
You can install the plugin using JMeter Plugins Manager
Merge Results tool can also be used in command-line
Amend merge-results.properties (by default it's located in "bin" folder of your JMeter installation), make sure it contains these lines:
inputJtl1=TestResult_1.jtl
inputJtl2=TestResult_2.jtl
Execute Merge Results using JMeter Plugins Command Line Tool like:
JMeterPluginsCMD --tool Reporter --generate-csv CombinedResult.jtl --input-jtl merge-results.properties --plugin-type MergeResults
Configure Jenkins Performance Plugin to read CombinedResult.jtl file instead of your 2 files.

How to skip report file generation on Allure-Report jenkins plugin?

i wanna know if there is a way to skip the report file generation on allure-report jenkins plugin on post-build action.
I want this because in my scenario i generate the files on build steps already (i need to check this archives before the build ends).
But then i need to call the allure plugin on post-build actions (to jenkins know that i'm using allure and show me the reports on build and build history).
But with this the plugin automatically generate the files again and i want use that ones that i've already created and cheked on build step.
Thanks

Creating artifacts in jenkins

I have been tasked with looking into using Jenkins as a build server. So far I have managed to pull a project from git, restore the Nuget packages, build the project and run the unit tests. However I am struggling to find out how to generate the artifact.
The way the business would like to have the build server generate a zip file to a directory on the build server or a remote server for the systems team then to pick up and deploy to the relevant location. E.g. given a windows service project the built bin directory would be zipped up and put in the relevant artifact directory.
I thought that in order to do this I add an archive the artifacts post-build action. However I am getting the below error:
‘Watchdog.WinService.Monitor/bin/Release/*.zip’ doesn’t match anything:
‘Watchdog.WinService.Monitor’ exists but not
‘Watchdog.WinService.Monitor/bin/Release/*.zip’
If I look in the workspace for this project I can browse to the bin directory and see all the files so I unsure what I have done wrong.
Can someone please let me know if what I am trying to accomplish is possible, and also if our approach to using Jenkins is correct?
The problem is that you try to create the artifact using the archive artifatcs step.
But the step is to collect artifacts and show them on the job page.
That means you need to create the artifact first e.g. using a shell or batch script.
You can combine this with the Flexible Publish Plugin.
When you select this as post build step you can create a conditional action that runs the artifact archive task and as condition executes the script that creates the zip file.
So if that fails the task won't be executed. Also it may causes your job to 'fail' but that may not be the case in your job.

Hudson/Jenkins PMD Configuration

I am new to Jenkins and just started configuring it. This is what i have done till now:
Installed and configured Jenkins to display the home page. Added PMD plugin.
Set the HUDSON_HOME to a specific directory > C:\Work\Jenkins
Configured a test build to run a simple do-nothing ant script. It runs successfully
Written an independent pmdbuild.xml to run checks on a set of files in C:\myview (I am using clearcase). This xml also copies the output pmd_results.xml to the workspace directory in $HUDSON_HOME/[job-name]/workspace
Now I added the pmdbuild.xml as a step in my primary build. So my build has 2 steps:
a. Run a simple script, do-nothing.
b. Run pmdbuild.xml which generate pmd_results.xml and place it in $HUDSON_HOME/[job-name]/workspace (HARD-CODED as Jenkins PMD plugin expects the file there)
Jenkins picks up the pmd_results.xml automatically with the plugin and displays warnings and everything.
Now the problem:
If I click on a filename in the PMD results, it gives a filenotfound exception as it is looking for the source file in $HUDSON_HOME/[job-name]/workspace.
My java code files are placed in C:\myview (a clearcase snapshot view)
My question is, do I need all my code files to be present inside $HUDSON_HOME/[job-name]/workspace ?? Meaning can't I tell Jenkins to look for the PMD input files in C:\myview or any other directory instead of $HUDSON_HOME/[job-name]/workspace ??
Sorry for the extremely long description.
Jenkins expects that all the code is in the workspace. Usually Jenkins is used to check out a copy of the code into the workspace, and then runs all build steps on the Sources in the Workspace.
Might seem restraining at first, but it saves you a lot of trouble if you need to move Jenkins to another server, or create a slave instance.
So I would suggest you let Jenkins check out your code (there should be a clearcase plugin) into the workspace, and run the analysis on the checked out code.
If there are compelling reasons why your code has to stay where it is (C:\myview in your case) you can still set the workspace of your build to that directory (find this in the job configuration page, you need to click on the 'extended' button to see the option).

Resources