KostyaSha / yet-another-docker-plugin

Jenkins Yet Another Docker Plugin
https://plugins.jenkins.io/yet-another-docker-plugin
MIT License
83 stars 48 forks source link

is there ability to specify jnlp tunnel? #238

Open alexeygrigorovaurea opened 6 years ago

alexeygrigorovaurea commented 6 years ago

Hi I have jenkins running in k8s container and it expose jnlp port on different dns name and port. Is there any way in this plugin to specify a tunnel url for slave to connect to? i.e i have http://jenkins.xxx.com:80 but jnpl is at jenkins-jnlp.xxx.com:31067 this option is there with all cloud plugins and permanents slave also but i cannot find it with yadp image

KostyaSha commented 6 years ago

java -jar slave.jar --help You can specify any slave.jar option in jnlp docker launcher

alexeygrigorovaurea commented 6 years ago

I tried that, but it dosn't work so i set image

this param was promoted to SLAVE_OPTS , but then it is not affecting anything. I also checked remoting.jar sources and didn't found any mentions of usage of SLAVE_OPTS

###################################
JENKINS_URL = http://docker-host.xxx.com:8898/
JENKINS_USER = 
JENKINS_HOME = c:
COMPUTER_URL = computer/DWEU1-71f9df4161c2/
COMPUTER_SECRET = 25940ba0fe4ec88b90eb61a15707f856081d8277935937520b129c33847e7ca3
NO_CERTIFICATE_CHECK = true
JAVA_OPTS = 
SLAVE_OPTS = -connectTo docker-host.xxx.com:8899
###################################
Invoke-WebRequest -Uri http://docker-host.xxx.com:8898//jnlpJars/slave.jar -Outfile c:/slave.jar
java  -jar c:/slave.jar -noReconnect -noCertificateCheck -jnlpUrl http://docker-host.xxx.com:8898//computer/DWEU1-71f9df4161c2//slave-agent.jnlp -secret 25940ba0fe4ec88b90eb61a15707f856081d8277935937520b129c33847e7ca3
Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
Jul 10, 2018 9:12:22 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up slave: DWEU1-71f9df4161c2
Jul 10, 2018 9:12:22 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Jul 10, 2018 9:12:22 PM hudson.remoting.Engine startEngine
WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\ContainerAdministrator\.jenkins\cache\jars
Jul 10, 2018 9:12:22 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://docker-host.xxx.com:8898/]
Jul 10, 2018 9:12:22 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Jul 10, 2018 9:12:23 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
  Agent address: docker-host.xxx.com
  Agent port:    50000
  Identity:      5d:24:ec:13:76:0c:54:0b:7f:8c:33:cf:8d:ce:91:78

as i compare to permanent slave jnlp tunnel appears in slave-agent.jnlp file

<jnlp codebase="http://docker-host.xxx.com/computer/CXMonitor_permanent/" spec="1.0+">
    <information>
        <title>Agent for CXMonitor_permanent</title>
        <vendor>Jenkins project</vendor>
        <homepage href="https://jenkins-ci.org/"/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.8+"/>
        <jar href="http://docker-host.xxx.com/jnlpJars/remoting.jar"/>
    </resources>
    <application-desc main-class="hudson.remoting.jnlp.Main">
        <argument>cf699910a203d69660b8ec1534ce17c92ac9aa27eddf02d6f100d728fe04c4a4</argument>
        <argument>CXMonitor_permanent</argument>
        <argument>-tunnel</argument>
        <argument>docker-host.xxx.com:8899</argument>
        <argument>-workDir</argument>
        <argument>c:\jenkins</argument>
        <argument>-internalDir</argument>
        <argument>remoting</argument>
        <argument>-url</argument>
        <argument>http://docker-host.xxx.com/</argument>
    </application-desc>
</jnlp>

similar generated by yadp, has no -tunnel argument

<jnlp codebase="http://docker-host.xxx.com:8898/computer/DWEU1-60ac7715c21f/" spec="1.0+">
    <information>
        <title>Agent for DWEU1-60ac7715c21f</title>
        <vendor>Jenkins project</vendor>
        <homepage href="https://jenkins-ci.org/"/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.8+"/>
        <jar href="http://docker-host.xxx.com:8898/jnlpJars/remoting.jar"/>
    </resources>
    <application-desc main-class="hudson.remoting.jnlp.Main">
        <argument>bb2b67be5f0aef46d2c50128b0438d6f9686015fd092d6c18092b39d83372670</argument>
        <argument>DWEU1-60ac7715c21f</argument>
        <argument>-url</argument>
        <argument>http://docker-host.xxx.com:8898/</argument>
    </application-desc>
</jnlp>