1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-30 10:11:23 +02:00

send agent version to server

This commit is contained in:
Brad Rydzewski 2017-04-12 00:24:32 +02:00
parent 754b36d131
commit 8dc97b56b0
4 changed files with 40 additions and 23 deletions

View File

@ -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

View File

@ -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

View File

@ -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}
}
}

46
vendor/vendor.json vendored
View File

@ -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=",