118 Commits

Author SHA1 Message Date
Philippe Martin
0f828ec99f Ignore devstate when existing process name is not odo + delete devstate files with odo delete component (#7090)
* 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
2023-09-20 14:20:53 +02:00
Armel Soro
28ed064133 Do not return an error in odo analyze if current directory contains an invalid Devfile (#6905)
* 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
2023-06-22 10:06:18 +02:00
Philippe Martin
9a239c4e77 Use a single handler for executing all commands (#6826)
* 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
2023-05-26 11:01:21 -04:00
Armel Soro
ec747b4ab3 Allow using imageName as a selector (#6768)
* 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>
2023-05-22 10:45:27 -04:00
Armel Soro
cc2e8def81 Support autoBuild and deployByDefault on Image and Kubernetes/OpenShift components (#6654)
* 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>
2023-04-05 01:30:30 -04:00
Armel Soro
7b9f214299 Bump Go to 1.19 (#6586)
* 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
2023-02-16 09:03:48 -05:00
Parthvi Vala
19f8e0ebdb Update devfile/library to support pod-overrides and container-overrides attributes and add integration test for it (#6512)
* 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>
2023-01-23 15:21:18 -05:00
Armel Soro
3c87ecdc8f Support Alizer-based automatic port detection with odo init interactive mode (#6365)
* 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.
2022-12-06 02:50:07 -05:00
Philippe Martin
32303b164d Add runtime label based on metadata:language/projectType (#6112)
* Add runtime label based on metadata:language/projectType

* Add integration tests for odo dev

* odo deploy integration test

* Reverse priority between pojectType and language
2022-09-14 09:22:45 +02:00
Parthvi Vala
224069cd68 odo dev: Add support for non-exec commands part of a composite run or debug command (#5923)
* Initial commit

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Move ValidateResourceExist(s) from pkg/service to pkg/devfile/adapters/kubernetes/component

* Fix odo dev cleanup

* Fix multiple deployment issue

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* DRY the code

* Fix unit test failure

* Add integration tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* remove comment

* Add isPartOfComponent to GetLabels, and GetSelector

* Add unit tests for changes in ListResourcesToDeleteFromDevfile

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Fix unit test failures due to removal of component label

* Enhance integration tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Use a single devfile.yaml

* Fix test failures

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Fix rebase conflicts, add new tests for remote Dockerfile URI, and rm3l's review

Signed-off-by: Parthvi Vala <pvala@redhat.com>

Co-authored-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Attempt at fixing integration tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Fix integration tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Mockgen

* Changes post rebase

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Attempt at fixing integration tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Fix rebase mishap

Signed-off-by: Parthvi Vala <pvala@redhat.com>

Co-authored-by: Armel Soro <armel@rm3l.org>
2022-08-10 10:41:43 +00:00
Philippe Martin
062160280f Add assertions for types implementing interfaces (#5893) 2022-07-01 08:12:24 +00:00
Parthvi Vala
1d48c49699 Add unit test for odo add binding (#5790)
* Add unit test for odo add binding

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Philippe's review

* Fix unit test failure
2022-06-08 04:32:27 -04:00
Philippe Martin
feb49607d4 Refactor labels (#5618)
* refacto labels

* Getters

* Builder

* Do not export labels

* Move to pkg/labels + doc

* Fix rebase
2022-04-28 09:51:02 -04:00
Parthvi Vala
abc4b59369 Remove references to v2 commands, remove unused functions, and constants (#5638)
* Remove references to v2 commands, remove unused functions, and constants

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Dharmit's review

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-04-20 00:54:15 -04:00
Dharmit Shah
c73f177cb6 Cleans up innerloop resources upon Ctrl+c (#5596)
* 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>
2022-04-04 04:59:43 -04:00
Philippe Martin
36f323dfbf Bugfix 5546/odo deploy then dev (#5594)
* Enable odo dev after odo deploy

* Add integration test

* review
2022-03-29 10:33:44 +02:00
Armel Soro
2132cb516f [#5561] Remove odo url (#5571)
* 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
2022-03-28 16:39:53 +02:00
Philippe Martin
24fd02673d Remove github.com/pkg/errors dependency (#5557)
* 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
2022-03-21 11:32:42 +01:00
Parthvi Vala
1d2cf39cf7 Delete with devfile.yaml (#5500)
Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-03-20 18:20:52 +01:00
Charlie Drage
d48a607e9a Add Dev and Project labeling / refactoring labeling and annotations (#5551)
* 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>
2022-03-17 13:38:00 +01:00
Anand Kumar Singh
3eb92b6a47 POC for odo interactive testing (#5466)
* 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>
2022-03-02 13:50:26 -05:00
Philippe Martin
e4a65e81ed Cleanup more functions not used after removing old v2 commands (#5447)
* Remove service.FindDevfileServiceBinding

* Remove IsOperatorServiceNameValid

* Remove MapFromParameters

* Remove OperatorSvcExists

* Remove AddKubernetesComponentToDevfile

* Remove AddKubernetesComponent

* Remove DeleteKubernetesComponentFromDevfile

* Remove from kclient/operators.go

* Remove unused functions from pkg/service

* Remove Storage methods from LocalConfigProvider

* Remove unused from pkg/envinfo

* Cleanup util packages

* Remove unused code with the help of staticcheck --unused.whole-program=true -- ./...
2022-02-10 12:10:00 -05:00
Philippe Martin
b75fa552ce Init command (#5348)
* 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
2022-02-01 04:48:54 -05:00
Philippe Martin
e63773cc15 Separate layers : Preference (#5296)
* Refactor preference package

* Unit tests

* Apply suggestions from code review

Co-authored-by: Parthvi Vala <pvala@redhat.com>

* Review

* Review from Dharmit

* Replace panic with LogErrorAndExit

* Remove preference from kclient/oc_server

* Remove preference.New from devfile

* Remove preference.New from kclient/WaitAndGetPodWithEvents

* Get prefClient from CreateOptions

* Parthvi review

Co-authored-by: Parthvi Vala <pvala@redhat.com>
2022-01-10 16:00:53 +01:00
Philippe Martin
c58e4c7e6b Create a cmdline interface for testing Context creation + Complete function (#5256)
* 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
2021-12-15 00:42:55 +01:00
Anand Kumar Singh
0e42e99082 Add suppport for cpuLimit, cpuRequest and memoryRequest (#5252)
* 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>
2021-12-08 09:02:19 +00:00
Dharmit Shah
8601ff45d8 Fixes done by goimports -l -w pkg (#5272) 2021-12-04 20:47:19 +00:00
Tomas Kral
5f79c542a8 openshift/odo -> redhat-developer/odo (#5268)
* openshift/odo -> redhat-developer/odo

* update more links to redhat-developer
2021-12-01 16:38:34 +01:00
Parthvi Vala
fc34e880dd Cleanup S2I; remove BuildConfig, LocalConfig, Imagestreams and DeploymentConfig (#5125)
* Clean LocalConfig

* Clean dc, bc, is

* Remove leftover code

* Comment the failing unit test

* Fix failing tests: part 1

* Fix failing tests: part 2

* Remove unused flag: temp

* Fix failing tests: part3

* Fix ci failures

* Rename devfile specific context

* Fix merge conflicts: remove convert.go

* Changes requested by Philippe

* Add missing changes requested by Philippe

* Fix unit test failure
2021-10-15 08:45:44 +02:00
Tomas Kral
f9baeecbb5 update devfile/library v1.2.0 (#5130)
* update devfile/library to v1.2.0

* go mod vendor

* updates to make it work with devfile/library v1.2.0

* fix tests: new error messages
2021-10-11 11:34:20 +02:00
Philippe Martin
905f2127b4 Mount persistent volumes for S2I images (#4918)
* preStart events support

* Make code clearer

* Add integration test

* Add unit test
2021-09-10 03:32:49 -04:00
Parthvi Vala
cae66cd5f5 Set correct component name in the devfile metadata (#4927)
* 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
2021-09-06 07:14:30 +02:00
Mrinal Das
08d4102033 Uses the deployment while listing storage from the cluster (#4970) 2021-08-20 14:47:58 -04:00
Anand Kumar Singh
e99b14212a delete dangling dir created by unit-tests (#4887)
* 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>
2021-07-10 04:33:50 -04:00
Mrinal Das
e308b6bc8c Renames the service name to include the app name (#4858)
* 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
2021-07-07 10:23:09 -04:00
Mrinal Das
3b621048c7 Fixes the unexpected deletion of ingress URLs with default tls secret (#4829) 2021-06-22 13:36:32 -04:00
Tomas Kral
0212068939 Update devfile/library to v1.0.0 (#4769)
* update devfile/library to v1.0.0

* go mod vendor

* update codebase to make it compatible with new devfile/library
2021-06-15 00:36:07 -04:00
Parthvi Vala
7232538f87 List components from other sources (#4742)
* 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
2021-06-14 21:54:13 -04:00
Dharmit Shah
0553847984 Add and remove service info from devfile (#4465)
* 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
2021-04-12 11:14:01 -07:00
Mrinal Das
dd2713915f Updates the library to the latest version (#4446)
* Updates the library to the latest version

* Updates example devfile for integration tests

* Removes tests using ExecMultipleDefaultsWithFlags()
2021-02-22 14:51:41 -05:00
Mrinal Das
a4b40a9892 Refactors url List() to use URL Client (#4366)
* 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
2021-02-03 09:20:43 -05:00
Mrinal Das
526ce0af8c Refactors URL for localConfigProvider. (#4311)
* 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.
2021-01-04 10:25:42 +01:00
Girish Ramnani
529a1bd5de remove packages imported twice (#4275) 2020-12-03 10:08:02 +01:00
Maysun Faisal
f8f8f1fc26 Use the generators from devfile/library (#4263)
* Use generator func from devfile library

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* rebase with master

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
2020-11-30 14:09:45 +01:00
Mrinal Das
e89f0a2356 Refactors, cleans and moves some resources to the new files. (#4250)
Signed-off-by: mik-dass <mrinald7@gmail.com>
2020-11-26 02:08:39 +01:00
Girish Ramnani
82c05701e0 remove duplicate list and refactor (#4177)
* 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
2020-11-25 11:36:38 +01:00
Stephanie Cao
adaa1b44e8 Switch to use parser library (#4188)
* cleanup git history

Signed-off-by: Stephanie <yangcao@redhat.com>

* format files

Signed-off-by: Stephanie <yangcao@redhat.com>

* add epl-2.0 into license whitelist

Signed-off-by: Stephanie <yangcao@redhat.com>

* remove componentType and commandType in convert.go

Signed-off-by: Stephanie <yangcao@redhat.com>

* pull in latest library change

Signed-off-by: Stephanie <yangcao@redhat.com>

* add --project to app list test

Signed-off-by: Stephanie <yangcao@redhat.com>

* fix integration test

Signed-off-by: Stephanie <yangcao@redhat.com>

* revert change to public doc

* move the testdevfileobj to testingutil

Signed-off-by: Stephanie <yangcao@redhat.com>
2020-11-21 01:34:32 +01:00
Maysun Faisal
fce3c77305 Refactor & cleanup kclient generators code before migrating to devfile/parser (#4134)
* Cleanup & Refactor kclient gen code 1

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Clean up podTemplateSpec usage

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Move GetContainers to kclient

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Move certificate signature to secrets

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Clean up sync folder code

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* add GetService()

Signed-off-by: Stephanie <yangcao@redhat.com>

* add get route

Signed-off-by: Stephanie <yangcao@redhat.com>

* get adapter to use generator getService

Signed-off-by: Stephanie <yangcao@redhat.com>

* Move endpoint validations to validate pkg

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Update generators & validators test 1

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Update unit tests 2

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* add new unit tests

Signed-off-by: Stephanie <yangcao@redhat.com>

* add unit test for getPortExposure()

Signed-off-by: Stephanie <yangcao@redhat.com>

* modify unit test due to change to createOrUpdateComponent

Signed-off-by: Stephanie <yangcao@redhat.com>

* add unit tests for convert functions

Signed-off-by: Stephanie <yangcao@redhat.com>

* Update unit tests 3 - volume

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Add unit tests 4 - sync folder

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Update adapter unit test

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Rebase and update PR

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Move util func to generators pkg

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Remove illogical devfile 1.0 test case

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Unexport some generator funcs

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Clean up prestart code

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Move project vol mount out of the generators - updated

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* PR Review Feedback

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Rename generate to get, add build config func

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* PR feedback - func rename and loc

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

Co-authored-by: Stephanie <yangcao@redhat.com>
2020-11-09 12:06:53 +00:00
Mrinal Das
aa28203096 Adds subDir checkout for git components (#4120)
* 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
2020-11-04 16:10:38 +01:00
Maysun Faisal
84512b93c1 Refactor validate pkg for generic and odo validation (#4085)
* First pass of refactoring validate pkg for generic validation

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Update tests and cleanup refactored code

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Add test, clean up func desc

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Apply PR Feedback, cleanup code and tests

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Fix integratino test

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Refactor and cleanup validation

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Add component name validation to generic validation

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Add one more test case for env

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>

* Update integration tests to be more generic

Signed-off-by: Maysun J Faisal <maysunaneek@gmail.com>
2020-10-15 10:29:55 -04:00