Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3ab841a
yeet
ecrupper Mar 22, 2023
a4eacdc
initial work
ecrupper Mar 22, 2023
5d61b68
remove unnecessary validation check
ecrupper Mar 22, 2023
b081082
adding some comments
ecrupper Mar 22, 2023
446a942
remove edits to inline testing
ecrupper Mar 22, 2023
73fb16e
Merge branch 'main' into feat/templateception
ecrupper Mar 23, 2023
2eba356
Merge branch 'main' into feat/templateception
ecrupper Mar 30, 2023
9b035c4
Merge branch 'main' into feat/templateception
ecrupper Apr 3, 2023
0b05339
Merge branch 'main' into feat/templateception
ecrupper Apr 5, 2023
132ff78
Merge branch 'main' into feat/templateception
cognifloyd Apr 10, 2023
67e635f
Merge branch 'main' into feat/templateception
ecrupper May 22, 2023
54da9db
fix typo
ecrupper May 22, 2023
7f90ed9
render inline init work
ecrupper May 22, 2023
6f73a4f
Merge branch 'main' into feat/templateception
ecrupper May 23, 2023
10938ac
support for render_inline
ecrupper May 23, 2023
6c68a78
Merge branch 'main' into feat/templateception
ecrupper May 23, 2023
f6f90fb
address feedback
ecrupper May 24, 2023
e40b5c7
Merge branch 'feat/templateception' of github.com:go-vela/server into…
ecrupper May 24, 2023
c5cd66a
validate template depth
ecrupper May 24, 2023
38a9fa4
added tests for compile inline
ecrupper May 25, 2023
7fea3ba
add test for error with called render_inline template in step
ecrupper May 25, 2023
cfc6c9b
drop vs code nonsense
ecrupper May 25, 2023
fb57519
add github.amrom.workers.devpiler flags to env example
ecrupper May 25, 2023
b712d33
Merge branch 'main' into feat/templateception
wass3rw3rk May 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
render inline init work
  • Loading branch information
ecrupper committed May 22, 2023
commit 7f90ed9e23e1e1ea94a2e132a9075f6a0eec6352
19 changes: 10 additions & 9 deletions compiler/native/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (c *client) Compile(v interface{}) (*pipeline.Build, *library.Pipeline, err

switch {
case p.Metadata.RenderInline:
newPipeline, err := c.compileInline(p, nil)
newPipeline, err := c.compileInline(p, nil, c.TemplateDepth)
if err != nil {
return nil, _pipeline, err
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func (c *client) CompileLite(v interface{}, template, substitute bool, localTemp
_pipeline.SetType(c.repo.GetPipelineType())

if p.Metadata.RenderInline {
newPipeline, err := c.compileInline(p, localTemplates)
newPipeline, err := c.compileInline(p, localTemplates, c.TemplateDepth)
if err != nil {
return nil, _pipeline, err
}
Expand Down Expand Up @@ -194,7 +194,7 @@ func (c *client) CompileLite(v interface{}, template, substitute bool, localTemp
}

// compileInline parses and expands out inline pipelines.
func (c *client) compileInline(p *yaml.Build, localTemplates []string) (*yaml.Build, error) {
func (c *client) compileInline(p *yaml.Build, localTemplates []string, depth int) (*yaml.Build, error) {
newPipeline := *p
newPipeline.Templates = yaml.TemplateSlice{}

Expand Down Expand Up @@ -231,6 +231,13 @@ func (c *client) compileInline(p *yaml.Build, localTemplates []string) (*yaml.Bu
return nil, err
}

if len(parsed.Templates) > 0 && parsed.Metadata.RenderInline {
parsed, err = c.compileInline(parsed, localTemplates, depth-1)
if err != nil {
return nil, err
}
}

switch {
case len(parsed.Environment) > 0:
for key, value := range parsed.Environment {
Expand Down Expand Up @@ -276,12 +283,6 @@ func (c *client) compileInline(p *yaml.Build, localTemplates []string) (*yaml.Bu
}
}

// validate the yaml configuration
err := c.Validate(&newPipeline)
if err != nil {
return nil, err
}

return &newPipeline, nil
}

Expand Down