tag:blogger.com,1999:blog-57383984363725764292024-02-08T21:26:00.362+01:00IllegalStateExceptionThoughts about developing, testing and software quality in general.Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-5738398436372576429.post-76845097191089669662013-01-31T22:21:00.000+01:002013-01-31T21:15:03.923+01:00Publishing a Maven site having jacoco reports at Github's gh-pages.When converting one of <a href="http://1and1.github.com/testlink-junit/">my pet projects </a>from <a href="http://cobertura.sourceforge.net/">Cobertura</a> to <a href="http://www.eclemma.org/jacoco/">Jacoco</a> I stumbled upon some small nuisance when publishing the site as a gh-page with the <a href="http://maven.apache.org/plugins/maven-scm-publish-plugin/">maven-scm-publish-plugin</a>:<br />
<br />
<ul>
<li>Jacoco creates it's needed resources (images, javascript, css) in a directory called <span style="font-family: Courier New, Courier, monospace;">.resources</span>, note the <b>dot at the start</b>.</li>
<li>Now while the resources were successfully pushed to the <a href="https://github.com/1and1/testlink-junit/tree/gh-pages/tljunit-surefire/jacoco/.resources">gh-pages branch</a>, they were missing afterwards in the <a href="http://1and1.github.com/testlink-junit/tljunit-surefire/jacoco/index.html">published site</a> firstly.</li>
<li>I found the solution in a help article called <a href="https://help.github.com/articles/files-that-start-with-an-underscore-are-missing">Files that start with an underscore are missing</a>.</li>
<li>It seems, directories or files <b>starting with a dot</b> are <b>not</b> published as well.</li>
<li>So the solution was quite simple: in the <a href="https://github.com/1and1/testlink-junit/blob/master/publish-site">shell script</a> I use for publishing the site I added a line which will touch a file called <span style="font-family: Courier New, Courier, monospace;">.nojekyll</span> as suggested in the help article before invoking the maven-scm-publish-plugin and it worked :-)</li>
</ul>
<div>
Update: I had written an email to github before I just tried the .nojekyll solution and received an answer quite promptly, <a href="https://github.com/mojombo/jekyll/blob/e383bfe65d81c34bd2e2d9c755157b4c3ff06c31/lib/jekyll/site.rb#L328-L345">jekyll/site.rb</a> has more explanations.<br />
<br />
Update 2: instead of touching <span style="font-family: 'Courier New', Courier, monospace;">.nojekyll</span><span style="font-family: inherit;"> you may add </span><span style="font-family: Courier New, Courier, monospace;">src/site/resources/.nojekyll</span><span style="font-family: inherit;"> in your project as outlined in </span><a href="http://maven.apache.org/plugins/maven-site-plugin/examples/creating-content.html#Adding_Extra_Resources">Adding Extra Resources</a> of the maven-site-plugin documentation.</div>
<br />
<br />Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-81068325655121652672012-11-05T22:30:00.002+01:002012-11-05T22:30:55.613+01:00Strange problems with git-svn fatal: "Cannot open '.git/wJj4wQYBct': Permission denied hash-object -w --stdin-paths --no-filters: command returned error: 128"While trying to convert an internal Subversion repository with <tt>git-svn</tt> I ran into the same error over and over again. After a lot of successful revision conversions, I always got:<br />
<br />
<pre>fatal: "Cannot open '.git/wJj4wQYBct': Permission denied
hash-object -w --stdin-paths --no-filters: command returned error: 128"
</pre>
<br />
After searching the web (the usual suspects <a href="http://stackoverflow.com/">http://stackoverflow.com/</a> and Google) and trying a lot of the given hints, I finally tried to checkout the trunk of the repository with subversion directly and <b>did not succeed</b> as well.<br />
Now I firstly was even thinking our subversion repository might be corrupt until a sudden insight grew in me: while I really like the Macbook Pro given to me by the company, the Avira virus scanner was detecting the <a href="http://en.wikipedia.org/wiki/EICAR_test_file">EICAR test virus</a> in the test suite, this showed up in the quarantine logs!<br />
Now the rest was a piece of cake: by applying the hints on the <a href="http://www.avira.com/en/support-for-business-knowledgebase-detail/kbid/1243">Avira KB for excluding specific paths</a> I finally succeeded by excluding only this specific directory where the conversion took place.Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com1tag:blogger.com,1999:blog-5738398436372576429.post-74349706694949103662012-03-26T22:20:00.000+02:002012-03-26T22:20:57.455+02:00jenkins LTS 1.424.6 and java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableList;<p>While updating the parent version of <a href="https://wiki.jenkins-ci.org/display/JENKINS/JobConfigHistory+Plugin">JobConfigHistory+Plugin</a> from Jenkins LTS version 1.424.2 to 1.424.6 I encountered<br />
the following:</p><script src="https://gist.github.com/2209348.js?file=gistfile1.java"></script><br />
<p>Using <tt>mvn dependency:tree</tt>, I saw that <tt>org.kohsuke.stapler:stapler:1.172</tt> depends on<br />
<tt>com.google.guava:guava:r06</tt>, this version does <b>not</b> include the symbol. <br />
Version 1.424.6 of the WAR provides <tt>com.google.guava:guava:jar:11.0.1</tt>, which includes this symbol.<br />
See <a href="https://github.com/jenkinsci/jobConfigHistory-plugin/commit/e4b8c6278c6c733b25abc06833a659351969316e">Update to LTS 1.424.6</a> for the fix.<br />
</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-56294545649014138142012-03-25T22:29:00.000+02:002012-03-25T22:29:14.082+02:00Restarter script for jenkins<h1>Restarter script for Jenkins</h1><ul><li>I am fighting with my <a href="http://jenkins-ci.org/">Jenkins</a> instance being down every other day.</li>
<li>Getting bored of sshing to the host and restart the instance, I wrote a small restarter script.</li>
</ul><script src="https://gist.github.com/2199521.js?file=restartjenkins.py"></script>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com1tag:blogger.com,1999:blog-5738398436372576429.post-15639981558304236822011-06-30T00:55:00.000+02:002011-06-30T00:55:13.272+02:00javax.net.ssl.SSLPeerUnverifiedException after installation of a new JDK on MacOSX<br />
<ul>
<li>After installing the new JDK (<b>1.6.0_26</b>) as normal user having the authentication dialog pop up for my admin account. I had loads of problems with <tt>javax.net.ssl.SSLPeerUnverifiedException</tt> popping up.</li>
<li>I even was not able to start the <tt>/Applications/Utilities/Java\ Preferences.app/</tt> and got a strange error.</li>
<li>Logging in as admin did not help either, I still was not able to start the preference app.</li>
<li>I downloaded the JDK as admin again and repeated the installation.</li>
<li>I rebooted my system and now was able to open the preference app, reset to default options and the <tt>javax.net.ssl.SSLPeerUnverifiedException</tt> were gone.</li>
</ul>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-9819750757674900932011-01-26T21:06:00.000+01:002011-01-26T21:06:03.871+01:00Using maven-release-plugin and maven-scm-plugin to tag all submodules of a multimodule project<p>I just created a <a href="https://github.com/mfriedenhagen/multi-module-sample">sample multi module maven project</a> in which by using the <a href="http://maven.apache.org/plugins/maven-release-plugin/">maven-release-plugin</a> and the <a href="http://maven.apache.org/scm/maven-scm-plugin/">maven-scm-plugin</a> I achieved my goal to create additional tags for the module artifacts as well. For a rationale see the included <a href="https://github.com/mfriedenhagen/multi-module-sample/blob/master/README.creole">README</a>.</p>
<p>There are two branches, one working with <a href="http://git-scm.com/">git</a> and one with <a href="http://subversion.apache.org/">Subversion (in the master branch)</a>.</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com1tag:blogger.com,1999:blog-5738398436372576429.post-8634894804691135642011-01-02T21:30:00.000+01:002011-02-02T23:48:29.051+01:00cobertura plugin and maven3 in a Hudson Installation<p>Now that <a href="http://hudson-labs.org/changelog">Hudson 1.392</a> supports <a href="http://maven.apache.org/docs/3.0.1/release-notes.html">Maven3</a> I switched my <a href="http://huschteguzzel.de/hudson/job/sardine/">first job</a> to Maven3. One small caveat: you need a new, not released version of the <a href="http://wiki.hudson-ci.org/display/HUDSON/Cobertura+Plugin">Cobertura Plugin</a>, more information is found in <a href="http://issues.hudson-ci.org/browse/HUDSON-8362">HUDSON-8362</a>.</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-28946458589111267262010-11-28T22:21:00.002+01:002012-03-24T22:42:52.256+01:00Triggering Hudson parameterized builds which include a file parameter using curl<p>My final goal is to run <tt class="command">mvn release:prepare</tt> on my local machine to have greater control and trigger the actual <tt class="command">mvn release:perform</tt> on Hudson, which will do the deployment in a controlled environment and archive the build log.</p>
<p>To achieve this, I want to upload the generated <tt>release.properties</tt> to the Hudson instance. This should be possible using the <a href="http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Trigger+Plugin">Parameterized Trigger Plugin</a>. The tricky part is that the proposed solution on the plugin's Wikipage using <tt>buildWithParameters</tt> seems not to work, I always got HTTP/400 or HTTP/500 responses. After some tries and an analyze of the traffic with <a href="/2010/10/using-basex-to-grep-through-charles.html">Charles</a> I came up with two solutions, one using token authentication, the other one basic authentication. The important part seems to be to include the parameters <tt>json</tt> and <tt>Submit</tt> as well. Note that the file parameter is numbered, i.e. it is called <tt>file0</tt>.</p>
<h4>Token authentication</h4>
<pre class="command">
curl -i -Fname=release.properties -Ffile0=@FILE_TO_UPLOAD \
-Fjson='{"parameter": {"name": "release.properties", "file": "file0"}}' \
-FSubmit=Build \
'http://HUDSON/hudson/job/JOBNAME/build?token=TOKEN'
</pre>
<p>The advantage of this is that no further user interaction is required, however you do not know who triggered the build.</p>
<h4>Basic HTTP authentication</h4>
<pre class="command">
curl -i -uUSERNAME -Fname=release.properties -Ffile0=@FILE_TO_UPLOAD \
-Fjson='{"parameter": {"name": "release.properties", "file": "file0"}}' \
-FSubmit=Build 'http://HUDSON/hudson/job/JOBNAME/build'
</pre>
<p>The advantage of this is you know who triggered the build.</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com5tag:blogger.com,1999:blog-5738398436372576429.post-40771697862828233542010-11-12T22:48:00.001+01:002010-11-12T22:56:28.258+01:00Using iptables on Android to redirect HTTP connections to a running Charles proxy instance<p>During development it is often desirable to inspect the HTTP requests from your applications. As reported in <a href="http://code.google.com/p/android/issues/detail?id=1273">Android Issue 1273</a> there is no easy way to set a HTTP proxy when using WIFI. In this article I describe how to use Charles as a Webproxy at least for unencrypted connections.</p>
<p>Unfortunately, you have to <em>root</em> your telephone, as otherwise you are not allowed to call <tt class="command">iptables</tt>.
<em>Rooting</em> is easy to do, visit <a href="http://unrevoked.com/">unrevoked</a> and follow the instructions. If you want to install
a custom rom with Froyo just follow the instructions on <a href="http://forceflow.ulyssis.be/2010/10/13/wildpuzzle-rom-for-htc-wildfire/">Wildpuzzle (or any other) ROM for HTC Wildfire</a>.
</p>
<p>Then install Charles, see my article on <a href="/2010/10/using-basex-to-grep-through-charles.html">Using BaseX and Charles</a>. Start it up and configure Charles to be a transparent HTTP proxy in <tt>Proxy/Proxy Settings...</tt>.</p>
<p>I assume you installed the <a href="http://developer.android.com/sdk/index.html">Android SDK</a> (for Mac OS X use Homebrew, see my article on <a href="/2010/09/starting-android-emulator-automatically.html">starting an Android emulator via LaunchAgent</a> for specifics).</p>
<p>On your device allow USB Debugging (<tt>Settings/Applications/Development/USB Debugging</tt>). Now connect your <em>rooted</em> device via USB. Enter <tt class="command">adb shell</tt>, you should be greeted with a <tt>sh-3.2</tt> prompt. In this example <tt>192.168.51.9</tt> is the address of the computer running Charles, <tt>8888</tt> is the port.</p>
<pre class="command">
sh-3.2# iptables -t nat -A OUTPUT -p tcp -o eth0 --dport 80 -j DNAT --to 192.168.51.9:8888
FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:378
</pre>
<p>You may ignore the error.</p>
<pre class="command">
sh-3.2# iptables -t nat -L -nvx
Chain PREROUTING (policy ACCEPT 19 packets, 4832 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 1068 packets, 65421 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1050 packets, 63721 bytes)
pkts bytes target prot opt in out source destination
8 472 DNAT tcp -- * eth0 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:192.168.51.9:8888
</pre>
<p><b>Hint:</b> On <em>Mac OS X</em> you have to allow incoming connections to your computer e.g. by going to
<em>System Settings/Security</em> and disabling the firewall. Now you should see all your unencrypted HTTP connections going through Charles.</p>
<p>To disable using Charles as a proxy enter:</p>
<pre class="command">
sh-3.2# iptables -t nat -F OUTPUT
</pre>
<p>This will reset the routing again and all HTTP connections will go directly to the hosts again.</p>
<p>Unfortunately this approach will not work for encrypted connections right now, I am still investigating this.</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com2tag:blogger.com,1999:blog-5738398436372576429.post-6616184077490164252010-10-15T21:16:00.003+02:002010-10-18T11:38:07.879+02:00Using BaseX to grep through Charles output<p><a href="http://www.inf.uni-konstanz.de/dbis/basex/index">BaseX</a> is a fantastic tool to grep through large XML files by creating indices for text, attributes and path summaries. I use this to analyze data generated by <a href="http://www.charlesproxy.com/">Charles</a>, an HTTP proxy / HTTP monitor / Reverse Proxy. Both tools are written in Java, so you should have no problems running them. While the latter is not OSS, it comes at a reasonable price and may be used in a trial version for 30 days after which you get a nagging dialog.</p>
<p>Charles may be used as a simple tool to run stress tests. Just choose it as a proxy, run your usual usecases and export the data to xml. Two of the power features Charles offers are <a href="http://en.wikipedia.org/wiki/Man-in-the-middle_attack">Man in the middle</a> for SSL connections by importing the Charles Root CA certificate and modifying your requests on the fly to use test systems of new software instead of the live ones. Afterwards you may check the output by grepping your expected results using BaseX using <a href="http://en.wikipedia.org/wiki/XQuery">XQuery</a> or <a href="http://en.wikipedia.org/wiki/XPath">XPath</a>. An example:</p>
<ul>
<li>Start Firefox creating a new profile <tt class="command">/Applications/Firefox.app/Contents/MacOS/firefox-bin -profileManager</tt> called Charles.</li>
<li>Download and install Charles' Firefox extension by visiting <a href="http://www.charlesproxy.com/charles.xpi">the download site</a> and restart Firefox after installation.</li>
<li>In the <tt>Tools</tt> menu of Firefox Charles offers to install the CA certificate.</li>
<li>Make sure you have Charles running and choose to proxy Firefox in it's <tt>Proxy</tt> menu.</li>
<li>Enable Charles in the <tt>Tools</tt> menu of Firefox, now you should see requests coming through Charles.</li>
<li>Search for <b>hgkit</b> in Google.</li>
<li>Drill down in Charles tree view and find the <a href="http://www.google.de/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=de&source=hp&q=hgkit&meta=&btnG=Google-Suche">http://www.google.de/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=de&source=hp&q=hgkit&meta=&btnG=Google-Suche</a> request.</li>
<li>From the context menu of this request choose <tt>Repeat advanced</tt> and enter 100 iterations with 5 concurrent requests making sure to use a new session.</li>
<li>Export the new session in Charles as <tt>google-hgkit.xml</tt>.</li>
<li>Now start BaseX and create a new database referencing <tt>google-hgkit.xml</tt>. If you encounter an error <i>Invalid byte 1 of 1-byte UTF-8 sequence</i> make sure to use the built in parser in the <tt>Parsing</tt> tab. Make sure you chose <tt>Options/Realtime execution</tt>.</li>
<li>Analyze your data:</li>
<ul>
<li>A search for <tt class="command">/charles-session/transaction</tt> should result in 100 hits.</li>
<li>A search for <tt class="command">/charles-session/transaction/response[@status="200"]</tt> should result in 100 hits.</li>
<li>As the html returned by the search is <a href="http://en.wikipedia.org/wiki/XML#Escaping">escaped</a> in the body, you need to use XML escaping in your search through the body.</li>
<li>A search for <tt class="command">/charles-session/transaction/response[@status="200"]/body[contains(text(), "this_surely_will_not_show_up_will_it_dsddada")]</tt> should result in 0 hits.</li>
<li>A search for <tt class="command">/charles-session/transaction/response[@status="200"]/body[contains(text(), "&lt;a href=&quot;http://hgkit.berlios.de/")]</tt> should result in 100 hits.</li>
<li>The Xquery <tt class="command">for $y in (for $x in /charles-session/transaction where $x/response/@status="200" return (
$x/@endTimeMillis - $x/@startTimeMillis)) order by $y descending return $y</tt> will return the times for successful requests in milliseconds in descending order.</li>
<li>Return all requests taking more than 300 milliseconds: <tt class="command">for $y in (for $x in /charles-session/transaction where $x/response/@status="200" return (
$x/@endTimeMillis - $x/@startTimeMillis)) where $y > 300 order by $y descending return $y</tt>.
<li>Return the count for the above requests:
<pre class="command">
let $times := (for $x in /charles-session/transaction
where $x/response/@status="200"
return ($x/@endTimeMillis - $x/@startTimeMillis))
let $slowQueries := for $y in ($times) where $y > 300 return $y
return count($slowQueries)
</pre>
</ul>
</ul>
<p>You could try to trigger a second search with a different searchterm and analyze that the search results are not mixed up by querying, e.g.<br/><tt class="command">/charles-session/transaction[contains(@query, "q=hgkit")]/response[@status="200"]/body[contains(text(), "&lt;a href=&quot;http://hgkit.berlios.de/")]</tt>. You may select more than one request in Charles for repetition. For further instructions on XPath I recommend <a href="http://www.w3schools.com/xpath/default.asp">w3school's tutorial</a>.</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-696390946319264082010-09-27T20:35:00.001+02:002010-09-27T20:38:19.192+02:00Starting an Android emulator automatically on MacOSX after Login via LaunchAgent<p><a href="http://mxcl.github.com/homebrew/">Homebrew</a> offers a simple means to install additional software packages on your MacOSX computer. After initial installation of <tt class="command">brew</tt> as admin user execute:</p>
<pre class="command">
brew install android-sdk # will install the newest SDK starter package
android update sdk # this will open the UI, now install all platforms
chgrp -R staff /usr/local/Cellar/android-sdk/r7 # otherwise the ANDROID_HOME will be owned by the wheel group and you may not start anything as non admin user.
</pre>
<p>To use tools like the <tt class="command">emulator</tt> add <tt class="command">ANDROID_HOME</tt> and <tt class="command">ANDROID_SDK_ROOT</tt> to your <tt class="command">$HOME/.profile</tt> or <tt class="command">$HOME/.bash_profile</tt> (if the latter exists, use this):</p>
<pre class="command">
ANDROID_SDK_ROOT=/usr/local/Cellar/android-sdk/r7
ANDROID_HOME=$ANDROID_SDK_ROOT
export ANDROID_SDK_ROOT ANDROID_HOME
</pre>
<p>Create an emulator called Wildfire using the <tt class="command">android</tt> command. Now if you want the emulator to be started automatically after you login, put the following into <tt class="command">$HOME/Library/LaunchAgents/emulator-wildfire.plist</tt>:</p>
<script src="http://gist.github.com/599148.js?file=emulator-wildfire.plist"></script>
<p>After you saved the file, execute <tt class="command">launchctl load $HOME/Library/LaunchAgents/emulator-wildfire.plist</tt>. From now on the emulator starts whenever you (or your CI user) logs in.</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-957883487417851322010-09-05T02:59:00.001+02:002010-09-05T03:07:37.447+02:00A simple way to get a git hash as version info into Android applications using Maven<p>I recently decided to do some <a href="http://developer.android.com/index.html">Android</a> programming. Enters <a href="http://wiki.github.com/mfriedenhagen/android-mittagstisch-ka/">Mittagstisch KA</a>. I really like to know which sources applications are built from. Using Maven and it's <a href="http://maven.apache.org/plugins/maven-antrun-plugin/index.html">Antrun-Plugin</a> this is rather simple:</p>
<script src="http://gist.github.com/565626.js?file=inject_git_hash_into_android_info"></script>
<p>This will create a new <a href="http://developer.android.com/guide/topics/resources/string-resource.html">string resource</a> file, which is automatically picked up by Android's resource compiler and might be read in your application by an <tt>Activity</tt> like this:</p>
<pre class="command">
<code>
final String gitHash = getResources().getString(R.string.info_githash);
</code>
</pre>
<p>Do not forget to add <tt>res/values/githash.xml</tt> to your <a href="http://www.kernel.org/pub/software/scm/git/docs/gitignore.html"><tt>.gitignore</tt></a> file otherwise you will be committing infinitely :-).</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-46326048587601596562010-07-06T10:57:00.000+02:002011-02-02T23:48:29.055+01:00Really using launchctl to restart a Hudson Mac OS X build slave connected via JNLP automaticallyIn my <a href="http://illegalstateexception.blogspot.com/2010/07/using-launchctl-to-restart-hudson-mac.html">last posting</a> I wrote commands put into <tt>$HOME/.launchd.conf</tt> would be launched automatically after a login as stated by the man page for <tt>launchtctl</tt>. However this is <strong>false</strong>! After a reboot or relogin the commands will not be picked up! Stating <a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/launchd.conf.5.html"><tt>man 5 launchd.conf</tt></a>:<br />
<pre class="command">$HOME/.launchd.conf Your launchd configuration file (currently unsupported).
</pre>
Pulling my ear: always try and test what you write about, sorry :-(. However using the following <tt>.plist</tt> file put into <br /><tt>$HOME/Library/LaunchAgents/org.hudson-ci.jnlpslave.plist</tt> <em>really</em> starts the slave:<br />
<pre class="command"><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.hudson-ci.jnlpslave</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-jar</string>
<string>/home/hudson/bin/slave.jar</string>
<string>-jnlpUrl</string>
<string>http://SERVER/hudson/computer/NODE/slave-agent.jnlp</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
</pre>
Of course you have to adapt the path to your <tt>slave.jar</tt> as well as the URL to your Hudson-master.Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-65581150832388249172010-07-02T22:33:00.006+02:002011-02-02T23:48:29.057+01:00Using launchctl to restart a Hudson Mac OS X build slave connected via JNLP automatically<p><strong><tt>$HOME/launchd.conf</tt> does not work, see my working <a href="/2010/07/really-using-launchctl-to-restart.html">followup</a> on this!</strong></p>
<p>In my company's build infrastructure most of the slaves are located in the same data centre as the master. So we usually just use <tt class="command">ssh</tt> to launch the <tt>slave.jar</tt>. As we did not want to buy <a href="http://www.apple.com/xserve/">XServe</a> and our operations team would not like to host such an aberration from the usual (Linux) to build the handful of jobs which are Mac OS X only, we bought a <a href="">Mac-Mini</a>, which is part of the workstation LAN, where <tt>hudson</tt> will login automatically as we need the GUI anyway for Selenium tests.</p>
<p>As we have very strict firewall rules, access from the server LAN into the workstation LAN is forbidden. That's why we use <a href="http://en.wikipedia.org/wiki/JNLP">JNLP</a> to start the <a href="http://wiki.hudson-ci.org/display/HUDSON/Distributed+builds#Distributedbuilds-Launchslaveagentheadlessly">slave</a>. So we've usually restarted the slave manually after the connection broke down.</p>
<p>Enters <a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/launchctl.1.html#//apple_ref/doc/man/1/launchctl"><tt>launchctl</tt></a>. Instead of fiddling around with a <tt>plist</tt> file I just used <tt>launchctl submit</tt> to achieve the same. From the commandline enter the following command:</p>
<pre class="command">
launchctl submit -l hudson-slave -- /usr/bin/java -jar /Users/hudson/slave.jar -jnlpUrl http://SERVER:PORT/hudson/computer/NODE/slave-agent.jnlp
</pre>
<p>This will start the slave and restart it automatically if the connection ever should break down. You may watch the logging statements uttered by the slave by executing <br/><tt class="command">open /Applications/Utilities/Console.app</tt>. <strike>To enable this command every time your Mac OS X machine reboots, create a <tt>.launchd.conf</tt> in the hudson user's <tt>HOME</tt> like this:</strike></p>
<pre class="command"><strike>
cat > /User/hudson/.launchd.conf << EOF
submit -l hudson-slave -- /usr/bin/java -jar /Users/hudson/slave.jar -jnlpUrl http://SERVER:PORT/hudson/computer/NODE/slave-agent.jnlp
EOF
</strike></pre>
<p>You <strong>must not</strong> use the <a href="http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/javaws.html"><tt>javaws</tt></a> way (the <tt>-wait</tt> option did not work for me), as the parent process will exit after it launched the jnlp connection and <a href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man8/launchd.8.html"><tt>launchd</tt></a> will try to restart it again immediately for some times.</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com1tag:blogger.com,1999:blog-5738398436372576429.post-27461118226416346932010-06-27T20:27:00.002+02:002011-02-02T23:48:29.058+01:00Cross browser CSS and selectors - improving Hudson's viewList<p>After visiting the <a href="http://hudson.jboss.org/hudson/">JBOSS Hudson</a> instance with Firefox I really liked the way how the tabs were shown in the viewList. However revisiting the same page with Chrome was a disappointment. Neither was the active view emphasized nor were the inactive views flowing like they did with Firefox.</p>
<p>After some trials I detected that the <a href="http://www.w3.org/TR/CSS2/selector.html#attribute-selectors">attribute selectors</a> in the CSS were not triggered. Digging into element view showed that Chrome did not render a whitespace between the <tt>height attribute</tt>, so Firefox rendered <tt>tr[style='height: 3px;']</tt> while Chrome was rendering <tt>tr[style='height:3px;']</tt>. After duplicating the selectors and changing some attributes for Chrome I got at least the active view rendered in the right way, see <a href="http://s312195779.online.de/hudson/userContent/jboss-style.css/*view*/">jboss-style.css</a>.</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-25951233218351952322010-06-18T23:29:00.007+02:002010-06-21T15:29:42.079+02:00Storing your OpenOffice, Xmind, ... zippy documents more efficiently in a SCMI really like having my sourcecode and documents in a <a href="http://en.wikipedia.org/wiki/Source_Code_Management">SCM</a> since I first discovered <a href="http://en.wikipedia.org/wiki/Concurrent_Versions_System">CVS</a> about 14 years back and introduced it in two companies thereafter, one of which had tried to use <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_SourceSafe">VSS</a> (not really usable at the time, you had to lock files for editing which made you call for the VSS admin when your colleague was not available and did not allow to work on the same document at all), while in the other developers only had been using timestamped <a href="http://en.wikipedia.org/wiki/ZIP_(file_format)">ZIP</a> files before, which made team work really hard. In my current company I (maybe) made a mistake by pushing the switch from CVS to <a href="http://en.wikipedia.org/wiki/Apache_Subversion">SVN</a> about five years ago.<br />
Back then I took a look at one of the first <a href="http://en.wikipedia.org/wiki/Distributed_Version_Control_System">DVCS</a> systems (<a href="http://en.wikipedia.org/wiki/GNU_arch">arch</a>) but found it to be to confusing (at least for me, YMMV). About three years ago I discovered <a href="http://en.wikipedia.org/wiki/Mercurial_(software)">Mercurial</a> and really have liked it since, especially as I really like <a href="http://en.wikipedia.org/wiki/Python_(programming_language)">Python</a>. I tried <a href="http://en.wikipedia.org/wiki/Bazaar_(software)">Bazaar</a> as well because it promised better integration with Subversion but it used several different, incompatible repository formats so I had problems even checking out a <em>remote</em> repository more than once and the speed was not at all convincing as well. Nowadays I use <a href="http://en.wikipedia.org/wiki/Git_(software)">Git</a> sometimes which I like as well and I am especially impressed by the simple underlaying <a href="http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#the-object-database">concept of storing things</a>. However I still feel more comfortable with Mercurial right now and use <a href="http://bitbucket.org/mfriedenhagen">Bitbucket</a> a lot.<br />
After having used DVCS you feel almost crippled by SVNs bad merging support and the idea of having no distinction between branches and tags seems not so clever anymore, we have had some hard times using standard SVN tools after a decision to put release tags in a directory called <tt>releases</tt> and are sometimes still struggling to find a common point of view on the correct position of <tt>trunk</tt> and what to store beneath release tags in repositories used by more than one project, so they are unambiguous both for our tooling chain and understandable for humans.<br />
Well, back to the topic: nowadays a lot of software uses ZIP containers to store their information, which will bloat your SCMs because every new zip is so different from it's ancestor, even if you did only include a single new word, because the compression and a preview picture will make the new version very different from the old one. So I wrote a little <a href="http://bitbucket.org/mfriedenhagen/store_zippies_uncompressed/wiki/Home">Python script</a> which will uncompress, delete the included preview and put the remaining files back into an uncompressed ZIP again using the <a href="http://en.wikipedia.org/wiki/ZIP_(file_format)#Compression_methods"><tt>stored</tt></a> method.<br />Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com1tag:blogger.com,1999:blog-5738398436372576429.post-66094656719949864682010-06-18T22:09:00.006+02:002011-06-16T14:06:58.956+02:00Triggering Hudson builds with Mercurial hooks - a variation<div><p>Ashlux writes about <a href="http://www.ashlux.com/wordpress/2010/06/16/triggering-hudson-builds-with-mercurial-hooks/">triggering Hudson builds with Mercurial hooks</a> on his blog. The basic hook described is:</p>
<pre>
[hooks]
changegroup.hudson = curl http://hudson_url/job/project_name/build?delay=0sec
</pre>
<p>I use this technique as well a lot with two refinements:</p>
<ol>
<li>I use <tt>polling</tt> instead of <tt>build</tt>. So the url is <tt>http://hudson_url/job/project_name/polling</tt>. This will poll your Mercurial repository and only if something really changed, the build will be triggered.</li>
<li>Instead of setting up authentication I always use the <tt>TOKEN</tt> approach described on <a href="http://wiki.hudson-ci.org/display/HUDSON/Remote+access+API">Remote access API</a>, so the url gets <tt>http://hudson_url/job/project_name/polling?token=TOKEN</tt></li>
</ol>
<p>Using tokens you do not need to submit any authentication information. <a href="http://bitbucket.org/mfriedenhagen">Bitbucket</a> offers a <a href="http://bitbucket.org/help/ServiceIntegration#post"><tt>POST</tt></a> service which you may use instead of the aforementioned hook. <a href="http://gitbub.com/">Github</a> offers a <a href="http://help.github.com/post-receive-hooks/">similar service</a>.</p></div>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-47415542065578631092010-05-29T23:38:00.006+02:002011-06-16T14:06:55.235+02:00Fun with Javascript for Hudson<div><div>Right now, I do not have a lot of experience with Javascript but after having seen some funny stuff done to our internal Bugzilla with a userscript (templates for bugreports patched into the comment field), I decided to give it a try. Sometimes jobs in our internal internal build servers (<a href="http://hudson-ci.org/">Hudson</a>) will break over night because of full hard drives e.g. So we created a special view with all failed builds and a Hudson extension to build all jobs in a view.<br />
<br />
Now I thought this could be easily accomplished with Javascript as well, so I read a little bit about <a href="http://yuilibrary.com/projects/yui2/">YUI2</a>, which is included in Hudson already and came out with my first Javascript extension, which I host on <a href="http://bitbucket.org/mfriedenhagen/hudson_extensions/">Bitbucket</a>.<br />
The <a href="http://bitbucket.org/mfriedenhagen/hudson_extensions/src/666327ec97fb/he-all.js">source code</a>:<br />
<script src="http://bitbucket.org/mfriedenhagen/hudson_extensions/src/d7201d3ca5d6/he-all.js?embed=t"></script>
<br />
<ul>
<li>I just save the script in the <tt>userContent</tt> folder of Hudson and source it in the description of the view like this:<br/> <tt><script src="/hudson/userContent/hudson_extensions/he-all.js" type="text/javascript"></script></tt>.
</li>
<li>
First, I attach the initialization with the help of the <a href="http://developer.yahoo.com/yui/docs/YAHOO.util.Event.html"><tt>YAHOO.util.Event.onDOMReady</tt></a> to the point in time when the whole page is rendered, on my first tries I only collected the links already rendered up to the point where the script was included.</li>
<li>If any job build links are found (<tt>isBuildHref</tt>), I render a Build All link.</li>
<li>When hitting the link, I just iterate over the links (<tt>buildAll</tt>) and send an <a href="http://developer.yahoo.com/yui/docs/YAHOO.util.Connect.html"><tt>asyncRequest</tt></a> discarding the result by not specifying a callback function at all to trigger the actual builds.</li>
</ul>
Now I already can think of other useful stuff to do with this :-).</div></div>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-32413629599350039972010-05-22T21:06:00.002+02:002010-06-18T22:19:12.784+02:00Command-Tab - Blog Archive - How to Test RAM Under Mac OS XAfter updating my Macbook from 2GBG to 4GB I ran <a href="http://www.command-tab.com/2008/01/11/how-to-test-ram-under-mac-os-x/">Command-Tab - Blog Archive - How to Test RAM Under Mac OS X</a> five times, as the the two blocks I have got first showed artifacts on the screen, now everything is running happily :-),Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0tag:blogger.com,1999:blog-5738398436372576429.post-11597273429923054112010-05-08T10:49:00.004+02:002010-08-13T19:09:22.761+02:00Upgrading a 1&1 Dynamic Cloud Server from Ubuntu 8.04 LTS to 10.04 LTS<p>My first try following the instructions <a href="https://help.ubuntu.com/community/LucidUpgrades#Network%20Upgrade%20for%20Ubuntu%20Servers%20(Recommended)">for Lucid</a> was not successful, after <tt class="command">shutdown -r now</tt> the <a href="http://www.1und1.info/xml/order/CloudDynamicServer">Dynamic Cloud Server</a> did not start up again. It is a pity that there is no serial console nor a Rescue or Repair-mode, so I gave it another try...</p>
<p>After <em>loads</em> of retries (new initialisation, waiting and another execution of <tt class="command">do-release-upgrade --devel-release</tt>) I found the solution in the end:</p>
<ul>
<li>While <tt class="command">do-release-upgrade --devel-release</tt> updated <em>dhclient</em> I took the old configuration with <tt class="command">static-route</tt>, see <a href="http://www.roysindre.no/a/2009/11/05/dhclient-classless-static-route-bug/">dhclient: classless static route, bug?</a> as well.</li>
<li>As I had no second chance to boot without security, I removed <em>apparmor</em> (<tt class="command">apt-get remove apparmor</tt>), maybe I will install this again after some research.</li>
<li><strong>Most important:</strong> New Linux-Kernels include a <a href="http://www.debian.org/releases/lenny/i386/release-notes/ch-upgrading.en.html#boot-hangs">new IDE-driver</a>, which adresses former <em>hda</em> devices as <em>sda</em>, so I changed three things <strong>after the package update but before reboot</strong>:
<ul>
<li>In <tt class="command">/boot/grub/menu.lst</tt> I replaced <tt class="command"># kopt=root=/dev/hda1 ro console=tty0 console=ttyS0,57600</tt> with <tt class="command"># kopt=root=/dev/sda1 ro console=tty0 console=ttyS0,57600</tt>.</li>
<li>After that I called <tt class="command">update-grub</tt> to update the configuration of grub.</li>
<li>In <tt class="command">/etc/fstab</tt> I replaced all occurrences of <em>hda</em> with <em>sda</em>.</li>
</ul>
</ul>
<p>Now the server is up and running again :-)</p>Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com8tag:blogger.com,1999:blog-5738398436372576429.post-89933621679290721052010-05-08T00:58:00.001+02:002010-05-08T10:54:14.870+02:00What's this all about?After having a <a href="http://unnuetzes.blogspot.com/">german blog</a> for some time I now decided to allow myself a second blog, where I will post about technical matters.Mirkohttp://www.blogger.com/profile/15357555770760554778noreply@blogger.com0