OpenWhisk Command Line Interface (CLI)
Clone or download
mdeuser and dubee allow api context override (#367)
* allow api context override
Latest commit e01606d Sep 18, 2018
Failed to load latest commit information.
commands allow api context override (#367) Sep 18, 2018
gradle Add ASF license header to .gradle files. May 23, 2018
tests allow namespace invalid arg message to be overridden (#369) Sep 14, 2018
tools Specify the CLI tag when install the CLI binaries from local environm… Aug 18, 2018
vendor Add Govendor as the preferred way of installing dependencies for Go (#… Aug 22, 2018
wski18n Refactor trigger create using new utility methods to factor out print… Jun 19, 2018
.gitignore Add Govendor as the preferred way of installing dependencies for Go (#… Aug 22, 2018
.scalafmt.conf Update tests for upstream changes. (#350) Jul 9, 2018
.travis.yml Specify the CLI tag when install the CLI binaries from local environm… Aug 18, 2018 Restore the LICENSE and NOTICE to fit the source code release (#295) May 11, 2018
DISCLAIMER.txt Add the DISCLAIMER file for Apache incubator project Jun 12, 2018
LICENSE.txt Change the copyright back to unfilled template (#355) Aug 3, 2018
NOTICE.txt Restore the LICENSE and NOTICE to fit the source code release (#295) May 11, 2018 Fix up README (#361) Aug 29, 2018
build.gradle Change the copyright back to unfilled template (#355) Aug 3, 2018 Add ASF license header to .gradle files. May 23, 2018
gradlew bump to gradle4 Aug 17, 2017
gradlew.bat Add the gradlew wrapper Apr 5, 2017
main.go Refactor action invoke functions (#319) Jun 18, 2018
settings.gradle Enable test scala formatting check in Travis (#351) Jul 12, 2018

OpenWhisk Command-line Interface wsk

Build Status License Join Slack Twitter

OpenWhisk Command-line Interface (CLI) is a unified tool that provides a consistent interface to interact with OpenWhisk services.

Where to download the binary of OpenWhisk CLI

The OpenWhisk CLI is available on the releases page. We currently have binaries available for Linux, Mac OS and Windows under i386 and amd64 architectures. Linux versions are also available under Linux on Z, Power and 64-bit ARM architectures. You can download the binary, which fits your local environment.

How to build the binary locally

The OpenWhisk CLI is written in the Go language. You have two options to build the binary locally:

  1. Build using the packaged Gradle scripts (including the 'gogradle' plugin) now the preferred build method.
  2. Compile in your local Go environment

Build the binary with Gradle

Note: For those who may have used the Gradle build previously, it has been re-engineered to no longer required Docker or Go to be pre-installed on your system. Using the gogradle plugin, Gradle now uses a preexisting Go environment to build if it can be located, or downloads and installs an environment within the build directory.

To build with Gradle, open an terminal, go to the directory of OpenWhisk CLI home directory, and build the binary via the following command under Linux or Mac:

$ ./gradlew compile -PnativeCompile

or run the following command for Windows:

$ ./gradlew.bat compile -PnativeCompile

After the build, you can find the binary wsk or wsk.exe in the build folder under the OpenWhisk CLI home directory. In addition, it is also available under the folder build/<os>-<architecture>/. For example, if your local operating system is Mac, and the CPU architecture is amd64, the binary can be found at build/mac-amd64/wsk and build/mac.

If you would like to build the binaries available for all the operating systems and architectures, run the following command:

$ ./gradlew compile

The build script will place the binaries into the folder build/<os>-<cpu arc>/ for each operating system and CPU architecture pair. The build supports both amd64 and 386 for Linux, Mac and Windows operating systems, as well as Power, 64-bit ARM, and S390X architectures for Linux.

A binary compatible with the local architecture will be placed at build/wsk (build\wsk.exe on Windows).

To specify a build for specific architectures, you can provide a comma or space-delimited list of hyphenated os-architecture pairs, like this:

$ ./gradlew compile -PbuildPlatforms=linux-amd64,mac-amd64,windows-amd64

The build library understands most representations of most Operating Systems.

Tests can be run using the Gradle script as well:

$ ./gradlew goTest -PgoTags=unit
$ ./gradlew goTest -PgoTags=native

Integration tests are best left to the Travis build as they depend on a fully functional OpenWhisk environment.

Compile the binary using your local Go environment

Make sure that you have Go installed, and $GOPATH is defined in your Go development environment.

Then download the source code of the OpenWhisk CLI and the dependencies by typing:

$ cd $GOPATH
$ go get
$ cd $GOPATH/src/

The CLI internationalization should be generated dynamically using the bindata tool:

$ go get -u
$ go-bindata -pkg wski18n -o wski18n/i18n_resources.go wski18n/resources

It is necessary to lock dependencies versions to obtain a clean build of wsk. To that end, it's now necessary to populate the vendors folder using the versions selected in the vendor/vendor.json:

$ go get -u         # Install govendor tool
$ govendor sync     # Download and install packages with specified dependencies.

Once vendor is populated, it's possible to build the binary:

$ go build -o wsk

If you would like to build the binary for a specific operating system, you may add the arguments GOOS and GOARCH into the Go build command. GOOS can be set to linux, darwin, or windows.

For example, run the following command to build the binary for Linux:

$ GOOS=linux GOARCH=amd64 go build -o wsk-$GOOS-$GOARCH

If it is executed successfully, you can find your binary wsk directly under OpenWhisk CLI home directory.

How to use the binary

When you have the binary, you can copy the binary to any folder, and add folder into the system PATH in order to run the OpenWhisk CLI command. To get the CLI command help, execute the following command:

$ wsk --help

To get CLI command debug information, include the -d, or --debug flag when executing this command.

Continuous Integration

Travis CI is used as a continuous delivery service for Linux and Mac. Currently Travis CI supports the environments of Linux and Mac, but it is not available for Windows. We will add support of AppVeyor CI in future to run test cases and build the binary for Windows.


Apache OpenWhisk Command-line Interface (CLI) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.