Skip to content

Commit

Permalink
Add error message for git components
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditi Sharma committed Jul 13, 2020
1 parent 361a922 commit 4ea1743
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 3 additions & 1 deletion pkg/occlient/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ func IsDCRolledOut(config *appsv1.DeploymentConfig, desiredRevision int64) bool
func GetS2IEnvForDevfile(sourceType string, env config.EnvVarList, imageStreamImage imagev1.ImageStreamImage) (config.EnvVarList, error) {

s2iPaths, err := GetS2IMetaInfoFromBuilderImg(&imageStreamImage)

if err != nil {
return nil, err
}

inputEnvs, err := GetInputEnvVarsFromStrings(env.ToStringSlice())
if err != nil {
return nil, err
}
// Append s2i related parameters extracted above to env
inputEnvs = injectS2IPaths(inputEnvs, s2iPaths)

Expand Down
16 changes: 7 additions & 9 deletions pkg/odo/cli/utils/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func NewMigrateOptions() *MigrateOptions {
func (mo *MigrateOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {

if !util.CheckPathExists(component.ConfigFilePath) {
return errors.New("This directory does not contain an odo s2i component, Please run the command from odo component directory to migrate s2i component to devfile")
return errors.New("this directory does not contain an odo s2i component, Please run the command from odo component directory to migrate s2i component to devfile")
}

mo.context = genericclioptions.NewContext(cmd)
Expand All @@ -79,6 +79,9 @@ func (mo *MigrateOptions) Complete(name string, cmd *cobra.Command, args []strin

// Validate validates the MigrateOptions based on completed values
func (mo *MigrateOptions) Validate() (err error) {
if mo.context.LocalConfigInfo.GetSourceType() == config.GIT {
return errors.New("migration of git type s2i components to devfile not supported by odo")
}

return nil
}
Expand All @@ -89,7 +92,7 @@ func (mo *MigrateOptions) Run() (err error) {
/* This data is yet to be converted
// git url or local source code location
sourceLocation := context.LocalConfigInfo.GetSourceLocation()
// Absolute path
sourcePath, _ := context.LocalConfigInfo.GetOSSourcePath()
minMemory := context.LocalConfigInfo.GetMinMemory()
Expand Down Expand Up @@ -167,8 +170,7 @@ func generateDevfileYaml(m *MigrateOptions) error {
Data: s2iDevfile,
}

devObj.WriteYamlDevfile()
return nil
return devObj.WriteYamlDevfile()

}

Expand Down Expand Up @@ -200,8 +202,6 @@ func generateEnvYaml(m *MigrateOptions) (err error) {

urlList = append(urlList, urlEnv)

m.context.EnvSpecificInfo.SetConfiguration("url", urlEnv)

}

componentSettings := envinfo.ComponentSettings{
Expand All @@ -214,9 +214,7 @@ func generateEnvYaml(m *MigrateOptions) (err error) {
componentSettings.DebugPort = &debugPort
}

m.context.EnvSpecificInfo.SetComponentSettings(componentSettings)

return nil
return m.context.EnvSpecificInfo.SetComponentSettings(componentSettings)
}

func getImageforDevfile(client *occlient.Client, componentType string) (*imagev1.ImageStreamImage, string, error) {
Expand Down

0 comments on commit 4ea1743

Please sign in to comment.