196 Commits

Author SHA1 Message Date
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
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
Priti Kumari
55c4c5a82e Writing unit tests using Gomock (#4110)
* Adding unit tests and mocks for interface and nested interface using gomock and testify

* Add testify latest verion in go mod

* Added vendor for dependencies

* Added examples with both gomock and testify for interface and embeded interface

* removed testify tests and mocks
2020-11-04 05:41:00 -05:00
Tomas Kral
0f55e33a6f use new project and starterProject git specification (#3867)
* implement new project and starterProject git spec

* fix starter project overriding devfile
 - The devfile is first downloaded and parsed in memory
 - Starter project is donwloaded into the current directory
 - Devfile is saved to the current directory
* perms 0644 for devfile is ok - nosec G306
* fix: not able to create component from local devfile
* fix: allow use of existing devfile
* fix: odo create in a directory with existing devfile
* fix: spinner not ended properly
* create and use ParseFromDataAndValidate
* show warning when someone uses revision

* remove events from parent

Events were removed from parent in Devfile spec.

* remove no longer used variable defaultGithubRef

* update unsuported devfile version message

* go mod tidy

* update vendor (go mod vendor)

* fix tests devfile

* temporary change registry in devfile test spec

* fix: add yaml tags to project git source

* fix: wrongly formated starter project in test devfile

* fix: integration tests

* update registry locations

* delete 2.0.0 types that are no longer used

* remove unused OverideEvents function

* fix: revision warning

* fix: typos

* fix: update GetDefaultSource unit tests

* roll back changes in default devfile registry
2020-09-08 16:37:52 -04:00
Tomas Kral
ebe51e886b Switch from glide to go mod (#3866)
* switch to go modules

* update vendor (go mod vendor)

* swithing to go mod: update docs and makefile

* update goget-tools

* use go mod verify to check vendor

* Update goget-tools

- pin goget-tools versions
- update gikgo to 1.14.0
- reset GOFLAGS for goget-tools
- fix ginkgo get for Prow

* go mod: replace github.com/kr/pty with github.com/creack/pty

* update vendor (go mod vendor)

* fix make cross target

-mod=vendor was not used for corss compiling
2020-09-03 07:49:41 -04:00
Tomas Kral
319b914b01 Caching registry responses to fix client.Timeout issue (#3681)
* debuging timeout issue

* use httpcaching (15min) for registry related requests

* update vendor

* add RegistryCacheTime preference option

* fix preference unit test

* add DownloadFileWithCache function

* address PR review comments

* address PR review comments

* errors related to caching should not be fatal

* cleaner cache logging
2020-08-06 04:49:48 +02:00
Dharmit Shah
e66e8ca157 Adds support for linking a Devfile component with an Operator backed service (#3557)
* Add dependency on service binding operator

* Add extra dependencies for service binding operator

* Adds support for odo link between component and operator hub service

* Add owner reference for the link

* Deals with inability to install SBO the OLM way on k8s

https://github.com/redhat-developer/service-binding-operator/issues/536

* Adds and removes 'odo link' entry to/from env.yaml

* Makes odo push set appropriate "envFrom" for a podTemplateSpec

* Changes to unit test & those based on PR feedback

* Rebase and "glide update -v"

* Make the linter happy. Remove unused variables

* Fix unit test of envinfo to include 'link' paramter

* Move 'odo link' tests under operator hub tests

* Install SBO on the cluster

* Changes as per PR feedback

* Check for Operator before trying to create a link

* Change error message expected in tests

* Make example less confusing by using less 'example'
2020-07-23 13:49:09 +02:00
Jingfu Wang
86fa18dbdb Secure registry support (#3516)
* feat: secure registry support

Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>

* test: fix TestDownloadFile test

Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>

* docs: update error message

Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>

* refactor: move credential prefix to util package

Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>

* feat: display and store registry type

Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>

* refactor: remove optional argumetns

Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>

* fix: unit test

Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>

* refactor: add unit test and refactor

Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
2020-07-14 16:54:45 +02:00
Dharmit Shah
f736e3bb0d Update dependencies in glide.yaml for make to succeed in building odo binary (#3369)
* Execute `glide update -v` to update the dependencies

* Use ContainerJSON in place of Container struct
2020-06-20 15:11:20 -04:00
Aditi Sharma
5f71123d43 Add Support for Devfile V2 (#3216)
* Add Devfile Parser V2, Update Common Structs (#3188)

* Add Devfile Parser for Version 2.0.0

Added Devfile V2 Go Structures
Added converter for v2 ro common types

Signed-off-by: adisky <adsharma@redhat.com>

* Add example V2 devfile

added example nodejs V2 devfile

* Add Common Types as V2

Add common types as v2
Add Converter from common to v1

* Updated example devfile with group

* Fixes command.go and kubernetes adapter (#3194)

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Fixes utils of k8s adapter (#3195)

* Update Command Logic to use groups (#3196)

* Updates create logic to v2 (#3200)

* Fixes utils of docker docker adapter (#3198)

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Update Docker and Kubernetes adapter to use groups (#3206)

* Update Docker and Kubernetes adapter to use groups

* Update Some Validation

Incorporate some review comments for commands Map
Update Some Validation logic

* Updated Logs for V2 (#3208)

Fixed interface implementation for v2
Updated logs
refactored commands.go

* Avoid String Pointers (#3209)

While converting v1 to v2 types, string pointers are prone to cause
null pointer error. This PR updates struct fields from string
pointers to string

* Update commands check

* Fixes lower and upper case for commands (#3219)

* Fixes type of project and components for devfile v1 (#3228)

* Update testing utils (#3220)


* Update command tests

Updated Command tests to v2
Removed some cases like command type validation, that will be
validated by schema only.

* Fix common adapters tests

All devfile.adapters.common unit tests are fixed

* Add tests for Mismatched type

Fix devfile.adapters.Kubernetes.Component unit tests

* Add TestCase for default command

* Design proposal: Event notification support for build and application status for IDE integration for devfile scenarios (#2550) (#3177)

* Add event notification proposal

[skip ci]

* Update event-notification.md

* Update event-notification.md

* Update event-notification.md

* Update event-notification.md

* Update event-notification.md

* Update event-notification.md

* Update event-notification.md

* Update event-notification.md

* Fix Integration tests for devfile v2 (#3236)

* Fix Integration tests

Correct volume structure
Fix supervisord binary insertion for docker
Insert command and args in build container fr docker

* Fix Integration tests

Revert commands, args removal
Add commands, args in v2 common structs
Fix duplicate volume error

* Fixes unit tests (#3240)

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Add devfiles V2 examples (#3253)

Add devfiles v2 examples for springboot and nodejs

* Fix regression by sparse checkout dir PR (#3258)

fix regression caused by rebase to master.
Also add github, zip as supported project types.

* Address review comments (#3267)

* Address review comments part 2

fix log levels to v4
fix error formatting
add case no's in test cases
update some comments

* Address review comments part 2

Remove validation for group

Co-authored-by: Mrinal Das <mrinald7@gmail.com>
Co-authored-by: Jonathan West <jgwest@users.noreply.github.com>
2020-06-03 00:16:39 +02:00
Stephanie Cao
6ed4650137 url list and describe for docker (#3086)
* url list and describe

Signed-off-by: Stephanie <stephanie.cao@ibm.com>

* fix unit test failure, fix locally deleted url cannot get reflected on container

* add unit test and integration tests

Signed-off-by: Stephanie <stephanie.cao@ibm.com>

* add comments

Signed-off-by: Stephanie <stephanie.cao@ibm.com>

* fix unit test failure

Signed-off-by: Stephanie <stephanie.cao@ibm.com>

* fix unittest failure

Signed-off-by: Stephanie <stephanie.cao@ibm.com>

* use log.info instead of fprintf

Signed-off-by: Stephanie <stephanie.cao@ibm.com>

* fix unittest

Signed-off-by: Stephanie <stephanie.cao@ibm.com>

* fix test failure due to change of intergration test

* fix unit test failure due to api version change
2020-05-13 03:15:23 -07:00
Tomas Kral
a82f3e0256 Update openshift to 4.4. and k8s to 1.17 (#3081)
* update openshift libs to 4.4

* update vendor
2020-05-06 18:53:51 +02:00
Tomas Kral
7f14dab08e Make odo buildable on Go 1.12 (#3022)
* pin github.com/hashicorp/go-multierror to v1.0.0

* update rpmspec golang_version to 1.12
2020-04-28 18:39:21 +05:30
Jonathan West
d03ed71b48 Use 'odo delete` to delete a component that's running locally with odo (#2905)
* Add docker delete support

* On container delete, add deletion of projects volume

* Delete volumes only after deleting containers

* Update delete volume tests based on review comments

* Update delete volume tests based on review comments

* Rebase with latest from master

* Rebase with latest from master

* Rebase and update dependencies

* Rebase and update dependencies
2020-04-23 13:24:59 +02:00
Enrique Lacal
0c3fe31e6c Download project devfile (#2902)
* Adding dependencies

* Download project from Devfile

* Cleaning up and commenting

* Add link for unzip function

* Remove old devfile create test

* Convert to log.Error

* Fixing file permissions

* Limit size of zip files

* Fix error handling

* Requested Changes

* Fix wrap error

* Fix delete dir

* Removing component type devfile tests

* Commenting tests due to lack of interactive testing

* Fix expected files in test

* Change dir back to context

* Add go requirement in doc
2020-04-22 22:08:58 +02:00
Tomas Kral
0e9e176515 glide.yaml replace github.com/kr/pty with github.com/creack/pty (#2783) 2020-04-07 22:24:40 +02:00
John Collier
0add600035 Add Docker client library for odo (#2724)
* Vendor github.com/docker/docker

* Add other dependencies needed for Docker client

* First pass of a docker client in odo

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* More unit tests

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Remove unneeded sections in fake docker client

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Remove extra line added

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Catch error

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Remove license that was added via copy and paste

Signed-off-by: John Collier <John.J.Collier@ibm.com>

* Address review comments

Signed-off-by: John Collier <John.J.Collier@ibm.com>
2020-03-25 12:45:55 +01:00
Dharmit Shah
51544e2342 Adds ability to list Operators available in the cluster (#2593)
* Add dependency on operator-lifecycle-manager (release-4.1)

* Add Operator Hub client to kclient package

* Add function to list installed operators

To be more specific, it lists the `ClusterServiceVersions` in the
cluster. But a `ClusterServiceVersion` is available only when
Operator(s) is/are installed by the cluster admin.

* List the CSVs in the cluster using odo commands

* Add dependency on github.com/golang/groupcache

* Removes futile call to get services from catalog

We're already getting services from the catalog in `Complete` function
and storing it in `o.services`.

* List the Operators only if experimental mode is enabled

* Update CI cluster setup script to setup operators

* Add OperatorHub tests to test-cmd-service

* Integration tests for listing operators

* Remove specific CSV version to let it be automatically selected

* Add test suite for OperatorHub tests to run

* Separate PHONY for OperatorHub tests and run it on 4.x cluster

* Use a CRD's kind instead of DisplayName to make service creation simpler in future

* Set environment variable for experimental mode

* Modify cluster setup to install operators on 4.1

* Execute different steps to setup OperatorHub if running on OCP 4.1

* Fix operator setup script for OCP 4.x

* Changes as per the PR review

https://github.com/openshift/odo/pull/2593#pullrequestreview-363449893

* Added klog dependency through `glide update -v`

* Changes as per the PR review

https://github.com/openshift/odo/pull/2593#pullrequestreview-372480988
https://github.com/openshift/odo/pull/2593#pullrequestreview-372484636
2020-03-11 05:06:15 -04:00
Tomas Kral
2cc1380c45 add k8s.io/client-go/plugin/pkg/client/auth (#2665)
* add kubernetes client auth library

* update vendor after adding k8s.io/client-go/plugin/pkg/client/auth
2020-03-06 02:41:23 +01:00
Tomas Kral
de1aa2bcb4 Update vendor openshift 4.1 (#2574)
* update openshift libs in glide.yaml to 4.1

* update vendored openshift to 4.1

* add licence check exception for sigs.k8s.io/yaml
2020-02-06 20:10:14 +01:00
Yusuf Kanchwala
8725bb0db1 Add devfile parser (#2500)
* Add devfile parser

* Update vendor: add gojsonschema
2020-02-03 07:19:24 -08:00
Girish Ramnani
adf3006360 odo delete --all only deletes the config directory if its empty (#2311)
*  odo delete --all only deletes the config directory if its empty

* better v4 log message

* add a filesystem interface for better testing

* use stat from fs too

* tighter file interface

* add unit tests

* add more comments

* add afero based filesystem in testutils

* capitalize comments

* integrate the filesystem package in the config and its unit tests

- Add missing methods in the testutil's filesystem package
- minor refactoring in the config package
- use of the new filesystem package in the config package's unit tests

* resolve failing unit test

* resolve charlie's comment

* resolve linting error

* lint issue - 2

* add source to the original filesystem package

* resolve empty componentContext when not provided as flag
2019-11-21 17:26:49 +01:00
Charlie Drage
09568358b6 Add "pretty" library for testing (#2122)
* Update vendoring

* Add "pretty" library for testing

Adds the "pretty" library for easier debugging.

See below:

```sh
--- FAIL: TestListWithDetailedStatus (0.00s)
    service_test.go:482:  [
          {
           TypeMeta: {
            Kind: "Service",
            APIVersion: "odo.openshift.io/v1alpha1",
           },
           ObjectMeta: {
            Name: "mysql-persistent",
            GenerateName: "",
            Namespace: "",
            SelfLink: "",
            UID: "",
            ResourceVersion: "",
            Generation: 0,
            CreationTimestamp: {
             Time: 0001-01-01 00:00:00 +0000 UTC,
            },
            DeletionTimestamp: nil,
            DeletionGracePeriodSeconds: nil,
            Labels: {
            },
            Annotations: {
            },
            OwnerReferences: [
            ],
            Initializers: nil,
            Finalizers: [
            ],
            ClusterName: "",
           },
           Spec: {
            Type: "mysql-persistent",
            Plan: "default",
           },
           Status: {
        -   Status: "ProvisionedSuccessfully",
        +   Status: "ProvisionedAndLinked",
           },
```

Vs:

```
--- FAIL: TestListWithDetailedStatus (0.00s)
    service_test.go:481: expected output: []service.Service{service.Service{TypeMeta:v1.TypeMeta{Kind:"Service", APIVersion:"odo.openshift.io/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"mysql-persistent", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Locati
on)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:service.ServiceSpec{Type:"mysql-persistent", Plan:"default"}, Status:service.Serv
iceStatus{Status:"ProvisionedSuccessfully"}}, service.Service{TypeMeta:v1.TypeMeta{Kind:"Service", APIVersion:"odo.openshift.io/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"postgresql-ephemeral", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}
, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:service.ServiceSpec{Type:"postgresql-ephemeral", Plan:"default"}, Status:service.ServiceSta
tus{Status:"ProvisionedSuccessfully"}}, service.Service{TypeMeta:v1.TypeMeta{Kind:"Service", APIVersion:"odo.openshift.io/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"mongodb", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp
:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:service.ServiceSpec{Type:"mongodb", Plan:"default"}, Status:service.ServiceStatus{Status:"ProvisionedSuccessfu
lly"}}, service.Service{TypeMeta:v1.TypeMeta{Kind:"Service", APIVersion:"odo.openshift.io/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"jenkins-persistent", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), Del
etionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:service.ServiceSpec{Type:"jenkins-persistent", Plan:"default"}, Status:service.ServiceStatus{Status:"Provisioning"}}},got: []servic
e.Service{service.Service{TypeMeta:v1.TypeMeta{Kind:"Service", APIVersion:"odo.openshift.io/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"mysql-persistent", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), Del
etionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:service.ServiceSpec{Type:"mysql-persistent", Plan:"default"}, Status:service.ServiceStatus{Status:"ProvisionedAndLinked"}}, service
.Service{TypeMeta:v1.TypeMeta{Kind:"Service", APIVersion:"odo.openshift.io/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"postgresql-ephemeral", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePer
iodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:service.ServiceSpec{Type:"postgresql-ephemeral", Plan:"default"}, Status:service.ServiceStatus{Status:"ProvisionedAndBound"}}, service.Service{T
ypeMeta:v1.TypeMeta{Kind:"Service", APIVersion:"odo.openshift.io/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"mongodb", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil
), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:service.ServiceSpec{Type:"mongodb", Plan:"default"}, Status:service.ServiceStatus{Status:"ProvisionedSuccessfully"}}, service.Service{TypeMeta:v1.TypeMeta{Kind:"Servic
e", APIVersion:"odo.openshift.io/v1alpha1"}, ObjectMeta:v1.ObjectMeta{Name:"jenkins-persistent", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]
string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:service.ServiceSpec{Type:"jenkins-persistent", Plan:"default"}, Status:service.ServiceStatus{Status:"Provisioning"}}}
```

Closes: https://github.com/openshift/odo/issues/2120
2019-09-19 20:20:16 +02:00
Amit Rout
1af22f3b5f Organize the tests in a proper way (#1612) 2019-05-09 15:07:45 +02:00
Tomas Kral
7c81a212d8 Clean e2e test example (#1535)
* a template for a clean tests

* vendor: update ginkgo,gomega,testify

* e2e template: Remove Before/AfterSuite and rename file

* gofmt

* don't ignore .odo
2019-04-01 06:09:14 -07:00
Charlie Drage
10b8152617 Adds color support for Windows (#1211)
* Vendoring for go-colorable

* Adds color support for Windows

This fixes the issue of ASCII characters not appearing correctly for
Windows users.

Changes with this PR:
- Odo will detect if Windows is used and use a non-Unicode spinner.
- Odo will also use "X" and "V" to indicate success and unsuccessful on Windows since "✓" is Unicode.

Closes issue: #https://github.com/redhat-developer/odo/issues/1072
2019-03-17 23:07:12 -07:00
Chris Laprun
f209c678ce Implement interactive mode for service create using survey lib.
* Initial implementation for service create interactive mode.

* Remove unneeded (and troublesome) raw extension unmarshalling.

* Update vendor.

* Isolate interactive mode implementation from command code.

* Unexport functions that don't need to be.

* Rename SelectServiceNameInteractively to EnterServiceNameInteractively.
Add documentation.

* Remove dependency on occlient in ui package.

* Format documentation according to conventions.

* Make todo more specific.

* If title doesn't exist use name instead.

* Actually, always use name and show title as additional info.

* Properly handle interrupts (ctrl-c).

* Improve handling of properties:
- Deal with optional properties
- Check (and ignore) extra provided properties

* Introduce Validator type.

* Improve UI.

* Add basic validation of input.

* Use init function and validators map.

* Initial implementation using survey instead of promptui.

* Update vendor.

* Address code style issues.

* Update glide and vendor.

* Fix improper pointer assignment.

* Proof of concept of promptui-like detail panel.

* Updated for new code organization. Needs lots of improvements.

* Extract ServicePlans creation into NewServicePlans function.
Simplify unmarshalling code.

* Use ServicePlans instead of dealing with info extraction here and remove
option to pass values to EnterServicePropertiesInteractively.

* Rename catalogUI to simply ui.

* Move ui package to where it's used and makes more sense.

* Make service plan parameters sortable by name.

* Make EnterServicePropertiesInteractively more easily testable.

* Extract fake plan details creation functions so that they can be reused.

* Add ui tests but it is currently failing… Update vendor dependencies.

* Disable color output to simplify testing.

* Duplicate survey test infrastructure and adapt ui_test accordingly.

* Remove now unneeded stdio function.

* Make providing value required.

* Only attempt to unmarshal extension if it exists.

* Fix crash if filtered entries resulted in empty pageEntries.

* Restore original template once we're done with the selection.

* Use a more explicit template function name and improve template changes.

* Use defer to restore template and template functions once done.

* Use survey.ComposeValidators and remove chainedValidator.

* Skip the test until we can figure out what is wrong with it.

* Fix improper imports.

* Fix style errors.

* Add documentation to exported functions.

* Rename ServicePlans to ServicePlan (no reason for it to be plural).

* Should error out if the service class is not found.

* Fix link.

* Add documentation.

* Fix missing display and potential panic.

* Service name was improperly validated.

* Remove additional information display as it's causing display issues.

* Update survey to latest version.

* Re-add service class detail since it is now fixed and improve output.

* Work around issue with repeated question when lines wrap in terminal.

* Update to survey 1.8.0.

* Use 1 error code.

* Create a constant for the default number of columns before text wraps.

* Add comments.

* Add comment for golint to pick up.

* Add comment.

* Add documentation to ServiceCreateOptions struct.

* Fix potentially invalid logic.

* Fix improper output (expected vs actual were reversed).

* Extract more common functions to services and add more tests.

* Delete unused function.

* Default to default column number if detected width is 0. Add tests.

* Update vendor information.

* Add more tests.

* Add documentation.
2019-01-17 13:17:32 +01:00
Mrinal Das
99fec5068d Added .odoignore functionality and glob matching support for watch. (#1158)
* Added glob support for watch.

Added the package for ** and other support for glob matching.

* Reads .gitignore file to get the ignore rules

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Adds support for reading .odoignore file for getting the ignore rules

A function 'GetIgnoreRulesFromDirectory' is introduced to get the ignore rules from the source directory. If .odoignore is not found, .gitignore will be used. If both files don't exist, empty array would be returned.

* Fixed tests for isRegExpMatch

* Added tests for the GetIgnoreRulesFromDirectory()

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Added more tests and added comments

* Added support for ignoring '#' line i.e comments in .gitignore and .odoignore

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Fixed glob checks for folder

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Fixed debug message and comment in CheckPathExists()

* Change rules appending behaviour and fixed comments

* Modified the return comment for isRegExpMatch

* Modified the comment structure for isGlobExpMatch()

Signed-off-by: mik-dass <mrinald7@gmail.com>

* Modified GetIgnoreRulesFromDirectory() to always include .git rule and modified tests accordingly

* Renamed to glob expressions in flag description
2019-01-16 16:25:27 -05:00
Suraj Narwade
c88f02e247 vendor 2018-11-13 13:04:05 +05:30
Chris Laprun
2fb026f084 Completion in go (#859)
* Initial implementation setting up of smart completion.

* Initial implementation for service delete.

* Initial implementation for service create.
This doesn't work properly because we really need to be able to
distinguish between positional arguments.

* Clean-up.

* Add doc.

* Add doc.

* Refactor completion handler code to make it easier to test. Add tests.

* Update vendor.

* Filtering doesn't occur at the completion handler level at this point.

* Add test for delete completion.

* Update glide and vendor.

* Fix format.

* Fix format.

* Add MPL-2.0 to licenses.

* Revert to 1.1.2 version of complete library due to bug with 1.2.0.
See https://github.com/posener/complete/issues/74

* Fix odo -h.
2018-10-29 13:46:45 +05:30
Suraj Narwade
64f9db2e17 Updated vendor with service catalog and client-go (#716)
* Updated client-go, service-catalog

* updated vendor

* Removed go-github and k8s.io/api to resolve conflicts

* updated vendor
2018-09-11 11:14:57 -04:00
anmolbabu
4d939c7c1f Momentarily remove project delete UT (#719)
Momentarily remove project delete UT until a better way to
stub ModifyConfig is found

fixes #718
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
2018-09-11 12:07:07 +05:30
anmolbabu
d924a1b36e Add project delete command (#648)
* Add project delete command

This PR adds project delete command.
The core implementation is only wrapped around by this PR
and exposed to the outside as a cli command

fixes #646
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Add monkeypatching dependency to vendor/

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Add UTs

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Add e2e tests

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Incoporate @cmoulliard comments

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Fix travis failures

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Incoporate @syamgk comment

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Incoporated @surajnarwade comments

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Incoporate @cdrage comments

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
2018-09-10 14:18:12 -04:00
anmolbabu
573ea65bea Enable levelled logging (#590)
* Enable logging as per verbosity rules in odo

Ref: https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-output-verbosity-and-debugging
To accomplish the above, in this PR as suggested by #189 (comment), the
following will be done:
1. replace log "github.com/sirupsen/logrus" with "github.com/golang/glog"
2. replace log.Debugf with glog.V(4).Infof
3. replace log.Errorf with glog.Errorf

fixes #189
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Update vendor to use glog instead of logrus

fixes #189
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Fix gofmt errors

fixes #189
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Incoporate @snarwade comments

fixes #189
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Rebase

Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>

* Incoporate @kadel comments

fixes #189
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
2018-08-24 13:22:02 +05:30
Charlie Drage
c7f7f53b35 Update vendoring for adding olekukonko/tablewriter 2018-05-28 10:06:36 -04:00
Tomas Kral
6f4e4605c4 Update vendor (glide up -v) to resolve missing dependencies 2018-05-04 13:56:27 +02:00
Charlie Drage
0d5cd93e96 Update vendoring 2018-04-19 09:13:59 -04:00
Tomas Kral
46cd5f0ee1 vendor: add fsnotify 2018-04-16 19:31:45 +05:30
Shubham Minglani
e74e858bc1 Add service-catalog to vendor/
This commit adds github.com/kubernetes-incubator/service-catalog,
version: v0.1.9 and github.com/satori/go.uuid, version: v1.1.0 (
which is required by service-catalog) to the vendor directory.

The standard procedure of adding the dependencies to glide.yaml
and then running `glide update --strip-vendor` was followed.
2018-03-26 15:25:36 +05:30
Anush Shetty
6ff2d4680e Add dependencies for e2e tests 2018-03-21 14:40:00 +05:30
Tomas Kral
aab6e804d7 add openshift/client-go to vendor 2018-03-19 17:03:58 +01:00
Tomas Kral
2ba1fe6c41 update vendor with glide 2018-03-16 15:05:37 +01:00
Shubham Minglani
083870dc0b vendor add: google/go-github and blang/semver
This commit updates vendor/ to bundle in the following
dependencies:
- github.com/google/go-github
- github.com/blang/semver
2018-02-21 20:27:46 +05:30
Shubham Minglani
40d75908ce Update vendor: ghodds/yaml, pkg/errors
This commit updates the vendor/ directory using `dep ensure` to
add the ghodds/yaml and pkg/errors packages to be used in the
config package.
2018-02-02 15:21:25 +05:30
Tomas Kral
ed0a1d59e9 vendor: add github.com/sirupsen/logrus 2018-02-01 13:28:54 +01:00
Suraj Narwade
c75bf541ea Added vendor 2018-01-30 16:45:35 +05:30