Documentation
¶
Overview ¶
Package control implements the forge control commands executed over SSH. Every command here is reachable from bare OpenSSH: argv in, JSON or plain text on stdout, diagnostics on stderr, exit code out.
Index ¶
- func Dispatch(c *Ctx, argv []string) int
- func HooksDir(root string) string
- func ProcessCommitMessages(st *store.Store, dir string, repo store.Repo, actorID int64, old, new string)
- func RecordLandedCommits(st *store.Store, dir string, repo store.Repo, old, new string)
- func RegisterAccount(cfg config.Config, st *store.Store, pub ssh.PublicKey, ...) (string, string, int)
- func RepoDir(root, owner, name string) string
- func RunRegister(cfg config.Config, st *store.Store, pub ssh.PublicKey, argv []string, ...) int
- func VerifyCommitCached(st *store.Store, repo store.Repo, parsed *sig.Commit, sha string) (sig.Result, error)
- type Command
- type Ctx
- type IssueTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dispatch ¶
Dispatch runs argv for an authenticated session. The dispatcher — not the handlers — enforces key scope: control commands require a full-scope key.
func ProcessCommitMessages ¶ added in v0.2.0
func ProcessCommitMessages(st *store.Store, dir string, repo store.Repo, actorID int64, old, new string)
ProcessCommitMessages acts on issue references in commits that just landed on the default branch (old..new): closing keywords close the issue, bare #N leaves a reference comment. Each (issue, sha) pair acts at most once, ever. actorID — the pusher or merger — authorizes and signs the resulting comments; failures are logged, never fatal, because this runs after the push or merge already succeeded.
func RecordLandedCommits ¶ added in v0.3.0
RecordLandedCommits attributes commits that just landed on the default branch to accounts by verified author email, for the activity graph. Dedup by (repo, sha) makes rebases and re-runs harmless; unresolvable authors are simply not activity.
func RegisterAccount ¶ added in v0.2.0
func RegisterAccount(cfg config.Config, st *store.Store, pub ssh.PublicKey, username, email, invite string) (string, string, int)
RegisterAccount creates an account for pub under the instance's registration mode. On success it returns the human message and ExitOK; otherwise an error message and the classifying exit code. Shared by the SSH register command and the web signup form.
func RepoDir ¶
RepoDir returns the on-disk path for a repository.
func RunRegister ¶
func RunRegister(cfg config.Config, st *store.Store, pub ssh.PublicKey, argv []string, stdout, stderr io.Writer) int
RunRegister handles the one command an UNAUTHENTICATED key may run. It is dispatched outside the normal registry: the caller has already checked that registration is enabled and that argv[0] == "register".
Types ¶
type Command ¶
type Command struct {
Path []string // e.g. ["keys", "add"]
Summary string
ReadsStdin bool
ReadOnly bool // safe for read-scoped API tokens
SSHOnly bool // refused over the HTTP API (credential minting)
Run func(c *Ctx, args []string) int
}
type Ctx ¶
type Ctx struct {
User store.User
Scope string // scope of the key that authenticated this session
Store *store.Store
Cfg config.Config
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
JSON bool
// ViaAPI marks requests arriving over the HTTP token API. Some
// commands (token management) are SSH-only: an API token must never
// mint further credentials.
ViaAPI bool
// ReadOnly is set for read-scoped API tokens.
ReadOnly bool
// Source identifies the credential behind this session for the audit
// log: an SSH key fingerprint, or "api" for token requests.
Source string
}
type IssueTemplate ¶ added in v0.2.0
func IssueTemplates ¶ added in v0.2.0
func IssueTemplates(dir, ref string) []IssueTemplate
IssueTemplates reads .gitbay/issue-template*.md from ref. Missing directory or unreadable files yield an empty list, never an error.
Source Files
¶
- audit.go
- build.go
- commitrefs.go
- control.go
- deploykey.go
- diffcomment.go
- ghimport.go
- identity.go
- import.go
- issue.go
- migrate.go
- milestone.go
- mirrorcmd.go
- mr.go
- notifications.go
- org.go
- pagescmd.go
- profile.go
- register.go
- release.go
- repo.go
- sig.go
- status.go
- teams.go
- token.go
- web.go
- webhook.go