* Add test highlighting the expectations
* Propagate errors and call os.Exit only in 'main' functions
See ExitInMain[1] and ExitInMain_ExitOnce[2] coding convention guidelines.
[1] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-in-main
[2] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-once
* Handle errors returned by Cleanuper#Cleanup
This makes sure the exit code of the command
is mapped onto any error returned by Cleanup
* Do not return an error when the watch loop in 'odo dev' is interrupted
* Test that the exit code of 'odo dev' matches the error returned by the cleanup logic
* Add integration tests highlighting our expectations
* Bump Devfile library to latest commit
f041d79870
* Expose preference that allows users to globally configure an image registry
* Return the effective Devfile view by default from the initial context
This is supposed to be read-only, so that tools can rely on it
and to the operations they need to perform right away.
Raw Devfile objects can still be obtained upon request
if there is need to update them (for example via 'odo add/remove
binding' commands.
* Pass the image registry preference to the Devfile parser to build the effective view
* Fix 'odo init' integration tests
- The test spec was actually not doing what it was supposed to do
- Now 'odo init' returns a complete Devfile, where the parent is flattened,
because the goal of 'odo init' is to bootstrap a Devfile.
Previously, 'odo init' would not download the parent referenced,
making it hard to understand the resulting Devfile.
* Document how odo now handles relative image names as selectors
* fixup! Document how odo now handles relative image names as selectors
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Revert "Fix 'odo init' integration tests"
This reverts commit 78868b03fd.
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Do not make `odo init` return an effective Devfile as a result
This would change the behavior of `odo init`.
Furthermore, due to an issue [1] in the Devfile library,
it is not possible to parse some Devfiles with parents linked as GitHub URLs (like GitHub release artifacts).
[1] https://github.com/devfile/api/issues/1119
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* fixup! Document how odo now handles relative image names as selectors
---------
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Add kubeclient as dependency of the registry client
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Add GetRegistryList method to the kube client interface
This is yet to be implemented.
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Implement GetRegistryList
* adding test if devfileRegistryListCR is present in cluster
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* Unit tests (to be continued)
* Add unit test cases against kclient#GetRegistryList()
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Ignore in-cluster registries with an empty URL
This should ideally not happen if the registry operator
is installed in the cluster (because it validates the
URL to make sure it is reachable), but you never know ;-)
* Update error message when trying to remove registry
Registries might be found in the cluster.
* Pass isSecure value to the registry handler
* Make it possible to use in-cluster registries when calling 'odo registry --details'
* Remove unused 'preferenceClient' from registry.getRegistryStacks
* Handle in-cluster registries in 'odo init' non-interactive mode
* Handle in-cluster registries in 'odo init' interactive mode
* Add integration test for odo init --devfile-registry
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use proxy when available
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
* Make sure tests work even if the registry operator is installed in the cluster or if there are cluster-wide registry lists
* Add tests for 'odo init' interactive mode
* Remove useless CR file
CRs are now dynamically created and applied from the tests
* fixup! Add tests for 'odo init' interactive mode
---------
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Co-authored-by: anandrkskd <anandrkskd@gmail.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Set Go version in go.mod
go mod edit -go=1.19
* Fix formatting issues reported by gofmt
* Fix SA1019 check (usage of deprecated "io/ioutil"), reported by golangci-lint
SA1019: "io/ioutil" has been deprecated since Go 1.16:
As of Go 1.16, the same functionality is now provided by package io or package os,
and those implementations should be preferred in new code.
See the specific function documentation for details. (staticcheck)
* Use Go 1.19 in our Dockerfiles
* Use Go 1.19 in the rpm-prepare.sh script
* Update the tag for the IBM Cloud CI image
* Update the Devfile library
* Add test for container-overrides and pod-overrides attributes
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Attempt at fixing CI failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix CI failure
* Attempt at fixing OC integration test failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use random name in integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Rebase and fix integration test failure
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Make integration test work for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Temp attempt at fixing podman test for GH
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Another attempt at fixing CI test for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* One more attempt at fixing integration test for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Define central config
* Use envConfig in GenericRun for segment parameters
* Pass the env config into the context passed to CLI methods
* Use PodmanCmd and DockerCmd from context
* Remove tests now that ODO_DISABLE_TELEMETRY is checked for a bool value
* deploy.Deploy: Use values from ctx instead of parameters + use FS from DI
* dev.Start: Use values from ctx instead of parameters
* image.Build*: Use values from ctx instead of parameters
* Use telemetry file from context
* Pass ctx to segment.getTelemetryForDevfileRegistry
* Use ctx in getTelemetryForDevfileRegistry
* Call IsTelemetryEnabled once and use scontext.GetTelemetryStatus after
* Fix unit tests
* Use envConfig in segment.IsTelemetryEnabled
* Define TelemetryCaller constant in test helper
* IsTrackingConsentEnabled: get value from envconfig instead of env
* Use ctx instead of GLOBALODOCONFIG
* Place ODO_EXPERIMENTAL_MODE in configuration
* Use maintained envconfig package
* Define default values when exist
* Document accepted boolean values
* fix to prioritize newly added registry
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* update RegistryList func to reverse the list and return []Registry
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* update the usage of RegistryList
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* update unit test and mock
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* fix: lint error and check for empty registry list
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* add documentation
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* resolve inconsistent order of registries in preference view
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* reverse regList on business layer
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* update unit test, add functional test and small refactor
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* update functional tests to use proxy
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.
Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* Set Kind in servicebinding instead or Resource
* odo add binding without Devfile
* Force select at least one operation option
* Change message for selecting operations
* Add Go back when selecting resource name for waorkload
* Doc
* Enable interactive binding tests for Kubernetes
* Add integration tests
* Validate and Test workload flag
* Fix doc about workload flag
* Apply suggestions from code review
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Review
* Fix interactive test
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* 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>
* 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
* 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>
<!--
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:**
This PR does the following:
- Moves "registry" to preference
- Gets rid of unused preference configuration options
- Reorders the parameters for preference for the usage in --help
**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->
https://github.com/redhat-developer/odo/issues/5402
**PR acceptance criteria:**
- [X] Unit test
- [X] Integration test
- [X] Documentation
**How to test changes / Special notes to the reviewer:**
* 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
* Add documentation for global configuration
* Cosmetic changes, add a few notes
* Add more clarification to docs and fix Ephemeral default value
* Add tabs for location example and add other examples
* Fix file paths and add requested changes
* Change the username in example file path.
Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
* Fix unsetting preference statement.
Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
Co-authored-by: Dharmit Shah <shahdharmit@gmail.com>
* 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>
* 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>
* Change default value for ephemral preference
For not it assumes default value for ephemeral 'false'.
It future releases we might change it 'true'. But for now we should
play it safe and keep the old behaviour. We are not sure about all the
consequences that this can have.
* fix failing test due to incorrect pvc count
* Implement source storage as pvc
add label for source pvc, to filter out from storage list
* Add "ephermeral" option in preference.yaml
* Add test and update preference settings
* Fix ephemeral spelling
* fix integration test
ignore lost+found
* Capitalize ephemeral
* Fix Preference issues
* Add default registry when preferences initialized
Signed-off-by: John Collier <John.J.Collier@ibm.com>
* Make Devfile the default deployment mechanism for odo
**What type of PR is this?**
> Uncomment only one ` /kind` line, and delete the rest.
> For example, `> /kind bug` would simply become: `/kind bug`
/kind feature
**What does does this PR do / why we need it**:
Makes Devfile the default deployment mechanism, removing S2I in favour
of Devfile deployment.
**Which issue(s) this PR fixes**:
Closes https://github.com/openshift/odo/issues/3550
**How to test changes / Special notes to the reviewer**:
Run:
```sh
odo preference set experimental false
odo create --starter nodejs
odo push
```
* Review round 1
* Pass testing
* Pass testing
* Remove failing devfile test since this test does not run against openshift testing suite
* Temporarily disable OperatorHub tests
Co-authored-by: John Collier <John.J.Collier@ibm.com>
* add feature complete odo set and unset
* added json output
* added json output for odo config
* resolved golint
* addressed some comments
* separated out devfile and s2i run sections
* Add example and descriptions
* some spacing
* added integration tests
* only odo injected ports can be managed
* typo resolved and DRYed the config tests
* updated desc and use dns friendly component name
* add devfile config tests to travis
* resolved the panic
* format the help for all config flows
* now a user can remove all ports
* resolved failing tests
* added the format test back
* not pushing in intg test
* added unit tests for devfile config
* unique portname for different protocol
* removed a comment
* 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
* refactor: remove redundant information
* refactor: remove API check as it's implied when retrieving schema
* refactor: simplify type check
* fix: typo
* refactor: introduce getStringOrEmpty function
* refactor: extract Get*OrDefault functions and use them where appropriate
* 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>