The post execution failed due to the failure to upload the HTML report to the directory and the failure to record test results in the junit report

Jenkins setup:
Jenkins 2.435
Ant Plugin (ant): 497.v94e7d9fffa_b_9
OWASP Markup Formatter Plugin (antisamy-markup-formatter): 162.v0e6ec0fcfcf6
Apache HttpComponents Client 4.x API Plugin (apache-httpcomponents-client-4-api): 4.5.14-208.v438351942757
Apache HttpComponents Client 5.x API Plugin (apache-httpcomponents-client-5-api): 5.3-1.0
Authentication Tokens API Plugin (authentication-tokens): 1.53.v1c90fd9191a_b_
Bitbucket Pipeline for Blue Ocean (blueocean-bitbucket-pipeline): 1.27.9
Common API for Blue Ocean (blueocean-commons): 1.27.9
Config API for Blue Ocean (blueocean-config): 1.27.9
Blue Ocean Core JS (blueocean-core-js): 1.27.9
Dashboard for Blue Ocean (blueocean-dashboard): 1.27.9
Display URL for Blue Ocean (blueocean-display-url): 2.4.2
Events API for Blue Ocean (blueocean-events): 1.27.9
Git Pipeline for Blue Ocean (blueocean-git-pipeline): 1.27.9
GitHub Pipeline for Blue Ocean (blueocean-github-pipeline): 1.27.9
i18n for Blue Ocean (blueocean-i18n): 1.27.9
JWT for Blue Ocean (blueocean-jwt): 1.27.9
Personalization for Blue Ocean (blueocean-personalization): 1.27.9
Pipeline implementation for Blue Ocean (blueocean-pipeline-api-impl): 1.27.9
Blue Ocean Pipeline Editor (blueocean-pipeline-editor): 1.27.9
Pipeline SCM API for Blue Ocean (blueocean-pipeline-scm-api): 1.27.9
REST Implementation for Blue Ocean (blueocean-rest-impl): 1.27.9
REST API for Blue Ocean (blueocean-rest): 1.27.9
Web for Blue Ocean (blueocean-web): 1.27.9
Blue Ocean (blueocean): 1.27.9
Bootstrap 5 API Plugin (bootstrap5-api): 5.3.2-3
bouncycastle API Plugin (bouncycastle-api): 2.30.1.77-225.v26ea_c9455fd9
Branch API Plugin (branch-api): 2.1144.v1425d1c3d5a_7
Build Timeout (build-timeout): 1.32
Caffeine API Plugin (caffeine-api): 3.1.8-133.v17b_1ff2e0599
Checks API plugin (checks-api): 2.0.2
Cloud Statistics Plugin (cloud-stats): 336.v788e4055508b_
Bitbucket Branch Source Plugin (cloudbees-bitbucket-branch-source): 856.v04c46c86f911
Folders Plugin (cloudbees-folder): 6.858.v898218f3609d
Command Agent Launcher Plugin (command-launcher): 107.v773860566e2e
commons-lang3 v3.x Jenkins API Plugin (commons-lang3-api): 3.13.0-62.v7d18e55f51e2
commons-text API Plugin (commons-text-api): 1.11.0-95.v22a_d30ee5d36
Credentials Binding Plugin (credentials-binding): 642.v737c34dea_6c2
Credentials Plugin (credentials): 1311.vcf0a_900b_37c2
Declarative Pipeline Migration Assistant API (declarative-pipeline-migration-assistant-api): 1.6.2
Declarative Pipeline Migration Assistant (declarative-pipeline-migration-assistant): 1.6.2
Display URL API (display-url-api): 2.200.vb_9327d658781
Docker Commons Plugin (docker-commons): 439.va_3cb_0a_6a_fb_29
Docker Compose Build Step Plugin (docker-compose-build-step): 1.0
Docker API Plugin (docker-java-api): 3.3.4-86.v39b_a_5ede342c
Docker plugin (docker-plugin): 1.5
Docker Pipeline (docker-workflow): 572.v950f58993843
Durable Task Plugin (durable-task): 543.v262f6a_803410
ECharts API Plugin (echarts-api): 5.4.3-2
Email Extension Plugin (email-ext): 2.103
Favorite (favorite): 2.208.v91d65b_7792a_c
Font Awesome API Plugin (font-awesome-api): 6.5.1-1
Git client plugin (git-client): 4.6.0
Git plugin (git): 5.2.1
GitHub API Plugin (github-api): 1.318-461.v7a_c09c9fa_d63
GitHub Branch Source Plugin (github-branch-source): 1767.va_7d01ea_c7256
GitHub plugin (github): 1.37.3.1
Gradle Plugin (gradle): 2.9
Groovy (groovy): 457.v99900cb_85593
Gson API Plugin (gson-api): 2.10.1-15.v0d99f670e0a_7
Handy Uri Templates 2.x API Plugin (handy-uri-templates-2-api): 2.1.8-30.v7e777411b_148
HTML Publisher plugin (htmlpublisher): 1.32
Instance Identity (instance-identity): 185.v303dc7c645f9
Ionicons API (ionicons-api): 56.v1b_1c8c49374e
Jackson 2 API Plugin (jackson2-api): 2.16.1-373.ve709c6871598
Jakarta Activation API (jakarta-activation-api): 2.0.1-3
Jakarta Mail API (jakarta-mail-api): 2.0.1-3
JavaBeans Activation Framework (JAF) API (javax-activation-api): 1.2.0-6
JavaMail API (javax-mail-api): 1.6.2-9
JAXB plugin (jaxb): 2.3.9-1
Oracle Java SE Development Kit Installer Plugin (jdk-tool): 73.vddf737284550
Design Language (jenkins-design-language): 1.27.9
Java JSON Web Token (JJWT) Plugin (jjwt-api): 0.11.5-77.v646c772fddb_0
Joda Time API Plugin (joda-time-api): 2.12.6-21.vca_fd74418fb_7
JQuery3 API Plugin (jquery3-api): 3.7.1-1
JSON Path API Plugin (json-path-api): 2.8.0-21.v8b_7dc8b_1037b_
JUnit Plugin (junit): 1252.vfc2e5efa_294f
LDAP Plugin (ldap): 711.vb_d1a_491714dc
Mailer Plugin (mailer): 463.vedf8358e006b_
Matrix Authorization Strategy Plugin (matrix-auth): 3.2.1
Matrix Project Plugin (matrix-project): 822.v01b_8c85d16d2
Mina SSHD API :: Common (mina-sshd-api-common): 2.11.0-86.v836f585d47fa_
Mina SSHD API :: Core (mina-sshd-api-core): 2.11.0-86.v836f585d47fa_
OkHttp Plugin (okhttp-api): 4.11.0-157.v6852a_a_fa_ec11
PAM Authentication plugin (pam-auth): 1.10
Pipeline: Build Step (pipeline-build-step): 540.vb_e8849e1a_b_d8
Pipeline: GitHub Groovy Libraries (pipeline-github-lib): 42.v0739460cda_c4
Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 202.va_d268e64deb_3
Pipeline: Groovy Libraries (pipeline-groovy-lib): 689.veec561a_dee13
Pipeline: Input Step (pipeline-input-step): 477.v339683a_8d55e
Pipeline: Milestone Step (pipeline-milestone-step): 111.v449306f708b_7
Pipeline: Model API (pipeline-model-api): 2.2168.vf921b_4e72c73
Pipeline: Declarative (pipeline-model-definition): 2.2168.vf921b_4e72c73
Pipeline: Declarative Extension Points API (pipeline-model-extensions): 2.2168.vf921b_4e72c73
Pipeline: REST API Plugin (pipeline-rest-api): 2.34
Pipeline: Stage Step (pipeline-stage-step): 305.ve96d0205c1c6
Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 2.2168.vf921b_4e72c73
Pipeline: Stage View Plugin (pipeline-stage-view): 2.34
Pipeline Utility Steps (pipeline-utility-steps): 2.16.0
Plain Credentials Plugin (plain-credentials): 143.v1b_df8b_d3b_e48
Plugin Utilities API Plugin (plugin-util-api): 3.8.0
Pub-Sub "light" Bus (pubsub-light): 1.18
Resource Disposer Plugin (resource-disposer): 0.23
SCM API Plugin (scm-api): 683.vb_16722fb_b_80b_
Script Security Plugin (script-security): 1313.v7a_6067dc7087
SnakeYAML API Plugin (snakeyaml-api): 2.2-111.vc6598e30cc65
Server Sent Events (SSE) Gateway Plugin (sse-gateway): 1.26
SSH Credentials Plugin (ssh-credentials): 308.ve4497b_ccd8f4
SSH Build Agents plugin (ssh-slaves): 2.947.v64ee6b_f87b_c1
SSH server (sshd): 3.312.v1c601b_c83b_0e
Structs Plugin (structs): 325.vcb_307d2a_2782
Timestamper (timestamper): 1.26
Token Macro Plugin (token-macro): 400.v35420b_922dcb_
Trilead API Plugin (trilead-api): 2.133.vfb_8a_7b_9c5dd1
Variant Plugin (variant): 60.v7290fc0eb_b_cd
Pipeline (workflow-aggregator): 596.v8c21c963d92d
Pipeline: API (workflow-api): 1283.v99c10937efcb_
Pipeline: Basic Steps (workflow-basic-steps): 1042.ve7b_140c4a_e0c
Pipeline: Groovy (workflow-cps): 3837.v305192405b_c0
Pipeline: Nodes and Processes (workflow-durable-task-step): 1313.vcb_970b_d2a_fb_3
Pipeline: Job (workflow-job): 1385.vb_58b_86ea_fff1
Pipeline: Multibranch (workflow-multibranch): 770.v1a_d0708dd1f6
Pipeline: SCM Step (workflow-scm-step): 415.v434365564324
Pipeline: Step API (workflow-step-api): 639.v6eca_cd8c04a_a_
Pipeline: Supporting APIs (workflow-support): 865.v43e78cc44e0d
Workspace Cleanup Plugin (ws-cleanup): 0.45

