Documentation
¶
Overview ¶
Package migrate converts a configuration directory in the layout used by the Python github-user-management tool into the layout gomgr reads.
The two are close enough that most of the work is renaming keys. What makes this worth a command rather than a shell script is the handful of places they are not close, because each one is a chance to produce a configuration that loads cleanly and grants the wrong thing:
- The Python layout puts every team in one file, keyed by team name. gomgr reads one team per file, named for the team. Turning a YAML mapping key into a filename is the point where untrusted input becomes a path.
- A repository entry may carry no permission at all. There is no safe guess for what that meant, so this refuses instead of picking one.
- The Python layout has org-level team defaults; gomgr has none. Defaults are inlined onto every team that does not state its own.
Conversion is planned in full before anything is written. A directory is either converted completely or not touched, so a refusal never leaves a half-translated configuration behind for someone to apply.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MissingPermission ¶
type MissingPermission string
MissingPermission is what to do about a repository entry that names no permission.
const ( // MissingPermissionRefuse stops the conversion and names the entry. The // default: the source says a team has some access to a repository without // saying how much, and every way of resolving that is a guess about // someone's privileges. MissingPermissionRefuse MissingPermission = "refuse" // MissingPermissionDrop omits the entry and reports it. Dropping grants // less access than the source, which is the safe direction to be wrong in, // but it is still a change and still gets reported. MissingPermissionDrop MissingPermission = "drop" )
type Options ¶
type Options struct {
From string
To string
// Force allows writing into a directory that already has something in it.
Force bool
// OnMissingPermission handles a repository entry with no permission.
OnMissingPermission MissingPermission
}
Options configures a conversion.
type OrgResult ¶
type OrgResult struct {
Dir string
Org string
Teams int
Grants int
// Nested counts the teams that carried a parent across.
Nested int
// Dropped is everything in the source that is not in the output.
Dropped []string
// Unmapped names source keys gomgr has no equivalent for. Distinct from
// Dropped only in that nobody asked for them to go.
Unmapped []string
}
OrgResult is what happened to one organization directory.