gitlab

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateProjectsInGroups

func UpdateProjectsInGroups(cfg *Config) error

UpdateProjectsInGroups is the entry point for this package and will update any projects found within the groups defined in *Config.Groups.

Types

type Config

type Config struct {
	APIToken *string     `json:"apitoken,omitempty"`
	APIURL   *string     `json:"apiurl,omitempty"`
	Defaults *Settings   `json:"defaults,omitempty"`
	Groups   []*Settings `json:"groups,omitempty"`
	DryRun   bool
}

Config represents the GitLab section of the config file.

func (*Config) LoadCreds

func (c *Config) LoadCreds(token, url string) error

LoadCreds accepts a token and url string; if these are empty it will attempt read the GITLAB_TOKEN and GITLAB_URL env vars as a source for credentials. If these are also empty it returns an error.

func (*Config) MergeRequestApprovalSettings

func (c *Config) MergeRequestApprovalSettings(ns string) *gitlab.ProjectApprovals

MergeRequestApprovalSettings will return the Merge Request Approval settings for a project by looking up it's namespace in the config.

func (*Config) ProtectedBranchesSettings

func (c *Config) ProtectedBranchesSettings(ns string) []*ProtectedBranchSetting

ProtectedBranchesSettings will return the Protected Branches settings for a project by looking up it's namespace in the config.

func (*Config) SlackSettings

func (c *Config) SlackSettings(ns string) *SlackSettings

SlackSettings will return the Slack settings for a project by looking up it's namespace in the config.

type Groups

type Groups []*gitlab.Group

Groups exists to provide helper methods to []*gitlab.Group

type ProtectedBranchSetting

type ProtectedBranchSetting struct {
	Name           string `json:"name,omitempty"`
	AllowedToMerge string `json:"allowed_to_merge,omitempty"`
	AllowedToPush  string `json:"allowed_to_push,omitempty"`
}

type Settings

type Settings struct {
	Name    string `json:"name,omitempty"`
	General struct {
		MergeRequestApprovals gitlab.ProjectApprovals `json:"merge_request_approvals,omitempty"`
	} `json:"general,omitempty"`
	Repository struct {
		ProtectedBranches []*ProtectedBranchSetting `json:"protected_branches,omitempty"`
	} `json:"repository,omitempty"`
	Integrations struct {
		Slack SlackSettings `json:"slack,omitempty"`
	} `json:"integrations,omitempty"`
}

Settings represents a group's settings.

type SlackSettings

type SlackSettings struct {
	Active     bool                          `json:"active"`
	Events     []string                      `json:"events"`
	Properties gitlab.SlackServiceProperties `json:"properties,omitempty"`
}

SlackSettings represents a project's Slack settings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL