jenkinsci / allure-plugin

Allure Jenkins Plugin
https://plugins.jenkins.io/allure-jenkins-plugin/
Other
84 stars 66 forks source link

Occasionally got PermissionError when build starts #331

Open Gatorix opened 1 year ago

Gatorix commented 1 year ago

Jenkins and plugins versions report

Environment the script doesn't work Jenkins 2.361.4 Allure Jenkins Plugin 2.30.3

What Operating System are you using (both controller, and any agents involved in the problem)?

win service 2008

Reproduction steps

I just have one computer to run the web UI tests, when i build continuous(like 10 times using different parameters), occasionally when build starts, the jenkins console give me the PermissionError and says couldn't delete the allure-dir,because some other program using it.

Here's my pytest params: pytest.main( [f'-m {run_marks}', '--clean-alluredir', '--alluredir', allure_dir, '-n', multiprocess, '--reruns', reruns, '--reruns-delay', reruns_delay, '--dashboard'] )

Expected Results

continuous build in jenkins success

Actual Results

got PermissionError

Anything else?

when the testcases finished, jenkins allure-plugin start to generate allure report, but when the report finished, occasionally allure-dir folder is still in use, at the same time next build starts, and the pytest params has "--clean-alluredir". i guess this is the reason, so i add following code:

try:
    shutil.rmtree(allure_dir)
except PermissionError:
    time.sleep(5)

when build starts, try to remove allure-dir first, if got PermissionError, force wait 5 second, but this seems doesn't work.

could anyone help me.