* Implement GetRunningPodFromSelector for podman
* Implement GetPodLogs for podman
* Same message in podman/cluster
* Integration tests
* Return stream of stdout/err
* Display a warning that "odo dev" on Podman might need to be restarted when local changes are detected
The initial idea was to display such a warning only
when changes are detected in the Devfile,
which are not yet handled completely at this time.
But to take into account the manual synchronization case (where
there is no file watcher (and therefore no way to determine which
files have actually been modified)), a generic warning is being
displayed whenever the Podman-specific watch handler is called.
* Add integration test case
* fixup! Add integration test case
* amend! Display a warning that "odo dev" on Podman might need to be restarted when local changes are detected
Display a warning that "odo dev" on Podman might need to be restarted when the Devfile is modified
* fixup! Add integration test case
* Assert that no warning is displayed if the Devfile has not changed
* Use podman generate kube instead podman kube generate
* get env from exec -it env (to be continued)
* Fix podman test
* Export function to make validate tests pass
* review
* Check podman tests result
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Do not use restmapper to map resource->kind for application. Juct copy Kind and Resource to json output
* Fix panic when no kubeclient
* Fix panic when odo list binding with --name
* Fix integration tests with new output
* odo dev works if no endpoint is defined
* Update tests/integration/cmd_dev_test.go
Co-authored-by: Armel Soro <armel@rm3l.org>
* Add log when no port to forward
Co-authored-by: Armel Soro <armel@rm3l.org>
* Pilot work
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add more tests
* CompareDocOutput returns strings missing from cmdout and file
* Finish automating docs for odo init command reference
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Cleanup
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add make target for doc automation tests; create a separate folder for doc automation tests; add documentation for helper functions
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Attempt at fixing validation test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix validation failures
* Rename ReplaceTimeInString to ReplaceAllTimeInString
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Replace all time strings with a static value for both cmd and mdx output
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add test suite for command reference tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix failing test and skip empty directory interactive test; add comment
for tests with specific check
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix make target
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* StripSpinner relies on statement to decide if it should strip the line or let it be
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add check for unicode spinner frames just in case it is present; it is flaky
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Make interactive tests work
* Make it pretty
* Update odo version
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Rename pkg/odo/commonflags/run_on.go to pkg/odo/commonflags/platform.go and change runOn to platform
* Rename feature
* Rename into pkg/odo/commonflags/context/
* Update comments
* Update doc
* fix comment
* Update integration tests
* Duplicate runningOn field with platform + deprecated runningOn
* Mark RunningOn as Deprecated
* Do not modify blog post
* Fix typo
* Add exception for SA1019
* odo describe component
* Fix integration tests for odo describe component
* Allow using the '--run-on' flag with 'odo describe component'
* Add "platform" to the ForwardedPort output
* Move RunningMode* structs to a dedicated file and add (tested) method for merging running modes
* Add RunningOn field to the Component API
* Make component#GetRunningModes able to return all modes for all specified platforms
* Do not display the namespace from NoComponentFoundError if no namespace is set
* Add more validation logic to the 'describe component' CLI
* Update 'odo describe component' logic for Devfile-based component
* Update 'odo describe component' logic for name-based component
This checks for the component with such name on all platforms.
If it finds several components on both platforms, it needs to extract
Devfile information from those resources.
To do so, it checks if the relevant labels (project type and name) are matching.
It errors out if they do not match, because this would imply that we
don't know what to display as Devfile information.
* Conditionally display "running on" information in human-readable output.
This is displayed only if the "run-on" feature is enabled.
* Implement GetAllResourcesFromSelector in the PodmanCli client
* Add more unit tests
* Update integration tests
* fixup! Update integration tests
* fixup! fixup! Update integration tests
* odo delete component with name
* Add unit test
* Add integration tests
* common printDevfileComponents
* fix name
* spinners + newlines
* Update info message with podman and/or cluster
* Make odo delete component work without kubeconfig
* Make odo delete component work when non auth
* Support run-on flag
* Do not delete cluster resources when running on podman
* No error when deleting component by name without cluster
* Refacto cleanup pod
* Add PodLs and KubeGenerate methods to pkg/podman
* List and delete Podman Pods
* Add integration tests
* Fix msg + when experimental is disabled
* Review (except UT)
* Add unit test
* restrict platforms earlier
* Ask for stack version in the interactive mode; downloading still doesn't work as expected
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Download the versioned Devfile for interactive mode
* Download the versioned Devfile for flag mode
* Download the versioned Devfile for the alizer mode
* Add support for 'latest' stack
* Update init automation message with devfile-version
* Mark the default version in interactive mode
* Fix interactive tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add integration tests for odo init flag mode
* Fix unit and validation tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add to the documentation
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add information about the default version
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Display a generic Experimental mode warning message when this mode is enabled
This fixes the issue of having this warning displayed for a specific feature
that might not be used by the user.
Instead, we are now displaying a more generic and feature-agnostic warning
message once.
* Drop useless 'id' field in OdoFeature struct
* Abstraction for component + ExpectIsNotDeployed
* Change signature of RunDevMode, to support RunOnPodman option
* Add a test with Exec
* More tests with Exec/ GetEnvVars
* Add integration tests highlighting the issue and setting the expectations
* Fallback to interactive questions if there is no match from Alizer when initializing a component
This applies to odo init, odo dev and odo deploy
* Make the registry client collect and return all stack versions
* Call the '/v2index' endpoint first and fallback to the index endpoint when listing Stack versions
* Display the Stack versions in the 'odo registry' human-readable output
* For convenience, sort stack versions based on the semantic version
This allows seeing them in a meaningful order in both
human-readable and JSON outputs.
* Enrich unit tests for 'getRegistryStacks'
* Fill the "starterProjects" field for backward compatibility
Similar to the "version" field, this represents
the list of starter projects of the default Stack version.
* Update integration tests
* Update documentation
* Test with OpenShift cluster non authenticated
* Add analyze commands
* Add same tests as with NoCluster
* Do not try to cleanup namespaces
* Assert non authenticated
* Change Makefile target name
* Improve confirmation message for namespace/project deletion
* Update sample output in ´delete namespace/project' command reference
* Use oc binary instead of odo in DeleteNamespaceProject 'helper_oc' implementation
This way, we do not rely on some other odo command (odo delete project command) in unrelated tests
This also makes it more consistent with the implementation in 'helper_kubectl'
* Rename GetK8sManifestWithVariablesSubstituted to GetK8sManifestsWithVariablesSubstituted
* Add GetK8sComponentAsUnstructuredList; add support for multiple manifests in a single k8s component
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use GetK8sComponentAsUnstructuredList in binding/remove.go
* Use GetK8sComponentAsUnstructuredList in component/component_test.go
* Use GetK8sComponentAsUnstructuredList in libdevfile/component_kubernetes_utils.go
* Use GetK8sComponentAsUnstructuredList in service/service.go
* Use GetK8sComponentAsUnstructuredList in devfile/adapters/kubernetes/component/adapter.go
* Add documentation for GetK8sComponentAsUnstructuredList and remove GetK8sComponentAsUnstructured
* Fix createOrUpdateServiceForComponent to fetch only the service created for the component
* Add integration test for odo deploy
* Add integration test for odo dev
* Attempt at fixing list/describe binding tests; fixes old mishap
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Check for empty list of binding
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Enable run-on flag
* List all components
* Select specific platform with --run-on flag
* Make podmanClient nil if no podman client is accessible
* integration test
* Delay the display of warnings related to experimental features
* Add logs displaying podman commands executed
* Use None when Running On is empty
* odo list
* Do not display "Port configuration using flag is currently not supported"
This is confusing to users.
* Display ports detected as part of the Alizer component detection logic
This is because we specifically need to display the ports
at the same moment when the language, project type and Devfile
are displayed to the end user (when source code is present)
* Update the loaded Devfile object with the application ports detected prior to asking for its customization
The case of multi-container components will be handled in [1].
Otherwise, the container component ports (all but the Debug ports) are replaced with the right application ports.
[1] https://github.com/redhat-developer/odo/issues/6264
* Add integration test case
* Add application ports detected to "odo analyze -o json" output
* Update documentation
* Add utility functions for helping handle Debug endpoints
* Make application ports detected appear first in the endpoint list
This allows such ports to be port-forwarded first, before the Debug ones.
* Fix: Panic when running odo list namespaces without an active Kubernetes context
* Add integration test for odo list namespaces
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add a new REMOVE_BINDING dependency to ensure remove binding command works even when cluster is inaccessible
* Revert REMOVE_BINDING change and use an alternate solution
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Call WatchAndPush
* NoOpWatcher for Kube-related watchers + Move cleanup to dedicated method
* Set component state
* Call reconcile again when files changed
* Fix prompt message
* Integration test for podman/sync file
* More integration tests
* Move display of forwarded ports after application started
For some reason, "odo list namespaces/projects" would contain
the current test namespace, but the subsequent
"odo list namespaces/projects -o json" would no longer
contain this namespace.
* Add utility functions allowing to report files generated by odo
The end goal is for 'odo delete component --files' to gather a list of
files that were initially generated by odo, so as to delete only those.
This way, we are less likely to delete the wrong files.
This list is collected in a '.odo/generated' file.
It will then be up to odo commands to call those methods
accordingly. For example, this is called:
- by odo init, odo dev, or odo deploy, when generating a new devfile.yaml
- by odo dev, when there is no .gitignore file and odo generated one
Note that it is quite impossible to cover all scenarios; for example,
if odo generates a new devfile.yaml file, but the user deletes it
manually and recreates it, 'odo delete component --files'
will still list it as a possible candidate for deletion
(because it would be listed in .odo/generated).
* Report files generated by commands like init, dev or deploy
* Implement 'odo delete component --files'
* Add integration tests for 'odo delete component --files'
* Document the `--files` flag
Co-authored-by: Philippe Martin <contact@elol.fr>
* Do not delete the .gitignore file
It is more likely to be modified by the user afterward (for another
usage).
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* fixup! Document the `--files` flag
* fixup! Implement 'odo delete component --files'
* Apply review suggestions on integration tests
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* fixup! fixup! Document the `--files` flag
Co-authored-by: Philippe Martin <contact@elol.fr>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Run build-images command without cluster
* Test odo remove binding without cluster
* Make odo describe component work without cluster
* Tests: configure cluster depending on nocluster label
* Make odo list component work when --namespace is not used
* Test odo list component before deployment without cluster
* Some Generic tests
* Unset KUBERNETES_SERVICE_HOST to disable in-cluster config
* Set KUBECONFIG to empty file for no-cluster tests
* Run no-cluster tests on Windows
* Fix ListIngresses related changes
* Add warning/error when no cluster connection is available
* Remove Dharmit from OWNERS files across the repo
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Remove Dharmit and Charlie from OWNERS
* Adds Tomas to owners
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Add integration test
* odo dev deletes remote resources not present in the Devfile
* Delete the servicebinding secret without SBO
* Fix integration tests failure for when SBO is installed
* code Refactor
* Refactor the code
* Fix components_test.go
* add todos to integration tests
* Code review from feloy
* Move secret removal out of UnbindWithLibrary; rename deleteServiceBindingSecrets; add spinner end defer
* Attempt at making resource deletion concurrent
* Temp changes
* temp change
* Use errgroup wg to handle go routines
* Use single spinner for all the resources
* Fix validation failures
* Temp changes
* Optimize the code
* Optimize error messages; remove the unnecessary use of 'Kubernetes'
* List routes/ingresses deployed by odo in the describe output
* Remove ListDyanmicResourcesFromSelector and use ListDyanmicResources instead by add a selector argument to it
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Update pkg/api/component.go
Co-authored-by: Armel Soro <armel@rm3l.org>
* Replace DyanmicClient for ingress with a kubeclient
* Show ing/route name if *.hosts is empty
* Change API format
* Ignore owned ing/routes
* Add devfile with default backend ingress
* Add tests for named describe command
* mock kclient
* Fix integration test failure
* Fix integration test failure with registry
* Add test for ingress with default backend
* Add unit test for ListRoutesAndIngresses
* Add documentation
* Fix circular dependency and test failures
* Update upstream docs
* Fix integration test and add unit test for owner reference
* DRY the unit test code
* Update pkg/component/component.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Use context to obtain app
* rm3l's review
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
Co-authored-by: Philippe Martin <contact@elol.fr>
* Adds ability to list namespaces in JSON format
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Tests without Expect
Using `Expect` directly or through something that uses it under the hood
is a problem when using `Eventually`. In normal case, a failure in
matching test condition behaves like `continue` and `Evnetually` keeps
trying again till timeout is reached. But `Expect` changes that
behaviour to be like `break` and doesn't keep testing repeatedly as we
would like it to.
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* UI fixes when there's no project on cluster
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Adds an import to fix unit tests
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* More JSON specific checks
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Consistent JSON output for namespaces
JSON output for components, bindings and services when odo can't find
any of these resources is simply a `{}`. This commit makes output of
`odo list namespaces -o json` consistent with that of these commands.
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Add doc for namespaces JSON output
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Test if some other namespace is marked as active: false
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Define central config
* Use envConfig in GenericRun for segment parameters
* Pass the env config into the context passed to CLI methods
* Use PodmanCmd and DockerCmd from context
* Remove tests now that ODO_DISABLE_TELEMETRY is checked for a bool value
* deploy.Deploy: Use values from ctx instead of parameters + use FS from DI
* dev.Start: Use values from ctx instead of parameters
* image.Build*: Use values from ctx instead of parameters
* Use telemetry file from context
* Pass ctx to segment.getTelemetryForDevfileRegistry
* Use ctx in getTelemetryForDevfileRegistry
* Call IsTelemetryEnabled once and use scontext.GetTelemetryStatus after
* Fix unit tests
* Use envConfig in segment.IsTelemetryEnabled
* Define TelemetryCaller constant in test helper
* IsTrackingConsentEnabled: get value from envconfig instead of env
* Use ctx instead of GLOBALODOCONFIG
* Place ODO_EXPERIMENTAL_MODE in configuration
* Use maintained envconfig package
* Define default values when exist
* Document accepted boolean values
* Add test cases highlighting the issue
* Sanitize value for 'app.openshift.io/runtime' label
* Lowercase value of 'app.openshift.io/runtime' label after sanitization
As suggested in review, this is to follow what's done by OpenShift console;
it is always lowercase when added by OpenShift Console.
Co-authored-by: Tomas Kral <tkral@redhat.com>
Co-authored-by: Tomas Kral <tkral@redhat.com>
* Add support for an experimental mode at the CLI level
This is backed by an "ODO_EXPERIMENTAL_MODE" environment variable.
* Mark the generic '--run-on' flag as experimental
Besides being hidden, it will error out as invalid flag
if the ODO_EXPERIMENTAL_MODE env var is not set to 'true'.
* Add integration test cases
* Document the experimental mode.
* fixup! Add support for an experimental mode at the CLI level
* fixup! Mark the generic '--run-on' flag as experimental
* Update odo to use go 1.18
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Update golangci-lint version in Makefile
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Use go 1.18, not go 1.19
Erroneously I had used go 1.19 at various places.
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Rearrange imports; fix golangci-lint errors
Fixed a bunch of golangci-lint errors like below:
`File is not `gofmt`-ed with `-s``
using the command: `golangci-lint run --fix`
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Use go install instead of go get
This is because with go 1.18, `go get` behaves as `go get -d` by
default. Which means that it will only download, but not install.
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>