tag:blogger.com,1999:blog-35936317746625022432024-03-13T03:32:38.031-07:00Logic StrategiesDerek Luhttp://www.blogger.com/profile/06680076628209687280noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-3593631774662502243.post-87321841906745722032016-09-13T08:31:00.002-07:002016-09-13T08:31:42.466-07:00Set up Jenkins Slave (on Linux)<h3>
1<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; font-weight: normal;">
</span><!--[endif]-->Create
a jenkins user on the Slave</h3>
<div class="MsoNoSpacing">
<strong><span style="font-weight: normal;"><span style="font-family: inherit;">Create a
jenkins user and a password using the following command on the slave server [your_slave_server]</span><span style="font-family: "calibri" , sans-serif;"><o:p></o:p></span></span></strong></div>
<div class="MsoNoSpacing">
<br /></div>
<br />
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: dash-small-gap windowtext .5pt; mso-border-insideh: .5pt dash-small-gap windowtext; mso-border-insidev: .5pt dash-small-gap windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: dashed windowtext 1.0pt; mso-border-alt: dash-small-gap windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 458.75pt;" valign="top" width="612"><div class="MsoNoSpacing">
<span style="font-family: "courier new"; font-size: 10.0pt;">sudo
adduser jenkins --shell /bin/bash<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span style="font-family: "courier new"; font-size: 10pt; letter-spacing: 0.15pt;">sudo
passwd jenkins</span></div>
</td></tr>
</tbody></table>
<div>
<br /></div>
<div>
<div class="MsoNoSpacing">
<strong><span style="font-family: "calibri" , sans-serif; font-weight: normal;">By default this
creates user jenkins at /home/jenkins<o:p></o:p></span></strong></div>
<div class="MsoNoSpacing">
<strong><span style="font-family: "calibri" , sans-serif; font-weight: normal;">Now login
as user jenkins and create a slave directory under jenkins.<o:p></o:p></span></strong></div>
<div class="MsoNoSpacing">
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: dash-small-gap windowtext .5pt; mso-border-insideh: .5pt dash-small-gap windowtext; mso-border-insidev: .5pt dash-small-gap windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: dashed windowtext 1.0pt; mso-border-alt: dash-small-gap windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 458.75pt;" valign="top" width="612"><div class="MsoNoSpacing">
<span style="font-family: "courier new"; font-size: 10.0pt;">mkdir
~/slave</span></div>
</td></tr>
</tbody></table>
</div>
<div>
<h3>
<span style="font-stretch: normal; font-variant-numeric: normal;">2</span><span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; font-weight: normal;"> </span><!--[endif]-->Setting
up Slaves jenkins on the Master Using Username and Password<o:p></o:p></h3>
</div>
<div>
<a href="https://www.blogger.com/null" name="_Toc461197201"></a><br />
<div class="MsoNoSpacing">
<a href="https://www.blogger.com/null" name="_Toc461197201"><span style="background-color: white; color: #494949; letter-spacing: 0.15pt;"><span style="font-family: inherit;">Login in to Jenkins Web Console as an administrator and go to
Dashboard –> Manage Jenkins –> Manage Nodes</span></span><strong style="font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;"><span style="font-weight: normal;"><o:p></o:p></span></strong></a></div>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;"><br /></span></div>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;"></span></div>
<div class="MsoNoSpacing">
Click on the New Node, then <span style="background: white; color: #494949; letter-spacing: 0.15pt;">give it a name, select the “Permanent
Agent” option and click ok.<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<br /></div>
<br />
<div class="MsoNoSpacing" style="display: inline !important;">
<a href="https://www.blogger.com/null" name="_Toc461197201"></a><a href="https://www.blogger.com/null" name="_Toc461197201"></a>In the New Node Page, Click Add button besides Credentials field to create the
credential, which is the jenkins user and password to the slave server. The
password is encrypted in the jenkins system.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6S1yZlJJLfy6pAtUJBYi69a7b2Px0mQ_7JQhzZUKn65H8-Bdkppy3Q-MFv9Pv5WlUH7FTjG4bE1OX9gykddRE22bZQJiVA3x0SeVsof3-huHTa_u8V260F4pQD9PHtEl8eS0CM5mjfDY/s1600/new_node.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6S1yZlJJLfy6pAtUJBYi69a7b2Px0mQ_7JQhzZUKn65H8-Bdkppy3Q-MFv9Pv5WlUH7FTjG4bE1OX9gykddRE22bZQJiVA3x0SeVsof3-huHTa_u8V260F4pQD9PHtEl8eS0CM5mjfDY/s640/new_node.png" width="640" /></a></div>
<div class="MsoNoSpacing">
<br /></div>
<div class="MsoNoSpacing">
Enter the values as indicated below.
Then click save<o:p></o:p></div>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXt3d9drFw1ob7TfPHxpOIiB7dzVAzjv78XGvIFOMx0XSKtGF8CTvAUQqiVLaLjsjlYEJFd1sRhz3_oTcTOrMYk4rZ258HBs9Pkm2ZrMm_PdCilJUNH_U594ro7Q1d1veNt6ek46G6p-g/s1600/new_node_cfg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="446" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXt3d9drFw1ob7TfPHxpOIiB7dzVAzjv78XGvIFOMx0XSKtGF8CTvAUQqiVLaLjsjlYEJFd1sRhz3_oTcTOrMYk4rZ258HBs9Pkm2ZrMm_PdCilJUNH_U594ro7Q1d1veNt6ek46G6p-g/s640/new_node_cfg.png" width="640" /></a></div>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;"><br /></span></div>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;"></span></div>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;">Once saved, Jenkins will automatically connect to the
slave machine and configure an agent. Noticeably, slave.jar will be
install in /home/jenkins/slave on the slave server and eventually
workspace will be created there too.<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;"><br /></span></div>
<h3>
<!--[if !supportLists]-->3<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; font-weight: normal;">
</span><!--[endif]-->Setting
up a Slave jenkins using ssh Key</h3>
<div class="MsoNoSpacing">
This is the preferred method as the access is not tied
with the user’s password and there won’t be impact if the user’s password is
changed.<o:p></o:p></div>
<div class="MsoNoSpacing">
<br /></div>
<div class="MsoNoSpacing" style="margin-left: .25in; mso-list: l1 level1 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="color: #494949; letter-spacing: 0.15pt;">1.<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;">
</span></span><!--[endif]--><span style="background: white; color: #494949; letter-spacing: 0.15pt;">Login to the slave server as a jenkins user<o:p></o:p></span></div>
<div class="MsoNoSpacing" style="margin-left: .25in; mso-list: l1 level1 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="color: #494949; letter-spacing: 0.15pt;">2.<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;">
</span></span><!--[endif]--><span style="background: white; color: #494949; letter-spacing: 0.15pt;">Create an .ssh directory and cd into the directory<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: dash-small-gap windowtext .5pt; mso-border-insideh: .5pt dash-small-gap windowtext; mso-border-insidev: .5pt dash-small-gap windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: dashed windowtext 1.0pt; mso-border-alt: dash-small-gap windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 458.75pt;" valign="top" width="612"><div class="MsoNoSpacing">
<span style="font-family: "courier new"; font-size: 10pt; letter-spacing: 0.15pt;">mkdir
~/.ssh <o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span style="font-family: "courier new"; font-size: 10pt; letter-spacing: 0.15pt;">chmod
700 ~/.ssh<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span style="font-family: "courier new"; font-size: 10pt; letter-spacing: 0.15pt;">cd
~/.ssh<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;">
</span></div>
<div class="MsoNoSpacing">
<br /></div>
<div class="MsoNoSpacing">
<span style="background: white; color: #494949; letter-spacing: 0.15pt;"><span style="background-color: transparent;">The .ssh directory must have proper access permissions
that group and others cannot have write permissions, otherwise, the following
error would show when starting the slave.</span></span></div>
<div class="MsoNoSpacing">
<o:p></o:p></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1pt solid windowtext; padding: 0in 5.4pt; width: 647.5pt;" valign="top" width="863"><div class="MsoNormal" style="line-height: 13.65pt; margin-bottom: 0.0001pt;">
<span style="background-color: yellow; color: red; font-family: "courier new"; font-size: 8pt;">ERROR: Server rejected the 1 private key(s) for
jenkins (credentialId:***/method:publickey)</span><span style="background-color: #e2efd9; color: #333333; font-family: "courier new"; font-size: 8pt;"><o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNoSpacing">
<br /></div>
<div class="MsoNoSpacing" style="margin-left: .25in; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span style="color: #494949; letter-spacing: 0.15pt;">3.<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;">
</span></span><!--[endif]--><span style="background: white; color: #494949; letter-spacing: 0.15pt;">Create an ssh key pair using the following command. Press
enter for all the defaults when prompted<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<br /></div>
<div class="MsoNoSpacing">
<o:p>
</o:p></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: dash-small-gap windowtext .5pt; mso-border-insideh: .5pt dash-small-gap windowtext; mso-border-insidev: .5pt dash-small-gap windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: dashed windowtext 1.0pt; mso-border-alt: dash-small-gap windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 458.75pt;" valign="top" width="612"><div class="MsoNoSpacing">
<span style="font-family: "courier new";"><span style="font-size: x-small;">ssh-keygen -t
rsa -C "The access key for You Jenkins slave"</span><o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
</div>
<div>
<br /></div>
<div>
<div class="MsoNoSpacing" style="margin-left: .25in; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span style="color: #494949; letter-spacing: .15pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">4.<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;">
</span></span><!--[endif]--><span style="background: white; color: #494949; letter-spacing: .15pt;">Add the public to authorized_keys file using the following
command.<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o:p></o:p></span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: dash-small-gap windowtext .5pt; mso-border-insideh: .5pt dash-small-gap windowtext; mso-border-insidev: .5pt dash-small-gap windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: dashed windowtext 1.0pt; mso-border-alt: dash-small-gap windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 458.75pt;" valign="top" width="612">
<div class="MsoNoSpacing">
<span style="font-family: "Courier New"; font-size: 10.0pt;">cat
id_rsa.pub > ~/.ssh/authorized_keys</span><span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNoSpacing" style="margin-left: .5in;">
<br /></div>
<div class="MsoNoSpacing" style="margin-left: .25in; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span style="color: #494949; letter-spacing: .15pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">5.<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;">
</span></span><!--[endif]--><span style="background: white; color: #494949; letter-spacing: .15pt; mso-bidi-font-family: "Courier New";">Copy the contents of the
private key in id_rsa to the clipboard.<o:p></o:p></span></div>
<div class="MsoNoSpacing" style="margin-left: .25in;">
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: dash-small-gap windowtext .5pt; mso-border-insideh: .5pt dash-small-gap windowtext; mso-border-insidev: .5pt dash-small-gap windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: dashed windowtext 1.0pt; mso-border-alt: dash-small-gap windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 458.75pt;" valign="top" width="612">
<div class="MsoNoSpacing">
<span style="font-family: "Courier New"; font-size: 10.0pt;">cat
id_rsa</span><span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<br />
<div class="MsoNoSpacing">
<br /></div>
</div>
<div>
<div class="MsoNoSpacing" style="margin-left: .25in; mso-list: l0 level1 lfo1; text-indent: -.25in;">
6.<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;"> </span><!--[endif]--><span style="background: white; color: #494949; letter-spacing: .15pt;">Login in to Jenkins
Web Console as an administrator </span><o:p></o:p></div>
<div class="MsoNoSpacing" style="margin-left: .25in;">
<span style="background: white; color: #494949; letter-spacing: .15pt;">Go to dashboard –> credentials –>
Global credentials –> add credentials<span class="apple-converted-space"> </span></span><strong><span style="font-family: "Calibri",sans-serif; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;"><o:p></o:p></span></strong></div>
<br />
<div class="MsoNoSpacing" style="text-indent: .25in;">
<span style="background: white; color: #494949; letter-spacing: .15pt;">Select SSH Username with private key </span></div>
<div class="MsoNoSpacing" style="text-indent: .25in;">
<span style="background: white; color: #494949; letter-spacing: .15pt;">Enter jenkins as the username</span></div>
<div class="MsoNoSpacing" style="text-indent: .25in;">
<span style="background: white; color: #494949; letter-spacing: .15pt;">Paste the key in the clipboard to Private Key (Enter directly)</span></div>
<div class="MsoNoSpacing" style="text-indent: .25in;">
<span style="background: white; color: #494949; letter-spacing: .15pt;">click ok.</span><o:p></o:p></div>
<div class="MsoNoSpacing" style="text-indent: .25in;">
<span style="background: white; color: #494949; letter-spacing: .15pt;"><br /></span></div>
<div class="MsoNoSpacing" style="margin-left: .25in; mso-list: l0 level1 lfo1; text-indent: -.25in;">
7.<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal;"> </span><!--[endif]--><span style="background: white; color: #494949; letter-spacing: .15pt;">Go to Dashboard
–> Manage Jenkins –> Manage Nodes </span><o:p></o:p></div>
<div class="MsoNoSpacing" style="text-indent: .25in;">
<span style="background: white; color: #494949; letter-spacing: .15pt;">
</span></div>
<div class="MsoNoSpacing" style="margin-left: .25in;">
<span style="background: white; color: #494949; letter-spacing: .15pt;">Select the key credential for the Slave configuration
then click Save.</span><strong><span style="font-family: "Calibri",sans-serif; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;"><o:p></o:p></span></strong></div>
</div>
Derek Luhttp://www.blogger.com/profile/06680076628209687280noreply@blogger.com3tag:blogger.com,1999:blog-3593631774662502243.post-59840346765562650182014-12-26T08:57:00.001-08:002014-12-26T08:57:13.707-08:00Is it possible to handle conflicts between 2 versions of jQuery loaded in the same page?Question: Is it possible to handle conflicts between 2 versions of jQuery loaded in the same page?<br />
<br />
Answer: Using jQuery.noConflict, you can make multiple versions of jQuery coexist on the same page. <br />
<pre class="default prettyprint prettyprinted"><code><span class="com"><!-- load jQuery 1.1.3 --></span><span class="pln">
</span><span class="tag"><script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"http://example.com/jquery-1.1.3.js"</span><span class="tag">></script></span><span class="pln">
</span><span class="tag"><script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="tag">></span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> jQuery_1_1_3 </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">.</span><span class="pln">noConflict</span><span class="pun">(</span><span class="kwd">true</span><span class="pun">);</span><span class="pln">
</span><span class="tag"></script></span><span class="pln">
</span><span class="com"><!-- load jQuery 1.3.2 --></span><span class="pln">
</span><span class="tag"><script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"http://example.com/jquery-1.3.2.js"</span><span class="tag">></script></span><span class="pln">
</span><span class="tag"><script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="tag">></span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> jQuery_1_3_2 </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">.</span><span class="pln">noConflict</span><span class="pun">(</span><span class="kwd">true</span><span class="pun">);</span><span class="pln">
</span><span class="tag"></script></span></code></pre>
Then, instead of <code>$('#selector').function();</code>, you'd do <code>jQuery_1_3_2('#selector').function();</code> or <code>jQuery_1_1_3('#selector').function();</code>.<br />
Derek Luhttp://www.blogger.com/profile/06680076628209687280noreply@blogger.com0tag:blogger.com,1999:blog-3593631774662502243.post-70694322063655320552014-12-18T07:08:00.001-08:002014-12-26T08:53:04.266-08:00Why the space is not freed on UNIX after a file is deleted?Question: When a large file is deleted from a UNIX file system why is the free space not changing?<br />
<br />
Answer: One possibility is that the file being deleted have more references in the filesystem, such as it is still open by a user, in this case the space will be freed after the file is closed.Derek Luhttp://www.blogger.com/profile/06680076628209687280noreply@blogger.com0