Commit Graph

127 Commits

Author SHA1 Message Date
Lance Ball 5adec03c7b
chore: update all references to kn-plugin-func (#1311)
* chore: update all references to kn-plugin-func

I did not change references in CHANGELOG.md but otherwise, I believe
this should cover all configuration settings, image names, package
names, etc.

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

* fixup: fix instances_test.go

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

* fixup: still some stray kn-plugin-func

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

Signed-off-by: Lance Ball <lball@redhat.com>
2022-10-13 16:31:53 +00:00
Gunjan Vyas 06ade524de
feat: interactive prompt for on-cluster deploy (#1300)
* feat: interactive prompt for on-cluster deploy

* changed the prompt type to survey.Confirm
2022-10-06 18:31:32 +00:00
Luke Kingland 4c8f730099
feat: readonly global config (#1260)
* improved deploy test output

* remove unused config struct

* feat: read-only global config

Co-authored-by: Lance Ball <lball@redhat.com>
2022-09-23 17:49:13 +00:00
salaboy fe0368a793
[feat] refactoring func.yaml struct to match cmd lifecycle (#1254)
* rebased and updated func struct

* fixing migration to 1.0.0 struct

* fixing on cluster tests

* updaating migration version to 0.34.0

* adding tests for marshalling and migration errors

* adding EOF new line

* updating migrations

* fixing wrong name

* fixing marshalling test

* adding EOF line

* fixing assertion
2022-09-22 20:22:12 +00:00
Luke Kingland 4b2bdc9b8a
fix: incorrect deploy namespace warnings (#1257) 2022-09-20 02:34:09 +00:00
Luke Kingland 15713b2a75
feat!: deploy autobuild and flag persistence (#1079)
* feat: deploy autobuild and flag persistence

* cleanup

* help text, comments and test cleanup

* removing usurped commands.txt

* add platform to deploy synopsis help
2022-09-14 11:45:10 +00:00
Luke Kingland 4e5e9927b2
fix: only use flag value as default or if altered (#1223) 2022-09-07 20:47:18 +00:00
Luke Kingland ae75e5e803
fix: image name derivation and flag precidence (#1185)
* fix: image name derivation and flag precidence

* cleanup

* fix image prompt, reorganize and cleanup

* client deploy image test

* be explicit about registry treatment in tests

* ineffassign

* fix: k8s env not required

* misspell

* minor cleanup

* recombine build and deploy configs

* test namesace choosing logic
2022-09-04 19:37:21 +00:00
Matej Vasek 6a0b4a2211
fix: flags more consistent between build/deploy (#1202)
Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-08-30 19:16:18 +00:00
Lance Ball 81289dc757
doc: use cobra markdown generator for command docs (#1169)
This commit removes the docs/reference/commands.txt file and instead
uses the Cobra built-in documentation generator to create markdown
documents for every command.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2022-08-25 13:16:19 +00:00
Luke Kingland e6ec11b0e5
builder short name constants etc throughout (#1180)
* chore: shared builder constants etc

* pretty-print the shared unknown builder error

* update builder impls to use shared defs and validators

* error and docs text formatting

* include static default short names

* comment updates and typos

* docs paths

* use the constants for the in-package builder defaults

* use builders.All but with caviat
2022-08-24 19:34:18 +00:00
Luke Kingland fecbc4ef8b
chore: use dot as path default rather than absolute path (#1184)
* use '.' in flags to indicate default function path

* regen commands.txt with '.' as default path

* centralize dot expansion

* minor cleanup

* update all references to path flag

* exits should be panics
2022-08-24 11:02:18 +00:00
David Fridrich e659256005
chore: use lower case *functions* in all CLI outputs (#1135)
* first run, F -> f

* fix

* fix

* misspells

* client*.go files

* add client*.go: misspells

* cmd dir test files

* docker dir

* function* files

* i*.go and job.go

* job.go,mock dir,repos*,s2i dir,schema dir,templates*

* test dir

* testing dir

* root dir *.go second round
2022-07-27 13:34:36 +00:00
Zbynek Roubalik 71b0dddc55
chore: add validation for `builder` (#1136)
* chore: add validation for `builder`

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>

* address feedback

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-07-25 16:09:24 +00:00
David Fridrich 8cb70808f5
feat: always store namespace in func.yaml and warn if current ns & func.yaml ns is different (#1118)
* check namespace; add to func.yaml on first deploy; added tests and mock kubeconfig for testing

* change func args because only f.Namespace is used instead of the whole struct

* func comment

* misspell

* fix tests

* warning in stderr

* use context.Background

* add fake kubeconfig for new test
2022-07-20 16:35:01 +00:00
Gunjan Vyas b1fd9f71b1
feat: persist builder value in func.yaml (#1099)
* Persist builder value in func.yaml

* Added tests

* removed print statement for platform error

* created common function for builder persistence test
2022-07-19 11:42:00 +00:00
David Fridrich c57af36f74
feat: func deploy accepts image digest in --image (#1098)
* --image can be given with digest, created parser and edited some help text to reflect this

* fixed small stuff

* tests for deploy with --image

* move parser to file, static test should be kept active

* updated some error mesgs; now prints a warning if flags not set explicitly, if set to a wrong value, return an error; updated tests to fit new error messages

* --image flag message edit

* removed warning; instead print info about disabled push a build unconditionally
2022-07-12 19:24:13 +00:00
Matej Vasek 80505979f9
Improve usability of `func` CLI for IDE plugins (#1091)
* Better input handling for non-tty

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

* Make cred-helper 'not implemented' non fatal error

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-07-01 05:07:42 +00:00
Matej Vasek f066218042
Add --platform flag for build/deploy sub-cmd (#1076)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-06-22 16:40:23 +00:00
Lance Ball 80093d66a4
fix: do not prompt user if --build diabled (#1071)
Fixes: https://github.com/knative-sandbox/kn-plugin-func/issues/693

Signed-off-by: Lance Ball <lball@redhat.com>
2022-06-16 22:39:17 +00:00
Luke Kingland 7a60394be6
feat: add all build flags to deploy (#1065)
* spelling

* feat: full build options on deploy

* increase e2e lifecycle test timeout to 45m

* remove redundant flag shorthand b

* map flags for parsing
2022-06-16 16:02:17 +00:00
Luke Kingland 3000a8857a
feat: on run, build only when filesystem changed (#1031)
* feat: detect built image staleness and utilize on run command

* write directly to sha256 rather than buffer

* client test cleanup

* remove superfluous test println

* ensure runtime dir

* close file opened when testing

* fix typos

* typos and missing test case
2022-06-15 09:56:17 +00:00
Matej Vasek e9932cdf43
fix: read pwd from non-tty input (#996)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-04-28 12:09:53 +00:00
Luke Kingland 9a0335de7d
src: exported client constructor with options (#883)
* update root and version structure and help text

* fix: limit openshift int test with tag

* refactor: commands to use simplifed, unified constructor

* fix ineffectual assignment lint error

* cleanup

* add repository to run command

* callout for forthcoming s2i builder impl

* lint errors

* re-add the deferred client factory

* remove setNamespaceFlag now that it is persistent

* avoid side-effect of global-mutating deploy tests

* reduce line-by-line difference for PR ease

* simplificaiton of tests and comment lines for further PR ease purposes

* reduce inconsequential differences for ease of PR

* tests to RootCommandConfig

* review comment updates

* fix lint errors

* replace stdlib Setenv in tests

Using t.Setenv will require an update to go1.17, which is out of scope
for this PR.

* pass ClientFactory throughout

* explicitly empty test command args

See https://github.com/spf13/cobra/pull/155

Errors can still be encountered when, for example, using precomiled
tests.  Explicitly setting constructed command args to the empty slice
ensures we avoid hitting any futher edge cases.
2022-03-30 00:58:46 +00:00
Luke Kingland 2bd5254f19
feat: command help text template preprocessing (#875) 2022-03-02 03:56:43 -08:00
Fabian Lopez 60dbeacc46
added git related flags for remote builds (#844)
* added git related flags for remote builds

* fix dependency issues

* remove context cancel

* add # split for git url

* account for the use of git args with local build type

* fix error message for build type
2022-02-28 03:56:07 -08:00
Matej Vasek 4fec4afca1
Custom improvements for OpenShift (#825)
* Custom improvements for OpenShift

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

* fixup: osh cred loader

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

* fixup: style

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

* fixup: dns-err detec for fallback in cluster dial

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-02-22 10:17:04 -08:00
Matej Vasek 568af71712
src: cmd's common fn.Client (#824)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-02-09 08:19:41 -08:00
Matej Vasek a2abfca3d3
src: error-less ctors (#818)
* src: no error ctors

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

* src: no error ctors

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-02-08 12:20:16 -08:00
Matej Vasek abd4eea0c7
Cleanup commands (#807)
* src: refactor commands

Commands are constructed from root,
not by using init() blocks.

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

* fixup the prefix issue

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

* fixup style

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

* fixup nolint:misspell

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-02-03 10:26:21 -08:00
Matej Vasek fff00497f8
feat: completion --build flag of deploy sub-cmd (#802)
* feat: completion --build flag of deploy sub-cmd

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

* src: refactor

Moved functionality.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-02-01 06:58:31 -08:00
Matej Vasek 15d617f99d
src: use common functionality for docker cred retrieval (#756)
* Use common functionality for docker cred retrieval

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

* fixup: docker auth secret for tekton pipeline

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

* fixup: style

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-01-13 03:52:12 -08:00
Zbynek Roubalik cb719ff564
feat!: support on cluster build from git repo with Tekton (#743)
* feat: support on cluster build from git repo with Tekton

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

* incorporate feedback

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

* incorporate feedback 2

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

* fixup-licence

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

* fix deploy with --build=disabled

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

* incorporate feedback

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

* incorporate feedback

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

Co-authored-by: Matej Vasek <mvasek@redhat.com>
2022-01-12 11:58:51 -08:00
Zbynek Roubalik 64ba17b4fb
feat: add possibility to disable pushing of image in `deploy` command (#739)
* feat: add possibility to disable pushing of image in `deploy` command

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

* remove commented code

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

* incorporate feedback

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2022-01-07 06:40:26 -08:00
Zbynek Roubalik 2282cf899d
Revert "feat: add possibility to disable pushing of image in `deploy` command (#736)" (#738)
This reverts commit 4e5a5e8307.
2022-01-06 08:03:02 -08:00
Zbynek Roubalik 4e5a5e8307
feat: add possibility to disable pushing of image in `deploy` command (#736)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2022-01-06 07:22:01 -08:00
Matej Vasek 8d51393181
feat: allow push to cluster internal registries (#718)
* feat: allow push to cluster internal registries

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

* fix: NewRoundTripper consults http.DefaultTransport

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

* src: move credential code to sub-package

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

* src: refactor

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

* src: share RoundTripper

avoid creating expensive RoundTripper twice

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

* test: added test for pusher

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

* src: disable parallel layer upload

it's more reliable

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

* fixup: lint

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

* fixup: lint

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

* fixup: doc, rm commented code

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-12-20 14:28:17 -08:00
Matej Vasek 27e1b0153a
Refactor credential provider (#707)
* src: cleanup

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

* src: cleanup

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

* src: cleanup

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

* src: cleanup

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

* src: cleanup

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

* src: allow to set custom crednetial loader

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-12-09 14:19:28 -08:00
Lance Ball 0d68ff945e
chore: refactor cli flags for path and namespace (#702)
These flags are used by multiple commands, and explicitly setting them for
each command risks errors that may not be easily detected (see the deleted
flag text for `namespace` in deploy.go). The downside to this is that wording
is not sligtly tweaked for the command - see again some of the removed text
for `namespace` that was slightly different for each command, but usefully so.

I'm not 100% convinced this change is needed, since it does reduce the flexibility
of the user facing text. But if it had existed before we wouldn't have had
incorrect text for `deploy`.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2021-12-06 11:46:27 -08:00
Luke Kingland c2e1b769cc
src: direct serialization of Function metadata as func.yaml (#641)
* src: directly serialize Function metadata as func.yaml

Functions now save directly to func.yaml using .Write().
Fixes a serialization error where defaults were not respected on load.
Moves runtime and template defaults into function constructor.
Extracts Function validation (was config validation) into separate functions.
Extracts associated test files (validation) into separate unit test files.
Updates schema generator to use Function

* comment spelling and re-enabling tests
2021-11-17 06:18:35 -08:00
Fabian Lopez d2ee140cee
Detect and report unreachable image deployment (#579)
* detect and report unreachable image deployment

* change error message for private images

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

Co-authored-by: Lance Ball <lball@redhat.com>
2021-10-13 06:43:48 -07:00
Matej Vasek e85a4aa7f3
feat: Save password after user input (#560)
* Save password after user input

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

* Improve wording

Signed-off-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Lance Ball <lball@redhat.com>

* Apply suggestions from code review

Signed-off-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Zbynek Roubalik <726523+zroubalik@users.noreply.github.com>

* Improve test

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

* Fix for symlinks

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

Co-authored-by: Lance Ball <lball@redhat.com>
Co-authored-by: Zbynek Roubalik <726523+zroubalik@users.noreply.github.com>
2021-10-13 06:29:47 -07:00
Matej Vasek 4236ba9287
Better credentials handling (#526)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-09-16 02:57:39 -07:00
Senthilnathan M 2ae3e46346
Minor fix in the help doc (#500) 2021-08-30 23:57:55 -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
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 5ded87368b
src: rename bosonFunc fn 2021-06-22 23:08:11 +09: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
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
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
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
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
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
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
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
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
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
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 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 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
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
Luke K 00ac880c3b
docs: fix function typos 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
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