HTML Publisher pipeline syntax

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

HTML Publisher pipeline syntax

Steven Heuertz
Hi,

I'm working with a pipeline that builds a bunch of npm packages in a monorepo. Our commands are run on each package individually, so we have individual test/lint results in each package. I'm trying to pull all of the results into a single html report. To make this easier, I'm copying the reports into a central folder, and trying to build the report from there:
pipelineContext.echo "Publishing jest results"
pipelineContext.sh(script: 'mkdir coverage-results')
List<String> reportTitles = []
changeSet.each {
String coverageDir = it.packageJson.name.replace('/', '_')
pipelineContext.sh(script: "mkdir -p coverage-results/${coverageDir}")
pipelineContext.sh(script: "cp -R ${it.path}/coverage/lcov-report/* coverage-results/${coverageDir}")
reportTitles << "'${it.packageJson.name}'"
}
pipelineContext.publishHTML(
target: [allowMissing : false,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : 'coverage-results/**/*',
reportFiles : 'index.html',
includes : '**/*,**/**/*',
reportName : 'Jest Coverage',
reportTitles : reportTitles.join(',')]
)
The issue I'm having is that for some reason, it's not seeing the folder, I guess?
ERROR: Specified HTML directory '/home/****rh/workspace/ckages_task_test-jest-publishing/coverage-results/**/*' does not exist.

I went into our build node and checked, and that directory does exist, so I'm unsure where my issue lies.

Thanks,
Steve

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/53090af4-a733-448e-b9fc-d78a36436817n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: HTML Publisher pipeline syntax

Richard Bywater-3
Looks like the issue is with your reportDir. In your case I think you'd want this set to simply "coverage-results" assuming there is a index.html in that directory. If the index.html only exists in the subdirectories of coverage-results (which I think might be the case?) then reportFiles should be something like "*/index.html" or "**/index.html" (exact syntax alludes my brain right this second).

Note that if you are wanting to keep the reportFiles and reportTitles in sync, you'll probably want to explicitly add each directory as a reportFile (e.g. "coverageDir1/index.html,coverageDir2/index.html,coverageDir3/index.html)

Hope that helps - I have only had a casual look in between my day job jobs but hopefully it gets you in the right direction.

Richard.

On Tue, 25 Aug 2020 at 09:43, Steven Heuertz <[hidden email]> wrote:
Hi,

I'm working with a pipeline that builds a bunch of npm packages in a monorepo. Our commands are run on each package individually, so we have individual test/lint results in each package. I'm trying to pull all of the results into a single html report. To make this easier, I'm copying the reports into a central folder, and trying to build the report from there:
pipelineContext.echo "Publishing jest results"
pipelineContext.sh(script: 'mkdir coverage-results')
List<String> reportTitles = []
changeSet.each {
String coverageDir = it.packageJson.name.replace('/', '_')
pipelineContext.sh(script: "mkdir -p coverage-results/${coverageDir}")
pipelineContext.sh(script: "cp -R ${it.path}/coverage/lcov-report/* coverage-results/${coverageDir}")
reportTitles << "'${it.packageJson.name}'"
}
pipelineContext.publishHTML(
target: [allowMissing : false,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : 'coverage-results/**/*',
reportFiles : 'index.html',
includes : '**/*,**/**/*',
reportName : 'Jest Coverage',
reportTitles : reportTitles.join(',')]
)
The issue I'm having is that for some reason, it's not seeing the folder, I guess?
ERROR: Specified HTML directory '/home/****rh/workspace/ckages_task_test-jest-publishing/coverage-results/**/*' does not exist.

I went into our build node and checked, and that directory does exist, so I'm unsure where my issue lies.

Thanks,
Steve

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/53090af4-a733-448e-b9fc-d78a36436817n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAAy0hwfEW9HQAfHuU0u%3D1XNrK1GLJnRUH2HRngsPqjMJGibEWA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: HTML Publisher pipeline syntax

Marco Sacchetto
In reply to this post by Steven Heuertz
According to the (non-optimal, I agree) documentation, where the pipeline steps options do match those on the UI in the freestyle jobs,  `includes` does not accept multiple entries.
Yours anyway are not needed both because "pick up all the files in the folder" is the default setting, and because your two ant patterns are equivalent, since ** in Ant covers multiple
directories levels.
Anyway, at least for me, trying to incorporate multiple test reports into the same entry in Jenkins never ended up well, constantly ended up with bad formatting or limitations. But
it may just have been my bad since I configured that some time ago, but I do remember quite some pain with the tabs that should have contained the different index pages.
If you wish to continue with your idea I'd rather recommend you generated a main index page linking to all of the `index.html` in the subfolders, that should keep stuff much simpler.

Il giorno lunedì 24 agosto 2020 alle 23:43:12 UTC+2 [hidden email] ha scritto:
Hi,

I'm working with a pipeline that builds a bunch of npm packages in a monorepo. Our commands are run on each package individually, so we have individual test/lint results in each package. I'm trying to pull all of the results into a single html report. To make this easier, I'm copying the reports into a central folder, and trying to build the report from there:
pipelineContext.echo "Publishing jest results"
pipelineContext.sh(script: 'mkdir coverage-results')
List<String> reportTitles = []
changeSet.each {
String coverageDir = it.packageJson.name.replace('/', '_')
pipelineContext.sh(script: "mkdir -p coverage-results/${coverageDir}")
pipelineContext.sh(script: "cp -R ${it.path}/coverage/lcov-report/* coverage-results/${coverageDir}")
reportTitles << "'${it.packageJson.name}'"
}
pipelineContext.publishHTML(
target: [allowMissing : false,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : 'coverage-results/**/*',
reportFiles : 'index.html',
includes : '**/*,**/**/*',
reportName : 'Jest Coverage',
reportTitles : reportTitles.join(',')]
)
The issue I'm having is that for some reason, it's not seeing the folder, I guess?
ERROR: Specified HTML directory '/home/****rh/workspace/ckages_task_test-jest-publishing/coverage-results/**/*' does not exist.

I went into our build node and checked, and that directory does exist, so I'm unsure where my issue lies.

Thanks,
Steve

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3334ebe9-88aa-4dc0-94f8-0fdfad316801n%40googlegroups.com.