Commit Graph

412 Commits

Author SHA1 Message Date
Fabian Lopez eb17fb819c
chore: example message changes between standalone and plugin (#507)
* example message changes between standalone and plugin

Signed-off-by: Fabian Lopez <lfabian@vmware.com>

* make template name a parameter in replaceNameInTemplate

Signed-off-by: Fabian Lopez <lfabian@vmware.com>

* use ExecuteTemplate error

Signed-off-by: Fabian Lopez <lfabian@vmware.com>
2021-09-08 06:42:45 -07:00
Zbynek Roubalik 77b019213a
chore: fix typo in `build` help message (#503)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-09-02 04:50:06 -07:00
Senthilnathan M 2ae3e46346
Minor fix in the help doc (#500) 2021-08-30 23:57:55 -07:00
Matej Vasek f7c55cb42e
test: add test for listing labels (#494)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-08-26 04:03:31 -07:00
Matej Vasek f2efbe5b42
fix: `config labels` panic (#493)
During refactor flag registration was unintentionally removed.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-08-25 05:32:25 -07:00
Lance Ball a4b15ad992
feat: move go, typescript and nodejs to paketo builders (#485)
This commit removes the Red Hat builders from the built in templates
for Go, TypeScript and Node.js, replacing them with paketo builders.
For Go, the builder is augmented with a simple buildpack that installs
the Go wrapper code and its dependencies. For TypeScript, the paketo
buildpacks oddly don't support an `npm build` step, so these templates
are also dependent on a small Boson buildpack. These buildpacks are
currently at https://github.com/lance/boson-buildpacks but should find
a home either in the boson-project organization, or the knative-sandbox
organization.

This change also slightly modifies how the Node.js and TypeScript
templates are structured, reducing the coupling between the buildpack
and a function project.

This commit includes the code in https://github.com/knative-sandbox/kn-plugin-func/pull/465
and is dependent on it in the use of manifest.yaml.

Provide sane defaults for health endpoints

Note that this will need to be documented as a requirement for
language packs that do not wish to provide explicit endpoints for
these kube health checks. In that case, the language pack should
specify these both as the root path, with a query parameter. For
example, `/?health=readiness` and `/?health=liveness`, or some other
similar construct.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-08-24 08:46:24 -07:00
jrangelramos 4b5d7365ac
doc: fix create command help message description (#486) 2021-08-20 00:35:06 -07:00
jrangelramos 10145aab29
style: create command output formatting for repository option (#487) 2021-08-19 14:13:05 -07:00
Lance Ball 10a07578e9
feat!: change `describe` command to `info` (#474)
The describe command conflicts sematically with kubectl describe.
This commit changes the command name to `info`.

Fixes: https://github.com/knative-sandbox/kn-plugin-func/issues/337

Signed-off-by: Lance Ball <lball@redhat.com>
2021-08-15 21:43:54 -07:00
Matej Vasek 84ff281bed
test: `config` sub-command (#457)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-08-12 06:30:35 -07:00
Zbynek Roubalik 55696811e3
feat!: use key&value for Labels (#472)
* feat!: use key/value for labels

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* fix typo

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-08-11 10:12:00 -07:00
Matej Vasek 79e2234cbc
fix: hide progress indicator if asking for creds (#458)
* fix: hide progress indicator if asking for creds

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fix: NPE in integration test

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-08-05 10:41:52 -07:00
Luke Kingland 9db1a3d902
feat: remote template repositories (#437)
* feat: remote template repositories

* Update cmd/create.go

Co-authored-by: Lance Ball <lball@redhat.com>

* docs: extensible templates

* feat: remote template repositories

* Update docs/guides/language-packs.md

* Update docs/guides/language-packs.md

Co-authored-by: Lance Ball <lball@redhat.com>

* Update docs/guides/language-packs.md

Co-authored-by: Lance Ball <lball@redhat.com>

* Update docs/guides/templates.md

Co-authored-by: Lance Ball <lball@redhat.com>

Co-authored-by: Lance Ball <lball@redhat.com>
2021-08-03 06:28:15 -07:00
Lance Ball 0dba67751e
feat: add support for labels in func.yaml (#373)
* feat: add support for labels in func.yaml and `func config`

This change adds support for setting labels on deployed functions. It uses
the interactive CLI prompt introduced by Zbynek to add, remove and list
labels applied on a deployed function.

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: fix string output for Pair type

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: review feedback

Signed-off-by: Lance Ball <lball@redhat.com>
2021-08-03 06:10:16 -07:00
Luke Kingland 66c26115b8
test: confirm repositories search path (#431) 2021-07-22 13:39:44 -07:00
Markus Thömmes 892558bf2a
Rename module to knative.dev/kn-plugin-func (#423)
Co-authored-by: Lance Ball <lball@redhat.com>
2021-07-15 11:33:32 -07:00
Luke Kingland afcde2d551
src: testable commands (#415)
* feat: client progress listener 'stopping' state

* src: testable commands

Restructures commands to accept a fn.Client constructor on command
instantiation.  This allows the concrete implementations, or entire
client to be mocked for testing.
Also some minor refacotring as necessary to shoehorn into the pattern.

* fix: increase default timeout to 120s for service creation

* chore: bump kind, knative and kubectl versions
2021-07-09 11:15:23 -04:00
Luke Kingland 4222e34aa6
src: test create command validates name 2021-06-24 21:08:06 +09:00
Luke Kingland 1591fa6759
src: refactor create command to be testable 2021-06-24 21:08:06 +09:00
Luke Kingland 5ded87368b
src: rename bosonFunc fn 2021-06-22 23:08:11 +09:00
Zbynek Roubalik 6f96011d7c
src: `create`- use Select for specifying runtime in interactive mode (#399)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-06-21 17:11:35 -04:00
Matej Vasek 88ea081cc0
fix: use credsStore
use credsStore when searching for credentials

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-06-21 15:51:56 +02:00
Zbynek Roubalik 7a24a103ef
src: refactor prompt to use `AlecAivazis/survey` (#397)
* src: refactor prompt to use `AlecAivazis/survey`

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-06-21 08:38:26 +02:00
Zbynek Roubalik 83a9ca684f
feat: `func config envs` - interactive prompt (#396)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-06-21 08:37:48 +02:00
Jim Crossley 947fcaa968
feat: add a URL output type for `func describe` (#389)
* Added a URL output type for 'func describe'

Fixes #387

Co-authored-by: Zbynek Roubalik <726523+zroubalik@users.noreply.github.com>
2021-06-18 09:50:36 +02:00
Zbynek Roubalik 54f60a2552
src: validate Env Var name (#395)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-06-18 09:12:45 +02:00
Zbynek Roubalik 4ba95b69a8
feat: `func config volumes` - interactive prompt (#391)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-06-17 09:21:07 +02:00
Matej Vasek 84f896b329
fix: password read on windows
* fix: password read on windows

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-06-16 04:18:40 +02:00
Luke Kingland 8041a25486
extensible repositories flag (#384)
The flag pointing to extensible template repositories is now called
repositories.  This fits with the expectation that this location
will most likely be filled with git repositories containing templates.
2021-06-14 14:57:05 -04:00
Luke Kingland 2147f97ba2
use 'a' for 'additional packages' parameter --packages 2021-06-10 22:42:53 +09:00
Lance Ball ce29ff6285
refactor!: change --trigger and --templates flags
This commit is a breaking change.

Change the `--trigger` flag to be `--template` and the `--templates` flag
to be `--packages`. This is being done in anticipation of future work focused
on making `func` extensibility friendlier, and in an attempt to finalized some
of the naming conventions we have used to date.

In fact, the `--trigger` flag used to be `--template` but we decided to
change that a few months ago. This commit reverses that decision. The reason
behind this is twofold.

1. Using 'trigger' has proved to be confusing. Even if I create a function
with an HTTP trigger, it will still be invoked when a CloudEvent is sent
to the function process. Or alternatively, it is possible to send a raw
HTTP request to a function with an event trigger. Using 'template' instead
implies that the incoming request does not determine how the function is
invoked - rather it is the structure of the function signature that informs
the invocation.

2. The `trigger` terminology is not inclusive enough for our use cases. For
example, a third party provider of function templates may provide a template
for multiplexing incoming HTTP requests in Go using `gorilla-mux`. It doesn't
really make sense to say that `gorilla-mux` is the trigger. It's just a
defining feature of how the template is structured. I think this:

```sh
func create --runtime go --template gorilla-mux
```

Makes more sense than this:

```sh
func create --runtime go --trigger gorilla-mux
```

In changing this flag to be `--template`, we then need to come up with
another name for our existing `--templates` flag. I chose `--packages`
because what is being specified here is more than just the template. The
user sees only the function template when they run `func create...` but
the filesystem from which this template is pulled also contains metadata
about the template - most importantly right now, `.builders.yaml`. It is
conceivable that we may ultimately want to stuff these directories with
event more metadata in the future.

Something like `--packages` makes sense to me, but I am open to suggestion.

Thinking of these as a package also allows for better extensibility features
down the road. For example, users could reference packages at a URI like so.

```
func create --packages https://mycompany.com/function/templates.tgz
```

This would result in `func` downloading the tarball, extracting it to the
config directory, and using it for additional templates.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-06-09 21:33:21 +09:00
Luke Kingland b30e883e67
refactor!: function signatures implied from trigger
Renames trigger to template, removing it as an unnecessary configuration.
This reiterates that a Function implementation can change function sig
implemented at any time, and it is not part of the configuration.  This
sets the stage for renaming 'templates', and the finalization of the
use cases enabling extensible templates.
2021-06-09 21:18:55 +09:00
Zbynek Roubalik 9d7fd34649
feat: reference Secrets in `envs` and `volumes` sections in config (#369)
* feat: reference Secrets in `envs` and `volumes` sections in config

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-06-02 09:20:28 +02:00
Zbynek Roubalik 4f0641f586
chore: bump Knative deps to 0.22.0 (#368)
* chore: bump Knative deps to 0.22.0

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-06-01 16:29:41 +02:00
Lance Ball 72584ced0d
fix: Revert "chore: bump Knative deps to 0.22.0 (#358)" (#366)
This reverts commit 27f62066ee.
2021-05-27 16:18:33 -04:00
Zbynek Roubalik 27f62066ee
chore: bump Knative deps to 0.22.0 (#358)
* chore: bump Knative deps to 0.22.0

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* update to Knative 0.22.0

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-05-25 15:05:05 +02:00
Lance Ball 2a0724083b
src: fail fast with conflicting flags (#348)
Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-17 08:41:44 -04:00
Lance Ball 49594d9766
feat: add 'kn func emit' command (#332)
This commit adds an Emitter to be used by the CLI commands
for sending CloudEvents to functions, either locally, on
the cluster, or at a specified endpoint.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-13 12:44:11 -04:00
Matej Vasek a74e3dd5e8
src: update CLI help for env flag
Update CLI help for env flag. Now mentioning unsetting of variable.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-13 16:19:22 +02:00
Matej Vasek a72a9a858a
src: add tests
Tests for mergeEnvMaps.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-13 15:01:33 +02:00
Lance Ball 2b025df199
src!: revert bump to go 1.16 and template changes (#340)
* Revert "src: rename boson import 'fn'"

This reverts commit c0a6f561c0.

* Revert "src: all test dirs set to 0700"

This reverts commit 99f01220c2.

* Revert "src: better error when custom template not found"

This reverts commit 6673395834.

* Revert "src: better errors when custom runtime not found"

This reverts commit a31a6f67a1.

* Revert "build: create separate target for templates.tgz"

This reverts commit 11164bf8d9.

* Revert "src: use consistent separators for fs.FS instances"

This reverts commit 4db07b412f.

* Revert "src: update go event template dependencies"

This reverts commit 3bfc13380f.

* Revert "src: tarfs assumes forward slashes internally"

This reverts commit 6cc0e67b1c.

* Revert "feat: support windows paths in embedded templates FS"

This reverts commit c2b216857b.

* Revert "feat: positive error when runtimme or template unrecognized"

This reverts commit acc56b0900.

* Revert "fix: lint issues"

This reverts commit 895872aee7.

* Revert "ci: go 1.16 compatiblity updates"

This reverts commit 1e3959c045.

* Revert "feat: preserve file modes using in-memory tar FS"

This reverts commit 7dc772ec62.

* Revert "feat: create templates archive on go generate"

This reverts commit 63b7f11471.

* Revert "ci: remove pkger from ci"

This reverts commit 876b0dd0f7.

* Revert "src: remove pkger dependency and tidy"

This reverts commit f006ab1e32.

* Revert "src: remove packaging artifact"

This reverts commit 4d9d0a7b4e.

* Revert "src: remove pkger from make targets"

This reverts commit e44c1ad74c.

* Revert "src: replace pkger with embed.FS"

This reverts commit 38874a4afd.

* Revert "src: update references to deprecated ioutil"

This reverts commit 4025460f73.

* Revert "src: require go 1.16"

This reverts commit 512d4c2580.

* chore: update pkged.go

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-12 14:37:21 -04:00
Jefferson Ramos 94e387c932 fix: added checks on delete command test for lint 2021-05-11 13:05:57 -03:00
Matej Vasek 5a3d385432 add tests for delete cmd
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-10 21:22:11 +02:00
Jefferson Ramos 8ab0ba243a fix: func delete with explicity name as argument (#323) with strict validation 2021-05-10 13:38:19 -03:00
Luke Kingland c0a6f561c0
src: rename boson import 'fn' 2021-05-07 14:17:14 +09:00
Matej Vasek 18cb0f4652
src: update knative deps to 0.21.0
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-05 17:20:32 +02:00
Lance Ball 857b0fd19d
feat: add/improve spinner for build and deploy (#322)
This commit modifies the progress meter so that, by default there is no
step counter. It also modifies the responsibility for calling `Done()`,
making it the job of the command rather than the client. This is because
the client does not know how many commands will be executed and therefore
cannot know when the progress bar is done.

This commit also adds String() to the progress bar, and moves logging
responsibility out of the deployer itself and fully into the client.
Deployer#Deploy() now returns a DeploymentResult.

Fixes: https://github.com/boson-project/func/issues/296

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-03 14:25:19 -04:00
Lance Ball 89ff286a1f
refactor!: change envVars to env in func.yaml (#316)
There are some places where I've changed variable and function names
where it wasn't strictly necessary. If you don't mind the bit of churn
that results, changing these makes `rg -i envvars` a nice way to check
for anything that could be overlooked.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-04-27 10:46:50 -04:00
Zbynek Roubalik 541e8586f7
feat: function name matches KService name (#317)
* feat: function name matches KService name

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* fix typo

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-04-26 10:13:32 +02:00
Matej Vasek 06455f4bac
fix: default for `--builder` flag
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-04-22 15:44:15 +02:00
Matej Vasek 923c788f4a
src: better ctx propagation (#283)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-24 11:05:52 -04:00
Matej Vasek dc2fbee67f
fix: `func deploy` uses Docker API, not binary
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-22 15:18:03 +01:00
Luke Kingland 8a91cac6cc
feat: add --build (default: true) flag to func deploy 2021-03-16 15:29:36 +09:00
Matej Vasek db0945ed3e
fix: `func run` now uses Docker API, not binary
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-15 18:24:57 +01:00
Zbynek Roubalik a5cbe3061b
src: rename from faas to func (#253)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-01-21 17:10:39 +01:00
Zbynek Roubalik 8d1f5b833d
fix: correcting broken merge (#252)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-12-14 09:54:07 -05:00
Lance Ball 61ea8d4fc6
fix: print "No functions found in [ns] namespace" for kn func list (#240)
When there are no functions deployed, the `kn func list` command now says so.

Fixes: https://github.com/boson-project/faas/issues/228

Signed-off-by: Lance Ball <lball@redhat.com>
2020-12-11 09:34:53 -05:00
Lance Ball 6470d9e574
fix: change --format flag to --output for list and describe commands (#248)
Fixes: https://github.com/boson-project/func/issues/223

Signed-off-by: Lance Ball <lball@redhat.com>
2020-12-11 15:32:30 +01:00
Lance Ball 8e72fd2eba
feat: add --all-namespaces flag to `func list` (#242)
* feat: add --all-namespaces flag to `func list`

Fixes: https://github.com/boson-project/faas/issues/224

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: linting

Signed-off-by: Lance Ball <lball@redhat.com>
2020-12-10 12:12:11 +01:00
Lance Ball 5a3a0d6bda
fix: fix the help text for the describe function (#243)
That must have been a copy/paste error.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-12-10 12:10:52 +01:00
Kamesh Sampath 557361a374
feat: add spring cloud function runtime and templates (#231)
* feat: add spring cloud function runtime and templates

* docs: review updates

* squash: apply suggestions from code review

Co-authored-by: Lance Ball <lball@redhat.com>
2020-11-25 12:15:48 -05:00
Roland Huß 5dd72d7348
chore: Update help messages and adding examples. (#218)
* chore: Update help messages and adding examples.

This commit introduces fixes for the top-level help message as described in #187.

It does not address:

* #216 - Use `kn function` in help message when run as a plugin to kn
* #215 - Group main help message to put important commands to the top
* #214 - Make examples in usage message parameterizable
2020-11-06 14:11:57 -05:00
Matej Vasek d5624980d5
fix: `delete` and `deploy sub-commands respects func.yaml conf 2020-11-06 17:19:10 +01:00
Zbynek Roubalik 470ebb9da4
rename function -> func (#217)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-11-06 12:47:30 +01:00
Zbynek Roubalik cd57692c9d
feat!: rename faas to function (#210)
* rename faas to function

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* function.yaml -> func.yaml

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-11-06 10:41:42 +01:00
Luke K 57e12362af
feat!: remove create cli subcommand (#180) 2020-11-06 17:08:49 +09:00
Zbynek Roubalik ddbb95b075
feat: Better output of build/deploy/delete commands (#206)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-11-05 16:46:21 +01:00
Zbynek Roubalik 29ca07768c
feat: list command - improved output (#205)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-11-04 13:15:06 +01:00
Lance Ball 61cb56aec3
feat: change default runtime to Node.js HTTP (#198)
Fixes: https://github.com/boson-project/faas/issues/191

Signed-off-by: Lance Ball <lball@redhat.com>
2020-11-02 09:27:31 -05:00
Zbynek Roubalik 551331925a
chore: tweak output & verbose messages (#173)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-10-15 19:00:28 +02:00
Zbynek Roubalik 68351bd0ec
src: use Knative Client libraries (#167)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-10-14 10:42:26 +02:00
Matej Vasek 5182487df2
feat: user can set envvars 2020-10-13 14:11:06 +02:00
David Simansky ec5327d520
fix: root cmd init 2020-10-08 18:35:18 +02:00
David Simansky 85a5f475eb
feat(kn): Enable faas to be integrated as plugin to kn (#155)
Provides capabilities for the faas CLI to exist as a plugin in the upstream kn CLI.

Tested with kn 0.17
2020-10-08 10:14:10 -04:00
Zbynek Roubalik 2c7c18dd9b
chore: commands are checking that Function is initialized (#162)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-10-08 15:32:46 +02:00
Lance Ball e425c8f081
src!: change all references of "repository" to "registry" for images (#156)
When dealing with images, instead of referring to an image repository,
let's instead use the more correct term "registry", even though we're
actually using "registry/namespace" in most case.

Signed-off-by: Lance Ball <lball@redhat.com>
2020-10-08 10:58:17 +02:00
Zbynek Roubalik d5839ea6c1
feat!: combine deploy and update commands (#152)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-10-07 17:29:09 +02:00
Matej Vasek d82230353d
feat: fish completion 2020-10-06 15:39:07 +02:00
Matej Vasek bf9b048813
fix: stop using manually edited completion 2020-10-05 22:06:49 +02:00
Matej Vasek c2b4a304bd
feat: ability for users to specify custom builders (#147)
* refactor: functionWithOverrides
* feat: custom Buildpacks builder
* fix: namespaces
2020-10-05 10:29:51 -04:00
Lance Ball a698f39d1d
chore: rename .faas.yaml to faas.yaml (#143)
Fixes: https://github.com/boson-project/faas/issues/142

Signed-off-by: Lance Ball <lball@redhat.com>
2020-09-29 10:27:04 -04:00
Lance Ball d6e131f915
feat: set builder images in templates and .faas.yaml (#136)
This commit adds a .builder.yaml file to each template directory. In the file
there is at the moment a single key/value pair, "default: <image>", where the
actual builder image name is <image>. Using a mapping allows the future
possibility that a user may specify a builder image by name via a flag on the
command line. For example,

```console
faas build --builder native
```

When a project is initialized, the .builder.yaml file is read, and the default
builder is saved in the project's .faas.yaml file. The .faas.yaml file is then
consulted when building an image with `faas build`. If the builder image is
specified, then the builder will use it. Otherwise, it will fallback to the
defaults. This allows developers to create custom builders, and specify them
in the configuration file.

After extracting the builder image from .builder.yaml in the project directory,
this file is deleted.

This commit also adds Verbose to the init command.
2020-09-24 11:41:34 -04:00
Lance Ball 05efee8c83
src: add Long command descriptions for each of the CLI commands (#133)
Uses the Cobra "Long" configuration for each command to provide more
descriptive text.

Example:

```console
faas help create                                                                                                      1.3m  Mon 21 Sep 2020 09:55:40 PM EDT
Create a new Function, including initialization of local files and deployment

Creates a new Function project at 'path'. If 'path' does not exist, it is
created. The function name is the name of the leaf directory at path. After
creating the project, a container image is created and is deployed. This
command wraps 'init', 'build' and 'deploy' all up into one command.

The runtime, trigger, image name, image repository, and namespace may all be
specified as flags on the command line, and will subsequently be the default
values when an image is built or a Function is deployed. If the image name and
image repository are both unspecified, the user will be prompted for a
repository name, and the image name can be inferred from that plus the function
name. The function name, namespace, image name and repository name are all
persisted in the project configuration file .faas.yaml.

Usage:
  faas create <path> [options] [flags]

Flags:
  -c, --confirm             Prompt to confirm all configuration options - $FAAS_CONFIRM
  -h, --help                help for create
  -i, --image string        Optional full image name, in form [registry]/[namespace]/[name]:[tag] for example quay.io/myrepo/project.name:latest (overrides --repository) - $FAAS_IMAGE
  -n, --namespace string    Override namespace into which the Function is deployed (on supported platforms).  Default is to use currently active underlying platform setting - $FAAS_NAMESPACE
  -r, --repository string   Repository for built images, ex 'docker.io/myuser' or just 'myuser'.  Optional if --image provided. - $FAAS_REPOSITORY
  -l, --runtime string      Function runtime language/framework. - $FAAS_RUNTIME (default "go")
      --templates string    Extensible templates path. - $FAAS_TEMPLATES (default "/home/lanceball/.config/faas/templates")
  -t, --trigger string      Function trigger (ex: 'http','events') - $FAAS_TRIGGER (default "http")

Global Flags:
      --config string   config file path (default "~/.faas/config")
  -v, --verbose         print verbose logs
```
2020-09-24 10:23:55 -04:00
Zbynek Roubalik 025862689e
feat: decouple function name from function domain (#127)
* decouple function name from function domain

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2020-09-24 09:52:22 -04:00
Lance Ball fae27dabc9
fix: correct value for config path and robustify (#130)
* fix: correct value for config path and robustify

The hardcoded, initial value for the configuration path was set to
`.faas/config`. But `configPath()` immediately sets this to the correct
value of ~/.config. Both the create and init commands use `configPath()`
to search for additional templates, if they exist, and were each doing
`filepath.Join(configPath(), "faas", "templates")`. This commit also
changes `configPath()` so that it is `~/.config/faas` and does so in a
cross platform friendly way. If the `$HOME` directory cannot be
determined, the config is assumed to be at `./.config/faas`.

* squash: remove config variable entirely
2020-09-21 14:35:46 -04:00
Lance Ball 3868ef3441 chore: remove [options] from usage string
The cobra package, magically appends "[flags]" to the usage string
if a command has flags. By adding "[options]" to the usage string,
we end up with help text that looks like this.

```
  faas init <name> [options] [flags]
```

This commit fixes that.
2020-09-19 17:23:08 -04:00
Lance Ball 566d8f9255 feat: default to no confirmation prompts for CLI commands
The CLI commands all printed confirmation prompts for the various flags
they exposed. This commit modifies that logic, so that there is no longer
a `-y` flag, but instead a `--confirm` or `-c` flag for each command, and
prompts are only displayed if using this flag. In most cases, the derived
values are printed even if not prompted for.

In call cases where the user is prompted, I have removed the "Verbose"
prompt, as that seems less like a configuration option that needs to be
confirmed, and more like just a CLI option for the current run which we
can just accept as-is.

The text for the prompts has also been reduced to one or two words.

Also added are some checks around image naming and repositories, short
circuiting failures that could occur if these are not specified or are
unknown. For example, if a user does `faas init` and then `faas deploy`
we don't yet know what the image name should be - one hasn't been built.

Fixes: https://github.com/boson-project/faas/issues/91
Fixes: https://github.com/boson-project/faas/issues/90
Fixes: https://github.com/boson-project/faas/issues/89
2020-09-11 14:36:34 -04:00
Matej Vasek 284b77f7ef fix: delete command
There was hard-coded `faas` namespace.
2020-09-10 10:06:20 -04:00
Luke K ce48083a10
fix: remove references to unused binaries appsody, kn, kubectl 2020-09-04 23:08:03 +09:00
Matej Vasek 91172ef0b1
fix: image override (#88) 2020-09-02 08:37:17 -04:00
Luke K 3fc39aa773
feat: consolidate formatters
- Replaces globally-scoped formatter function with methods
- Defines enumerated Format types
- Renames the 'output' flag 'format' due to confusion with command file descriptors
- FunctionDescription now Function
- Global verbose flag replaced with config struct based value throughout
2020-08-31 16:37:07 +09:00
Luke K 00ac880c3b
docs: fix function typos 2020-08-29 01:55:33 +09:00
Luke K d33fb2d694
feat: test suite
- updated tests to new api throughout
- expanded tests where appropriate
- lint issues
- minor code review comments addressed
2020-08-29 01:55:33 +09:00
Luke K 4918cc7eef
feat: cli usability enhancements and API simplification 2020-08-29 01:54:13 +09:00
Luke K 2fcbe740e9
fix: default k8s namespace to 'faas' per documentation 2020-08-29 01:52:56 +09:00
Matej Vasek fbab8c09d0
feat: the `list` sub-command uses namespace 2020-08-24 14:08:25 +02:00
lkingland 4c3a276c2f
feat: version command respects verbose flag (#61) 2020-08-13 17:05:59 -04:00
Lance Ball 5b4d97a443
feat: add init/build/deploy commands and customizable namespace (#65)
* feat: add init/build/deploy commands and customizable namespace

This commit comprises some fairly large changes in the codebase.
The 'create' command has been extracted into 'init', 'bulid' and
'deploy' commands. The 'create' command remains, but now delegates
most of its work to these other three. This also has resulted in
some rework of the various flags. 

In addition, it is now possible to specify the cluster namespace to
which the function will be deployed.
2020-08-12 10:52:50 -04:00
Matej Vasek 17a00c9057
feat: JSON output for the `list` sub-command 2020-08-11 15:25:33 +02:00
Matej Vasek 4677b3452f
chore: add lint to GH actions CI 2020-07-29 17:47:08 +02:00
Luke K dd2e70969f
feat: version prints semver first 2020-07-28 15:02:23 +00:00
Luke K 7c253298ea
fix: version flag 2020-07-28 15:02:23 +00:00
Luke K cb0a74714c
enable build from tag 2020-07-08 12:22:27 +00:00
Luke K a232165688
make build with version tags 2020-07-08 02:32:35 +00:00
Luke K 3d7a386fec
v0.2.1 2020-07-08 02:00:52 +00:00
Luke K 7b0e59248d
Merge remote-tracking branch 'matej/imprv-deploy' into develop 2020-07-08 01:59:46 +00:00
Luke K 7b2f623de0
Merge remote-tracking branch 'matej/imrv-remove' into develop 2020-07-08 01:57:16 +00:00
Luke K 95db3bd133
Merge remote-tracking branch 'lkingland/templates' into develop 2020-07-08 01:52:57 +00:00
Luke K 711094b02e
rename Service Function to simply Function 2020-07-02 14:52:27 +00:00
Luke K 560a269039
update language references to associated runtime 2020-07-02 13:18:19 +00:00
Luke K f23e81538f
rename language to runtime 2020-07-02 13:06:54 +00:00
Matej Vasek 8610218159 fix: remove dependency on `kubectl` binary 2020-07-01 18:21:19 +02:00
Matej Vasek d503a73680 fix: remove dependency on `kn` binary 2020-07-01 17:02:19 +02:00
Luke K 5e621e583a
reference context from templates in main 2020-07-01 14:02:08 +00:00
Matej Vasek 22c60c7379 feat: remove dependency on `kn` binary 2020-06-16 21:13:39 +02:00
Luke K 2301a908ae
remove deprecated root cmd test 2020-06-16 14:32:15 +00:00
Luke K 75cee352e5
templates flag defaulting to XDG or ~/.config 2020-06-11 12:25:34 +00:00
Luke K 5febf1ac4a
add function context (style) to Create 2020-06-11 12:23:49 +00:00
Luke K b5ffc25b5c
v0.2.0 2020-06-11 12:18:44 +00:00
Matej Vasek 5e8dc8b5f7
feat: buildpacks
Implemented builder using buildpack.
2020-06-08 18:38:55 +02:00
Luke K b5a7f020a5
Merge remote-tracking branch 'matejvasek/shell-comp' into shell-comp 2020-06-01 11:18:55 +00:00
Luke K 0b937285c7
v0.1.0 2020-06-01 11:16:05 +00:00
Luke K 5ec4ac644a
pass through verbose mode 2020-05-28 13:53:06 +00:00
Luke K 9671e5af74
progress indicator on create 2020-05-28 07:47:07 +00:00
Matej Vasek 3cefa758df fixup 2020-05-27 20:06:00 +02:00
Matej Vasek cdaa1869d2 Add some more completion 2020-05-27 19:32:39 +02:00
Matej Vasek 290b59ec12 Add shell completion fixes 2020-05-27 18:14:56 +02:00
Matej Vasek acbaf48c0b Add shell completion for bash and zsh 2020-05-26 23:15:37 +02:00
Luke K a0e9fcb11c
remove debug and cleanup 2020-05-25 08:56:46 +00:00
Luke K 625a270942
bind flags on pre-run rather than init 2020-05-25 08:44:28 +00:00
Luke K 032ab96787
gather create config from user using prompts 2020-05-25 08:43:55 +00:00
Luke K c12c5c17d2
gather create parameters into a structure 2020-05-23 03:30:40 +00:00
Luke K fd27affb4b
final url print placeholder 2020-05-23 01:25:12 +00:00
Luke K dbc97b1652
v0.0.17 2020-05-11 07:05:56 +00:00
Luke K 31d601197a
expand describe to default to current active function (CWD) 2020-05-11 04:59:41 +00:00
Luke K 88d806b52b
allow path to be provided to commands 2020-05-11 04:01:49 +00:00
Luke K 853d0eb4db
remove defaults to CWD, with name parameter available 2020-05-11 01:40:37 +00:00
Luke K 48e761c999
internal mode stub 2020-05-11 00:27:49 +00:00
Luke K be955cce39
update local mode to option 2020-05-11 00:24:11 +00:00
Luke K 33a86e6e91
references to client now faas root package 2020-05-11 00:21:17 +00:00
Luke K 724b64b51a
FaasNamespace to DefaultNamespace 2020-05-11 00:17:39 +00:00
Luke K 1a3fbe294d
flatten package structure 2020-05-10 23:55:04 +00:00
Luke K 208fba4f40
move binary to cmd/faas 2020-05-10 23:55:03 +00:00
Matej Vasek 380cc2f3ef feat: 'describe' sub-command for faas cli 2020-05-05 01:13:48 +02:00
Luke K 039e5506c4
create --internal stub 2020-04-28 16:25:40 +00:00
Luke K e70c8632e3
doc: command description 2020-04-28 16:01:17 +00:00
Luke K 17b2366505
v0.0.16 2020-04-27 15:21:39 +00:00
Matej Vasek 09cb2d5425 Rename packages
Needed since the project has been moved.
2020-04-27 16:45:46 +02:00
lkingland 3224123222
Pull list into client library
* pull list into client library

* fix list formatting
2020-04-27 16:03:29 +02:00
Matej Vasek 08c986011a feat: list sub-command for faas cli 2020-04-23 16:29:33 +02:00
Luke K c0f0d34786
Support user-defined service name, persisted via config. 2020-04-23 10:31:21 +00:00
Luke K fe12839e97
updater: add kn-based implementation 2020-04-18 16:29:43 +00:00
Luke K 132ce75dda
service removal impl with directory state prereq checks on create 2020-04-12 17:59:08 +00:00
Luke K 8b404c090c
enable pusher and deployer in command 2020-04-11 19:45:05 +00:00
Luke K 8e0dd47cfa
move version subcommand to root 2020-04-11 19:43:15 +00:00
Luke K ef908a32bf
version command impl 2020-04-09 16:31:07 +00:00
Luke K 22b4b77c85
Command improvements
* Add version subcommand
* Update builtin version template to raw version number output
* Prefix environment variables with "FAAS_" namespace
* Combine Execute with root.
2020-04-09 16:30:06 +00:00
Luke K b2aebca0fe
create command builder integration 2020-04-09 16:27:33 +00:00
Luke K fdd7430199
initial local runner implementation using appsody delegate 2020-03-23 16:43:48 +00:00
Luke K 0cc1788254
initial local create implementation using appsody delegate 2020-03-22 13:30:25 +00:00
Luke K c78be32b72
separate deploy from create for the --local flag 2020-03-04 15:12:05 +00:00
Luke K 86cdedec91
Initial Commit 2020-03-04 14:36:41 +00:00