From cf3089804226dd4555a1d9eeefa4bafd302b24e5 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 1 Dec 2017 13:38:55 -0800 Subject: [PATCH] enable instance in when clause --- server/hook.go | 7 +++ .../pipeline/frontend/yaml/constraint.go | 1 + vendor/vendor.json | 54 +++++++++---------- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/server/hook.go b/server/hook.go index 67757466e..0b1b4ec1f 100644 --- a/server/hook.go +++ b/server/hook.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "math/rand" + "net/url" "regexp" "strconv" "strings" @@ -346,6 +347,11 @@ func PostHook(c *gin.Context) { // return the metadata from the cli context. func metadataFromStruct(repo *model.Repo, build, last *model.Build, proc *model.Proc, link string) frontend.Metadata { + host := link + uri, err := url.Parse(link) + if err == nil { + host = uri.Host + } return frontend.Metadata{ Repo: frontend.Repo{ Name: repo.FullName, @@ -405,6 +411,7 @@ func metadataFromStruct(repo *model.Repo, build, last *model.Build, proc *model. Sys: frontend.System{ Name: "drone", Link: link, + Host: host, Arch: "linux/amd64", }, } diff --git a/vendor/github.com/cncd/pipeline/pipeline/frontend/yaml/constraint.go b/vendor/github.com/cncd/pipeline/pipeline/frontend/yaml/constraint.go index ad193b286..1b1c8b129 100644 --- a/vendor/github.com/cncd/pipeline/pipeline/frontend/yaml/constraint.go +++ b/vendor/github.com/cncd/pipeline/pipeline/frontend/yaml/constraint.go @@ -45,6 +45,7 @@ func (c *Constraints) Match(metadata frontend.Metadata) bool { c.Branch.Match(metadata.Curr.Commit.Branch) && c.Repo.Match(metadata.Repo.Name) && c.Ref.Match(metadata.Curr.Commit.Ref) && + c.Instance.Match(metadata.Sys.Host) && c.Matrix.Match(metadata.Job.Matrix) } diff --git a/vendor/vendor.json b/vendor/vendor.json index 2541178b7..e450b6b95 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -195,80 +195,80 @@ { "checksumSHA1": "W3AuK8ocqHwlUajGmQLFvnRhTZE=", "path": "github.com/cncd/pipeline/pipeline", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "iRKdpheRPBTP0DKTQH7zmE2PI34=", "path": "github.com/cncd/pipeline/pipeline/backend", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "EHJGG1USUliP8nzNWV/axO5KLzw=", "path": "github.com/cncd/pipeline/pipeline/backend/docker", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "HWV2BBLXS4gY5eLJeNIg7Z6nAOA=", "path": "github.com/cncd/pipeline/pipeline/frontend", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { - "checksumSHA1": "a31aG4R3OK0t87whuZ5IWbSD1uc=", + "checksumSHA1": "ncGH2MfHDtM7/dNzj2i+lnXFnf4=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "cdjOSSSS5Gzx7gRLNvObQvNJWYg=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml/compiler", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "Sj2VYU+asWToYriIqcinav5MJZo=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml/linter", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "kx2sPUIMozPC/g6E4w48h3FfH3k=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml/matrix", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "L7Q5qJmPITNmvFEEaj5MPwCWFRk=", "path": "github.com/cncd/pipeline/pipeline/frontend/yaml/types", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "2/3f3oNmxXy5kcrRLCFa24Oc9O4=", "path": "github.com/cncd/pipeline/pipeline/interrupt", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "uOjTfke7Qxosrivgz/nVTHeIP5g=", "path": "github.com/cncd/pipeline/pipeline/multipart", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "5oiGroE8hLXcj9hcZ+GGoBEm3o0=", "path": "github.com/cncd/pipeline/pipeline/rpc", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "N+3wNQ8hc/6yrh3FxbaxkEVwrkY=", "path": "github.com/cncd/pipeline/pipeline/rpc/proto", - "revision": "82706703c87f88a632674484e095e494c0e30e34", - "revisionTime": "2017-11-17T22:46:28Z" + "revision": "f8c48fc9fb9fd113c6e7dd941d63bb9f86a623cb", + "revisionTime": "2017-12-01T21:30:15Z" }, { "checksumSHA1": "7Qj1DK0ceAXkYztW0l3+L6sn+V8=",