Skip to content

[JENKINS-47821] Prevent run-once slave from accepting more jobs.#91

Merged
pjdarton merged 1 commit intojenkinsci:masterfrom
pjdarton:prevent-reuse-of-single-use-slaves
Apr 4, 2018
Merged

[JENKINS-47821] Prevent run-once slave from accepting more jobs.#91
pjdarton merged 1 commit intojenkinsci:masterfrom
pjdarton:prevent-reuse-of-single-use-slaves

Conversation

@pjdarton
Copy link
Copy Markdown
Member

vSphereCloudSlaveTemplate

  • now provides each cloud slave it creates with its own RetentionStrategy instance, being a copy of the template's rather than being the same instance. This allows us to simplify RunOnceCloudRetentionStrategy's implementation as it's no longer shared.

RunOnceCloudRetentionStrategy

  • can no longer be shared between slaves. It now only holds state information about one slave. See also: vSphereCloudSlaveTemplate changes.
  • now overrides isAcceptingTasks to prevent further activity instead of simply setting c.setAcceptingTasks(false).
  • now triggers node termination in-line instead of spawning a new thread for it. We can do this without slowing Jenkins down because our nodes ask vSphere to delete their VMs in a separate thread. Hopefully
    this should fix the re-use bug.
  • offline reasons now given as a VSphereOfflineCause that can be localized. See also: vSphereCloudLauncher changes.

vSphereCloudSlave

  • flyweight-task refusal message can now be localized.
  • offline reasons now given as a VSphereOfflineCause that can be localized. See also: vSphereCloudLauncher changes.

vSphereCloudLauncher

  • no longer uses the special text "vSphere Plugin" in the offline reason to recognise our own offline reasons. Our code uses now VSphereOfflineCause and so we can now use instanceof to detect these
    instead of String.contains.

vSphereCloudSlaveTemplate
 - now provides each cloud slave it creates with its own
RetentionStrategy instance, being a copy of the template's rather than
being the same instance.  This allows us to simplify
RunOnceCloudRetentionStrategy's implementation as it's no longer shared.

RunOnceCloudRetentionStrategy
 - can no longer be shared between slaves. It now only holds state
information about one slave. See also: vSphereCloudSlaveTemplate
changes.
 - now overrides isAcceptingTasks to prevent further activity instead of
simply setting c.setAcceptingTasks(false).
 - now triggers node termination in-line instead of spawning a new
thread for it.  We can do this without slowing Jenkins down because our
nodes ask vSphere to delete their VMs in a separate thread.  Hopefully
this should fix the re-use bug.
 - offline reasons now given as a VSphereOfflineCause that can be
localized.  See also: vSphereCloudLauncher changes.

vSphereCloudSlave
 - flyweight-task refusal message can now be localized.
 - offline reasons now given as a VSphereOfflineCause that can be
localized.  See also: vSphereCloudLauncher changes.

vSphereCloudLauncher
 - no longer uses the special text "vSphere Plugin" in the offline
reason to recognise our own offline reasons.  Our code uses now
VSphereOfflineCause and so we can now use instanceof to detect these
instead of String.contains.
@pjdarton pjdarton added bugfix Fixes a bug (that should be in the Jenkins JIRA) WIP Not ready for merge. labels Mar 27, 2018
@pjdarton pjdarton self-assigned this Mar 27, 2018
@pjdarton pjdarton removed the WIP Not ready for merge. label Apr 4, 2018
@pjdarton pjdarton merged commit 620868e into jenkinsci:master Apr 4, 2018
@pjdarton pjdarton deleted the prevent-reuse-of-single-use-slaves branch April 4, 2018 16:14
@pjdarton
Copy link
Copy Markdown
Member Author

pjdarton commented Apr 4, 2018

I've been running a plugin with these changes in for a week now and it all seems fine to me.
At the very least, these changes are harmless.
Hopefully they've actually fixed something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug (that should be in the Jenkins JIRA)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant