config

package
v3.42.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CourseExists

func CourseExists(course string) bool

CourseExists reports whether a course configuration was loaded.

func DecodeCourse

func DecodeCourse(data []byte) (*CourseSource, *DecodeResult, error)

DecodeCourse decodes a course file. The file must have exactly one top-level key — the course name — whose value is the course mapping.

func DecodeCourseBody

func DecodeCourseBody(name string, body any) (*CourseSource, *DecodeResult, error)

DecodeCourseBody decodes an already-parsed course mapping. The web server uses this for documents coming from MongoDB rather than from a file.

func EncodeCourse

func EncodeCourse(course *CourseSource) ([]byte, error)

EncodeCourse renders a course source back to a course file: a single top-level key naming the course, with the course mapping underneath.

This is the canonical form. Deprecated spellings are gone (decoding folded them into their canonical field) and polymorphic blocks come out in their modern shape — which is what makes `glabs config fmt` and `glabs config migrate` fall out of the schema rather than needing their own rewriting pass.

Comments and key order are NOT preserved: a struct has neither. Callers that must not lose them should keep the original bytes and only re-encode once the source has actually been edited.

func GetCourseSubgroupPath

func GetCourseSubgroupPath(course string) string

GetCourseSubgroupPath returns the full path to the course subgroup (coursepath/semesterpath), for Dependency-Proxy and other group-level features.

func GetCourseURL

func GetCourseURL(course string)

GetCourseURL prints the course subgroup URL.

func HTTPSCloneURL

func HTTPSCloneURL(raw string) (string, error)

HTTPSCloneURL turns a starter-code or repository URL into the HTTPS clone URL glabs talks to. The SSH form `git@host:path.git` stays valid *notation* in a course file — it is what people paste out of GitLab — but glabs clones and pushes over HTTPS with a PAT, so every URL is normalized to https here.

func LoadCourseFile

func LoadCourseFile(path string) (string, error)

LoadCourseFile reads a course file and registers its contents under the course name declared inside it.

func ResetCourses

func ResetCourses()

ResetCourses drops every loaded course. Tests use it; the CLI loads once.

func ResolveCoursePath

func ResolveCoursePath(courseName string, body any) (string, error)

ResolveCoursePath returns the course subgroup path (coursepath/semesterpath).

func StudentKey

func StudentKey(student *Student) string

StudentKey generates a unique key for a student based on available identifiers

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 ApprovalRuleSource

type ApprovalRuleSource struct {
	Name string `yaml:"name,omitempty" bson:"name,omitempty" mapstructure:"name"`
	// Deprecated: singular form, folded into Branches on resolve.
	Branch                string   `yaml:"branch,omitempty" bson:"branch,omitempty" mapstructure:"branch"`
	Branches              []string `yaml:"branches,omitempty" bson:"branches,omitempty" mapstructure:"branches"`
	Usernames             []string `yaml:"usernames,omitempty" bson:"usernames,omitempty" mapstructure:"usernames"`
	Groups                []string `yaml:"groups,omitempty" bson:"groups,omitempty" mapstructure:"groups"`
	MultiMemberGroupsOnly bool     `yaml:"multiMemberGroupsOnly,omitempty" bson:"multiMemberGroupsOnly,omitempty" mapstructure:"multiMemberGroupsOnly"`
	RequiredApprovals     int      `yaml:"requiredApprovals,omitempty" bson:"requiredApprovals,omitempty" mapstructure:"requiredApprovals"`
}

type ApprovalSettingsSource

type ApprovalSettingsSource struct {
	PreventApprovalByMergeRequestCreator       *bool   `` /* 159-byte string literal not displayed */
	PreventApprovalsByUsersWhoAddCommits       *bool   `` /* 159-byte string literal not displayed */
	PreventEditingApprovalRulesInMergeRequests *bool   `` /* 177-byte string literal not displayed */
	RequireUserReauthenticationToApprove       *bool   `` /* 159-byte string literal not displayed */
	WhenCommitAdded                            *string `yaml:"whenCommitAdded,omitempty" bson:"whenCommitAdded,omitempty" mapstructure:"whenCommitAdded"`
}

ApprovalSettingsSource fields are pointers throughout: each is only sent to GitLab when explicitly configured (config/assignment.go:385-412).

type ApprovalWhenCommitAdded

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

type ApprovalsSource

type ApprovalsSource struct {
	Settings *ApprovalSettingsSource `yaml:"settings,omitempty" bson:"settings,omitempty" mapstructure:"settings"`
	Rules    []ApprovalRuleSource    `yaml:"rules,omitempty" bson:"rules,omitempty" mapstructure:"rules"`
}

ApprovalsSource is polymorphic in the source: either a bare list of rules (the original form) or a {settings, rules} mapping. Decoding normalizes the list form into Rules (see approvalsDecodeHook); encoding always emits the mapping form, which is how `glabs config migrate` upgrades old files.

type AssignmentConfig

type AssignmentConfig struct {
	Course                 string
	Name                   string
	UseCoursenameAsPrefix  bool
	UseEmailDomainAsSuffix 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
	DeferredBranches       map[string]*DeferredBranch
}

func GetAssignmentConfig

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

GetAssignmentConfig resolves an assignment from the loaded course files.

func ResolveAssignment

func ResolveAssignment(courseName string, body any, g Globals, assignment string, onlyForStudentsOrGroups ...string) (*AssignmentConfig, error)

ResolveAssignment resolves one assignment out of a raw course body — the value under the course file's single top-level key.

onlyForStudentsOrGroups filters students or groups by regexp, matching the CLI's positional arguments.

func ResolveAssignmentFromBytes added in v3.4.0

func ResolveAssignmentFromBytes(data []byte, courseName, assignment string, g Globals, onlyForStudentsOrGroups ...string) (*AssignmentConfig, error)

ResolveAssignmentFromBytes resolves one assignment straight from a course file's raw bytes — the form the web server keeps in `rawYAML`. It parses the bytes into the generic body map under the course's single top-level key and hands that to ResolveAssignment, so the web reaches the exact same resolution (inheritance, legacy-key handling, lowercasing) the CLI does.

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

RepoNameWithSuffix returns the project path for an assignment repository. The result is normalized via gitlabProjectPath so it matches the path GitLab derives from the project name: names that are already valid paths are kept as-is, while names containing characters invalid in a path (e.g. "+") are slugified the same way GitLab does. Without this, the printed URL and the search used to locate the project would not match the repository GitLab actually creates.

func (*AssignmentConfig) RepoSuffix

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

RepoSuffix returns the part of a repository name that identifies the student.

Using email addresses rather than usernames or ids puts an "@" in the name, which is invalid in both a filesystem path and a GitLab path, so it has to be replaced.

func (*AssignmentConfig) RepoTargets added in v3.20.0

func (cfg *AssignmentConfig) RepoTargets() []RepoTarget

RepoTargets returns the per-student or per-group repositories for the assignment (depending on Per). It is the data behind both the printing Urls method and the web layer's URL list and operation targets.

func (*AssignmentConfig) RepoURLs added in v3.15.0

func (cfg *AssignmentConfig) RepoURLs() []RepoURL

RepoURLs returns the per-student or per-group repository URLs for the assignment (a projection of RepoTargets). The assignment-level group URL is cfg.URL.

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() string

Show renders the resolved assignment configuration as a colored, human- readable document and returns it. It returns the string rather than printing, so the CLI writes it to stdout while the web server can send the same rendering to the browser; config stays free of any opinion about where output goes.

func (*AssignmentConfig) StartercodeURL

func (cfg *AssignmentConfig) StartercodeURL()

func (*AssignmentConfig) Urls

func (cfg *AssignmentConfig) Urls(assignment bool)

type AssignmentSource

type AssignmentSource struct {
	// Meta keys. Never inherited, never part of the effective config.
	Extends  string `yaml:"extends,omitempty" bson:"extends,omitempty" mapstructure:"extends"`
	Abstract bool   `yaml:"abstract,omitempty" bson:"abstract,omitempty" mapstructure:"abstract"`

	AssignmentPath    string `yaml:"assignmentpath,omitempty" bson:"assignmentpath,omitempty" mapstructure:"assignmentpath"`
	Description       string `yaml:"description,omitempty" bson:"description,omitempty" mapstructure:"description"`
	Per               string `yaml:"per,omitempty" bson:"per,omitempty" mapstructure:"per"`
	ContainerRegistry bool   `yaml:"containerRegistry,omitempty" bson:"containerRegistry,omitempty" mapstructure:"containerRegistry"`
	AccessLevel       string `yaml:"accesslevel,omitempty" bson:"accesslevel,omitempty" mapstructure:"accesslevel"`

	Students []string            `yaml:"students,omitempty" bson:"students,omitempty" mapstructure:"students"`
	Groups   map[string][]string `yaml:"groups,omitempty" bson:"groups,omitempty" mapstructure:"groups"`

	MergeRequest     *MergeRequestSource              `yaml:"mergeRequest,omitempty" bson:"mergeRequest,omitempty" mapstructure:"mergeRequest"`
	Branches         []BranchRuleSource               `yaml:"branches,omitempty" bson:"branches,omitempty" mapstructure:"branches"`
	Issues           *IssuesSource                    `yaml:"issues,omitempty" bson:"issues,omitempty" mapstructure:"issues"`
	Startercode      *StartercodeSource               `yaml:"startercode,omitempty" bson:"startercode,omitempty" mapstructure:"startercode"`
	DeferredBranches map[string]*DeferredBranchSource `yaml:"deferredBranches,omitempty" bson:"deferredBranches,omitempty" mapstructure:"deferredBranches"`
	Clone            *CloneSource                     `yaml:"clone,omitempty" bson:"clone,omitempty" mapstructure:"clone"`
	Release          *ReleaseSource                   `yaml:"release,omitempty" bson:"release,omitempty" mapstructure:"release"`
	Seeder           *SeederSource                    `yaml:"seeder,omitempty" bson:"seeder,omitempty" mapstructure:"seeder"`
}

AssignmentSource is a single assignment as written in the course file, with `extends` unresolved.

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 BranchRuleSource

type BranchRuleSource struct {
	Name                      string `yaml:"name,omitempty" bson:"name,omitempty" mapstructure:"name"`
	Protect                   bool   `yaml:"protect,omitempty" bson:"protect,omitempty" mapstructure:"protect"`
	MergeOnly                 bool   `yaml:"mergeOnly,omitempty" bson:"mergeOnly,omitempty" mapstructure:"mergeOnly"`
	Default                   bool   `yaml:"default,omitempty" bson:"default,omitempty" mapstructure:"default"`
	AllowForcePush            bool   `yaml:"allowForcePush,omitempty" bson:"allowForcePush,omitempty" mapstructure:"allowForcePush"`
	CodeOwnerApprovalRequired bool   `` /* 126-byte string literal not displayed */
}

type Clone

type Clone struct {
	LocalPath string
	Branch    string
	Force     bool
}

type CloneSource

type CloneSource struct {
	// Pointer: absent means "." (config/repo.go:212-215).
	LocalPath *string `yaml:"localpath,omitempty" bson:"localpath,omitempty" mapstructure:"localpath"`
	// Pointer: absent means the assignment's default branch (config/repo.go:217-220).
	Branch *string `yaml:"branch,omitempty" bson:"branch,omitempty" mapstructure:"branch"`
	Force  bool    `yaml:"force,omitempty" bson:"force,omitempty" mapstructure:"force"`
}

type CourseConfig

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

func GetCourseConfig

func GetCourseConfig(course string) (*CourseConfig, error)

GetCourseConfig resolves the course-level students and groups.

func ResolveCourse

func ResolveCourse(courseName string, body any) (*CourseConfig, error)

ResolveCourse resolves the course-level students and groups out of a raw course body.

type CourseSource

type CourseSource struct {
	// Name is the file's top-level key. It is not part of the mapping itself.
	Name string `yaml:"-" bson:"name" mapstructure:"-"`

	CoursePath   string `yaml:"coursepath,omitempty" bson:"coursepath,omitempty" mapstructure:"coursepath"`
	SemesterPath string `yaml:"semesterpath,omitempty" bson:"semesterpath,omitempty" mapstructure:"semesterpath"`

	UseCoursenameAsPrefix bool `yaml:"useCoursenameAsPrefix,omitempty" bson:"useCoursenameAsPrefix,omitempty" mapstructure:"useCoursenameAsPrefix"`
	// Pointer: absent means true (config/assignment.go:100-105), false means false.
	UseEmailDomainAsSuffix *bool `yaml:"useEmailDomainAsSuffix,omitempty" bson:"useEmailDomainAsSuffix,omitempty" mapstructure:"useEmailDomainAsSuffix"`

	Students []string            `yaml:"students,omitempty" bson:"students,omitempty" mapstructure:"students"`
	Groups   map[string][]string `yaml:"groups,omitempty" bson:"groups,omitempty" mapstructure:"groups"`

	// Assignments are siblings of the course settings above, not nested under a
	// key. yaml ",inline" reproduces that layout on encode; mapstructure
	// ",remain" collects them on decode. In BSON they get their own subdocument
	// so they cannot collide with the course settings.
	Assignments map[string]*AssignmentSource `yaml:",inline" bson:"assignments,omitempty" mapstructure:",remain"`
}

CourseSource is one course file. The file has a single top-level key (the course name) whose value is this struct.

type DecodeResult

type DecodeResult struct {
	// UnknownKeys are dotted paths present in the file that no field matches.
	// They are silently ignored by the loader, which is exactly why they are
	// worth reporting: `clone.clone` and `release.mergeRequest.dockerImages`
	// both look effective and are not.
	UnknownKeys []string
	// LegacyKeys are dotted paths that were accepted via a deprecated alias,
	// with an explanation.
	LegacyKeys []LegacyKey
}

DecodeResult carries what a decode learned about the input beyond the values themselves: keys nobody claimed, and deprecated spellings that were accepted. `glabs config lint` reports these; ordinary loading ignores them.

type DeferredBranch

type DeferredBranch struct {
	URL           string
	FromBranch    string
	ToBranch      string
	Orphan        bool
	OrphanMessage string
}

type DeferredBranchSource

type DeferredBranchSource struct {
	// Pointer: absent falls back to the startercode URL, empty does not
	// (config/assignment.go:66-68).
	URL        *string `yaml:"url,omitempty" bson:"url,omitempty" mapstructure:"url"`
	FromBranch string  `yaml:"fromBranch,omitempty" bson:"fromBranch,omitempty" mapstructure:"fromBranch"`
	// Pointer: absent falls back to FromBranch (config/assignment.go:71-74).
	ToBranch *string `yaml:"toBranch,omitempty" bson:"toBranch,omitempty" mapstructure:"toBranch"`
	// Pointer: absent means true (config/assignment.go:75-79).
	Orphan *bool `yaml:"orphan,omitempty" bson:"orphan,omitempty" mapstructure:"orphan"`
	// Pointer: absent gets a generated message (config/assignment.go:81-84).
	OrphanMessage *string `yaml:"orphanMessage,omitempty" bson:"orphanMessage,omitempty" mapstructure:"orphanMessage"`
}

type Finding

type Finding struct {
	// Path is the dotted location, e.g. "vss.blatt2.release.mergeRequest.dockerImages".
	Path string
	// Message says what is wrong, in terms of what the config does or fails to do.
	Message string
	// Severity distinguishes "this silently does nothing" from "this still works
	// but has a better spelling".
	Severity Severity
}

Finding is one problem found in a course source.

func Lint

func Lint(course *CourseSource, decoded *DecodeResult) []Finding

Lint reports everything questionable about a decoded course source.

The interesting category is keys that are silently ignored. The loader has never complained about them, so they look effective and are not — `clone.clone` (present in every real course file, does nothing) and `release.mergeRequest.dockerImages` (six images configured, none applied, because config/release.go:47 reads release.dockerImages) are both live examples.

func (Finding) String

func (f Finding) String() string

type Globals

type Globals struct {
	// GitlabHost is the base for the URLs glabs prints and searches for.
	GitlabHost string
}

Globals are the settings that live outside any course file.

type Group

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

type IssueReplication

type IssueReplication struct {
	ReplicateFromStartercode bool
	IssueNumbers             []int
	IncludeChildTasks        bool
}

type IssuesSource

type IssuesSource struct {
	ReplicateFromStartercode bool  `yaml:"replicateFromStartercode,omitempty" bson:"replicateFromStartercode,omitempty" mapstructure:"replicateFromStartercode"`
	IssueNumbers             []int `yaml:"issueNumbers,omitempty" bson:"issueNumbers,omitempty" mapstructure:"issueNumbers"`
	IncludeChildTasks        bool  `yaml:"includeChildTasks,omitempty" bson:"includeChildTasks,omitempty" mapstructure:"includeChildTasks"`
}

type LegacyKey

type LegacyKey struct {
	Path string
	Hint string
}

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 MergeRequestSource

type MergeRequestSource struct {
	MergeMethod                   string           `yaml:"mergeMethod,omitempty" bson:"mergeMethod,omitempty" mapstructure:"mergeMethod"`
	SquashOption                  string           `yaml:"squashOption,omitempty" bson:"squashOption,omitempty" mapstructure:"squashOption"`
	Pipeline                      bool             `yaml:"pipeline,omitempty" bson:"pipeline,omitempty" mapstructure:"pipeline"`
	SkippedPipelinesAreSuccessful bool             `` /* 138-byte string literal not displayed */
	AllThreadsMustBeResolved      bool             `yaml:"allThreadsMustBeResolved,omitempty" bson:"allThreadsMustBeResolved,omitempty" mapstructure:"allThreadsMustBeResolved"`
	StatusChecksMustSucceed       bool             `yaml:"statusChecksMustSucceed,omitempty" bson:"statusChecksMustSucceed,omitempty" mapstructure:"statusChecksMustSucceed"`
	Approvals                     *ApprovalsSource `yaml:"approvals,omitempty" bson:"approvals,omitempty" mapstructure:"approvals"`
}

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 ReleaseMergeRequestSource

