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

JENKINS-63607 Do not disconnect agent when remoting doesn't match #192

Conversation

jonesbusy
Copy link
Contributor

I'm putting this PR as draft because I have dependency with #189 which change the descriptor to a field and it include some similar changes. Will need to be rebased when merged to main branch

Partially fix JENKINS-63607 to not put the agent offline if there is any mismatch between remoting version

This PR doesn't add any comparison mechanism but only a similar option to not disconnect the agent and keep it online

It also miss some automated test (At least unit for the new field, but I want to check if it's possible to test using JenkinsRule and DumbSlave)

Testing done

  • Ensure retro compatibility to disconnect by default (view and when plugin is upgraded)
  • Tested with same and different remoting version to ensure correct behavior

The new field

version_column_disconnect_remoting

The default behavior to disconnect the agent

remoting_disconnect

Node is not disconnected with option is selected

remoting_mismatch_not_disconnect

Submitter checklist

@jonesbusy jonesbusy force-pushed the feature/JENKINS-63607-no-not-disconnect-when-remoting-doesnt-match branch from d9f08a5 to 8e205fd Compare October 29, 2023 07:52
@mawinter69
Copy link
Contributor

mawinter69 commented Oct 29, 2023

This while PR is not necessary. When a monitor is ignored (it is not checked in the node monitoring config), then the markOffline method in core will not take an agent offline (https://github.com/jenkinsci/jenkins/blob/551043065bc672102fb8b07e8008f959ebc566fa/core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java#L229) . The fact that the java version monitor has an explicit disconnect, is because it has additional configuration. When you put a monitor to ignored it has no configuration and default values will be used. Here you just add configuration to allow to prevent disconnection.
The node monitor overview will always show all monitors (at least for admins), regardless if they are enabled or not.
Also the current change means a regression. You put the logic when to take an agent offline from the monitor method of the descriptor to the data method of the monitor. The problem is that the data method is only called in the UI, i.e. when someone opens the node overview page .../computer. So if someone never does this, the agent will never be taken offline.
This wrong behaviour can be seen for the diskspace monitors as well which I try to fix with jenkinsci/jenkins#8593

@mawinter69
Copy link
Contributor

BTW, the Java version monitor is doing this also wrong.

@jonesbusy
Copy link
Contributor Author

This while PR is not necessary. When a monitor is ignored (it is not checked in the node monitoring config), then the markOffline method in core will not take an agent offline (https://github.com/jenkinsci/jenkins/blob/551043065bc672102fb8b07e8008f959ebc566fa/core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java#L229) . The fact that the java version monitor has an explicit disconnect, is because it has additional configuration. When you put a monitor to ignored it has no configuration and default values will be used. Here you just add configuration to allow to prevent disconnection. The node monitor overview will always show all monitors (at least for admins), regardless if they are enabled or not. Also the current change means a regression. You put the logic when to take an agent offline from the monitor method of the descriptor to the data method of the monitor. The problem is that the data method is only called in the UI, i.e. when someone opens the node overview page .../computer. So if someone never does this, the agent will never be taken offline. This wrong behaviour can be seen for the diskspace monitors as well which I try to fix with jenkinsci/jenkins#8593

Thanks for this detailed report. I will close the PR then

@jonesbusy jonesbusy closed this Oct 29, 2023
@jonesbusy jonesbusy deleted the feature/JENKINS-63607-no-not-disconnect-when-remoting-doesnt-match branch October 29, 2023 10:36
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.

2 participants