diff --git a/drone/agent/agent.go b/drone/agent/agent.go index df3c1233e..4d1342220 100644 --- a/drone/agent/agent.go +++ b/drone/agent/agent.go @@ -18,6 +18,7 @@ import ( "github.com/cncd/pipeline/pipeline/interrupt" "github.com/cncd/pipeline/pipeline/multipart" "github.com/cncd/pipeline/pipeline/rpc" + "github.com/drone/drone/version" "github.com/tevino/abool" "github.com/urfave/cli" @@ -98,6 +99,10 @@ func loop(c *cli.Context) error { rpc.WithToken( c.String("drone-secret"), ), + rpc.WithHeader( + "X-Drone-Version", + version.Version, + ), ) if err != nil { return err diff --git a/vendor/github.com/cncd/pipeline/pipeline/rpc/client.go b/vendor/github.com/cncd/pipeline/pipeline/rpc/client.go index 07016825d..9040bc46b 100644 --- a/vendor/github.com/cncd/pipeline/pipeline/rpc/client.go +++ b/vendor/github.com/cncd/pipeline/pipeline/rpc/client.go @@ -57,6 +57,7 @@ type Client struct { backoff time.Duration endpoint string token string + headers map[string][]string } // NewClient returns a new Client. @@ -65,6 +66,7 @@ func NewClient(endpoint string, opts ...Option) (*Client, error) { endpoint: endpoint, retry: defaultRetryClount, backoff: defaultBackoff, + headers: map[string][]string{}, } for _, opt := range opts { opt(cli) @@ -180,6 +182,9 @@ func (t *Client) open() error { "Content-Type": {"application/json-rpc"}, "Authorization": {"Bearer " + t.token}, } + for key, value := range t.headers { + header[key] = value + } conn, _, err := websocket.DefaultDialer.Dial(t.endpoint, http.Header(header)) if err != nil { return err diff --git a/vendor/github.com/cncd/pipeline/pipeline/rpc/option.go b/vendor/github.com/cncd/pipeline/pipeline/rpc/option.go index aed0070e2..e08dce278 100644 --- a/vendor/github.com/cncd/pipeline/pipeline/rpc/option.go +++ b/vendor/github.com/cncd/pipeline/pipeline/rpc/option.go @@ -27,3 +27,10 @@ func WithToken(t string) Option { c.token = t } } + +// WithHeader configures the client header. +func WithHeader(key, value string) Option { + return func(c *Client) { + c.headers[key] = []string{value} + } +} diff --git a/vendor/vendor.json b/vendor/vendor.json index 1aea83b5c..2c7a8727a 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -28,68 +28,68 @@ { "checksumSHA1": "W3AuK8ocqHwlUajGmQLFvnRhTZE=", "path": "github.com/cncd/pipeline/pipeline", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "Qu2FreqaMr8Yx2bW9O0cxAGgjr0=", "path": "github.com/cncd/pipeline/pipeline/backend", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "0CGXRaYwZhJxGIrGhn8WGpkFqPo=", "path": "github.com/cncd/pipeline/pipeline/backend/docker", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "/8wE+cVb7T4PQZgpLNu0DHzKGuE=", "path": "github.com/cncd/pipeline/pipeline/frontend", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "QWs+L3emrt5DDTWvqD6rbMtLKMw=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "ggOpR/vh0Hs6SnaiuiEO/9dUkcA=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml/compiler", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "Q0GkNUFamVYIA1Fd8r0A5M6Gx54=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml/linter", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "kx2sPUIMozPC/g6E4w48h3FfH3k=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml/matrix", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "2/3f3oNmxXy5kcrRLCFa24Oc9O4=", "path": "github.com/cncd/pipeline/pipeline/interrupt", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "uOjTfke7Qxosrivgz/nVTHeIP5g=", "path": "github.com/cncd/pipeline/pipeline/multipart", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { - "checksumSHA1": "TP5lK1T8cOKv5QjZ2nqdlYczSTo=", + "checksumSHA1": "vWImaniGEUutEvLvNCzTpSRSArg=", "path": "github.com/cncd/pipeline/pipeline/rpc", - "revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18", - "revisionTime": "2017-04-10T16:25:49Z" + "revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f", + "revisionTime": "2017-04-11T22:22:03Z" }, { "checksumSHA1": "7Qj1DK0ceAXkYztW0l3+L6sn+V8=",