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
Parent POM update and slave=>agent renaming (#1)
[JENKINS-42841] - Parent POM update and slave=>agent renaming
  • Loading branch information
oleg-nenashev committed Apr 11, 2017
1 parent 691f28c commit 8a31a65
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 39 deletions.
19 changes: 4 additions & 15 deletions pom.xml
Expand Up @@ -3,36 +3,25 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.498</version>
<version>2.20</version>
</parent>

<groupId>org.jenkins-ci.modules</groupId>
<artifactId>slave-installer</artifactId>
<version>1.6-SNAPSHOT</version>
<packaging>jenkins-module</packaging>
<name>Slave installer</name>
<description>Base abstraction for platform-specific slave installer</description>
<name>Agent installer module</name>
<description>Base abstraction for platform-specific Jenkins agent installer</description>

<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-module.git</connection>
<developerConnection>scm:git:ssh://git@github.com/jenkinsci/${project.artifactId}-module.git</developerConnection>
</scm>

<build>
<plugins>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>1.90</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>

<licenses>
<license>
<name>MIT License</name>
<url>http://jenkins-ci.org/mit-license</url>
<url>https://jenkins.io/license/</url>
</license>
</licenses>

Expand Down
@@ -1,7 +1,7 @@
package org.jenkinsci.modules.slave_installer;

/**
* Represents an anticipated failure during {@link SlaveInstaller#install(LaunchConfiguration)}
* Represents an anticipated failure during {@link SlaveInstaller#install(org.jenkinsci.modules.slave_installer.LaunchConfiguration, org.jenkinsci.modules.slave_installer.Prompter)}
* that does not require stack trace printing.
*
* <p>
Expand Down
Expand Up @@ -13,7 +13,7 @@
*/
public abstract class LaunchConfiguration {
/**
* To install a slave on a system, sometimes the installer needs to place some files (including
* To install an agent on a system, sometimes the installer needs to place some files (including
* configuration files, binaries, etc.)
*
* <p>
Expand All @@ -24,7 +24,7 @@ public abstract class LaunchConfiguration {
* <p>
* Because of this, the caller will provide a directory that allows installer to place some files. The installer
* is encourage to use platform dependent conventional locations over this storage area. Typically,
* this is the remote file system root of the slave.
* this is the remote file system root of the agent.
*/
public abstract File getStorage() throws IOException;

Expand Down
Expand Up @@ -7,14 +7,14 @@
import java.io.Serializable;

/**
* Represents platform-specific installation process of a slave agent to the service wrapper.
*
* Represents platform-specific agent installation process.
* E.g. this class is being used in {@code windows-slave-installer} module to install an agent to the service wrapper
* @author Kohsuke Kawaguchi
* @see SlaveInstallerFactory
*/
public abstract class SlaveInstaller implements Serializable {
/**
* Short one-line human readable name of what this slave installer does.
* Short one-line human readable name of what this agent installer does.
* This can be used as a GUI menu item, text in the button, etc, to
* have the user initiate the {@link #install(LaunchConfiguration,Prompter)} call.
*/
Expand All @@ -32,8 +32,8 @@ public String getDisplayName() {
public abstract Localizable getConfirmationText();

/**
* Installs the slave as a service, quit the current JVM, and let the newly installed service
* spawns and connects as a slave.
* Installs the agent as a service, quit the current JVM, and let the newly installed service
* spawns and connects as a Jenkins agent.
*
* The JVM termination is tied to the installation as some service wrappers (such as launchd)
* cannot distinguish the service installation and launch.
Expand Down
Expand Up @@ -22,7 +22,7 @@ public abstract class SlaveInstallerFactory implements ExtensionPoint {
* of the given {@link SlaveComputer}, create one and return its {@link SlaveInstaller}.
*
* @param c
* Slave that's online.
* Agent that's online.
*/
// this method was the original abstraction in 1.0, which can be now implemented on top of createIfApplicable(Channel)
public SlaveInstaller createIfApplicable(SlaveComputer c) throws IOException, InterruptedException {
Expand Down Expand Up @@ -68,9 +68,10 @@ public static SlaveInstaller createFor(Channel c) throws InterruptedException {

/**
* All the registered {@link SlaveInstallerFactory}s.
* @return collection of the extension point implementations
*/
public static ExtensionList<SlaveInstallerFactory> all() {
return Jenkins.getInstance().getExtensionList(SlaveInstallerFactory.class);
return ExtensionList.lookup(SlaveInstallerFactory.class);
}

private static final Logger LOGGER = Logger.getLogger(SlaveInstallerFactory.class.getName());
Expand Down
Expand Up @@ -11,7 +11,7 @@
import java.io.IOException;

/**
* Inserts {@link InstallerGui} to a slave that has JNLP GUI.
* Inserts {@link InstallerGui} to a Jenkins agent that has JNLP GUI.
*
* @author Kohsuke Kawaguchi
*/
Expand Down
Expand Up @@ -133,12 +133,12 @@ public void paintComponent(Graphics g) {

private Area[] buildTicker() {
Area[] ticker = new Area[barsCount];
AffineTransform toCenter = AffineTransform.getTranslateInstance(getWidth() / 2, getHeight() / 2);
AffineTransform toCenter = AffineTransform.getTranslateInstance(((double)getWidth()) / 2, ((double)getHeight()) / 2);
double fixedAngle = 2.0 * Math.PI / ((double) barsCount);

AffineTransform scaler = AffineTransform.getTranslateInstance(0,0);
{
double radius = Math.min(getWidth(), getHeight())/2;
double radius = ((double)Math.min(getWidth(), getHeight())) / 2;
double size = 45 /*from 'toBorder' above*/ + 42 /* size of the pill */ + 20 /*margin*/;
if (radius < size) {
// if our tickers are too big for the area, we need to scale it down
Expand Down
@@ -1,7 +1,9 @@
package org.jenkinsci.modules.slave_installer.impl;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.FilePath;
import hudson.Util;
import hudson.model.Slave;
import hudson.remoting.Callable;
import hudson.remoting.Channel;
import hudson.remoting.Engine;
Expand All @@ -24,14 +26,15 @@
import java.net.URL;

import static javax.swing.JOptionPane.*;
import jenkins.security.MasterToSlaveCallable;

/**
* When executed via {@link Channel#call(Callable)} on a slave,
* adds a GUI menu to install the slave as a platform-specific service.
* When executed via {@link Channel#call(Callable)} on an agent,
* adds a GUI menu to install the agent as a platform-specific service.
*
* @author Kohsuke Kawaguchi
*/
public class InstallerGui implements Callable<Void,IOException> {
public class InstallerGui extends MasterToSlaveCallable<Void,IOException> {
private final SlaveInstaller installer;
private final FilePath slaveRoot;
private final String jnlpMac;
Expand All @@ -41,8 +44,15 @@ public class InstallerGui implements Callable<Void,IOException> {

public InstallerGui(SlaveInstaller installer, SlaveComputer sc) {
this.installer = installer;
this.slaveRoot = sc.getNode().getRootPath();
jnlpMac = sc.getJnlpMac();
final Slave node = sc.getNode();
if (node == null) {
throw new IllegalStateException("The configration has change and the node for computer " +
sc.getName() + " is removed");
}

// TODO: missing null check
this.slaveRoot = node.getRootPath();
this.jnlpMac = sc.getJnlpMac();
}

public InstallerGui(SlaveInstaller installer, FilePath slaveRoot, String jnlpMac) {
Expand All @@ -52,7 +62,7 @@ public InstallerGui(SlaveInstaller installer, FilePath slaveRoot, String jnlpMac
}

/**
* To be executed on each slave JVM.
* To be executed on each agent JVM.
*/
public Void call() throws IOException {
dialog = MainDialog.get();
Expand Down Expand Up @@ -136,12 +146,13 @@ protected URL getJnlpUrl() throws MalformedURLException {

/**
* {@link LaunchConfiguration} that controls what process will be run under the service wrapper
* when the slave installation happens through GUI.
* when the agent installation happens through GUI.
*
* Conceptually, this can be thought of as a recovered memory of how this slave JVM has been started.
* This is "recovered", because we can't really reliably tell from within the slave itself, but
* nonetheless it's a piece of information scoped to the slave JVM. Hence singleton.
* Conceptually, this can be thought of as a recovered memory of how this agent JVM has been started.
* This is "recovered", because we can't really reliably tell from within the agent itself, but
* nonetheless it's a piece of information scoped to the agent JVM. Hence singleton.
*/
// XXX what is this for? no one ever writes to it
// TODO: what is this for? no one ever writes to it
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "Retained for API compaltibility")
public static LaunchConfiguration LAUNCH_CONFIG;
}

0 comments on commit 8a31a65

Please sign in to comment.