-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When multiple Docker clouds are defined, the plugin will always create agents from the first available cloud, not allowing to distribute the load on all the clouds that are defined. Possible solutions to this issue are: - Docker Swarm Standalone, which is deprecated - Docker Engine Swarm API, which is not supported by docker-plugin. This changes adds a setting that enables randomizing the order in which Docker clouds are tried when creating a new agent.
- Loading branch information
Showing
3 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/io/jenkins/docker/DockerGlobalConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.jenkins.docker; | ||
|
||
import jenkins.model.GlobalConfiguration; | ||
import org.kohsuke.stapler.DataBoundSetter; | ||
import hudson.Extension; | ||
import hudson.ExtensionList; | ||
|
||
@Extension | ||
public class DockerGlobalConfiguration extends GlobalConfiguration { | ||
public static DockerGlobalConfiguration get() { | ||
return ExtensionList.lookupSingleton(DockerGlobalConfiguration.class); | ||
} | ||
|
||
private boolean randomizeCloudsOrder = false; | ||
|
||
public DockerGlobalConfiguration() { | ||
load(); | ||
} | ||
|
||
public boolean getRandomizeCloudsOrder() { | ||
return randomizeCloudsOrder; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setRandomizeCloudsOrder(boolean value) { | ||
randomizeCloudsOrder = value; | ||
save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/resources/io/jenkins/docker/DockerGlobalConfiguration/config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"> | ||
<f:section title="Docker Plugin Configuration"> | ||
<f:entry title="Randomize clouds order" field="randomizeCloudsOrder" | ||
description="During node provisioning, randomize the order clouds are tried."> | ||
<f:checkbox/> | ||
</f:entry> | ||
</f:section> | ||
</j:jelly> |