Skip to content

Set jenkins.javaAgent in TestRuntimeMojo #1138

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

Merged
merged 2 commits into from
May 5, 2025
Merged

Conversation

basil
Copy link
Member

@basil basil commented May 5, 2025

Downstream of jenkinsci/maven-hpi-plugin#741. Fixes jenkinsci/bom#5000 (comment) by reimplementing #1130 in maven-hpi-plugin, thus preserving the calling convention expected by PCT.

Testing done

See jenkinsci/maven-hpi-plugin#741.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Comment on lines +117 to +118
<!-- Filled in by "maven-hpi-plugin" with "-javaagent:/path/to/mockito-core-<version>.jar" -->
<jenkins.javaAgent />
Copy link
Member Author

Choose a reason for hiding this comment

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

Will make the failure mode softer in the future by simply skipping a Java agent in the case that, for whatever reason, maven-hpi-plugin doesn't fill in this value.

Comment on lines -506 to -516
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
Copy link
Member Author

@basil basil May 5, 2025

Choose a reason for hiding this comment

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

This is handled via TestRuntimeMojo, which contains:

@Mojo(name = "test-runtime", requiresDependencyResolution = ResolutionScope.TEST)

Comment on lines -782 to -796
<execution>
<id>configureJavaAgent</id>
<goals>
<goal>run</goal>
</goals>
<phase>initialize</phase>
<configuration>
<target>
<condition else="" property="jenkins.javaAgent" value="-javaagent:${org.mockito:mockito-core:jar}">
<isset property="org.mockito:mockito-core:jar" />
</condition>
</target>
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
Copy link
Member Author

Choose a reason for hiding this comment

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

Reimplemented with Java code in jenkinsci/maven-hpi-plugin#741.

@basil basil marked this pull request as ready for review May 5, 2025 21:21
@basil basil merged commit d48a58d into jenkinsci:master May 5, 2025
1 of 2 checks passed
MarkEWaite added a commit to MarkEWaite/configuration-as-code-plugin that referenced this pull request May 6, 2025
The plugin bill of materials fails to run tests with parent
pom versions 5.13 through 5.15.  Details are available in
jenkinsci/bom#5000 (comment) and
in the related pull requests:

* jenkinsci/maven-hpi-plugin#741
* jenkinsci/plugin-pom#1138
timja pushed a commit to jenkinsci/configuration-as-code-plugin that referenced this pull request May 6, 2025
The plugin bill of materials fails to run tests with parent
pom versions 5.13 through 5.15.  Details are available in
jenkinsci/bom#5000 (comment) and
in the related pull requests:

* jenkinsci/maven-hpi-plugin#741
* jenkinsci/plugin-pom#1138
MarkEWaite added a commit to MarkEWaite/pipeline-milestone-step-plugin that referenced this pull request May 7, 2025
The plugin bill of materials fails to run tests with parent
pom versions 5.13 through 5.15.  Details are available in
jenkinsci/bom#5000 (comment) and
in the related pull requests:

* jenkinsci/maven-hpi-plugin#741
* jenkinsci/plugin-pom#1138

Needs to be labeled `developer` so that a new release is delivered
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants