config

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLevel

type AccessLevel int
const (
	Guest      AccessLevel = 10
	Reporter   AccessLevel = 20
	Developer  AccessLevel = 30
	Maintainer AccessLevel = 40
)

func (AccessLevel) String

func (ac AccessLevel) String() string

type ApprovalWhenCommitAdded

type ApprovalWhenCommitAdded string
const (
	ApprovalKeepApprovals                          ApprovalWhenCommitAdded = "keepApprovals"
	ApprovalRemoveAllApprovals                     ApprovalWhenCommitAdded = "removeAllApprovals"
	ApprovalRemoveCodeOwnerApprovalsIfFilesChanged ApprovalWhenCommitAdded = "removeCodeOwnerApprovalsIfTheirFilesChanged"
)

type AssignmentConfig

type AssignmentConfig struct {
	Course                string
	Name                  string
	UseCoursenameAsPrefix bool
	Path                  string
	URL                   string
	Per                   Per
	Description           string
	ContainerRegistry     bool
	AccessLevel           AccessLevel
	MergeRequest          *MergeRequest
	Branches              []BranchRule
	Issues                *IssueReplication
	Students              []*Student
	Groups                []*Group
	Startercode           *Startercode
	Clone                 *Clone
	Release               *Release
	Seeder                *Seeder
}

func GetAssignmentConfig

func GetAssignmentConfig(course, assignment string, onlyForStudentsOrGroups ...string) *AssignmentConfig

func (*AssignmentConfig) RepoBaseName

func (cfg *AssignmentConfig) RepoBaseName() string

func (*AssignmentConfig) RepoNameForGroup

func (cfg *AssignmentConfig) RepoNameForGroup(group *Group) string

func (*AssignmentConfig) RepoNameForStudent

func (cfg *AssignmentConfig) RepoNameForStudent(student *Student) string

func (*AssignmentConfig) RepoNameWithSuffix

func (cfg *AssignmentConfig) RepoNameWithSuffix(suffix string) string

func (*AssignmentConfig) RepoSuffix

func (cfg *AssignmentConfig) RepoSuffix(student *Student) string

Using email addresses instead of usernames/user-id's results in @ in the student's name. This is incompatible to the filesystem and gitlab so replacing the values is necessary.

func (*AssignmentConfig) SetAccessLevel

func (cfg *AssignmentConfig) SetAccessLevel(level string)

func (*AssignmentConfig) SetBranch

func (cfg *AssignmentConfig) SetBranch(branch string)

func (*AssignmentConfig) SetForce

func (cfg *AssignmentConfig) SetForce()

func (*AssignmentConfig) SetLocalpath

func (cfg *AssignmentConfig) SetLocalpath(localpath string)

func (*AssignmentConfig) SetProtectToBranch

func (cfg *AssignmentConfig) SetProtectToBranch(branch string)

func (*AssignmentConfig) Show

func (cfg *AssignmentConfig) Show()

func (*AssignmentConfig) Urls

func (cfg *AssignmentConfig) Urls(assignment bool)

type BranchRule

type BranchRule struct {
	Name                      string `mapstructure:"name"`
	Protect                   bool   `mapstructure:"protect"`
	MergeOnly                 bool   `mapstructure:"mergeOnly"`
	Default                   bool   `mapstructure:"default"`
	AllowForcePush            bool   `mapstructure:"allowForcePush"`
	CodeOwnerApprovalRequired bool   `mapstructure:"codeOwnerApprovalRequired"`
}

type Clone

type Clone struct {
	LocalPath string
	Branch    string
	Force     bool
}

type CourseConfig

type CourseConfig struct {
	Course   string
	Students []*Student
	Groups   []*Group
}

func GetCourseConfig

func GetCourseConfig(course string) *CourseConfig

type Group

type Group struct {
	Name    string
	Members []*Student
}

type IssueReplication

type IssueReplication struct {
	ReplicateFromStartercode bool
	IssueNumbers             []int
}

type MergeMethod

type MergeMethod string

MergeMethod represents the merge strategy for GitLab projects. Values correspond to glabs config format, not the GitLab API directly.

const (
	// MergeCommit creates a merge commit for every merge (GitLab default).
	MergeCommit MergeMethod = "merge"
	// SemiLinearHistory requires linear history: rebase before creating merge commit.
	SemiLinearHistory MergeMethod = "semi_linear"
	// FastForward only allows fast-forward merges; no merge commits.
	FastForward MergeMethod = "ff"
)

type MergeRequest

type MergeRequest struct {
	MergeMethod                   MergeMethod
	SquashOption                  SquashOption
	PipelineMustSucceed           bool
	SkippedPipelinesAreSuccessful bool
	AllThreadsMustBeResolved      bool
	StatusChecksMustSucceed       bool
	Approvals                     []MergeRequestApprovalRule
	ApprovalSettings              *MergeRequestApprovalSettings
}

type MergeRequestApprovalRule

type MergeRequestApprovalRule struct {
	Name                  string   `mapstructure:"name"`
	Branch                string   `mapstructure:"branch"`
	Branches              []string `mapstructure:"branches"`
	Usernames             []string `mapstructure:"usernames"`
	Groups                []string `mapstructure:"groups"`
	MultiMemberGroupsOnly bool     `mapstructure:"multiMemberGroupsOnly"`
	RequiredApprovals     int      `mapstructure:"requiredApprovals"`
}

type MergeRequestApprovalSettings

type MergeRequestApprovalSettings struct {
	PreventApprovalByMergeRequestCreator       *bool
	PreventApprovalsByUsersWhoAddCommits       *bool
	PreventEditingApprovalRulesInMergeRequests *bool
	RequireUserReauthenticationToApprove       *bool
	WhenCommitAdded                            *ApprovalWhenCommitAdded
}

type Per

type Per string
const (
	PerStudent Per = "student"
	PerGroup   Per = "group"
	PerFailed  Per = "could not happen"
)

type Release

type Release struct {
	MergeRequest *ReleaseMergeRequest
	DockerImages []string
}

type ReleaseMergeRequest

type ReleaseMergeRequest struct {
	SourceBranch string
	TargetBranch string
	HasPipeline  bool
}

type Seeder

type Seeder struct {
	Command         string
	Args            []string
	Name            string
	EMail           string
	SignKey         *openpgp.Entity
	ToBranch        string
	ProtectToBranch bool
}

type SquashOption

type SquashOption string

SquashOption represents the squash-on-merge setting for GitLab projects.

const (
	// SquashNever disables squashing for all merge requests.
	SquashNever SquashOption = "never"
	// SquashAlways squashes all merge requests automatically.
	SquashAlways SquashOption = "always"
	// SquashDefaultOff lets users opt in to squash per MR (default off).
	SquashDefaultOff SquashOption = "default_off"
	// SquashDefaultOn lets users opt out of squash per MR (default on).
	SquashDefaultOn SquashOption = "default_on"
)

type Startercode

type Startercode struct {
	URL                string
	FromBranch         string
	ToBranch           string
	AdditionalBranches []string
}

type Student

type Student struct {
	Id       *int
	Username *string
	Email    *string
	Raw      string
}

Jump to

Keyboard shortcuts

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