Developing software in the Real World

Notes for working on the OpenWhisk PHP Runtime

These are some notes for working on the OpenWhisk PHP Runtime, but are probably applicable to the other runtimes too.

Setting up

I have a clone of the runtimes I’m interested in and core side-by-side in a directory.

You then need various tools for development, which are documented here for macOS & Ubuntu in the Prerequites section.

Build the container

The PHP runtime creates two containers, one for PHP 7.1 and one for PHP 7.2. To build them we use Gradle:

This will create the images action-php-v7.1 and action-php-v7.2 with aliases whisk/action-php-v7.1 & whisk/action-php-v7.2 respectively.

Tests

Run the tests using:

This will run all the tests for both containers. If you need to run just one container’s test, then use the --tests filter:

The tests use the BasicActionRunnerTests from core. If you have modified those, then you need to import them into your local Maven repo using:

You can then go back to the runtime directory and run the tests and they will pick up your local changes from core.

Interactive testing of a container

You can test the container using your local install of OpenWhisk.

Alternatively you can test directly against the container using the handy invoke.py script that lives in core’s tools/actionProxy directory:

Firstly run action container:

Then, in a different terminal:

Note that you don’t pass the action name to invoke.py because we’re working at the container level and there can be only one action for each container instance. This means that you need to stop the container and restart it to init a new action.

You can test zip files too by passing your zip file to invoke.py init:

Note that as the zip file must have a file called index.php in it, so we copy hello.php to index.php first.

Checking the formatting of Scala files

Travis runs on each PR raised. One thing it will do is check the formatting of the Scala. Check locally using:

Fin

The tooling available for working on a single action runtime makes it reasonably easy to concentrate on the job in hand and you don’t need to worry about building the rest of OpenWhisk at the same time.

One thought on “Notes for working on the OpenWhisk PHP Runtime

  1. You could use redo (aka wskdev)

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *