Skip to content

Commit 14451bd

Browse files
author
Oleg Sucharevich
committed
support run pipeline interface
1 parent 710a157 commit 14451bd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cmd/root.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ var cfgFile string
3030
var rootCmd = &cobra.Command{
3131
Use: "cfctl",
3232
Short: "A command line application for Codefresh",
33-
Long: ``,
3433

3534
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
3635
configPath := cmd.Flag("cfconfig").Value.String()

pkg/codefresh/pipeline.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package codefresh
22

33
import (
4+
"fmt"
5+
"net/url"
46
"time"
57
)
68

79
type (
810
// IPipelineAPI declers Codefresh pipeline API
911
IPipelineAPI interface {
1012
GetPipelines() []*Pipeline
13+
RunPipeline(string) string
1114
}
1215

1316
PipelineMetadata struct {
@@ -67,3 +70,11 @@ func (c *codefresh) GetPipelines() []*Pipeline {
6770
resp.JSON(r)
6871
return r.Docs
6972
}
73+
74+
func (c *codefresh) RunPipeline(name string) string {
75+
resp := c.requestAPI(&requestOptions{
76+
path: fmt.Sprintf("/api/pipelines/run/%s", url.PathEscape(name)),
77+
method: "POST",
78+
})
79+
return resp.String()
80+
}

0 commit comments

Comments
 (0)