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

Commit

Permalink
backport of commit 771c681
Browse files Browse the repository at this point in the history
  • Loading branch information
briancain committed Oct 28, 2022
1 parent 1bdc916 commit 4c83281
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
31 changes: 30 additions & 1 deletion internal/config/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"path/filepath"
"testing"

"github.com/hashicorp/go-hclog"
"github.com/hashicorp/waypoint/internal/config/variables"
pb "github.com/hashicorp/waypoint/pkg/server/gen"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -59,6 +61,29 @@ func TestPipeline(t *testing.T) {
},
},

{
"pipeline_input_var.hcl",
"foo",
func(t *testing.T, c *Pipeline) {
require := require.New(t)

require.NotNil(t, c)
require.Equal("foo", c.Name)

steps := c.Steps
s := steps[0]

var p testStepPluginConfig
diag := s.Configure(&p, nil)
if diag.HasErrors() {
t.Fatal(diag.Error())
}

require.NotEmpty(t, p.config.Foo)
require.Equal("example.com/test", s.ImageURL)
},
},

{
"pipeline_multi_step.hcl",
"foo",
Expand Down Expand Up @@ -222,7 +247,11 @@ func TestPipeline(t *testing.T) {
})
require.NoError(err)

pipeline, err := cfg.Pipeline(tt.Pipeline, nil)
evalCtx := EvalContext(nil, "").NewChild()
inputVars, _, _ := variables.EvaluateVariables(hclog.L(), nil, cfg.InputVariables, "")
AddVariables(evalCtx, inputVars)

pipeline, err := cfg.Pipeline(tt.Pipeline, evalCtx)
require.NoError(err)

tt.Func(t, pipeline)
Expand Down
28 changes: 28 additions & 0 deletions internal/config/testdata/pipelines/pipeline_input_var.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project = "foo"

pipeline "foo" {
step "test" {
image_url = var.image_url

use "test" {
foo = "bar"
}
}
}

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

build {}

deploy {}
}

variable "image_url" {
default = "example.com/test"
type = string
}

0 comments on commit 4c83281

Please sign in to comment.