Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ credentials:
- On every agent provisioned by the plugin, there is an environment
variable `OPENSTACK_PUBLIC_IP` declared with the public IP address
allocated for the machine.
- Default recurrence period for thread cleaning up agents is 10 minutes, for thread pre-creating node it is 2 minutes. These values can be modified by setting new values in milliseconds in system properties `jenkins.openstack.cleanupPeriod` and `jenkins.openstack.preCreationPeriod`. This is particularly useful in combinations with single-use agents (agents with 1 executor and retention time set to `0`) for Jenkins installation with quick and often executed jobs.

### Troubleshooting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.openstack4j.api.exceptions.ClientResponseException;
import org.openstack4j.api.exceptions.StatusCode;
import org.openstack4j.model.compute.Server;
import java.util.concurrent.TimeUnit;


import javax.annotation.Nonnull;

Expand All @@ -41,14 +43,17 @@
@Extension @Restricted(NoExternalUse.class)
public final class JCloudsCleanupThread extends AsyncPeriodicWork {
private static final Logger LOGGER = Logger.getLogger(JCloudsCleanupThread.class.getName());
private final Long recurrencePeriod;

public JCloudsCleanupThread() {
super("OpenStack slave cleanup");
recurrencePeriod = Long.getLong("jenkins.openstack.cleanupPeriod", TimeUnit.MINUTES.toMillis(10));
LOGGER.log(Level.FINE, "OpenStack cleanup recurrence period is {0}ms", recurrencePeriod);
}

@Override
public long getRecurrencePeriod() {
return MIN * 10;
return recurrencePeriod;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import hudson.Functions;
import hudson.model.TaskListener;
import hudson.model.AsyncPeriodicWork;
import java.util.concurrent.TimeUnit;


/**
* Periodically ensure enough slaves are created.
Expand All @@ -37,14 +39,17 @@
@Extension @Restricted(NoExternalUse.class)
public final class JCloudsPreCreationThread extends AsyncPeriodicWork {
private static final Logger LOGGER = Logger.getLogger(JCloudsPreCreationThread.class.getName());
private final Long recurrencePeriod;

public JCloudsPreCreationThread() {
super("OpenStack slave pre-creation");
recurrencePeriod = Functions.getIsUnitTest() ? Long.MAX_VALUE : Long.getLong("jenkins.openstack.preCreationPeriod", TimeUnit.MINUTES.toMillis(2));
LOGGER.log(Level.FINE, "OpenStack pre-creation recurrence period is {0}ms", recurrencePeriod);
}

@Override
public long getRecurrencePeriod() {
return Functions.getIsUnitTest() ? Long.MAX_VALUE : MIN * 2;
return recurrencePeriod;
}

@Override
Expand Down
Loading