tomasdavidorg commented on code in PR #2092:
URL:
https://github.com/apache/incubator-kie-tools/pull/2092#discussion_r1423732312
##########
packages/kn-plugin-workflow/pkg/command/deploy.go:
##########
@@ -122,18 +149,38 @@ func deploy(cfg *DeployUndeployCmdConfig) error {
func runDeployCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig, err
error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ CustomManifestsFileDir:
viper.GetString("custom-manifests-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SubflowsDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
Should it be general `support` or specific `support specs`?
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
specs files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/deploy.go:
##########
@@ -122,18 +149,38 @@ func deploy(cfg *DeployUndeployCmdConfig) error {
func runDeployCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig, err
error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ CustomManifestsFileDir:
viper.GetString("custom-manifests-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SubflowsDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SchemasDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SchemasDir = dir + "/schemas"
if err != nil {
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
Should it be general `support` or specific `support schemas`?
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
schemas files folder: %w", err)
```
##########
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).
Review Comment:
```suggestion
"application.properties" file (inside the root project directory).
```
##########
packages/kn-plugin-workflow/pkg/command/undeploy.go:
##########
@@ -117,16 +148,35 @@ func undeploy(cfg *DeployUndeployCmdConfig) error {
func runUndeployCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig,
err error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ CustomManifestsFileDir:
viper.GetString("custom-manifests-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
+ }
+
+ if len(cfg.SubflowsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support specs files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/metadata/constants.go:
##########
@@ -38,13 +38,17 @@ const (
DefaultTag = "latest"
WorkflowSwJson = "workflow.sw.json"
+ WorkflowSwYaml = "workflow.sw.yaml"
OperatorName = "sonataflow-operator-system"
OperatorManagerPod = "sonataflow-operator-controller-manager"
- YAMLExtension = "sw.yaml"
- YAMLExtensionShort = "sw.yml"
- JSONExtension = "sw.json"
+ YAMLExtension = ".yaml"
+ YMLExtension = ".yml"
+ JSONExtension = ".json"
+ YAMLSWExtension = "sw.yaml"
+ YMLSWExtensionShort = "sw.yml"
Review Comment:
Shouldn't it be without the `Short`? It was also removed from `YMLExtension`.
```suggestion
YMLSWExtension = "sw.yml"
```
##########
packages/kn-plugin-workflow/pkg/command/gen_manifest.go:
##########
@@ -89,30 +100,49 @@ func generateManifestsCmd(cmd *cobra.Command, args
[]string) error {
func runGenManifestCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig,
err error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SubflowsDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support specs files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/undeploy.go:
##########
@@ -117,16 +148,35 @@ func undeploy(cfg *DeployUndeployCmdConfig) error {
func runUndeployCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig,
err error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ CustomManifestsFileDir:
viper.GetString("custom-manifests-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
+ }
+
+ if len(cfg.SubflowsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
+ }
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SchemasDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SchemasDir = dir + "/schemas"
if err != nil {
- return cfg, fmt.Errorf("❌ ERROR: failed to get current
directory: %w", err)
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support schemas files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/deploy.go:
##########
@@ -122,18 +149,38 @@ func deploy(cfg *DeployUndeployCmdConfig) error {
func runDeployCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig, err
error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ CustomManifestsFileDir:
viper.GetString("custom-manifests-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SubflowsDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
Should it be general `support` or specific `support specs`?
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
specs files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/deploy.go:
##########
@@ -122,18 +149,38 @@ func deploy(cfg *DeployUndeployCmdConfig) error {
func runDeployCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig, err
error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ CustomManifestsFileDir:
viper.GetString("custom-manifests-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SubflowsDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SchemasDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SchemasDir = dir + "/schemas"
if err != nil {
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
Should it be general `support` or specific `support schemas`?
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
schemas files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/gen_manifest.go:
##########
@@ -89,30 +100,49 @@ func generateManifestsCmd(cmd *cobra.Command, args
[]string) error {
func runGenManifestCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig,
err error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SubflowsDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support specs files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/undeploy.go:
##########
@@ -117,16 +148,35 @@ func undeploy(cfg *DeployUndeployCmdConfig) error {
func runUndeployCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig,
err error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ CustomManifestsFileDir:
viper.GetString("custom-manifests-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
+ }
+
+ if len(cfg.SubflowsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support specs files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/undeploy.go:
##########
@@ -117,16 +148,35 @@ func undeploy(cfg *DeployUndeployCmdConfig) error {
func runUndeployCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig,
err error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ CustomManifestsFileDir:
viper.GetString("custom-manifests-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
+ }
+
+ if len(cfg.SubflowsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
+ }
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SchemasDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SchemasDir = dir + "/schemas"
if err != nil {
- return cfg, fmt.Errorf("❌ ERROR: failed to get current
directory: %w", err)
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support schemas files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/gen_manifest.go:
##########
@@ -89,30 +100,49 @@ func generateManifestsCmd(cmd *cobra.Command, args
[]string) error {
func runGenManifestCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig,
err error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SubflowsDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SchemasDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SchemasDir = dir + "/schemas"
if err != nil {
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support schemas files folder: %w", err)
```
##########
packages/kn-plugin-workflow/pkg/command/gen_manifest.go:
##########
@@ -89,30 +100,49 @@ func generateManifestsCmd(cmd *cobra.Command, args
[]string) error {
func runGenManifestCmdConfig(cmd *cobra.Command) (cfg DeployUndeployCmdConfig,
err error) {
cfg = DeployUndeployCmdConfig{
- NameSpace: viper.GetString("namespace"),
- SupportFileFolder: viper.GetString("supportFilesFolder"),
- ManifestPath: viper.GetString("manifestPath"),
+ NameSpace: viper.GetString("namespace"),
+ SpecsDir: viper.GetString("specs-dir"),
+ SchemasDir: viper.GetString("schemas-dir"),
+ SubflowsDir: viper.GetString("subflows-dir"),
+ CustomGeneratedManifestDir:
viper.GetString("custom-generated-manifests-dir"),
}
- if len(cfg.SupportFileFolder) == 0 {
+ if len(cfg.SubflowsDir) == 0 {
dir, err := os.Getwd()
- cfg.SupportFileFolder = dir + "/specs"
+ cfg.SubflowsDir = dir + "/subflows"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
subflows workflow files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SpecsDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SpecsDir = dir + "/specs"
+ if err != nil {
+ return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
+ }
+ }
+
+ if len(cfg.SchemasDir) == 0 {
+ dir, err := os.Getwd()
+ cfg.SchemasDir = dir + "/schemas"
if err != nil {
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support files folder: %w", err)
Review Comment:
```suggestion
return cfg, fmt.Errorf("❌ ERROR: failed to get default
support schemas files folder: %w", err)
```
--
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]