* Ignore devstate when existing process name is not odo
* Delete orphan devstate files with odo delete component
* Update unit tests
* Create fake system
* Add unit tests for odo delete component
* Integration tests for odo dev
* Troubleshooting
* First process on Windows is 4
* Use go-ps lib for pidExists
* Add unit test highliging the issue
* Fix 'delete' unit tests
* Pass the filesystem object where it is relevant
* Add a way for CLI commands to indicate whether of not they require a valid Devfile
For the 'analyze' command, this is not required,
so Devfile parsing will be ignored completely.
* Make the fake filesystem return an absolute current dir
Otherwise, some code will assume it is relative,
and try to prepend the current physical directory
* Document current implementations of command handlers
* Add unit tests for execHAndler
* Refactor pkg/devfile/image to inject Backend as dependency
* Use same handler for kubedev/podmandev
* Fail after SelectBackend==nil only if backend is needed
* Move runHandler to dev/common
* Unit tests for runHandler
* Create a component.ExecuteTerminatingCommand
* ExecuteTerminatingCommand/ExecuteNonTerminatingCommand for Handler
* Fix calling other command types
* Consider parent group to determine if a command is terminating
* Replace component.execHandler by common.runHandler
* Remove execHandler
* Make runHandler and most of fields private and pass containersRunning to handler
* Pass containersRunning value
* deploy using common Handler
* Fix tests
* Use specific Dev/Deploy mode for Apply
* Fix cmdline for job
* Fix unit tests
* Pass appName and componentName with ctx to handler
* Move handler to pkg/component package
* Update doc
* Unit tests Deploy
* Unit tests Build
* Unit tests Run
* Unit tests PostStart
* Unit tests PreStop
* Update doc
* Fix Podman tests
* Fix hotReload on podman
* Change podman version timeout to 30s for tests
* Cleanup + fix doc
* Add integration tests highlighting our expectations
* Bump Devfile library to latest commit
f041d79870
* Expose preference that allows users to globally configure an image registry
* Return the effective Devfile view by default from the initial context
This is supposed to be read-only, so that tools can rely on it
and to the operations they need to perform right away.
Raw Devfile objects can still be obtained upon request
if there is need to update them (for example via 'odo add/remove
binding' commands.
* Pass the image registry preference to the Devfile parser to build the effective view
* Fix 'odo init' integration tests
- The test spec was actually not doing what it was supposed to do
- Now 'odo init' returns a complete Devfile, where the parent is flattened,
because the goal of 'odo init' is to bootstrap a Devfile.
Previously, 'odo init' would not download the parent referenced,
making it hard to understand the resulting Devfile.
* Document how odo now handles relative image names as selectors
* fixup! Document how odo now handles relative image names as selectors
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Revert "Fix 'odo init' integration tests"
This reverts commit 78868b03fd.
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Do not make `odo init` return an effective Devfile as a result
This would change the behavior of `odo init`.
Furthermore, due to an issue [1] in the Devfile library,
it is not possible to parse some Devfiles with parents linked as GitHub URLs (like GitHub release artifacts).
[1] https://github.com/devfile/api/issues/1119
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* fixup! Document how odo now handles relative image names as selectors
---------
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Add sample Devfile with multiple autoBuild/deployByDefault combinations
It will be used for integration tests.
* Add helper function to update a given Devfile Command Group
This will allow supporting cases where we need to run a custom command,
but this is not implemented yet on odo (cases with 'odo dev --debug'
and 'odo deploy').
In this case, this helper will allow updating the Devfile for example to
unmark the current default command as non-default, and mark the custom
one as default.
* Add test cases for 'odo dev'
* Add test cases for 'odo deploy'
* Add test cases for 'odo build-images'
'odo build-images' should build all images regardless of the 'autoBuild' property.
* Display the spinner when creating or updating Kubernetes resources
This helps understand what resources are being patched.
* Handle deployByDefault on K8s and OpenShift components
* Add 'devfile.GetImageComponentsToPush' functions that returns the list of image components to auto-create
See https://github.com/devfile/api/issues/852#issuecomment-1211928487 for more context.
* Handle automatic image component creation for 'odo dev' on Kubernetes
* Handle automatic image component creation for 'odo dev' on Podman
* Handle automatic image and K8s/OpenShift component creation for 'odo deploy'
* Bump Devfile library to the latest commit at this time (c1b23d2)
This includes the fix for [1], which provides a way not to set default values automatically
[1] https://github.com/devfile/api/issues/1067
* Do not set default values when parsing a Devfile
See [1] for the rationale
[1] https://github.com/redhat-developer/odo/issues/5694\#issuecomment-1465778398
* Add documentation in the Devfile reference page
* Revert "Display the spinner when creating or updating Kubernetes resources"
This reverts commit 6ad073e63cb0e685f165eed767619a90997393a3.
* Avoid re-applying Image components multiple times
'adapter#Push' might get called several times when there are
state transitions (either on the Deployment in the cluster,
or from 'odo').
It might be confusing to apply Image components over and over again
(and also it can be slower if we need to push images to remote registries).
* Move GetK8sAndOcComponentsToPush and GetImageComponentsToPush to libdevfile package
As suggested in review, this should be the responsibility of the devfile library
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* fixup! Handle automatic image and K8s/OpenShift component creation for 'odo deploy'
* fixup! Handle automatic image component creation for 'odo dev' on Podman
* fixup! Avoid re-applying Image components multiple times
* Apply suggestions from code review
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* fixup! Do not set default values when parsing a Devfile
* Fix devfile-deploy-functional-pods.yaml (used in 'odo logs' tests)
Set deployByDefault to false on innerloop-pod component.
Otherwise, since it is not referenced by any apply command,
it will be automatically created by *both* 'odo dev' and 'odo deploy'.
---------
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Set Go version in go.mod
go mod edit -go=1.19
* Fix formatting issues reported by gofmt
* Fix SA1019 check (usage of deprecated "io/ioutil"), reported by golangci-lint
SA1019: "io/ioutil" has been deprecated since Go 1.16:
As of Go 1.16, the same functionality is now provided by package io or package os,
and those implementations should be preferred in new code.
See the specific function documentation for details. (staticcheck)
* Use Go 1.19 in our Dockerfiles
* Use Go 1.19 in the rpm-prepare.sh script
* Update the tag for the IBM Cloud CI image
* Update the Devfile library
* Add test for container-overrides and pod-overrides attributes
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Attempt at fixing CI failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix CI failure
* Attempt at fixing OC integration test failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use random name in integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Rebase and fix integration test failure
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Make integration test work for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Temp attempt at fixing podman test for GH
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Another attempt at fixing CI test for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* One more attempt at fixing integration test for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* 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.
* Add runtime label based on metadata:language/projectType
* Add integration tests for odo dev
* odo deploy integration test
* Reverse priority between pojectType and language
* Cleans up innerloop resources upon Ctrl+c
* Remove cleanup method from dev interface
* Self review
* Remove ImagePullPolicy change
* Print message about resource deletion
* Fixes issue of multiple push for single event
Fixes#5532
Takes idea from https://github.com/fsnotify/fsnotify/issues/122#issuecomment-1065925569
* Self review and trim WatchParameters
* Rollback parameters useful for unit tests, and changes to unit tests
* Define context early in dev
* Use delete client to delete resources from cluster
* Update pkg/odo/cli/dev/dev.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Update pkg/odo/cli/dev/dev.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Update pkg/watch/watch.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Update pkg/watch/watch.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Removed unnecessary return statement
* Don't error in Telemetry for every Ctrl+c
* Refactors watch and push logic
* Run mockgen.sh script
* Fixes message on stdout
* Removes function re-added due to rebase mistake
* PR review and unit tests failure
* Unit tests & integration tests
* Use constants defined in the file
* More refactoring of watch package, and unit tests
* PR review and change tests to suit changed behaviour
* Prints appropriate message upon user interrupt
* Add comment for evaluateChangesFunc, remove irrelevant comments from
watch_test.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Remove `odo url` from CLI layer
* Adapt tests
* Adapt test from deleted `cmd_devfile_delete_test.go`
This test still makes sense, as it tests the removal
of URL-related resources, like Services and Ingresses.
* Remove call to `odo project set ...` in test, as suggested in review
This command will get removed in the near future.
* Remove places where URL manipulation could modify Devfiles
Also remove dead code
* Remove unused `updateURL` field from EnvInfo struct
* Adapt test by mimicking some behavior that `odo url create` used to perform
`odo url` used to modify the `env.yaml` file,
and `odo dev` currently creates Kubernetes/OCP resources related to URLs.
We may remove this test later on if `odo dev`
no longer needs to create such Ingresses and Routes.
* Remove all places where URLs, Ingresses and Routes are manipulated
* Port test in cmd_dev_test instead and make sure no Ingress/Route is created
* Remove no-longer `test-cmd-devfile-url` target from Makefile
The corresponding test file has been deleted.
* Remove `create url` command reference from V3 docs, as suggested in review
* Use existing `devfile-with-multiple-endpoints.yaml` Devfile in test, as suggested in review
* Change errors.Wrapf
* Replace errors.Wrap
* Dont use pkg/errors (except error.Cause)
* Fix errors on Windows (do not test system underlying message)
* Replace errors.Cause
* Review
* Add Dev and Project labeling / refactoring labeling and annotations
<!--
Thank you for opening a PR! Here are some things you need to know before submitting:
1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines
2. Label this PR accordingly with the '/kind' line
3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests
4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline
Documentation:
If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing
-->
**What type of PR is this:**
<!--
Add one of the following kinds:
/kind bug
/kind tests
/kind documentation
Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well.
-->
/kind feature
/kind cleanup
**What does this PR do / why we need it:**
In this PR we:
* Correctly name all the labels in a more concise manner (ex. Project Type
is an annotation)
* Add Dev and Deploy mode labels to both `odo dev` and `odo deploy`
commands so that we can intuitively retrieve what components are in
deploy or dev mode
* Somewhat refactors how we do labeling
**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->
1/2 of PR's for https://github.com/redhat-developer/odo/issues/5405
**PR acceptance criteria:**
- [X] Unit test
- [X] Integration test
- [X] Documentation
**How to test changes / Special notes to the reviewer:**
N/A
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
* Review update / renaming
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
* Review changes. Adds tests for generateDeploymentObjectMeta. Changes labels
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
* POC for odo interactive testing
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* add interactive tests to make target test-integration
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* [WIP] use func to pass test instructions
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* cleanup comments/test
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* cleanup minor changes
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* fix unit test failure
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* skip for windows
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* skip for windows by not compiling, cleanup
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* cleanup, and add the make target to test files
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* incorporate review, adding comments, cleanup
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* fix failing make validate
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* update test dependency, and possible fix for windows
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* Revert "update test dependency, and possible fix for windows"
This reverts commit 55580b7dc5.
* Final cleanup
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* Init command
* More tests + check empty dir
* Move function from catalog to service package
* Interactive asks lang + type
* Interactive
* Refactor catalog package with interface
* Add mocks for catalog and init/asker
* Add tests
* Create sub-packages for init + starter project
* Rename files in pkg/catalog
* More validations
* fix
* Logs
* Rollback
* Go back and No starter
* Review
* Use filesystem.Filesystem in pkg/catalog
* Change pull from registry strategy
* More unit tests
* More tests
* Integration tests
* Review
* Use full path to fix problem with Unzip
* Add integration test for devfile with parent URI
* Add prefClient dependence to catalog package
* Move function to pkg/init package
* Review
* Fix rebase
* Review
* Create a cmdline interface
The interface abstracts the cobra.Command
* Remove cobra relation from Context
* Remove cmd parameter to Run method
* Remove direct use of cobra.Command
* Add mock for cmdline interface
* First test
* Fix typo in rebase
* Restore SetClusterType
* Move constants to specific package to avoid import cycle
* Fix rebase
* update Devfile library and api
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* resolve problem occured by update
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* add test for cpuLimit,cpuRequest,memoryRequest
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* resolve branch conflicts
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* update schema version to 2.2.0 for test devfiles
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* revert - update schema version to 2.2.0 for test devfiles
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* downgrade devfile library
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* update test, remove duplication
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* replace oc with kubectl
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* restructure when
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* force push
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* rebase and update the test to use cliRunner
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* remove golint issues
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* Set correct component name in the devfile metadata
* Use t.Run, NOTAVAILABLE -> NotAvailable, grammar
* JustBeforeEach -> BeforeEach, helper.CopyAndCreate
* Remove s2i tests, remove issue reference
* Update springboot images to use the 'next' tag
* delete dangling dir created by unit-tests
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* delete dangling dir created by unit-tests
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* Renames the service name to include the app name
* Renames route names to include the app name instead of the component
* Fixes comments and modifies the error message for some service related errors
* List components from other sources
* Rename OdoManagedBy and OdoVersion to ManagedBy and ManagerVersion
* Add tests
* Add deployment and deploymentconfig manifests
* Move tests
* Test case
* Add cleaner tests
* Add comments
* Cleanup and fix tests
* Add comment
* Fix CI failures
* Change error check
* Add unit tests for ConvertLabelToSelector
* Fix unit test CI failure
* Add and remove service info from devfile
* Changes function name and moves to service package
Changed function name from `AddServiceToDevfile` to
`AddKubernetesComponentToDevfile`. Similar name change for delete
function. Also, moves it from `pkg/envinfo` to `pkg/service` package
* Address Maysun's PR review comments
* Modify storage create and delete to use changes in "devfile/library"
* Check for length of containers and mount paths
* Don't ignore the errors; use t.Error
* Fixes based on PR review
* Addressed Mrinal's review comments and fixed panic
"odo service create" without any arguments was panicking.
* Fix integration tests
Fixing issues to play well with ConsentTelemetry being set to false
before each test runs and with the change in this PR to execute service
create and delete commands from the component's directory.
* Removes wrongly commented code.
* Integration test for service create and delete
* Remove unnecessary newlines
* Check devfile existence before anything else
* Common function to decide service provider backend
* Remove a test spec and modify another
* Adds incorrectly removed test spec back
* Correct the error message to expect
* Refactors url List() to use URL Client.
It also adds ListCluster() to get urls from the cluster.
Signed-off-by: mik-dass <mrinald7@gmail.com>
* Adds comments and fixes variable names
* Fixes occlient error while creating new URL client
* Refactors URL for localConfigProvider. The CLI layer code for url create and delete are refactored to use the new changes.
It also moves the localConfigProvider to a new package.
Signed-off-by: mik-dass <mrinald7@gmail.com>
* Fixes Complete() and Validate() code in envinfo.go and also adds comments.
* Renames URLCreateOptions and URLDeleteOptions to CreateOptions and DeleteOptions.
Also simplifies the logic during context creation and fixes the comment for the LocalConfigProvider interface.
* remove duplicate list and refactor
* resolve failing validation
* reordered the listing
* add source type in devfile components
* add intg test for odo list duplicate
* removed FIt
* resolve comments
* uniformity
* resolve failing tests and uniform labels in tests
* Adds subDir checkout for git components
Signed-off-by: mik-dass <mrinald7@gmail.com>
* Changes the functions to not expose the filesystem used in them