-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JaCoCo for Code Coverage Reports in Pass Support #142
base: main
Are you sure you want to change the base?
Conversation
@@ -2,12 +2,13 @@ FROM eclipse-temurin:17.0.13_11-jre-jammy | |||
|
|||
WORKDIR /app | |||
|
|||
COPY target/pass-journal-loader-nih-*-exec.jar pass-journal-loader-nih-exec.jar | |||
COPY target/ /app/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better not to copy all of target into the image and instead just pick out what you need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe that copy glob pattern doesn't work cross-platform? One solution would be to update the pom such that the executable jar which is produced has a set name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this change was made for this PR. Maybe a mistaken commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the comment in the description. I will work with Tim to troubleshoot. It must have been something strange in Tim's docker env. The other modules have the same pattern of copying. The *
is used so we can leave the version in the exec jar file (there will only be one file that matches in target).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm running the latest docker which was recently update on 1/9 prior to me making this change. I tested running mvn verify
on the pass-journal-loader
module and it passed with the original docker statements. I'm now testing mvn verify
on pass-support altogether.
Side note: Docker for Windows apparently just has intermittent problems. On some versions I never experience issues and then it will update and I'm plagued with a whole variety of problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rpoet-jh @markpatton Reverted back to the previous version. I tested a couple times and it's now passing.
32ecbff
to
237b6dd
Compare
pass-data-client/pom.xml
Outdated
@@ -182,6 +182,21 @@ | |||
<groupId>org.cyclonedx</groupId> | |||
<artifactId>cyclonedx-maven-plugin</artifactId> | |||
</plugin> | |||
|
|||
<plugin> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this repeats in all modules, did you try defining this in a pluginManagement
element in pass-support/pom.xml
and then defining the plugin in the child modules (exception would be jacoco-aggregate-report
which would remain as is)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I haven't, I can give this a try and see if it works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool, this worked! Nice find!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass for me locally. I agree with Russ about checking if the pom changes can be consolidated.
Quality Gate passedIssues Measures |
@@ -91,7 +93,31 @@ | |||
</repositories> | |||
|
|||
<build> | |||
<pluginManagement> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this pom looks like it requires the plugin
declaration in the plugins
element too (line 109), you can remove the pluginManagement
element and put the <version>${jacoco-maven-plugin.version}</version>
below in the plugins
section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this 4 different ways, and here were the results:
With only the plugin without the agent in the root POM
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
</plugin>
With only the plugin in the pluginManagement tag in the root POM
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
Plugin with agent only in the root POM
Test now....
With pluginManagement and the agent in plugin tags in the root POM
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
@@ -182,6 +182,7 @@ | |||
<groupId>org.cyclonedx</groupId> | |||
<artifactId>cyclonedx-maven-plugin</artifactId> | |||
</plugin> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove these line feeds in the children pom.xml file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>${jacoco-maven-plugin.version}</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the version element here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This PR will add JaCoCo (Java Code Coverage) to the pass-support project. It is mostly the default configuration for JaCoCo. The reports are aggregated into the jacoco-aggregate-report module. In my research this is the approach to take when setting up an aggregate report to be consumed by a report service like SonarQube.
target/site/jacoco/index.html
target/site/jacoco/org.eclipse.pass.support.client
etc. These can be nagivated to by using theindex.html
Other important notes: I had to update the dockerfile:
pass-journal-loader/pass-journal-loader-nih/Dockerfile
. I couldn't get it to work any other way locally, however I'm not sure if this is the best approach.To generate the reports: