diff --git a/VERSION b/VERSION index 1cf0537..41915c7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.19.0 +0.19.1 diff --git a/pkg/codefresh/workflow.go b/pkg/codefresh/workflow.go index 35923b0..7c26c4d 100644 --- a/pkg/codefresh/workflow.go +++ b/pkg/codefresh/workflow.go @@ -9,6 +9,7 @@ import ( type ( IWorkflowAPI interface { WaitForStatus(string, string, time.Duration, time.Duration) error + Get(string) (*Workflow, error) } workflow struct { @@ -16,8 +17,13 @@ type ( } Workflow struct { - ID string `json:"id"` - Status string `json:"status"` + ID string `json:"id"` + Status string `json:"status"` + UserYamlDescriptor string `json:"userYamlDescriptor"` + Progress string `json:"progress"` + Created time.Time `json:"created"` + Updated time.Time `json:"updated"` + Finished time.Time `json:"finished"` } ) @@ -25,6 +31,24 @@ func newWorkflowAPI(codefresh Codefresh) IWorkflowAPI { return &workflow{codefresh} } +func (w *workflow) Get(id string) (*Workflow, error) { + wf := &Workflow{} + resp, err := w.codefresh.requestAPI(&requestOptions{ + path: fmt.Sprintf("/api/builds/%s", id), + method: "GET", + }) + // failed in api call + if err != nil { + return nil, err + } + err = w.codefresh.decodeResponseInto(resp, wf) + // failed to decode + if err != nil { + return nil, err + } + return wf, nil +} + func (w *workflow) WaitForStatus(id string, status string, interval time.Duration, timeout time.Duration) error { err := waitFor(interval, timeout, func() (bool, error) {