diff --git a/database/ddl/postgres/secret.go b/database/ddl/postgres/secret.go index 21d15cd9d..21ef759b1 100644 --- a/database/ddl/postgres/secret.go +++ b/database/ddl/postgres/secret.go @@ -20,6 +20,7 @@ secrets ( value BYTEA, images VARCHAR(1000), events VARCHAR(1000), + allow_command BOOLEAN, UNIQUE(type, org, repo, name), UNIQUE(type, org, team, name) ); diff --git a/database/ddl/sqlite/secret.go b/database/ddl/sqlite/secret.go index c491439a0..560f6bffd 100644 --- a/database/ddl/sqlite/secret.go +++ b/database/ddl/sqlite/secret.go @@ -20,6 +20,7 @@ secrets ( value TEXT, images TEXT, events TEXT, + allow_command BOOLEAN, UNIQUE(type, org, repo, name), UNIQUE(type, org, team, name) ); diff --git a/database/secret_test.go b/database/secret_test.go index 66ff6bb1a..f6fd14fe1 100644 --- a/database/secret_test.go +++ b/database/secret_test.go @@ -628,15 +628,17 @@ func testSecret() *library.Secret { i64 := int64(0) str := "" arr := []string{} + booL := false return &library.Secret{ - ID: &i64, - Org: &str, - Repo: &str, - Team: &str, - Name: &str, - Value: &str, - Type: &str, - Images: &arr, - Events: &arr, + ID: &i64, + Org: &str, + Repo: &str, + Team: &str, + Name: &str, + Value: &str, + Type: &str, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } } diff --git a/go.mod b/go.mod index 16674640b..0139ed551 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.4.0 github.com/go-redis/redis v6.15.6+incompatible - github.com/go-vela/compiler v0.1.4 - github.com/go-vela/types v0.1.2 + github.com/go-vela/compiler v0.1.5 + github.com/go-vela/types v0.1.3 github.com/google/go-cmp v0.3.1 github.com/google/go-github/v26 v26.1.3 github.com/google/uuid v1.1.1 diff --git a/go.sum b/go.sum index bffee2174..238f93941 100644 --- a/go.sum +++ b/go.sum @@ -67,10 +67,10 @@ github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZp github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-vela/compiler v0.1.4 h1:3otdK/ATLIRdogCZtnqBzwxM78kcry1KFShYeRy7u8Y= -github.com/go-vela/compiler v0.1.4/go.mod h1:4c2Erqdq5eirc6km/KJduoN5F5M/96AlXi95LAQZBq4= -github.com/go-vela/types v0.1.2 h1:1YyjLJNREMiEkI8KH2bGICz7jihvsROTjFm8TaoaY7E= -github.com/go-vela/types v0.1.2/go.mod h1:JR5jxRuE5A+RZyyQqMd4lJoUApVFo/Iq9iABbQzPCj0= +github.com/go-vela/compiler v0.1.5 h1:6zrW7ydyId7KMkYpYi51Dm7ZQMuwByCfcnJqyWR7ZOQ= +github.com/go-vela/compiler v0.1.5/go.mod h1:gzPGewolyck47FSmZapgo5rU2OvAECrlTyxUGlnWZ0g= +github.com/go-vela/types v0.1.3 h1:y7PRarTVNZdu9x8v3vah+0+hB4NuNHYqY5Uq6MVJ04U= +github.com/go-vela/types v0.1.3/go.mod h1:JR5jxRuE5A+RZyyQqMd4lJoUApVFo/Iq9iABbQzPCj0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/secret/native/create_test.go b/secret/native/create_test.go index 6f2f69a86..88526a6f1 100644 --- a/secret/native/create_test.go +++ b/secret/native/create_test.go @@ -23,16 +23,18 @@ func TestNative_Create_Org(t *testing.T) { value := "baz" typee := "org" arr := []string{"foo", "bar"} + booL := false want := &library.Secret{ - ID: &one, - Org: &org, - Repo: &repo, - Team: &team, - Name: &name, - Value: &value, - Type: &typee, - Images: &arr, - Events: &arr, + ID: &one, + Org: &org, + Repo: &repo, + Team: &team, + Name: &name, + Value: &value, + Type: &typee, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } // setup database @@ -70,16 +72,18 @@ func TestNative_Create_Repo(t *testing.T) { value := "foob" typee := "repo" arr := []string{"foo", "bar"} + booL := false want := &library.Secret{ - ID: &one, - Org: &org, - Repo: &repo, - Team: &team, - Name: &name, - Value: &value, - Type: &typee, - Images: &arr, - Events: &arr, + ID: &one, + Org: &org, + Repo: &repo, + Team: &team, + Name: &name, + Value: &value, + Type: &typee, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } // setup database @@ -117,16 +121,18 @@ func TestNative_Create_Shared(t *testing.T) { value := "foob" typee := "shared" arr := []string{"foo", "bar"} + booL := false want := &library.Secret{ - ID: &one, - Org: &org, - Repo: &repo, - Team: &team, - Name: &name, - Value: &value, - Type: &typee, - Images: &arr, - Events: &arr, + ID: &one, + Org: &org, + Repo: &repo, + Team: &team, + Name: &name, + Value: &value, + Type: &typee, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } // setup database @@ -163,15 +169,17 @@ func TestNative_Create_Invalid(t *testing.T) { value := "foob" typee := "invalid" arr := []string{"foo", "bar"} + booL := false sec := &library.Secret{ - ID: &one, - Org: &org, - Repo: &repo, - Name: &name, - Value: &value, - Type: &typee, - Images: &arr, - Events: &arr, + ID: &one, + Org: &org, + Repo: &repo, + Name: &name, + Value: &value, + Type: &typee, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } // setup database diff --git a/secret/native/get_test.go b/secret/native/get_test.go index 0c24ce60c..3939a6f4c 100644 --- a/secret/native/get_test.go +++ b/secret/native/get_test.go @@ -23,16 +23,18 @@ func TestNative_Get(t *testing.T) { value := "foob" typee := "repo" arr := []string{"foo", "bar"} + booL := false want := &library.Secret{ - ID: &one, - Org: &org, - Repo: &repo, - Team: &team, - Name: &name, - Value: &value, - Type: &typee, - Images: &arr, - Events: &arr, + ID: &one, + Org: &org, + Repo: &repo, + Team: &team, + Name: &name, + Value: &value, + Type: &typee, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } // setup database diff --git a/secret/native/list_test.go b/secret/native/list_test.go index 3fa244e5d..648844c9c 100644 --- a/secret/native/list_test.go +++ b/secret/native/list_test.go @@ -23,28 +23,31 @@ func TestNative_List(t *testing.T) { value := "foob" typee := "repo" arr := []string{"foo", "bar"} + booL := false sOne := &library.Secret{ - ID: &one, - Org: &org, - Repo: &repo, - Team: &team, - Name: &name, - Value: &value, - Type: &typee, - Images: &arr, - Events: &arr, + ID: &one, + Org: &org, + Repo: &repo, + Team: &team, + Name: &name, + Value: &value, + Type: &typee, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } two := int64(2) sTwo := &library.Secret{ - ID: &two, - Org: &org, - Repo: &repo, - Team: &team, - Name: &value, - Value: &name, - Type: &typee, - Images: &arr, - Events: &arr, + ID: &two, + Org: &org, + Repo: &repo, + Team: &team, + Name: &value, + Value: &name, + Type: &typee, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } want := []*library.Secret{sTwo, sOne} diff --git a/secret/native/update_test.go b/secret/native/update_test.go index 7b399bfd8..d8a27f93c 100644 --- a/secret/native/update_test.go +++ b/secret/native/update_test.go @@ -23,16 +23,18 @@ func TestNative_Update(t *testing.T) { value := "foob" typee := "repo" arr := []string{"foo", "bar"} + booL := false want := &library.Secret{ - ID: &one, - Org: &org, - Repo: &repo, - Team: &team, - Name: &name, - Value: &value, - Type: &typee, - Images: &arr, - Events: &arr, + ID: &one, + Org: &org, + Repo: &repo, + Team: &team, + Name: &name, + Value: &value, + Type: &typee, + Images: &arr, + Events: &arr, + AllowCommand: &booL, } // setup database