diff --git a/pkg/component/component.go b/pkg/component/component.go index e24110614b4..8d43f750902 100644 --- a/pkg/component/component.go +++ b/pkg/component/component.go @@ -24,7 +24,6 @@ import ( "github.com/openshift/odo/pkg/config" "github.com/openshift/odo/pkg/log" "github.com/openshift/odo/pkg/occlient" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/odo/util/validation" "github.com/openshift/odo/pkg/preference" "github.com/openshift/odo/pkg/storage" @@ -563,10 +562,10 @@ func ensureAndLogProperResourceUsage(resourceMin, resourceMax *string, resourceN // componentConfig: Component configuration // envSpecificInfo: Component environment specific information, available if uses devfile // cmpExist: true if components exists in the cluster +// isS2I: Legacy option. Set as true if you want to use the old S2I method as it differentiates slightly. // Returns: // err: Errors if any else nil -func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConfig config.LocalConfigInfo, envSpecificInfo envinfo.EnvSpecificInfo, stdout io.Writer, cmpExist bool) (err error) { - isExperimentalModeEnabled := experimental.IsExperimentalModeEnabled() +func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConfig config.LocalConfigInfo, envSpecificInfo envinfo.EnvSpecificInfo, stdout io.Writer, cmpExist bool, isS2I bool) (err error) { if client == nil { var err error @@ -577,7 +576,7 @@ func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConf client.Namespace = envSpecificInfo.GetNamespace() } - if !isExperimentalModeEnabled { + if isS2I { // if component exist then only call the update function if cmpExist { if err = Update(client, componentConfig, componentConfig.GetSourceLocation(), stdout); err != nil { @@ -588,7 +587,7 @@ func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConf var componentName string var applicationName string - if !isExperimentalModeEnabled || kClient == nil { + if isS2I || kClient == nil { componentName = componentConfig.GetName() applicationName = componentConfig.GetApplication() } else { @@ -602,12 +601,12 @@ func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConf } return urlpkg.Push(client, kClient, urlpkg.PushParameters{ - ComponentName: componentName, - ApplicationName: applicationName, - ConfigURLs: componentConfig.GetURL(), - EnvURLS: envSpecificInfo.GetURL(), - IsRouteSupported: isRouteSupported, - IsExperimentalModeEnabled: isExperimentalModeEnabled, + ComponentName: componentName, + ApplicationName: applicationName, + ConfigURLs: componentConfig.GetURL(), + EnvURLS: envSpecificInfo.GetURL(), + IsRouteSupported: isRouteSupported, + IsS2I: isS2I, }) } diff --git a/pkg/component/component_full_description.go b/pkg/component/component_full_description.go index 8b92dfd725a..829172e53b1 100644 --- a/pkg/component/component_full_description.go +++ b/pkg/component/component_full_description.go @@ -8,7 +8,6 @@ import ( "github.com/openshift/odo/pkg/config" "github.com/openshift/odo/pkg/log" "github.com/openshift/odo/pkg/occlient" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/storage" urlpkg "github.com/openshift/odo/pkg/url" corev1 "k8s.io/api/core/v1" @@ -190,22 +189,22 @@ func (cfd *ComponentFullDescription) Print(client *occlient.Client) error { if len(cfd.Spec.URL.Items) > 0 { var output string - if !experimental.IsExperimentalModeEnabled() { - // if the component is not pushed - for i, componentURL := range cfd.Spec.URL.Items { - if componentURL.Status.State == urlpkg.StateTypePushed { - output += fmt.Sprintf(" · %v exposed via %v\n", urlpkg.GetURLString(componentURL.Spec.Protocol, componentURL.Spec.Host, "", experimental.IsExperimentalModeEnabled()), componentURL.Spec.Port) + // For S2I Only.. + // This MUST be changed before merging (this will automatically show URL routes for S2I despite Devfile being default) + for i, componentURL := range cfd.Spec.URL.Items { + if componentURL.Status.State == urlpkg.StateTypePushed { + output += fmt.Sprintf(" · %v exposed via %v\n", urlpkg.GetURLString(componentURL.Spec.Protocol, componentURL.Spec.Host, "", true), componentURL.Spec.Port) + } else { + var p string + if i >= len(cfd.Spec.Ports) { + p = cfd.Spec.Ports[len(cfd.Spec.Ports)-1] } else { - var p string - if i >= len(cfd.Spec.Ports) { - p = cfd.Spec.Ports[len(cfd.Spec.Ports)-1] - } else { - p = cfd.Spec.Ports[i] - } - output += fmt.Sprintf(" · URL named %s will be exposed via %v\n", componentURL.Name, p) + p = cfd.Spec.Ports[i] } + output += fmt.Sprintf(" · URL named %s will be exposed via %v\n", componentURL.Name, p) } } + // Cut off the last newline and output if len(output) > 0 { output = output[:len(output)-1] diff --git a/pkg/debug/portforward.go b/pkg/debug/portforward.go index e76fc37addb..3c20d558569 100644 --- a/pkg/debug/portforward.go +++ b/pkg/debug/portforward.go @@ -41,12 +41,12 @@ func NewDefaultPortForwarder(componentName, appName string, projectName string, // portPair is a pair of port in format "localPort:RemotePort" that is to be forwarded // stop Chan is used to stop port forwarding // ready Chan is used to signal failure to the channel receiver -func (f *DefaultPortForwarder) ForwardPorts(portPair string, stopChan, readyChan chan struct{}, isExperimental bool) error { +func (f *DefaultPortForwarder) ForwardPorts(portPair string, stopChan, readyChan chan struct{}, isDevfile bool) error { var pod *corev1.Pod var conf *rest.Config var err error - if f.kClient != nil && isExperimental { + if f.kClient != nil && isDevfile { conf, err = f.kClient.KubeConfig.ClientConfig() if err != nil { return err @@ -78,7 +78,7 @@ func (f *DefaultPortForwarder) ForwardPorts(portPair string, stopChan, readyChan } var req *rest.Request - if f.kClient != nil && isExperimental { + if f.kClient != nil && isDevfile { req = f.kClient.GeneratePortForwardReq(pod.Name) } else { req = f.client.BuildPortForwardReq(pod.Name) diff --git a/pkg/devfile/adapters/kubernetes/component/adapter.go b/pkg/devfile/adapters/kubernetes/component/adapter.go index b4dc98ad8c8..af72ff9d378 100644 --- a/pkg/devfile/adapters/kubernetes/component/adapter.go +++ b/pkg/devfile/adapters/kubernetes/component/adapter.go @@ -152,7 +152,7 @@ func (a Adapter) Push(parameters common.PushParameters) (err error) { return errors.Wrapf(err, "unable to get pod for component %s", a.ComponentName) } - err = component.ApplyConfig(nil, &a.Client, config.LocalConfigInfo{}, parameters.EnvSpecificInfo, color.Output, componentExists) + err = component.ApplyConfig(nil, &a.Client, config.LocalConfigInfo{}, parameters.EnvSpecificInfo, color.Output, componentExists, false) if err != nil { odoutil.LogErrorAndExit(err, "Failed to update config to component deployed.") } diff --git a/pkg/devfile/validate/components_test.go b/pkg/devfile/validate/components_test.go index 539a01a4367..b26e5704903 100644 --- a/pkg/devfile/validate/components_test.go +++ b/pkg/devfile/validate/components_test.go @@ -126,7 +126,7 @@ func TestValidateComponents(t *testing.T) { got := validateComponents(components) want := "size randomgarbage for volume component myvol is invalid" - if !strings.Contains(got.Error(), want) { + if got != nil && !strings.Contains(got.Error(), want) { t.Errorf("TestValidateComponents error - got: '%v', want substring: '%v'", got.Error(), want) } }) diff --git a/pkg/occlient/occlient.go b/pkg/occlient/occlient.go index ed6102523c6..bd99b5af2ab 100644 --- a/pkg/occlient/occlient.go +++ b/pkg/occlient/occlient.go @@ -22,7 +22,6 @@ import ( "github.com/openshift/odo/pkg/config" "github.com/openshift/odo/pkg/devfile/adapters/common" "github.com/openshift/odo/pkg/log" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/preference" "github.com/openshift/odo/pkg/util" @@ -719,11 +718,7 @@ func (c *Client) GetImageStream(imageNS string, imageName string, imageTag strin } } if e != nil && err != nil { - // Imagestream not found in openshift and current namespaces - if experimental.IsExperimentalModeEnabled() { - return nil, fmt.Errorf("component type %q not found", imageName) - } - return nil, err + return nil, fmt.Errorf("component type %q not found", imageName) } // Required tag not in openshift and current namespaces diff --git a/pkg/odo/cli/cli.go b/pkg/odo/cli/cli.go index 9dbea1893c8..c35ed0a3bcf 100644 --- a/pkg/odo/cli/cli.go +++ b/pkg/odo/cli/cli.go @@ -24,7 +24,6 @@ import ( "github.com/openshift/odo/pkg/odo/cli/version" "github.com/openshift/odo/pkg/odo/util" odoutil "github.com/openshift/odo/pkg/odo/util" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -205,12 +204,10 @@ func odoRootCmd(name, fullName string) *cobra.Command { debug.NewCmdDebug(debug.RecommendedCommandName, util.GetFullName(fullName, debug.RecommendedCommandName)), ) - if experimental.IsExperimentalModeEnabled() { - rootCmd.AddCommand( - registry.NewCmdRegistry(registry.RecommendedCommandName, util.GetFullName(fullName, registry.RecommendedCommandName)), - component.NewCmdTest(component.TestRecommendedCommandName, util.GetFullName(fullName, component.TestRecommendedCommandName)), - ) - } + rootCmd.AddCommand( + registry.NewCmdRegistry(registry.RecommendedCommandName, util.GetFullName(fullName, registry.RecommendedCommandName)), + component.NewCmdTest(component.TestRecommendedCommandName, util.GetFullName(fullName, component.TestRecommendedCommandName)), + ) odoutil.VisitCommands(rootCmd, reconfigureCmdWithSubcmd) diff --git a/pkg/odo/cli/component/common_link.go b/pkg/odo/cli/component/common_link.go index fef37ce49df..d450622e528 100644 --- a/pkg/odo/cli/component/common_link.go +++ b/pkg/odo/cli/component/common_link.go @@ -12,7 +12,6 @@ import ( "github.com/openshift/odo/pkg/log" "github.com/openshift/odo/pkg/occlient" "github.com/openshift/odo/pkg/odo/genericclioptions" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/secret" svc "github.com/openshift/odo/pkg/service" "github.com/openshift/odo/pkg/util" @@ -38,6 +37,8 @@ type commonLinkOptions struct { secretName string isTargetAService bool + devfilePath string + suppliedName string operation func(secretName, componentName, applicationName string) error operationName string @@ -55,12 +56,13 @@ func newCommonLinkOptions() *commonLinkOptions { // Complete completes LinkOptions after they've been created func (o *commonLinkOptions) complete(name string, cmd *cobra.Command, args []string) (err error) { + o.operationName = name suppliedName := args[0] o.suppliedName = suppliedName - if experimental.IsExperimentalModeEnabled() { + if util.CheckPathExists(o.devfilePath) { o.Context = genericclioptions.NewDevfileContext(cmd) oclient, err := occlient.New() @@ -161,7 +163,7 @@ func (o *commonLinkOptions) complete(name string, cmd *cobra.Command, args []str func (o *commonLinkOptions) validate(wait bool) (err error) { - if experimental.IsExperimentalModeEnabled() { + if util.CheckPathExists(o.devfilePath) { // let's validate if the service exists svcFullName := strings.Join([]string{o.serviceType, o.serviceName}, "/") svcExists, err := svc.OperatorSvcExists(o.KClient, svcFullName) @@ -227,7 +229,8 @@ func (o *commonLinkOptions) validate(wait bool) (err error) { } func (o *commonLinkOptions) run() (err error) { - if experimental.IsExperimentalModeEnabled() { + + if util.CheckPathExists(o.devfilePath) { // convert service binding request into a ma[string]interface{} type so // as to use it with dynamic client sbrMap := make(map[string]interface{}) diff --git a/pkg/odo/cli/component/common_push.go b/pkg/odo/cli/component/common_push.go index da16c7e8340..1f57148f30e 100644 --- a/pkg/odo/cli/component/common_push.go +++ b/pkg/odo/cli/component/common_push.go @@ -127,7 +127,7 @@ func (cpo *CommonPushOptions) createCmpIfNotExistsAndApplyCmpConfig(stdout io.Wr } } // Apply config - err := component.ApplyConfig(cpo.Context.Client, nil, *cpo.LocalConfigInfo, envinfo.EnvSpecificInfo{}, stdout, cpo.doesComponentExist) + err := component.ApplyConfig(cpo.Context.Client, nil, *cpo.LocalConfigInfo, envinfo.EnvSpecificInfo{}, stdout, cpo.doesComponentExist, true) if err != nil { odoutil.LogErrorAndExit(err, "Failed to update config to component deployed.") } diff --git a/pkg/odo/cli/component/component.go b/pkg/odo/cli/component/component.go index 763a7a8d559..844dcbdf912 100644 --- a/pkg/odo/cli/component/component.go +++ b/pkg/odo/cli/component/component.go @@ -73,6 +73,8 @@ func NewCmdComponent(name, fullName string) *cobra.Command { componentCmd.Flags().AddFlagSet(componentGetCmd.Flags()) componentCmd.AddCommand(componentGetCmd, createCmd, deleteCmd, describeCmd, linkCmd, unlinkCmd, listCmd, logCmd, pushCmd, updateCmd, watchCmd, execCmd) + + // Experimental feature to be added, "odo test" command. if experimental.IsExperimentalModeEnabled() { componentCmd.AddCommand(testCmd) } diff --git a/pkg/odo/cli/component/create.go b/pkg/odo/cli/component/create.go index dff7e93ba71..aede7813606 100644 --- a/pkg/odo/cli/component/create.go +++ b/pkg/odo/cli/component/create.go @@ -30,7 +30,6 @@ import ( "github.com/openshift/odo/pkg/odo/genericclioptions" odoutil "github.com/openshift/odo/pkg/odo/util" "github.com/openshift/odo/pkg/odo/util/completion" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/odo/util/pushtarget" "github.com/openshift/odo/pkg/preference" "github.com/openshift/odo/pkg/util" @@ -82,24 +81,12 @@ const CreateRecommendedCommandName = "create" // since the application will always be in the same directory as `.odo`, we will always set this as: ./ const LocalDirectoryDefaultLocation = "./" -// Constants for devfile component -const ( - devFile = "devfile.yaml" -) - var ( envFile = filepath.Join(".odo", "env", "env.yaml") configFile = filepath.Join(".odo", "config.yaml") envDir = filepath.Join(".odo", "env") ) -// DevfilePath is the devfile path that is used by odo, -// which means odo can: -// 1. Directly use the devfile in DevfilePath -// 2. Download devfile from registry to DevfilePath then use the devfile in DevfilePath -// 3. Copy user's own devfile (path is specified via --devfile flag) to DevfilePath then use the devfile in DevfilePath -var DevfilePath = filepath.Join(LocalDirectoryDefaultLocation, devFile) - // EnvFilePath is the path of env file for devfile component var EnvFilePath = filepath.Join(LocalDirectoryDefaultLocation, envFile) @@ -311,7 +298,7 @@ func (co *CreateOptions) checkConflictingFlags() (err error) { func (co *CreateOptions) checkConflictingS2IFlags() error { if !co.forceS2i { - errorString := "flag --%s, requires --s2i flag to be set, when in experimental mode." + errorString := "flag --%s, requires --s2i flag to be set, when deploying S2I (Source-to-Image)." var flagName string if co.now { @@ -360,9 +347,8 @@ func (co *CreateOptions) Complete(name string, cmd *cobra.Command, args []string // this populates the LocalConfigInfo as well co.Context = genericclioptions.NewContextCreatingAppIfNeeded(cmd) - if experimental.IsExperimentalModeEnabled() { - // Add a disclaimer that we are in *experimental mode* - log.Experimental("Experimental mode is enabled, use at your own risk") + // If not using --s2i + if !co.forceS2i { err = co.checkConflictingFlags() if err != nil { @@ -842,29 +828,27 @@ func (co *CreateOptions) Complete(name string, cmd *cobra.Command, args []string // Validate validates the create parameters func (co *CreateOptions) Validate() (err error) { - if experimental.IsExperimentalModeEnabled() { - if !co.forceS2i && co.devfileMetadata.devfileSupport { - // Validate if the devfile component that user wants to create already exists - spinner := log.Spinner("Validating devfile component") - defer spinner.End(false) + if !co.forceS2i && co.devfileMetadata.devfileSupport { + // Validate if the devfile component that user wants to create already exists + spinner := log.Spinner("Validating devfile component") + defer spinner.End(false) + + err = util.ValidateK8sResourceName("component name", co.devfileMetadata.componentName) + if err != nil { + return err + } - err = util.ValidateK8sResourceName("component name", co.devfileMetadata.componentName) + // Only validate namespace if pushtarget isn't docker + if !pushtarget.IsPushTargetDocker() { + err := util.ValidateK8sResourceName("component namespace", co.devfileMetadata.componentNamespace) if err != nil { return err } + } - // Only validate namespace if pushtarget isn't docker - if !pushtarget.IsPushTargetDocker() { - err := util.ValidateK8sResourceName("component namespace", co.devfileMetadata.componentNamespace) - if err != nil { - return err - } - } - - spinner.End(true) + spinner.End(true) - return nil - } + return nil } log.Info("Validation") @@ -996,97 +980,96 @@ func (co *CreateOptions) downloadProject(projectPassed string) error { // Run has the logic to perform the required actions as part of command func (co *CreateOptions) Run() (err error) { - if experimental.IsExperimentalModeEnabled() { - if !co.forceS2i && co.devfileMetadata.devfileSupport { - // Use existing devfile directly from --devfile flag - if co.devfileMetadata.devfilePath.value != "" { - if co.devfileMetadata.devfilePath.protocol == "http(s)" { - // User specify devfile path is http(s) URL - params := util.DownloadParams{ - Request: util.HTTPRequestParams{ - URL: co.devfileMetadata.devfilePath.value, - Token: co.devfileMetadata.token, - }, - Filepath: DevfilePath, - } - err = util.DownloadFile(params) - if err != nil { - return errors.Wrapf(err, "failed to download devfile for devfile component from %s", co.devfileMetadata.devfilePath.value) - } - } else if co.devfileMetadata.devfilePath.protocol == "file" { - // User specify devfile path is file system link - info, err := os.Stat(co.devfileMetadata.devfilePath.value) - if err != nil { - return err - } - err = util.CopyFile(co.devfileMetadata.devfilePath.value, DevfilePath, info) - if err != nil { - return errors.Wrapf(err, "failed to copy devfile from %s to %s", co.devfileMetadata.devfilePath, DevfilePath) - } - } - } - if !util.CheckPathExists(DevfilePath) { - // Download devfile from registry + if !co.forceS2i && co.devfileMetadata.devfileSupport { + // Use existing devfile directly from --devfile flag + if co.devfileMetadata.devfilePath.value != "" { + if co.devfileMetadata.devfilePath.protocol == "http(s)" { + // User specify devfile path is http(s) URL params := util.DownloadParams{ Request: util.HTTPRequestParams{ - URL: co.devfileMetadata.devfileRegistry.URL + co.devfileMetadata.devfileLink, + URL: co.devfileMetadata.devfilePath.value, + Token: co.devfileMetadata.token, }, Filepath: DevfilePath, } - if registryUtil.IsSecure(co.devfileMetadata.devfileRegistry.Name) { - token, err := keyring.Get(util.CredentialPrefix+co.devfileMetadata.devfileRegistry.Name, "default") - if err != nil { - return errors.Wrap(err, "unable to get secure registry credential from keyring") - } - params.Request.Token = token + err = util.DownloadFile(params) + if err != nil { + return errors.Wrapf(err, "failed to download devfile for devfile component from %s", co.devfileMetadata.devfilePath.value) } - - cfg, err := preference.New() + } else if co.devfileMetadata.devfilePath.protocol == "file" { + // User specify devfile path is file system link + info, err := os.Stat(co.devfileMetadata.devfilePath.value) if err != nil { return err } - err = util.DownloadFileWithCache(params, cfg.GetRegistryCacheTime()) + err = util.CopyFile(co.devfileMetadata.devfilePath.value, DevfilePath, info) if err != nil { - return errors.Wrapf(err, "failed to download devfile for devfile component from %s", co.devfileMetadata.devfileRegistry.URL+co.devfileMetadata.devfileLink) + return errors.Wrapf(err, "failed to copy devfile from %s to %s", co.devfileMetadata.devfilePath, DevfilePath) } } + } - if util.CheckPathExists(DevfilePath) && co.devfileMetadata.starter != "" { - err = co.downloadProject(co.devfileMetadata.starter) + if !util.CheckPathExists(DevfilePath) { + // Download devfile from registry + params := util.DownloadParams{ + Request: util.HTTPRequestParams{ + URL: co.devfileMetadata.devfileRegistry.URL + co.devfileMetadata.devfileLink, + }, + Filepath: DevfilePath, + } + if registryUtil.IsSecure(co.devfileMetadata.devfileRegistry.Name) { + token, err := keyring.Get(util.CredentialPrefix+co.devfileMetadata.devfileRegistry.Name, "default") if err != nil { - return errors.Wrap(err, "failed to download project for devfile component") + return errors.Wrap(err, "unable to get secure registry credential from keyring") } + params.Request.Token = token } - // Generate env file - err = co.EnvSpecificInfo.SetComponentSettings(envinfo.ComponentSettings{ - Name: co.devfileMetadata.componentName, - Namespace: co.devfileMetadata.componentNamespace, - AppName: co.appName, - }) + cfg, err := preference.New() if err != nil { - return errors.Wrap(err, "failed to create env file for devfile component") + return err } - - sourcePath, err := util.GetAbsPath(co.componentContext) + err = util.DownloadFileWithCache(params, cfg.GetRegistryCacheTime()) if err != nil { - return errors.Wrap(err, "unable to get source path") + return errors.Wrapf(err, "failed to download devfile for devfile component from %s", co.devfileMetadata.devfileRegistry.URL+co.devfileMetadata.devfileLink) } + } - ignoreFile, err := util.CheckGitIgnoreFile(sourcePath) + if util.CheckPathExists(DevfilePath) && co.devfileMetadata.starter != "" { + err = co.downloadProject(co.devfileMetadata.starter) if err != nil { - return err + return errors.Wrap(err, "failed to download project for devfile component") } + } - err = util.AddFileToIgnoreFile(ignoreFile, filepath.Join(co.componentContext, envDir)) - if err != nil { - return err - } + // Generate env file + err = co.EnvSpecificInfo.SetComponentSettings(envinfo.ComponentSettings{ + Name: co.devfileMetadata.componentName, + Namespace: co.devfileMetadata.componentNamespace, + AppName: co.appName, + }) + if err != nil { + return errors.Wrap(err, "failed to create env file for devfile component") + } - log.Italic("\nPlease use `odo push` command to create the component with source deployed") - return nil + sourcePath, err := util.GetAbsPath(co.componentContext) + if err != nil { + return errors.Wrap(err, "unable to get source path") + } + + ignoreFile, err := util.CheckGitIgnoreFile(sourcePath) + if err != nil { + return err } + + err = util.AddFileToIgnoreFile(ignoreFile, filepath.Join(co.componentContext, envDir)) + if err != nil { + return err + } + + log.Italic("\nPlease use `odo push` command to create the component with source deployed") + return nil } err = co.LocalConfigInfo.SetComponentSettings(co.componentSettings) @@ -1175,14 +1158,12 @@ func NewCmdCreate(name, fullName string) *cobra.Command { componentCreateCmd.Flags().StringSliceVarP(&co.componentPorts, "port", "p", []string{}, "Ports to be used when the component is created (ex. 8080,8100/tcp,9100/udp)") componentCreateCmd.Flags().StringSliceVar(&co.componentEnvVars, "env", []string{}, "Environmental variables for the component. For example --env VariableName=Value") - if experimental.IsExperimentalModeEnabled() { - componentCreateCmd.Flags().StringVar(&co.devfileMetadata.starter, "starter", "", "Download a project specified in the devfile") - componentCreateCmd.Flags().Lookup("starter").NoOptDefVal = defaultProjectName //Default value to pass to the flag if one is not specified. - componentCreateCmd.Flags().StringVar(&co.devfileMetadata.devfileRegistry.Name, "registry", "", "Create devfile component from specific registry") - componentCreateCmd.Flags().StringVar(&co.devfileMetadata.devfilePath.value, "devfile", "", "Path to the user specify devfile") - componentCreateCmd.Flags().StringVar(&co.devfileMetadata.token, "token", "", "Token to be used when downloading devfile from the devfile path that is specified via --devfile") - componentCreateCmd.Flags().BoolVar(&co.forceS2i, "s2i", false, "Enforce S2I type components") - } + componentCreateCmd.Flags().StringVar(&co.devfileMetadata.starter, "starter", "", "Download a project specified in the devfile") + componentCreateCmd.Flags().Lookup("starter").NoOptDefVal = defaultProjectName //Default value to pass to the flag if one is not specified. + componentCreateCmd.Flags().StringVar(&co.devfileMetadata.devfileRegistry.Name, "registry", "", "Create devfile component from specific registry") + componentCreateCmd.Flags().StringVar(&co.devfileMetadata.devfilePath.value, "devfile", "", "Path to the user specify devfile") + componentCreateCmd.Flags().StringVar(&co.devfileMetadata.token, "token", "", "Token to be used when downloading devfile from the devfile path that is specified via --devfile") + componentCreateCmd.Flags().BoolVar(&co.forceS2i, "s2i", false, "Enforce S2I type components") componentCreateCmd.SetUsageTemplate(odoutil.CmdUsageTemplate) diff --git a/pkg/odo/cli/component/delete.go b/pkg/odo/cli/component/delete.go index cb510adc155..675eb975b7a 100644 --- a/pkg/odo/cli/component/delete.go +++ b/pkg/odo/cli/component/delete.go @@ -6,7 +6,6 @@ import ( "path/filepath" "github.com/openshift/odo/pkg/envinfo" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/odo/util/pushtarget" "github.com/openshift/odo/pkg/util" @@ -80,7 +79,7 @@ func (do *DeleteOptions) Complete(name string, cmd *cobra.Command, args []string ConfigFilePath = filepath.Join(do.componentContext, configFile) // if experimental mode is enabled and devfile is present - if !do.componentDeleteS2iFlag && experimental.IsExperimentalModeEnabled() && util.CheckPathExists(do.devfilePath) { + if !do.componentDeleteS2iFlag && util.CheckPathExists(do.devfilePath) { do.EnvSpecificInfo, err = envinfo.NewEnvSpecificInfo(do.componentContext) if err != nil { return err @@ -105,7 +104,7 @@ func (do *DeleteOptions) Complete(name string, cmd *cobra.Command, args []string func (do *DeleteOptions) Validate() (err error) { // if experimental mode is enabled and devfile is present - if !do.componentDeleteS2iFlag && experimental.IsExperimentalModeEnabled() && util.CheckPathExists(do.devfilePath) { + if !do.componentDeleteS2iFlag && util.CheckPathExists(do.devfilePath) { return nil } @@ -132,7 +131,7 @@ func (do *DeleteOptions) Run() (err error) { klog.V(4).Infof("component delete called") klog.V(4).Infof("args: %#v", do) - if !do.componentDeleteS2iFlag && experimental.IsExperimentalModeEnabled() && util.CheckPathExists(do.devfilePath) { + if !do.componentDeleteS2iFlag && util.CheckPathExists(do.devfilePath) { return do.DevFileRun() } @@ -312,10 +311,7 @@ func NewCmdDelete(name, fullName string) *cobra.Command { componentDeleteCmd.Flags().BoolVarP(&do.componentDeleteWaitFlag, "wait", "w", false, "Wait for complete deletion of component and its dependent") componentDeleteCmd.Flags().BoolVarP(&do.componentDeleteS2iFlag, "s2i", "", false, "Delete s2i component if devfile and s2i both component present with same name") - // enable show flag if experimental mode is enabled - if experimental.IsExperimentalModeEnabled() { - componentDeleteCmd.Flags().BoolVar(&do.show, "show-log", false, "If enabled, logs will be shown when deleted") - } + componentDeleteCmd.Flags().BoolVar(&do.show, "show-log", false, "If enabled, logs will be shown when deleted") componentDeleteCmd.SetUsageTemplate(odoutil.CmdUsageTemplate) completion.RegisterCommandHandler(componentDeleteCmd, completion.ComponentNameCompletionHandler) diff --git a/pkg/odo/cli/component/devfile.go b/pkg/odo/cli/component/devfile.go index dba5928a437..382d96e4ae9 100644 --- a/pkg/odo/cli/component/devfile.go +++ b/pkg/odo/cli/component/devfile.go @@ -2,6 +2,7 @@ package component import ( "os" + "path/filepath" "strings" "github.com/openshift/odo/pkg/devfile" @@ -32,6 +33,18 @@ The behaviour of this feature is subject to change as development for this feature progresses. */ +// Constants for devfile component +const ( + devFile = "devfile.yaml" +) + +// DevfilePath is the devfile path that is used by odo, +// which means odo can: +// 1. Directly use the devfile in DevfilePath +// 2. Download devfile from registry to DevfilePath then use the devfile in DevfilePath +// 3. Copy user's own devfile (path is specified via --devfile flag) to DevfilePath then use the devfile in DevfilePath +var DevfilePath = filepath.Join(LocalDirectoryDefaultLocation, devFile) + // DevfilePush has the logic to perform the required actions for a given devfile func (po *PushOptions) DevfilePush() error { diff --git a/pkg/odo/cli/component/exec.go b/pkg/odo/cli/component/exec.go index 348ee9e8611..98c15e1bc66 100644 --- a/pkg/odo/cli/component/exec.go +++ b/pkg/odo/cli/component/exec.go @@ -8,8 +8,8 @@ import ( "github.com/openshift/odo/pkg/odo/genericclioptions" odoutil "github.com/openshift/odo/pkg/odo/util" "github.com/openshift/odo/pkg/odo/util/completion" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/odo/util/pushtarget" + "github.com/openshift/odo/pkg/util" "path/filepath" @@ -63,7 +63,7 @@ Please provide a command to execute, odo exec -- `) eo.devfilePath = filepath.Join(eo.componentContext, eo.devfilePath) // if experimental mode is enabled and devfile is present - if experimental.IsExperimentalModeEnabled() { + if util.CheckPathExists(eo.devfilePath) { eo.componentOptions.Context = genericclioptions.NewDevfileContext(cmd) if !pushtarget.IsPushTargetDocker() { diff --git a/pkg/odo/cli/component/link.go b/pkg/odo/cli/component/link.go index 5a9620f14f2..4b8bd532534 100644 --- a/pkg/odo/cli/component/link.go +++ b/pkg/odo/cli/component/link.go @@ -2,17 +2,17 @@ package component import ( "fmt" + "path/filepath" "github.com/openshift/odo/pkg/component" "github.com/openshift/odo/pkg/odo/genericclioptions" sbo "github.com/redhat-developer/service-binding-operator/pkg/apis/apps/v1alpha1" - appCmd "github.com/openshift/odo/pkg/odo/cli/application" projectCmd "github.com/openshift/odo/pkg/odo/cli/project" "github.com/openshift/odo/pkg/odo/util/completion" - "github.com/openshift/odo/pkg/odo/util/experimental" + "github.com/openshift/odo/pkg/util" - "github.com/openshift/odo/pkg/odo/util" + odoutil "github.com/openshift/odo/pkg/odo/util" ktemplates "k8s.io/kubectl/pkg/util/templates" "github.com/spf13/cobra" @@ -88,6 +88,7 @@ odo link EtcdCluster/myetcd type LinkOptions struct { waitForTarget bool componentContext string + *commonLinkOptions } @@ -101,8 +102,10 @@ func NewLinkOptions() *LinkOptions { // Complete completes LinkOptions after they've been created func (o *LinkOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { + o.commonLinkOptions.devfilePath = filepath.Join(o.componentContext, DevfilePath) + err = o.complete(name, cmd, args) - if !experimental.IsExperimentalModeEnabled() { + if !util.CheckPathExists(o.commonLinkOptions.devfilePath) { o.operation = o.Client.LinkSecret } return err @@ -115,7 +118,8 @@ func (o *LinkOptions) Validate() (err error) { return err } - if experimental.IsExperimentalModeEnabled() { + // Wat? + if util.CheckPathExists(o.commonLinkOptions.devfilePath) { return } @@ -160,22 +164,27 @@ func NewCmdLink(name, fullName string) *cobra.Command { linkCmd.PersistentFlags().BoolVarP(&o.wait, "wait", "w", false, "If enabled the link will return only when the component is fully running after the link is created") linkCmd.PersistentFlags().BoolVar(&o.waitForTarget, "wait-for-target", false, "If enabled, the link command will wait for the service to be provisioned (has no effect when linking to a component)") - linkCmd.SetUsageTemplate(util.CmdUsageTemplate) + linkCmd.SetUsageTemplate(odoutil.CmdUsageTemplate) + + // Update the use / example / long to the Devfile description + linkCmd.Use = fmt.Sprintf("%s /", name) + linkCmd.Example = fmt.Sprintf(linkExampleExperimental, fullName) + linkCmd.Long = linkLongDescExperimental - // Modifications for the case when experimental mode is enabled - if experimental.IsExperimentalModeEnabled() { - linkCmd.Use = fmt.Sprintf("%s /", name) - linkCmd.Example = fmt.Sprintf(linkExampleExperimental, fullName) - linkCmd.Long = linkLongDescExperimental - } //Adding `--project` flag projectCmd.AddProjectFlag(linkCmd) - //Adding `--application` flag - if !experimental.IsExperimentalModeEnabled() { - appCmd.AddApplicationFlag(linkCmd) - } + + // Adding `--application` flag + // Should we just remove this if Devfile is default? I guess so! + /* + if !experimental.IsExperimentalModeEnabled() { + appCmd.AddApplicationFlag(linkCmd) + } + */ + //Adding `--component` flag AddComponentFlag(linkCmd) + //Adding context flag genericclioptions.AddContextFlag(linkCmd, &o.componentContext) diff --git a/pkg/odo/cli/component/list.go b/pkg/odo/cli/component/list.go index 28ad0402559..4332b87851b 100644 --- a/pkg/odo/cli/component/list.go +++ b/pkg/odo/cli/component/list.go @@ -27,7 +27,6 @@ import ( "github.com/openshift/odo/pkg/odo/genericclioptions" odoutil "github.com/openshift/odo/pkg/odo/util" "github.com/openshift/odo/pkg/odo/util/completion" - "github.com/openshift/odo/pkg/odo/util/experimental" ktemplates "k8s.io/kubectl/pkg/util/templates" ) @@ -51,7 +50,6 @@ type ListOptions struct { hasDCSupport bool hasDevfileComponents bool hasS2IComponents bool - isExperimentalMode bool devfilePath string *genericclioptions.Context } @@ -63,11 +61,10 @@ func NewListOptions() *ListOptions { // Complete completes log args func (lo *ListOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { - lo.isExperimentalMode = experimental.IsExperimentalModeEnabled() + lo.devfilePath = filepath.Join(lo.componentContext, DevfilePath) - if lo.isExperimentalMode && util.CheckPathExists(lo.devfilePath) { - // Add a disclaimer that we are in *experimental mode* - log.Experimental("Experimental mode is enabled, use at your own risk") + + if util.CheckPathExists(lo.devfilePath) { lo.Context = genericclioptions.NewDevfileContext(cmd) lo.Client = genericclioptions.Client(cmd) @@ -113,7 +110,7 @@ func (lo *ListOptions) Validate() (err error) { klog.V(4).Infof("either --app and --all-apps both provided or provided --all-apps in a folder has app, use --all-apps anyway") } - if lo.isExperimentalMode { + if util.CheckPathExists(lo.devfilePath) { if lo.Context.Application == "" && lo.Context.KClient.Namespace == "" { return odoutil.ThrowContextError() } @@ -144,7 +141,7 @@ func (lo *ListOptions) Run() (err error) { if len(lo.pathFlag) != 0 { - if lo.isExperimentalMode && util.CheckPathExists(lo.devfilePath) { + if util.CheckPathExists(lo.devfilePath) { log.Experimental("--path flag is not supported for devfile components") } components, err := component.ListIfPathGiven(lo.Context.Client, filepath.SplitList(lo.pathFlag)) @@ -176,7 +173,7 @@ func (lo *ListOptions) Run() (err error) { // experimental workflow - if lo.isExperimentalMode && util.CheckPathExists(lo.devfilePath) { + if util.CheckPathExists(lo.devfilePath) { var deploymentList *appsv1.DeploymentList var err error diff --git a/pkg/odo/cli/component/log.go b/pkg/odo/cli/component/log.go index 57ac5c8afbc..71ac2bb05f4 100644 --- a/pkg/odo/cli/component/log.go +++ b/pkg/odo/cli/component/log.go @@ -11,7 +11,6 @@ import ( appCmd "github.com/openshift/odo/pkg/odo/cli/application" projectCmd "github.com/openshift/odo/pkg/odo/cli/project" "github.com/openshift/odo/pkg/odo/util/completion" - "github.com/openshift/odo/pkg/odo/util/experimental" ktemplates "k8s.io/kubectl/pkg/util/templates" odoutil "github.com/openshift/odo/pkg/odo/util" @@ -48,7 +47,7 @@ func (lo *LogOptions) Complete(name string, cmd *cobra.Command, args []string) ( lo.devfilePath = filepath.Join(lo.componentContext, lo.devfilePath) // if experimental mode is enabled and devfile is present - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(lo.devfilePath) { + if util.CheckPathExists(lo.devfilePath) { lo.ComponentOptions.Context = genericclioptions.NewDevfileContext(cmd) return nil } @@ -66,7 +65,7 @@ func (lo *LogOptions) Run() (err error) { stdout := os.Stdout // If experimental mode is enabled, use devfile push - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(lo.devfilePath) { + if util.CheckPathExists(lo.devfilePath) { err = lo.DevfileComponentLog() } else { // Retrieve the log diff --git a/pkg/odo/cli/component/push.go b/pkg/odo/cli/component/push.go index 8cc99399fb1..864689de7a4 100644 --- a/pkg/odo/cli/component/push.go +++ b/pkg/odo/cli/component/push.go @@ -15,7 +15,6 @@ import ( projectCmd "github.com/openshift/odo/pkg/odo/cli/project" "github.com/openshift/odo/pkg/odo/genericclioptions" "github.com/openshift/odo/pkg/odo/util/completion" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/util" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -85,7 +84,7 @@ func (po *PushOptions) Complete(name string, cmd *cobra.Command, args []string) po.CompleteDevfilePath() // if experimental mode is enabled and devfile is present - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(po.DevfilePath) { + if util.CheckPathExists(po.DevfilePath) { po.Devfile, err = devfile.ParseAndValidate(po.DevfilePath) if err != nil { @@ -176,7 +175,7 @@ func (po *PushOptions) Validate() (err error) { // If the experimental flag is set and devfile is present, then we do *not* validate // TODO: We need to clean this section up a bit.. We should also validate Devfile here // too. - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(po.DevfilePath) { + if util.CheckPathExists(po.DevfilePath) { return nil } @@ -208,7 +207,7 @@ func (po *PushOptions) Validate() (err error) { // Run has the logic to perform the required actions as part of command func (po *PushOptions) Run() (err error) { // If experimental mode is enabled, use devfile push - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(po.DevfilePath) { + if util.CheckPathExists(po.DevfilePath) { // Return Devfile push return po.DevfilePush() } @@ -224,14 +223,8 @@ func NewCmdPush(name, fullName string) *cobra.Command { annotations := map[string]string{"command": "component"} pushCmdExampleText := pushCmdExample - - if experimental.IsExperimentalModeEnabled() { - // The '-o json' option should only appear in help output when experimental mode is enabled. - annotations["machineoutput"] = "json" - - // The '-o json' example should likewise only appear in experimental only. - pushCmdExampleText += pushCmdExampleExperimentalOnly - } + annotations["machineoutput"] = "json" + pushCmdExampleText += pushCmdExampleExperimentalOnly var pushCmd = &cobra.Command{ Use: fmt.Sprintf("%s [component name]", name), @@ -252,15 +245,12 @@ func NewCmdPush(name, fullName string) *cobra.Command { pushCmd.Flags().BoolVar(&po.pushSource, "source", false, "Use source flag to only push latest source on to cluster") pushCmd.Flags().BoolVarP(&po.forceBuild, "force-build", "f", false, "Use force-build flag to force building the component") - // enable devfile flag if experimental mode is enabled - if experimental.IsExperimentalModeEnabled() { - pushCmd.Flags().StringVar(&po.namespace, "namespace", "", "Namespace to push the component to") - pushCmd.Flags().StringVar(&po.devfileInitCommand, "init-command", "", "Devfile Init Command to execute") - pushCmd.Flags().StringVar(&po.devfileBuildCommand, "build-command", "", "Devfile Build Command to execute") - pushCmd.Flags().StringVar(&po.devfileRunCommand, "run-command", "", "Devfile Run Command to execute") - pushCmd.Flags().BoolVar(&po.debugRun, "debug", false, "Runs the component in debug mode") - pushCmd.Flags().StringVar(&po.devfileDebugCommand, "debug-command", "", "Devfile Debug Command to execute") - } + pushCmd.Flags().StringVar(&po.namespace, "namespace", "", "Namespace to push the component to") + pushCmd.Flags().StringVar(&po.devfileInitCommand, "init-command", "", "Devfile Init Command to execute") + pushCmd.Flags().StringVar(&po.devfileBuildCommand, "build-command", "", "Devfile Build Command to execute") + pushCmd.Flags().StringVar(&po.devfileRunCommand, "run-command", "", "Devfile Run Command to execute") + pushCmd.Flags().BoolVar(&po.debugRun, "debug", false, "Runs the component in debug mode") + pushCmd.Flags().StringVar(&po.devfileDebugCommand, "debug-command", "", "Devfile Debug Command to execute") //Adding `--project` flag projectCmd.AddProjectFlag(pushCmd) diff --git a/pkg/odo/cli/component/update.go b/pkg/odo/cli/component/update.go index 9ec01a79b92..76c8d5a292d 100644 --- a/pkg/odo/cli/component/update.go +++ b/pkg/odo/cli/component/update.go @@ -18,7 +18,6 @@ import ( "github.com/openshift/odo/pkg/odo/genericclioptions" odoutil "github.com/openshift/odo/pkg/odo/util" "github.com/openshift/odo/pkg/odo/util/completion" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/util" ktemplates "k8s.io/kubectl/pkg/util/templates" @@ -78,10 +77,7 @@ func NewUpdateOptions() *UpdateOptions { func (uo *UpdateOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { uo.devfilePath = filepath.Join(uo.componentContext, DevfilePath) - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(uo.devfilePath) { - // Add a disclaimer that we are in *experimental mode* - log.Experimental("Experimental mode is enabled, use at your own risk") - + if util.CheckPathExists(uo.devfilePath) { // Configure the devfile context uo.Context = genericclioptions.NewDevfileContext(cmd) return @@ -99,7 +95,7 @@ func (uo *UpdateOptions) Complete(name string, cmd *cobra.Command, args []string func (uo *UpdateOptions) Validate() (err error) { // if experimental mode is enabled and devfile is present - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(uo.devfilePath) { + if util.CheckPathExists(uo.devfilePath) { return nil } @@ -171,8 +167,8 @@ func (uo *UpdateOptions) Validate() (err error) { // Run has the logic to perform the required actions as part of command func (uo *UpdateOptions) Run() (err error) { - // if experimental mode is enabled and devfile is present - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(uo.devfilePath) { + // if devfile is present + if util.CheckPathExists(uo.devfilePath) { return errors.New(devfileErrorString) } diff --git a/pkg/odo/cli/component/watch.go b/pkg/odo/cli/component/watch.go index 90947ed4aca..007380f6769 100644 --- a/pkg/odo/cli/component/watch.go +++ b/pkg/odo/cli/component/watch.go @@ -2,11 +2,12 @@ package component import ( "fmt" - "github.com/openshift/odo/pkg/devfile/adapters/common" "os" "path/filepath" "strings" + "github.com/openshift/odo/pkg/devfile/adapters/common" + "github.com/openshift/odo/pkg/config" "github.com/openshift/odo/pkg/devfile" "github.com/openshift/odo/pkg/devfile/adapters" @@ -14,7 +15,6 @@ import ( "github.com/openshift/odo/pkg/occlient" appCmd "github.com/openshift/odo/pkg/odo/cli/application" projectCmd "github.com/openshift/odo/pkg/odo/cli/project" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/odo/util/pushtarget" "github.com/pkg/errors" ktemplates "k8s.io/kubectl/pkg/util/templates" @@ -40,10 +40,6 @@ var watchExampleWithDevfile = ktemplates.Examples(` # Watch for changes in dire %[1]s --build-command="mybuild" --run-command="myrun" `) -var watchExample = ktemplates.Examples(` # Watch for changes in directory for current component -%[1]s - `) - // WatchOptions contains attributes of the watch command type WatchOptions struct { ignores []string @@ -78,7 +74,7 @@ func (wo *WatchOptions) Complete(name string, cmd *cobra.Command, args []string) wo.devfilePath = filepath.Join(wo.componentContext, DevfilePath) // if experimental mode is enabled and devfile is present - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(wo.devfilePath) { + if util.CheckPathExists(wo.devfilePath) { wo.Context = genericclioptions.NewDevfileContext(cmd) // Set the source path to either the context or current working directory (if context not set) @@ -157,7 +153,7 @@ func (wo *WatchOptions) Validate() (err error) { } // if experimental mode is enabled and devfile is present, return. The rest of the validation is for non-devfile components - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(wo.devfilePath) { + if util.CheckPathExists(wo.devfilePath) { exists, err := wo.devfileHandler.DoesComponentExist(wo.componentName) if err != nil { return err @@ -199,7 +195,7 @@ func (wo *WatchOptions) Validate() (err error) { // Run has the logic to perform the required actions as part of command func (wo *WatchOptions) Run() (err error) { // if experimental mode is enabled and devfile is present - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(wo.devfilePath) { + if util.CheckPathExists(wo.devfilePath) { err = watch.DevfileWatchAndPush( os.Stdout, @@ -249,12 +245,10 @@ func (wo *WatchOptions) Run() (err error) { func NewCmdWatch(name, fullName string) *cobra.Command { wo := NewWatchOptions() - example := fmt.Sprintf(watchExample, fullName) usage := name - if experimental.IsExperimentalModeEnabled() { - example = fmt.Sprintf(watchExampleWithDevfile, fullName) - } + // Add information on Devfile + example := fmt.Sprintf(watchExampleWithDevfile, fullName) var watchCmd = &cobra.Command{ Use: usage, @@ -274,12 +268,9 @@ func NewCmdWatch(name, fullName string) *cobra.Command { watchCmd.SetUsageTemplate(odoutil.CmdUsageTemplate) - // enable devfile flag if experimental mode is enabled - if experimental.IsExperimentalModeEnabled() { - watchCmd.Flags().StringVar(&wo.devfileInitCommand, "init-command", "", "Devfile Init Command to execute") - watchCmd.Flags().StringVar(&wo.devfileBuildCommand, "build-command", "", "Devfile Build Command to execute") - watchCmd.Flags().StringVar(&wo.devfileRunCommand, "run-command", "", "Devfile Run Command to execute") - } + watchCmd.Flags().StringVar(&wo.devfileInitCommand, "init-command", "", "Devfile Init Command to execute") + watchCmd.Flags().StringVar(&wo.devfileBuildCommand, "build-command", "", "Devfile Build Command to execute") + watchCmd.Flags().StringVar(&wo.devfileRunCommand, "run-command", "", "Devfile Run Command to execute") // Adding context flag genericclioptions.AddContextFlag(watchCmd, &wo.componentContext) diff --git a/pkg/odo/cli/debug/info.go b/pkg/odo/cli/debug/info.go index ec4d89f5ec2..c35d46ad4a2 100644 --- a/pkg/odo/cli/debug/info.go +++ b/pkg/odo/cli/debug/info.go @@ -2,11 +2,13 @@ package debug import ( "fmt" + "path/filepath" + "github.com/openshift/odo/pkg/debug" "github.com/openshift/odo/pkg/log" "github.com/openshift/odo/pkg/machineoutput" + "github.com/openshift/odo/pkg/odo/cli/component" "github.com/openshift/odo/pkg/odo/genericclioptions" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/util" "github.com/spf13/cobra" k8sgenclioptions "k8s.io/cli-runtime/pkg/genericclioptions" @@ -20,8 +22,8 @@ type InfoOptions struct { Namespace string PortForwarder *debug.DefaultPortForwarder *genericclioptions.Context - contextDir string - DevfilePath string + componentContext string + devfilePath string } var ( @@ -46,7 +48,9 @@ func NewInfoOptions() *InfoOptions { // Complete completes all the required options for port-forward cmd. func (o *InfoOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { - if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(o.DevfilePath) { + o.devfilePath = filepath.Join(o.componentContext, component.DevfilePath) + + if util.CheckPathExists(o.devfilePath) { o.Context = genericclioptions.NewDevfileContext(cmd) // a small shortcut @@ -103,10 +107,7 @@ func NewCmdInfo(name, fullName string) *cobra.Command { genericclioptions.GenericRun(opts, cmd, args) }, } - genericclioptions.AddContextFlag(cmd, &opts.contextDir) - if experimental.IsExperimentalModeEnabled() { - cmd.Flags().StringVar(&opts.DevfilePath, "devfile", "./devfile.yaml", "Path to a devfile.yaml") - } + genericclioptions.AddContextFlag(cmd, &opts.componentContext) return cmd } diff --git a/pkg/odo/cli/debug/portforward.go b/pkg/odo/cli/debug/portforward.go index 0fa737754b9..7e192a6682c 100644 --- a/pkg/odo/cli/debug/portforward.go +++ b/pkg/odo/cli/debug/portforward.go @@ -5,14 +5,15 @@ import ( "net" "os" "os/signal" + "path/filepath" "strconv" "syscall" "github.com/openshift/odo/pkg/config" "github.com/openshift/odo/pkg/debug" "github.com/openshift/odo/pkg/log" + "github.com/openshift/odo/pkg/odo/cli/component" "github.com/openshift/odo/pkg/odo/genericclioptions" - "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/util" "github.com/spf13/cobra" @@ -30,8 +31,8 @@ type PortForwardOptions struct { // PortPair is the combination of local and remote port in the format "local:remote" PortPair string - localPort int - contextDir string + localPort int + componentContext string PortForwarder *debug.DefaultPortForwarder // StopChannel is used to stop port forwarding @@ -39,9 +40,7 @@ type PortForwardOptions struct { // ReadChannel is used to receive status of port forwarding ( ready or not ready ) ReadyChannel chan struct{} *genericclioptions.Context - DevfilePath string - - isExperimental bool + devfilePath string } var ( @@ -71,12 +70,11 @@ func NewPortForwardOptions() *PortForwardOptions { // Complete completes all the required options for port-forward cmd. func (o *PortForwardOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { + o.devfilePath = filepath.Join(o.componentContext, component.DevfilePath) var remotePort int - o.isExperimental = experimental.IsExperimentalModeEnabled() - - if o.isExperimental && util.CheckPathExists(o.DevfilePath) { + if util.CheckPathExists(o.devfilePath) { o.Context = genericclioptions.NewDevfileContext(cmd) // a small shortcut @@ -165,7 +163,7 @@ func (o PortForwardOptions) Run() error { return err } - return o.PortForwarder.ForwardPorts(o.PortPair, o.StopChannel, o.ReadyChannel, o.isExperimental) + return o.PortForwarder.ForwardPorts(o.PortPair, o.StopChannel, o.ReadyChannel, util.CheckPathExists(o.devfilePath)) } // NewCmdPortForward implements the port-forward odo command @@ -181,10 +179,7 @@ func NewCmdPortForward(name, fullName string) *cobra.Command { genericclioptions.GenericRun(opts, cmd, args) }, } - genericclioptions.AddContextFlag(cmd, &opts.contextDir) - if experimental.IsExperimentalModeEnabled() { - cmd.Flags().StringVar(&opts.DevfilePath, "devfile", "./devfile.yaml", "Path to a devfile.yaml") - } + genericclioptions.AddContextFlag(cmd, &opts.componentContext) cmd.Flags().IntVarP(&opts.localPort, "local-port", "l", config.DefaultDebugPort, "Set the local port") return cmd diff --git a/pkg/odo/cli/service/create.go b/pkg/odo/cli/service/create.go index de967f532c1..d723a491e5f 100644 --- a/pkg/odo/cli/service/create.go +++ b/pkg/odo/cli/service/create.go @@ -6,10 +6,12 @@ import ( "fmt" "io/ioutil" "os" + "path/filepath" "strings" "text/template" "github.com/openshift/odo/pkg/log" + "github.com/openshift/odo/pkg/odo/cli/component" "github.com/openshift/odo/pkg/odo/cli/service/ui" commonui "github.com/openshift/odo/pkg/odo/cli/ui" "github.com/openshift/odo/pkg/odo/genericclioptions" @@ -17,6 +19,7 @@ import ( "github.com/openshift/odo/pkg/odo/util/experimental" "github.com/openshift/odo/pkg/odo/util/validation" svc "github.com/openshift/odo/pkg/service" + "github.com/openshift/odo/pkg/util" "github.com/ghodss/yaml" "github.com/pkg/errors" @@ -107,6 +110,9 @@ type ServiceCreateOptions struct { // Location of the file in which yaml specification of CR is stored. // TODO: remove this after service create's interactive mode supports creating operator backed services fromFile string + + // Devfile + devfilePath string } // NewServiceCreateOptions creates a new ServiceCreateOptions instance @@ -128,11 +134,13 @@ func NewDynamicCRD() *DynamicCRD { // Complete completes ServiceCreateOptions after they've been created func (o *ServiceCreateOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) { + o.devfilePath = filepath.Join(o.componentContext, component.DevfilePath) + if len(args) == 0 || !cmd.HasFlags() { o.interactive = true } - if experimental.IsExperimentalModeEnabled() { + if util.CheckPathExists(o.devfilePath) { o.Context = genericclioptions.NewDevfileContext(cmd) } else if o.componentContext != "" { o.Context = genericclioptions.NewContext(cmd) @@ -144,8 +152,7 @@ func (o *ServiceCreateOptions) Complete(name string, cmd *cobra.Command, args [] var class scv1beta1.ClusterServiceClass - if experimental.IsExperimentalModeEnabled() { - // we don't support interactive mode for Operator Hub yet + if util.CheckPathExists(o.devfilePath) { o.interactive = false // if user has just used "odo service create", simply return @@ -209,7 +216,7 @@ func (o *ServiceCreateOptions) Complete(name string, cmd *cobra.Command, args [] } // if only one arg is given, then it is considered as service name and service type both // ONLY if not running in Experimental mode - if !experimental.IsExperimentalModeEnabled() { + if !util.CheckPathExists(o.devfilePath) { // This is because an operator with name // "etcdoperator.v0.9.4-clusterwide" would lead to creation of a // serice with name like @@ -277,7 +284,7 @@ func (o *ServiceCreateOptions) Validate() (err error) { } // we want to find an Operator only if something's passed to the crd flag on CLI - if experimental.IsExperimentalModeEnabled() { + if util.CheckPathExists(o.devfilePath) { d := NewDynamicCRD() // if the user wants to create service from a file, we check for // existence of file and validate if the requested operator and CR @@ -430,7 +437,7 @@ func (o *ServiceCreateOptions) Validate() (err error) { // Run contains the logic for the odo service create command func (o *ServiceCreateOptions) Run() (err error) { s := &log.Status{} - if experimental.IsExperimentalModeEnabled() { + if util.CheckPathExists(o.devfilePath) { // in case of an opertor backed service, name of the service is // provided by the yaml specification in alm-examples. It might also // happen that a user spins up Service Catalog based service in @@ -445,7 +452,7 @@ func (o *ServiceCreateOptions) Run() (err error) { log.Infof("Deploying service %s of type: %s", o.ServiceName, o.ServiceType) } - if experimental.IsExperimentalModeEnabled() && o.CustomResource != "" { + if util.CheckPathExists(o.devfilePath) && o.CustomResource != "" { // if experimental mode is enabled and o.CustomResource is not empty, we're expected to create an Operator backed service if o.DryRun { // if it's dry run, only print the alm-example (o.CustomResourceDefinition) and exit @@ -512,15 +519,13 @@ func NewCmdServiceCreate(name, fullName string) *cobra.Command { }, } - if experimental.IsExperimentalModeEnabled() { - serviceCreateCmd.Use += fmt.Sprintf(" [flags]\n %s / [service_name] [flags]", o.CmdFullName) - serviceCreateCmd.Short = createShortDescExperimental - serviceCreateCmd.Long = createLongDescExperimental - serviceCreateCmd.Example += "\n\n" + fmt.Sprintf(createOperatorExample, fullName) - serviceCreateCmd.Flags().BoolVar(&o.DryRun, "dry-run", false, "Print the yaml specificiation that will be used to create the service") - // remove this feature after enabling service create interactive mode for operator backed services - serviceCreateCmd.Flags().StringVar(&o.fromFile, "from-file", "", "Path to the file containing yaml specification to use to start operator backed service") - } + serviceCreateCmd.Use += fmt.Sprintf(" [flags]\n %s / [service_name] [flags]", o.CmdFullName) + serviceCreateCmd.Short = createShortDescExperimental + serviceCreateCmd.Long = createLongDescExperimental + serviceCreateCmd.Example += "\n\n" + fmt.Sprintf(createOperatorExample, fullName) + serviceCreateCmd.Flags().BoolVar(&o.DryRun, "dry-run", false, "Print the yaml specificiation that will be used to create the service") + // remove this feature after enabling service create interactive mode for operator backed services + serviceCreateCmd.Flags().StringVar(&o.fromFile, "from-file", "", "Path to the file containing yaml specification to use to start operator backed service") serviceCreateCmd.Flags().StringVar(&o.Plan, "plan", "", "The name of the plan of the service to be created") serviceCreateCmd.Flags().StringArrayVarP(&o.parameters, "parameters", "p", []string{}, "Parameters of the plan where a parameter is expressed as = 0 { output = output[:len(output)-1] diff --git a/pkg/url/url.go b/pkg/url/url.go index fee72e1ce86..29301d72861 100644 --- a/pkg/url/url.go +++ b/pkg/url/url.go @@ -242,7 +242,7 @@ type CreateParameters struct { // Create creates a URL and returns url string and error if any // portNumber is the target port number for the route and is -1 in case no port number is specified in which case it is automatically detected for components which expose only one service port) -func Create(client *occlient.Client, kClient *kclient.Client, parameters CreateParameters, isRouteSupported bool, isExperimental bool) (string, error) { +func Create(client *occlient.Client, kClient *kclient.Client, parameters CreateParameters, isRouteSupported bool, isS2I bool) (string, error) { if parameters.urlKind != envinfo.INGRESS && parameters.urlKind != envinfo.ROUTE { return "", fmt.Errorf("urlKind %s is not supported for URL creation", parameters.urlKind) @@ -256,7 +256,7 @@ func Create(client *occlient.Client, kClient *kclient.Client, parameters CreateP serviceName := "" - if isExperimental && parameters.urlKind == envinfo.INGRESS && kClient != nil { + if !isS2I && parameters.urlKind == envinfo.INGRESS && kClient != nil { if parameters.host == "" { return "", errors.Errorf("the host cannot be empty") } @@ -318,14 +318,14 @@ func Create(client *occlient.Client, kClient *kclient.Client, parameters CreateP if err != nil { return "", errors.Wrap(err, "unable to create ingress") } - return GetURLString(GetProtocol(routev1.Route{}, *ingress), "", ingressDomain, isExperimental), nil + return GetURLString(GetProtocol(routev1.Route{}, *ingress), "", ingressDomain, false), nil } else { if !isRouteSupported { return "", errors.Errorf("routes are not available on non OpenShift clusters") } var ownerReference metav1.OwnerReference - if !isExperimental || kClient == nil { + if isS2I || kClient == nil { var err error parameters.urlName, err = util.NamespaceOpenShiftObject(parameters.urlName, parameters.applicationName) if err != nil { @@ -360,7 +360,7 @@ func Create(client *occlient.Client, kClient *kclient.Client, parameters CreateP if err != nil { return "", errors.Wrap(err, "unable to create route") } - return GetURLString(GetProtocol(*route, iextensionsv1.Ingress{}), route.Spec.Host, "", isExperimental), nil + return GetURLString(GetProtocol(*route, iextensionsv1.Ingress{}), route.Spec.Host, "", true), nil } } @@ -684,8 +684,8 @@ func ConvertEnvinfoURL(envinfoURL envinfo.EnvInfoURL, serviceName string) URL { } // GetURLString returns a string representation of given url -func GetURLString(protocol, URL string, ingressDomain string, isExperimentalMode bool) string { - if isExperimentalMode && URL == "" { +func GetURLString(protocol, URL string, ingressDomain string, isS2I bool) string { + if !isS2I && URL == "" { return protocol + "://" + ingressDomain } return protocol + "://" + URL @@ -862,12 +862,12 @@ func getMachineReadableFormatDocker(internalPort int, externalPort int, hostIP s } type PushParameters struct { - ComponentName string - ApplicationName string - ConfigURLs []config.ConfigURL - EnvURLS []envinfo.EnvInfoURL - IsRouteSupported bool - IsExperimentalModeEnabled bool + ComponentName string + ApplicationName string + ConfigURLs []config.ConfigURL + EnvURLS []envinfo.EnvInfoURL + IsRouteSupported bool + IsS2I bool } // Push creates and deletes the required URLs @@ -876,7 +876,7 @@ func Push(client *occlient.Client, kClient *kclient.Client, parameters PushParam // in case the component is a s2i one // kClient will be nil - if parameters.IsExperimentalModeEnabled && kClient != nil { + if !parameters.IsS2I && kClient != nil { urls := parameters.EnvURLS for _, url := range urls { if url.Kind != envinfo.DOCKER { @@ -905,7 +905,7 @@ func Push(client *occlient.Client, kClient *kclient.Client, parameters PushParam } urlCLUSTER := make(map[string]URL) - if parameters.IsExperimentalModeEnabled && kClient != nil { + if !parameters.IsS2I && kClient != nil { urlList, err := ListPushedIngress(kClient, parameters.ComponentName) if err != nil { return err @@ -992,7 +992,7 @@ func Push(client *occlient.Client, kClient *kclient.Client, parameters PushParam secretName: urlInfo.Spec.TLSSecret, urlKind: urlInfo.Spec.Kind, } - host, err := Create(client, kClient, createParameters, parameters.IsRouteSupported, parameters.IsExperimentalModeEnabled) + host, err := Create(client, kClient, createParameters, parameters.IsRouteSupported, parameters.IsS2I) if err != nil { return err } diff --git a/pkg/url/url_test.go b/pkg/url/url_test.go index 59cfc2f7b47..8b627147ce6 100644 --- a/pkg/url/url_test.go +++ b/pkg/url/url_test.go @@ -35,16 +35,16 @@ import ( func TestCreate(t *testing.T) { type args struct { - componentName string - applicationName string - urlName string - portNumber int - secure bool - host string - urlKind envinfo.URLKind - isRouteSupported bool - isExperimentalModeEnabled bool - tlsSecret string + componentName string + applicationName string + urlName string + portNumber int + secure bool + host string + urlKind envinfo.URLKind + isRouteSupported bool + isS2I bool + tlsSecret string } tests := []struct { name string @@ -64,6 +64,7 @@ func TestCreate(t *testing.T) { urlName: "nodejs", portNumber: 8080, isRouteSupported: true, + isS2I: true, urlKind: envinfo.ROUTE, }, returnedRoute: &routev1.Route{ @@ -99,6 +100,7 @@ func TestCreate(t *testing.T) { urlName: "example-url", portNumber: 9100, isRouteSupported: true, + isS2I: true, urlKind: envinfo.ROUTE, }, returnedRoute: &routev1.Route{ @@ -135,6 +137,7 @@ func TestCreate(t *testing.T) { portNumber: 9100, secure: true, isRouteSupported: true, + isS2I: true, urlKind: envinfo.ROUTE, }, returnedRoute: &routev1.Route{ @@ -170,13 +173,12 @@ func TestCreate(t *testing.T) { { name: "Case 4: Create a ingress, with same name as component,instead of route on openshift cluster", args: args{ - componentName: "nodejs", - urlName: "nodejs", - portNumber: 8080, - host: "com", - isRouteSupported: true, - isExperimentalModeEnabled: true, - urlKind: envinfo.INGRESS, + componentName: "nodejs", + urlName: "nodejs", + portNumber: 8080, + host: "com", + isRouteSupported: true, + urlKind: envinfo.INGRESS, }, returnedIngress: fake.GetSingleIngress("nodejs", "nodejs"), want: "http://nodejs.com", @@ -185,13 +187,12 @@ func TestCreate(t *testing.T) { { name: "Case 5: Create a ingress, with different name as component,instead of route on openshift cluster", args: args{ - componentName: "nodejs", - urlName: "example", - portNumber: 8080, - host: "com", - isRouteSupported: true, - isExperimentalModeEnabled: true, - urlKind: envinfo.INGRESS, + componentName: "nodejs", + urlName: "example", + portNumber: 8080, + host: "com", + isRouteSupported: true, + urlKind: envinfo.INGRESS, }, returnedRoute: &routev1.Route{ ObjectMeta: metav1.ObjectMeta{ @@ -222,14 +223,13 @@ func TestCreate(t *testing.T) { { name: "Case 6: Create a secure ingress, instead of route on openshift cluster, default tls exists", args: args{ - componentName: "nodejs", - urlName: "example", - portNumber: 8080, - host: "com", - isRouteSupported: true, - isExperimentalModeEnabled: true, - secure: true, - urlKind: envinfo.INGRESS, + componentName: "nodejs", + urlName: "example", + portNumber: 8080, + host: "com", + isRouteSupported: true, + secure: true, + urlKind: envinfo.INGRESS, }, returnedIngress: fake.GetSingleIngress("example", "nodejs"), defaultTLSExists: true, @@ -239,14 +239,13 @@ func TestCreate(t *testing.T) { { name: "Case 7: Create a secure ingress, instead of route on openshift cluster and default tls doesn't exist", args: args{ - componentName: "nodejs", - urlName: "example", - portNumber: 8080, - host: "com", - isRouteSupported: true, - isExperimentalModeEnabled: true, - secure: true, - urlKind: envinfo.INGRESS, + componentName: "nodejs", + urlName: "example", + portNumber: 8080, + host: "com", + isRouteSupported: true, + secure: true, + urlKind: envinfo.INGRESS, }, returnedIngress: fake.GetSingleIngress("example", "nodejs"), defaultTLSExists: false, @@ -256,15 +255,14 @@ func TestCreate(t *testing.T) { { name: "Case 8: Fail when while creating ingress when user given tls secret doesn't exists", args: args{ - componentName: "nodejs", - urlName: "example", - portNumber: 8080, - host: "com", - isRouteSupported: true, - isExperimentalModeEnabled: true, - secure: true, - tlsSecret: "user-secret", - urlKind: envinfo.INGRESS, + componentName: "nodejs", + urlName: "example", + portNumber: 8080, + host: "com", + isRouteSupported: true, + secure: true, + tlsSecret: "user-secret", + urlKind: envinfo.INGRESS, }, returnedIngress: fake.GetSingleIngress("example", "nodejs"), defaultTLSExists: false, @@ -275,15 +273,14 @@ func TestCreate(t *testing.T) { { name: "Case 9: Create a secure ingress, instead of route on openshift cluster, user tls secret does exists", args: args{ - componentName: "nodejs", - urlName: "example", - portNumber: 8080, - host: "com", - isRouteSupported: true, - isExperimentalModeEnabled: true, - secure: true, - tlsSecret: "user-secret", - urlKind: envinfo.INGRESS, + componentName: "nodejs", + urlName: "example", + portNumber: 8080, + host: "com", + isRouteSupported: true, + secure: true, + tlsSecret: "user-secret", + urlKind: envinfo.INGRESS, }, returnedIngress: fake.GetSingleIngress("example", "nodejs"), defaultTLSExists: false, @@ -295,15 +292,14 @@ func TestCreate(t *testing.T) { { name: "Case 10: invalid url kind", args: args{ - componentName: "nodejs", - urlName: "example", - portNumber: 8080, - host: "com", - isRouteSupported: true, - isExperimentalModeEnabled: true, - secure: true, - tlsSecret: "user-secret", - urlKind: "blah", + componentName: "nodejs", + urlName: "example", + portNumber: 8080, + host: "com", + isRouteSupported: true, + secure: true, + tlsSecret: "user-secret", + urlKind: "blah", }, returnedIngress: fake.GetSingleIngress("example", "nodejs"), defaultTLSExists: false, @@ -314,12 +310,11 @@ func TestCreate(t *testing.T) { { name: "Case 11: route is not supported on the cluster", args: args{ - componentName: "nodejs", - applicationName: "app", - urlName: "example", - isRouteSupported: false, - isExperimentalModeEnabled: true, - urlKind: envinfo.ROUTE, + componentName: "nodejs", + applicationName: "app", + urlName: "example", + isRouteSupported: false, + urlKind: envinfo.ROUTE, }, returnedIngress: fake.GetSingleIngress("example", "nodejs"), defaultTLSExists: false, @@ -330,13 +325,12 @@ func TestCreate(t *testing.T) { { name: "Case 11: secretName used without secure flag", args: args{ - componentName: "nodejs", - applicationName: "app", - urlName: "example", - isRouteSupported: false, - isExperimentalModeEnabled: true, - tlsSecret: "secret", - urlKind: envinfo.ROUTE, + componentName: "nodejs", + applicationName: "app", + urlName: "example", + isRouteSupported: false, + tlsSecret: "secret", + urlKind: envinfo.ROUTE, }, returnedIngress: fake.GetSingleIngress("example", "nodejs"), defaultTLSExists: false, @@ -412,7 +406,7 @@ func TestCreate(t *testing.T) { urlKind: tt.args.urlKind, } - got, err := Create(client, fakeKClient, urlCreateParameters, tt.args.isRouteSupported, tt.args.isExperimentalModeEnabled) + got, err := Create(client, fakeKClient, urlCreateParameters, tt.args.isRouteSupported, tt.args.isS2I) if err == nil && !tt.wantErr { if tt.args.urlKind == envinfo.INGRESS { @@ -741,8 +735,8 @@ func TestGetValidPortNumber(t *testing.T) { func TestPush(t *testing.T) { type args struct { - isRouteSupported bool - isExperimentalModeEnabled bool + isRouteSupported bool + isS2I bool } tests := []struct { name string @@ -761,6 +755,7 @@ func TestPush(t *testing.T) { name: "no urls on local config and cluster", args: args{ isRouteSupported: true, + isS2I: true, }, componentName: "nodejs", applicationName: "app", @@ -770,7 +765,10 @@ func TestPush(t *testing.T) { name: "2 urls on local config and 0 on openshift cluster", componentName: "nodejs", applicationName: "app", - args: args{isRouteSupported: true}, + args: args{ + isRouteSupported: true, + isS2I: true, + }, existingConfigURLs: []config.ConfigURL{ { Name: "example", @@ -811,7 +809,7 @@ func TestPush(t *testing.T) { name: "0 url on local config and 2 on openshift cluster", componentName: "wildfly", applicationName: "app", - args: args{isRouteSupported: true}, + args: args{isRouteSupported: true, isS2I: true}, returnedRoutes: testingutil.GetRouteListWithMultiple("wildfly", "app"), deletedURLs: []URL{ getMachineReadableFormat(testingutil.GetSingleRoute("example-app", 8080, "nodejs", "app")), @@ -822,7 +820,7 @@ func TestPush(t *testing.T) { name: "2 url on local config and 2 on openshift cluster, but they are different", componentName: "nodejs", applicationName: "app", - args: args{isRouteSupported: true}, + args: args{isRouteSupported: true, isS2I: true}, existingConfigURLs: []config.ConfigURL{ { Name: "example-local-0", @@ -867,7 +865,7 @@ func TestPush(t *testing.T) { name: "2 url on local config and openshift cluster are in sync", componentName: "nodejs", applicationName: "app", - args: args{isRouteSupported: true}, + args: args{isRouteSupported: true, isS2I: true}, existingConfigURLs: []config.ConfigURL{ { Name: "example", @@ -888,7 +886,7 @@ func TestPush(t *testing.T) { { name: "0 urls on env file and cluster", componentName: "nodejs", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{}, returnedRoutes: &routev1.RouteList{}, returnedIngress: &extensionsv1.IngressList{}, @@ -896,7 +894,7 @@ func TestPush(t *testing.T) { { name: "2 urls on env file and 0 on openshift cluster", componentName: "nodejs", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example", @@ -943,7 +941,7 @@ func TestPush(t *testing.T) { { name: "0 urls on env file and 2 on openshift cluster", componentName: "nodejs", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{}, returnedRoutes: &routev1.RouteList{}, returnedIngress: fake.GetIngressListWithMultiple("nodejs"), @@ -963,7 +961,7 @@ func TestPush(t *testing.T) { { name: "2 urls on env file and 2 on openshift cluster, but they are different", componentName: "wildfly", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example-local-0", @@ -1022,7 +1020,7 @@ func TestPush(t *testing.T) { { name: "2 urls on env file and openshift cluster are in sync", componentName: "wildfly", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example-0", @@ -1047,7 +1045,7 @@ func TestPush(t *testing.T) { { name: "2 (1 ingress,1 route) urls on env file and 2 on openshift cluster (1 ingress,1 route), but they are different", componentName: "nodejs", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example-local-0", @@ -1104,7 +1102,7 @@ func TestPush(t *testing.T) { { name: "create a ingress on a kubernetes cluster", componentName: "nodejs", - args: args{isRouteSupported: false, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: false}, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example", @@ -1136,7 +1134,9 @@ func TestPush(t *testing.T) { { name: "url with same name exists on env and cluster but with different specs", componentName: "nodejs", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{ + isRouteSupported: true, + }, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example-local-0", @@ -1176,7 +1176,7 @@ func TestPush(t *testing.T) { name: "url with same name exists on config and cluster but with different specs", componentName: "nodejs", applicationName: "app", - args: args{isRouteSupported: true, isExperimentalModeEnabled: false}, + args: args{isRouteSupported: true, isS2I: true}, existingConfigURLs: []config.ConfigURL{ { Name: "example-local-0", @@ -1215,7 +1215,7 @@ func TestPush(t *testing.T) { { name: "create a secure route url", componentName: "nodejs", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example", @@ -1242,7 +1242,7 @@ func TestPush(t *testing.T) { { name: "create a secure ingress url with empty user given tls secret", componentName: "nodejs", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example", @@ -1271,7 +1271,7 @@ func TestPush(t *testing.T) { { name: "create a secure ingress url with user given tls secret", componentName: "nodejs", - args: args{isRouteSupported: true, isExperimentalModeEnabled: true}, + args: args{isRouteSupported: true}, existingEnvInfoURLs: []envinfo.EnvInfoURL{ { Name: "example", @@ -1338,12 +1338,12 @@ func TestPush(t *testing.T) { }) if err := Push(fakeClient, fakeKClient, PushParameters{ - ComponentName: tt.componentName, - ApplicationName: tt.applicationName, - ConfigURLs: tt.existingConfigURLs, - EnvURLS: tt.existingEnvInfoURLs, - IsRouteSupported: tt.args.isRouteSupported, - IsExperimentalModeEnabled: tt.args.isExperimentalModeEnabled, + ComponentName: tt.componentName, + ApplicationName: tt.applicationName, + ConfigURLs: tt.existingConfigURLs, + EnvURLS: tt.existingEnvInfoURLs, + IsRouteSupported: tt.args.isRouteSupported, + IsS2I: tt.args.isS2I, }); (err != nil) != tt.wantErr { t.Errorf("Push() error = %v, wantErr %v", err, tt.wantErr) } else { diff --git a/pkg/version/version.go b/pkg/version/version.go index 3e163da373e..78e2c4d9f09 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -12,7 +12,7 @@ Changing these values will change the versioning information when releasing odo. var ( // VERSION is version number that will be displayed when running ./odo version - VERSION = "v1.2.5" + VERSION = "v2.0.0-alpha" // GITCOMMIT is hash of the commit that will be displayed when running ./odo version // this will be overwritten when running build like this: go build -ldflags="-X github.com/openshift/odo/cmd.GITCOMMIT=$(GITCOMMIT)" diff --git a/tests/e2escenarios/e2e_beta_test.go b/tests/e2escenarios/e2e_beta_test.go index 403a2150098..e411d0a638e 100644 --- a/tests/e2escenarios/e2e_beta_test.go +++ b/tests/e2escenarios/e2e_beta_test.go @@ -46,7 +46,7 @@ var _ = Describe("odo core beta flow", func() { // abstract main test to the function, to allow running the same test in a different context (slightly different arguments) TestBasicCreateConfigPush := func(extraArgs ...string) { - createSession := helper.CmdShouldPass(odo, append([]string{"component", "create", "java:8", "mycomponent", "--app", "myapp", "--project", project}, extraArgs...)...) + createSession := helper.CmdShouldPass(odo, append([]string{"component", "create", "--s2i", "java:8", "mycomponent", "--app", "myapp", "--project", project}, extraArgs...)...) // output of the commands should point user to running "odo push" Expect(createSession).Should(ContainSubstring("odo push")) configFile := filepath.Join(context, ".odo", "config.yaml") @@ -106,8 +106,8 @@ var _ = Describe("odo core beta flow", func() { }) It("'odo component' should fail if there already is .odo dir", func() { - helper.CmdShouldPass("odo", "component", "create", "nodejs", "--project", project) - helper.CmdShouldFail("odo", "component", "create", "nodejs", "--project", project) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", "--project", project) + helper.CmdShouldFail("odo", "component", "create", "--s2i", "nodejs", "--project", project) }) It("'odo config' should fail if there is no .odo dir", func() { @@ -123,8 +123,8 @@ var _ = Describe("odo core beta flow", func() { Context("when --context flag is used", func() { It("odo component should fail if there already is .odo dir", func() { - helper.CmdShouldPass("odo", "component", "create", "nodejs", "--context", context, "--project", project) - helper.CmdShouldFail("odo", "component", "create", "nodejs", "--context", context, "--project", project) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", "--context", context, "--project", project) + helper.CmdShouldFail("odo", "component", "create", "--s2i", "nodejs", "--context", context, "--project", project) }) It("odo config should fail if there is no .odo dir", func() { diff --git a/tests/e2escenarios/e2e_java_test.go b/tests/e2escenarios/e2e_java_test.go index f5c450151ab..ab2ad544a7a 100644 --- a/tests/e2escenarios/e2e_java_test.go +++ b/tests/e2escenarios/e2e_java_test.go @@ -47,7 +47,7 @@ var _ = Describe("odo java e2e tests", func() { }) It("Should be able to deploy a git repo that contains a wildfly application without wait flag", func() { - helper.CmdShouldPass("odo", "create", "wildfly", "wo-wait-javaee-git-test", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "wildfly", "wo-wait-javaee-git-test", "--project", project, "--ref", "master", "--git", warGitRepo, "--context", context) // Create a URL @@ -66,7 +66,7 @@ var _ = Describe("odo java e2e tests", func() { Context("odo component creation", func() { It("Should be able to deploy a .war file using wildfly", func() { helper.CopyExample(filepath.Join("binary", "java", "wildfly"), context) - helper.CmdShouldPass("odo", "create", "wildfly", "javaee-war-test", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "wildfly", "javaee-war-test", "--project", project, "--binary", filepath.Join(context, "ROOT.war"), "--context", context) // Create a URL @@ -85,7 +85,7 @@ var _ = Describe("odo java e2e tests", func() { oc.ImportJavaIS(project) // Deploy the git repo / wildfly example - helper.CmdShouldPass("odo", "create", "java:8", "uberjar-git-test", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "java:8", "uberjar-git-test", "--project", project, "--ref", "master", "--git", jarGitRepo, "--context", context) // Create a URL @@ -104,7 +104,7 @@ var _ = Describe("odo java e2e tests", func() { oc.ImportJavaIS(project) helper.CopyExample(filepath.Join("binary", "java", "openjdk"), context) - helper.CmdShouldPass("odo", "create", "java:8", "sb-jar-test", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "java:8", "sb-jar-test", "--project", project, "--binary", filepath.Join(context, "sb.jar"), "--context", context) // Create a URL diff --git a/tests/e2escenarios/e2e_source_test.go b/tests/e2escenarios/e2e_source_test.go index e2a89f03996..a89bb7c71b4 100644 --- a/tests/e2escenarios/e2e_source_test.go +++ b/tests/e2escenarios/e2e_source_test.go @@ -39,7 +39,7 @@ var _ = Describe("odo source e2e tests", func() { It("Should be able to deploy a wildfly source application", func() { helper.CopyExample(filepath.Join("source", "wildfly"), context) - helper.CmdShouldPass("odo", "create", "wildfly", "wildfly-app", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "wildfly", "wildfly-app", "--project", project, "--context", context) // Push changes @@ -62,7 +62,7 @@ var _ = Describe("odo source e2e tests", func() { It("Should be able to deploy a dotnet source application", func() { oc.ImportDotnet20IS(project) helper.CopyExample(filepath.Join("source", "dotnet"), context) - helper.CmdShouldPass("odo", "create", "dotnet:2.0", "dotnet-app", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "dotnet:2.0", "dotnet-app", "--project", project, "--context", context) // Push changes @@ -87,7 +87,7 @@ var _ = Describe("odo source e2e tests", func() { It("Should be able to deploy a python source application", func() { helper.CopyExample(filepath.Join("source", "python"), context) - helper.CmdShouldPass("odo", "create", "python", "python-app", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "python", "python-app", "--project", project, "--context", context) // Push changes @@ -110,7 +110,7 @@ var _ = Describe("odo source e2e tests", func() { It("Should be able to deploy an openjdk source application", func() { oc.ImportJavaIS(project) helper.CopyExample(filepath.Join("source", "openjdk"), context) - helper.CmdShouldPass("odo", "create", "java:8", "openjdk-app", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "java:8", "openjdk-app", "--project", project, "--context", context) // Push changes @@ -132,7 +132,7 @@ var _ = Describe("odo source e2e tests", func() { It("Should be able to deploy a nodejs source application", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs-app", "--project", + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs-app", "--project", project, "--context", context) // Push changes diff --git a/tests/integration/cmd_debug_test.go b/tests/integration/cmd_debug_test.go index 26fa53742b9..5d123c80227 100644 --- a/tests/integration/cmd_debug_test.go +++ b/tests/integration/cmd_debug_test.go @@ -42,7 +42,7 @@ var _ = Describe("odo debug command tests", func() { Context("odo debug on a nodejs:latest component", func() { It("check that machine output debug information works", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs:latest", "--project", project, "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) httpPort, err := util.HTTPGetFreePort() @@ -69,7 +69,7 @@ var _ = Describe("odo debug command tests", func() { It("should expect a ws connection when tried to connect on different debug port locally and remotely", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs:latest", "--project", project, "--context", context) helper.CmdShouldPass("odo", "config", "set", "--force", "DebugPort", "9292", "--context", context) dbgPort := helper.GetConfigValueWithContext("DebugPort", context) Expect(dbgPort).To(Equal("9292")) @@ -88,7 +88,7 @@ var _ = Describe("odo debug command tests", func() { It("should expect a ws connection when tried to connect on default debug port locally", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs:latest", "--project", project, "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) stopChannel := make(chan bool) @@ -107,7 +107,7 @@ var _ = Describe("odo debug command tests", func() { Context("odo debug info should work on a odo component", func() { It("should start a debug session and run debug info on a running debug session", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "nodejs-cmp-"+project, "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs:latest", "nodejs-cmp-"+project, "--project", project, "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) httpPort, err := util.HTTPGetFreePort() @@ -130,7 +130,7 @@ var _ = Describe("odo debug command tests", func() { It("should start a debug session and run debug info on a closed debug session", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "nodejs-cmp-"+project, "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs:latest", "nodejs-cmp-"+project, "--project", project, "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) httpPort, err := util.HTTPGetFreePort() diff --git a/tests/integration/cmd_link_unlink_test.go b/tests/integration/cmd_link_unlink_test.go index f6982dfc74f..f30378242ed 100644 --- a/tests/integration/cmd_link_unlink_test.go +++ b/tests/integration/cmd_link_unlink_test.go @@ -41,14 +41,16 @@ var _ = Describe("odo link and unlink command tests", func() { Context("when running help for link command", func() { It("should display the help", func() { appHelp := helper.CmdShouldPass("odo", "link", "-h") - Expect(appHelp).To(ContainSubstring("Link component to a service or component")) + // Check for -vmodule moduleSpec output which is in additional flags + Expect(appHelp).To(ContainSubstring("--vmodule moduleSpec")) }) }) Context("when running help for unlink command", func() { It("should display the help", func() { appHelp := helper.CmdShouldPass("odo", "unlink", "-h") - Expect(appHelp).To(ContainSubstring("Unlink component or service from a component")) + // Check for -vmodule moduleSpec output which is in additional flags + Expect(appHelp).To(ContainSubstring("--vmodule moduleSpec")) }) }) @@ -63,10 +65,10 @@ var _ = Describe("odo link and unlink command tests", func() { }) It("should fail", func() { helper.CopyExample(filepath.Join("source", "nodejs"), frontendContext) - helper.CmdShouldPass("odo", "create", "nodejs", "frontend", "--context", frontendContext, "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "frontend", "--context", frontendContext, "--project", project) helper.CmdShouldPass("odo", "push", "--context", frontendContext) helper.CopyExample(filepath.Join("source", "python"), backendContext) - helper.CmdShouldPass("odo", "create", "python", "backend", "--context", backendContext, "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "python", "backend", "--context", backendContext, "--project", project) helper.CmdShouldPass("odo", "push", "--context", backendContext) stdErr := helper.CmdShouldFail("odo", "link", "backend", "--context", frontendContext, "--port", "1234") Expect(stdErr).To(ContainSubstring("Unable to properly link to component backend using port 1234")) @@ -84,13 +86,13 @@ var _ = Describe("odo link and unlink command tests", func() { }) It("should link the frontend application to the backend and then unlink successfully", func() { helper.CopyExample(filepath.Join("source", "nodejs"), frontendContext) - helper.CmdShouldPass("odo", "create", "nodejs", "frontend", "--context", frontendContext, "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "frontend", "--context", frontendContext, "--project", project) helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", frontendContext) helper.CmdShouldPass("odo", "push", "--context", frontendContext) frontendURL := helper.DetermineRouteURL(frontendContext) oc.ImportJavaIS(project) helper.CopyExample(filepath.Join("source", "openjdk"), backendContext) - helper.CmdShouldPass("odo", "create", "java:8", "backend", "--project", project, "--context", backendContext) + helper.CmdShouldPass("odo", "create", "--s2i", "java:8", "backend", "--project", project, "--context", backendContext) helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", backendContext) helper.CmdShouldPass("odo", "push", "--context", backendContext) @@ -113,14 +115,14 @@ var _ = Describe("odo link and unlink command tests", func() { It("Wait till frontend dc rollout properly after linking the frontend application to the backend", func() { appName := helper.RandString(7) helper.CopyExample(filepath.Join("source", "nodejs"), frontendContext) - helper.CmdShouldPass("odo", "create", "nodejs", "frontend", "--app", appName, "--context", frontendContext, "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "frontend", "--app", appName, "--context", frontendContext, "--project", project) helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", frontendContext) helper.CmdShouldPass("odo", "push", "--context", frontendContext) frontendURL := helper.DetermineRouteURL(frontendContext) oc.ImportJavaIS(project) helper.CopyExample(filepath.Join("source", "openjdk"), backendContext) - helper.CmdShouldPass("odo", "create", "java:8", "backend", "--app", appName, "--project", project, "--context", backendContext) + helper.CmdShouldPass("odo", "create", "--s2i", "java:8", "backend", "--app", appName, "--project", project, "--context", backendContext) helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", backendContext) helper.CmdShouldPass("odo", "push", "--context", backendContext) @@ -138,10 +140,10 @@ var _ = Describe("odo link and unlink command tests", func() { It("should successfully delete component after linked component is deleted", func() { // first create the two components helper.CopyExample(filepath.Join("source", "nodejs"), frontendContext) - helper.CmdShouldPass("odo", "create", "nodejs", "frontend", "--context", frontendContext, "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "frontend", "--context", frontendContext, "--project", project) helper.CmdShouldPass("odo", "push", "--context", frontendContext) helper.CopyExample(filepath.Join("source", "nodejs"), backendContext) - helper.CmdShouldPass("odo", "create", "nodejs", "backend", "--context", backendContext, "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "backend", "--context", backendContext, "--project", project) helper.CmdShouldPass("odo", "push", "--context", backendContext) // now link frontend to the backend component diff --git a/tests/integration/cmd_pref_config_test.go b/tests/integration/cmd_pref_config_test.go index 595f0e73a67..91c6156e23d 100644 --- a/tests/integration/cmd_pref_config_test.go +++ b/tests/integration/cmd_pref_config_test.go @@ -173,7 +173,7 @@ var _ = Describe("odo preference and config command tests", func() { paramValue: "https://github.com/sclorg/nodejs-ex", }, } - helper.CmdShouldPass("odo", "create", "nodejs", "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--project", project) for _, testCase := range cases { helper.CmdShouldPass("odo", "config", "set", testCase.paramName, testCase.paramValue, "-f") setValue := helper.GetConfigValue(testCase.paramName) @@ -252,7 +252,7 @@ var _ = Describe("odo preference and config command tests", func() { paramValue: "https://github.com/sclorg/nodejs-ex", }, } - helper.CmdShouldPass("odo", "create", "nodejs", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--project", project, "--context", context) for _, testCase := range cases { helper.CmdShouldPass("odo", "config", "set", "-f", "--context", context, testCase.paramName, testCase.paramValue) @@ -276,7 +276,7 @@ var _ = Describe("odo preference and config command tests", func() { helper.DeleteDir(context) }) It("should set and unset env variables", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--project", project, "--context", context) helper.CmdShouldPass("odo", "config", "set", "--env", "PORT=4000", "--env", "PORT=1234", "--context", context) configPort := helper.GetConfigValueWithContext("PORT", context) Expect(configPort).To(ContainSubstring("1234")) @@ -289,7 +289,7 @@ var _ = Describe("odo preference and config command tests", func() { helper.DontMatchAllInOutput(configValue, []string{"PORT", "SECRET_KEY"}) }) It("should check for existence of environment variable in config before unsetting it", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--project", project, "--context", context) helper.CmdShouldPass("odo", "config", "set", "--env", "PORT=4000", "--env", "PORT=1234", "--context", context) // unset a valid env var @@ -313,7 +313,7 @@ var _ = Describe("odo preference and config command tests", func() { helper.DeleteDir(context) }) It("should list config successfully", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--project", project, "--context", context) helper.CmdShouldPass("odo", "config", "set", "--env", "hello=world", "--context", context) kubeconfigOld := os.Getenv("KUBECONFIG") os.Setenv("KUBECONFIG", "/no/such/path") @@ -323,7 +323,7 @@ var _ = Describe("odo preference and config command tests", func() { }) It("should set config variable without logging in", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--project", project, "--context", context) kubeconfigOld := os.Getenv("KUBECONFIG") os.Setenv("KUBECONFIG", "/no/such/path") helper.CmdShouldPass("odo", "config", "set", "--force", "--context", context, "Name", "foobar") @@ -349,7 +349,7 @@ var _ = Describe("odo preference and config command tests", func() { It("should successfully set and unset variables", func() { //set env var helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--project", project, "--context", context) helper.CmdShouldPass("odo", "config", "set", "--now", "--env", "hello=world", "--context", context) //*Check config configValue1 := helper.CmdShouldPass("odo", "config", "view", "--context", context) diff --git a/tests/integration/cmd_push_test.go b/tests/integration/cmd_push_test.go index 4b184f67b5f..25032da8c7c 100644 --- a/tests/integration/cmd_push_test.go +++ b/tests/integration/cmd_push_test.go @@ -45,7 +45,7 @@ var _ = Describe("odo push command tests", func() { It("Check that pod timeout works and we time out immediately..", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) helper.CmdShouldPass("odo", "preference", "set", "PushTimeout", "1") output := helper.CmdShouldFail("odo", "push", "--context", context+"/nodejs-ex") Expect(output).To(ContainSubstring("waited 1s but couldn't find running pod matching selector")) @@ -58,7 +58,7 @@ var _ = Describe("odo push command tests", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "config", "set", "Memory", "300Mi", "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) @@ -68,7 +68,7 @@ var _ = Describe("odo push command tests", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "config", "set", "minmemory", "100Mi", "--context", context) output := helper.CmdShouldFail("odo", "push", "--context", context) @@ -79,7 +79,7 @@ var _ = Describe("odo push command tests", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "config", "set", "maxmemory", "400Mi", "--context", context) output := helper.CmdShouldFail("odo", "push", "--context", context) @@ -90,7 +90,7 @@ var _ = Describe("odo push command tests", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "config", "set", "cpu", "0.4", "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) @@ -100,7 +100,7 @@ var _ = Describe("odo push command tests", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "config", "set", "mincpu", "0.4", "--context", context) output := helper.CmdShouldFail("odo", "push", "--context", context) @@ -111,7 +111,7 @@ var _ = Describe("odo push command tests", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "config", "set", "maxcpu", "0.5", "--context", context) output := helper.CmdShouldFail("odo", "push", "--context", context) @@ -123,7 +123,7 @@ var _ = Describe("odo push command tests", func() { It("Check for labels", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "push", "--context", context) // Check for all the labels @@ -154,7 +154,7 @@ var _ = Describe("odo push command tests", func() { It("Push, modify a file and then push outside of the working directory", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "push", "--context", context) // Create a new file to test propagating changes @@ -178,7 +178,7 @@ var _ = Describe("odo push command tests", func() { Context("when push command is executed", func() { It("should not build when no changes are detected in the directory and build when a file change is detected", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", context+"/nodejs-ex") output := helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") @@ -194,7 +194,7 @@ var _ = Describe("odo push command tests", func() { It("should be able to create a file, push, delete, then push again propagating the deletions", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) // Create a new file that we plan on deleting later... newFilePath := filepath.Join(context, "nodejs-ex", "foobar.txt") @@ -230,7 +230,7 @@ var _ = Describe("odo push command tests", func() { It("should build when a new file and a new folder is added in the directory", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") output := helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") @@ -264,7 +264,7 @@ var _ = Describe("odo push command tests", func() { It("should build when a file and a folder is renamed in the directory", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") output := helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") @@ -303,7 +303,7 @@ var _ = Describe("odo push command tests", func() { It("should not build when changes are detected in a ignored file", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) // create the .odoignore file and push ignoreFilePath := filepath.Join(context, "nodejs-ex", ".odoignore") @@ -324,7 +324,7 @@ var _ = Describe("odo push command tests", func() { It("should build when no changes are detected in the directory and force flag is enabled", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", context+"/nodejs-ex") @@ -335,7 +335,7 @@ var _ = Describe("odo push command tests", func() { It("should push only the modified files", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs:latest", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", context+"/nodejs-ex") helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") @@ -407,7 +407,7 @@ var _ = Describe("odo push command tests", func() { oc.ImportJavaIS(project) cmpName := "backend" helper.CopyExample(filepath.Join("source", "openjdk"), context) - helper.CmdShouldPass("odo", "create", "java:8", "backend", "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "create", "--s2i", "java:8", "backend", "--project", project, "--context", context, "--app", appName) helper.CmdShouldPass("odo", "url", "create", "--port", "8080", "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) @@ -456,7 +456,7 @@ var _ = Describe("odo push command tests", func() { fmt.Printf("the .odoignore file was not created, reason %v", err.Error()) } - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--project", project, "--context", context+"/nodejs-ex") + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--project", project, "--context", context+"/nodejs-ex") helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") // get the name of running pod @@ -482,7 +482,7 @@ var _ = Describe("odo push command tests", func() { Context("when .gitignore file exists", func() { It("should create and push the contents of a named component and include odo-file-index.json path to .gitignore file to exclude the contents", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context+"/nodejs-ex", "--app", appName) // push and include the odo-file-index.json path to .gitignore file helper.CmdShouldPass("odo", "push", "--context", filepath.Join(context, "nodejs-ex")) @@ -494,7 +494,7 @@ var _ = Describe("odo push command tests", func() { Context("when .gitignore file does not exist", func() { It("should create and push the contents of a named component and also create .gitignore then include odo-file-index.json path to .gitignore file to exclude the contents", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--app", appName) // push and include the odo-file-index.json path to .gitignore file helper.CmdShouldPass("odo", "push", "--context", context) @@ -506,7 +506,7 @@ var _ = Describe("odo push command tests", func() { Context("when running odo push with flag --show-log", func() { It("should be able to spam odo push without anything breaking", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--project", project, "--context", context+"/nodejs-ex") + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--project", project, "--context", context+"/nodejs-ex") // Iteration 1 output := helper.CmdShouldPass("odo", "push", "--show-log", "--context", context+"/nodejs-ex") Expect(output).To(Not(ContainSubstring("No file changes detected, skipping build"))) diff --git a/tests/integration/cmd_storage_test.go b/tests/integration/cmd_storage_test.go index 1ad9a4dc4fb..54c1547ab8f 100644 --- a/tests/integration/cmd_storage_test.go +++ b/tests/integration/cmd_storage_test.go @@ -43,7 +43,7 @@ var _ = Describe("odo storage command tests", func() { Context("when running storage command without required flag(s)", func() { It("should fail", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", "nodejs", "--app", "nodeapp", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", "nodejs", "--app", "nodeapp", "--project", project, "--context", context) stdErr := helper.CmdShouldFail("odo", "storage", "create", "pv1") Expect(stdErr).To(ContainSubstring("required flag")) //helper.CmdShouldFail("odo", "storage", "create", "pv1", "-o", "json") @@ -54,7 +54,7 @@ var _ = Describe("odo storage command tests", func() { It("should add a storage, list and delete it", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", "nodejs", "--app", "nodeapp", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", "nodejs", "--app", "nodeapp", "--project", project, "--context", context) // Default flag value // --app string Application, defaults to active application // --component string Component, defaults to active component. @@ -92,7 +92,7 @@ var _ = Describe("odo storage command tests", func() { Context("when using storage command with specified flag values", func() { It("should add a storage, list and delete it", func() { helper.CopyExample(filepath.Join("source", "python"), context) - helper.CmdShouldPass("odo", "component", "create", "python", "python", "--app", "pyapp", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "python", "python", "--app", "pyapp", "--project", project, "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) storAdd := helper.CmdShouldPass("odo", "storage", "create", "pv1", "--path", "/mnt/pv1", "--size", "1Gi", "--context", context) Expect(storAdd).To(ContainSubstring("python")) @@ -128,7 +128,7 @@ var _ = Describe("odo storage command tests", func() { Context("when using storage command with -o json", func() { It("should create and list output in json format", func() { helper.CopyExample(filepath.Join("source", "wildfly"), context) - helper.CmdShouldPass("odo", "component", "create", "wildfly", "wildfly", "--app", "wildflyapp", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "wildfly", "wildfly", "--app", "wildflyapp", "--project", project, "--context", context) actualJSONStorage := helper.CmdShouldPass("odo", "storage", "create", "mystorage", "--path=/opt/app-root/src/storage/", "--size=1Gi", "--context", context, "-o", "json") desiredJSONStorage := `{"kind":"storage","apiVersion":"odo.dev/v1alpha1","metadata":{"name":"mystorage","creationTimestamp":null},"spec":{"size":"1Gi","path":"/opt/app-root/src/storage/"}}` Expect(desiredJSONStorage).Should(MatchJSON(actualJSONStorage)) @@ -145,7 +145,7 @@ var _ = Describe("odo storage command tests", func() { It("should list storage with correct state", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", "nodejs", "--app", "nodeapp", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", "nodejs", "--app", "nodeapp", "--project", project, "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) // create storage, list storage should have state "Not Pushed" diff --git a/tests/integration/cmd_url_test.go b/tests/integration/cmd_url_test.go index b3226f9734d..9aacc0a0d94 100644 --- a/tests/integration/cmd_url_test.go +++ b/tests/integration/cmd_url_test.go @@ -44,7 +44,7 @@ var _ = Describe("odo url command tests", func() { url1 := helper.RandString(5) url2 := helper.RandString(5) componentName := helper.RandString(6) - helper.CmdShouldPass("odo", "create", "nodejs", "--context", context, "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex", "--port", "8080,8000") + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--context", context, "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex", "--port", "8080,8000") helper.CmdShouldPass("odo", "push", "--context", context) stdout = helper.CmdShouldFail("odo", "url", "list", "--context", context) Expect(stdout).To(ContainSubstring("no URLs found")) @@ -75,7 +75,7 @@ var _ = Describe("odo url command tests", func() { url1 := helper.RandString(5) componentName := helper.RandString(6) helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "create", "nodejs", "--context", context, "--project", project, componentName) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--context", context, "--project", project, componentName) helper.CmdShouldPass("odo", "url", "create", url1, "--port", "8080", "--context", context, "--secure") @@ -100,7 +100,7 @@ var _ = Describe("odo url command tests", func() { var stdout string url1 := helper.RandString(5) componentName := helper.RandString(6) - helper.CmdShouldPass("odo", "create", "nodejs", "--context", context, "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex", "--port", "8080,8000") + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--context", context, "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex", "--port", "8080,8000") helper.CmdShouldPass("odo", "url", "create", url1, "--port", "8080", "--context", context) stdout = helper.CmdShouldPass("odo", "url", "describe", url1, "--context", context) @@ -117,7 +117,7 @@ var _ = Describe("odo url command tests", func() { }) It("should be able to describe a url in CLI format and machine readable json format for a secure url", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--app", "myapp", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--app", "myapp", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context) helper.CmdShouldPass("odo", "url", "create", "myurl", "--secure", "--context", context) actualURLDescribeJSON := helper.CmdShouldPass("odo", "url", "describe", "myurl", "-o", "json", "--context", context) @@ -146,7 +146,7 @@ var _ = Describe("odo url command tests", func() { helper.Chdir(originalDir) }) It("should be able to list url in machine readable json format", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--app", "myapp", "--project", project, "--git", "https://github.com/openshift/nodejs-ex") + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--app", "myapp", "--project", project, "--git", "https://github.com/openshift/nodejs-ex") helper.CmdShouldPass("odo", "url", "create", "myurl") helper.CmdShouldPass("odo", "push") @@ -159,7 +159,7 @@ var _ = Describe("odo url command tests", func() { }) It("should be able to list url in machine readable json format for a secure url", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--app", "myapp", "--project", project, "--git", "https://github.com/openshift/nodejs-ex") + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--app", "myapp", "--project", project, "--git", "https://github.com/openshift/nodejs-ex") helper.CmdShouldPass("odo", "url", "create", "myurl", "--secure") actualURLListJSON := helper.CmdShouldPass("odo", "url", "list", "-o", "json") desiredURLListJSON := `{"kind":"List","apiVersion":"odo.dev/v1alpha1","metadata":{},"items":[{"kind":"url","apiVersion":"odo.dev/v1alpha1","metadata":{"name":"myurl","creationTimestamp":null},"spec":{"port":8080,"secure":true,"kind": "route"},"status":{"state": "Not Pushed"}}]}` @@ -181,7 +181,7 @@ var _ = Describe("odo url command tests", func() { url1 := helper.RandString(5) componentName := helper.RandString(6) helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "create", "nodejs", "--context", context, "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex", "--port", "8080,8000") + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--context", context, "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex", "--port", "8080,8000") helper.CmdShouldPass("odo", "url", "create", url1, "--context", context, "--port", "8080", "--now") out1 := helper.CmdShouldPass("odo", "url", "list", "--context", context) helper.MatchAllInOutput(out1, []string{url1, "Pushed", url1}) diff --git a/tests/integration/cmd_watch_test.go b/tests/integration/cmd_watch_test.go index 4d49baf273c..20ca449ea3b 100644 --- a/tests/integration/cmd_watch_test.go +++ b/tests/integration/cmd_watch_test.go @@ -45,7 +45,7 @@ var _ = Describe("odo watch command tests", func() { Context("when executing watch without pushing the component", func() { It("should fail", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", "--project", project, "--context", context) output := helper.CmdShouldFail("odo", "watch", "--context", context) Expect(output).To(ContainSubstring("component does not exist. Please use `odo push` to create your component")) }) @@ -61,7 +61,7 @@ var _ = Describe("odo watch command tests", func() { }) It("should fail with proper error", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs", "--project", project) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs", "--project", project) output := helper.CmdShouldFail("odo", "watch", "--app", "dummy") Expect(output).To(ContainSubstring("component does not exist")) }) @@ -69,7 +69,7 @@ var _ = Describe("odo watch command tests", func() { Context("when executing watch on a git source type component", func() { It("should fail", func() { - helper.CmdShouldPass("odo", "create", "--context", context, "nodejs", "--git", "https://github.com/openshift/nodejs-ex.git") + helper.CmdShouldPass("odo", "create", "--s2i", "--context", context, "nodejs", "--git", "https://github.com/openshift/nodejs-ex.git") output := helper.CmdShouldFail("odo", "watch", "--context", context) Expect(output).To(ContainSubstring("Watch is supported by binary and local components only")) }) diff --git a/tests/integration/component.go b/tests/integration/component.go index ca4608a1e72..1e714ce9ec4 100644 --- a/tests/integration/component.go +++ b/tests/integration/component.go @@ -61,7 +61,7 @@ func componentTests(args ...string) { }) It("should create component even in new project", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--project", project, "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--project", project, "--context", context, "--app", "testing")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,cmp-git", "Application,testing") helper.CmdShouldPass("odo", append(args, "push", "--context", context, "-v4")...) oc.SwitchProject(project) @@ -70,7 +70,7 @@ func componentTests(args ...string) { }) It("shouldn't error when creating a component with --project and --context at the same time", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--project", project, "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--project", project, "--context", context, "--app", "testing")...) helper.CmdShouldPass("odo", append(args, "push", "--context", context, "-v4")...) oc.SwitchProject(project) projectList := helper.CmdShouldPass("odo", "project", "list") @@ -78,13 +78,13 @@ func componentTests(args ...string) { }) It("should error when listing components (basically anything other then creating) with --project and --context ", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--project", project, "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--project", project, "--context", context, "--app", "testing")...) helper.CmdShouldFail("odo", "list", "--project", project, "--context", context) }) It("Without an application should create one", func() { componentName := helper.RandString(6) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+componentName, "Application,app") helper.CmdShouldPass("odo", append(args, "push")...) appName := helper.CmdShouldPass("odo", "app", "list") @@ -104,30 +104,30 @@ func componentTests(args ...string) { It("should create default named component when passed same context differently", func() { dir := filepath.Base(context) helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "--project", project, "--context", ".", "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "--project", project, "--context", ".", "--app", "testing")...) componentName := helper.GetConfigValueWithContext("Name", context) Expect(componentName).To(ContainSubstring("nodejs-" + dir)) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+componentName, "Application,testing") helper.DeleteDir(filepath.Join(context, ".odo")) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "--project", project, "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "--project", project, "--context", context, "--app", "testing")...) newComponentName := helper.GetConfigValueWithContext("Name", context) Expect(newComponentName).To(ContainSubstring("nodejs-" + dir)) }) It("should show an error when ref flag is provided with sources except git", func() { - outputErr := helper.CmdShouldFail("odo", append(args, "create", "nodejs", "--project", project, "cmp-git", "--ref", "test")...) + outputErr := helper.CmdShouldFail("odo", append(args, "create", "--s2i", "nodejs", "--project", project, "cmp-git", "--ref", "test")...) Expect(outputErr).To(ContainSubstring("the --ref flag is only valid for --git flag")) }) It("create component twice fails from same directory", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "nodejs", "--project", project)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "nodejs", "--project", project)...) output := helper.CmdShouldFail("odo", append(args, "create", "nodejs", "nodejs", "--project", project)...) Expect(output).To(ContainSubstring("this directory already contains a component")) }) It("should list out component in json format along with path flag", func() { var contextPath string - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "nodejs", "--project", project)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "nodejs", "--project", project)...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,nodejs", "Application,app") if runtime.GOOS == "windows" { contextPath = strings.Replace(strings.TrimSpace(context), "\\", "\\\\", -1) @@ -149,7 +149,7 @@ func componentTests(args ...string) { var contextPath string var contextPath2 string helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "nodejs", "--project", project)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "nodejs", "--project", project)...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,nodejs", "Application,app") helper.CmdShouldPass("odo", append(args, "push")...) @@ -157,7 +157,7 @@ func componentTests(args ...string) { context2 := helper.CreateNewContext() helper.Chdir(context2) helper.CopyExample(filepath.Join("source", "python"), context2) - helper.CmdShouldPass("odo", append(args, "create", "python", "python", "--project", project2)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "python", "python", "--project", project2)...) helper.ValidateLocalCmpExist(context2, "Type,python", "Name,python", "Application,app") helper.CmdShouldPass("odo", append(args, "push")...) @@ -186,7 +186,7 @@ func componentTests(args ...string) { }) It("should list the component", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,cmp-git", "Application,testing") helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) @@ -201,14 +201,14 @@ func componentTests(args ...string) { }) It("should list the component when it is not pushed", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,cmp-git", "Application,testing") cmpList := helper.CmdShouldPass("odo", append(args, "list", "--context", context)...) helper.MatchAllInOutput(cmpList, []string{"cmp-git", "Not Pushed"}) helper.CmdShouldPass("odo", append(args, "delete", "-f", "--all", "--context", context)...) }) It("should list the state as unknown for disconnected cluster", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,cmp-git", "Application,testing") kubeconfigOrig := os.Getenv("KUBECONFIG") os.Setenv("KUBECONFIG", "/no/such/path") @@ -225,7 +225,7 @@ func componentTests(args ...string) { }) It("should describe the component when it is not pushed", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) helper.CmdShouldPass("odo", "url", "create", "url-1", "--context", context) helper.CmdShouldPass("odo", "url", "create", "url-2", "--context", context) helper.CmdShouldPass("odo", "storage", "create", "storage-1", "--size", "1Gi", "--path", "/data1", "--context", context) @@ -255,7 +255,7 @@ func componentTests(args ...string) { It("should describe not pushed component when it is created with json output", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - cmpDescribeJSON, err := helper.Unindented(helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--context", context, "--app", "testing", "-o", "json")...)) + cmpDescribeJSON, err := helper.Unindented(helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--context", context, "--app", "testing", "-o", "json")...)) Expect(err).Should(BeNil()) expected, err := helper.Unindented(`{"kind": "Component","apiVersion": "odo.dev/v1alpha1","metadata": {"name": "cmp-git","namespace": "` + project + `","creationTimestamp": null},"spec":{"app": "testing","type":"nodejs","source": "file://./","sourceType": "local","ports": ["8080/TCP"]}, "status": {"state": "Not Pushed"}}`) Expect(err).Should(BeNil()) @@ -265,7 +265,7 @@ func componentTests(args ...string) { It("should describe pushed component when it is created with json output", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - cmpDescribeJSON, err := helper.Unindented(helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--context", context, "--app", "testing", "-o", "json", "--now")...)) + cmpDescribeJSON, err := helper.Unindented(helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--context", context, "--app", "testing", "-o", "json", "--now")...)) Expect(err).Should(BeNil()) expected, err := helper.Unindented(`{"kind": "Component","apiVersion": "odo.dev/v1alpha1","metadata": {"name": "cmp-git","namespace": "` + project + `","creationTimestamp": null},"spec":{"app": "testing","type":"nodejs","sourceType": "local","env": [{"name": "DEBUG_PORT","value": "5858"}],"ports": ["8080/TCP"]}, "status": {"state": "Pushed"}}`) Expect(err).Should(BeNil()) @@ -275,12 +275,12 @@ func componentTests(args ...string) { It("should list the component in the same app when one is pushed and the other one is not pushed", func() { helper.Chdir(originalDir) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,cmp-git", "Application,testing") helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) context2 := helper.CreateNewContext() - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git-2", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context2, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git-2", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context2, "--app", "testing")...) helper.ValidateLocalCmpExist(context2, "Type,nodejs", "Name,cmp-git-2", "Application,testing") cmpList := helper.CmdShouldPass("odo", append(args, "list", "--context", context2)...) helper.MatchAllInOutput(cmpList, []string{"cmp-git", "cmp-git-2", "Not Pushed", "Pushed"}) @@ -302,7 +302,7 @@ func componentTests(args ...string) { oc.ImportJavaIS(project) helper.CopyExample(filepath.Join("binary", "java", "openjdk"), context) // Was failing due to https://github.com/openshift/odo/issues/1969 - helper.CmdShouldPass("odo", append(args, "create", "java:8", "sb-jar-test", "--project", + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "java:8", "sb-jar-test", "--project", project, "--binary", filepath.Join(context, "sb.jar"))...) helper.ValidateLocalCmpExist(context, "Type,java:8", "Name,sb-jar-test") }) @@ -314,7 +314,7 @@ func componentTests(args ...string) { newContext := helper.CreateNewContext() defer helper.DeleteDir(newContext) - output := helper.CmdShouldFail("odo", append(args, "create", "java:8", "sb-jar-test", "--project", + output := helper.CmdShouldFail("odo", append(args, "create", "--s2i", "java:8", "sb-jar-test", "--project", project, "--binary", filepath.Join(context, "sb.jar"), "--context", newContext)...) Expect(output).To(ContainSubstring("inside of the context directory")) }) @@ -326,7 +326,7 @@ func componentTests(args ...string) { relativeContext := fmt.Sprintf("..%c%s", filepath.Separator, filepath.Base(context)) fmt.Printf("relativeContext = %#v\n", relativeContext) - helper.CmdShouldPass("odo", append(args, "create", "java:8", "sb-jar-test", "--project", + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "java:8", "sb-jar-test", "--project", project, "--binary", filepath.Join(context, "sb.jar"), "--context", relativeContext)...) helper.ValidateLocalCmpExist(relativeContext, "Type,java:8", "Name,sb-jar-test") }) @@ -349,7 +349,7 @@ func componentTests(args ...string) { cmpName := "nodejs" helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--project", project)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--project", project)...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+cmpName, "Application,"+appName) // component doesn't exist yet so attempt to only push source should fail @@ -379,7 +379,7 @@ func componentTests(args ...string) { cmpName := "nodejs-push-atonce" helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--project", project)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--project", project)...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+cmpName, "Application,"+appName) // Push only config and see that the component is created but wothout any source copied helper.CmdShouldPass("odo", append(args, "push")...) @@ -405,7 +405,7 @@ func componentTests(args ...string) { cmpName := "nodejs" helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--context", context, "--app", appName, "--project", project)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--context", context, "--app", appName, "--project", project)...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+cmpName, "Application,"+appName) // component doesn't exist yet so attempt to only push source should fail @@ -435,7 +435,7 @@ func componentTests(args ...string) { cmpName := "nodejs-push-atonce" helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--context", context, "--project", project)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--context", context, "--project", project)...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+cmpName, "Application,"+appName) // Push both config and source @@ -465,7 +465,7 @@ func componentTests(args ...string) { helper.DeleteProject(project) }) It("should create component", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--project", project, "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--project", project, "--context", context, "--app", "testing")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,cmp-git", "Application,testing") helper.CmdShouldPass("odo", append(args, "push", "--context", context, "-v4")...) oc.SwitchProject(project) @@ -488,7 +488,7 @@ func componentTests(args ...string) { appName := "nodejs-create-now-test" cmpName := "nodejs-push-atonce" helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--project", project, "--now")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--project", project, "--now")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+cmpName, "Application,"+appName) oc.VerifyCmpExists(cmpName, appName, project) @@ -523,14 +523,14 @@ func componentTests(args ...string) { It("create local nodejs component twice and fail", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "--project", project, "--env", "key=value,key1=value1")...) - output := helper.CmdShouldFail("odo", append(args, "create", "nodejs", "--project", project, "--env", "key=value,key1=value1")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "--project", project, "--env", "key=value,key1=value1")...) + output := helper.CmdShouldFail("odo", append(args, "create", "--s2i", "nodejs", "--project", project, "--env", "key=value,key1=value1")...) Expect(output).To(ContainSubstring("this directory already contains a component")) }) It("creates and pushes local nodejs component and then deletes --all", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", componentName, "--app", appName, "--project", project, "--env", "key=value,key1=value1")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", componentName, "--app", appName, "--project", project, "--env", "key=value,key1=value1")...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+componentName, "Application,"+appName) helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) helper.CmdShouldPass("odo", append(args, "delete", "--context", context, "-f", "--all")...) @@ -542,7 +542,7 @@ func componentTests(args ...string) { It("creates a local python component, pushes it and then deletes it using --all flag", func() { helper.CopyExample(filepath.Join("source", "python"), context) - helper.CmdShouldPass("odo", append(args, "create", "python", componentName, "--app", appName, "--project", project, "--context", context)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "python", componentName, "--app", appName, "--project", project, "--context", context)...) helper.ValidateLocalCmpExist(context, "Type,python", "Name,"+componentName, "Application,"+appName) helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) helper.CmdShouldPass("odo", append(args, "delete", "--context", context, "-f")...) @@ -555,7 +555,7 @@ func componentTests(args ...string) { It("creates a local python component, pushes it and then deletes it using --all flag in local directory", func() { helper.CopyExample(filepath.Join("source", "python"), context) - helper.CmdShouldPass("odo", append(args, "create", "python", componentName, "--app", appName, "--project", project)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "python", componentName, "--app", appName, "--project", project)...) helper.ValidateLocalCmpExist(context, "Type,python", "Name,"+componentName, "Application,"+appName) helper.CmdShouldPass("odo", append(args, "push")...) helper.CmdShouldPass("odo", append(args, "delete", "--all", "-f")...) @@ -568,19 +568,19 @@ func componentTests(args ...string) { It("creates a local python component and check for unsupported warning", func() { helper.CopyExample(filepath.Join("source", "python"), context) - output := helper.CmdShouldPass("odo", append(args, "create", "python", componentName, "--app", appName, "--project", project, "--context", context)...) + output := helper.CmdShouldPass("odo", append(args, "create", "--s2i", "python", componentName, "--app", appName, "--project", project, "--context", context)...) Expect(output).To(ContainSubstring("Warning: python is not fully supported by odo, and it is not guaranteed to work")) }) It("creates a local nodejs component and check unsupported warning hasn't occured", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - output := helper.CmdShouldPass("odo", append(args, "create", "nodejs:latest", componentName, "--app", appName, "--project", project, "--context", context)...) + output := helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs:latest", componentName, "--app", appName, "--project", project, "--context", context)...) Expect(output).NotTo(ContainSubstring("Warning")) }) It("creates a local java component and check unsupported warning hasn't occured", func() { helper.CopyExample(filepath.Join("binary", "java", "openjdk"), context) - output := helper.CmdShouldPass("odo", append(args, "create", "java:latest", componentName, "--project", project, "--context", context)...) + output := helper.CmdShouldPass("odo", append(args, "create", "--s2i", "java:latest", componentName, "--project", project, "--context", context)...) Expect(output).NotTo(ContainSubstring("Warning")) }) }) @@ -596,7 +596,7 @@ func componentTests(args ...string) { It("should be able to create a git component and update it from local to git", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--context", context, "--app", "testing")...) helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) helper.CmdShouldPass("odo", "update", "--git", "https://github.com/openshift/nodejs-ex.git", "--context", context) @@ -608,7 +608,7 @@ func componentTests(args ...string) { }) It("should be able to update a component from git to local", func() { - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "cmp-git", "--project", project, "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing")...) helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) // update the component config according to the git component @@ -640,7 +640,7 @@ func componentTests(args ...string) { It("should pass inside a odo directory without component name as parameter", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) helper.CmdShouldPass("odo", "url", "create", "example", "--context", context) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+cmpName, "Application,"+appName, "URL,0,Name,example") helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) @@ -660,7 +660,7 @@ func componentTests(args ...string) { It("should fail outside a odo directory without component name as parameter", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+cmpName, "Application,"+appName) helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) @@ -673,7 +673,7 @@ func componentTests(args ...string) { It("should pass outside a odo directory with component name as parameter", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) helper.ValidateLocalCmpExist(context, "Type,nodejs", "Name,"+cmpName, "Application,"+appName) helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) @@ -704,7 +704,7 @@ func componentTests(args ...string) { componentName := helper.RandString(6) appName := helper.RandString(6) helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", componentName, "--app", appName, "--project", project, "--context", context)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", componentName, "--app", appName, "--project", project, "--context", context)...) helper.CmdShouldPass("odo", append(args, "push", "--context", context)...) helper.Chdir(context) @@ -739,7 +739,7 @@ func componentTests(args ...string) { It("should create default named component in a directory with numeric name", func() { helper.CopyExample(filepath.Join("source", "nodejs"), contextNumeric) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", "--project", project, "--context", contextNumeric, "--app", "testing")...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", "--project", project, "--context", contextNumeric, "--app", "testing")...) helper.ValidateLocalCmpExist(contextNumeric, "Type,nodejs", "Application,testing") helper.CmdShouldPass("odo", append(args, "push", "--context", contextNumeric, "-v4")...) }) @@ -775,7 +775,7 @@ func componentTests(args ...string) { helper.CopyExample(filepath.Join("binary", "java", "openjdk"), context) // create the component using symlink - helper.CmdShouldPass("odo", append(args, "create", "java:8", "sb-jar-test", "--project", + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "java:8", "sb-jar-test", "--project", project, "--binary", filepath.Join(symLinkPath, "sb.jar"), "--context", symLinkPath)...) // Create a URL and push without using the symlink @@ -793,7 +793,7 @@ func componentTests(args ...string) { It("Should be able to deploy a wildfly war file using symlinks in some odo commands", func() { helper.CopyExample(filepath.Join("binary", "java", "wildfly"), context) - helper.CmdShouldPass("odo", append(args, "create", "wildfly", "javaee-war-test", "--project", + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "wildfly", "javaee-war-test", "--project", project, "--binary", filepath.Join(symLinkPath, "ROOT.war"), "--context", symLinkPath)...) // Create a URL @@ -824,7 +824,7 @@ func componentTests(args ...string) { It("should delete the component and the owned resources", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) helper.CmdShouldPass("odo", "url", "create", "example-1", "--context", context) helper.CmdShouldPass("odo", "storage", "create", "storage-1", "--size", "1Gi", "--path", "/data1", "--context", context) @@ -847,7 +847,7 @@ func componentTests(args ...string) { It("should delete the component and the owned resources with wait flag", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", append(args, "create", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) + helper.CmdShouldPass("odo", append(args, "create", "--s2i", "nodejs", cmpName, "--app", appName, "--project", project, "--context", context)...) helper.CmdShouldPass("odo", "url", "create", "example-1", "--context", context) helper.CmdShouldPass("odo", "storage", "create", "storage-1", "--size", "1Gi", "--path", "/data1", "--context", context) diff --git a/tests/integration/debug/cmd_debug_test.go b/tests/integration/debug/cmd_debug_test.go index 3d350e0414f..315d1990402 100644 --- a/tests/integration/debug/cmd_debug_test.go +++ b/tests/integration/debug/cmd_debug_test.go @@ -48,7 +48,7 @@ var _ = Describe("odo debug command serial tests", func() { It("should auto-select a local debug port when the given local port is occupied", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "nodejs-cmp-"+namespace, "--project", namespace, "--context", context) + helper.CmdShouldPass("odo", "component", "create", "--s2i", "nodejs:latest", "nodejs-cmp-"+namespace, "--project", namespace, "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) stopChannel := make(chan bool) diff --git a/tests/integration/devfile/cmd_devfile_catalog_test.go b/tests/integration/devfile/cmd_devfile_catalog_test.go index 5eb8df20808..a938526cfb4 100644 --- a/tests/integration/devfile/cmd_devfile_catalog_test.go +++ b/tests/integration/devfile/cmd_devfile_catalog_test.go @@ -24,7 +24,6 @@ var _ = Describe("odo devfile catalog command tests", func() { SetDefaultEventuallyTimeout(10 * time.Minute) context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) diff --git a/tests/integration/devfile/cmd_devfile_create_test.go b/tests/integration/devfile/cmd_devfile_create_test.go index 71022e50803..35b0fb0280a 100644 --- a/tests/integration/devfile/cmd_devfile_create_test.go +++ b/tests/integration/devfile/cmd_devfile_create_test.go @@ -25,7 +25,6 @@ var _ = Describe("odo devfile create command tests", func() { SetDefaultEventuallyTimeout(10 * time.Minute) context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) namespace = cliRunner.CreateRandNamespaceProject() @@ -44,48 +43,51 @@ var _ = Describe("odo devfile create command tests", func() { os.Unsetenv("GLOBALODOCONFIG") }) - Context("Enabling experimental preference should show a disclaimer", func() { - It("checks that the experimental warning appears for create", func() { - helper.CopyExample(filepath.Join("source", "nodejs"), context) + // These tests no longer matter + /* + Context("Enabling experimental preference should show a disclaimer", func() { + It("checks that the experimental warning appears for create", func() { + helper.CopyExample(filepath.Join("source", "nodejs"), context) - // Check that it will contain the experimental mode output - experimentalOutputMsg := "Experimental mode is enabled, use at your own risk" - Expect(helper.CmdShouldPass("odo", "create", "nodejs")).To(ContainSubstring(experimentalOutputMsg)) + // Check that it will contain the experimental mode output + experimentalOutputMsg := "Experimental mode is enabled, use at your own risk" + Expect(helper.CmdShouldPass("odo", "create", "nodejs")).To(ContainSubstring(experimentalOutputMsg)) + }) }) - }) - Context("Disabling experimental preference should show a disclaimer", func() { - JustBeforeEach(func() { - if os.Getenv("KUBERNETES") == "true" { - Skip("Skipping test because s2i image is not supported on Kubernetes cluster") - } - }) - It("checks that the experimental warning does *not* appear when Experimental is set to false for create", func() { - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "false", "-f") - helper.CopyExample(filepath.Join("source", "nodejs"), context) + Context("Disabling experimental preference should show a disclaimer", func() { + JustBeforeEach(func() { + if os.Getenv("KUBERNETES") == "true" { + Skip("Skipping test because s2i image is not supported on Kubernetes cluster") + } + }) + It("checks that the experimental warning does *not* appear when Experimental is set to false for create", func() { + helper.CmdShouldPass("odo", "preference", "set", "Experimental", "false", "-f") + helper.CopyExample(filepath.Join("source", "nodejs"), context) - // Check that it will contain the experimental mode output - experimentalOutputMsg := "Experimental mode is enabled, use at your own risk" - Expect(helper.CmdShouldPass("odo", "create", "nodejs")).To(Not(ContainSubstring(experimentalOutputMsg))) + // Check that it will contain the experimental mode output + experimentalOutputMsg := "Experimental mode is enabled, use at your own risk" + Expect(helper.CmdShouldPass("odo", "create", "nodejs")).To(Not(ContainSubstring(experimentalOutputMsg))) + }) }) - }) - Context("Disabling experimental preference should error out on providing --s2i flag", func() { - JustBeforeEach(func() { - if os.Getenv("KUBERNETES") == "true" { - Skip("Skipping test because s2i image is not supported on Kubernetes cluster") - } - }) - It("checks that the --s2i flag is unrecognised when Experimental is set to false for create", func() { - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "false", "-f") - helper.CopyExample(filepath.Join("source", "nodejs"), context) + Context("Disabling experimental preference should error out on providing --s2i flag", func() { + JustBeforeEach(func() { + if os.Getenv("KUBERNETES") == "true" { + Skip("Skipping test because s2i image is not supported on Kubernetes cluster") + } + }) + It("checks that the --s2i flag is unrecognised when Experimental is set to false for create", func() { + helper.CmdShouldPass("odo", "preference", "set", "Experimental", "false", "-f") + helper.CopyExample(filepath.Join("source", "nodejs"), context) - // Check that it will contain the experimental mode output - s2iFlagUnknownMsg := "Error: unknown flag: --s2i" - Expect(helper.CmdShouldFail("odo", "create", "nodejs", "--s2i")).To(ContainSubstring(s2iFlagUnknownMsg)) + // Check that it will contain the experimental mode output + s2iFlagUnknownMsg := "Error: unknown flag: --s2i" + Expect(helper.CmdShouldFail("odo", "create", "nodejs", "--s2i")).To(ContainSubstring(s2iFlagUnknownMsg)) + }) }) - }) + */ Context("When executing odo create with devfile component type argument", func() { It("should successfully create the devfile component", func() { @@ -170,20 +172,20 @@ var _ = Describe("odo devfile create command tests", func() { It("should fail the create command as --git flag, which is specific to s2i component creation, is used without --s2i flag", func() { output := helper.CmdShouldFail("odo", "create", "nodejs", "cmp-git", "--git", "https://github.com/openshift/nodejs-ex", "--context", context, "--app", "testing") - Expect(output).Should(ContainSubstring("flag --git, requires --s2i flag to be set, when in experimental mode.")) + Expect(output).Should(ContainSubstring("flag --git, requires --s2i flag to be set, when deploying S2I (Source-to-Image).")) }) It("should fail the create command as --binary flag, which is specific to s2i component creation, is used without --s2i flag", func() { helper.CopyExample(filepath.Join("binary", "java", "openjdk"), context) output := helper.CmdShouldFail("odo", "create", "java:8", "sb-jar-test", "--binary", filepath.Join(context, "sb.jar"), "--context", context) - Expect(output).Should(ContainSubstring("flag --binary, requires --s2i flag to be set, when in experimental mode.")) + Expect(output).Should(ContainSubstring("flag --binary, requires --s2i flag to be set, when deploying S2I (Source-to-Image).")) }) It("should fail the create command as --now flag, which is specific to s2i component creation, is used without --s2i flag", func() { componentName := helper.RandString(6) output := helper.CmdShouldFail("odo", "create", "nodejs", componentName, "--now") - Expect(output).Should(ContainSubstring("flag --now, requires --s2i flag to be set, when in experimental mode.")) + Expect(output).Should(ContainSubstring("flag --now, requires --s2i flag to be set, when deploying S2I (Source-to-Image).")) }) }) diff --git a/tests/integration/devfile/cmd_devfile_debug_test.go b/tests/integration/devfile/cmd_devfile_debug_test.go index b21e7da0fb1..d4c13118bb7 100644 --- a/tests/integration/devfile/cmd_devfile_debug_test.go +++ b/tests/integration/devfile/cmd_devfile_debug_test.go @@ -29,9 +29,6 @@ var _ = Describe("odo devfile debug command tests", func() { context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - // Devfile push requires experimental mode to be set - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") - originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) namespace = cliRunner.CreateRandNamespaceProject() diff --git a/tests/integration/devfile/cmd_devfile_delete_test.go b/tests/integration/devfile/cmd_devfile_delete_test.go index 84dc9c2ce62..e7f568f985b 100644 --- a/tests/integration/devfile/cmd_devfile_delete_test.go +++ b/tests/integration/devfile/cmd_devfile_delete_test.go @@ -25,9 +25,6 @@ var _ = Describe("odo devfile delete command tests", func() { context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - // Devfile commands require experimental mode to be set - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") - originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) namespace = cliRunner.CreateRandNamespaceProject() diff --git a/tests/integration/devfile/cmd_devfile_log_test.go b/tests/integration/devfile/cmd_devfile_log_test.go index 605f254b744..59bf85a280a 100644 --- a/tests/integration/devfile/cmd_devfile_log_test.go +++ b/tests/integration/devfile/cmd_devfile_log_test.go @@ -23,9 +23,6 @@ var _ = Describe("odo devfile log command tests", func() { context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - // Devfile push requires experimental mode to be set - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") - originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) namespace = cliRunner.CreateRandNamespaceProject() diff --git a/tests/integration/devfile/cmd_devfile_push_test.go b/tests/integration/devfile/cmd_devfile_push_test.go index d4a9a362748..de8688da6ab 100644 --- a/tests/integration/devfile/cmd_devfile_push_test.go +++ b/tests/integration/devfile/cmd_devfile_push_test.go @@ -27,9 +27,6 @@ var _ = Describe("odo devfile push command tests", func() { context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - // Devfile push requires experimental mode to be set - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") - originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) namespace = cliRunner.CreateRandNamespaceProject() @@ -676,7 +673,6 @@ var _ = Describe("odo devfile push command tests", func() { Expect(output).To(ContainSubstring(cmpName)) Expect(output).To(ContainSubstring(cmpName2)) - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "false") helper.DeleteDir(context2) }) @@ -702,15 +698,12 @@ var _ = Describe("odo devfile push command tests", func() { context2 := helper.CreateNewContext() cmpName2 := helper.RandString(6) appName := helper.RandString(6) - helper.CmdShouldPass("odo", "preference", "set", "--force", "Experimental", "false") helper.CopyExample(filepath.Join("source", "nodejs"), context2) helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, "--app", appName, "--context", context2, cmpName2) output2 := helper.CmdShouldPass("odo", "push", "--context", context2) Expect(output2).To(ContainSubstring("Changes successfully pushed to component")) - helper.CmdShouldPass("odo", "preference", "set", "--force", "Experimental", "true") - output = helper.CmdShouldPass("odo", "list", "--all-apps", "--project", namespace) Expect(output).To(ContainSubstring(cmpName)) diff --git a/tests/integration/devfile/cmd_devfile_registry_test.go b/tests/integration/devfile/cmd_devfile_registry_test.go index 05c9b7c39fa..e69f4b5806d 100644 --- a/tests/integration/devfile/cmd_devfile_registry_test.go +++ b/tests/integration/devfile/cmd_devfile_registry_test.go @@ -24,8 +24,6 @@ var _ = Describe("odo devfile registry command tests", func() { SetDefaultEventuallyTimeout(10 * time.Minute) context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") - originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) project = cliRunner.CreateRandNamespaceProject() diff --git a/tests/integration/devfile/cmd_devfile_test_test.go b/tests/integration/devfile/cmd_devfile_test_test.go index 11f7326cc98..97bfdb20e27 100644 --- a/tests/integration/devfile/cmd_devfile_test_test.go +++ b/tests/integration/devfile/cmd_devfile_test_test.go @@ -22,8 +22,6 @@ var _ = Describe("odo devfile test command tests", func() { SetDefaultEventuallyTimeout(10 * time.Minute) context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") - originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) namespace = cliRunner.CreateRandNamespaceProject() diff --git a/tests/integration/devfile/cmd_devfile_url_test.go b/tests/integration/devfile/cmd_devfile_url_test.go index d39afc52a0d..960754c21ad 100644 --- a/tests/integration/devfile/cmd_devfile_url_test.go +++ b/tests/integration/devfile/cmd_devfile_url_test.go @@ -31,9 +31,6 @@ var _ = Describe("odo devfile url command tests", func() { currentWorkingDirectory = helper.Getwd() componentName = helper.RandString(6) helper.Chdir(context) - - // Devfile push requires experimental mode to be set - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") }) // Clean up after the test diff --git a/tests/integration/devfile/cmd_devfile_watch_test.go b/tests/integration/devfile/cmd_devfile_watch_test.go index 52be52abced..73861cedde4 100644 --- a/tests/integration/devfile/cmd_devfile_watch_test.go +++ b/tests/integration/devfile/cmd_devfile_watch_test.go @@ -31,9 +31,6 @@ var _ = Describe("odo devfile watch command tests", func() { currentWorkingDirectory = helper.Getwd() cmpName = helper.RandString(6) helper.Chdir(context) - - // Set experimental mode to true - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") }) // Clean up after the test diff --git a/tests/integration/devfile/debug/cmd_devfile_debug_test.go b/tests/integration/devfile/debug/cmd_devfile_debug_test.go index ae35ab105d5..5effc36c672 100644 --- a/tests/integration/devfile/debug/cmd_devfile_debug_test.go +++ b/tests/integration/devfile/debug/cmd_devfile_debug_test.go @@ -38,9 +38,6 @@ var _ = Describe("odo devfile debug command serial tests", func() { context = helper.CreateNewContext() os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) - // Devfile push requires experimental mode to be set - helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") - originalKubeconfig = os.Getenv("KUBECONFIG") helper.LocalKubeconfigSet(context) namespace = cliRunner.CreateRandNamespaceProject() diff --git a/tests/integration/generic_test.go b/tests/integration/generic_test.go index 9d1a1ad79f1..60a317c44c2 100644 --- a/tests/integration/generic_test.go +++ b/tests/integration/generic_test.go @@ -131,7 +131,7 @@ var _ = Describe("odo generic", func() { os.Unsetenv("GLOBALODOCONFIG") }) It("should create the component in default application", func() { - helper.CmdShouldPass("odo", "create", "php", "testcmp", "--app", "e2e-xyzk", "--project", project, "--git", testPHPGitURL) + helper.CmdShouldPass("odo", "create", "--s2i", "php", "testcmp", "--app", "e2e-xyzk", "--project", project, "--git", testPHPGitURL) helper.CmdShouldPass("odo", "config", "set", "Ports", "8080/TCP", "-f") helper.CmdShouldPass("odo", "push") oc.VerifyCmpName("testcmp", project) @@ -156,7 +156,7 @@ var _ = Describe("odo generic", func() { os.Unsetenv("GLOBALODOCONFIG") }) It("should pass to build component if the given build timeout is more than the default(300s) value", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--project", project, "--git", testNodejsGitURL) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--project", project, "--git", testNodejsGitURL) helper.CmdShouldPass("odo", "preference", "set", "BuildTimeout", "600") buildTimeout := helper.GetPreferenceValue("BuildTimeout") helper.MatchAllInOutput(buildTimeout, []string{"600"}) @@ -164,7 +164,7 @@ var _ = Describe("odo generic", func() { }) It("should fail to build component if the given build timeout is pretty less(2s)", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--project", project, "--git", testNodejsGitURL) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--project", project, "--git", testNodejsGitURL) helper.CmdShouldPass("odo", "preference", "set", "BuildTimeout", "2") buildTimeout := helper.GetPreferenceValue("BuildTimeout") helper.MatchAllInOutput(buildTimeout, []string{"2"}) @@ -186,7 +186,7 @@ var _ = Describe("odo generic", func() { os.Unsetenv("GLOBALODOCONFIG") }) It("should be able to create a php component with application created", func() { - helper.CmdShouldPass("odo", "create", "php", "testcmp", "--app", "testing", "--project", project, "--ref", "master", "--git", testPHPGitURL, "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "php", "testcmp", "--app", "testing", "--project", project, "--ref", "master", "--git", testPHPGitURL, "--context", context) helper.CmdShouldPass("odo", "push", "--context", context) currentProject := helper.CreateRandProject() currentAppNames := helper.CmdShouldPass("odo", "app", "list", "--project", currentProject) @@ -211,7 +211,7 @@ var _ = Describe("odo generic", func() { }) It("should be able to push changes", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "create", "nodejs", "nodejs", "--project", project, "--context", context) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "nodejs", "--project", project, "--context", context) // Push the changes with --show-log getLogging := helper.CmdShouldPass("odo", "push", "--show-log", "--context", context) @@ -233,7 +233,7 @@ var _ = Describe("odo generic", func() { }) It("should deploy the component", func() { helper.CmdShouldPass("git", "clone", "https://github.com/openshift/nodejs-ex", context+"/nodejs-ex") - helper.CmdShouldPass("odo", "create", "nodejs:latest", "testversioncmp", "--project", project, "--context", context+"/nodejs-ex") + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs:latest", "testversioncmp", "--project", project, "--context", context+"/nodejs-ex") helper.CmdShouldPass("odo", "push", "--context", context+"/nodejs-ex") helper.CmdShouldPass("odo", "delete", "-f", "--context", context+"/nodejs-ex") }) @@ -310,7 +310,7 @@ var _ = Describe("odo generic", func() { os.Unsetenv("GLOBALODOCONFIG") }) It("should not allow creating a URL with long name", func() { - helper.CmdShouldPass("odo", "create", "nodejs", "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", "--project", project) stdOut := helper.CmdShouldFail("odo", "url", "create", testLongURLName, "--port", "8080") Expect(stdOut).To(ContainSubstring("must be shorter than 63 characters")) }) @@ -336,7 +336,7 @@ var _ = Describe("odo generic", func() { }) It("should delete all OpenShift objects except the component's imagestream", func() { helper.CopyExample(filepath.Join("source", "nodejs"), context) - helper.CmdShouldPass("odo", "create", "nodejs", componentRandomName, "--project", project) + helper.CmdShouldPass("odo", "create", "--s2i", "nodejs", componentRandomName, "--project", project) helper.CmdShouldPass("odo", "push") // Delete the deployment config using oc delete @@ -410,7 +410,7 @@ var _ = Describe("odo generic", func() { } for _, testCase := range cases { helper.CopyExample(filepath.Join("source", "nodejs"), context) - output := helper.CmdShouldFail("odo", "component", "create", "nodejs", cmpName, "--project", project, "--context", context, "--"+testCase.paramName, testCase.paramValue) + output := helper.CmdShouldFail("odo", "component", "create", "--s2i", "nodejs", cmpName, "--project", project, "--context", context, "--"+testCase.paramName, testCase.paramValue) Expect(output).To(ContainSubstring("unknown flag: --" + testCase.paramName)) } })