* 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>
All tests which are directory-sensitive now also:
- reset viper
- use t.Cleanup
- use t.TempDir
- use a clean XDG_CONFIG_HOME
- specify explict name when creating
- moves helpers to root_test
* feat: deploy autobuild and flag persistence
* cleanup
* help text, comments and test cleanup
* removing usurped commands.txt
* add platform to deploy synopsis help
* 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
* fix: check for `--image` flag in build command
If the user provides an `--image` flag on the command line, it should be
used. This commit modifies the image resolving code to check whether or
not the image name was provided on the command line.
Fixes: https://github.com/knative-sandbox/kn-plugin-func/issues/1125
Signed-off-by: Lance Ball <lball@redhat.com>
* fixup: review feedback
Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
* 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
* fix: ensure registry in func.yaml is respected
If the user has a value specified in func.yaml for the image registry,
that value should be used by the build command, if not otherwise
specified as a flag or via the environment.
Fixes: https://github.com/knative-sandbox/kn-plugin-func/issues/1159
Signed-off-by: Lance Ball <lball@redhat.com>
* fixup: lint
Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Lance Ball <lball@redhat.com>
* 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
* 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
* 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.
* feat!: rename 'emit' to 'invoke' and default to local
This commit renames 'func emit' command to 'func invoke' and makes the
default behavior to send an event to localhost. The special '--sink'
value 'local' is changed to 'cluster' to indicate that the function
should be invoked on the cluster instead of locally. All other behavior
has remained the same.
BREAKING CHANGE
Signed-off-by: Lance Ball <lball@redhat.com>
* fixup: update commands.md doc
Signed-off-by: Lance Ball <lball@redhat.com>
* squash: change Emitter interface to Invoker
Changes Emit() to Send() in the (now named) Invoker interface, and changes
Emit() to Invoke() in the client.
BREAKING CHANGE
Signed-off-by: Lance Ball <lball@redhat.com>
* squash: use a common Invoker interface for HTTP and events
Signed-off-by: Lance Ball <lball@redhat.com>
* checkpoint
Signed-off-by: Lance Ball <lball@redhat.com>
* fixup: change Emitter to EventInvoker
Signed-off-by: Lance Ball <lball@redhat.com>
* Invoke v2 Draft
* feat: client invoke function
* static invoke defaults and methods
* remove assimilated invoker package
* includes an ignored .func directory on create
* Instances manager with local and remote defaults
Funciton Info is now Instance, representing a Function in a given
environment.
Describing a Function instance is now Instances().Get(f, environment)
Moves Runner to be async with a Stop method to enable returning runtime pid
and port for persisting.
Instances now have a place for primary Route in addition to all routes slice
Running Functions write PID and Port to .func
* cascading targets: local vs remote vs ad-hoc endpoint
* runner start signals and cancel cleanup
* return run on context done or err on channel
* async runner
Refactors the image runner to start the container asynchronously,
reporting back the port on which it started. Errors are communicated
back via a provided channel and stop is signaled using context
cancelation.
* pid neither required nor available
* add withTransport option
Incorporates addition of custom transport of the emitter into the
renamed version invoker. Flag and help text cleanup. Re-additionof the
Info accessor.
* schema now includes invocation data
* loop build msg
* run jobs
Externally exposed port is now chosen based on availability, with 8080
preferred and falling back to an os-chosen open port.
The Client Run method is now async, returning the port assigned to the
running Function, a stop/cleanup function and a runtime errors channel.
The Runner is internally divided into the runner and its started Jobs.
* job metadata
Extracts job metadata tracking to a Job object in the core,
Handles multiple instances of the same Function by creating a single
file for each instances in .func/instances/<port>
* remove superfluous error types and flag bindings
* feat: enable invoke target remote
* feat: preferentially invoke local, remote if running
* feat: read --file for invoke
* feat: invoke confirm prompts
* fixup cli tests
- Updates to handle asynchronous Runner
- Standardize on the naming convention for selective running
* docker runner tests and lint errors
* test refactor
* feat: invoke format override
* comments, spelling and other cleanup
* invoke command doc
* feat: invoke format interactive option
* rename runjob.go to job.go
* e2e test flag update
* test naming homoginization
* silence build activity messages when verbose
* test debugging
* code review updates
- return Job from Client.Run rather than constituent members
- Treat .gitignore as contentious, punting on feature to mutate if
extant.
- docs wording changes
- add invocation format to pertinent manifest.yaml files
* help text spelling etc.
Co-authored-by: Lance Ball <lball@redhat.com>
* add flag to push image at the end of a successful build
* ensure that push flag is binded to viper
* add unit test to build command
* change build test name
* add registry to build test
* fix e2e test problem
* fix compile error
* add push fail test case
* avoid pusher instanciation in absence of push flag
* fix: make registry validation work again
In ccf00152be
the behavior of `NewFunction()` changed slightly, such that it no longer actually
works without a provided and valid path. This was not caught in any of the
tests, because it's the CLI code that was making this call, and the end to end
tests that exercise the build command, use the `--repository` flag, causing
the repository validation code path to be slightly different.
This commit just adds the path so that `func build` without a `--repository` flag will work again.
Signed-off-by: Lance Ball <lball@redhat.com>
* fixup: add validation for registry flag and a test
Signed-off-by: Lance Ball <lball@redhat.com>