Skip to content
Apache OpenWhisk Ballerina runtime. Learn more at
Java Scala Shell Dockerfile Ballerina
Branch: master
Clone or download
dgrove-oss and rabbah gradlew licensing (#17)
* gradlew licensing

Update gradlew[.bat] scripts from Gradle v5.5 release which
have proper Apache license headers and add corresponding
entry to LICENSE.txt.

* full license headers
Latest commit 2f23ccf Aug 1, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
ballerina gradlew licensing (#17) Aug 1, 2019
gradle gradlew licensing (#17) Aug 1, 2019
tests Update Ballerina runtime to 0.990.2. (#10) Jan 26, 2019
tools/travis change travis builds to publish docker images with tag 'nightly' (#16) Jun 29, 2019
.gitignore Publish image hash tag (#12) Feb 7, 2019
.scalafmt.conf gradlew licensing (#17) Aug 1, 2019
.travis.yml add missing legal boilerplate files (#14) Mar 4, 2019
DISCLAIMER.txt add missing legal boilerplate files (#14) Mar 4, 2019
LICENSE.txt gradlew licensing (#17) Aug 1, 2019
NOTICE.txt add missing legal boilerplate files (#14) Mar 4, 2019 Update Ballerina runtime to 0.990.2. (#10) Jan 26, 2019
build.gradle updating readme Jul 23, 2018
gradlew gradlew licensing (#17) Aug 1, 2019
gradlew.bat gradlew licensing (#17) Aug 1, 2019
settings.gradle Update Ballerina runtime to 0.990.2. (#10) Jan 26, 2019

Apache OpenWhisk Runtime for Ballerina

License Build Status

This repository contains the Ballerina runtime for the Apache OpenWhisk serverless platform.


The following prerequisites are needed to try this out:

Creating a Ballerina function

Create a file hello.bal for your Ballerina function with the following code:

import ballerina/io;

public function main(json jsonInput) returns json {
  json output = { "response": "hello-world"};
  return output;

The Ballerina file must include a function called main. The abscence of main causes the Ballerina compiler to omit generation of the executable. You may have more than one entry point in your source file however (e.g., a main and a run) and use the standard OpenWhisk mechanism to specify other functions to run on entry (e.g., --main <other function name> when using the wsk action create CLI command). The function must accept a JSON object and return a JSON object to be compliant with the OpenWhisk action interface.

Compiling your function

Run the Ballerina compiler to build your function.

ballerina build hello.bal

This generates an executable hello.balx. You will use this binary to create the OpenWhisk action.

Creating and invoking your Ballerina action

Use the OpenWhisk wsk CLI to create your Ballerina action.

wsk action create hello hello.balx --docker openwhisk/action-ballerina-v0.990.2

Now you're ready to invoke the action:

wsk action invoke hello --result
  "response": "hello-world"

You can learn more about working with OpenWhisk Actions here.

Developing the Ballerina runtime for OpenWhisk

To build the Ballerina runtime, you need an OpenWhisk snapshot release which you can install as follows:

./gradlew install

where $OPENWHISK_HOME is an environment variable that points to your OpenWhisk directory.

The Ballerina runtime is built with the Gradle wrapper gradlew.

./gradlew distDocker

You can also use gradlew to run all the unit tests.

./gradlew :tests:test

Or to run a specific test.

./gradlew :tests:test --tests *ActionContainerTests*

This project can be imported into IntelliJ for development and testing. Import the project as a Gradle project, and make sure your working directory is the root directory for this repository.

You can’t perform that action at this time.