Allure TestOps plugin for Jenkins - Could not create session for closed launch

Created by George I., Modified on Thu, 02 Feb 2023 at 02:30 PM by George I.

Symptoms

  1. Allure TestOps plugin for Jenkins CI cannot upload the data and throws exception
  2. Exception's log contains the following


{"timestamp":1675262703108,"status":400,"message":"Could not create session for closed launch","errors":[]} 

16:45:03 at io.qameta.allure.jenkins.AllureUploader.startUploader(AllureUploader.java:155)

What really happens

This error is not a bug, but the flavour of working with Jenkins CI which does not provide any unique IDs (see hashes in Gitlab, Github and the others) for the builds. 


Problem is, we can only identify a build using the pipeline's name and build id, e.g. "my state of the art pipeline" #234 in Allure TestOps this combination is linked to a particular job run of a job in Allure TestOps, and job run is a part of a launch.


Now, imagine the situation when you delete a pipeline, and suddenly create a new one with the same name, i.e. "my state of the art pipeline" and the next build ID for this pipeline will be #1


This means, the plug-in will go to Allure TestOps and say "I want to create a job run for "my state of the art pipeline#1", ATO checks the database and finds that there is in fact a job run "my state of the art pipeline#1" in an old closed launch, so it denies any data upload to this launch as the closed launch es are immutable entities. As a result, you see the exception and error message "Could not create session for closed launch"


Again this is related to Jenkins only as there is no unique id for a build (e.g. for GL there are CI_BUILD_ID=3702704024, which is consecutive number across whole system, which would never repeat or CI_BUILD_REF=ef8905eb5e4ebc31463803fe87af06ad749937a3 which is unique id generally).

Solution

To overcome the issue, you need to rename the pipeline, new job, and new link in the DB between job/job-run will be created in Allure TestOps for this new pipeline name and plug-in will be able to upload the data.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article