Jenkins Test Result History - jenkins

At the moment we have our Jenkins Jobs configured so the Test Results get written to a specific file and then published. The problem with this is the next time the build runs it replaces the previous test results. This means the link the the email notification points to the same test results file and we are not able to debug why the tests failed.
Is there a way to create test results with a unique name like a time stamp and publish these?

You can use the archive function of Jenkins. Add the post build action "Archive artifacts" to your job and give the filename pattern of your test file. Now the file is archived for every job. The link in the mail notification may still point to the newest file, but you can download the archived files in the web interface of Jenkins (if you go to a specific build, you see all archived artifacts of that build).

Related

Jmeter jenkins doesnt store past builds result

I setup my jmeter to run on jenkins daily. Everything works fine except the past jenkins build automatically flip to fail status the next day when a new schedule run kicks in and it also removed the past build results. I attached a screenshot of the build history. For sep 12, they were all green.
Anyone experience this issue or know which area I can look into?
My goal is to try to compare with past build result and send an email if the performance didn't pass criteria.
I am happy to share more details.
Unfortunately we're not telepathic enough to guess the reason by looking at a single screenshot.
Double check your job configuration, especially location of the JMeter's jtl result files as it might be the case you're storing them in current job folder instead of workspace
Double check your Performance Plugin configuration, especially "thresholds" section
Inspect Console Output for the previous/latest builds
Check jenkins.log file for any suspicious entries

Using Jira to trigger a Jenkins build

I have a strange use case here I know, but basically I have a CI / CD solution that starts be a developer creating a zip file of a set of resources. This zip is then sucked in to SVN via the tools internal programs.
Currently the solution works, using the FSTRigger to poll for an updated zip. When it see it, then the process kicks off and we're happy.
going forward I'd like the builds to be triggered by a Jira job reaching a certain status and have been looking at the Jira trigger plugin. It looks like it will help satisfy me with regards the triggering of the build and passing data from Jira to Jenkins to use for delivery notes etc. However it would still depend on the zip file being in a certain location to be picked up.
I'm wondering if it's possible to attach the zip to the Jira task and then as part of the task status hitting 'build' kick off the Jenkins job and copy the zip so it can be picked up by by the Jenkins build task.
for reasons to complex to mention, checking the zip into svn first won't really work.
When your Jenkins build is triggered via jira-trigger-plugin, you would be able to access JIRA_ISSUE_KEY environment variable that contains the JIRA issue which status has changed.
With the JIRA issue key, you can hit Get Issue JIRA REST API to retrieve the issue details. The issue details would contain the attachment information, which would then be able to be used for downloading the zip in Jenkins.

jenkins space: how not to store all jars in all builds

I have a couple jenkins builds that run every second hour or so, since jenkins stores the data and metadata for the builds this takes up a lot of space but most of that space goes to the jars that are stored.
Jenkins keeps every jar for every build and most of them don't really change from one build to another so I was wondering if there's a way to
a) store only the jars that changed, which would be the best case scenario, something using symbolic links or something;
b) don't store the jars at all, we don't really check the builds by using the jars as a debug tool so we don't really need them. Of course I could put a cron to erase them, but I'd prefer do that from inside jenkins if possible.
Jenkins only stores jars and such if you have an "Archive the artifacts" post-build action in your job. If you don't have this, it doesn't archive anything except for logs and results.
If you're wanting to store SOME stuff but just not the jars, you can change the Excludes line in the advanced setting of the "Archive the artifacts" post-build action.

Jenkins - API to update build status

I am using Jenkins to build my project. When the build is ready, the product is downloaded and tested. I would like to notify Jenkins that the build is tested and then to notify it about the test results. I would like that once jenkis has created the build, it is available to download, but that there is a message like 'build is tested' or 'tests passed/failed'.
Uploading a file with this kind of information would be OK as well.
Is it possible with jenkins?
I do not want to integrate my tests into jenkins build process: they take too long and use too much resources (and must be carried out on a separate machine with dedicated environment)
You can setup 2 promotions on the build job. Call one "Tests Passed" and another "Tests Failed".
The promotions will add different colored "star" icons to the individual builds to indicate which promotions had been executed. All build artifact downloads and other build information is available regardless of promotion status.
If you will be "notifying" Jenkins manually, you just need to manually execute a promotion. You can also access a permalink to the last successful promoted build's artifacts like http://[JENKINS_URL]/job/[JOB_NAME]/[PROMOTION_NAME]/artifact
If you want your test process to notify Jenkins automatically, you would need to trigger it by sending a call to the webpage. You can use CURL to request http://[JENKINS_URL]/job/[JOB_NAME]/[JOB_NUMBER]/Promotion/[PROMOTION_NAME]/build. Of course you need to know the number of the build that you are trying to mark for promotion. Alternatively, you can use the "Last Successful" permalink like http://[JENKINS_URL]/job/[JOB_NAME]/lastBuild/promotion/[PROMOTION_NAME]/build

Jenkins - trigger post-build action based on parameter

I have a Jenkins job set up that builds my iOS Xcode project and archives the resulting IPA file. In addition, I have also installed the Testflight plugin to upload the IPA file as a post-build action. That's all working fine, and my question is this...is there a way to only trigger that post-build action based on the result of a boolean build parameter. There are certain cases where I need to be able to build an IPA and I don't want it to be uploaded to Testflight. If I could just add a checkbox at the start of the build that determines whether or not to upload to Testflight that would be ideal.
Thanks.
Flexible Publish plugin supports Run Conditions. Never tried it myself, but heard good things about it from others.
If you don't mind setting up a separate Jenkins job to do the IPA file upload, you could use the Parameterized Trigger plugin.

Resources