mirror of
				https://github.com/redhat-developer/odo.git
				synced 2025-10-19 03:06:19 +03:00 
			
		
		
		
	OCI-based devfile reigstry support patch (#4636)
* fix: starter project overriding issue Signed-off-by: jingfu wang <jingfwan@redhat.com> * fix: issues detected from test cases Signed-off-by: jingfu wang <jingfwan@redhat.com> * refactor: modify the patch Signed-off-by: jingfu wang <jingfwan@redhat.com> * fix: test cases issue Signed-off-by: jingfu wang <jingfwan@redhat.com>
This commit is contained in:
		| @@ -767,6 +767,7 @@ func (co *CreateOptions) s2iRun() (err error) { | ||||
| // Run has the logic to perform the required actions as part of command | ||||
| func (co *CreateOptions) devfileRun() (err error) { | ||||
| 	var devfileData []byte | ||||
| 	devfileExist := util.CheckPathExists(DevfilePath) | ||||
| 	// Use existing devfile directly from --devfile flag | ||||
| 	if co.devfileMetadata.devfilePath.value != "" { | ||||
| 		if co.devfileMetadata.devfilePath.protocol == "http(s)" { | ||||
| @@ -786,7 +787,7 @@ func (co *CreateOptions) devfileRun() (err error) { | ||||
| 			} | ||||
| 		} | ||||
| 	} else { | ||||
| 		if util.CheckPathExists(DevfilePath) { | ||||
| 		if devfileExist { | ||||
| 			// if local devfile already exists read that | ||||
| 			// odo create command was expected in a directory already containing devfile | ||||
| 			devfileData, err = ioutil.ReadFile(DevfilePath) | ||||
| @@ -853,12 +854,18 @@ func (co *CreateOptions) devfileRun() (err error) { | ||||
| 		return errors.Wrap(err, "failed to download project for devfile component") | ||||
| 	} | ||||
|  | ||||
| 	// save devfile | ||||
| 	// save devfile and corresponding resources if possible | ||||
| 	// use original devfileData to persist original formatting of the devfile file | ||||
| 	err = ioutil.WriteFile(DevfilePath, devfileData, 0644) // #nosec G306 | ||||
| 	if err != nil { | ||||
| 		return errors.Wrapf(err, "unable to save devfile to %s", DevfilePath) | ||||
| 	} | ||||
| 	if co.devfileMetadata.devfilePath.value == "" && !devfileExist && !strings.Contains(co.devfileMetadata.devfileRegistry.URL, "github") { | ||||
| 		err = registryLibrary.PullStackFromRegistry(co.devfileMetadata.devfileRegistry.URL, co.devfileMetadata.componentType, co.componentContext) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// Generate env file | ||||
| 	err = co.EnvSpecificInfo.SetComponentSettings(envinfo.ComponentSettings{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jingfu Wang
					Jingfu Wang