Merge pull request #2661 from tboerger/fix-matrix-convert

Fix automated legacy matrix convert
pull/2674/head
Brad Rydzewski 2019-04-16 22:19:57 -07:00 committed by GitHub
commit 5a0a07e553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

2
go.sum
View File

@ -124,6 +124,8 @@ github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uP
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6 h1:qCv4319q2q7XKn0MQbi8p37hsJ+9Xo8e6yojA73JVxk=
github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6/go.mod h1:fXcdFsQoipQa7mwORhKad5jmDCeSy/RCGzWA08PO0lM=
github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/nomad v0.0.0-20190125003214-134391155854 h1:L7WhLZt2ory/kQWxqkMwOiBpIoa4BWoadN7yx8LHEtk=

View File

@ -184,7 +184,18 @@ func (r *Runner) Run(ctx context.Context, id int64) error {
// TODO mutate the yaml
//
y, err := envsubst.Eval(string(m.Config.Data), func(name string) string {
// this code is temporarily in place to detect and convert
// the legacy yaml configuration file to the new format.
y, err := converter.ConvertString(string(m.Config.Data), converter.Metadata{
Filename: m.Repo.Config,
Ref: m.Build.Ref,
})
if err != nil {
return err
}
y, err = envsubst.Eval(y, func(name string) string {
env := environ[name]
if strings.Contains(env, "\n") {
env = fmt.Sprintf("%q", env)
@ -192,16 +203,6 @@ func (r *Runner) Run(ctx context.Context, id int64) error {
return env
})
// this code is temporarily in place to detect and convert
// the legacy yaml configuration file to the new format.
y, err = converter.ConvertString(y, converter.Metadata{
Filename: m.Repo.Config,
Ref: m.Build.Ref,
})
if err != nil {
return err
}
manifest, err := yaml.ParseString(y)
if err != nil {
logger = logger.WithError(err)