This keeps the podman process alive while `func` receives
SIGKILL or SIGTERM.
We must keep podman alive for cleanup (e.g. container removal).
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fix: pack docker socket mounting with npipe
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* feat: trust ssh connection by podman machine
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fix: socket mount on macOS with podman machine
The `podman machine start` outputs recipe for DOCKER_HOST setting,
following the recipe it was causing troubles,
since path in host OS and in the podman VM is different.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* chore: use go-winio library for handling npipes
Replacing unmaintained an buggy library.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* test: added test for podman machine auto connect
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* Better error message I docker/podman not present.
* Auto detect podman machine's socket on mac/win.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Signed-off-by: Matej Vasek <mvasek@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
* 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>
* Fix docker client lifecycle
Avoid premature Close() of docker client.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* Guard for usage of docker client after close
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* Allow empty credentials registry
Useful when using local unsecured registry.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* Added tests for empty credentials registries
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* 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.
* update root and version structure and help text
* fix: limit openshift int test with tag
* src: verbosity to constructor param
* fix misspelling
* fix merge error
* force run of `make test`
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fix git file:// URIs
When using file:// forward slashes should be used.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fix parsing of FS path from URI path
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* disable some test on Windows
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fixup: style
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* disable some test on Windows
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fix some tests for Windows
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* disable some test on Windows
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* 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>
* 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>
* allow build to be triggered from run when fn.Image is missing
* add build check when run by the run command
* added unit test for run command
* remove log output
* rename run test
* change build trigger to be managed by a flag and not a prompt
* tlet users know about the --build flag in the error message
* fix code check issue
* add some debug info to the run_test
* Update cmd/run.go
Co-authored-by: Luke Kingland <58986931+lkingland@users.noreply.github.com>
* add build field to runConfig
* fix issue with cmd args for testing
* refactor run tests to use mocks
* update imageless function run error message
* add check for build error test case
* run unit test cleanup
* empty commit
Co-authored-by: Luke Kingland <58986931+lkingland@users.noreply.github.com>
* feat: config and repository path creation
Removes need to use a client to trigger creation of paths
Adds back static path accessors
Enables creation of paths when configured repos is outside config
Cleans up instantiation logic, including removal of some setters
* fix spelling mistakes per review
* src: refactor tests
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: add comments
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: fix style
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* test: add test for ssh docker client
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: refactore rename struct
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: more reliable connection disposal
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: avoid unnecessary wrapping
When using dial-stdio the DialContext is not associated
with an SSH connection so wrapper with clean up is not needed.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: add doc comment
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* feat: automatically start podman service
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: refactor rename function
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: add commnets to tests
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* src: refactor rename function
Signed-off-by: Matej Vasek <mvasek@redhat.com>
The integration tests and unit tests are currently expected to be
disjunct sets. While we may change to being additive in the future,
this change makes us consistent by adding the integration exclusion tag
to a few non-integration test files where it was currently missing.
* 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>