Hello everyone!
Thank you for creating this space and I’m glad to be a part of the Jenkins community.

I have the question regarding to post action fails in the Jenkins pipeline while storing html and junit reports. Generally, I have built a custom image in Docker based on the jenkins/jenkins official image and I’ve attached the extract of it that may be concerning to the reason of occurring errors:

WORKDIR /myapp
RUN mkdir /myapp/newman
COPY postman_collections/trello-rest-api-testing.json postman_collections/trello-rest-api-testing.json
COPY postman_collections/trello-rest-api-testing.json /newman/trello-rest-api-testing.json

I’ve tried varieties of settings post action in order to solve the problem but still encounter them.

This is how my post action looks like:

post {
    always {
      publishHTML(target: [allowMissing: false, alwaysLinkToLastBuild: false, includes: '**/*.png', keepAll: true, reportDir: '/var/jenkins_home/workspace/TrelloAPI_Newman_Pipeline/newman', reportFiles: 'htmlreport.html', reportName: 'HTML Report', reportTitles: '', useWrapperFileDirectly: true])      
      step(checksName: '', $class: 'JUnitResultArchiver', testResults: '/var/jenkins_home/workspace/TrelloAPI_Newman_Pipeline/newman/report.xml')
      mail(subject: 'Build Notification - ${currentBuild.currentResult}', body: 'The body', to: 'my_email@gmail.com')
    }
  }

