Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4746 from hashicorp/backport/bug/pipelines/dont-a…
Browse files Browse the repository at this point in the history
…ppend-same-context/curiously-dear-mollusk

This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-waypoint authored May 25, 2023
2 parents 0171dd5 + 3f846a5 commit fbae194
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/4744.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
config: Remove extra eval context append for parsing configs which caused a slowdown during pipeline config parsing.
```
2 changes: 0 additions & 2 deletions internal/config/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ func (c *Config) Pipelines() []string {
// Note that currently this parsing function does not attempt to detect cycles
// between embedded pipelines.
func (c *Config) Pipeline(id string, ctx *hcl.EvalContext) (*Pipeline, error) {
ctx = appendContext(c.ctx, ctx)

// Find the pipeline by progressively decoding
var rawPipeline *hclPipeline
for _, p := range c.hclConfig.Pipelines {
Expand Down
14 changes: 14 additions & 0 deletions internal/config/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,20 @@ func TestPipelineProtos(t *testing.T) {
},
},

{
"pipelines_many_many_many.hcl",
func(t *testing.T, c *Config) {
require := require.New(t)

pipelines, err := c.PipelineProtos()
require.NoError(err)
require.Len(pipelines, 7)

require.Equal(pipelines[0].Name, "foo")
require.Equal(pipelines[1].Name, "bar")
},
},

{
"pipeline_nested_pipes.hcl",
func(t *testing.T, c *Config) {
Expand Down
84 changes: 84 additions & 0 deletions internal/config/testdata/pipelines/pipelines_many_many_many.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
project = "foo"

pipeline "foo" {
step "test" {
image_url = "example.com/test"

use "exec" {
command = "bar"
}
}
}


pipeline "bar" {
step "test2" {
image_url = "example.com/test"

use "exec" {
command = "bar"
}
}
}

pipeline "foofoo" {
step "test2" {
image_url = "example.com/test"

use "exec" {
command = "bar"
}
}
}

pipeline "barbar" {
step "test2" {
image_url = "example.com/test"

use "exec" {
command = "bar"
}
}
}

pipeline "foobar" {
step "test2" {
image_url = "example.com/test"

use "exec" {
command = "bar"
}
}
}

pipeline "naming-is-hard" {
step "test2" {
image_url = "example.com/test"

use "exec" {
command = "bar"
}
}
}

pipeline "hey-we-made-it" {
step "test2" {
image_url = "example.com/test"

use "exec" {
command = "bar"
}
}
}

app "web" {
config {
env = {
static = "hello"
}
}

build {}

deploy {}
}

0 comments on commit fbae194

Please sign in to comment.