enable instance in when clause

This commit is contained in:
Brad Rydzewski 2017-12-01 13:38:55 -08:00
parent 970080e444
commit cf30898042
3 changed files with 35 additions and 27 deletions

View file

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

View file

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

54
vendor/vendor.json vendored
View file

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