code to inject private params
This commit is contained in:
parent
7a668b79c7
commit
b16759b0b6
1 changed files with 7 additions and 1 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/drone/drone/common"
|
"github.com/drone/drone/common"
|
||||||
|
"github.com/drone/drone/parser/inject"
|
||||||
"github.com/drone/drone/parser/matrix"
|
"github.com/drone/drone/parser/matrix"
|
||||||
// "github.com/bradrydzewski/drone/worker"
|
// "github.com/bradrydzewski/drone/worker"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
@ -72,6 +73,8 @@ func PostHook(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
params, _ := store.RepoParams(repo.FullName)
|
||||||
|
|
||||||
build := &common.Build{}
|
build := &common.Build{}
|
||||||
build.State = common.StatePending
|
build.State = common.StatePending
|
||||||
build.Commit = hook.Commit
|
build.Commit = hook.Commit
|
||||||
|
@ -84,7 +87,10 @@ func PostHook(c *gin.Context) {
|
||||||
c.Fail(404, err)
|
c.Fail(404, err)
|
||||||
return
|
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))
|
axes, err := matrix.Parse(string(raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("failure to calculate matrix for %s. %s", repo.FullName, err)
|
log.Errorf("failure to calculate matrix for %s. %s", repo.FullName, err)
|
||||||
|
|
Loading…
Reference in a new issue