Last Updated: February 25, 2016
·
1.231K
· sebastianconcpt

Automating Pharo image builds

If you're planning to make a backend application using Pharo worker images, you'll probably setup a Jenkins or some kind of CI server.

Two minutes after that the CI server will need to have a terminal command to :

  1. Start the image build.
  2. Load all the requisites and app packages.
  3. Save image and quit.

So the first thing you might want to make is to create some code to fileIn. After all the package loading, you might put some method there to save image and quit.

That will start the build and load all but you'll not be able to open the image again. When you try to open that fresh built image it will close itself in a split second. You'll not see any crash dumps or error logs nothing anomalous. That's because is not a crash or an error. Is simply a normal image quit.

After digging into the issue for a while and testing different combinations, I've figured out the command that allows to do the three things: build, load and save properly.

/pharo -vm-display-null airflowing.image AirflowingWorkerBuilder.st --quit

How does it work?

The way it works is this: it loads requisites and packages from the filedIn AirflowingWorkerBuilder.st code, after all packages are loaded the image saves with a Smalltalk imageSave, and finally exits.

Have in mind the image quit should not be done by the filedIn script. Another thing you should not do is to try a Smalltalk saveImage: anImageName andQuit: true from your filedIn script, otherwise it will create an image that you cannot open anymore.

Conclusion

Use the command line --quit to automate image quits instead of coding it. If you use --quit from the command line the image state when saving will remain as expected when the image closes.

5 Responses
Add your response

And after all is working nicely, consider making a base worker image with all requisites loaded. And then load the in house code on top. This will reduce the build times by an order of magnitude.

over 1 year ago ·

Yeah, investment in automation has high returns!

over 1 year ago ·

I'll update the HelloPharo distrbution to use --quit from the command line instead of putting it in the setup script.

Thanks for sharing !

over 1 year ago ·

@fstephany hello-pahro looks really cool! I gave it a start.
I might give it a try for easing the deployment process of flow-based apps

over 1 year ago ·

Shouldn't Smalltalk imageSave be Smalltalk saveSession? There is no imageSave in Pharo 3.0

over 1 year ago ·