Skip to content

Commit

Permalink
feat: general update
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik Scholl committed Jun 7, 2024
1 parent 0326184 commit b855642
Show file tree
Hide file tree
Showing 14 changed files with 531 additions and 123 deletions.
11 changes: 11 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
with-expecter: True
all: true
filename: "{{.InterfaceName}}.go"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
log-level: "info"
packages:
github.com/steffakasid/trivy-scanner/internal:
config:
dir: "internal/mocks"
recursive: True
8 changes: 7 additions & 1 deletion internal/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type GitLabClient struct {
GroupsClient GitLabGroups
ProjectsClient GitLabProjects
JobsClient GitLabJobs
PipelinesClient GitLabPipelines
RepositoryFiles GitLabRepositoryFiles
}

Expand All @@ -26,8 +27,13 @@ type GitLabProjects interface {
type GitLabJobs interface {
ListProjectJobs(pid interface{}, opts *gitlab.ListJobsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Job, *gitlab.Response, error)
DownloadArtifactsFile(pid interface{}, refName string, opt *gitlab.DownloadArtifactsFileOptions, options ...gitlab.RequestOptionFunc) (*bytes.Reader, *gitlab.Response, error)
GetJobArtifacts(pid interface{}, jobID int, options ...gitlab.RequestOptionFunc) (*bytes.Reader, *gitlab.Response, error)
ListPipelineJobs(pid interface{}, pipelineID int, opts *gitlab.ListJobsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Job, *gitlab.Response, error)
}

type GitLabPipelines interface {
GetLatestPipeline(pid interface{}, opt *gitlab.GetLatestPipelineOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Pipeline, *gitlab.Response, error)
}
type GitLabRepositoryFiles interface {
GetRawFile(pid interface{}, fileName string, opt *gitlab.GetRawFileOptions, options ...gitlab.RequestOptionFunc) ([]byte, *gitlab.Response, error)
}
Expand All @@ -47,7 +53,7 @@ func (c GitLabClient) GetProjects(groupId string) ([]*gitlab.Project, error) {

func (c GitLabClient) GetAllGroupProjects(groupId string) ([]*gitlab.Project, error) {
allProjs := []*gitlab.Project{}
var options *gitlab.ListGroupProjectsOptions = &gitlab.ListGroupProjectsOptions{
var options = &gitlab.ListGroupProjectsOptions{
ListOptions: gitlab.ListOptions{
PerPage: 100,
Page: 1,
Expand Down
41 changes: 34 additions & 7 deletions internal/mocks/GitLabGroups.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b855642

Please sign in to comment.