Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-43603] - Add System Property, which allows disableng automat…
…ic WinSW upgrade/downgrade
  • Loading branch information
oleg-nenashev committed Apr 28, 2017
1 parent a3b83c8 commit c9e9187
Showing 1 changed file with 17 additions and 2 deletions.
Expand Up @@ -3,6 +3,7 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.FilePath;
import hudson.RestrictedSince;
import hudson.Util;
import hudson.model.Computer;
import hudson.model.Slave;
Expand All @@ -15,21 +16,35 @@
import java.io.IOException;
import java.net.URL;
import java.util.concurrent.Callable;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

/**
* Overwrite <tt>jenkins-slave.exe</tt> by new copy
*
* Overwrite <tt>jenkins-slave.exe</tt> by new copy.
*
* @author Kohsuke Kawaguchi
*/
@Extension
@Restricted(NoExternalUse.class)
@RestrictedSince("1.9")
public class SlaveExeUpdater extends ComputerListener {
/**
* MD5 checksum of jenkins-slave.exe in our resource
*/
private volatile String ourCopy;

/**
* Disables automatic update of Windows Service Wrapper on agents.
* This option may be useful if this executable is being managed outside Jenkins.
* The system property needs to be set up for master only.
* @since 1.9
*/
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "Should be accessible to System Grrovy Scripts")
static boolean DISABLE_AUTOMATIC_UPDATE = Boolean.getBoolean("org.jenkinsci.modules.windows_slave_installer.disableAutoUpdate");

@Override @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
public void onOnline(Computer c, final TaskListener listener) throws IOException, InterruptedException {
if (DISABLE_AUTOMATIC_UPDATE) return;
if (!(c instanceof SlaveComputer)) return;

final SlaveComputer sc = (SlaveComputer) c;
Expand Down

0 comments on commit c9e9187

Please sign in to comment.