about summary refs log tree commit diff
path: root/gerrit/client.go
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-11-21T15·12+0100
committerFlorian Klink <flokli@flokli.de>2019-11-21T15·13+0100
commit057294830e8e1915ee804d980d2b954ffbdff60a (patch)
treeb5143ce4629078d6c5c1decc540a05d3644d50fe /gerrit/client.go
parent43f8205e85a6c5aed79041715375d199414abf0a (diff)
frontend: show submittable status and URL, add runner, revamp logging
Diffstat (limited to 'gerrit/client.go')
-rw-r--r--gerrit/client.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/gerrit/client.go b/gerrit/client.go
index 5a13befe5463..c65b5016c1ff 100644
--- a/gerrit/client.go
+++ b/gerrit/client.go
@@ -17,13 +17,15 @@ type IClient interface {
 	SubmitChangeset(changeset *Changeset) (*Changeset, error)
 	RebaseChangeset(changeset *Changeset, ref string) (*Changeset, error)
 	RemoveTag(changeset *Changeset, tag string) (*Changeset, error)
+	GetBaseURL() string
 }
 
 var _ IClient = &Client{}
 
 // Client provides some ways to interact with a gerrit instance
 type Client struct {
-	client *goGerrit.Client
+	client  *goGerrit.Client
+	baseURL string
 }
 
 // NewClient initializes a new gerrit client
@@ -38,7 +40,10 @@ func NewClient(URL, username, password string) (*Client, error) {
 	if err != nil {
 		return nil, err
 	}
-	return &Client{client: goGerritClient}, nil
+	return &Client{
+		client:  goGerritClient,
+		baseURL: URL,
+	}, nil
 }
 
 // SearchChangesets fetches a list of changesets matching a passed query string
@@ -117,3 +122,8 @@ func (gerrit *Client) RemoveTag(changeset *Changeset, tag string) (*Changeset, e
 	// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-hashtags
 	return changeset, nil
 }
+
+// GetBaseURL returns the gerrit base URL
+func (gerrit *Client) GetBaseURL() string {
+	return gerrit.baseURL
+}