Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64676

Launch Agent via command on master but connect via JNLP/Websocket

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: core, remoting
    • Labels:
      None
    • Environment:
      Jenkins 2.263.2
      Windows 10 1909 64-bit
    • Similar Issues:

      Description

      We are currently running Jenkins agents in VirtualBox VMs on the master. We are investigating running agents on Windows Sandbox for a built-in lite VM that allows GUI testing.

      I've tried "Launch agent via execution of a command on the master", but this appears to only work when that commands results in stdin/stdout of the agent being connected. This isn't possible with Windows Sandbox unless we got some sort of hacky reverse shell working somehow.

      We'd like Jenkins to run a command to start the VM/Sandbox then connect back via JNLP or WebSockets, but as far as I can tell these two launch methods are mutually exclusive.

        Attachments

          Activity

          Hide
          jthompson Jeff Thompson added a comment -

          Do you have any further information about what errors or messages you see?

          I'm not familiar with any issues like this, so we would need to identify the cause and make sure we understand what would need to be done.

          Show
          jthompson Jeff Thompson added a comment - Do you have any further information about what errors or messages you see? I'm not familiar with any issues like this, so we would need to identify the cause and make sure we understand what would need to be done.
          Hide
          mgrochowalski Matt Grochowalski added a comment -

          If I switch the launch method to "Launch Agent by connecting it to the master", I run the following command and it establishes a successful websocket connection:

          java -jar agent.jar -jnlpUrl https://URLHERE/computer/Windows_Sandbox/slave-agent.jnlp -secret SECRETHERE -workDir "d:\Jenkins"

          But if I switch the launch method to "Launch agent via execution of a command on the master", running that same command with the same jnlpUrl gives:

          INFO: Locating server among https://URLHERE/
          Jan 20, 2021 4:16:26 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
          INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
          Jan 20, 2021 4:16:31 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver isPortVisible
          WARNING: connect timed out
          Jan 20, 2021 4:16:31 PM hudson.remoting.jnlp.Main$CuiListener error
          SEVERE: https://URLHERE/ provided port:33559 is not reachable
          java.io.IOException: https://URLHERE/ provided port:33559 is not reachable

          As far as I understand this isn't supported now. I marked the type as "Improvement" instead of "Feature Request" since these are existing components. Please change if it should be type "Feature Request".

          Show
          mgrochowalski Matt Grochowalski added a comment - If I switch the launch method to "Launch Agent by connecting it to the master", I run the following command and it establishes a successful websocket connection: java -jar agent.jar -jnlpUrl https://URLHERE/computer/Windows_Sandbox/slave-agent.jnlp -secret SECRETHERE -workDir "d:\Jenkins" But if I switch the launch method to "Launch agent via execution of a command on the master", running that same command with the same jnlpUrl gives: INFO: Locating server among https://URLHERE/ Jan 20, 2021 4:16:26 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping] Jan 20, 2021 4:16:31 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver isPortVisible WARNING: connect timed out Jan 20, 2021 4:16:31 PM hudson.remoting.jnlp.Main$CuiListener error SEVERE: https://URLHERE/ provided port:33559 is not reachable java.io.IOException: https://URLHERE/ provided port:33559 is not reachable As far as I understand this isn't supported now. I marked the type as "Improvement" instead of "Feature Request" since these are existing components. Please change if it should be type "Feature Request".
          Hide
          jthompson Jeff Thompson added a comment -

          I rarely use "Launch agent via execution of a command on the master" and I've got too many things in progress at the moment to spin it up and try it out. However, the error message you shared looks like something different.

          The agent does a simple, quick port verification before proceeding with the rest of the connection. See the line containing "isPortVisible". It looks like this connection fails. Maybe there is something about your systems or networking configuration that means your URL / port is not reachable when using the other mechanism.

          Show
          jthompson Jeff Thompson added a comment - I rarely use "Launch agent via execution of a command on the master" and I've got too many things in progress at the moment to spin it up and try it out. However, the error message you shared looks like something different. The agent does a simple, quick port verification before proceeding with the rest of the connection. See the line containing "isPortVisible". It looks like this connection fails. Maybe there is something about your systems or networking configuration that means your URL / port is not reachable when using the other mechanism.

            People

            Assignee:
            jthompson Jeff Thompson
            Reporter:
            mgrochowalski Matt Grochowalski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: