mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-20 16:03:02 +00:00
code to inject private params
This commit is contained in:
@@ -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)
|
||||||
|
Reference in New Issue
Block a user