Installing Jenkins CI and configuring Pharo build scripts

A lot has been talked and discussed about CI in the last months. So I would like to share the experience I have gained while trying to do it myself locally in my Mac OS box.

CI introduction and Pharo integration

I guess most of you are aware of what Continuous Integration and CI server are. Basically are tools that help us to automatically build systems, run tests, make final binaries, run code critics, etc. One of the most popular ones is Jenkins (previously known as Hudson). We would like to have that for Smalltalk, but the problem is that most of them are targeted for a specific language, for example, for Java.

Fortunately for us, thanks to Yanni Chiu and Lukas Renggli, we have two things: 1) HudsonBuildTools: an integration between Jenkins and Pharo Smalltalk. 2) A builder.

HudsonBuildTools: You can check the package HudsonBuildTools in Basically, the package is an adaptor between what Java expects and what Smalltalk generates. So from the Smalltalks results of running tests, this package generates the .xml files (probably the JUnit results) that Jenkins expects.  Not only for tests but also for Lint rules, test coverage, etc.

Builder: this is a set of bash files that help us all the process of building Pharo images from command line. Of course, we can then use this builder from Jenkins. The builder takes care of, for example, executing the VM and passing by argument the Smalltalk script to load what you want to load in the image. It also has some cache to improve its performance and some hooks to execute code after or before each build. It makes the integration with Jenkins extremely easy because at the end all you have to do is to create a in the folder /scripts and that’s all.

Installing Jenkins

This should be easy. You just go to the jenkins website and you download the latest version for Mac OS. In my case it was here. After executing the .pkg you should have Jenkins installed in /Applications/Jenkins/. If you enter there, you will see only one file: jenkins.war. Where is Jenkins really then?  Well, that’s Jenkins “binary” (search in Google for more details about what a Java .war is). How do you start then Jenkins?  Well, it should be as easy as executing from a command line:

java -jar /Applications/Jenkins/jenkins.war

But of course, in my machine it didn’t start and throw an error saying the port 8009 was already in use…After googling a little bit, I found that I could change the port of the AJP13 protocol. I finally ended up changing both ports AJP13 and HTTP port (because default is 8080 and can be in conflict with some other stuff I have running). For more details about it read this link. So finally I had to start Jenkins like this:

java -jar /Applications/Jenkins/jenkins.war --ajp13Port=8010 --httpPort=7777

With that, I could successfully start Jenkins and I could browse its UI in: http://localhost:7777/.

Installing the builder

Nick Ager did a great post about Jenkins and Smalltalk. And the builder’s README is pretty clear. You should read both. I wont repeat all what they have already explained. I will just mention the problems I had and what I did to solve them.

1) The first problem I found is that expects that for Mac OSX:  PHARO_VM=”$VM_PATH/MacOS/Squeak VM Opt”. And VM_PATH=”$BASE_PATH/oneclick/Contents” (notice that “uname -s” MAC OSX will answer “Darwin”).  So… I needed to correctly set PHARO_VM to my VM. Hence,  after the “case “$(uname -s)” in” and before “# build configuration” I added the line:


So that way I am using that particular VM.

2) The second problem is that from Jenkins we will call the builder, so all those .sh has to be found in $PATH. What I did is to create the following



export PATH="$PATH:/Users/mariano/PhD/Jenkins/builder"

java -jar $WARFILE --ajp13Port=8010 --httpPort=7777 > $LOGFILE 2>&1 &

java -jar /Applications/Jenkins/jenkins.war --ajp13Port=8010 --httpPort=7777

Notice that this is a simple script that I use *locally*. If you are running Jenkins in a server, you may probably want to use nohup or something like that.

Configuring Jenkins and the builder

More about the builder, tests and Jenkins

There were some things which were not easy or were not working out of the box. Hence, I will share them wth you.  Just to clarify if it is not already clear. If you want that Jenkins run tests, then you need not only a .st that loads the test, but also the “buildtools” script, which downloads the HudsonBuildTools. So if you create a job and you want to run tests for it you have to put something like: -i Pharo-1.3 -o seaside3 -s seaside3 -i seaside3 -o seaside3-tests -s buildtools -s seaside3-tests

As you can imagine, for each script you pass with “-s” you need a corresponding .st in /scripts. We are putting two lines (commands) to the “execution shell”. The first takes the Pharo-1.3 image as input, loads seaside with the and then saves the image as seaside3.image. The second line, takes that seaside3.image as input, loads HudsonBuildTools (using, and then loads seaside3 tests and run them. We can see that is something like:

HDTestReport runPackages: ((WADevelopment allPackages
    select: [ :each | each name includesSubString: '-Tests-' ])
    collect: [ :each | each name ]).
HDLintReport runPackages: ((WADevelopment allPackages
    reject: [ :each | each name includesSubString: '-Tests-' ])
    collect: [ :each | each name ]).

In this case of Seaside3, the tests are not loaded by since they are loaded in But you can split this in your projects and only load tests in the second image.

Notice that you only need the “buildtools” it if you want to run tests, lint, test coverage, etc. If you just want to build images, then “buildtools” parameter is not needed. You can read the README file for more details.

Non-Interactive UIManager

In my case, I was building an image which opens a Transcript and for some reason it also asks for the author name (it is fixed now). Anyway, one of the problems I found is that since the builder is running the image headless, we should use a non-interactive UIManager. To do that I need to evaluate:  “UIManager default nonInteractiveManager”. What I did is to add such line in /scripts/ That way, all my scripts will include it by default.

Needed plugins

As explained in the README, for both, tests and lint, you need a special Jenkins plugin. To install them you can go from the web interface to “manage Jenkins” -> “manage plugins” or directly go to http://localhost:7777/pluginManager/. Then go to the tab “Available” and install those you need. Then restart Jenkins.

Creating Jenkins users

To create Jenkins users, you have to first enable security. Here you have a nice explanation of all the requires steps to be able to create users for Jenkins.

Test Coverage

If you want to run the test coverage you have to use the latest (VM.r2508 for example) CogVM from Eliot Miranda. TestCoverage uses a hook of the VM which is not working correctly in previous versions of the VM.


All in all between 1 and 2 hours, I was able to have my Jenkins running locally and building my own images. I am not a bash expert and I haven’t installed Jenkins before, so you should be able to do it fast also. If you were thinking that configuring Jenkins to build and test your images was something complicated and only for “gurus” then you should re-think it and give it a try. In my experience it was really straightforward. Of course, to have a real/secure Jenkins running you may need to spend some time giving correct permissions to files, users, etc, etc, etc.

5 thoughts on “Installing Jenkins CI and configuring Pharo build scripts

  1. If you use the Jenkins package as installed by apt on Ubuntu you may need to change the permissions in the cache folder created by the builder repository on Github. You can do that by changeing to the builder directory and running :

    chown -R 777 cache

    1. Thanks Paul. Indeed! Just after setting my local machine we set up Jenkins image here in my lab, in a Ubuntu box, and yes, we needed to touch a couple of permissons.

Leave a Reply