Skip to content
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

separate surefire/failsafe directory for report on each matrix step #1463

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ runs:
steps:
- name: build controllers project
shell: bash
env:
CURRENT_INDEX: ${{ matrix.current_index }}
run: |
cd spring-cloud-kubernetes-controllers
.././mvnw -T 1C -U clean install
.././mvnw -DCURRENT_INSTANCE=${CURRENT_INDEX} -T 1C -U clean install
cd ..
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ runs:

./mvnw -s .settings.xml \
-DtestsToRun=${TEST_ARG[@]} \
-DCURRENT_INSTANCE=${CURRENT_INDEX} \
-e clean install \
-P 'sonar, run-on-github-actions' -nsu --batch-mode \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the profile since we don't need it anymore

-P sonar -nsu --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ runs:

./mvnw -s .settings.xml \
-DtestsToRun=${tests_to_run_in_current_index} \
-DCURRENT_INSTANCE=${CURRENT_INDEX} \
-e clean install \
-P 'sonar, run-on-github-actions' -nsu --batch-mode \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the profile since we do not need it anymore

-P sonar -nsu --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
Expand Down
17 changes: 15 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@
</scm>

<properties>
<!-- in our github actions run, we save surefire/failsafe reports in a path that looks like this: -->
<!-- surefire-report/1/... , where "1" (and other numbers like this) are the index of the github matrix -->
<!-- where this is running. When outside the github actions, for example locally/jenkins, we will simply store -->
<!-- the reports in a directory: "surefire-reports/one/..." -->
<CURRENT_INSTANCE>one</CURRENT_INSTANCE>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here about what this is used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

<!-- Dependency Versions -->
<mockito-inline.version>4.8.1</mockito-inline.version>
<spring-cloud-commons.version>4.0.5-SNAPSHOT</spring-cloud-commons.version>
<spring-cloud-config.version>4.0.5-SNAPSHOT</spring-cloud-config.version>
<spring-cloud-bus.version>4.0.1</spring-cloud-bus.version>
<spring-cloud-contract.version>4.0.5-SNAPSHOT</spring-cloud-contract.version>

<maven-surefire-plugin.version>3.1.0</maven-surefire-plugin.version>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't know why we have this one here, I want to simplify as much as possible related to surefire/failsafe - just remove it, build passes just fine without it


<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
<maven-checkstyle-plugin.failsOnViolation>true
</maven-checkstyle-plugin.failsOnViolation>
Expand Down Expand Up @@ -205,8 +208,18 @@
<includes>
<include>${testsToRun}</include>
</includes>
<reportsDirectory>${project.build.directory}/surefire-reports/${CURRENT_INSTANCE}</reportsDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my previous observation that the hangs in the builds are related to surefie/failsafe still stands, this still happens.

In the initial approach, I hoped that upgrading the plugins will solve this problem - and I was wrong. My builds in some other branches proved this.

The other observations I made looking at the failures, is that all of them hang somewhere around logs like these (not verbatim):

will use .../surefire-reports directory for saving test results

So may be this is related to a folder/file being accessed from various matrix steps at the same time. At least, this is my best guess. If that is the case, what if we save the reports in folder structure like so:

surefire-reports/<CURRENT_INDEX>...

this way, may be they will not step on each others feet. Semantically, for our builds, this is irrelevant, we only need those reports for when we find out the test times, but out searches are against an entire directory that comes before surefire-reports, so the searches still work, as seen from the logs:

searching for filename: org.springframework.cloud.kubernetes.client.discovery.it.KubernetesClientDiscoveryClientIT.txt

found file: ./spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-discovery-it/target/failsafe-reports/2/org.springframework.cloud.kubernetes.client.discovery.it.KubernetesClientDiscoveryClientIT.txt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this solution makes the branches that I maintain to pass on all of them (and it was not the case before)

<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<reportsDirectory>${project.build.directory}/failsafe-reports/${CURRENT_INSTANCE}</reportsDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
23 changes: 0 additions & 23 deletions spring-cloud-kubernetes-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,6 @@

</build>

<profiles>
Copy link
Contributor Author

@wind57 wind57 Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this solution did not help :( I tested it against a few branches that I maintain and I still get things to block on the failsafe/surefire plugins sometimes. As such, I am dropping the idea. There is good news though...

<profile>
<id>run-on-github-actions</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.1.2</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down
Loading