update secret interpolation

This commit is contained in:
Brad Rydzewski 2017-01-18 23:43:40 +07:00
parent cbeac5e671
commit f51a9aed84

View file

@ -97,7 +97,7 @@ func (a *Agent) prep(w *model.Work) (*yaml.Config, error) {
envSecrets := map[string]string{} envSecrets := map[string]string{}
if os.Getenv("DRONE_INTERPOLATE_SECRETS") != "" { if os.Getenv("DRONE_INTERPOLATE_SECRETS") != "" {
for _, secret := range w.Secrets { for _, secret := range w.Secrets {
if w.Verified || secret.SkipVerify { if (w.Verified || secret.SkipVerify) && secret.MatchEvent(w.Build.Event) {
envSecrets[secret.Name] = secret.Value envSecrets[secret.Name] = secret.Value
} }
} }
@ -109,9 +109,6 @@ func (a *Agent) prep(w *model.Work) (*yaml.Config, error) {
if !ok { if !ok {
env, ok = envs[s] env, ok = envs[s]
} }
if !ok {
return ""
}
if strings.Contains(env, "\n") { if strings.Contains(env, "\n") {
env = fmt.Sprintf("%q", env) env = fmt.Sprintf("%q", env)
} }