Skip to content

Spring cleaning - #3148

Merged
SylvainJuge merged 3 commits into
elastic:mainfrom
SylvainJuge:spring-cleaning
Jun 1, 2023
Merged

Spring cleaning#3148
SylvainJuge merged 3 commits into
elastic:mainfrom
SylvainJuge:spring-cleaning

Conversation

@SylvainJuge

@SylvainJuge SylvainJuge commented May 24, 2023

Copy link
Copy Markdown
Member

What does this PR do?

  • initial intent is to remove global spring versions as described in Add support for Spring 6.x and Spring Boot 3.x #2942 (see below)
  • cleanup quartz plugin: rename modules for consistency + remove common quartz module dependency on quartz2.
  • remove spring-boot version property (only used for packaging a test app).
  • remove unused version.logback

The spring.version in the main pom.xml is used for two things:

  • in test applications like benchmarks, where it's meant to be the current latest version of spring framework, in this case using any version will usually do and keeping it to the latest is fine
  • as a "secondary" test dependency, for example in the quartz plugin, there is a spring-based integration that we need to test. In theory we should test for all spring-versions, but from experience the latest is usually fine.

There are a few other version properties that are used in a similar way:

  • version.jetty-server
  • version.okhttp (this one is also used outside test code, defining it in instrumentation plugin might be better than globally).
  • version.h2

Having a single property here makes updating and reviewing dependabot PRs easier, so it might be relevant to keep that.
Maybe it could be enough to add a small comment in the pom.xml to make it more obvious that those are not actual dependencies and only used for testing outside of production code.

Checklist

  • Decide on which approach to take to remove spring.version property and similar ones (see above)
  • This is something else

@ghost

ghost commented May 24, 2023

Copy link
Copy Markdown

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview previewSnapshots

Expand to view the summary

Build stats

  • Start Time: 2023-05-31T14:39:16.308+0000

  • Duration: 14 min 6 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run benchmark tests : Run the benchmark tests.

  • run jdk compatibility tests : Run the JDK Compatibility tests.

  • run integration tests : Run the Agent Integration tests.

  • run end-to-end tests : Run the APM-ITs.

  • run windows tests : Build & tests on windows.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Comment thread apm-agent-builds/pom.xml
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>apm-quartz-1-plugin</artifactId>
<artifactId>apm-quartz-plugin-1</artifactId>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[for reviewer] using same naming convention as grpc

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apm-quartz-job-plugin</artifactId>
<artifactId>apm-quartz</artifactId>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[for reviewer] using apm-quartz as module name for all the other sub-modules, the -plugin sufix is kept for the instrumentation plugins (with an extra per-version suffix to fit the naming conventions).

<name>${project.groupId}:${project.artifactId}</name>

<properties>
<version.quartz>2.3.1</version.quartz>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[for reviewer] the common part was compiled with quartz 2.x and contained some code that was only used with 2.x plugin, however making sure the common part is compiled with 1.x only is safer.

Comment on lines -25 to -37
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${version.spring}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>${version.quartz}</version>
<scope>test</scope>
</dependency>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[for reviewer] those were only required for quartz 2.x

@@ -124,24 +107,6 @@ void testJobWithResult() throws SchedulerException {
assertThat(transaction.getResult()).isEqualTo("this is the result");
}

@Test
void testDirectoryScan() throws SchedulerException, IOException {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[for reviewer] this was only relevant for quartz 2.x (hence the Assumptions call at start of test method.

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- explicit version required as bom will not cover plugins, only dependencies -->
<version>${version.spring-boot}</version>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[for reviewer] the global spring-boot version property was removed because only used here in test application, thus in test code.

Comment thread pom.xml
<version.jackson>2.14.2</version.jackson>
<version.junit>5.9.1</version.junit>
<version.junit.vintage>4.13.2</version.junit.vintage>
<version.logback>1.2.3</version.logback>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[for reviewer] this wasn't used anymore.

@SylvainJuge
SylvainJuge marked this pull request as ready for review May 30, 2023 08:33
@github-actions

Copy link
Copy Markdown

/test

@SylvainJuge
SylvainJuge requested a review from a team May 30, 2023 08:34
@SylvainJuge
SylvainJuge merged commit 571b06e into elastic:main Jun 1, 2023
@SylvainJuge
SylvainJuge deleted the spring-cleaning branch June 1, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants