Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updating types for lazy loading secrets #992

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions compiler/native/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,15 @@ func TestNative_Compile_StagesPipeline(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_password",
Key: "org/repo/docker/password",
Engine: "vault",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
},
}
Expand Down Expand Up @@ -567,13 +569,15 @@ func TestNative_Compile_StepsPipeline(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_password",
Key: "org/repo/docker/password",
Engine: "vault",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
},
}
Expand Down Expand Up @@ -805,20 +809,23 @@ func TestNative_Compile_StagesPipelineTemplate(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_password",
Key: "org/repo/docker/password",
Engine: "vault",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "foo_password",
Key: "org/repo/foo/password",
Engine: "vault",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
},
Services: pipeline.ContainerSlice{
Expand Down Expand Up @@ -1047,20 +1054,23 @@ func TestNative_Compile_StepsPipelineTemplate(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_password",
Key: "org/repo/docker/password",
Engine: "vault",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "foo_password",
Key: "org/repo/foo/password",
Engine: "vault",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
},
Services: pipeline.ContainerSlice{
Expand Down Expand Up @@ -2734,48 +2744,55 @@ func Test_Compile_Inline(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_username",
Key: "org/repo/docker/username",
Engine: "native",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_password",
Key: "org/repo/docker/password",
Engine: "vault",
Type: "repo",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_username",
Key: "org/docker/username",
Engine: "native",
Type: "org",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_password",
Key: "org/docker/password",
Engine: "vault",
Type: "org",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_username",
Key: "org/team/docker/username",
Engine: "native",
Type: "shared",
Origin: &pipeline.Container{},
Pull: "build_start",
},
&pipeline.Secret{
Name: "docker_password",
Key: "org/team/docker/password",
Engine: "vault",
Type: "shared",
Origin: &pipeline.Container{},
Pull: "build_start",
},
},
},
Expand Down
9 changes: 9 additions & 0 deletions compiler/native/expand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ func TestNative_ExpandStages(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
&yaml.Secret{
Name: "foo_password",
Key: "org/repo/foo/password",
Engine: "vault",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
}

Expand Down Expand Up @@ -287,13 +289,15 @@ func TestNative_ExpandSteps(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
&yaml.Secret{
Name: "foo_password",
Key: "org/repo/foo/password",
Engine: "vault",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
}

Expand Down Expand Up @@ -506,20 +510,23 @@ func TestNative_ExpandStepsMulti(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
&yaml.Secret{
Name: "foo_password",
Key: "org/repo/foo/password",
Engine: "vault",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
&yaml.Secret{
Name: "vault_token",
Key: "vault_token",
Engine: "native",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
&yaml.Secret{
Origin: yaml.Origin{
Expand Down Expand Up @@ -804,13 +811,15 @@ func TestNative_ExpandSteps_TemplateCallTemplate(t *testing.T) {
Engine: "native",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
&yaml.Secret{
Name: "foo_password",
Key: "org/repo/foo/password",
Engine: "vault",
Type: "repo",
Origin: yaml.Origin{},
Pull: "build_start",
},
}

Expand Down
10 changes: 10 additions & 0 deletions compiler/native/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
}
Expand Down Expand Up @@ -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",
},
},
}
Expand Down Expand Up @@ -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",
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down