cmd

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERR_ACCESS_EXTRA      = "The user/team '%s' is present and shouldn't be."
	ERR_ACCESS_MISSING    = "The user/team %s is not defined."
	ERR_ACCESS_DIFFERENT  = "The user/team '%s' should have the permission '%s', not '%s'."
	ERR_ACCESS_STRATEGY   = "'%s' is not a valid access strategy."
	ERR_BRANCH_DEFAULT    = "The default branch should be '%s', not '%s'."
	ERR_LABEL_EXTRA       = "The label '%s' is present and shouldn't be."
	ERR_LABEL_MISSING     = "The label '%s' is missing."
	ERR_LICENSE_DIFFERENT = "The license should be one of '%s', not '%s'."
	ERR_LICENSE_MISSING   = "The license is missing."
	ERR_CO_DIFFERENT      = "The CODEOWNERS file is different from the policy."
	ERR_CO_MISSING        = "The CODEOWNERS file is missing."
	ERR_CO_SYNTAX         = "The CODEOWNERS file has syntax errors:\n%s"
)
View Source
const (
	RESULT_DEBUG auditResultType = iota
	RESULT_INFO
	RESULT_WARNING
	RESULT_ERROR
)

Variables

This section is empty.

Functions

func AddChildrenFlag added in v0.8.0

func AddChildrenFlag(cmd *cobra.Command)

func AddGroupFlag added in v0.8.0

func AddGroupFlag(cmd *cobra.Command)

func AddPolicyFileFlag added in v0.5.0

func AddPolicyFileFlag(cmd *cobra.Command)

func AddRepositoriesFileFlag added in v0.5.0

func AddRepositoriesFileFlag(cmd *cobra.Command)

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately.

func WardenRepo added in v0.10.0

func WardenRepo(repo *vcsurl.Repository, tags []string) *wardenRepo

Create a new WardenRepo

func WardenRepos added in v0.10.0

func WardenRepos(repoDefs []RepositoryDefinition) ([]*wardenRepo, error)

Create a slice of new WardenRepos from RepoDefs

Types

type PolicyFile added in v0.5.0

type PolicyFile struct {
	DefaultBranch string             `yaml:"defaultBranch"`
	Archived      bool               `yaml:"archived"` // include archived repos in lookup?
	License       *licensePolicy     `yaml:"license"`
	Labels        []string           `yaml:"labels"`
	LabelStrategy string             `yaml:"labelStrategy"`
	Access        []accessPolicy     `yaml:"access"`
	Codeowners    []codeownersPolicy `yaml:"codeowners"`
}

The top-level structure representing a policy.yml file.

type RepositoriesFile added in v0.6.0

type RepositoriesFile []*RepositoryGroup

============================================================================= A repositories.yml file =============================================================================

func (RepositoriesFile) Group added in v0.6.0

func (this RepositoriesFile) Group(groupName string) (*RepositoryGroup, error)

Get a group from a repositories file.

func (*RepositoriesFile) RepositoriesByGroup added in v0.6.0

func (this *RepositoriesFile) RepositoriesByGroup(group string) []RepositoryDefinition

Gets repositories from a repositories.yml file by group. The only group supported at this time is 'all'.

type RepositoryDefinition added in v0.5.0

type RepositoryDefinition struct {
	URL  string   `yaml:"url"`
	Tags []string `yaml:"tags,omitempty"`
}

type RepositoryGroup added in v0.6.0

type RepositoryGroup struct {
	Group        string                 `yaml:"group"`
	Repositories []RepositoryDefinition `yaml:"repositories"`
	Children     RepositoriesFile       `yaml:"children,omitempty"`
}

============================================================================= A list of repositories belonging to a group, the top-level object in a repositories.yml file. =============================================================================

func (*RepositoryGroup) Add added in v0.6.0

func (this *RepositoryGroup) Add(repoDef RepositoryDefinition)

Add a repository to the group

func (*RepositoryGroup) GetRepositories added in v0.8.0

func (this *RepositoryGroup) GetRepositories(listChildren bool) []RepositoryDefinition

Returns the repositories belong to the group. The parameter decides if to include children or not.

func (*RepositoryGroup) HasChildren added in v0.6.0

func (this *RepositoryGroup) HasChildren() bool

func (*RepositoryGroup) ListRepositories added in v0.8.0

func (this *RepositoryGroup) ListRepositories(listChildren bool) []string

Returns the list of URLs for each repository in this group. The parameter decides if to include children or not.

func (*RepositoryGroup) Remove added in v0.13.0

func (this *RepositoryGroup) Remove(repoDef RepositoryDefinition) bool

Remove a repository from the group

Jump to

Keyboard shortcuts

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