From 4eec5e9b03ab7e7004bfae08fc558eb2b27d87c5 Mon Sep 17 00:00:00 2001 From: claire1618 <55173466+claire1618@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:45:46 -0500 Subject: [PATCH] chore: updating types for lazy loading secrets (#992) Co-authored-by: Claire.Nicholas --- compiler/native/compile_test.go | 17 +++++++++++++++++ compiler/native/expand_test.go | 9 +++++++++ compiler/native/parse_test.go | 10 ++++++++++ go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/compiler/native/compile_test.go b/compiler/native/compile_test.go index 91948e07b..067349e01 100644 --- a/compiler/native/compile_test.go +++ b/compiler/native/compile_test.go @@ -231,6 +231,7 @@ func TestNative_Compile_StagesPipeline(t *testing.T) { Engine: "native", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_password", @@ -238,6 +239,7 @@ func TestNative_Compile_StagesPipeline(t *testing.T) { Engine: "vault", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, }, } @@ -567,6 +569,7 @@ func TestNative_Compile_StepsPipeline(t *testing.T) { Engine: "native", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_password", @@ -574,6 +577,7 @@ func TestNative_Compile_StepsPipeline(t *testing.T) { Engine: "vault", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, }, } @@ -805,6 +809,7 @@ func TestNative_Compile_StagesPipelineTemplate(t *testing.T) { Engine: "native", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_password", @@ -812,6 +817,7 @@ func TestNative_Compile_StagesPipelineTemplate(t *testing.T) { Engine: "vault", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "foo_password", @@ -819,6 +825,7 @@ func TestNative_Compile_StagesPipelineTemplate(t *testing.T) { Engine: "vault", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, }, Services: pipeline.ContainerSlice{ @@ -1047,6 +1054,7 @@ func TestNative_Compile_StepsPipelineTemplate(t *testing.T) { Engine: "native", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_password", @@ -1054,6 +1062,7 @@ func TestNative_Compile_StepsPipelineTemplate(t *testing.T) { Engine: "vault", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "foo_password", @@ -1061,6 +1070,7 @@ func TestNative_Compile_StepsPipelineTemplate(t *testing.T) { Engine: "vault", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, }, Services: pipeline.ContainerSlice{ @@ -2734,6 +2744,7 @@ func Test_Compile_Inline(t *testing.T) { Engine: "native", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_username", @@ -2741,6 +2752,7 @@ func Test_Compile_Inline(t *testing.T) { Engine: "native", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_password", @@ -2748,6 +2760,7 @@ func Test_Compile_Inline(t *testing.T) { Engine: "vault", Type: "repo", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_username", @@ -2755,6 +2768,7 @@ func Test_Compile_Inline(t *testing.T) { Engine: "native", Type: "org", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_password", @@ -2762,6 +2776,7 @@ func Test_Compile_Inline(t *testing.T) { Engine: "vault", Type: "org", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_username", @@ -2769,6 +2784,7 @@ func Test_Compile_Inline(t *testing.T) { Engine: "native", Type: "shared", Origin: &pipeline.Container{}, + Pull: "build_start", }, &pipeline.Secret{ Name: "docker_password", @@ -2776,6 +2792,7 @@ func Test_Compile_Inline(t *testing.T) { Engine: "vault", Type: "shared", Origin: &pipeline.Container{}, + Pull: "build_start", }, }, }, diff --git a/compiler/native/expand_test.go b/compiler/native/expand_test.go index 808be5a33..0ea845cfc 100644 --- a/compiler/native/expand_test.go +++ b/compiler/native/expand_test.go @@ -118,6 +118,7 @@ func TestNative_ExpandStages(t *testing.T) { Engine: "native", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, &yaml.Secret{ Name: "foo_password", @@ -125,6 +126,7 @@ func TestNative_ExpandStages(t *testing.T) { Engine: "vault", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, } @@ -287,6 +289,7 @@ func TestNative_ExpandSteps(t *testing.T) { Engine: "native", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, &yaml.Secret{ Name: "foo_password", @@ -294,6 +297,7 @@ func TestNative_ExpandSteps(t *testing.T) { Engine: "vault", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, } @@ -506,6 +510,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Engine: "native", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, &yaml.Secret{ Name: "foo_password", @@ -513,6 +518,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Engine: "vault", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, &yaml.Secret{ Name: "vault_token", @@ -520,6 +526,7 @@ func TestNative_ExpandStepsMulti(t *testing.T) { Engine: "native", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, &yaml.Secret{ Origin: yaml.Origin{ @@ -804,6 +811,7 @@ func TestNative_ExpandSteps_TemplateCallTemplate(t *testing.T) { Engine: "native", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, &yaml.Secret{ Name: "foo_password", @@ -811,6 +819,7 @@ func TestNative_ExpandSteps_TemplateCallTemplate(t *testing.T) { Engine: "vault", Type: "repo", Origin: yaml.Origin{}, + Pull: "build_start", }, } diff --git a/compiler/native/parse_test.go b/compiler/native/parse_test.go index 672ebcaaf..7176438e1 100644 --- a/compiler/native/parse_test.go +++ b/compiler/native/parse_test.go @@ -320,12 +320,14 @@ func TestNative_Parse_StagesPipeline(t *testing.T) { Key: "org/repo/docker/username", Engine: "native", Type: "repo", + Pull: "build_start", }, &yaml.Secret{ Name: "docker_password", Key: "org/repo/docker/password", Engine: "vault", Type: "repo", + Pull: "build_start", }, }, } @@ -421,12 +423,14 @@ func TestNative_Parse_StepsPipeline(t *testing.T) { Key: "org/repo/docker/username", Engine: "native", Type: "repo", + Pull: "build_start", }, &yaml.Secret{ Name: "docker_password", Key: "org/repo/docker/password", Engine: "vault", Type: "repo", + Pull: "build_start", }, }, } @@ -460,36 +464,42 @@ func TestNative_Parse_Secrets(t *testing.T) { Key: "org/repo/docker/username", Engine: "native", Type: "repo", + Pull: "build_start", }, &yaml.Secret{ Name: "docker_password", Key: "org/repo/docker/password", Engine: "vault", Type: "repo", + Pull: "build_start", }, &yaml.Secret{ Name: "docker_username", Key: "org/docker/username", Engine: "native", Type: "org", + Pull: "build_start", }, &yaml.Secret{ Name: "docker_password", Key: "org/docker/password", Engine: "vault", Type: "org", + Pull: "build_start", }, &yaml.Secret{ Name: "docker_username", Key: "org/team/docker/username", Engine: "native", Type: "shared", + Pull: "build_start", }, &yaml.Secret{ Name: "docker_password", Key: "org/team/docker/password", Engine: "vault", Type: "shared", + Pull: "build_start", }, }, } diff --git a/go.mod b/go.mod index 1aa96d380..d0cf1c469 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/drone/envsubst v1.0.3 github.com/gin-gonic/gin v1.9.1 github.com/go-playground/assert/v2 v2.2.0 - github.com/go-vela/types v0.21.1-0.20231012142227-0c0b890487af + github.com/go-vela/types v0.21.1-0.20231024201126-19101a5b1346 github.com/golang-jwt/jwt/v5 v5.0.0 github.com/google/go-cmp v0.5.9 github.com/google/go-github/v55 v55.0.0 diff --git a/go.sum b/go.sum index ccc23bbaa..fa1e03179 100644 --- a/go.sum +++ b/go.sum @@ -146,8 +146,8 @@ github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-vela/types v0.21.1-0.20231012142227-0c0b890487af h1:qiP6pXFDyPDDP+hy8zY+nhmoWv9aoQrrnNmfAAT6yCA= -github.com/go-vela/types v0.21.1-0.20231012142227-0c0b890487af/go.mod h1:Jn8K28uj7mACc55fkFgaIzL0q45iXydOFGEeoSeHUtQ= +github.com/go-vela/types v0.21.1-0.20231024201126-19101a5b1346 h1:8VqRJ02KcAxV+gHuxLzuPuNaf7EOE/zfBomEV+UPj/E= +github.com/go-vela/types v0.21.1-0.20231024201126-19101a5b1346/go.mod h1:Jn8K28uj7mACc55fkFgaIzL0q45iXydOFGEeoSeHUtQ= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=