This package is a template for Openwhisk Packages, it can be used to build, test and integrate new packages.
openwhisk-package-template/ ├── actions │ └── hello_world.js ├── CONTRIBUTING.md ├── feeds │ └── ... ├── install.sh ├── LICENSE.txt ├── README.md ├── tests │ ├── credentials.json │ ├── credentials.json.enc │ └── src │ └── TemplateTests.scala ├── tools │ └── travis │ └── build.sh ├── TriggerProvider │ └── ... └── uninstall.sh
Install the package using ./install.sh $EDGE_HOST $AUTH_KEY $WSK_CLI
where :
This will create a new package called packageTemplate as well as a hello world action.
To uninstall the package, please use ./uninstall.sh $EDGE_HOST $AUTH_KEY $WSK_CLI
##Testing You can test your package using the test cases you provided within tests/src, it is highly recommended to use Scala in writing test cases. To execute the test cases locally ( local deployment of Openwhisk), please copy your test files into openwhisk/tests/src/packages
and then by using gradle within Openwhisk gradle :tests:test
this will execute all test files of openwhisk, to execute a specific test class you can use gradle :tests:test --tests "packages.CLASS_NAME
credentials: You may need credentials during testing, you can put whatever credentials you need in tests/credentials.json
(use tests/template_ceredentials.json
as an example). In case of travis deployment for continuous integration, you can encrypt credentials.json file by using travis CLI.
Caution: Do not forget to include tests/credentials.json in .gitignore.
##Package contents | Entity | Type | Parameters | Description | | --- | --- | --- | --- | | /namespace/packageTemplate
| package | - | Openwhisk Package Template | | /namespace/packageTemplate/helloWorld
| action | details | A simple hello world action |
###Feeds List here Feed actions ...
###Actions ####Hello World This action is a simple hello world, ######Parameters | Parameter | Type | Required | Description| Options | Default | Example | | ------------- | ---- | -------- | ------------ | ------- | ------- |------- | | name | string | no | A name to greet | - | - | “Openwhisk” |
######Usage To use this action, you need to pass the required parameters (refer to the table above)
wsk action invoke /namespace/packageTemplate/helloWorld -p name 'Openwhisk' --blocking
Output:
{ "message": "Hello, Openwhisk!" }
Please refer to CONTRIBUTING.md
See LICENSE.txt