Skip to content

Latest commit

 

History

History
180 lines (133 loc) · 6.96 KB

README.md

File metadata and controls

180 lines (133 loc) · 6.96 KB

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 github.com/apache/incubator-openwhisk-cli
$ cd $GOPATH/src/github.com/apache/incubator-openwhisk-cli

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

$ go get -u github.com/jteeuwen/go-bindata/...
$ 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 github.com/kardianos/govendor         # 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.

Disclaimer

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.