This is an automated email from the ASF dual-hosted git repository.

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new ac61877e [dubboctl] add image part logic (#572)
ac61877e is described below

commit ac61877e406f535804e5b6895ec3941bd5efde41
Author: Jian Zhong <[email protected]>
AuthorDate: Sat Feb 1 12:22:36 2025 +0800

    [dubboctl] add image part logic (#572)
---
 dubboctl/cmd/image.go      | 49 +++++++++++++++++++++++++++++++++++++++++++++-
 dubboctl/pkg/sdk/client.go | 30 ++++++++++++++++++++++++++++
 pkg/art/art.go             |  2 +-
 pkg/art/dubbo-ascii.txt    | 10 +++++-----
 4 files changed, 84 insertions(+), 7 deletions(-)

diff --git a/dubboctl/cmd/image.go b/dubboctl/cmd/image.go
index c1b5592a..91cc9892 100644
--- a/dubboctl/cmd/image.go
+++ b/dubboctl/cmd/image.go
@@ -4,6 +4,7 @@ import (
        "fmt"
        "github.com/apache/dubbo-kubernetes/dubboctl/pkg/cli"
        "github.com/apache/dubbo-kubernetes/dubboctl/pkg/sdk/dubbo"
+       "github.com/apache/dubbo-kubernetes/dubboctl/pkg/util"
        "github.com/ory/viper"
        "github.com/spf13/cobra"
        "os"
@@ -13,19 +14,23 @@ import (
 
 type BuildConfig struct {
        Build bool
+       Path  string
 }
 
 type PushConfig struct {
        Push bool
+       Path string
 }
 
 type ApplyConfig struct {
        Apply bool
+       Path  string
 }
 
 func newBuildConfig(cmd *cobra.Command) *BuildConfig {
        bc := &BuildConfig{
                Build: viper.GetBool("build"),
+               Path:  viper.GetString("path"),
        }
        return bc
 }
@@ -33,6 +38,7 @@ func newBuildConfig(cmd *cobra.Command) *BuildConfig {
 func newPushConfig(cmd *cobra.Command) *PushConfig {
        pc := &PushConfig{
                Push: viper.GetBool("push"),
+               Path: viper.GetString("path"),
        }
        return pc
 }
@@ -40,6 +46,7 @@ func newPushConfig(cmd *cobra.Command) *PushConfig {
 func newApplyConfig(cmd *cobra.Command) *ApplyConfig {
        ac := &ApplyConfig{
                Apply: viper.GetBool("apply"),
+               Path:  viper.GetString("path"),
        }
        return ac
 }
@@ -73,6 +80,19 @@ func imageBuildCmd(cmd *cobra.Command, clientFactory 
ClientFactory) *cobra.Comma
 }
 
 func runBuild(cmd *cobra.Command, args []string, clientFactory ClientFactory) 
error {
+       if err := util.GetCreatePath(); err != nil {
+               return err
+       }
+       config := newBuildConfig(cmd)
+
+       fp, err := dubbo.NewDubboConfig(config.Path)
+       if err != nil {
+               return err
+       }
+
+       if !fp.Initialized() {
+       }
+
        return fmt.Errorf("TODO")
 }
 
@@ -90,6 +110,19 @@ func imagePushCmd(cmd *cobra.Command, clientFactory 
ClientFactory) *cobra.Comman
 }
 
 func runPush(cmd *cobra.Command, args []string, clientFactory ClientFactory) 
error {
+       if err := util.GetCreatePath(); err != nil {
+               return err
+       }
+       config := newPushConfig(cmd)
+
+       fp, err := dubbo.NewDubboConfig(config.Path)
+       if err != nil {
+               return err
+       }
+
+       if !fp.Initialized() {
+       }
+
        return fmt.Errorf("TODO")
 }
 
@@ -107,7 +140,21 @@ func imageApplyCmd(cmd *cobra.Command, clientFactory 
ClientFactory) *cobra.Comma
 }
 
 func runApply(cmd *cobra.Command, args []string, clientFactory ClientFactory) 
error {
-       if err := applyToCluster(cmd, nil); err != nil {
+       if err := util.GetCreatePath(); err != nil {
+               return err
+       }
+
+       config := newApplyConfig(cmd)
+
+       fp, err := dubbo.NewDubboConfig(config.Path)
+       if err != nil {
+               return err
+       }
+
+       if !fp.Initialized() {
+       }
+
+       if err := applyToCluster(cmd, fp); err != nil {
                return err
        }
 
diff --git a/dubboctl/pkg/sdk/client.go b/dubboctl/pkg/sdk/client.go
index 4b85ded5..b4cc0792 100644
--- a/dubboctl/pkg/sdk/client.go
+++ b/dubboctl/pkg/sdk/client.go
@@ -2,6 +2,7 @@ package sdk
 
 import (
        "bufio"
+       "context"
        "fmt"
        "github.com/apache/dubbo-kubernetes/dubboctl/pkg/sdk/dubbo"
        "github.com/apache/dubbo-kubernetes/dubboctl/pkg/util"
@@ -20,6 +21,35 @@ type Client struct {
        repositoriesPath string
 }
 
+type Builder interface {
+       Build(context.Context, *dubbo.DubboConfig) error
+}
+
+type Pusher interface {
+       Push(ctx context.Context, dcfg *dubbo.DubboConfig) (string, error)
+}
+
+type DeploymentResult struct {
+       Status    Status
+       Namespace string
+}
+
+type Status int
+
+const (
+       Failed Status = iota
+       Deployed
+)
+
+type DeployParams struct {
+       skipBuiltCheck bool
+}
+type DeployOption func(f *DeployParams)
+
+type Deployer interface {
+       Deploy(context.Context, *dubbo.DubboConfig, ...DeployOption) 
(DeploymentResult, error)
+}
+
 type Option func(client *Client)
 
 func New(options ...Option) *Client {
diff --git a/pkg/art/art.go b/pkg/art/art.go
index 8ae9d4cd..b42671f3 100644
--- a/pkg/art/art.go
+++ b/pkg/art/art.go
@@ -13,5 +13,5 @@ func dubboArt() string {
 }
 
 func DubboColoredArt() string {
-       return color.New(color.FgHiCyan).Add(color.Bold).Sprint(dubboASCIIArt)
+       return color.New(color.FgHiBlue).Add(color.Bold).Sprint(dubboASCIIArt)
 }
diff --git a/pkg/art/dubbo-ascii.txt b/pkg/art/dubbo-ascii.txt
index 3a990c1a..962d6bc9 100644
--- a/pkg/art/dubbo-ascii.txt
+++ b/pkg/art/dubbo-ascii.txt
@@ -1,5 +1,5 @@
- ____   _   _  _      _      _____
-|  _ \ | | | || |__  | |__  |  _  |
-| | | || | | || |_ \ | |_ \ | | | |
-| |_| || |_| || |_| || |_| || |_| |
-|____/ |_____||____/ |____/ |_____|
\ No newline at end of file
+ ____        _     _
+|  _ \ _   _| |__ | |__   ___
+| | | | | | | |_ \| |_ \ / _ \
+| |_| | |_| | |_| | |_| | |_| |
+|____/ \____|____/|____/ \___/
\ No newline at end of file

Reply via email to