Skip to content

Commit

Permalink
support run pipeline interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Sucharevich committed Dec 28, 2018
1 parent 710a157 commit 14451bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 11 additions & 0 deletions pkg/codefresh/pipeline.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package codefresh

import (
"fmt"
"net/url"
"time"
)

type (
// IPipelineAPI declers Codefresh pipeline API
IPipelineAPI interface {
GetPipelines() []*Pipeline
RunPipeline(string) string
}

PipelineMetadata struct {
Expand Down Expand Up @@ -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()
}

0 comments on commit 14451bd

Please sign in to comment.