type ReleaseMergeRequestSource struct {
	Source   string `yaml:"source,omitempty" bson:"source,omitempty" mapstructure:"source"`
	Target   string `yaml:"target,omitempty" bson:"target,omitempty" mapstructure:"target"`
	Pipeline bool   `yaml:"pipeline,omitempty" bson:"pipeline,omitempty" mapstructure:"pipeline"`
}

type ReleaseSource

type ReleaseSource struct {
	MergeRequest *ReleaseMergeRequestSource `yaml:"mergeRequest,omitempty" bson:"mergeRequest,omitempty" mapstructure:"mergeRequest"`
	DockerImages []string                   `yaml:"dockerImages,omitempty" bson:"dockerImages,omitempty" mapstructure:"dockerImages"`
}

type RepoTarget added in v3.20.0

type RepoTarget struct {
	For  string
	Repo string
	URL  string
}

RepoTarget is one repository the assignment resolves to: who it belongs to (For — a student's email/username/id, or the group name), the repository's project name (Repo), and the full web URL.

type RepoURL added in v3.15.0

type RepoURL struct {
	For string
	URL string
}

RepoURL is one repository URL together with who it belongs to.

type Seeder

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

type SeederSource

type SeederSource struct {
	Cmd             string   `yaml:"cmd,omitempty" bson:"cmd,omitempty" mapstructure:"cmd"`
	Args            []string `yaml:"args,omitempty" bson:"args,omitempty" mapstructure:"args"`
	Name            string   `yaml:"name,omitempty" bson:"name,omitempty" mapstructure:"name"`
	EMail           string   `yaml:"email,omitempty" bson:"email,omitempty" mapstructure:"email"`
	SignKey         string   `yaml:"signKey,omitempty" bson:"signKey,omitempty" mapstructure:"signKey"`
	ToBranch        string   `yaml:"toBranch,omitempty" bson:"toBranch,omitempty" mapstructure:"toBranch"`
	ProtectToBranch bool     `yaml:"protectToBranch,omitempty" bson:"protectToBranch,omitempty" mapstructure:"protectToBranch"`
}

type Severity

type Severity string
const (
	// SeverityProblem: the config does not do what it looks like it does.
	SeverityProblem Severity = "problem"
	// SeverityDeprecated: it works, but the spelling or shape is obsolete.
	SeverityDeprecated Severity = "deprecated"
)

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
	Tag                string
	Template           bool
	TemplateMessage    string
	ToBranch           string
	AdditionalBranches []string
}

type StartercodeSource

type StartercodeSource struct {
	URL                string   `yaml:"url,omitempty" bson:"url,omitempty" mapstructure:"url"`
	FromBranch         string   `yaml:"fromBranch,omitempty" bson:"fromBranch,omitempty" mapstructure:"fromBranch"`
	Tag                string   `yaml:"tag,omitempty" bson:"tag,omitempty" mapstructure:"tag"`
	Template           bool     `yaml:"template,omitempty" bson:"template,omitempty" mapstructure:"template"`
	TemplateMessage    string   `yaml:"templateMessage,omitempty" bson:"templateMessage,omitempty" mapstructure:"templateMessage"`
	ToBranch           string   `yaml:"toBranch,omitempty" bson:"toBranch,omitempty" mapstructure:"toBranch"`
	AdditionalBranches []string `yaml:"additionalBranches,omitempty" bson:"additionalBranches,omitempty" mapstructure:"additionalBranches"`

	// Deprecated: superseded by the assignment-level `branches:` block, which
	// wins outright when present (config/repo.go:98). Read only for older
	// configs; `glabs config migrate` rewrites them.
	DevBranch                 string `yaml:"devBranch,omitempty" bson:"devBranch,omitempty" mapstructure:"devBranch"`
	ProtectToBranch           bool   `yaml:"protectToBranch,omitempty" bson:"protectToBranch,omitempty" mapstructure:"protectToBranch"`
	ProtectDevBranchMergeOnly bool   `` /* 126-byte string literal not displayed */

	// Deprecated: superseded by the assignment-level `issues:` block, which
	// disables these entirely by merely being present (config/repo.go:193).
	ReplicateIssue bool  `yaml:"replicateIssue,omitempty" bson:"replicateIssue,omitempty" mapstructure:"replicateIssue"`
	IssueNumbers   []int `yaml:"issueNumbers,omitempty" bson:"issueNumbers,omitempty" mapstructure:"issueNumbers"`
}

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