Interacts with OpenFaaS CLI.
- OpenFaaS CLI binary executable >= 0.17
Builds OpenFaaS function containers.
faas.build(
bin: '/usr/bin/faas-cli', // optional executable path for faas-cli
filter: 'filter_string', // optional wildcard to match with function names in yaml file
noCache: false, // optional do not use docker's build cache
parallel: '1', // optional build in parallel to depth specified
pull: false, // optional force re-pull of base images
regex: 'regexp_string', // optional regex to match with function names in yaml file
squash: false, // optional use docker's squash flag for smaller images
tag: 'latest', // optional tag override for function image
template: 'samples.yaml' // path to yaml file describing function(s)
)Deploys OpenFaaS function containers.
faas.deploy(
bin: '/usr/bin/faas-cli', // optional executable path for faas-cli
filter: 'filter_string', // optional wildcard to match with function names in yaml file
gateway: 'http://127.0.0.1:8080', // optional gateway url with protocol
label: ['canary':'true', 'dev':'false'], // optional labels to set
namespace: 'default', // optional namespace of the function
regex: 'regexp_string', // optional regex to match with function names in yaml file (default is unused)
regex: 'regexp_string', // optional regex to match with function names in yaml file
secret: 'dockerhuborg', // optional secure secret to give function access to
strategy: 'update', // optional function strategy (valid: 'update' or 'replace')
template: 'samples.yaml', // path to yaml file describing function(s)
tls: true // optional TLS validation
)Invokes an OpenFaaS function.
faas.invoke(
async: false, // optional invoke the function asynchronously
bin: '/usr/bin/faas-cli', // optional executable path for faas-cli
contentType: 'text/plain', // optional content-type HTTP header
filter: 'filter_string', // optional wildcard to match with function names in yaml file
function: 'echo', // name of the deployed function
gateway: 'http://127.0.0.1:8080', // optional gateway url with protocol
header: ['X-Callback-Url':'http://gateway:8080/function/send2slack', 'X-Ping-Url':'http://request.bin/etc'], // optional HTTP request headers
method: 'POST', // optional HTTP request method
namespace: 'default', // optional namespace of the function
query: ['repo':'faas-cli', 'org':'openfaas'], // optional queries for request
regex: 'regexp_string', // optional regex to match with function names in yaml file
stdin: 'image.png', // optional stdin for function to receive
tls: true // optional TLS validation
)List OpenFaaS functions. The output function list and information is also returned by this method as a String.
faas.list(
bin: '/usr/bin/faas-cli', // optional executable path for faas-cli
filter: 'filter_string', // optional wildcard to match with function names in yaml file
gateway: 'http://127.0.0.1:8080', // optional gateway url with protocol
namespace: 'default', // optional namespace of the function
quiet: false, // optional display only the function's id (mutually exclusive with verbose)
regex: 'regexp_string', // optional regex to match with function names in yaml file
sort: 'name', // optional sort category (valid: 'name' or 'invocations')
tls: true // optional TLS validation
verbose: false, // optional display extra function information (mutually exclusive with quiet)
)Log in to the specified OpenFaaS gateway.
faas.login(
bin: '/usr/bin/faas-cli', // optional executable path for faas-cli
gateway: 'http://127.0.0.1:8080', // optional gateway url with protocol
password: 'password', // gateway password
user: 'admin', // optional gateway username
tls: true // optional TLS validation
)Fetch logs for a given function name. The logs are returned by this method as a String.
faas.logs(
bin: '/usr/bin/faas-cli', // optional executable path for faas-cli
filter: 'filter_string', // optional wildcard to match with function names in yaml file
format: 'plain', // optional return format (plain, keyvalue, or json)
gateway: 'http://127.0.0.1:8080', // optional gateway url with protocol
instance: false, // optional print the function instance name/id
name: 'sadpanda', // function name for which to retrieve logs
namespace: 'default', // optional namespace of the function
regex: 'regexp_string', // optional regex to match with function names in yaml file
since: '5s', // optional return logs newer than relative duration
tls: true // optional TLS validation
)Pushes the OpenFaaS function container image(s) to a remote repository. These container images must already be present in your local image cache.
faas.push(
bin: '/usr/bin/faas-cli', // optional executable path for faas-cli
filter: 'filter_string', // optional wildcard to match with function names in yaml file
parallel: '1', // optional build in parallel to depth specified
regex: 'regexp_string', // optional regex to match with function names in yaml file
tag: 'latest', // override latest tag on function Docker image
template: 'samples.yaml' // path to yaml file describing function(s)
)Removes/deletes deployed OpenFaaS functions.
faas.remove(
bin: '/usr/bin/faas-cli', // optional executable path for faas-cli
filter: 'filter_string', // optional wildcard to match with function names in yaml file
gateway: 'http://127.0.0.1:8080', // optional gateway url with protocol
namespace: 'default', // optional namespace of the function
regex: 'regexp_string', // optional regex to match with function names in yaml file
template: 'samples.yaml' // path to yaml file describing function(s)
tls: true // optional TLS validation
)Validates template syntax. This method will return a Boolean type indicating whether the validation was successful (true) or not (false).
faas.validateTemplate('template.yaml')