{"id":548,"date":"2017-02-13T14:51:46","date_gmt":"2017-02-13T13:51:46","guid":{"rendered":"http:\/\/balazspuskas.com\/?p=548"},"modified":"2017-02-13T14:51:46","modified_gmt":"2017-02-13T13:51:46","slug":"jenkins-ci-and-slaves-in-easy-way","status":"publish","type":"post","link":"http:\/\/balazspuskas.com\/?p=548","title":{"rendered":"Jenkins CI and slaves in easy way."},"content":{"rendered":"<p>I had a difficulty to make our Jenkins CI faster. Cloud instance was limited, i wanted to make master-slaves workaround.<br \/>\nAll systems are Ubuntu Linux OS. I searched whole internet to how make it works.<br \/>\nProblems:<br \/>\n-custom environment on Linux<br \/>\n-custom gcc compilers<br \/>\n-custom precompiled subsystems<\/p>\n<p>Many of the worked separately by docker container. I had to make them connect each other.<\/p>\n<p>Well, i find a lot of article, how to make it easily:\u00a0Launch slave agents on Unix machines via SSH.<br \/>\nWell, it is almost good, but not. My system is docker system. I don&#8217;t want port forward SSH port to a specific docker container. And i need one click solution.<br \/>\nOther way: ,,Launch agent via execution of command on the master&#8221;. Still SSH. And i should write bash script or else.<br \/>\n,,Let Jenkins control this Windows slave as a Windows service&#8221; Well, i have Linux&#8230;<\/p>\n<p>There is another option: ,,<b>Launch agent via Java Web Start&#8221;<br \/>\n<\/b><\/p>\n<p>Well, let me show its description:<br \/>\n,,Allows an agent to be launched using <a href=\"https:\/\/en.wikipedia.org\/wiki\/Java_Web_Start\" target=\"_blank\">Java Web Start<\/a>.<br \/>\nIn this case, a JNLP file must be opened on the agent machine, which will establish a TCP connection to the Jenkins master.<br \/>\nThis means that the agent need not be reachable from the master; the agent just needs to be able to reach the master. If you have enabled security via the <i>Configure Global Security<\/i> page, you can customise the port on which the Jenkins master will listen for incoming JNLP agent connections.<br \/>\nBy default, the JNLP agent will launch a GUI, but its also possible to run a JNLP agent without a GUI, e.g. as a Window service.&#8221;<\/p>\n<p>It says windows service.. And GUI. I don&#8217;t have GUI only terminal window. And ofc Linux.<br \/>\nBut this is what i needed. This is not for windows only. \u00a0It can work with linux.<br \/>\nThe node view doesn&#8217;t show if it will work on linux.<br \/>\nThis is what it shows:<\/p>\n<h1>Agent asdf<\/h1>\n<p>Connect agent to Jenkins one of these ways:<\/p>\n<ul>\n<li><a id=\"jnlp-link\" href=\"http:\/\/lnxt3.dynamic.nsn-net.net:8080\/computer\/asdf\/slave-agent.jnlp\"><img decoding=\"async\" src=\"http:\/\/lnxt3.dynamic.nsn-net.net:8080\/static\/f3fa04b4\/images\/webstart.gif\" alt=\"launch agent\" \/><\/a> Launch agent from browser<\/li>\n<li>Run from agent command line:\n<pre>java -jar <a href=\"http:\/\/lnxt3.dynamic.nsn-net.net:8080\/jnlpJars\/slave.jar\">slave.jar<\/a> -jnlpUrl http:\/\/&lt;computer&gt;:8080\/computer\/asdf\/slave-agent.jnlp -secret &lt;secret_code&gt;<\/pre>\n<\/li>\n<\/ul>\n<p>You can see, ,,launch in browser&#8221; -&gt; i have terminal window&#8230; ,,run agent from command line&#8221;-&gt;well, try it on linux.<br \/>\nIt works. But not at first..<\/p>\n<p>I had to download slave.jar file inside docker container.<br \/>\nhttp:\/\/&lt;computer&gt;:8080\/jnlpJars\/slave.jar<\/p>\n<p>After that it started working. It could communicate through port 50000.<\/p>\n<p>What is the conclusion? Am I dumb?<\/p>\n<p>I don&#8217;t think so. I read the description and if they talk about windows solution, it does not means it will run in linux. If other tutorials always show SSH ways on Linux, why would i try java web start option. When our expert make port forward because our cloud security does not allow http get\/put (this is what goes on port 22, if you chose that option -as i remember-) connection to make slaves. I could be smarter and think java is OS independent. I am now. But why don&#8217;t they write a good description? Like: ,,Launch agent via Java: It will run a java vm on your slave\u00a0(whether linux\/windows) and will use its\u00a0resource. Workspace directory will be created next to slave.jar file. Can be started by browser or command line on your slave.&#8221; That&#8217;s all. Full information what you need.\u00a0And show a working command on view, that download slave.jar automatically, also..<\/p>\n<p>This is how I imagine a clever description for this functionality. But i don&#8217;t wonder. I saw some Eclipse CHE description. Start commands had not worked on new versions \ud83d\ude00 But they posted it on their website. \ud83d\ude00 Of course you could start it manually. But why do I have to do everything manually? Simplification please&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a difficulty to make our Jenkins CI faster. Cloud instance was limited, i wanted to make master-slaves workaround. All systems are Ubuntu Linux OS. I searched whole internet to how make it works. Problems: -custom environment on Linux -custom gcc compilers -custom precompiled subsystems Many of the worked separately by docker container. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-548","post","type-post","status-publish","format-standard","hentry","category-egyeb"],"_links":{"self":[{"href":"http:\/\/balazspuskas.com\/index.php?rest_route=\/wp\/v2\/posts\/548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/balazspuskas.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/balazspuskas.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/balazspuskas.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/balazspuskas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=548"}],"version-history":[{"count":1,"href":"http:\/\/balazspuskas.com\/index.php?rest_route=\/wp\/v2\/posts\/548\/revisions"}],"predecessor-version":[{"id":549,"href":"http:\/\/balazspuskas.com\/index.php?rest_route=\/wp\/v2\/posts\/548\/revisions\/549"}],"wp:attachment":[{"href":"http:\/\/balazspuskas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/balazspuskas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=548"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/balazspuskas.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}