Adding SkipVerify to Secrets
This commit is contained in:
parent
2d90155d5a
commit
dfcaa78e85
8 changed files with 77 additions and 26 deletions
|
@ -20,6 +20,9 @@ type RepoSecret struct {
|
|||
|
||||
// the secret is restricted to this list of events.
|
||||
Events []string `json:"event,omitempty" meddler:"secret_events,json"`
|
||||
|
||||
// whether the secret requires verification
|
||||
SkipVerify bool `json:"skip_verify" meddler:"secret_skip_verify"`
|
||||
}
|
||||
|
||||
// Secret transforms a repo secret into a simple secret.
|
||||
|
@ -29,6 +32,7 @@ func (s *RepoSecret) Secret() *Secret {
|
|||
Value: s.Value,
|
||||
Images: s.Images,
|
||||
Events: s.Events,
|
||||
SkipVerify: s.SkipVerify,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +43,7 @@ func (s *RepoSecret) Clone() *RepoSecret {
|
|||
Name: s.Name,
|
||||
Images: s.Images,
|
||||
Events: s.Events,
|
||||
SkipVerify: s.SkipVerify,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ type Secret struct {
|
|||
|
||||
// the secret is restricted to this list of events.
|
||||
Events []string `json:"event,omitempty"`
|
||||
|
||||
// whether the secret requires verification
|
||||
SkipVerify bool `json:"skip_verify"`
|
||||
}
|
||||
|
||||
// Match returns true if an image and event match the restricted list.
|
||||
|
|
|
@ -20,6 +20,9 @@ type TeamSecret struct {
|
|||
|
||||
// the secret is restricted to this list of events.
|
||||
Events []string `json:"event,omitempty" meddler:"team_secret_events,json"`
|
||||
|
||||
// whether the secret requires verification
|
||||
SkipVerify bool `json:"skip_verify" meddler:"team_secret_skip_verify"`
|
||||
}
|
||||
|
||||
// Secret transforms a repo secret into a simple secret.
|
||||
|
@ -29,6 +32,7 @@ func (s *TeamSecret) Secret() *Secret {
|
|||
Value: s.Value,
|
||||
Images: s.Images,
|
||||
Events: s.Events,
|
||||
SkipVerify: s.SkipVerify,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +43,7 @@ func (s *TeamSecret) Clone() *TeamSecret {
|
|||
Name: s.Name,
|
||||
Images: s.Images,
|
||||
Events: s.Events,
|
||||
SkipVerify: s.SkipVerify,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
12
store/datastore/ddl/mysql/9.sql
Normal file
12
store/datastore/ddl/mysql/9.sql
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- +migrate Up
|
||||
|
||||
ALTER TABLE secrets ADD COLUMN secret_skip_verify BOOLEAN;
|
||||
ALTER TABLE team_secrets ADD COLUMN team_secret_skip_verify BOOLEAN;
|
||||
|
||||
UPDATE secrets SET secret_skip_verify = false;
|
||||
UPDATE team_secrets SET team_secret_skip_verify = false;
|
||||
|
||||
-- +migrate Down
|
||||
|
||||
ALTER TABLE secrets DROP COLUMN secret_skip_verify;
|
||||
ALTER TABLE team_secrets DROP COLUMN team_secret_skip_verify;
|
12
store/datastore/ddl/postgres/9.sql
Normal file
12
store/datastore/ddl/postgres/9.sql
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- +migrate Up
|
||||
|
||||
ALTER TABLE secrets ADD COLUMN secret_skip_verify BOOLEAN;
|
||||
ALTER TABLE team_secrets ADD COLUMN team_secret_skip_verify BOOLEAN;
|
||||
|
||||
UPDATE secrets SET secret_skip_verify = false;
|
||||
UPDATE team_secrets SET team_secret_skip_verify = false;
|
||||
|
||||
-- +migrate Down
|
||||
|
||||
ALTER TABLE secrets DROP COLUMN secret_skip_verify;
|
||||
ALTER TABLE team_secrets DROP COLUMN team_secret_skip_verify;
|
12
store/datastore/ddl/sqlite3/9.sql
Normal file
12
store/datastore/ddl/sqlite3/9.sql
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- +migrate Up
|
||||
|
||||
ALTER TABLE secrets ADD COLUMN secret_skip_verify BOOLEAN;
|
||||
ALTER TABLE team_secrets ADD COLUMN team_secret_skip_verify BOOLEAN;
|
||||
|
||||
UPDATE secrets SET secret_skip_verify = 0;
|
||||
UPDATE team_secrets SET team_secret_skip_verify = 0;
|
||||
|
||||
-- +migrate Down
|
||||
|
||||
ALTER TABLE secrets DROP COLUMN secret_skip_verify;
|
||||
ALTER TABLE team_secrets DROP COLUMN team_secret_skip_verify;
|
|
@ -28,6 +28,7 @@ func TestRepoSecrets(t *testing.T) {
|
|||
Value: "bar",
|
||||
Images: []string{"docker", "gcr"},
|
||||
Events: []string{"push", "tag"},
|
||||
SkipVerify: false,
|
||||
}
|
||||
err := s.SetSecret(secret)
|
||||
g.Assert(err == nil).IsTrue()
|
||||
|
|
|
@ -28,6 +28,7 @@ func TestTeamSecrets(t *testing.T) {
|
|||
Value: "bar",
|
||||
Images: []string{"docker", "gcr"},
|
||||
Events: []string{"push", "tag"},
|
||||
SkipVerify: false,
|
||||
}
|
||||
err := s.SetTeamSecret(secret)
|
||||
g.Assert(err == nil).IsTrue()
|
||||
|
|
Loading…
Reference in a new issue