* 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
* 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
* Refactors service catalog and discovery client code and moves them into the kclient package.
It also refactors the operator code.
* Renames ListClusterServiceVersion() to ListClusterServiceVersions()
* add Kubernetes namespace support
* fix project unit tests
* add project unit tests for Kubernetes
* fix race in unit test
* use Context as it encasulates both client and kclient
* initial work on adding AppName
* completed the implementation and tests
* resolved failing tests
* reverting an un-necessary change
* dryed the tests
* added test for having both devfile and s2i together
* uncommented some stuff
* skip s2i test on kuberenetes
* resolved charlie's comments
* addressed mrinal's comments
* resolved the panic
* use client and dc support for specific cases
* resolved final tests and odo list now worked for unpushed components
* resolved failing unit tests
* update the component adapter in other places
* resolved all comments
* removed the created context at the end of the test
* addressed tomas's comment
* resolved all comments
* updated all devfiles with proper name
* resolved rebase
* addressed a missed error and more validation in the tests
* use random cmpName for tests
* Fixes wait for project creation
* Fixes unit test
* Changes hardcoded string to corev1.NamespaceActive
* Removed Kcore package, added unit test and comments
* Uses helper.WaitForCmdOut to wait and get the desired output for project list
Adds the ability to list catalog services and output to json.
The format is as follows:
```json
{
"kind": "ServiceList",
"apiVersion": "odo.openshift.io/v1alpha1",
"metadata": {
"creationTimestamp": null
},
"items": [
{
"name": "cakephp-mysql-persistent",
"hidden": false,
"planList": [
"default"
]
},
]
}
```
* use more robust exists function
* checked the error status returned by project
* running only the two tests on travis
* added more error check and made tests better
* reversed the targetted run
* removed the comment
* added comment to GetProject
* Create ComponentSettings on `odo create` and apply on `odo push`
This PR does the following:
1. Create Component settings config as part of `odo create` using
the flags passed.
2. As part of `odo push`, if component does not exist:
i. Create it with config created in 1 above
ii. Push source code to created component and build and deploy it
Note: Push now creates project in config if non-existant
else
i. Apply config in local component config file
ii. Push source code to created component and build and deploy it
and update the type of component if config changed
3. Add `context` as a flag to `odo create` and `odo push` to indicate
directory that is expected to contain the component config file.
4. Deprecate application#set, get and create
5. Fixes UTs and e2e relevant to this PR and comments out un-relevant
tests(includign mainly those that are known to broken and expected
to fixed by subsequent issues labelled "new workflow")
e2e credits: amitkrout <amit.silicon2008@gmail.com>
fixes#1366#1372#1373
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix main and component e2e tests
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Resolved component creation without application
* removed DS store
* fixed component e2e tests
* Fix e2e tests
Commit credits: amitkrout <amit.silicon2008@gmail.com>
Signed-off-by: amitkrout <amit.silicon2008@gmail.com>
* Make project creation test wait for project to appear in list
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix more e2e tests
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @cdrage comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix login tests
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* commented out oc project -q to check if it resolves java e2e
* broke out the preferences and config
* resolved UTs
* resolved golangCI comments
* resolved some e2e tests
* resolved error message in tests
* Resolved codeclimate issue
* resolved the e2e_test failure
* resolved some comments on the PR
* renamed GlobalConfig to Preference
* made the logic of unset simpler
* reverted the test changed
* use log instead of fmt for output
* resolved e2e test
* use log.Info instead of log.Println
* Adding way to get around resolution of ~ with user.Current().
This is needed for getting UTs to run on OpenShift CI where
we login to build root as anyUID
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
* Adding CUSTOM_HOMEDIR to override resolution of user.Current
We can now skip user.Current by providing CUSTOM_HOMEDIR env
* Changing env to be set for test configs to GLOBALODOCONFIG
* Adding unit tests for configs
* Adding reference to CUSTOM_HOMEDIR to development.md
* Adding CUSTOM_HOMEDIR to config.go
* Fix#1400 : Adding prow style OWNERS files
This PR adds OWNERS files to enable prow to ping appropriate people
and decide whose PRs warrant automatic merge
Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
* Removing kadel from tests
* Fixed the problem of displaying wrong project as active after project delete.
The project delete function in pkg folder now returns the current set project along with the error if any. If no project is left to be set active, "" is returned.
* Fixed the test
Signed-off-by: mik-dass <mrinald7@gmail.com>
* Fixed the comments
Signed-off-by: mik-dass <mrinald7@gmail.com>
This PR does:
* Adds flags `project`, `application` and `component` flag to respective commands
* added `getProjectName` and `getAppName` reusable functions which looks for `project` or `application` flag first, if not provided then it gives current value by default.
* Provide comments to some of the exported functions
* Refactors the way we provide `namespace` value for methods in `occlient.go`.
(No method will accept namespace as a argument, whenever needed we will use `client.Namespace` value)
* Updated unit tests as per new refactoring
* Add random string generator util
This commit adds a genric utility(and UTs to test associated
functionality) to generate random names using:
1. a prefix
2. an optional suffix
and additionally checks if the generated name is already in use in:
3. passed existList.
The utility generates the name in the form of prefix-suffix but if
the same is already in use(present already in the passed existList),
a new unique(not in existList) name of the form prefix-suffix-(a-z){4}
will be attempted to be generated. Additionally, if suffix is not passed,
it attempts to generate a suffix using the MIT licensed vendored library
`github.com/Pallinder/go-randomdata` that can generate the random strings
as in: `https://github.com/Pallinder/go-randomdata/blob/master/README.md`
fixes#216
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Make app name non-mandatory for odo create app
This commit makes the `odo create app`command generate a
random name for the application if the user has not passed the
app name as `odo create app <app_name>`.
The random name involves the following parts:
1. configurable prefix with `app` as safe default
2. randomly generated suffix which if already used will be further
appended with a 4 character random string for duplicate resolution
fixes#216
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Add vendored package
fixes#216
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @snarwade and @syamgk comments
fixes#741
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Add UTs and e2e tests
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @mik-dass comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix travis errors
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate comments from @golangcibot
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix travis failures
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Random generate component names
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @cdrage comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Changes as per new suggestions by @jorgemoralespou
The new behaviour is as follows:
By default(in absence of prefix in config being overriden) app and component
names will be named after the directory from which `odo app create` and
`odo create` components are used along with a random 4 char length string as
unique suffix. However, if the prefix in config is overriden by user, the same
will be used instead of fetching any directory/path names along with the random
4 char length string unique suffix..
This is achieved as follows:
1. For component create, in absence of `prefix` being overriden by user in the
odo config:
a. If component is created from git, the git url's ending part which
is the repository name is used for app and compoennt names. For,
component name, additionally we use component type also.
case 1: Component creation in absence of an app
app name: ${repo_name}-${random_4_char_str}
component name: ${repo_name}-${component_type}-${random_4_char_str}
case 2: App exists already
component name: ${repo_name}-${component_type}-${random_4_char_str}
b. If component is created from local source, the last part of source path,
which is the source directory, is used for app and compoennt names. For,
component name, additionally we use component type also.
case 1: Component creation in absence of an app
app name: ${src_dir_name}-${random_4_char_str}
component name: ${src_dir_name}-${component_type}-${random_4_char_str}
case 2: App exists already
component name: ${src_dir_name}-${component_type}-${random_4_char_str}
c. If component is created from binary, the binary name excluding its extension
is used for app and compoennt names. For component name, additionally we use
component type also.
case 1: Component creation in absence of an app
app name: ${binary_name}-${random_4_char_str}
component name: ${binary_name}-${component_type}-${random_4_char_str}
case 2: App exists already
component name: ${binary_name}-${component_type}-${random_4_char_str}
2. For app create, in absence of `prefix` being overriden by user in the
odo config:
app name: ${current-dir}-${random_4_char_str}
3. For app create in case of prefix in config being overriden,
app name: ${prefix}-${random_4_char_str}
4. For component create, in case of a configured prefix,
app name: ${prefix}-${random_4_char_str}
component name: ${prefix}-${component_type}-${random_4_char_str}
fixes#216
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix tests as per latest changes
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Remove the no-more required vendored package go-randomdata
This is no longer required due to new changes
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @codeclimate and @golangcibot comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix travis failures
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @GolangCI comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @cdrage comments
This commit adds option to delete app(current app) if app name
is not passed for deletion.
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incorporate @snarwade comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Rebase
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @cdrage comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @mik-dass comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix travis failure
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incorporate @kadel comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incorporate @tkral comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @tkral comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Doc update
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix travis failures
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incorporate @cdrage comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Delete project enhancements + unit tests and e2e tests
This PR adds the following:
1. When a project is deleted, the delete project now displays also the
active project post deletion if there are more projects left post deletion
2. Adds UTs and e2e tests for project delete
3. Handles the case of project list with no projects with a proper message
indicating that there are no currently available projects and suggests the
command to create a project instead of displaying an empty table.
fixes#726#750
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Addess @codeclimate comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @cdrage and @snarwade comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @snarwade and @tkral comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix gofmt errors
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incoporate @codeclimate comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incorporate @cdrage comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix travis failures
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Incorporate @tkral comments
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Fix error msgs -- start them with small letters
Signed-off-by: anmolbabu <anmolbudugutta@gmail.com>
* Add support for odo app list --project name
Add e2e regarding the new command
Refactored list function to make code reusable
Use tabwriter to print everything
Fix typos
Fixes#206
* Adds function to set all applications inactive
Implemented a function to set all applications inactive
of the current project when switching to other project
Refactored the unset active component to be able to
use in project because we want to unset active component
also when switching to other project
Refactored delete component function because we want
to unset only if application name and current application
name are equal
* Fix typo
This commit renames the commands in project package to be more
consistent with the other packages.
- ListProjects() is now List()
- CreateProjects() is now Create()