Skip to content

Commit

Permalink
artifact definition in config file is now a protobuf. (#92)
Browse files Browse the repository at this point in the history
Previously it was a flat yaml string but this is harder to edit correctly.
  • Loading branch information
scudette authored Sep 30, 2019
1 parent 2cd9c3e commit b3ce9ad
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 321 deletions.
41 changes: 39 additions & 2 deletions artifacts/assets/ab0x.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion bin/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ func load_config_artifacts(config_obj *config_proto.Config) {
}
repository := getRepository(config_obj)
for _, definition := range config_obj.Autoexec.ArtifactDefinitions {
_, err := repository.LoadYaml(definition, true /* validate */)
serialized, err := yaml.Marshal(definition)
kingpin.FatalIfError(err, "Unable to parse config artifact")

_, err = repository.LoadYaml(string(serialized), true /* validate */)
kingpin.FatalIfError(err, "Unable to parse config artifact")
}
}
Expand Down
11 changes: 8 additions & 3 deletions bin/repack.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ func validate_config(config_data []byte) error {
if test_config.Autoexec != nil {
repository := artifacts.NewRepository()

for _, def := range test_config.Autoexec.ArtifactDefinitions {
_, err := repository.LoadYaml(def, true /* validate */)
for _, definition := range test_config.Autoexec.ArtifactDefinitions {
serialized, err := yaml.Marshal(definition)
if err != nil {
return err
}

_, err = repository.LoadYaml(string(serialized), true /* validate */)
if err != nil {
return errors.New(
fmt.Sprintf("While parsing artifact: %s\n%s",
err, def))
err, string(serialized)))
}
}
}
Expand Down
Loading

0 comments on commit b3ce9ad

Please sign in to comment.