Whisk Deploy — Zip Actions

Priti Desai
Nov 20, 2017 · 2 min read

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 wskdeploy:

Step 1: Create a manifest file (manifest.yaml)

Assuming that my-zip-action has the following directory structure and action source code:

$ ls actions/my-zip-action
index.js
package.json

index.js:

package.json

Step 2: Run npm install to install “string-format”

cd actions/my-action
npm install --production

Step 2: Deploy a zip action

./wskdeploy -i -p actions/my-zip-action/         ____      ___                   _    _ _     _     _
/\ \ / _ \ _ __ ___ _ __ | | | | |__ (_)___| | __
/\ /__\ \ | | | | '_ \ / _ \ '_ \| | | | '_ \| / __| |/ /
/ \____ \ / | |_| | |_) | __/ | | | |/\| | | | | \__ \ <
\ \ / \/ \___/| .__/ \___|_| |_|__/\__|_| |_|_|___/_|\_\
\___\/ |_|
Packages:
Name: zipaction
bindings:
* action: my-zip-action
bindings:
- name: name value: Amy
Do 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.

Enjoy!

Apache OpenWhisk

Apache OpenWhisk is a serverless cloud platform that…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store