Skip to content

Commit

Permalink
Expand fields for GitLab project
Browse files Browse the repository at this point in the history
Get some more data. Also improve help to make it more clear what format
the URL needs to be in

Signed-off-by: Tim Smith <tsmith84@gmail.com>
  • Loading branch information
tas50 committed Nov 17, 2024
1 parent d48a9a3 commit 530a125
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 3 deletions.
2 changes: 1 addition & 1 deletion providers/gitlab/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var Config = plugin.Provider{
Long: "url",
Type: plugin.FlagType_String,
Default: "",
Desc: "Custom GitLab base url",
Desc: "Custom GitLab base URL (https://example.com/)",
},
},
},
Expand Down
6 changes: 6 additions & 0 deletions providers/gitlab/resources/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ func getGitlabProjectArgs(prj *gitlab.Project) map[string]*llx.RawData {
"visibility": llx.StringData(string(prj.Visibility)),
"webURL": llx.StringData(prj.WebURL),
"wikiEnabled": llx.BoolData(prj.WikiEnabled),
"jobsEnabled": llx.BoolData(prj.JobsEnabled),
"emptyRepo": llx.BoolData(prj.EmptyRepo),
"license": llx.StringData(prj.License.Name),
"sharedRunnersEnabled": llx.BoolData(prj.SharedRunnersEnabled),
"groupRunnersEnabled": llx.BoolData(prj.GroupRunnersEnabled),
}
}

Expand Down Expand Up @@ -141,6 +146,7 @@ func (p *mqlGitlabProject) approvalSettings() (*mqlGitlabProjectApprovalSetting,
"mergeRequestsAuthorApproval": llx.BoolData(approvalConfig.MergeRequestsAuthorApproval),
"mergeRequestsDisableCommittersApproval": llx.BoolData(approvalConfig.MergeRequestsDisableCommittersApproval),
"requirePasswordToApprove": llx.BoolData(approvalConfig.RequirePasswordToApprove),
"selectiveCodeOwnerRemovals": llx.BoolData(approvalConfig.SelectiveCodeOwnerRemovals),
}

mqlApprovalSettings, err := CreateResource(p.MqlRuntime, "gitlab.project.approvalSetting", approvalSettings)
Expand Down
16 changes: 14 additions & 2 deletions providers/gitlab/resources/gitlab.lr
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ gitlab.project @defaults("fullName visibility webURL") {
// Project path
path string
// Create date of the project
createdAt time
createdAt time
// Project description
description string
// Default Git branch
Expand Down Expand Up @@ -96,6 +96,16 @@ gitlab.project @defaults("fullName visibility webURL") {
projectFiles() []gitlab.project.file
// List of webhooks for the project
webhooks() []gitlab.project.webhook
// Whether CI jobs are enabled
jobsEnabled bool
// Whether the repo is empty or not
emptyRepo bool
// The license of the project if present
license string
// Whether the project is enabled for shared runners
sharedRunnersEnabled bool
// Whether the project is enabled for group runners
groupRunnersEnabled bool
}


Expand Down Expand Up @@ -123,6 +133,8 @@ private gitlab.project.approvalSetting @defaults("approvalsBeforeMerge requirePa
mergeRequestsDisableCommittersApproval bool
// Whether a password is required to approve
requirePasswordToApprove bool
// Whether approvals are reset from Code Owners if their files changed
selectiveCodeOwnerRemovals bool
}


Expand Down Expand Up @@ -166,4 +178,4 @@ private gitlab.project.webhook @defaults("url sslVerification") {
url string
// Whether SSL verification is enabled
sslVerification bool
}
}
72 changes: 72 additions & 0 deletions providers/gitlab/resources/gitlab.lr.go

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

11 changes: 11 additions & 0 deletions providers/gitlab/resources/gitlab.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@ resources:
description: {}
emailsDisabled:
min_mondoo_version: 9.0.0
emptyRepo:
min_mondoo_version: 9.0.0
fullName:
min_mondoo_version: 9.0.0
groupRunnersEnabled:
min_mondoo_version: 9.0.0
id: {}
issuesEnabled:
min_mondoo_version: 9.0.0
jobsEnabled:
min_mondoo_version: 9.0.0
license:
min_mondoo_version: 9.0.0
mergeMethod:
min_mondoo_version: 9.0.0
mergeRequestsEnabled:
Expand All @@ -73,6 +81,8 @@ resources:
min_mondoo_version: 9.0.0
serviceDeskEnabled:
min_mondoo_version: 9.0.0
sharedRunnersEnabled:
min_mondoo_version: 9.0.0
snippetsEnabled:
min_mondoo_version: 9.0.0
visibility: {}
Expand All @@ -99,6 +109,7 @@ resources:
mergeRequestsDisableCommittersApproval: {}
requirePasswordToApprove: {}
resetApprovalsOnPush: {}
selectiveCodeOwnerRemovals: {}
is_private: true
min_mondoo_version: 9.0.0
gitlab.project.file:
Expand Down

0 comments on commit 530a125

Please sign in to comment.