commit | c4bb46d0529ad16215954360cdc6a91ab857058e | [log] [tgz] |
---|---|---|
author | Vincent <shou@us.ibm.com> | Tue Sep 19 21:01:08 2017 -0400 |
committer | Ying Chun Guo <guoyingc@cn.ibm.com> | Wed Sep 20 09:01:08 2017 +0800 |
tree | a0275688730d166130d12e5969e97f60dbbcc387 | |
parent | 333bde150d7cf57b8b42afcdc804413e0d2cc172 [diff] |
Add the document to explain how to generate i18n_resources.go (#517) Closes #509
wskdeploy
wskdeploy
is a utility to help you create and deploy OpenWhisk packages and their entities using a Manifest file wrttien in YAML. Deploy all your Actions, Triggers, Rules and rules using a single command! You can use this in addition to the OpenWhisk CLI. In fact, this utility uses the OpenWhisk “Go” CLI to create its HTTP REST calls for deploying and undeploying your packages.
wskdeploy
is written in Go. You can invoke it as a Go program, or run its binary file wskdeploy
directly after building.
The following examples show you how to invoke wskdeploy's command line help using both methods, as well as deploy the triggerrule
test case:
invoking command line help:
$ go run main.go --help
deploying the triggerrule
test case:
$ go run main.go -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/triggerrule/deployment.yml
invoking command line help:
$ ./wskdeploy --help
deploying the triggerrule
test case:
$ ./wskdeploy -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/triggerrule/deployment.yml
wskdeploy
is available on the release page of openwhisk-wskdeploy project: click here to download. We currently have binaries available for Linux, Mac OS and windows under amd64 architecture. You can find the binary, which fits your local environment.
There is another approach to get the binary wskdeploy
, which is to build it from the source code with Go tool.
Make sure $GOPATH
is defined. If not, setup your Go development environment.
Then download wskdeploy
and dependencies by typing:
$ cd $GOPATH $ go get github.com/apache/incubator-openwhisk-wskdeploy # see known issues below if you get an error
And finally build wskdeploy
$ cd src/github.com/apache/incubator-openwhisk-wskdeploy/ $ go build -o wskdeploy
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. You have to set GOARCH to amd64 or 386. GOOS can be set to “linux” “darwin” or “windows”.
For example, run the following command to build the binary for 64-bit Linux:
$ GOOS=linux GOARCH=amd64 go build -o wskdeploy
If you want to build with the godep tool, please execute the following commands.
$ go get github.com/tools/godep # Install the godep tool. $ godep get # Download and install packages with specified dependencies. $ godep go build -o wskdeploy # build the wskdeploy tool.
You can verify your build by running:
./wskdeploy --help
Start by creating a fork of incubator-openwhisk-wskdeploy
and then change the git origin
to point to your forked repository, as follows:
$ cd $GOPATH/src/github.com/apache/incubator-openwhisk-wskdeploy $ git remote rename origin upstream $ git remote add origin https://github.com/<your fork>/incubator-openwhisk-wskdeploy $ git fetch --all $ git branch --set-upstream-to origin/master # track master from origin now
You can now use git push
to push changes to your repository and submit pull requests.
If you don't want to bother with go installation, build, git clone etc, and you can do it with Gradle/Docker. After compiling, a suitable wskdeploy binary that works for your OS platform will be available under /bin directory.
First you need a docker daemon running locally on your machine.
Make sure you have Java 1.7 or above installed.
Clone the wskdeploy repo with command git clone https://github.com/apache/incubator-openwhisk-wskdeploy.git
If you use Windows OS, type gradlew.bat -version
. For Unix/Linux/Mac, please type ./gradlew -version
.
Make sure you can see the correct Gradle version info on your console. Currently the expected Gradle version is 3.3.
For Windows type gradlew.bat distDocker
. For Linux/Unix/Mac, please type ./gradlew distDocker
. These commands will start the wskdeploy cross compile for your specific OS platform inside a Docker container.
After build success, you should find a correct binary under current /bin dir of you openwhisk-deploy clone dir.
If you would like to build the binaries available for all the operating systems and architectures, run the following command:
$ ./gradlew distDocker -PcrossCompileCLI=true
Then, you will find the binaries and their compressed packages generated under the folder bin/// for each operating system and CPU architecture pair. We supports both amd64 and 386 for Linux, Mac and Windows operating systems.
Wskdeploy uses the OpenWhisk Go Client to format and invoke OpenWhisk's APIs which has additional debug tracing available.
To enable this trace, set the following environment variable in Bash:
# set to any value > 0 WSK_CLI_DEBUG=1
The “go get” command uses HTTPS with GitHub and when you attempt to “commit” code you might be prompted with your GitHub credentials. If you wish to use your SSH credentials, you may need to issue the following command to set the appropriate URL for your “origin” fork:
git remote set-url origin git@github.com:<username>/incubator-openwhisk-wskdeploy.git
This sometimes occurs using “go get” the wskdeploy code (which indirectly invokes “git clone”). You might get this error when downloading incubator-openwhisk-wskdeploy
:
Cloning into ''$GOAPTH/src/gopkg.in/yaml.v2'... error: RPC failed; HTTP 301 curl 22 The requested URL returned error: 301 fatal: The remote end hung up unexpectedly
This is caused by newer git
not forwarding request anymore. One solution is to allow forwarding for gopkg.in
$ git config --global http.https://gopkg.in.followRedirects true