There is how error message looks like:

[Pipeline] { (Declarative: Post Actions)
[Pipeline] publishHTML
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at BUILD level /var/jenkins_home/workspace/TrelloAPI_Newman_Pipeline/newman to /var/jenkins_home/jobs/TrelloAPI_Newman_Pipeline/builds/111/htmlreports/HTML_20Report
ERROR: Directory '/var/jenkins_home/workspace/TrelloAPI_Newman_Pipeline/newman' exists but failed copying to '/var/jenkins_home/jobs/TrelloAPI_Newman_Pipeline/builds/111/htmlreports/HTML_20Report'.
ERROR: This is especially strange since your build otherwise succeeded.
[Pipeline] step
Recording test results
Error when executing always post condition:
Also:   org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 241cb1e1-15ed-481e-917b-6accd9c9d3dd
hudson.AbortException: No test report files were found. Configuration error?
	at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:188)
	at hudson.FilePath.act(FilePath.java:1198)
	at hudson.FilePath.act(FilePath.java:1181)
	at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:120)
	at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:160)
	at hudson.tasks.junit.JUnitResultArchiver.parseAndSummarize(JUnitResultArchiver.java:254)
	at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:177)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)

[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: No test report files were found. Configuration error?
Finished: FAILURE

The reports named “trello-rest-api-testing-2024-01-27-09-10-05-462-0.html” and “newman-run-report-2024-01-27-09-10-05-464-0.xml” are stored in this directory: /var/jenkins_home/workspace/TrelloAPI_Newman_Pipeline/newman/
While the following directory doen’t exists: /var/jenkins_home/jobs/TrelloAPI_Newman_Pipeline/builds/111/htmlreports/

What I can do to solve that?
I’d be appreciated for any advice or tips that help me to figure this out.
Thanks in advance.

Use relative paths rather than absolute paths. The directory name for the workspace used by a Jenkins job depends on the agent that runs the job and other conditions at the time the job is started. When you use an absolute path, you are assuming the job always uses the same directory and always uses the controller. Both those assumptions will be invalid at some time.

Something like:

reportDir: 'newman'

Thank you so much @MarkEWaite for reply and editing my post.
I’ve tried using relative paths the same as you mentioned above, but the issue still occurring in publish HTML block.

I wonder what the reason of copying reports as I understood correctly from this directory

‘/var/jenkins_home/workspace/TrelloAPI_Newman_Pipeline@2/newman’
to ‘/var/jenkins_home/jobs/TrelloAPI_Newman_Pipeline/builds/119/htmlreports/HTML_20Report’

while former directory contains just a few reportes and latter directory doesn’t even exist (the number of builds, for example builds/119 is the last existed directory from the absolute path).

But maybe all those things may not making any sense because I missed out one significant thing in my pipeline and now it may be clearer to figure out the correct directory.
I mean, in general I’m persuing to run the Postman collection via Newman CLI runner and this how my shell command looks like after last change:

sh ‘’’
# Run the Newman command
newman run “https://api.postman.com/collections/id_of_collection?access_key=$POSTMAN_API_KEY” --env-var “Key=$KEY” --env-var “Token=$TOKEN” -d “Data/data_typys_to_test.json” --reporters cli,htmlextra,junit --reporter-htmlextra-export Reports/HTMLextra_report.html --reporter-junit-export Reports/report.xml ‘’’

After I added the highlighted command options, I can see the generated reports in the Reports directory.
So, right now I need to figure out what the appropriate directory to mention there to not occur the error notification.

Another thing is Recording junit report’s failure.
I’ve tried to find an appropriate snippet for JUntt report, and just one that I found was - junit: Archive JUnit-formatted test results, but it just generates me this output: junit “newman/report.xml” that causes additional error messages or I’ve just used it wrongly.

I assume, that if I figure out the right directory for reports then those errors should go.