This is an automated email from the ASF dual-hosted git repository.
dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-composer.git
The following commit(s) were added to refs/heads/master by this push:
new ee3f7fd Add support for setting the apiversion in the deploy command
(#58)
ee3f7fd is described below
commit ee3f7fd32ca2e8089e33880b4e3f44d13c08715f
Author: Olivier Tardieu <[email protected]>
AuthorDate: Fri Nov 15 08:13:37 2019 -0500
Add support for setting the apiversion in the deploy command (#58)
---
bin/deploy.js | 4 +++-
client.js | 5 ++++-
docs/COMMANDS.md | 5 +++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/bin/deploy.js b/bin/deploy.js
index 5fffccd..5a54691 100755
--- a/bin/deploy.js
+++ b/bin/deploy.js
@@ -28,7 +28,7 @@ const minimist = require('minimist')
const path = require('path')
const argv = minimist(process.argv.slice(2), {
- string: ['apihost', 'auth', 'source', 'annotation', 'annotation-file',
'debug', 'kind'],
+ string: ['apihost', 'apiversion', 'auth', 'source', 'annotation',
'annotation-file', 'debug', 'kind'],
boolean: ['insecure', 'version', 'overwrite', 'basic', 'bearer'],
alias: { auth: 'u', insecure: 'i', version: 'v', annotation: 'a',
'annotation-file': 'A', overwrite: 'w', timeout: 't', memory: 'm', logsize: 'l'
}
})
@@ -45,6 +45,7 @@ if (argv._.length !== 2 || path.extname(argv._[1]) !==
'.json') {
console.error(' -a, --annotation KEY=VALUE add KEY annotation with
VALUE')
console.error(' -A, --annotation-file KEY=FILE add KEY annotation with
FILE content')
console.error(' --apihost HOST API HOST')
+ console.error(' --apiversion VERSION API VERSION')
console.error(' --basic force basic
authentication')
console.error(' --bearer force bearer token
authentication')
console.error(' -i, --insecure bypass certificate
checking')
@@ -88,6 +89,7 @@ try {
const options = { ignore_certs: argv.insecure }
if (argv.apihost) options.apihost = argv.apihost
if (argv.auth) options.api_key = argv.auth
+if (argv.apiversion) options.apiversion = argv.apiversion
try {
composition.name = fqn(argv._[0])
} catch (error) {
diff --git a/client.js b/client.js
index 233b4a2..e1863a0 100644
--- a/client.js
+++ b/client.js
@@ -29,6 +29,7 @@ const path = require('path')
module.exports = function (options, basic, bearer) {
// try to extract apihost and key first from whisk property file file and
then from process.env
let apihost
+ let apiversion
let apikey
let ignorecerts
let namespace = '_'
@@ -44,6 +45,8 @@ module.exports = function (options, basic, bearer) {
if (parts.length === 2) {
if (parts[0] === 'APIHOST') {
apihost = parts[1]
+ } else if (parts[0] === 'APIVERSION') {
+ apiversion = parts[1]
} else if (parts[0] === 'AUTH') {
apikey = parts[1]
} else if (parts[0] === 'NAMESPACE') {
@@ -70,7 +73,7 @@ module.exports = function (options, basic, bearer) {
}
}
- const wsk = openwhisk(Object.assign({ apihost, api_key: apikey,
auth_handler: authHandler, namespace, ignore_certs: ignorecerts }, options))
+ const wsk = openwhisk(Object.assign({ apihost, apiversion, api_key: apikey,
auth_handler: authHandler, namespace, ignore_certs: ignorecerts }, options))
wsk.compositions = new Compositions(wsk)
return wsk
}
diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md
index 2850e2a..6e37924 100644
--- a/docs/COMMANDS.md
+++ b/docs/COMMANDS.md
@@ -75,6 +75,7 @@ Flags:
-a, --annotation KEY=VALUE add KEY annotation with VALUE
-A, --annotation-file KEY=FILE add KEY annotation with FILE content
--apihost HOST API HOST
+ --apiversion VERSION API VERSION
--basic force basic authentication
--bearer force bearer token authentication
-i, --insecure bypass certificate checking
@@ -144,6 +145,10 @@ If the `--apihost` flag is absent, the environment
variable `__OW_API_HOST` is
used in its place. If neither is available, the `deploy` command extracts the
`APIHOST` key from the whisk property file.
+The `apiversion` may be specified using the `--apiversion` flag, or, if absent,
+the `APIVERSION` property of the whisk property file. If both are absent, the
+default is assumed.
+
If the `--insecure` flag is set or the environment variable `__OW_IGNORE_CERTS`
is set to `true`, the `deploy` command ignores SSL certificates validation
failures.