update client-go version to 4286a82 (#424)

2 files changed
tree: 7dc7fcc3d3174ab2c499740b94ca835bcf79c631
  1. commands/
  2. gradle/
  3. tests/
  4. tools/
  5. vendor/
  6. wski18n/
  7. .gitignore
  8. .scalafmt.conf
  9. .travis.yml
  10. build.gradle
  11. CONTRIBUTING.md
  12. DISCLAIMER.txt
  13. gradle.properties
  14. gradlew
  15. gradlew.bat
  16. LICENSE.txt
  17. main.go
  18. NOTICE.txt
  19. README.md
  20. settings.gradle
README.md

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:

$ ./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

The project includes a vendor/vendor.json and you can lock down dependencies for a clean build of the CLI by populating the vendor folder.

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

NOTE: As a temporary workaround, you have to remove a redundant instance of spf13/cobra in the vendor folder. See this issue for details.

$ rm -rf vendor/github.com/spf13

Now you can 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.

You can run unit tests as well (although note the majority of the tests today are not in Go).

$ cd commands
$ go get github.com/stretchr/testify/assert
$ go test -tags=unit -v

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.