code-coverage-api-plugin
code-coverage-api-plugin copied to clipboard
Environment variables are not resolved in patterns
Hello,
I'm trying to create a coverage report using this plugin. Here's the pipeline syntax I use:
publishCoverage adapters: [coberturaAdapter('test_results/coverage/pytest-core-unittests-coverage-${BUILD_NUMBER}.xml')]
where BUILD_NUMBER is just your standard Jenkins environment variable.
The coverage report is generated using the pytest-cov plugin which produces XML compatible with cobertura: https://coverage.readthedocs.io/en/latest/cmd.html?highlight=Cobertura#xml-reporting-coverage-xml
What I see in the Jenkins console:
Publishing Coverage report....
No reports were found
What I expect to see: One report found.
I have confirmed that the XML file exists, as I store it as a Jenkins build artifact.
Did you check if the environment variable is actually available in the step? Did you try to echo the path?
Yes, I know the path exists because Jenkins is able to archive it.
On Wed, 3 Mar 2021, 19:21 Ullrich Hafner, [email protected] wrote:
Did you check if the environment variable is actually available in the step? Did you try to echo the path?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jenkinsci/code-coverage-api-plugin/issues/183#issuecomment-789991998, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHPGEX3QTRGE6NFBGAIQNTTB2D2JANCNFSM4YORTNUA .
But that does only mean that the archive step is able to resolve environment variables. This is something that needs to be added programmatically in a plugin, I am not sure if that is supported already. Can you try without environment variable? (Or by resolving the variable before the step?
Ok, confirmed. Environment variables are not resolved in patterns.
will you assign me this issue?
Yes, I can do that. Are you using the plugin on your own or why are you interested in this issue?
The implementation should be quite similar to https://github.com/jenkinsci/warnings-ng-plugin/blob/master/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/ReportScanningTool.java#L154.
The only problem ist that I am currently refactoring the code in #512. That means any new code should be based on that branch. Do you already have your development environment set up?
@YashSalve695 Sorry, seems that I already fixed that in #512.
Ok.
If you get any beginner issue next time.. I would like to help
On Mon, 9 Jan 2023, 10:13 pm Ullrich Hafner, @.***> wrote:
@YashSalve695 https://github.com/YashSalve695 Sorry, seems that I already fixed that in #512 https://github.com/jenkinsci/code-coverage-api-plugin/pull/512.
— Reply to this email directly, view it on GitHub https://github.com/jenkinsci/code-coverage-api-plugin/issues/183#issuecomment-1375930976, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARBOIUSABVLB2Q6XJQAW7RTWRQ54JANCNFSM4YORTNUA . You are receiving this because you were mentioned.Message ID: @.***>
Yes, when the #512 is released then a lot of small things should be required. But until then it does not make sense to help...