Skip to content

Conversation

@jgreffe
Copy link
Contributor

@jgreffe jgreffe commented Aug 8, 2025

jenkinsci/workflow-api-plugin#417 changes the LogStorageFactory API in an incompatible way, see that PR for details and justification.
This PR adapts to the upstream changes, and will need to be released roughly at the same time as that PR.
We are opening this draft PR to make sure the maintainers here are ok with the general idea and to help coordinate the release.

This PR applies the following changes:

  • Updates OtelLogStorageFactory to use the Describable/Descriptor pattern, which requires some minor changes due to OtelLogStorageFactory no longer being a singleton @Extension
  • Updates the baseline in pom.xml as required by the workflow-api update, which requires some changes to fix dependency issues and upper bounds conflicts. We can file these updates as a standalone PR if desired.

As the upstream changes allow users to configure functionality equivalent to otel.logs.mirror_to_disk=true mechanism in a generic way (other than the caveat of no longer being able to print a link to the observability platform into the logs dynamically), the current plugin won't need the Tee* classes anymore and the logging code can be simplified if desired. We can handle this simplification in a followup PR if you are interested.

Testing done

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 demonstrate the feature works or the issue is fixed

Comment on lines 63 to 64
<jenkins.baseline>2.504</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.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.

This bump is required due to the workflow-api bump.
We can file this bump as a separate PR if requested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems it's already been filed: #1168

Comment on lines +195 to +204
<exclusion>
<!-- provided by org.jenkins-ci.plugins:jackson2-api -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<!-- provided by org.jenkins-ci.plugins:jackson2-api -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix some "require upper bounds" maven issues.

pom.xml Outdated
Comment on lines 528 to 531
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</exclusion>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to remove this exclusion due to https://issues.jenkins.io/browse/JENKINS-73355.
This dependency is mandatory for testcontainers.
This library has a test scope and is not bundled in the final HPI.

* <p>
* See <a href="https://github.com/jenkinsci/pipeline-cloudwatch-logs-plugin/blob/pipeline-cloudwatch-logs-0.2/src/main/java/io/jenkins/plugins/pipeline_cloudwatch_logs/PipelineBridge.java">Pipeline Cloudwatch Logs - PipelineBridge</a>
*/
@Extension
Copy link
Contributor Author

@jgreffe jgreffe Aug 8, 2025

Choose a reason for hiding this comment

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

With the Describable/Descriptor pattern, the @Extension is not supported anymore on the factory.

System.setProperty("org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.USE_WATCHING", "true");
}

@Inject
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't inject anymore with the @Extension removal.

Copy link
Contributor

Choose a reason for hiding this comment

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

We use @Inject ~30 times in this plugin, is there a problem now with @Inject?

Copy link
Member

Choose a reason for hiding this comment

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

It was only a problem here because LogStorageFactory is no longer an ExtensionPoint after the upstream changes and so the implementations are no longer singleton @Extensions and so dependency injection doesn't work. In other contexts, @Inject is fine.

Comment on lines -116 to -118
@PostConstruct
public void postConstruct() {
this.tracer = jenkinsControllerOpenTelemetry.getDefaultTracer();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Useless with the @Extension removal.

}

@Extension()
@Symbol("openTelemetry")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Describable/Descriptor pattern, the symbol "openTelemetry" is used for CasC configuration.

@NonNull
@Override
public String getDisplayName() {
return "OpenTelemetry";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Displayed in the new "Pipeline logging" global UI configuration, see jenkinsci/workflow-api-plugin#417

Comment on lines -52 to -54
static OtelLogStorageFactory get() {
return ExtensionList.lookupSingleton(OtelLogStorageFactory.class);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unused method.

System.setProperty("org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.USE_WATCHING", "true");
}

@Inject
Copy link
Contributor

Choose a reason for hiding this comment

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

We use @Inject ~30 times in this plugin, is there a problem now with @Inject?

@dwnusbaum
Copy link
Member

@kuisathaverat Cyrille took a look at this and seems to be ok with it, but what do you think? Are you ok with the general idea of the API changes? Are you interested in having us help clean up all of the Tee* classes and related code in a followup PR, along with adjusting the documentation to explain the new way to achieve the same behavior?

@cyrille-leclerc
Copy link
Contributor

Are you interested in having us help clean up all of the Tee* classes and related code in a followup PR, along with adjusting the documentation to explain the new way to achieve the same behavior?

With great pleasure, thanks for the offer.

@dwnusbaum
Copy link
Member

@cyrille-leclerc Ok, does that mean you're planning on merging and releasing this PR? We'll need a coordinated release of this PR soon after jenkinsci/workflow-api-plugin#417 is released to avoid widespread breakage. We can mention the incompatibility in release notes and tell people not to update, but we'd want the release of this PR to go out roughly the same day as the upstream PR, or at least the next day. Let us know how you'd prefer to coordinate that.

Copy link
Contributor

@kuisathaverat kuisathaverat left a comment

Choose a reason for hiding this comment

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

this is a breaking change in the log API, I want to test it manually to verify any configuration is affected.

@jgreffe
Copy link
Contributor Author

jgreffe commented Sep 17, 2025

Hello @kuisathaverat , did you have the chance to check the changes? 🙏🏼

@jgreffe jgreffe closed this Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants