Skip to content

Conversation

@Seros
Copy link

@Seros Seros commented Jan 9, 2026

Merges #138, #147 and salemove#1 to fix https://issues.jenkins.io/browse/JENKINS-71693

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

@Seros Seros requested a review from a team as a code owner January 9, 2026 08:59
Copy link

@jakub-bochenski jakub-bochenski left a comment

Choose a reason for hiding this comment

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

LGTM, except it seems there are some random imports in LogstashConfiguration.java
Can you please remove them?

Also can you please restore the previous state after setting LogstashConfiguration.getInstance().setEnableGlobally(true);

@jakub-bochenski
Copy link

Thanks for the PR

@Seros Seros requested a review from jakub-bochenski January 16, 2026 09:39
@Seros
Copy link
Author

Seros commented Jan 16, 2026

We are running the artifact build from this PR in our Jenkins and can I confirm the issue is fixed without any other errors coming up

@jakub-bochenski
Copy link

@Seros great, thanks!

@jakub-bochenski
Copy link

Hmm I see there are some conflicts now, that's a bit strange.

Can you please rebase it on latest master?

@Seros
Copy link
Author

Seros commented Jan 16, 2026

I don't see any conflicts and the branch is up-to-date

@jakub-bochenski
Copy link

That's weird, GH tells me This branch cannot be rebased due to conflicts

Vladimir Kuznichenkov and others added 10 commits January 16, 2026 14:29
According to the [doc][1] to get an instance of a config
we should use `ExtensionList.lookupSingleton(<your GlobalConfiguration subclass>.class)`

Added additional test to handle a remote logging from
workflow pipeline job.

Initially started to check the code because we got exceptions
on agents when using Git checkout:

```
java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
	at jenkins.model.Jenkins.get(Jenkins.java:816)
	at jenkins.model.GlobalConfiguration.all(GlobalConfiguration.java:75)
	at jenkins.plugins.logstash.LogstashConfiguration.getInstance(LogstashConfiguration.java:289)
	at jenkins.plugins.logstash.LogstashWriter.getIndexerDao(LogstashWriter.java:162)
	at jenkins.plugins.logstash.LogstashWriter.getDaoOrNull(LogstashWriter.java:201)
	at jenkins.plugins.logstash.LogstashWriter.<init>(LogstashWriter.java:82)
	at jenkins.plugins.logstash.pipeline.GlobalDecorator.decorate(GlobalDecorator.java:41)
	at org.jenkinsci.plugins.workflow.log.TaskListenerDecorator.decorateAll(TaskListenerDecorator.java:230)
	at org.jenkinsci.plugins.workflow.log.TaskListenerDecorator$DecoratedTaskListener.getOutputStream(TaskListenerDecorator.java:267)
	at org.jenkinsci.plugins.workflow.log.OutputStreamTaskListener$Default.getLogger(OutputStreamTaskListener.java:116)
	at org.jenkinsci.plugins.workflow.log.TaskListenerDecorator$CloseableTaskListener.getLogger(TaskListenerDecorator.java:307)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2801)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2762)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2757)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2051)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2063)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:1115)
	at hudson.plugins.git.GitAPI.revParse(GitAPI.java:419)
```

[1]: https://javadoc.jenkins-ci.org/jenkins/model/GlobalConfiguration.html
According to the [doc][1] to get an instance of a config
we should use `ExtensionList.lookupSingleton(<your GlobalConfiguration subclass>.class)`

Added additional test to handle a remote logging from
workflow pipeline job.

Initially started to check the code because we got exceptions
on agents when using Git checkout:

```
java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
	at jenkins.model.Jenkins.get(Jenkins.java:816)
	at jenkins.model.GlobalConfiguration.all(GlobalConfiguration.java:75)
	at jenkins.plugins.logstash.LogstashConfiguration.getInstance(LogstashConfiguration.java:289)
	at jenkins.plugins.logstash.LogstashWriter.getIndexerDao(LogstashWriter.java:162)
	at jenkins.plugins.logstash.LogstashWriter.getDaoOrNull(LogstashWriter.java:201)
	at jenkins.plugins.logstash.LogstashWriter.<init>(LogstashWriter.java:82)
	at jenkins.plugins.logstash.pipeline.GlobalDecorator.decorate(GlobalDecorator.java:41)
	at org.jenkinsci.plugins.workflow.log.TaskListenerDecorator.decorateAll(TaskListenerDecorator.java:230)
	at org.jenkinsci.plugins.workflow.log.TaskListenerDecorator$DecoratedTaskListener.getOutputStream(TaskListenerDecorator.java:267)
	at org.jenkinsci.plugins.workflow.log.OutputStreamTaskListener$Default.getLogger(OutputStreamTaskListener.java:116)
	at org.jenkinsci.plugins.workflow.log.TaskListenerDecorator$CloseableTaskListener.getLogger(TaskListenerDecorator.java:307)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2801)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2762)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2757)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2051)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2063)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:1115)
	at hudson.plugins.git.GitAPI.revParse(GitAPI.java:419)
```

`getIndexerDao` should return `null` if configuration isn't
yet available. In that case `getDaoOrNull` will return `null`
as it is expected.

[1]: https://javadoc.jenkins-ci.org/jenkins/model/GlobalConfiguration.html
@Seros Seros force-pushed the fix-global-config branch from fbc6997 to 6f83856 Compare January 16, 2026 13:30
@Seros
Copy link
Author

Seros commented Jan 16, 2026

Sorry for some reason my git behaved weird. Now the rebase worked

@jakub-bochenski jakub-bochenski merged commit 696c827 into jenkinsci:master Jan 16, 2026
15 checks passed
@jakub-bochenski
Copy link

Alright, thanks again.

I think automatic releases should pick this up.

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.

3 participants