From b16759b0b68f5417a83b1acc2998395dd884ab3c Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 21 Apr 2015 15:48:48 -0700 Subject: [PATCH] code to inject private params --- server/hooks.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/hooks.go b/server/hooks.go index 70b3120b..df7a9ae2 100644 --- a/server/hooks.go +++ b/server/hooks.go @@ -5,6 +5,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/drone/drone/common" + "github.com/drone/drone/parser/inject" "github.com/drone/drone/parser/matrix" // "github.com/bradrydzewski/drone/worker" "github.com/gin-gonic/gin" @@ -72,6 +73,8 @@ func PostHook(c *gin.Context) { return } + params, _ := store.RepoParams(repo.FullName) + build := &common.Build{} build.State = common.StatePending build.Commit = hook.Commit @@ -84,7 +87,10 @@ func PostHook(c *gin.Context) { c.Fail(404, err) return } - + // inject any private parameters into the .drone.yml + if params != nil && len(params) != 0 { + raw = []byte(inject.InjectSafe(string(raw), params)) + } axes, err := matrix.Parse(string(raw)) if err != nil { log.Errorf("failure to calculate matrix for %s. %s", repo.FullName, err)