Commit Graph

16 Commits

Author SHA1 Message Date
Armel Soro
5660093167 Use go-cmp instead of reflect.DeepEqual to compare unit test results (#6343) 2022-11-24 07:24:32 -05: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
f22c3f854d odo dev: react to changes as soon as possible (#5933)
* Create auxialiary functions to find current deployment and pod name

* Create auxialiary function for pushing Kubernetes components to cluster

* Auxiliary function getPushDevfileCommands and remocve RunModeChanged flag as it is not possible anymore with long running dev command
+ move prelimiray tests at the beginning

* Create auxiliary function updatePVCsOwnerReferences + move isMainStorageEphemeral inside aux. function

* Watch for deployments in addition to watching for files during odo dev

* - Check the Deployment Generation to return earlier when generation changed
- Return earlier when pod is not ready

* Push receives a Status that it can update, to indicate the status of the component when the function returns. This status is passed from Start to Watch

* Use status to decide to sync files

* Simplify getting pod

* Status for PostStartEvents

* - Touch .gitignore earlier so it is not synced
- Add devstate.jso file to .gitignore

* Fix the integration tests.

* Make --no-watch work again

* Get smaller volumes for tests

* Quit when fail to exec port forwarding

* Exponential delay after an error

* Fix: get running pod

* Remove testing odo dev stops when the build command fails. odo dev now gives a change to the user to fix the problem

* Fix order or volumes and volume mounts in pod spec

* Use server side apply for updating PVC when supported

* Watch Devfile separately

* Adapt tests for devfile handled separately

* Update forwarded ports when necessary

* Display kubernetes resources created only when created/updated

* Do not set ResourceVersion when patching

* TEMP: Add more logs on failing integrattests

* Tests: select the *running* pod

* Use forward slashes for .gitignore content, even on Windows

* Rename GetOnePodFromSelector to GetRunningPodFromSelector

* Cleanup logs

* Fix 'odo log' integration test

* Add log "Waiting for Kubernetes resources"

* Fail if service bindings are not injected

* Rename sources related watcher, timer

* Fix delay after error

* Display info about Pod

* Disambiguate error messages

* Display events related to components pod

* Remove now unused functions used to wait for Deployment / Pod

* Typos + function renaming

* Do not watch devfile with --no-watch

* Use type switch for Kubernertes watch event

* Do not fail when watching Events is Forbidden

* Do not fail when servicebinding resources are forbidden

* Exit when build command fails on no-watch mode

* Sync devfile.yaml by default, workaround when commands change on devfile

* Rename to warningsWatcher

* Fix comment
2022-08-08 10:20:55 +00: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
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
Mrinal Das
687e7513bc Adds storage Push() for devfile components. (#4407)
* Adds storage Push() for devfile components.

It also adds CLI messages for creation and deletion of storage.

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

* Adds test for Push(). It also adds tests for Create() and Delete() of the kubernetes storage client

* Removes GetOwnerReference() from the kclient

* Renames UpdateStorageOwnerReference() to GetAndUpdateStorageOwnerReference()

* Fixes ListFromCluster(), removes the StorageAdapter from the common interface and adds some comments.

* Fixes ListFromCluster() by avoiding the volume mounts from the init containers and the source volume
2021-03-15 16:04:29 -04: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
809462a1c9 Refactors pvc code in occlient and kclient (#4226)
* Refactors pvc code in occlient and kclient

* Uses fakeDeploymentConfig() in TestGetPVCNameFromVolumeMountName()

* Removes redeclared v1
2020-11-24 15:19:47 +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
Maysun J Faisal
c89c1ab1d7 Use volume components from the devfile (#3584)
* Volume components devfile

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Volume Component integration tests

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Vol Component Feedback 1

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Vol Component Feedback 2

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Vol Component Feedback 3

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Container component volMount & volume component dependency

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Fix rebased test

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Remove devfile v1 tests

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Update rebased tests

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
2020-07-24 13:55:50 +02: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
Maysun J Faisal
fd8416cc92 Devfile command execution (#2735)
* First pass of devfile exec

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Second pass of devfile exec

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Devfile exec - PR Feedback 1

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* First pass of devfile exec

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Second pass of devfile exec

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Devfile exec - PR Feedback 1

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Devfile exec unit tests 1

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Devfile exec unit tests 1

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Address review comments from pull/2735#pullrequestreview-383109487

* Fix up command validation error messages

Signed-off-by: Rajiv Senthilnathan <rajivsen@ca.ibm.com>

* Devfile exec - PR Feedback 2, Unit Tests, etc.

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Rebase cleanup for devfile exec

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Fix error format and validate command bug

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Update devfile integration tests for mandatory devrun

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Temporarily switch odo init image until prod image is updated

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

Co-authored-by: Rajiv Senthilnathan <rajivsen@ca.ibm.com>
2020-04-04 01:45:56 +02:00
John Collier
3a9981fa59 File sync for devfiles (#2681)
* Implement devfile syncing on odo push

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

* Add test for GetRemoteFilesMarkedForDeletion

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

* Properly retrieve sourcePath

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

* Don't push if not needed to

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

* Remove duplicate WaitAndGetPod

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

* Use odo volume constants

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

* Fix race condition (oops)

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

* Fix gosec errors

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

* Add namespace flag to odo push

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

* Implement integration tests for odo push

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

* Address review comments on tests

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

* Remove duplicated preferences lines

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

* Address review comments

* Implement KubernetesAdapter to store namespace passed in from CLI
* Move adapter push function into start function
* Move FilterIgnores into util package and write unit tests for it

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

* Fix unit test

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

* Address review comments

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

* Fix rebase

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

* Properly return error if sync fails

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

* Sync to `/projects/<projectName>` when needed

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

* Fix unit tests

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

* Remove debugging line

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

* Add more unit tests for functions in pushlocal

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

* Add comments

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

* Fix test on Windows

Signed-off-by: John Collier <John.J.Collier@ibm.com>
2020-03-12 19:49:22 -04:00
Maysun J Faisal
4852786c14 Add Volume Storage Adapter for Devfiles (#2651)
* Add Volume Storage Adapter for Devfiles

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Add tests for devfile storage adapter and utils

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Fix golint errors

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Apply Storage Adapter Feedback 1

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Apply Storage Adapter Feedback 2

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Apply Storage Adapter Feedback 3 - pvc owner ref

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Add Volume test for owner reference

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Apply Storage Adapter Feedback 4 - pvc own ref, kube res name, test

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
2020-03-11 11:46:45 -04:00
Rajiv Nathan
037490217b Create deployment based on Devfile (#2589)
* Create deployment based on Devfile

* GetAliasedComponents helper function and fix some log messages

* Refactor to make platform adapters more modular

* Generate a component name that satisfies DNS-1123 requirement due to deployment name

* Handle devfile updates

* Include devfile object in context

* New tests

* Fixes after rebase on master

Signed-off-by: Rajiv Senthilnathan <rajivsen@ca.ibm.com>

* Update to work with experimental devfile push

Signed-off-by: Rajiv Senthilnathan <rajivsen@ca.ibm.com>

* Fix console output and deployment strategy

Signed-off-by: Rajiv Senthilnathan <rajivsen@ca.ibm.com>

* Rename AdapterMetadata to AdapterContext + cleanup

Signed-off-by: Rajiv Senthilnathan <rajivsen@ca.ibm.com>

* Fix component start test

Signed-off-by: Rajiv Senthilnathan <rajivsen@ca.ibm.com>

* Address naming review comments

Signed-off-by: Rajiv Senthilnathan <rajivsen@ca.ibm.com>

* Fix test race condition

* Move utils to a more common location and fix Travis CI failures
2020-02-27 09:43:52 +01:00
Maysun J Faisal
8e6116abbe Add kclient functions for creating volumes (#2546)
* Changes to kclient for volumes

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Add test for kclient, volumes and generators

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Clean up code and add in common object meta

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Apply PR Feedback and move func to volumes

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Fix golint errors

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Add feedback for volumes test

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
2020-02-19 16:58:36 +01:00