diff --git a/cmd/root.go b/cmd/root.go index 42279d2..bd9b23f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -30,7 +30,6 @@ var cfgFile string var rootCmd = &cobra.Command{ Use: "cfctl", Short: "A command line application for Codefresh", - Long: ``, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { configPath := cmd.Flag("cfconfig").Value.String() diff --git a/pkg/codefresh/pipeline.go b/pkg/codefresh/pipeline.go index c6a5eda..b0d03b2 100644 --- a/pkg/codefresh/pipeline.go +++ b/pkg/codefresh/pipeline.go @@ -1,6 +1,8 @@ package codefresh import ( + "fmt" + "net/url" "time" ) @@ -8,6 +10,7 @@ type ( // IPipelineAPI declers Codefresh pipeline API IPipelineAPI interface { GetPipelines() []*Pipeline + RunPipeline(string) string } PipelineMetadata struct { @@ -67,3 +70,11 @@ func (c *codefresh) GetPipelines() []*Pipeline { resp.JSON(r) return r.Docs } + +func (c *codefresh) RunPipeline(name string) string { + resp := c.requestAPI(&requestOptions{ + path: fmt.Sprintf("/api/pipelines/run/%s", url.PathEscape(name)), + method: "POST", + }) + return resp.String() +}