Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ inputs:
description: Digger hostname
required: false
default: 'https://cloud.digger.dev'
digger-organisation:
description: The name of your digger organisation
required: false
setup-tfenv:
description: Setup tfenv
required: false
Expand Down Expand Up @@ -188,6 +191,7 @@ runs:
ACTIVATE_VENV: ${{ inputs.setup-checkov == 'true' }}
DISABLE_LOCKING: ${{ inputs.disable-locking == 'true' }}
DIGGER_TOKEN: ${{ inputs.digger-token }}
DIGGER_ORGANISATION: ${{ inputs.digger-organisation }}
DIGGER_HOSTNAME: ${{ inputs.digger-hostname }}
ACCUMULATE_PLANS: ${{ inputs.post-plans-as-one-comment == 'true' }}
REPORTING_STRATEGY: ${{ inputs.reporting-strategy }}
Expand Down
10 changes: 7 additions & 3 deletions cmd/digger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,15 @@ func main() {
}
var policyChecker core_policy.Checker
if os.Getenv("DIGGER_TOKEN") != "" {
if os.Getenv("DIGGER_ORGANISATION") == "" {
log.Fatalf("Token specified but missing organisation: DIGGER_ORGANISATION. Please set this value in action configuration.")
}
policyChecker = policy.DiggerPolicyChecker{
PolicyProvider: &policy.DiggerHttpPolicyProvider{
DiggerHost: os.Getenv("DIGGER_HOSTNAME"),
AuthToken: os.Getenv("DIGGER_TOKEN"),
HttpClient: http.DefaultClient,
DiggerHost: os.Getenv("DIGGER_HOSTNAME"),
DiggerOrganisation: os.Getenv("DIGGER_ORGANISATION"),
AuthToken: os.Getenv("DIGGER_TOKEN"),
HttpClient: http.DefaultClient,
}}
} else {
policyChecker = policy.NoOpPolicyChecker{}
Expand Down
7 changes: 2 additions & 5 deletions cmd/digger/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ func TestGitHubNewPullRequestContext(t *testing.T) {
PrNumber: prNumber,
}
commandsToRunPerProject, _, err := github.ConvertGithubEventToCommands(ghEvent, impactedProjects, requestedProject, map[string]configuration.Workflow{})
_, _, err = digger.RunCommandsPerProject(commandsToRunPerProject, &depGraph, context.RepositoryOwner, context.Repository, eventName, prNumber, prManager, lock, reporter, planStorage, policyChecker, "")
_, _, err = digger.RunCommandsPerProject(commandsToRunPerProject, &depGraph, context.Repository, context.Repository, eventName, prNumber, prManager, lock, reporter, planStorage, policyChecker, "")

assert.NoError(t, err)
if err != nil {
Expand Down Expand Up @@ -919,10 +919,7 @@ func TestGitHubNewCommentContext(t *testing.T) {
policyChecker := &utils.MockPolicyChecker{}

commandsToRunPerProject, _, err := github.ConvertGithubEventToCommands(ghEvent, impactedProjects, requestedProject, map[string]configuration.Workflow{})
_, _, err = digger.RunCommandsPerProject(commandsToRunPerProject, &depGraph, context.RepositoryOwner, context.Repository, eventName, prNumber, prManager, lock, reporter, planStorage, policyChecker, "")

_, _, err = digger.RunCommandsPerProject(commandsToRunPerProject, &depGraph, context.RepositoryOwner, context.Repository, eventName, prNumber, prManager, lock, reporter, planStorage, policyChecker, "")

_, _, err = digger.RunCommandsPerProject(commandsToRunPerProject, &depGraph, context.Repository, context.Repository, eventName, prNumber, prManager, lock, reporter, planStorage, policyChecker, "")
assert.NoError(t, err)
if err != nil {
fmt.Println(err)
Expand Down
15 changes: 0 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRB
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/aws/aws-sdk-go v1.44.282 h1:ZPB9QhwxmMIEC8ja0DdFowOl5fODWaZ6s2cZ40fx6r8=
github.com/aws/aws-sdk-go v1.44.282/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.291 h1:JVgIyvdYm/A6iCHD0UIS/Hvu/GVHjpW7bN3mwG6sHlU=
github.com/aws/aws-sdk-go v1.44.291/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand All @@ -44,7 +42,6 @@ github.com/caarlos0/env/v8 v8.0.0/go.mod h1:7K4wMY9bH0esiXSSHlfHLX5xKGQMnkH5Fk4T
github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
Expand Down Expand Up @@ -74,7 +71,6 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
Expand All @@ -83,7 +79,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down Expand Up @@ -118,8 +113,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v53 v53.1.0 h1:mKJnR9lzZwD1fvbp27aK1i6rxyAbycWsXlN+r9JKPqM=
github.com/google/go-github/v53 v53.1.0/go.mod h1:XhFRObz+m/l+UCm9b7KSIC3lT3NWSXGt7mOsAWEloao=
github.com/google/go-github/v53 v53.2.0 h1:wvz3FyF53v4BK+AsnvCmeNhf8AkTaeh2SoYu/XUvTtI=
github.com/google/go-github/v53 v53.2.0/go.mod h1:XhFRObz+m/l+UCm9b7KSIC3lT3NWSXGt7mOsAWEloao=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
Expand All @@ -146,9 +139,6 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand All @@ -159,9 +149,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfr
github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5 h1:YH424zrwLTlyHSH/GzLMJeu5zhYVZSx5RQxGKm1h96s=
github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5/go.mod h1:PoGiBqKSQK1vIfQ+yVaFcGjDySHvym6FM1cNYnwzbrY=
github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/open-policy-agent/opa v0.53.1 h1:APN8iA7Txgel13kSkc6S8dbUulydiPojXt6iyubmB7Q=
github.com/open-policy-agent/opa v0.53.1/go.mod h1:j3wl8FqSz/+u33Scl72Ms2wxkZx4yZPdqSCrOqBqdsA=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
Expand Down Expand Up @@ -196,8 +183,6 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tchap/go-patricia/v2 v2.3.1 h1:6rQp39lgIYZ+MHmdEq4xzuk1t7OdC35z/xm0BGhTkes=
github.com/tchap/go-patricia/v2 v2.3.1/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k=
github.com/xanzy/go-gitlab v0.85.0 h1:E/wjnsd/mM5kV6O9y5+i6zxjx+wfAwa97sgcT1ETNwk=
github.com/xanzy/go-gitlab v0.85.0/go.mod h1:5ryv+MnpZStBH8I/77HuQBsMbBGANtVpLWC15qOjWAw=
github.com/xanzy/go-gitlab v0.86.0 h1:jR8V9cK9jXRQDb46KOB20NCF3ksY09luaG0IfXE6p7w=
github.com/xanzy/go-gitlab v0.86.0/go.mod h1:5ryv+MnpZStBH8I/77HuQBsMbBGANtVpLWC15qOjWAw=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
Expand Down
4 changes: 3 additions & 1 deletion pkg/core/policy/policy.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package policy

import "digger/pkg/ci"

type Provider interface {
GetPolicy(namespace string, projectname string) (string, error)
}

type Checker interface {
Check(organisation string, namespace string, projectname string, command string, requestedBy string) (bool, error)
Check(ciService ci.CIService, SCMOrganisation string, SCMrepository string, projectname string, command string, requestedBy string) (bool, error)
}
6 changes: 4 additions & 2 deletions pkg/digger/digger.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ func RunCommandsPerProject(
) (bool, bool, error) {
appliesPerProject := make(map[string]bool)

organisation := strings.Split(projectNamespace, "/")[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is generic function called by other CI providers, so shouldn't rename it either

splits := strings.Split(projectNamespace, "/")
SCMOrganisation := splits[0]
SCMrepository := splits[1]

commandsPerProject = SortedCommandsByDependency(commandsPerProject, dependencyGraph)

for _, projectCommands := range commandsPerProject {
for _, command := range projectCommands.Commands {
fmt.Printf("Running '%s' for project '%s'\n", command, projectCommands.ProjectName)

allowedToPerformCommand, err := policyChecker.Check(organisation, projectNamespace, projectCommands.ProjectName, command, requestedBy)
allowedToPerformCommand, err := policyChecker.Check(ciService, SCMOrganisation, SCMrepository, projectCommands.ProjectName, command, requestedBy)

if err != nil {
return false, false, fmt.Errorf("error checking policy: %v", err)
Expand Down
46 changes: 25 additions & 21 deletions pkg/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,29 @@ import (
"github.com/open-policy-agent/opa/rego"
"io"
"net/http"
"strings"
)

type PolicyProvider interface {
GetPolicy(organisation string, namespace string, projectname string) (string, error)
GetPolicy(organisation string, repository string, projectname string) (string, error)
GetOrganisation() string
}

type DiggerHttpPolicyProvider struct {
DiggerHost string
AuthToken string
HttpClient *http.Client
DiggerHost string
DiggerOrganisation string
AuthToken string
HttpClient *http.Client
}

type NoOpPolicyChecker struct {
}

func (p NoOpPolicyChecker) Check(_ string, _ string, _ string, _ string, _ string) (bool, error) {
func (p NoOpPolicyChecker) Check(_ ci.CIService, _ string, _ string, _ string, _ string, _ string) (bool, error) {
return true, nil
}

func (p *DiggerHttpPolicyProvider) getPolicyForOrganisation(organisation string) (string, *http.Response, error) {

func getPolicyForOrganisation(p *DiggerHttpPolicyProvider) (string, *http.Response, error) {
organisation := p.DiggerOrganisation
req, err := http.NewRequest("GET", p.DiggerHost+"/orgs/"+organisation+"/access-policy", nil)
if err != nil {
return "", nil, err
Expand All @@ -49,10 +50,8 @@ func (p *DiggerHttpPolicyProvider) getPolicyForOrganisation(organisation string)
return string(body), resp, nil
}

func (p *DiggerHttpPolicyProvider) getPolicyForNamespace(namespace string, projectName string) (string, *http.Response, error) {

// fetch RBAC policies for projectfrom Digger API
namespace = strings.ReplaceAll(namespace, "/", "-")
func getPolicyForNamespace(p *DiggerHttpPolicyProvider, namespace string, projectName string) (string, *http.Response, error) {
// fetch RBAC policies for project from Digger API
req, err := http.NewRequest("GET", p.DiggerHost+"/repos/"+namespace+"/projects/"+projectName+"/access-policy", nil)

if err != nil {
Expand All @@ -75,15 +74,17 @@ func (p *DiggerHttpPolicyProvider) getPolicyForNamespace(namespace string, proje
}

// GetPolicy fetches policy for particular project, if not found then it will fallback to org level policy
func (p *DiggerHttpPolicyProvider) GetPolicy(organisation string, namespace string, projectName string) (string, error) {
content, resp, err := p.getPolicyForNamespace(namespace, projectName)
func (p *DiggerHttpPolicyProvider) GetPolicy(organisation string, repo string, projectName string) (string, error) {
namespace := fmt.Sprintf("%v-%v", organisation, repo)
content, resp, err := getPolicyForNamespace(p, namespace, projectName)
if err != nil {
return "", err
}
if resp.StatusCode == 200 {

if resp.StatusCode == 200 && content != "" {
return content, nil
} else if resp.StatusCode == 404 {
content, resp, err := p.getPolicyForOrganisation(organisation)
content, resp, err := getPolicyForOrganisation(p)
if err != nil {
return "", err
}
Expand All @@ -99,15 +100,18 @@ func (p *DiggerHttpPolicyProvider) GetPolicy(organisation string, namespace stri
}
}

func (p *DiggerHttpPolicyProvider) GetOrganisation() string {
return p.DiggerOrganisation
}

type DiggerPolicyChecker struct {
PolicyProvider PolicyProvider
ciService ci.CIService
}

func (p DiggerPolicyChecker) Check(organisation string, namespace string, projectName string, command string, requestedBy string) (bool, error) {
policy, err := p.PolicyProvider.GetPolicy(organisation, namespace, projectName)

teams, err := p.ciService.GetUserTeams(organisation, requestedBy)
func (p DiggerPolicyChecker) Check(ciService ci.CIService, SCMOrganisation string, SCMrepository string, projectName string, command string, requestedBy string) (bool, error) {
organisation := p.PolicyProvider.GetOrganisation()
policy, err := p.PolicyProvider.GetPolicy(organisation, SCMrepository, projectName)
teams, err := ciService.GetUserTeams(SCMOrganisation, requestedBy)
if err != nil {
fmt.Printf("Error while fetching user teams for CI service: %v", err)
return false, err
Expand Down
18 changes: 15 additions & 3 deletions pkg/policy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
type OpaExamplePolicyProvider struct {
}

func (s *OpaExamplePolicyProvider) GetPolicy(_ string, _ string, _ string) (string, error) {
func (s *OpaExamplePolicyProvider) GetPolicy(_ string, _ string) (string, error) {
return "package digger\n" +
"\n" +
"# user-role assignments\n" +
Expand Down Expand Up @@ -41,6 +41,10 @@ func (s *OpaExamplePolicyProvider) GetPolicy(_ string, _ string, _ string) (stri
"}", nil
}

func (s *OpaExamplePolicyProvider) GetOrganisation() string {
return "ORGANISATIONDIGGER"
}

type DiggerExamplePolicyProvider struct {
}

Expand All @@ -60,6 +64,10 @@ func (s *DiggerExamplePolicyProvider) GetPolicy(_ string, _ string, _ string) (s
"", nil
}

func (s *DiggerExamplePolicyProvider) GetOrganisation() string {
return "ORGANISATIONDIGGER"
}

type DiggerExamplePolicyProvider2 struct {
}

Expand All @@ -82,6 +90,10 @@ func (s *DiggerExamplePolicyProvider2) GetPolicy(_ string, _ string, _ string) (
"", nil
}

func (s *DiggerExamplePolicyProvider2) GetOrganisation() string {
return "ORGANISATIONDIGGER"
}

func TestDiggerPolicyChecker_Check(t *testing.T) {
type fields struct {
PolicyProvider PolicyProvider
Expand Down Expand Up @@ -145,9 +157,9 @@ func TestDiggerPolicyChecker_Check(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
var p = &DiggerPolicyChecker{
PolicyProvider: tt.fields.PolicyProvider,
ciService: utils.MockPullRequestManager{Teams: []string{"engineering"}},
}
got, err := p.Check(tt.organisation, tt.name, tt.name, tt.command, tt.requestedBy)
ciService := utils.MockPullRequestManager{Teams: []string{"engineering"}}
got, err := p.Check(ciService, tt.organisation, tt.name, tt.name, tt.command, tt.requestedBy)
if (err != nil) != tt.wantErr {
t.Errorf("DiggerPolicyChecker.Check() error = %v, wantErr %v", err, tt.wantErr)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (lock *MockLock) GetLock(resource string) (*int, error) {
type MockPolicyChecker struct {
}

func (t MockPolicyChecker) Check(organisation string, namespace string, projectname string, command string, requestedBy string) (bool, error) {
func (t MockPolicyChecker) Check(ciService ci.CIService, SCMOrganisation string, SCMrepository string, projectName string, command string, requestedBy string) (bool, error) {
return false, nil
}

Expand Down