HCL2: allow to describe a build block
This commit is contained in:
parent
fb337f8867
commit
a96a8f22b9
|
@ -38,6 +38,10 @@ type BuildBlock struct {
|
||||||
// Name is a string representing the named build to show in the logs
|
// Name is a string representing the named build to show in the logs
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
// A description of what this build does, it could be used in a inspect
|
||||||
|
// call for example.
|
||||||
|
Description string
|
||||||
|
|
||||||
// Sources is the list of sources that we want to start in this build block.
|
// Sources is the list of sources that we want to start in this build block.
|
||||||
Sources []SourceRef
|
Sources []SourceRef
|
||||||
|
|
||||||
|
@ -61,6 +65,7 @@ func (p *Parser) decodeBuildConfig(block *hcl.Block) (*BuildBlock, hcl.Diagnosti
|
||||||
|
|
||||||
var b struct {
|
var b struct {
|
||||||
Name string `hcl:"name,optional"`
|
Name string `hcl:"name,optional"`
|
||||||
|
Description string `hcl:"description,optional"`
|
||||||
FromSources []string `hcl:"sources,optional"`
|
FromSources []string `hcl:"sources,optional"`
|
||||||
Config hcl.Body `hcl:",remain"`
|
Config hcl.Body `hcl:",remain"`
|
||||||
}
|
}
|
||||||
|
@ -70,6 +75,7 @@ func (p *Parser) decodeBuildConfig(block *hcl.Block) (*BuildBlock, hcl.Diagnosti
|
||||||
}
|
}
|
||||||
|
|
||||||
build.Name = b.Name
|
build.Name = b.Name
|
||||||
|
build.Description = b.Description
|
||||||
|
|
||||||
for _, buildFrom := range b.FromSources {
|
for _, buildFrom := range b.FromSources {
|
||||||
ref := sourceRefFromString(buildFrom)
|
ref := sourceRefFromString(buildFrom)
|
||||||
|
|
Loading…
Reference in New Issue