Documentation
¶
Index ¶
- func AuthForURL(rawURL string) (transport.AuthMethod, error)
- func Clone(rep reporter.Reporter, cfg *config.AssignmentConfig)
- func GetAuth() (transport.AuthMethod, error)
- func ProjectRepoUrl(cfg *config.AssignmentConfig, suffix string) string
- func Push(rep reporter.Reporter, assignmentCfg *config.AssignmentConfig, ...) error
- type SourceRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthForURL ¶
func AuthForURL(rawURL string) (transport.AuthMethod, error)
AuthForURL returns the credential to use when cloning the given URL.
The token authenticates against one host: the configured GitLab instance. Under SSH this was invisible — the operator's key worked against any host, so a starter repo or deferred branch could live on github.com or another GitLab. Over HTTPS with a PAT that no longer holds, and sending the GitLab token to a foreign host would leak it. So the token is attached only for the GitLab host; any other host is cloned unauthenticated, which works for public repositories and fails with a plain "authentication required" for private ones.
func Clone ¶
func Clone(rep reporter.Reporter, cfg *config.AssignmentConfig)
Clone clones every student/group repository to disk. It is CLI-only — the web server never writes to a local working directory. --suppress passes a discard reporter so only the machine-readable paths are printed.
func GetAuth ¶
func GetAuth() (transport.AuthMethod, error)
GetAuth returns the credential glabs uses to talk to its own GitLab instance: the personal access token, over HTTPS.
glabs used to authenticate git with an SSH key (`sshprivatekey`), separate from the token it already needed for the API. That is gone: one credential, one transport, the same in the CLI and — once it exists — the web server, where a per-user SSH key would be a shared identity with access to every user's repositories. The token needs the `write_repository` scope in addition to `api`.
GitLab accepts the token as the HTTP password with any non-empty username; "oauth2" is the conventional one.
func ProjectRepoUrl ¶
func ProjectRepoUrl(cfg *config.AssignmentConfig, suffix string) string
ProjectRepoUrl is the HTTPS clone URL for a student's or group's repository. cfg.URL is already https://host/coursepath, so the repository URL is just that plus the repo name; glabs clones it over HTTPS with the token.
Types ¶
type SourceRepo ¶
type SourceRepo struct {
Repo *git.Repository
Ref plumbing.ReferenceName
Auth transport.AuthMethod
}