Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
57e5162
Merge branch 'master' of github.com:go-vela/server
jbrockopp Feb 23, 2022
98b740d
chore: general refactor expand functions
jbrockopp Feb 23, 2022
461ca5a
chore: refactor template Render() functions
jbrockopp Feb 23, 2022
1e17b6a
enhance: support render inline templates
jbrockopp Feb 23, 2022
da5c94d
chore: fix api endpoints for compiler changes
jbrockopp Feb 23, 2022
776ddff
chore: add leftover todos
jbrockopp Feb 23, 2022
2eb7bd6
fix tests
JordanSussman Feb 24, 2022
4ebc042
Merge branch 'poc/stages/templates' of github.com:go-vela/server into…
jbrockopp Feb 25, 2022
8b5fe54
enhance: address leftover TODOs
jbrockopp Feb 25, 2022
5cd457c
chore: save work
jbrockopp Feb 25, 2022
805a6c3
fix pipeline type
JordanSussman Feb 25, 2022
bc62ada
Merge branch 'master' into poc/stages/templates
JordanSussman Feb 25, 2022
9c4e2fe
another fix
JordanSussman Feb 28, 2022
d1e9558
Merge branch 'poc/stages/templates' of github.com:go-vela/server into…
JordanSussman Feb 28, 2022
6a0e4b7
use branch from github instead of relative
JordanSussman Feb 28, 2022
e0a387d
feat: add a lite compile for pipeline endpoints
kneal Feb 28, 2022
87434f3
fix: add inline suppport to lite compile
kneal Feb 28, 2022
f3dac73
fix: update linter and add comments
kneal Feb 28, 2022
f667472
init tests for render_inline
JordanSussman Mar 6, 2022
25456e6
Merge branch 'master' into poc/stages/templates
JordanSussman Mar 6, 2022
f18ebe3
more updates
JordanSussman Mar 6, 2022
4e3fc56
Merge branch 'poc/stages/templates' of github.com:go-vela/server into…
JordanSussman Mar 6, 2022
8bb3b3c
more linter updates
JordanSussman Mar 6, 2022
469f91c
fix variables for templates
JordanSussman Mar 7, 2022
221597b
make linter happy
JordanSussman Mar 7, 2022
5049f4d
fix existing tests
JordanSussman Mar 7, 2022
43fb3a5
add more inline tests
JordanSussman Mar 7, 2022
00c0529
delete unused nolint
JordanSussman Mar 7, 2022
41af322
Merge branch 'poc/stages/templates' of github.com:go-vela/server into…
jbrockopp Mar 7, 2022
77da644
add test for pipeline type
JordanSussman Mar 7, 2022
2d02198
update goimports
JordanSussman Mar 7, 2022
82526a8
return build object
JordanSussman Mar 8, 2022
f450a0e
more code coverage
JordanSussman Mar 8, 2022
9bda378
Merge branch 'master' into poc/stages/templates
JordanSussman Mar 10, 2022
9a674fb
check if template is present
JordanSussman Mar 10, 2022
06b5871
fix linter
JordanSussman Mar 10, 2022
3e48d92
Merge branch 'poc/stages/templates' of github.com:go-vela/server into…
JordanSussman Mar 10, 2022
97b4f72
another linter update
JordanSussman Mar 10, 2022
40c2dd5
yet another update
JordanSussman Mar 10, 2022
08b1152
fix typo
JordanSussman Mar 10, 2022
795971b
yet more linter updates
JordanSussman Mar 10, 2022
8ce6fa0
fix test
JordanSussman Mar 11, 2022
4b65af5
make clean
JordanSussman Mar 11, 2022
af14284
return error if render_inline and step template mixed
JordanSussman Mar 11, 2022
44454a5
fix flaky test
JordanSussman Mar 11, 2022
d88662e
revert last_update code
JordanSussman Mar 11, 2022
4d9acce
fix test
JordanSussman Mar 11, 2022
4808ced
Merge branch 'master' into poc/stages/templates
JordanSussman Mar 11, 2022
fd7d467
fix test
JordanSussman Mar 11, 2022
81b8399
Merge branch 'poc/stages/templates' of github.com:go-vela/server into…
jbrockopp Mar 11, 2022
98204ca
chore: address linter feedback
jbrockopp Mar 11, 2022
15ca263
Merge branch 'master' into poc/stages/templates
wass3r Mar 15, 2022
28af1c7
default format to golang
JordanSussman Mar 15, 2022
770c636
make linter happy
JordanSussman Mar 15, 2022
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
fix linter
  • Loading branch information
JordanSussman committed Mar 10, 2022
commit 06b5871f55d712f7929783ae4f2726814ada1ce6
2 changes: 2 additions & 0 deletions api/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func GetPipeline(ctx *gin.Context) {
if err != nil {
retErr := fmt.Errorf("unable to validate pipeline configuration for %s: %w", repoName(ctx), err)
util.HandleError(ctx, http.StatusBadRequest, retErr)

return
}

Expand Down Expand Up @@ -263,6 +264,7 @@ func ExpandPipeline(ctx *gin.Context) {
if err != nil {
retErr := fmt.Errorf("unable to validate pipeline configuration for %s: %w", repoName(ctx), err)
util.HandleError(ctx, http.StatusBadRequest, retErr)

return
}

Expand Down
1 change: 1 addition & 0 deletions compiler/native/expand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func TestNative_ExpandStages(t *testing.T) {
if diff := cmp.Diff(build.Services, wantServices); diff != "" {
t.Errorf("ExpandStages() mismatch (-want +got):\n%s", diff)
}

if diff := cmp.Diff(build.Environment, wantEnvironment); diff != "" {
t.Errorf("ExpandStages() mismatch (-want +got):\n%s", diff)
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/template/native/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ func Render(tmpl string, name string, tName string, environment raw.StringSliceM
// https://pkg.go.dev/github.com/Masterminds/sprig?tab=doc#TxtFuncMap
t, err := template.New(name).Funcs(sf).Funcs(templateFuncMap).Parse(tmpl)
if err != nil {
return nil, fmt.Errorf("unable to parse template %s: %v", tName, err)
return nil, fmt.Errorf("unable to parse template %s: %w", tName, err)
}

// apply the variables to the parsed template
err = t.Execute(buffer, variables)
if err != nil {
return nil, fmt.Errorf("unable to execute template %s: %v", tName, err)
return nil, fmt.Errorf("unable to execute template %s: %w", tName, err)
}

// unmarshal the template to the pipeline
err = yaml.Unmarshal(buffer.Bytes(), config)
if err != nil {
return nil, fmt.Errorf("unable to unmarshal yaml: %v", err)
return nil, fmt.Errorf("unable to unmarshal yaml: %w", err)
}

// ensure all templated steps have template prefix
Expand Down
1 change: 1 addition & 0 deletions compiler/template/starlark/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func RenderBuild(b string, envs map[string]string, variables map[string]interfac
if err != nil {
return nil, err
}

err = context.SetKey(starlark.String("vars"), userVars)
if err != nil {
return nil, err
Expand Down