OpenWhisk supports creating an action from a single source file like we saw in Getting Started with Whisk Deploy. OpenWhisk also supports creating an action using multiple source files and a set of packages on which your action depends on. These kind of actions are called zip actions.
Lets look at how we can deploy zip actions using
Step 1: Create a manifest file (manifest.yaml)
my-zip-action has the following directory structure and action source code:
$ ls actions/my-zip-action
Step 2: Run npm install to install “string-format”
npm install --production
Step 2: Deploy a zip action
./wskdeploy -i -p actions/my-zip-action/ ____ ___ _ _ _ _ _
/\ \ / _ \ _ __ ___ _ __ | | | | |__ (_)___| | __
/\ /__\ \ | | | | '_ \ / _ \ '_ \| | | | '_ \| / __| |/ /
/ \____ \ / | |_| | |_) | __/ | | | |/\| | | | | \__ \ <
\ \ / \/ \___/| .__/ \___|_| |_|__/\__|_| |_|_|___/_|\_\
* action: my-zip-action
- name: name value: AmyDo you really want to deploy this? (y/N): y
Deployment completed successfully.
We have deployed a zip action my-zip-action with dependent npm module
string-format. When you specify a directory location in Whisk Deploy manifest file for
function key under
action, Whisk Deploy creates a zip file based on that directory and creates an action with that zip file for us so that we dont have to maintain a zip file in our file system. Now, you can invoke this action just like any other OpenWhisk action.