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/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