Java web start agents

Operations Center provides a mechanism to share agents (formerly called "slaves") across client masters. This works across wide variety of launcher types, including the "Launch slave agents via Java Web Start" launcher type (also known as JNLP launcher.)

A critical difference between normal JNLP agents and JNLP agents in Operations Center concerns how the JVM used to connect to the client master gets its JVM options.

  • In a stand-alone Jenkins environment the JVM options for the agent’s JVM depend on the launch method:

    • If launched using the "Launch" button, then the JVM Options specified within the launcher’s "Advanced" section of the "Configuration" screen for the agent will be injected into the JNLP file and will be used for launching the agent.

    • If launched using the command line, then the JVM Options will be those specified on the command line, and any JVM Options specified within the launcher’s "Advanced" section of the "Configuration" screen for the agent will be ignored.

  • In Operations Center a shared agent / shared cloud using the JNLP launcher will behave the same way as a stand-alone Jenkins environment for the JVM used to connect to Operations Center, but when leasing the agent out to client masters _a second JVM is started using the JVM Options specified within the launcher’s "Advanced" section of the "Configuration" screen for the agent.

When you configure a shared agent with a JNLP launcher, the resulting shared agent will show you a Java Web Start launch button.

slave
Figure 1. Launch screen

You’ll now go to a machine you plan to use as an agent, start a browser, access this same page, then click the launch button to start Java Web Start. You should see a small GUI window. When the GUI window says "Connected", it indicates that the computer is now under the control of Operations Center.

The UI in Operations Center changes to indicate that the shared agent is available to be leased to client masters:

slave ready
Figure 2. Agent ready to lease

On supported platforms, this GUI gives you a menu option to install it as a service, enabling it to start automatically upon machine boot-up. You’ll want to do install as a service if you plan to use the computer as an agent permanently.

Installing JNLP agent without GUI

If the computer you plan to use as an agent does not have a GUI, you can run the command indicated in the above UI. See the Jenkins Wiki page for a discussion of the same topic.

Bundling multiple JNLP agents as shared cloud

When you have multiple identical JNLP agents, it becomes tedious to configure shared agents individually. To simplify this, Operations Center provides a "Java Web Start agents" cloud type in the shared cloud setting.

To configure a shared cloud in this manner, select "Java Web Start agents" as the cloud type and fill in the details of the JNLP agent:

cloud config
Figure 3. JNLP cloud config

All the JNLP agents connected to this share the exact same settings.

When you finish the settings, you’ll see the same Java Web Start launch button as with the JNLP shared agent:

cloud ready
Figure 4. JNLP cloud ready

The difference here is that you can launch an agent from this button multiple times on different computers, and they are all grouped into one big pool. The "current pool size" section indicates the number of JNLP agents that are currently controlled by Operations Center, including ones that are leased to client masters.

JNLP agent workflow

JNLP agents work a little differently in Operations Center compared to stand-alone Jenkins. This section describes those differences.

In stand-alone Jenkins, a JNLP client connects to a master, establishes a channel, becomes an agent, and starts taking orders from the master to perform builds and other tasks.

In Operations Center, the same JNLP client connects to a Operations Center and establishes a channel in the exact same manner, but it does not become an agent. Instead, Operations Center keeps this client idle, until it decides to lease it to a client master. At that point, Operations Center orders the JNLP client to launch a separate JNLP client as a child process, then have it connect to the master to which the agent was leased.

This new child process connects to a client master, establishes a channel, becomes an agent, and starts taking orders from this master, until the lease ends.

One of the implications of this design is that an agent computer must be reachable by all the client masters to which it might be leased.

Copyright © 2010-2020 CloudBees, Inc.Online version published by CloudBees, Inc. under the Creative Commons Attribution-ShareAlike 4.0 license.CloudBees and CloudBees DevOptics are registered trademarks and CloudBees Core, CloudBees Flow, CloudBees Flow Deploy, CloudBees Flow DevOps Insight, CloudBees Flow DevOps Foresight, CloudBees Flow Release, CloudBees Accelerator, CloudBees Accelerator ElectricInsight, CloudBees Accelerator Electric Make, CloudBees CodeShip, CloudBees Jenkins Enterprise, CloudBees Jenkins Platform, CloudBees Jenkins Operations Center, and DEV@cloud are trademarks of CloudBees, Inc. Most CloudBees products are commonly referred to by their short names — Accelerator, Automation Platform, Flow, Deploy, Foresight, Release, Insight, and eMake — throughout various types of CloudBees product-specific documentation. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Jenkins is a registered trademark of the non-profit Software in the Public Interest organization. Used with permission. See here for more info about the Jenkins project. The registered trademark Jenkins® is used pursuant to a sublicense from the Jenkins project and Software in the Public Interest, Inc. Read more at www.cloudbees.com/jenkins/about. Apache, Apache Ant, Apache Maven, Ant and Maven are trademarks of The Apache Software Foundation. Used with permission. No endorsement by The Apache Software Foundation is implied by the use of these marks.Other names may be trademarks of their respective owners. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this content, and CloudBees was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this content, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.