mirror of
https://github.com/harness/drone.git
synced 2025-05-12 15:10:09 +08:00
send agent version to server
This commit is contained in:
parent
754b36d131
commit
8dc97b56b0
@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/cncd/pipeline/pipeline/interrupt"
|
"github.com/cncd/pipeline/pipeline/interrupt"
|
||||||
"github.com/cncd/pipeline/pipeline/multipart"
|
"github.com/cncd/pipeline/pipeline/multipart"
|
||||||
"github.com/cncd/pipeline/pipeline/rpc"
|
"github.com/cncd/pipeline/pipeline/rpc"
|
||||||
|
"github.com/drone/drone/version"
|
||||||
|
|
||||||
"github.com/tevino/abool"
|
"github.com/tevino/abool"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
@ -98,6 +99,10 @@ func loop(c *cli.Context) error {
|
|||||||
rpc.WithToken(
|
rpc.WithToken(
|
||||||
c.String("drone-secret"),
|
c.String("drone-secret"),
|
||||||
),
|
),
|
||||||
|
rpc.WithHeader(
|
||||||
|
"X-Drone-Version",
|
||||||
|
version.Version,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
5
vendor/github.com/cncd/pipeline/pipeline/rpc/client.go
generated
vendored
5
vendor/github.com/cncd/pipeline/pipeline/rpc/client.go
generated
vendored
@ -57,6 +57,7 @@ type Client struct {
|
|||||||
backoff time.Duration
|
backoff time.Duration
|
||||||
endpoint string
|
endpoint string
|
||||||
token string
|
token string
|
||||||
|
headers map[string][]string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient returns a new Client.
|
// NewClient returns a new Client.
|
||||||
@ -65,6 +66,7 @@ func NewClient(endpoint string, opts ...Option) (*Client, error) {
|
|||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
retry: defaultRetryClount,
|
retry: defaultRetryClount,
|
||||||
backoff: defaultBackoff,
|
backoff: defaultBackoff,
|
||||||
|
headers: map[string][]string{},
|
||||||
}
|
}
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(cli)
|
opt(cli)
|
||||||
@ -180,6 +182,9 @@ func (t *Client) open() error {
|
|||||||
"Content-Type": {"application/json-rpc"},
|
"Content-Type": {"application/json-rpc"},
|
||||||
"Authorization": {"Bearer " + t.token},
|
"Authorization": {"Bearer " + t.token},
|
||||||
}
|
}
|
||||||
|
for key, value := range t.headers {
|
||||||
|
header[key] = value
|
||||||
|
}
|
||||||
conn, _, err := websocket.DefaultDialer.Dial(t.endpoint, http.Header(header))
|
conn, _, err := websocket.DefaultDialer.Dial(t.endpoint, http.Header(header))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
7
vendor/github.com/cncd/pipeline/pipeline/rpc/option.go
generated
vendored
7
vendor/github.com/cncd/pipeline/pipeline/rpc/option.go
generated
vendored
@ -27,3 +27,10 @@ func WithToken(t string) Option {
|
|||||||
c.token = t
|
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
46
vendor/vendor.json
vendored
@ -28,68 +28,68 @@
|
|||||||
{
|
{
|
||||||
"checksumSHA1": "W3AuK8ocqHwlUajGmQLFvnRhTZE=",
|
"checksumSHA1": "W3AuK8ocqHwlUajGmQLFvnRhTZE=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline",
|
"path": "github.com/cncd/pipeline/pipeline",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "Qu2FreqaMr8Yx2bW9O0cxAGgjr0=",
|
"checksumSHA1": "Qu2FreqaMr8Yx2bW9O0cxAGgjr0=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/backend",
|
"path": "github.com/cncd/pipeline/pipeline/backend",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "0CGXRaYwZhJxGIrGhn8WGpkFqPo=",
|
"checksumSHA1": "0CGXRaYwZhJxGIrGhn8WGpkFqPo=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/backend/docker",
|
"path": "github.com/cncd/pipeline/pipeline/backend/docker",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "/8wE+cVb7T4PQZgpLNu0DHzKGuE=",
|
"checksumSHA1": "/8wE+cVb7T4PQZgpLNu0DHzKGuE=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/frontend",
|
"path": "github.com/cncd/pipeline/pipeline/frontend",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "QWs+L3emrt5DDTWvqD6rbMtLKMw=",
|
"checksumSHA1": "QWs+L3emrt5DDTWvqD6rbMtLKMw=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml",
|
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "ggOpR/vh0Hs6SnaiuiEO/9dUkcA=",
|
"checksumSHA1": "ggOpR/vh0Hs6SnaiuiEO/9dUkcA=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/compiler",
|
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/compiler",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "Q0GkNUFamVYIA1Fd8r0A5M6Gx54=",
|
"checksumSHA1": "Q0GkNUFamVYIA1Fd8r0A5M6Gx54=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/linter",
|
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/linter",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "kx2sPUIMozPC/g6E4w48h3FfH3k=",
|
"checksumSHA1": "kx2sPUIMozPC/g6E4w48h3FfH3k=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/matrix",
|
"path": "github.com/cncd/pipeline/pipeline/frontend/yaml/matrix",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "2/3f3oNmxXy5kcrRLCFa24Oc9O4=",
|
"checksumSHA1": "2/3f3oNmxXy5kcrRLCFa24Oc9O4=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/interrupt",
|
"path": "github.com/cncd/pipeline/pipeline/interrupt",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "uOjTfke7Qxosrivgz/nVTHeIP5g=",
|
"checksumSHA1": "uOjTfke7Qxosrivgz/nVTHeIP5g=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/multipart",
|
"path": "github.com/cncd/pipeline/pipeline/multipart",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "TP5lK1T8cOKv5QjZ2nqdlYczSTo=",
|
"checksumSHA1": "vWImaniGEUutEvLvNCzTpSRSArg=",
|
||||||
"path": "github.com/cncd/pipeline/pipeline/rpc",
|
"path": "github.com/cncd/pipeline/pipeline/rpc",
|
||||||
"revision": "3592c9ddd294f698e70b8dd855cdd66264f8ae18",
|
"revision": "6782e9f66c439f8cf5ece4d7e1e5371c8be58d5f",
|
||||||
"revisionTime": "2017-04-10T16:25:49Z"
|
"revisionTime": "2017-04-11T22:22:03Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "7Qj1DK0ceAXkYztW0l3+L6sn+V8=",
|
"checksumSHA1": "7Qj1DK0ceAXkYztW0l3+L6sn+V8=",
|
||||||
|
Loading…
Reference in New Issue
Block a user