* Display the supported architectures in `odo registry` output
* Allow filtering by architectures
* Update documentation accordingly
* Add test cases
* fixup! Update documentation accordingly
* fixup! Allow filtering by architectures
Devfiles with no architecture declared are supposed to be compatible
with all known architectures.
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* fixup! Add test cases
---------
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Add integration tests highlighting the expectations
* Add and fill a 'Commands' field from the DevfileData struct returned by `describe`
* Display commands in the human-readable output of 'odo describe'
* Add documentation and sample outputs
* Add unit test highliging the issue
* Fix 'delete' unit tests
* Pass the filesystem object where it is relevant
* Add a way for CLI commands to indicate whether of not they require a valid Devfile
For the 'analyze' command, this is not required,
so Devfile parsing will be ignored completely.
* Make the fake filesystem return an absolute current dir
Otherwise, some code will assume it is relative,
and try to prepend the current physical directory
* 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>
* Do not use deprecated DefaultStarterProjects
* Fix integration tests
* Use CommandGroups from registry index
* Fix JSON field name / Detailed err message
* Clarify --details is to be used with --devfile
* Document versions.commandGroups in json output
* 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>
* Ask for stack version in the interactive mode; downloading still doesn't work as expected
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Download the versioned Devfile for interactive mode
* Download the versioned Devfile for flag mode
* Download the versioned Devfile for the alizer mode
* Add support for 'latest' stack
* Update init automation message with devfile-version
* Mark the default version in interactive mode
* Fix interactive tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add integration tests for odo init flag mode
* Fix unit and validation tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add to the documentation
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add information about the default version
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Make the registry client collect and return all stack versions
* Call the '/v2index' endpoint first and fallback to the index endpoint when listing Stack versions
* Display the Stack versions in the 'odo registry' human-readable output
* For convenience, sort stack versions based on the semantic version
This allows seeing them in a meaningful order in both
human-readable and JSON outputs.
* Enrich unit tests for 'getRegistryStacks'
* Fill the "starterProjects" field for backward compatibility
Similar to the "version" field, this represents
the list of starter projects of the default Stack version.
* Update integration tests
* Update documentation
* 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>
* Move 'starter_project.go' from 'pkg/component' to 'pkg/registry'
Functions in this file are only called from the 'registry' package,
so it makes sense for this file to belong to this package.
Furthermore, this paves the way to calling 'alizer.DetectName' from 'component.go',
thus avoiding a cyclic dependency between packages.
* Introduce central logic for determining component names in 'pkg/component/component.go'
This rewrites the 'component#GatherName' function that was already there,
but not used, to meet the expectations, i.e.:
- use 'metadata.name' field (after sanitizing it) if it is defined in the Devfile
- otherwise, use Alizer to detect the name. Under the hood, this leverages the 'alizer#DetectName' introduced in 83ad3ee, which means that:
-- use Alizer to detect the name automatically
-- otherwise, use the name of the Devfile base directory after sanitizing it
* Compute and store the component name in the CLI context, and pass it as needed
As commented out in [1], the context should ideally be built
and passed down to the business clients structs.
[1] https://github.com/redhat-developer/odo/pull/6015#discussion_r957005479
* Enrich relevant integration test cases
For the sake of both performance and readability,
only the tests that break in the absence of a 'metadata.name'
field in their Devfiles have been updated (to test this specific case).
* Add test case for 'odo dev' when a project with no source code is used with no 'metadata.name' in the Devfile
The rationale behind this is to purposely make
the Alizer library unable to detect the project.
Per the requirements, this would force us to use the project
directory name as component name.
This highlights an interesting behavior if the project
directory name is all-numeric (as is the case in our tests);
our sanitization logic automatically prepends an "x" prefix
to the directory name, so it can be used as a valid name
for the component.
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>
* Doc odo registry
* JSON output
* Move structure for JSON output to api package
* Doc for json output
* Add integration tests
* Review
* Do not rely on devfile version for tests as it is too unstable
* Adds odo registry command
<!--
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:**
This adds the `odo registry` command, to output the details of what's
in the registry.
It also implements the flags:
- `--filter`
- `--devfile`
- `--details`
This can be tested by typing in the `odo registry` command after adding
a registry (you should already have one by default)
**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->
Fixes https://github.com/redhat-developer/odo/issues/5524
**PR acceptance criteria:**
- [X] Unit test
- [X] Integration test
- [X] Documentation
**How to test changes / Special notes to the reviewer:**
`odo registry`
* Update based on review
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
* List based on registry
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
* Update tests + improve based on comments
* Move function down to business layer, fix tests
* Add business layer logic for sorting
* remove odo catalog command
- move devfile registry relevant code to pkg/registry
* remove odo catalog page form docs
* remove a few forgotten uses of catalog from clientset.go
* fix typos in docs