caponetto commented on code in PR #2092:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2092#discussion_r1423711753


##########
packages/kn-plugin-workflow/pkg/root/root.go:
##########
@@ -37,9 +37,29 @@ type RootCmdConfig struct {
 
 func NewRootCommand(cfg RootCmdConfig) *cobra.Command {
        var cmd = &cobra.Command{
-               Use:     cfg.Name,
-               Short:   "SonataFlow",
-               Long:    "Manage SonataFlow projects",
+               Use:   cfg.Name,
+               Short: "SonataFlow",
+               Long: `
+       Manage SonataFlow projects
+       ==========================
+
+       Currently, SonataFlow targets use cases with a single Serverless 
Workflow main
+       file definition (i.e. workflow.json|yaml).
+
+       Additionally, you can define the configurable parameters of your 
application in the
+       "application.properties" file (inside the root pproject directory).
+       You can also store your spec files (i.e., Open API files) inside the 
"specs" folder,
+    schemas file inside "schema" folder and also subflows (inside subflows 
folder).

Review Comment:
   ```suggestion
       schemas file inside "schemas" folder and also subflows inside "subflows" 
folder.
   ```



##########
packages/kn-plugin-workflow/pkg/root/root.go:
##########
@@ -37,9 +37,29 @@ type RootCmdConfig struct {
 
 func NewRootCommand(cfg RootCmdConfig) *cobra.Command {
        var cmd = &cobra.Command{
-               Use:     cfg.Name,
-               Short:   "SonataFlow",
-               Long:    "Manage SonataFlow projects",
+               Use:   cfg.Name,
+               Short: "SonataFlow",
+               Long: `
+       Manage SonataFlow projects
+       ==========================
+
+       Currently, SonataFlow targets use cases with a single Serverless 
Workflow main
+       file definition (i.e. workflow.json|yaml).

Review Comment:
   ```suggestion
        file definition (i.e. workflow.sw.{json|yaml|yml}).
   ```



##########
packages/kn-plugin-workflow/pkg/command/deploy.go:
##########
@@ -35,20 +35,35 @@ func NewDeployCommand() *cobra.Command {
                Use:   "deploy",
                Short: "Deploy a SonataFlow project on Kubernetes via 
SonataFlow Operator",
                Long: `
-       Deploy a SonataFlow project in Kubernetes via the SonataFlow Operator. 
+       Deploy a SonataFlow project in Kubernetes via the SonataFlow Operator.
+       By default, the deploy command will generate the Operator manifests and 
apply them to the cluster.
+       You can also provide a custom manifest directory with the 
--custom-manifests-dir option.
        `,
                Example: `
        # Deploy the workflow project from the current directory's project. 
        # You must provide target namespace.
        {{.Name}} deploy --namespace <your_namespace>
+
        # Persist the generated Operator manifests on a given path and deploy 
the 
        # workflow from the current directory's project. 
-       {{.Name}} deploy --manifestPath=<full_directory_path>
-    # Specify a custom support files folder. 
-       {{.Name}} deploy --supportFiles=<full_directory_path>
+       {{.Name}} deploy --custom-generated-manifests-dir=<full_directory_path>
+
+       # Specify a custom manifest files directory.
+       # This option *will not* automatically generate the manifest files, but 
will use the existing ones.
+       {{.Name}} deploy --custom-manifests-dir=<full_directory_path>
+
+       # Specify a custom subflows files directory. (default: ./subflows)
+       {{.Name}} deploy --subflows-dir=<full_directory_path>
+
+       # Specify a custom support specs directory. (default: ./specs)
+       {{.Name}} deploy --specs-dir=<full_directory_path>
+
+       # Specify a custom support schemas directory. (default: ./schemas)
+       {{.Name}} deploy --schemas-dir=<full_directory_path>
+
                `,
 
-               PreRunE:    common.BindEnv("namespace", "manifestPath", 
"supportFilesFolder"),
+               PreRunE:    common.BindEnv("namespace", "custom-manifests-dir", 
"custom-generated-manifests-dir", "specs-dir", "schemas-dir", "subflows-dir"),

Review Comment:
   Can we use constants for these names? It could be done in a separate PR but 
I think it would be useful to avoid mistakes.



##########
packages/kn-plugin-workflow/pkg/command/create.go:
##########
@@ -53,9 +64,12 @@ func NewCreateCommand() *cobra.Command {
 
        # Create a project with an specific name
        {{.Name}} create --name myproject
+
+       # Creates a YAML sample workflow file (json is default)

Review Comment:
   As people tend to prefer, I'm wondering if YAML should be the default.



##########
packages/kn-plugin-workflow/pkg/root/root.go:
##########
@@ -37,9 +37,29 @@ type RootCmdConfig struct {
 
 func NewRootCommand(cfg RootCmdConfig) *cobra.Command {
        var cmd = &cobra.Command{
-               Use:     cfg.Name,
-               Short:   "SonataFlow",
-               Long:    "Manage SonataFlow projects",
+               Use:   cfg.Name,
+               Short: "SonataFlow",
+               Long: `
+       Manage SonataFlow projects
+       ==========================
+
+       Currently, SonataFlow targets use cases with a single Serverless 
Workflow main
+       file definition (i.e. workflow.json|yaml).
+
+       Additionally, you can define the configurable parameters of your 
application in the
+       "application.properties" file (inside the root pproject directory).
+       You can also store your spec files (i.e., Open API files) inside the 
"specs" folder,
+    schemas file inside "schema" folder and also subflows (inside subflows 
folder).
+
+       A SonataFlow project, as the following structure by default:
+
+       Workflow project root
+               /specs (optional)
+               /schemas (optional)
+               /subflows (optional)
+               workflow.json|yaml (mandatory)

Review Comment:
   ```suggestion
                workflow.sw.{json|yaml|yml} (mandatory)
   ```



##########
packages/kn-plugin-workflow/pkg/command/create.go:
##########
@@ -53,9 +64,12 @@ func NewCreateCommand() *cobra.Command {
 
        # Create a project with an specific name
        {{.Name}} create --name myproject
+
+       # Creates a YAML sample workflow file (json is default)

Review Comment:
   ```suggestion
        # Creates a YAML sample workflow file (JSON is default)
   ```



##########
packages/kn-plugin-workflow/pkg/common/create_workflow.go:
##########
@@ -57,28 +58,34 @@ func GetWorkflowTemplate() (workflowJsonByte []byte, err 
error) {
                Version:     "1.0",
                SpecVersion: "0.8.0",
                Name:        "Hello World",
+               Description: "Description",
                Start:       "HelloWorld",
                States:      []WorkflowStates{workflowStates},
        }
 
-       workflowJsonByte, err = json.MarshalIndent(workflow, "", "  ")
-       if err != nil {
-               return nil, fmt.Errorf("error marshaling the workflow json 
file. %w", err)
+       if yamlWorkflow {
+               workflowByte, err = yaml.Marshal(workflow)
+               if err != nil {
+                       return nil, fmt.Errorf("error marshaling the workflow 
file. %w", err)
+               }
+       } else {
+               workflowByte, err = json.MarshalIndent(workflow, "", "  ")
+               if err != nil {
+                       return nil, fmt.Errorf("error marshaling the workflow 
file. %w", err)
+               }
        }
-       return
+
+       return workflowByte, nil
 }
 
-func CreateWorkflow(workflowFilePath string) (err error) {
-       workflowFileData, err := GetWorkflowTemplate()
-       if err != nil {
-               return err
-       }
+func CreateWorkflow(workflowFilePath string, yamlWorkflow bool) (err error) {
 
-       err = afero.WriteFile(FS, workflowFilePath, workflowFileData, 0644)
+       workflowByte, err := GetWorkflowTemplate(yamlWorkflow)
+       err = afero.WriteFile(FS, workflowFilePath, workflowByte, 0644)
        if err != nil {
-               return fmt.Errorf("error writing the workflow json file. %w", 
err)
+               return fmt.Errorf("error writing the workflow yaml file: %w", 
err)

Review Comment:
   ```suggestion
                return fmt.Errorf("error writing the workflow YAML file: %w", 
err)
   ```



##########
packages/kn-plugin-workflow/env/index.js:
##########
@@ -39,12 +39,12 @@ module.exports = 
composeEnv([require("@kie-tools/root-env/env")], {
     },
     KN_PLUGIN_WORKFLOW__devModeImage: {
       name: "KN_PLUGIN_WORKFLOW__devModeImage",
-      default: "quay.io/kiegroup/kogito-swf-devmode:1.42",
+      default: "quay.io/kiegroup/kogito-swf-devmode:1.44",

Review Comment:
   I think we should also update the default value of 
`KN_PLUGIN_WORKFLOW__quarkusVersion` to `2.16.10.Final` because that's the 
companion version of `1.44.1.Final`. 
([ref](https://github.com/kiegroup/kogito-images/blob/1.44.1/kogito-swf-devmode-image.yaml#L32))



##########
packages/kn-plugin-workflow/pkg/command/create.go:
##########
@@ -43,8 +44,18 @@ func NewCreateCommand() *cobra.Command {
        Workflow file definition.
 
        Additionally, you can define the configurable parameters of your 
application in the 
-       "application.properties" file (inside the root directory). 
-       You can also store your spec files (i.e., Open API files) inside the 
"specs" folder.
+       "application.properties" file (inside the root project directory).
+       You can also store your spec files (i.e., Open API files) inside the 
"specs" folder,
+       schemas file inside "schema" folder and also subflows (inside subflows 
folder).
+
+       A SonataFlow project, as the following structure by default:
+
+       Workflow project root
+               /specs (optional)
+               /schemas (optional)
+               /subflows (optional)
+               workflow.json|yaml (mandatory)

Review Comment:
   ```suggestion
                workflow.sw.{json|yaml|yml} (mandatory)
   ```



##########
packages/kn-plugin-workflow/pkg/command/create.go:
##########
@@ -43,8 +44,18 @@ func NewCreateCommand() *cobra.Command {
        Workflow file definition.
 
        Additionally, you can define the configurable parameters of your 
application in the 
-       "application.properties" file (inside the root directory). 
-       You can also store your spec files (i.e., Open API files) inside the 
"specs" folder.
+       "application.properties" file (inside the root project directory).
+       You can also store your spec files (i.e., Open API files) inside the 
"specs" folder,
+       schemas file inside "schema" folder and also subflows (inside subflows 
folder).

Review Comment:
   ```suggestion
        schemas file inside "schemas" folder and also subflows inside 
"subflows" folder.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to