Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: laurentsimon <[email protected]>
  • Loading branch information
laurentsimon committed Mar 27, 2024
1 parent d01a816 commit 66038fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions pkg/deployment/internal/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Package struct {
}

type Protection struct {
ServiceAccount string `json:"service_account"`
GoogleServiceAccount string `json:"google_service_account"`
}

// Policy defines the policy.
Expand Down Expand Up @@ -91,7 +91,7 @@ func (p *Policy) validateFormat() error {
}

func (p *Policy) validateProtection() error {
if p.Protection.ServiceAccount == "" {
if p.Protection.GoogleServiceAccount == "" {
return fmt.Errorf("[project] %w: empty protection service_account", errs.ErrorInvalidField)
}
return nil
Expand Down Expand Up @@ -176,7 +176,7 @@ func FromReaders(readers iterator.NamedReadCloserIterator, orgPolicy organizatio
policies[id] = *policy

// The protection must be unique across all projects.
name := policy.Protection.ServiceAccount
name := policy.Protection.GoogleServiceAccount
if _, exists := protections[name]; exists {
return nil, fmt.Errorf("[project] %w: protection's serivce_account (%q) is defined more than once", errs.ErrorInvalidField, name)
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/deployment/internal/project/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_validateProtection(t *testing.T) {
name: "service_account present",
policy: Policy{
Protection: Protection{
ServiceAccount: "the_sa",
GoogleServiceAccount: "the_sa",
},
},
},
Expand Down Expand Up @@ -462,7 +462,7 @@ func Test_Evaluate(t *testing.T) {
}
project := Policy{
Protection: Protection{
ServiceAccount: "protection_name",
GoogleServiceAccount: "protection_name",
},
BuildRequirements: BuildRequirements{
RequireSlsaLevel: common.AsPointer(2),
Expand Down Expand Up @@ -666,7 +666,7 @@ func Test_FromReaders(t *testing.T) {
{
Format: 1,
Protection: Protection{
ServiceAccount: "protection_name",
GoogleServiceAccount: "protection_name",
},
Packages: []Package{
{
Expand All @@ -683,7 +683,7 @@ func Test_FromReaders(t *testing.T) {
{
Format: 1,
Protection: Protection{
ServiceAccount: "protection_name2",
GoogleServiceAccount: "protection_name2",
},
Packages: []Package{
{
Expand All @@ -707,7 +707,7 @@ func Test_FromReaders(t *testing.T) {
{
Format: 1,
Protection: Protection{
ServiceAccount: "protection_name",
GoogleServiceAccount: "protection_name",
},
Packages: []Package{
{
Expand All @@ -724,7 +724,7 @@ func Test_FromReaders(t *testing.T) {
{
Format: 1,
Protection: Protection{
ServiceAccount: "protection_name",
GoogleServiceAccount: "protection_name",
},
Packages: []Package{
{
Expand All @@ -749,7 +749,7 @@ func Test_FromReaders(t *testing.T) {
{
Format: 1,
Protection: Protection{
ServiceAccount: "protection_name",
GoogleServiceAccount: "protection_name",
},
Packages: []Package{
{
Expand All @@ -766,7 +766,7 @@ func Test_FromReaders(t *testing.T) {
{
Format: 1,
Protection: Protection{
ServiceAccount: "protection_name2",
GoogleServiceAccount: "protection_name2",
},
Packages: []Package{
{
Expand All @@ -791,7 +791,7 @@ func Test_FromReaders(t *testing.T) {
{
Format: 1,
Protection: Protection{
ServiceAccount: "protection_name",
GoogleServiceAccount: "protection_name",
},
Packages: []Package{
{
Expand Down

0 comments on commit 66038fd

Please sign in to comment.