mirror of
				https://github.com/redhat-developer/odo.git
				synced 2025-10-19 03:06:19 +03:00 
			
		
		
		
	 ec747b4ab3
			
		
	
	ec747b4ab3
	
	
	
		
			
			* Add integration tests highlighting our expectations * Bump Devfile library to latest commitf041d79870* 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 commit78868b03fd. 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>
		
			
				
	
	
		
			80 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package preference
 | |
| 
 | |
| import (
 | |
| 	"reflect"
 | |
| 
 | |
| 	"github.com/redhat-developer/odo/pkg/api"
 | |
| )
 | |
| 
 | |
| func (o *preferenceInfo) NewPreferenceList() api.PreferenceList {
 | |
| 	return api.PreferenceList{
 | |
| 		Items: toPreferenceItems(*o),
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func toPreferenceItems(prefInfo preferenceInfo) []api.PreferenceItem {
 | |
| 	settings := prefInfo.OdoSettings
 | |
| 	return []api.PreferenceItem{
 | |
| 		{
 | |
| 			Name:        UpdateNotificationSetting,
 | |
| 			Value:       settings.UpdateNotification,
 | |
| 			Default:     true,
 | |
| 			Type:        getType(prefInfo.GetUpdateNotification()), // use the Getter here to determine type
 | |
| 			Description: UpdateNotificationSettingDescription,
 | |
| 		},
 | |
| 		{
 | |
| 			Name:        TimeoutSetting,
 | |
| 			Value:       settings.Timeout,
 | |
| 			Default:     DefaultTimeout,
 | |
| 			Type:        getType(prefInfo.GetTimeout()),
 | |
| 			Description: TimeoutSettingDescription,
 | |
| 		},
 | |
| 		{
 | |
| 			Name:        PushTimeoutSetting,
 | |
| 			Value:       settings.PushTimeout,
 | |
| 			Default:     DefaultPushTimeout,
 | |
| 			Type:        getType(prefInfo.GetPushTimeout()),
 | |
| 			Description: PushTimeoutSettingDescription,
 | |
| 		},
 | |
| 		{
 | |
| 			Name:        RegistryCacheTimeSetting,
 | |
| 			Value:       settings.RegistryCacheTime,
 | |
| 			Default:     DefaultRegistryCacheTime,
 | |
| 			Type:        getType(prefInfo.GetRegistryCacheTime()),
 | |
| 			Description: RegistryCacheTimeSettingDescription,
 | |
| 		},
 | |
| 		{
 | |
| 			Name:        ConsentTelemetrySetting,
 | |
| 			Value:       settings.ConsentTelemetry,
 | |
| 			Default:     DefaultConsentTelemetrySetting,
 | |
| 			Type:        getType(prefInfo.GetConsentTelemetry()),
 | |
| 			Description: ConsentTelemetrySettingDescription,
 | |
| 		},
 | |
| 		{
 | |
| 			Name:        EphemeralSetting,
 | |
| 			Value:       settings.Ephemeral,
 | |
| 			Default:     DefaultEphemeralSetting,
 | |
| 			Type:        getType(prefInfo.GetEphemeral()),
 | |
| 			Description: EphemeralSettingDescription,
 | |
| 		},
 | |
| 		{
 | |
| 			Name:        ImageRegistrySetting,
 | |
| 			Value:       settings.ImageRegistry,
 | |
| 			Default:     "",
 | |
| 			Type:        getType(prefInfo.GetImageRegistry()),
 | |
| 			Description: ImageRegistrySettingDescription,
 | |
| 		},
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func getType(v interface{}) string {
 | |
| 
 | |
| 	rv := reflect.ValueOf(v)
 | |
| 
 | |
| 	if rv.Kind() == reflect.Ptr {
 | |
| 		return rv.Elem().Kind().String()
 | |
| 	}
 | |
| 
 | |
| 	return rv.Kind().String()
 | |
| }
 |