From 58b217b3af201b665a812d5275c3ee96384aa40e Mon Sep 17 00:00:00 2001 From: Pablo Chico de Guzman Date: Fri, 19 Jun 2020 10:56:26 +0200 Subject: [PATCH 1/2] Add GET endpoint and deserialize more info about builds --- pkg/codefresh/workflow.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) 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) { From 05a1121ea311fd158556f19e74df0cf9f7628d63 Mon Sep 17 00:00:00 2001 From: Pablo Chico de Guzman Date: Mon, 22 Jun 2020 11:48:49 +0200 Subject: [PATCH 2/2] Update version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1cf0537..41915c7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.19.0 +0.19.1