mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* 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>
43 lines
2.2 KiB
Go
43 lines
2.2 KiB
Go
// Package init provides methods to initiate an odo project.
|
|
// Most of the methods of the package get a `flags` parameter
|
|
// representing the flags passed from the user through the command line.
|
|
// Several backends are available to complete the operations, the backend
|
|
// being chosen depending on the flags content:
|
|
// - if no flags are passed, the `interactive` backend will be used
|
|
// - if some flags are passed, the `flags` backend will be used.
|
|
package init
|
|
|
|
import (
|
|
"github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
|
|
"github.com/devfile/library/pkg/devfile/parser"
|
|
|
|
"github.com/redhat-developer/odo/pkg/init/backend"
|
|
"github.com/redhat-developer/odo/pkg/testingutil/filesystem"
|
|
)
|
|
|
|
type Client interface {
|
|
// Validate checks for each backend if flags are valid
|
|
Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error
|
|
|
|
// SelectDevfile returns information about a devfile selected based on Alizer if the directory content,
|
|
// or based on the flags if the directory is empty, or
|
|
// interactively if flags is empty
|
|
SelectDevfile(flags map[string]string, fs filesystem.Filesystem, dir string) (*backend.DevfileLocation, error)
|
|
|
|
// DownloadDevfile downloads a devfile given its location information and a destination directory
|
|
// and returns the path of the downloaded file
|
|
DownloadDevfile(devfileLocation *backend.DevfileLocation, destDir string) (string, error)
|
|
|
|
// SelectStarterProject selects a starter project from the devfile and returns information about the starter project,
|
|
// depending on the flags. If not starter project is selected, a nil starter is returned
|
|
SelectStarterProject(devfile parser.DevfileObj, flags map[string]string, fs filesystem.Filesystem, dir string) (*v1alpha2.StarterProject, error)
|
|
|
|
// DownloadStarterProject downloads the starter project referenced in devfile and stores it in dest directory
|
|
// WARNING: This will first remove all the content of dest.
|
|
DownloadStarterProject(project *v1alpha2.StarterProject, dest string) error
|
|
|
|
// PersonalizeName updates a devfile name, depending on the flags.
|
|
// The method will modify the devfile content and save the devfile on disk
|
|
PersonalizeName(devfile parser.DevfileObj, flags map[string]string) error
|
|
}
|