code-coverage-api-plugin icon indicating copy to clipboard operation
code-coverage-api-plugin copied to clipboard

Environment variables are not resolved in patterns

Open themanifold opened this issue 4 years ago • 4 comments

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.

themanifold avatar Mar 02 '21 09:03 themanifold

Did you check if the environment variable is actually available in the step? Did you try to echo the path?

uhafner avatar Mar 03 '21 19:03 uhafner

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 .

themanifold avatar Mar 03 '21 19:03 themanifold

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?

uhafner avatar Mar 04 '21 07:03 uhafner

Ok, confirmed. Environment variables are not resolved in patterns.

themanifold avatar Mar 04 '21 07:03 themanifold

will you assign me this issue?

YashSalve695 avatar Jan 09 '23 13:01 YashSalve695

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?

uhafner avatar Jan 09 '23 14:01 uhafner

@YashSalve695 Sorry, seems that I already fixed that in #512.

uhafner avatar Jan 09 '23 16:01 uhafner

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: @.***>

YashSalve695 avatar Jan 09 '23 16:01 YashSalve695

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...

uhafner avatar Jan 09 '23 16:01 uhafner