Commit Graph

158 Commits

Author SHA1 Message Date
Parthvi Vala
b1fbfaa6f1 Preference cleanup (1/n) (#5822)
* Preference(Timeout) int > time.Duration

* Fix odo preference --help for unset examples

* Preference(PushTimeout) int > time.Duration

* Change set, and unset messages

* Preference(RegistryCacheTime) int > time.Duration

* use cobra.ExactArgs for set, and unset

* mockgen

* Unit tests and integration tests

* Fix unit test failure

* Update k8s.io/utils pkg

* Philippe's review

* Fix error message

* Philippe's review

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

* Add minimum acceptable value for preferences accepting time.Difference type

* Fix unit test failure

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

* Add migration plan with a warning, add better error message for incompatible formats

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-06-23 14:27:39 +00:00
Philippe Martin
8cdc9348d7 Substituting variables into the devfile from the CLI (#5749)
* Define var and and-file flags

* vars package

* Vars for deploy

* Add integration tests for dev

* Update dev mock

* New devfile library version

* Add doc

* Fix validate

* Review

* Apply suggestions from code review

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

* review

Co-authored-by: Parthvi Vala <pvala@redhat.com>
2022-06-13 05:03:22 -04:00
Philippe Martin
d5935a16cc Use latest alizer library version, including .net detection (#5804)
* Use latest alizer library version

* Update quickstart guide
2022-06-09 04:40:19 -04:00
Philippe Martin
f73ae5bf9a Upgrade to registry-library v1.0.1 to ignore OWNERS files (#5712) 2022-05-05 02:36:26 -04:00
Anand Kumar Singh
098389b027 update go version to use go 1.17 (#5497)
* update go version to 1.17

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* update go version to 1.17 and fix failure

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2022-04-29 12:20:35 -04:00
Charlie Drage
9c491b16fe Updates odo init output, fixes colorized output for tests. (#5613)
* Update vendoring for coloring to add NO_COLOR

* Updates odo init output / adds logo

<!--
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 cleanup
/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

**What does this PR do / why we need it:**

We have the logo appearing in `odo dev` and `odo deploy`

Those 3 commands are the most used with `odo`, and the ones that are
most used. All three should have similar and consistent output that
contains:
  * What the component is doing (first line)
  * What's detected (in odo init, it's the files, in odo deploy and dev
    it's the component name)
  * odo version that is being used / outputted.

```sh
$ odo init
  __
 /  \__     Initializing a new component
 \__/  \    Files: No source code detected, a starter project will be created in the current directory
 /  \__/    odo version: v2.5.0
 \__/

Interactive mode enabled, please answer the following questions:
? Select language: javascript
? Select project type: Next.js
 ✓  Downloading devfile "nodejs-nextjs" from registry "DefaultDevfileRegistry" [450ms]
? Which starter project do you want to use? nodejs-nextjs-starter
? Enter component name: my-nodejs-nextjs-app
 ✓  Downloading starter project "nodejs-nextjs-starter" [516ms]

Your new component 'my-nodejs-nextjs-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
```

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

N/A

**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>

* Update based on reviews

Signed-off-by: Charlie Drage <charlie@charliedrage.com>

* Update based on review

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2022-04-12 09:41:45 -04:00
Charlie Drage
4669bc9dc7 Implement redesigned odo list functionality (#5552)
* Vendoring

* Add redesigned odo list
2022-03-30 10:21:51 -04: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
Mohammed Ahmed
2d7c993796 Moving to use gitignore library go-gitignore (#5181)
* Adding gitignore to odo

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding indexer to file indexer

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing file closed error

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating to simpler logic

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating path to check if its a directory

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Trying to fix directroy matching

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding debug stmts

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding more debug

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unneeded code

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating logic and removing IsGlobExpMatch usage

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding back changes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving to simpler gitignore package

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing debug stmts

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing old code

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unnessasary code

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing gofmt

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Making replace string longer to avoid clash with actual names

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing duplicate code

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding intergration test

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding orignal ignore rules as argument to file indexer funcs

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating uts as needed

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unused function

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Cleanup

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing test

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing tests

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating unit tests to inlude a subdir

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding unit test for subdir ignore case

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing the now unneeded integration test

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing gofmt

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unneeded example

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Cleaning up

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing todos

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unused consts from rebase

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
2022-03-16 10:56:22 -04:00
Dharmit Shah
f80207b029 Implements odo dev (#5441)
* Skeleton for odo dev and a unit test

* Update go mod for fsnotify

* Start method Pushes and then Watches

* More understandable code comments

* Client and interface for watch package

* Mocks for watch package

* Add CLI layer

* Fix infinite watch & push trigger

* Remove context flag from odo dev

* Add integration tests for odo dev

* Add klog to dev.go

* Replace errors.Wrap with fmt.Errorf

* Self review

* Removes `odo watch` command, but the business logic exists as it's
  used by odo dev
* Removes integration tests for `odo watch`
* Removes errors.go and types.go from pkg/dev/ since they are empty

* Check if error is not nil

* Use real client in watch unit tests

* Uncomment AfterEach from tests

* Modify the logs printed to stdout

* Changes based on Philippe's review

* Remove unused clients

* Parthvi's PR review and unit test fixes

* Fix gofmt message, remove message to not expect

* Fix lint complains, add mistakenly deleted URL creation logic

* Remove or modify tests that rely on odo push output

* Remove unused variables based on golangci-lint

* Fixes based on Philippe's review

* Initialize first index after first run of odo dev

* Modify odo dev test, and uncomment a mistake
2022-03-03 04:15:37 -05: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
83a3ee5a0b [v3] update to SBO library to 1.0 (#5314)
* update vendored sbo to 1.0

* go mod vendor

* update code to work with sbo 1.0

* Re-enable use of operator

* Fix remove link

* Continue when no access to CRDs

* Fix rebase

Co-authored-by: Tomas Kral <tkral@redhat.com>
2022-03-01 04:36:53 -05:00
Parthvi Vala
39c8e40ddc Personalize devfile (#5467)
* Fix: Ask for devfile personalization

* Update devfile library

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

* Add todo

* Print live configuration, make it work

* Run mockgen script

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

* TODO

* Add missing mock methods

* Add review suggestions

* Add mock methods

* Add unit tests

* Add mock methods post rebase

* Fixes post rebase

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

* Review, only run devfile personalization if the dir is not empty and is interactive mode

* Mock methods

* Fix unit tests

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

* Review

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-02-24 03:19:28 -05:00
Philippe Martin
ff03b8e49a Select and pull a devfile using Alizer (#5464)
* Add alizer library and test functionality

<!--
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/Developer-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/Writing-and-running-tests
4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/PR-Review

Documentation:

If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Contributing-to-Docs
-->

**What type of PR is this:**

<!--
Add one of the following kinds:
/kind bug
/kind cleanup
/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

**What does this PR do / why we need it:**

Adds the alizer library from
https://github.com/redhat-developer/alizer/tree/main/go as part of our
implementaion of `odo dev` and `odo init`.

This builds upon @feloy 's PR located here: https://github.com/redhat-developer/odo/pull/5434

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

Fixes #

**PR acceptance criteria:**

- [X] Unit test

- [X] Integration test

- [X] Documentation

**How to test changes / Special notes to the reviewer:**

N/A. Only function implementation

* New alizer version

* Use alizer for odo init

* Add integration tests

* Add Alizer to odo deploy

* review

* Ask component name for odo deploy

* Fix unit test

Co-authored-by: Charlie Drage <charlie@charliedrage.com>
2022-02-23 01:52:51 -05:00
Dharmit Shah
32d8a042ea Set replicas using devfile library (#5413) 2022-02-14 06:52:36 -05:00
Philippe Martin
21ea375695 Use functions from devfile library (#5457)
* Remove duplicated functions from pkg/util

* Use generator.GetVolumeMountPath from devfile library
2022-02-14 00:40:37 -05:00
Parthvi Vala
752c9285df Add duplicate port validation, update devfile libraries, and add tests to check port name matches endpoint name (#5407)
* Add duplicate port validation, update devfile libraries, and add tests to check port name matches endpoint name

* Fix k8s test
2022-02-09 10:59:54 -05:00
Philippe Martin
4b601a8911 Remove unused go imports (#5444) 2022-02-08 06:16:17 -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
Tomas Kral
c1f570df1f update gjson version (#5291)
* vendor: update gjson version (CVE-2021-42836)

* go mod vendor
2021-12-16 12:47:50 +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
Kim Tsao
9342ddc0e1 Devfile telemetry (#5260)
* Devfile telemetry

* Vendor updates

* fix colon

* fix tests

* update package names
2021-12-03 08:26:35 +01: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
Philippe Martin
ac478e9cd1 odo deploy command (#5228)
* Update devfile library

* deploy cmd

* Init "odo deploy" command reference

* Integration test

* Fix odo deploy

* Filter components to apply during odo push

* Output

* Remove redondant level 1 title

* Doc review

* Use server-side apply to apply Kubernetes components

* Review

* Replace PROJECT_ROOT with PROJECTS_ROOT
2021-11-24 15:26:03 +01:00
Tomas Kral
88e89104ee update dependencies to OpenShift 4.9 (#5133)
* update to openshift-4.9/k8s-1.22

* go mod vendor
2021-11-09 20:16:30 +01:00
Dharmit Shah
fd029225e6 Update buildroot to 1.16 (#5154)
* Update buildroot to 1.16

* Update go.mod to use go 1.16

* Ran go mod vendor for failing test

* Update 1.15 reference at more places
2021-10-20 12:03:14 +00: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
Jingfu Wang
1eff3210c4 Devfile registry telemetry integration (#5101)
* feat: devfile registry telemetry

Signed-off-by: Jingfu Wang <jingfwan@redhat.com>

* fix: resolve conflict issue

Signed-off-by: Jingfu Wang <jingfwan@redhat.com>

* refactor: centralize consts

Signed-off-by: Jingfu Wang <jingfwan@redhat.com>
2021-10-05 03:46:52 -04:00
Philippe Martin
3674110c22 Validate parameters on odo service create from swagger/csv (#5074)
* Validate parameters

* Fix types

* detect errors on params

* Remove duplicated lines

* Get type from schema

* New describe

* Integration tests

* Fix kclient interface

* vendor
2021-09-29 05:16:57 -04:00
Dharmit Shah
0b735ae7b6 Fetch locale information for Telemetry (#5066)
* Fetch locale information for Telemetry

* Set locale info in traits

* Continue execution if locale detection fails

* Update pkg/segment/segment.go

Co-authored-by: Philippe Martin <contact@elol.fr>

* Update pkg/segment/segment.go

Co-authored-by: Philippe Martin <contact@elol.fr>

* Use %s instead of %w for logging error

Co-authored-by: Philippe Martin <contact@elol.fr>
2021-09-27 11:55:57 -04:00
Philippe Martin
fd6ebb27f6 Get parameters information of operator backed services from Kubernetes OpenAPI spec (#5020)
* vendor

* go mod

* remove old service structures

* Get parameters information of operator backed services from Kubernetes OpenAPI spec

* Add DisplayName

* Displays required + type

* Add some integration tests

* Unit tests

* Display a warning when no CRD or CSV info is found

* Add unit tests

* Update pkg/odo/cli/catalog/describe/operator_backend.go

Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>

Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
2021-09-03 20:00:57 +02:00
Mrinal Das
2e661bf71d Adds support for linking using service binding without the service binding operator (#4905)
* Adds support for linking using service binding without the service binding operator

* Uses isLinkResource() to detect the service binding resources

* Updates the success message for operator based links

* Updates the flow to creating the deployment first

* Adds annotations to the Redis CR in devfile-with-link.yaml file

* Updates the flow to create only the services before the deployment.

It also separates the push related code for link and service creation.

* Moves the for loop in setLinksServiceNames() inside the if condition

* Adds and returns a error message when the pipeline throws a forbidden type of error

* Moves the updation of services and pvcs with owner references before attempting creation of links
2021-08-02 15:42:41 +00:00
Philippe Martin
e1391b2624 preStart events support (#4909)
* preStart events support

* Changelog

* devfile/library with new getContainers

* Fix unit test

* Remove unnecessary validateEvents
2021-07-22 11:51:21 -04:00
Anand Kumar Singh
f9cbdc4d98 Update go 1.15 (#4852)
* updating golang version 1.15

Signed-off-by: anandrkskd <anandrkskd@gmail.com>

* update go.mod

Signed-off-by: anandrkskd <anandrkskd@gmail.com>
2021-06-28 16:36:39 -04:00
Girish Ramnani
9cfcbc3485 param based odo service create for operator backed services (#4704)
* initial work towards param based odo service create

* change

* add type data to cr

* add to devfile

* update olm

* remove logs

* towards tests

* init tests

* more test

* fix tests

* fix unit again

* set default service name

* mod fix

* addressed some comments

* add postgres operator in setup and in test

* fix

* fix some tests

* fix helpers

* helper flag

* merge conflicts

* add tests and install operator

* certain cases fix

* fix intg tests

* update scripts

* fix intg test

* changed function name

* changes

* fix comments

* docs update

* link fix

* small fix

* comment

* unit tests

* doc fix

* renamed as per comments

* comment
2021-06-24 03:42:47 -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
Tomas Kral
7b44d593e4 use -mod=vendor with all go commands in Makefile and use vendoring to manage ginkgo (#4784)
* export GOFLAGS=-mod=vendor in Makefile

* use go get instead of go install

for installing test dependencies

* use tools approach to manage testing dependencies

When using this apporoach we can make sure that all dependencies in a
proper version are vendored with the source code.

* go mod vendor

* add wwhrd expection for github.com/hinshun/vt10x
2021-06-09 11:18:51 +02:00
Philippe Martin
bd182d8809 Use ServiceBinding types instead of unstructured.Unstructured (#4713)
* revert #4613

* Add servicebinding vendor

* Fixes
2021-05-19 06:39:41 -04:00
Tomas Kral
89ac67e425 use server side apply (#4648)
* update to openshift 4.7 and sbo 0.7.0

* use server side apply for updating deployments

* go mod vendor

* use ApplyDeployment instad Patch and Create

* fix login message

* update unit tests to work with ApplyDeployment function

* fall back to Create/Update for k8s older than 1.16

* abstract fieldManager into const

* fix operator-framework imports
2021-05-17 13:05:21 -04:00
Dharmit Shah
cb6e2cab27 Creates service on cluster upon "odo push" (#4650)
* Creates service on cluster upon "odo push"

* Modifies integration tests to use "odo push"
2021-04-22 06:14:45 -04:00
Jingfu Wang
cdd92ef3a5 OCI-based devifle registry support (#4525)
* feat: OCI-based registry support

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* refactor: download the whole stack by default

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* fix: invalid folder issue

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* fix: address comments

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* fix: test case and auto migration

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* fix: code issue detected by unit test

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* test: fix unit test

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* Merge branch 'master' of github.com:openshift/odo into odoMigration

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* refactor: adopt the latest devfile library

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* test: fix unit tests

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* test: fix unit tests

Signed-off-by: jingfu wang <jingfwan@redhat.com>

* Merge branch 'master' of github.com:openshift/odo into odoMigration

Signed-off-by: jingfu wang <jingfwan@redhat.com>
2021-04-15 18:20:07 -04:00
Tomas Kral
8479050f68 fix odo compatibility with SBO 0.7.0 (#4613)
* use k8s unstructured instead of SBO types

* remove service-binding-operator from vendor
2021-04-15 02:08:36 -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
Parthvi Vala
c98445f8bb Enter Telemetry (#4482)
* Send telemetry to segment

* Add tests and other properties

* Add comments

* Fix fmt

* Add telemetry dev key

* Add non-test related changes requested to the PR and add consenttelemetry prompt

* Handle prompt while running tests

* First attempt at fixing unit job failure

* Modify tests as requested

* Stop prompting when preference is called

* Fix comments

* Add more unit tests and integration test(WIP)

* Fix failing tests

* Stop prompting when help is called

* Make tests more verbose

* Add Usage data doc

* Add segment key

* Add a better usage doc

* Add comments, move tests and other requested changes

* Fix comments and remove focus

* Add set ConsentTelemetry unit tests

* Change want from string to bool

* Fix failing integration test

* Fix failing operator hub test

* Fix failing devfile integration test

* Fix tests failing due to cmdwrapper WithEnv

Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
2021-03-26 11:43:09 +00: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
Mohammed Ahmed
b2483a5cf2 Setting up baseline POC of internal CI (#4063)
* Working on baseline POC of internal CI

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing golangci comments

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Reducing timeout for sake of PIC feedback

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving defer

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* jenkins build is now a number and dont cancel current build

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating envs to prevent conflicts, if any

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Update jenkins user envs

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Disabling auto delete and adding explicit shutdown

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing autodel

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some more fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Reenablong autodelete and sleeping

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Init and shutdown moved around a bit

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* 2 Connections on prow worker

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some more fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing nil pointer exception on rcvqchan

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some cleanup and fixing done message not being sent

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing up messaging

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding actual testing

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Make it fail purposefully

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Simplifying poc

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some more fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing success chan as its not needed

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing in favor of seperate repo

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing related vendor

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Blah

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* updating testing scripts

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some script updates

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* build odo and copy it to path

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Re-ordering test script

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removed unneeded setup script

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Debugging

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some more stuff

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Re-enable hiding

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Cleaning up the script

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixup for windows and macos testing

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing env names to make it cleaner

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Allow redhat tests to specify precreated project name and delete it

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Updating script for kubeadmin login and handling some setup

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixup randomstring to satisfy dns format

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some stuff to do

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Remove deleteproject

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some more fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing project name

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Some fixes

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Hiding deletion projects and export project names

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Increasing timeout and memory for java

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing after rebase

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Reverting fixes to tests

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Rebasing and fixing env names and adding one for ubi8 nodejs12

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing up way env is read

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing project name in oc import image

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding remaining tests

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Skipping user login tests

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing coloration for ginkgo

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding helper for oc get pods and using it in operator hub tests

oc get pods succeeds, even if there are no resources. So to account
for delays in pods becoming available the fallthough from above mentioned
issue, this was created

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving noColor to GINKGO_TEST_ARGS

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding justbeforeeach and justafter each to a context

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixup for newer image

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing Access information from file stat in pod.

1. Touching a file on mounts without `noatime` changes the access time.
2. This includes use by run script in container, hence resulting in errors.
3. We are not interested in access information anyway.

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing after rebase

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Increasing curl timeout

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Rebasing and addressing comments by @dharmit

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing after rebase

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Readjusting time and order

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Moving operator hub tests to top

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing ginko nocolor as ansi stripping is available in ci-firewall

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing typo

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding back old openshift presubmit script with a -old

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing random project for nodejs-14

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing after rebase

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing odo command

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
2021-02-08 15:23:09 -05:00
Girish Ramnani
9c129a3c7f sanitize dir name before using it on odo push (#4333)
* sanitize dir name before using it on odo push

* removed log statements

* sensible comment

* valid url name should only be slugged

* fix
2021-01-11 04:54:53 -05:00
Rodolfo Napoles
14c98ec55b 3823 refactor json (#4296)
* 3377 adding odo devfile support test

* #3377 replaced spaces with a Tab

* #3377 updated focus value

* #3823 new func to match JSON path values and updated test scripts to use it

* added . to import

* updated Makefile to aff gjson

* modified Makefile for gjson

* adding go.mo, go.sum and vendor for new gjson dependency

* removed unnecessary changes

* Removed unused import

* Removing if block

* Fixed expected strings for JSON matcher

* Fixed json paths and values to be compared

* Fixed JSON paths and expected values

* fixed required flags for expected failure

* Removed comment in failing code

* Fixed expected output line 164

* removed commented code
2020-12-21 13:36:12 -05:00
Aditi Sharma
c194899343 Add Support for specifying git branch and tag in devfile (#4260)
* Update go-git

* Add support for specifying branch and tag name

* Fix gosec error
Fix Integration test

* Added warning if commit id is used as revision

Added Integration tests

* fix devfile

* Fix failing test update tag version

* Address review comment 1
2020-12-07 17:52:55 -05:00