Skip to content

Commit

Permalink
chore: upgrade server and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed May 16, 2024
1 parent acf42e2 commit 5379d4a
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 30 deletions.
14 changes: 7 additions & 7 deletions executor/linux/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestLinux_CreateBuild(t *testing.T) {
// setup types
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_build := testBuild()

Expand Down Expand Up @@ -220,7 +220,7 @@ func TestLinux_AssembleBuild_EnforceTrustedRepos(t *testing.T) {
// setup types
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_build := testBuild()

Expand Down Expand Up @@ -1050,7 +1050,7 @@ func TestLinux_PlanBuild(t *testing.T) {
// setup types
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_build := testBuild()

Expand Down Expand Up @@ -1232,7 +1232,7 @@ func TestLinux_AssembleBuild(t *testing.T) {
// setup types
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_build := testBuild()

Expand Down Expand Up @@ -1539,7 +1539,7 @@ func TestLinux_ExecBuild(t *testing.T) {
// setup types
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_build := testBuild()

Expand Down Expand Up @@ -1828,7 +1828,7 @@ func TestLinux_StreamBuild(t *testing.T) {
// setup types
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_build := testBuild()

Expand Down Expand Up @@ -2441,7 +2441,7 @@ func TestLinux_DestroyBuild(t *testing.T) {
// setup types
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_build := testBuild()

Expand Down
6 changes: 3 additions & 3 deletions executor/linux/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func TestLinux_Secret_exec(t *testing.T) {
// setup types
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_build := testBuild()

Expand Down Expand Up @@ -1152,7 +1152,7 @@ func TestLinux_Secret_injectSecret(t *testing.T) {
name: "secret with matching deployment event ACL injected",
step: &pipeline.Container{
Image: "alpine:latest",
Environment: map[string]string{"VELA_BUILD_EVENT": "deployment"},
Environment: map[string]string{"VELA_BUILD_EVENT": "deployment", "VELA_BUILD_EVENT_ACTION": "created"},
Secrets: pipeline.StepSecretSlice{{Source: "FOO", Target: "FOO"}},
},
msec: map[string]*library.Secret{
Expand All @@ -1169,7 +1169,7 @@ func TestLinux_Secret_injectSecret(t *testing.T) {
},
want: &pipeline.Container{
Image: "alpine:latest",
Environment: map[string]string{"FOO": "foo", "VELA_BUILD_EVENT": "deployment"},
Environment: map[string]string{"FOO": "foo", "VELA_BUILD_EVENT": "deployment", "VELA_BUILD_EVENT_ACTION": "created"},
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion executor/linux/stage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestLinux_CreateStage(t *testing.T) {

set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")
compiler, _ := native.New(cli.NewContext(nil, set, nil))
compiler, _ := native.FromCLIContext(cli.NewContext(nil, set, nil))

_pipeline, _, err := compiler.
Duplicate().
Expand Down
48 changes: 42 additions & 6 deletions executor/local/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ import (

func TestLocal_CreateBuild(t *testing.T) {
// setup types
compiler, _ := native.New(cli.NewContext(nil, flag.NewFlagSet("test", 0), nil))
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")

compiler, err := native.FromCLIContext(cli.NewContext(nil, set, nil))
if err != nil {
t.Errorf("unable to create compiler engine: %v", err)
}

_build := testBuild()

Expand Down Expand Up @@ -91,7 +97,13 @@ func TestLocal_CreateBuild(t *testing.T) {

func TestLocal_PlanBuild(t *testing.T) {
// setup types
compiler, _ := native.New(cli.NewContext(nil, flag.NewFlagSet("test", 0), nil))
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")

compiler, err := native.FromCLIContext(cli.NewContext(nil, set, nil))
if err != nil {
t.Errorf("unable to create compiler engine: %v", err)
}

_build := testBuild()

Expand Down Expand Up @@ -170,7 +182,13 @@ func TestLocal_PlanBuild(t *testing.T) {

func TestLocal_AssembleBuild(t *testing.T) {
// setup types
compiler, _ := native.New(cli.NewContext(nil, flag.NewFlagSet("test", 0), nil))
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")

compiler, err := native.FromCLIContext(cli.NewContext(nil, set, nil))
if err != nil {
t.Errorf("unable to create compiler engine: %v", err)
}

_build := testBuild()

Expand Down Expand Up @@ -283,7 +301,13 @@ func TestLocal_AssembleBuild(t *testing.T) {

func TestLocal_ExecBuild(t *testing.T) {
// setup types
compiler, _ := native.New(cli.NewContext(nil, flag.NewFlagSet("test", 0), nil))
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")

compiler, err := native.FromCLIContext(cli.NewContext(nil, set, nil))
if err != nil {
t.Errorf("unable to create compiler engine: %v", err)
}

_build := testBuild()

Expand Down Expand Up @@ -381,7 +405,13 @@ func TestLocal_ExecBuild(t *testing.T) {

func TestLocal_StreamBuild(t *testing.T) {
// setup types
compiler, _ := native.New(cli.NewContext(nil, flag.NewFlagSet("test", 0), nil))
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")

compiler, err := native.FromCLIContext(cli.NewContext(nil, set, nil))
if err != nil {
t.Errorf("unable to create compiler engine: %v", err)
}

_build := testBuild()

Expand Down Expand Up @@ -591,7 +621,13 @@ func TestLocal_StreamBuild(t *testing.T) {

func TestLocal_DestroyBuild(t *testing.T) {
// setup types
compiler, _ := native.New(cli.NewContext(nil, flag.NewFlagSet("test", 0), nil))
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")

compiler, err := native.FromCLIContext(cli.NewContext(nil, set, nil))
if err != nil {
t.Errorf("unable to create compiler engine: %v", err)
}

_build := testBuild()

Expand Down
8 changes: 7 additions & 1 deletion executor/local/stage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ func TestLocal_CreateStage(t *testing.T) {
_file := "testdata/build/stages/basic.yml"
_build := testBuild()

compiler, _ := native.New(cli.NewContext(nil, flag.NewFlagSet("test", 0), nil))
set := flag.NewFlagSet("test", 0)
set.String("clone-image", "target/vela-git:latest", "doc")

compiler, err := native.FromCLIContext(cli.NewContext(nil, set, nil))
if err != nil {
t.Errorf("unable to create compiler from CLI context: %v", err)
}

_pipeline, _, err := compiler.
Duplicate().
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ toolchain go1.22.2

require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/distribution/reference v0.5.0
github.com/distribution/reference v0.6.0
github.com/docker/docker v26.0.0+incompatible
github.com/docker/go-units v0.5.0
github.com/gin-gonic/gin v1.9.1
github.com/go-vela/sdk-go v0.23.3-0.20240424150003-64f8eb0ebcc0
github.com/go-vela/server v0.23.4-0.20240424144436-b55aa2bb3684
github.com/go-vela/types v0.23.4-0.20240405205548-f24f795ac0b7
github.com/go-vela/sdk-go v0.23.3-0.20240513192330-1d75672772e6
github.com/go-vela/server v0.23.4-0.20240513143405-93571138ad3f
github.com/go-vela/types v0.23.4-0.20240417135026-fb4a95c30338
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/go-cmp v0.6.0
github.com/joho/godotenv v1.5.1
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/docker v26.0.0+incompatible h1:Ng2qi+gdKADUa/VM+6b6YaY2nlZhk/lVJiKR/2bMudU=
github.com/docker/docker v26.0.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
Expand Down Expand Up @@ -100,12 +100,12 @@ 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-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/go-vela/sdk-go v0.23.3-0.20240424150003-64f8eb0ebcc0 h1:AYltea00KRHeIqVW0A1BDNH10Kb6Djfl69rCtztAqM0=
github.com/go-vela/sdk-go v0.23.3-0.20240424150003-64f8eb0ebcc0/go.mod h1:WB3MAFpnwvuvSGJLrGGbt6VO8aS1URiWa5kqjngO8mU=
github.com/go-vela/server v0.23.4-0.20240424144436-b55aa2bb3684 h1:O0gfupNx7aYPCCrXwVuisrbbqbVkvrRqRBAkSg1bIww=
github.com/go-vela/server v0.23.4-0.20240424144436-b55aa2bb3684/go.mod h1:QV9JFv+LdpAgkRJhHE92dh4vVdh0kNv8OJnyOLt++84=
github.com/go-vela/types v0.23.4-0.20240405205548-f24f795ac0b7 h1:3mN7ej69dMH3Vis3G/tPLzLL0Rfp8nR5qd0gpj5ejRM=
github.com/go-vela/types v0.23.4-0.20240405205548-f24f795ac0b7/go.mod h1:mEF9dLkk00rUXf/t39n2WvXZgJbxnPEEWy+DHqIlRUo=
github.com/go-vela/sdk-go v0.23.3-0.20240513192330-1d75672772e6 h1:Iyn34V6BE92LOhobcnmYeBtDMiaV+OEUVDFx9uZFjgw=
github.com/go-vela/sdk-go v0.23.3-0.20240513192330-1d75672772e6/go.mod h1:0k5Xv6h+ZdO08+dHmTDqrXTKJFR4tTI+wVLX3Qc+npw=
github.com/go-vela/server v0.23.4-0.20240513143405-93571138ad3f h1:d2J/3+wCmP9gKjGZPvn2A4eQuvqz3Occw+B361ByzpI=
github.com/go-vela/server v0.23.4-0.20240513143405-93571138ad3f/go.mod h1:tnymHBBZZFdiVYlXNg4AG87F7iWChFiIqI9Q+zLD9YY=
github.com/go-vela/types v0.23.4-0.20240417135026-fb4a95c30338 h1:I0v47dOdAvjX7lOFN4s28uONChmluD6TNgFL1hpav60=
github.com/go-vela/types v0.23.4-0.20240417135026-fb4a95c30338/go.mod h1:vISsYDdjz9RPEK6qZ+MxtrdZEjTVU4K30NomB3826u8=
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

0 comments on commit 5379d4a

Please sign in to comment.