wskdeploy
Whisk Deploy
wskdeploy
is a utility to help you describe and deploy any part of the OpenWhisk programming model using a Manifest file written in YAML. Use it to deploy all your OpenWhisk Packages, Actions, Triggers, and Rules using a single command!
You can use this in addition to the OpenWhisk CLI. In fact, this utility uses the OpenWhisk "Go" Client to create its HTTP REST calls for deploying and undeploying your packages.
Here are some quick links for:
- Downloading wskdeploy - released binaries for Linux, Mac OS and Windows
- Running wskdeploy - run wskdeploy as a binary or Go program
✳️ Writing Package Manifests - a step-by-step guide on writing Package Manifest files forwskdeploy
- Building the project - download and build the GoLang source code
- Contributing to the project - join us!
- Debugging wskdeploy - helpful tips for debugging the code and your manifest files
- Troubleshooting - known issues (e.g., Git)
Building the project
GoLang setup
The wskdeploy utility is a GoLang program so you will first need to Download and install GoLang onto your local machine.
Make sure your $GOPATH
is defined correctly in your environment. For detailed setup of your GoLang development environment, please read How to Write Go Code.
Get the source code from GitHub
Once your environment is setup, download wskdeploy
and its dependencies:
$ cd $GOPATH
$ go get github.com/apache/incubator-openwhisk-wskdeploy # see known issues below if you get an error
Build the binary
Use the Go utility to build the wskdeploy
binary as follows:
$ cd src/github.com/apache/incubator-openwhisk-wskdeploy/
$ go build -o wskdeploy
building for other Operating Systems (GOOS) and Architectures (GOARCH)
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 may set
GOOS
to "linux", "darwin" or "windows"GOARCH
to "amd64" or "386"
For example, run the following command to build the binary for 64-bit Linux:
$ GOOS=linux GOARCH=amd64 go build -o wskdeploy
build using GoDep tool
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.
wskdeploy
Running After building the wskdeploy binary, you can run it as follows:
Running the Binary file
Start by verifying the utility can display the command line help:
$ ./wskdeploy --help
then try deploying an OpenWhisk Manifest and Deployment file:
$ ./wskdeploy -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/triggerrule/deployment.yml
Running as a Go program
Since wskdeploy
is a GoLang program, you may choose to run it using the Go utility:
$ go run main.go --help
and deploying using the Go utility would look like:
$ go run main.go -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/triggerrule/deployment.yml
Downloading released binaries
Binaries of wskdeploy
are available for download on the project's GitHub release page:
For each release, we typically provide binaries built for Linux, Mac OS (Darwin) and Windows on the AMD64 architecture. However, we provide instructions on how to build your own binaries as well from source code with the Go tool. See Building the project.
If you are a Developer or Contributor, we recommend building from the latest source code from the project's master branch.
Contributing to the project
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.
Developers should use "go deps" and "go build" not "go get"
The Whisk deploy project is setup for development purposes and uses "go deps" for dependency management. We do NOT recommend using "go get" as this will use the latest dependencies for all imported GitHub repos. which is not supported.
Specifically, for development please use:
$ git clone git@github.com:mrutkows/incubator-openwhisk-wskdeploy
$ go build
for end-users, please use versioned releases of binaries.
How to Cross Compile Binary with Gradle/Docker
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 -PcrossCompileWSKDEPLOY=true
Then, you will find the binaries and their compressed packages generated under the folder bin/<os>/<arch>/
for each supported Operating System and CPU Architecture pair.
Building for Internationalization
Please follow this process for building any changes to translatable strings:
Troubleshooting
Known issues
Git commands using HTTPS, not SSH
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
you can manually change the remote (origin) url within your .git/config file:
[remote "origin"]
url = git@github.com:<username>/incubator-openwhisk-wskdeploy
while there, you can verify that your upstream repository is set correctly:
[remote "upstream"]
url = git@github.com:apache/incubator-openwhisk-wskdeploy
Git clone RPC failed: HTTP 301
This sometimes occurs using "go get" the wskdeploy code (which indirectly invokes "git clone").
Note: Using "go get" for development is unsupported; instead, please use "go deps" for dependency management.
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
versions not forwarding requests anymore. One solution is to allow forwarding for gopkg.in
$ git config --global http.https://gopkg.in.followRedirects true
Creating Tagged Releases
Committers can find instructions on how to create tagged releases here: