integration

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package integration reads integration files: descriptions of a service's HTTP API for one kind of job conch already does, so a service conch has no code for can still be used. The first kind is CI — where a branch's failed run is and what it printed — for the CI services that report to a pull request but are not GitHub Actions (CircleCI, GitLab CI, …), whose failures conch could see and not read.

It is the sandbox provider file (internal/sandbox/custom.go) grown to a second kind, and a description for the same reason: a file runs nothing. Its calls go to its own api with the person's key, or — for a URL a reply hands back, such as CircleCI's presigned log — to a host the file lists, without the key. Everything else is conch's code.

Index

Constants

View Source
const (
	KindSandbox = "sandbox"
	KindCI      = "ci"
	KindTickets = "tickets"
	KindNotify  = "notify"
	KindDeploy  = "deploy"
	KindHost    = "host"
)

The kinds of integration: which contract a file fills.

View Source
const Format = 3

Format is the provider file format this conch reads for an integration. Sandbox files were formats 1 and 2; 3 adds kind and operations, so a conch from before it refuses such a file as having unknown keys, rather than reading a CI file as a sandbox provider with nothing in it.

View Source
const IndexFormat = 2

IndexFormat is the newest index this conch reads. Format 1 is the sandbox providers' index, read as entries of kind sandbox.

View Source
const KindImport = "import"

KindImport is another app whose conversations conch brings in. Its file reaches no service and runs nothing: it says where the app keeps them on this machine ([source]) and which of conch's readers reads that. The file cannot add a reader, only name one conch has, the way a ci file's operations name conch's contract.

View Source
const SourceActions = "github-actions"

SourceActions is a check GitHub Actions ran, which conch reads through gh.

View Source
const TeamFile = ".conch/integrations.toml"

TeamFile is where a repository says which integrations it uses, for everybody who clones it: names only. A key never goes in it — it is committed — and conch never reads one from it.

Variables

View Source
var ErrNoKey = errors.New("no key")

ErrNoKey means the integration's key is not set.

View Source
var ErrNothing = errors.New("nothing there")

ErrNothing means a step picked nothing: there is no such run, nothing failed, no log to read. It is an answer, not a failure.

View Source
var ErrUnlinked = errors.New("nothing linked to this repository")

ErrUnlinked means a deploy file's lookup of the project — a named step before the last, such as Vercel's project by repository or Netlify's site — found nothing: the service has nothing that builds from this repository, which is said, where a branch with no deploys yet is simply none. It is also ErrNothing.

View Source
var Guide string

Guide is the format, as a person or an agent writing a file is told it.

View Source
var Readers = map[string]int{
	"conductor": 1,
}

Readers are the readers this conch has for kind import, by name, and each one's version: a reader's version goes up when what it reads or writes changes in a way an import file has to ask for.

View Source
var RegistryKey = ""

RegistryKey is the public key conch's own registry signs its index with, base64; empty until its CI signs.

View Source
var Timeout = time.Minute

Timeout bounds one request; the caller's context bounds the operation.

Transport carries every request; tests point it at their own servers.

Functions

func CanRelease

func CanRelease(f *File, d Deploy) (bool, string)

CanRelease says whether d may be released to production through f, and — for a ready deploy the service will not release — why not, in words for the row. A deploy that is not ready has nothing to say. A deploy already built for production may be released again: that is how an earlier one is rolled back to.

func CanRerun

func CanRerun(source string, files []*File) bool

CanRerun is whether conch can run a check of source again: GitHub Actions, through gh, or an integration whose file has [rerun].

func CheckName

func CheckName(name string) error

CheckName says whether name can be an integration's: it becomes a path.

func CheckSource

func CheckSource(name, link string, files []*File) (source string, readable bool)

CheckSource names the service a pull request check came from, by its name and link, and says whether conch can read its log: GitHub Actions through gh, an integration of files whose file reads a failed log. A service conch only recognises is named, unreadable; "" is one it does not know. A deploy file's checks (Vercel's, Netlify's) are its own: a failed build is read as a failed run is.

func Dir

func Dir() string

Dir is where installed integration files are kept.

func Edited

func Edited(name string) (bool, error)

Edited says whether name's file is no longer as it came.

func FetchIcon

func FetchIcon(ctx context.Context, r Registry, e Entry) (string, error)

FetchIcon is the local copy of e's icon, downloaded from r the first time and checked against the hash the index gives — so a registry's signature covers its icons too. "" is an entry with no icon. The name carries the hash, so a new icon is a new file and the old one goes.

func FetchIndexData

func FetchIndexData(ctx context.Context, r Registry) ([]byte, bool, error)

FetchIndexData is a registry's index as it came, checked against its signature when a key is known for it — for the sandbox providers' installer too, which reads the same index.

func Forget

func Forget()

Forget drops what Cached read, after an install or a removal.

func HasBuildLog

func HasBuildLog(f *File) bool

HasBuildLog says whether f's failed_log reads a build's output. A failed_log that is one call reading the very field previews gives as the error (Netlify's error_message: its API has no build log) is the error message again, not a log.

func HomePath

func HomePath(p, home string) string

HomePath is p, a ~/ path, under home; "" for anything else, which an import file's paths never are.

func HostsChanged

func HostsChanged(rec Record, e Entry) bool

HostsChanged says whether e reaches hosts the installed version did not, which the person must agree to again before an update.

func IconsDir

func IconsDir() string

IconsDir is where downloaded icons are kept.

func Install

func Install(e Entry, data []byte) error

Install keeps a file fetched for e, recording where it came from. A file somebody edited since it was installed is not replaced: their change is theirs.

func KeepCapabilities

func KeepCapabilities(name string, caps *Capabilities) error

KeepCapabilities records what the registry says name's file can do, for one installed before it said.

func Label

func Label(source string, files []*File) string

Label is how people write a source: an integration's label, a known service's, else the name.

func MarkRevoked

func MarkRevoked(ix *Index) ([]string, error)

MarkRevoked writes down, for every installed file from ix's registry, whether its version is revoked; All then leaves a revoked one out and says why. It returns the names newly revoked.

func NewKey

func NewKey() (private, public string, err error)

NewKey makes a signing key pair, base64: the private seed for the registry's CI, and the public key for conch.

func OwnURL

func OwnURL() string

OwnURL is conch-integrations' address — in a test binary, an address nothing answers, unless the test gave one ($CONCH_PROVIDERS_URL): opening a sandbox provider conch once had installs its file from the registry, so a test in any package that opens one would otherwise reach the real registry over the network.

func Pick

func Pick(v any, path string, fill func(string) string) any

Pick reads a path out of a JSON value decoded with UseNumber.

A selector's value matches without regard to case: a status somebody typed is matched to the one a tracker names.

A path is dotted keys and list indexes, "items.0.id". A part may select from a list: "items[status=failed]" is its first item whose status reads failed; "items[*status=failed]" every such item; "items[*]" every item, and "[*]" alone every item of a reply that is a list. After a *, the rest is read in each item and the results put in one list; an item that lacks it adds nothing. A selector's key may reach inside an item with / (vcs/revision); its value is put through fill, so it may be a placeholder, and a value that is empty matches every item — a branch with no pull request has no head to look for.

It returns nil when nothing is there, and for a path with a * a []any, or nil when that would be empty: nothing picked is nothing picked.

func ReadTeam

func ReadTeam(root string) ([]string, error)

ReadTeam is the names a checkout's team file lists, sorted and once each; nil, nil with no file. A name that cannot be an integration's is an error rather than dropped: whoever wrote it wants to know.

func ReaderProblem

func ReaderProblem(reader string, min int) string

ReaderProblem says why this conch cannot read with reader at version min, in words ending "needs a newer conch"; "" when it can.

func Reads

func Reads(kind string) bool

Reads says whether this conch reads integration files of kind.

func Records

func Records() (map[string]Record, error)

Records is every integration installed from a registry; none for a missing file.

func Remove

func Remove(name string) error

Remove deletes an installed file and its record.

func RemoveTeam

func RemoveTeam(root string) error

RemoveTeam deletes the team file; none there is not an error.

func Sign

func Sign(private string, data []byte) (string, error)

Sign signs data with a private key (base64 of its 32-byte seed), returning the signature as base64: what the registry's CI writes to index.json.sig.

func Source

func Source(name string) (data []byte, shipped bool, err error)

Source is the text of the integration name: the installed file, else the one conch ships, and whether it is that one.

func Subset

func Subset(a, b []string) bool

Subset says whether every name in a is in b.

func Text

func Text(v any) string

Text is a picked value as text: a string as it is, a number as written, nothing as "".

func Unlinked

func Unlinked(f *File, rem Remote) string

Unlinked is what is said when f's service has nothing that builds from rem (Previews returned ErrUnlinked), with what conch cannot see yet.

func Verify

func Verify(public string, data, sig []byte) error

Verify checks a base64 signature of data against a base64 public key.

func WriteTeam

func WriteTeam(root string, names []string) error

WriteTeam writes the team file with names and nothing else.

Types

type Auth

type Auth struct {
	Type    string   `toml:"type"`
	Header  string   `toml:"header"`
	Value   string   `toml:"value"`
	Scopes  []string `toml:"scopes"`
	UserEnv string   `toml:"user_env"`
}

Auth is how the key is sent. Type "header" (the default) sends Header: Value, Value holding {key}; "bearer" sends Authorization: Bearer KEY, with the Scopes the person should give the token; "basic" sends the user from UserEnv and the key as a password; "url" is a webhook's: the key is the whole address calls go to, which must be on api's host.

type AuthCaps

type AuthCaps struct {
	Type   string `json:"type"`
	Header string `json:"header,omitempty"`
}

AuthCaps is how the key is sent: a header (named), bearer, basic, or in the URL.

type Capabilities

type Capabilities struct {
	// Operations are the calls the file has, in conch's order; format 4's
	// are snapshot_save, snapshot_list, snapshot_forget, preview and
	// usage.
	Operations []string `json:"operations"`
	// SSH is how ssh gets in; nil for a provider that is off (no [ssh]
	// yet).
	SSH *SSHCaps `json:"ssh,omitempty"`
	// Create are the placeholders the create call fills, its query's too:
	// what conch asks for and nothing else.
	Create   []string `json:"create,omitempty"`
	Settings []string `json:"settings,omitempty"`
	// Size is how a size is chosen: names, limits, the plan's, or "".
	Size string `json:"size,omitempty"`
	// Lifetime is whether a sandbox is given a length of life. The
	// registry's capabilities_version 1 said so as a bool, version 2 as
	// the numbers ({"default_mins": 120, "max_mins": 43200}); both are
	// read (UnmarshalJSON), and conch writes the bool it always has.
	Lifetime bool      `json:"lifetime,omitempty"`
	States   []string  `json:"states,omitempty"`
	List     *ListCaps `json:"list,omitempty"`
	Auth     *AuthCaps `json:"auth,omitempty"`
	Needs    []string  `json:"needs,omitempty"`
	Detect   []string  `json:"detect,omitempty"`
	// DetectOn is what each way of detecting looks for: an import's files,
	// ~/ paths on this machine, which say it is here before it is
	// installed.
	DetectOn map[string][]string `json:"detect_on,omitempty"`
	Follow   bool                `json:"follow,omitempty"`
}

Capabilities is what an integration can do, as the registry works it out from its file when the index is built (conch-integrations' "What each one can do"): it cannot disagree with the file it came from. An entry without them — a built-in, an index from before them, the old mirror — is nil, and conch decides from the file as it always has.

A sandbox provider's fill Operations, SSH, Create, Settings, Size, Lifetime, States, List, Auth and Needs; an integration's Operations, Auth, Needs, Detect, States and Follow.

func CapabilitiesOf

func CapabilitiesOf(f *File) *Capabilities

CapabilitiesOf is what the installed file f can do: the registry's, kept when it was installed, while the file is still that one; else worked out from the file.

func FileCapabilities

func FileCapabilities(f *File) *Capabilities

FileCapabilities is what an integration's file can do, as the registry's index would say it (scripts/registry.py integration_capabilities): for one installed before the registry said, or a file of the person's own.

func (*Capabilities) Can

func (c *Capabilities) Can(op string) bool

Can is whether op is one of its operations. Nil can everything: conch then goes by the file.

func (*Capabilities) NeedsWords

func (c *Capabilities) NeedsWords() string

NeedsWords says what the person supplies: "an API key, a base URL".

func (*Capabilities) Off

func (c *Capabilities) Off(kind string) bool

Off is a sandbox provider the registry lists but conch cannot reach a machine of: its file has no [ssh] yet.

func (*Capabilities) OperationWords

func (c *Capabilities) OperationWords(kind string) string

OperationWords is what it can do, as a short list: "create, start, stop, delete, snapshots, preview links". Lookups a person would not name (get, list) are left out of a sandbox's; a tracker's list and get are its point, so they stay.

func (*Capabilities) SSHWords

func (c *Capabilities) SSHWords(kind string) string

SSHWords says how ssh gets into a provider's sandboxes; "" for an integration, or none known.

func (*Capabilities) Takes

func (c *Capabilities) Takes(placeholder string) bool

Takes is whether create fills placeholder (cpu, memory_mb, …). Nil takes everything.

func (*Capabilities) TakesPart

func (c *Capabilities) TakesPart(part string) bool

TakesPart is whether create sends a part of a size — cpu, memory or disk — in either unit.

func (*Capabilities) UnmarshalJSON

func (c *Capabilities) UnmarshalJSON(data []byte) error

UnmarshalJSON reads capabilities of either version: lifetime as a bool (1) or as its numbers (2). An index this conch could not read a field of lost every entry at once — the Integrations page empty of the registry's sandboxes and icons — so a lifetime of a shape it does not know is read as none rather than failing the index.

type CheckRef

type CheckRef struct {
	Name string
	URL  string
}

CheckRef is a pull request check, by its name and link.

type Checked

type Checked struct {
	Date   string `json:"date"`
	Conch  string `json:"conch"`
	Detail string `json:"detail,omitempty"`
}

Checked is when a maintainer last ran the file against the service.

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is a file with what it needs to be used: the key, the user for basic auth, and the base URL the person gave for base_url = "ask".

func (*Conn) FailedLog

func (c *Conn) FailedLog(ctx context.Context, t Target, run string) (Log, error)

FailedLog is what run printed where it failed: a CI run's, or for a deploy file a deploy's build.

func (*Conn) Previews

func (c *Conn) Previews(ctx context.Context, t Target) ([]Deploy, error)

Previews lists the deploys of t's branch, newest first, at t's head when it has one. A project the service has nothing of is none.

func (*Conn) Promote

func (c *Conn) Promote(ctx context.Context, t Target, deploy string) error

Promote releases deploy to production. It changes what everybody is shown: whoever calls it has asked the person first.

func (*Conn) Redeploy

func (c *Conn) Redeploy(ctx context.Context, t Target, deploy string) error

Redeploy builds deploy again.

func (*Conn) Rerun

func (c *Conn) Rerun(ctx context.Context, t Target, run string) error

Rerun re-runs what failed in run.

func (*Conn) Runs

func (c *Conn) Runs(ctx context.Context, t Target) ([]Run, error)

Runs lists the runs of t's branch, newest first, as the file reads them.

func (*Conn) Send

func (c *Conn) Send(ctx context.Context, m Message) error

Send sends a notification through a notify file.

func (*Conn) Stats

func (c *Conn) Stats(ctx context.Context, t Target) ([]Run, error)

Stats lists runs over a longer time, for the CI panel; Runs when the file has no stats.

func (*Conn) Tracker

func (c *Conn) Tracker(t Target) tracker.Tracker

Tracker is the file's tickets for the project at t (its remote fills {project}; the branch and head are not used).

type Deploy

type Deploy struct {
	Run
	Environment string `json:"environment,omitempty"`
	Error       string `json:"error,omitempty"`
	Inspect     string `json:"inspect,omitempty"`
}

Deploy is one deploy, in the deploy contract's words: a run's fields — State is ready, building, failed or canceled, URL the preview's address — and where it went, why it failed, and the service's own page for it.

type DeployOp

type DeployOp struct {
	RunsOp
	Environment string `toml:"environment"`
	Error       string `toml:"error"`
	Inspect     string `toml:"inspect"`
}

DeployOp lists a branch's deploys: a run's fields and three more — where it went (production, preview…), why it failed, and the service's own page for it.

type Detect

type Detect struct {
	Files   []string `toml:"files"`
	Remotes []string `toml:"remotes"`
	Checks  []string `toml:"checks"`
}

Detect says which projects use the service: a file in the checkout, a host in the remote's URL, a pull request check's name (a glob).

type Detection

type Detection struct {
	Name      string `json:"name"`
	Label     string `json:"label"`
	Kind      string `json:"kind"`
	Why       string `json:"why"`
	Installed bool   `json:"installed,omitempty"`
}

Detection is a service a project uses, and why conch thinks so. Installed is whether something here reads it — a file, or conch's own GitHub support; one conch only recognises is not.

func Detected

func Detected(root string, rem Remote, checks []CheckRef, files []*File) []Detection

Detected lists the services the project at root uses: its code host from the remote, and every CI its files, remote or pull request checks show — all of them, since a project uses every CI it has. Nothing runs: a file is looked for with stat, and checks are what the server already has.

func WithTeam

func WithTeam(ds []Detection, team []string, files []*File) []Detection

WithTeam adds to ds what the team file names that nothing else showed, each with the file as its reason. A name conch knows neither as a file nor as one of its own is left out: there is no kind to show it under.

type Entry

type Entry struct {
	Kind  string `json:"kind"`
	Name  string `json:"name"`
	Label string `json:"label"`
	// BuiltIn is something conch's own code reads — GitHub, Linear, Jira —
	// listed so the catalog is one place; it has no file to install.
	BuiltIn bool   `json:"builtin,omitempty"`
	Version int    `json:"version"`
	Format  int    `json:"format"`
	File    string `json:"file"`
	SHA256  string `json:"sha256"`
	// Hosts are where the file sends the key (API) and what it fetches
	// without it (Follow); the person agrees to them before installing.
	Hosts Hosts `json:"hosts"`
	// KeyEnv is the variable the file reads the key from: shown with the
	// hosts, since a file reading another service's variable would send
	// that service's key to its own.
	KeyEnv     string   `json:"key_env"`
	UserEnv    string   `json:"user_env,omitempty"`
	Operations []string `json:"operations,omitempty"`
	// Tier is verified (a maintainer's key ran it, Checked says when) or
	// community.
	Tier      string       `json:"tier,omitempty"`
	Checked   *Checked     `json:"checked,omitempty"`
	Revoked   []Revocation `json:"revoked,omitempty"`
	Installs  int          `json:"installs,omitempty"`
	Note      string       `json:"note,omitempty"`
	Docs      string       `json:"docs,omitempty"`
	AdaptedBy string       `json:"adapted_by,omitempty"`
	Adapted   string       `json:"adapted,omitempty"`
	// Icon is the service's own mark, beside the index (icons/NAME.svg or
	// .png), and IconSHA256 its hash: FetchIcon downloads and checks it.
	Icon       string `json:"icon,omitempty"`
	IconSHA256 string `json:"icon_sha256,omitempty"`
	// Capabilities are what it can do, worked out from its file by the
	// registry; nil for a built-in or an index from before them.
	Capabilities *Capabilities `json:"capabilities,omitempty"`
	// Platforms, Reader and MinReader are an import's [source]: where the
	// app ran, and which of conch's readers reads it, from which version.
	Platforms []string `json:"platforms,omitempty"`
	Reader    string   `json:"reader,omitempty"`
	MinReader int      `json:"min_reader,omitempty"`

	// Registry is which index it was read from.
	Registry string `json:"-"`
}

Entry is one file in an index.

func (Entry) DisplayName

func (e Entry) DisplayName() string

DisplayName is how people write it.

func (Entry) FoundEntry

func (e Entry) FoundEntry(home string) []string

FoundEntry is Found for an import not installed yet, from what the registry's index says its [detect] files are.

func (Entry) NeedsNewer

func (e Entry) NeedsNewer() string

NeedsNewer says why this conch cannot install or use e, in words ending "needs a newer conch"; "" when it can. A kind it has no code for, or an import whose reader it lacks or has an older version of.

func (Entry) RevokedReason

func (e Entry) RevokedReason(version int) string

RevokedReason is why version is revoked, "" when it is not.

type Feature

type Feature struct {
	What  string `json:"what"`
	Where string `json:"where"`
	Level string `json:"level"`
}

Feature is one thing an integration does in conch, as an integration's page says it: what, where in conch, and how fully — "yes", "partly", "no", or "built-in" for what conch already has without it.

func Does

func Does(kind string, ops []string) []Feature

Does lists what a file of kind with these operations does in conch, from the kind's contract rather than written per integration, so every page says it the same way.

type File

type File struct {
	Format int    `toml:"format"`
	Kind   string `toml:"kind"`
	Name   string `toml:"name"`
	Label  string `toml:"label"`
	// API is the base every call's path is put after; the key goes only
	// there. With BaseURL "ask", the person gives it at install (a
	// self-hosted Jenkins or GitLab) and API, if any, is the default.
	API     string `toml:"api"`
	BaseURL string `toml:"base_url"`
	KeyEnv  string `toml:"key_env"`
	// AuthHeader and AuthValue send the key as sandbox files do; Auth says
	// it otherwise. One or the other.
	AuthHeader string `toml:"auth_header"`
	AuthValue  string `toml:"auth_value"`
	Auth       Auth   `toml:"auth"`
	// FollowHosts are the hosts a URL found in a reply may be fetched
	// from — never with the key.
	FollowHosts []string `toml:"follow_hosts"`
	Docs        string   `toml:"docs"`
	AdaptedBy   string   `toml:"adapted_by"`
	Adapted     string   `toml:"adapted"`
	Note        string   `toml:"note"`
	// KeyHelp says where the key is made and what access it needs.
	KeyHelp string `toml:"key_help"`

	Detect Detect `toml:"detect"`
	// Source is kind import's: where the app keeps what is brought in.
	Source  ImportSource      `toml:"source"`
	Project Project           `toml:"project"`
	States  map[string]string `toml:"states"`

	// The ci kind's operations.
	Runs      RunsOp    `toml:"runs"`
	FailedLog LogOp     `toml:"failed_log"`
	Rerun     Operation `toml:"rerun"`
	Stats     RunsOp    `toml:"stats"`

	// The tickets kind's operations.
	List    TicketsOp `toml:"list"`
	Mine    TicketsOp `toml:"mine"`
	Get     TicketsOp `toml:"get"`
	Comment Operation `toml:"comment"`
	Link    Operation `toml:"link"`
	Move    Operation `toml:"move"`

	// The notify kind's operation.
	Send Operation `toml:"send"`

	// The deploy kind's operations; its failed_log is FailedLog, with
	// {deploy} for {run}.
	Previews DeployOp  `toml:"previews"`
	Redeploy Operation `toml:"redeploy"`
	Promote  Operation `toml:"promote"`
	// contains filtered or unexported fields
}

File is the shape of an integration file.

func All

func All() (files []*File, bad []string)

All is every integration this conch can use: the ones it ships, each replaced by an installed file of the same name, and the installed ones besides, by name. A file that is wrong is left out and said in bad.

func Cached

func Cached() []*File

Cached is All, read again at most every few seconds: a project's checks are named at every refresh, and the files change only when somebody installs one.

func FetchFile

func FetchFile(ctx context.Context, r Registry, e Entry) ([]byte, *File, error)

FetchFile downloads e's file and checks it is the one the index lists, byte for byte, and that it is one this conch can use as listed: its kind, its name, no host the index did not show.

func For

func For(kind, root string, rem Remote) []*File

For lists the integrations, of kind, that the project at root uses.

func Parse

func Parse(data []byte) (*File, []string, error)

Parse reads an integration file and lists what is wrong with it — everything, since whoever fixes it wants the list.

func Read

func Read(path string) (*File, []string, error)

Read reads and checks the file at path.

func (*File) Connect

func (f *File) Connect(key, user, base string) (*Conn, error)

Connect readies the file for calls. base replaces api ("" keeps it); it must be https, or the file's api when there is no base. For a file whose key is a webhook's address, the key must be an https address on that host: a key pointing anywhere else is refused, not sent to.

func (*File) DisplayName

func (f *File) DisplayName() string

DisplayName is how people write it.

func (*File) Found

func (f *File) Found(home string) []string

Found is an import file's [detect] files that are on this machine, under home, as the paths they are there: nothing on a platform the app never ran on.

func (*File) Hosts

func (f *File) Hosts() []string

Hosts are every host the file reaches: its api's, with the key, then the follow hosts, without it.

func (*File) Operations

func (f *File) Operations() []string

Operations lists the operations the file fills, in the contract's order.

func (*File) Problems

func (f *File) Problems() []string

Problems lists what is wrong with the file, or nothing.

func (*File) RunsHere

func (f *File) RunsHere() bool

RunsHere says whether the app an import file reads ran on this platform.

func (*File) Shipped

func (f *File) Shipped() bool

Shipped reports whether conch carries the file rather than the person having installed it.

func (*File) Uses

func (f *File) Uses(root string, rem Remote) bool

Uses says whether the project checked out at root, whose remote is rem, uses the service.

type Hosts

type Hosts struct {
	API    string   `json:"api"`
	Follow []string `json:"follow,omitempty"`
	SSH    string   `json:"ssh,omitempty"`
}

Hosts are a file's hosts as an index lists them.

type ImportSource

type ImportSource struct {
	Platforms []string `toml:"platforms"`
	Store     string   `toml:"store"`
	Path      string   `toml:"path"`
	Reader    string   `toml:"reader"`
	MinReader int      `toml:"min_reader"`
}

ImportSource is an import file's [source]: the platforms the app ran on, how it keeps its conversations (store), where (path, under the person's home), and the reader in conch that understands it, at least version MinReader — the one the file was checked with.

type Index

type Index struct {
	Format int `json:"format"`
	// Kinds are the registry's folders, in the order it lists them, with
	// what people call each: an index from before them has none.
	Kinds   []KindInfo `json:"kinds,omitempty"`
	Entries []Entry    `json:"entries"`
	// Disabled are listed but cannot be installed yet: a sandbox provider
	// with no [ssh], whose machines conch could make and not reach.
	Disabled []Entry `json:"disabled,omitempty"`
	Registry string  `json:"-"`
	Signed   bool    `json:"-"`
	// Cached says this is the last index read, the registry being out of
	// reach (IndexOrCached).
	Cached bool `json:"-"`
}

Index is a registry's list, and whether it was signed.

func FetchIndex

func FetchIndex(ctx context.Context, r Registry) (*Index, error)

FetchIndex reads a registry's index, checking its signature when a key is known for it.

func IndexOrCached

func IndexOrCached(ctx context.Context, r Registry) (*Index, error)

IndexOrCached is r's index, or the last one read when r cannot be reached — for drawing the catalog's icons and kinds offline. Installing reads the registry itself (FetchIndex), never this.

func ParseIndex

func ParseIndex(data []byte) (*Index, error)

ParseIndex reads an index of either format.

func (*Index) Find

func (ix *Index) Find(name string) (Entry, bool)

Find is the entry for name.

func (*Index) Search

func (ix *Index) Search(term string) []Entry

Search is the entries whose kind, name or label holds term; all of them for "".

func (*Index) SearchDisabled

func (ix *Index) SearchDisabled(term string) []Entry

SearchDisabled is Search over the entries that cannot be installed yet.

type KeyVars

type KeyVars struct {
	KeyEnv  string `json:"key_env"`
	UserEnv string `json:"user_env,omitempty"`
}

KeyVars are the variables a file sends: the key, and a user name for one that signs in with both.

func KeyChange

func KeyChange(name string, rec Record, e Entry) (was KeyVars, known, changed bool)

KeyChange says whether e reads the key, or the user name, from another variable than the version installed as rec did, and which it read. A new version that keeps its hosts but reads $GITHUB_TOKEN sends that token to them as surely as new hosts would send the key elsewhere, so it is asked about as they are. A record from before Key was kept is compared with the installed file, which an update only replaces when it is as it came; a file that cannot be read is a change, said as unknown (known false).

type KindContract

type KindContract struct {
	Required []string
	Optional []string
	States   []string
	// Text is the contract in words.
	Text string
}

KindContract is what a kind's file fills, for whoever writes one.

func Contract

func Contract(kind string) (KindContract, bool)

Contract is kind's contract; false for a kind this conch reads no file of (a sandbox file is the sandbox package's).

type KindInfo

type KindInfo struct {
	Kind  string `json:"kind"`
	Label string `json:"label"`
	About string `json:"about,omitempty"`
}

KindInfo is one of the registry's kinds: a top-level folder of it, and what people call it.

type ListCaps

type ListCaps struct {
	Paged   bool `json:"paged"`
	AllMine bool `json:"all_mine"`
}

ListCaps is whether the list is paged, and whether it lists only conch's.

type Log

type Log struct {
	Job  string
	Text string
}

Log is what a failed run printed, and which job printed it.

type LogOp

type LogOp struct {
	Operation
	Job string `toml:"job"`
}

LogOp is a failed run's output, {run} its id; Job names what failed, as a template over the steps.

type Message

type Message struct {
	Title string
	Body  string
	URL   string
}

Message is one notification: what happened, more about it, and where to look.

type Operation

type Operation struct {
	Call string `toml:"call"`
	// Body is a table sent as JSON, or a string sent as plain text.
	Body    any               `toml:"body"`
	Headers map[string]string `toml:"headers"`
	Follow  string            `toml:"follow"`
	Text    string            `toml:"text"`
	Steps   []Step            `toml:"steps"`
}

Operation is one of the kind's jobs: one call, or a chain of steps.

func (Operation) Has

func (op Operation) Has() bool

Has says whether the file fills the operation.

type Project

type Project struct {
	ID string `toml:"id"`
}

Project makes the service's name for a project, {project}, out of its remote: {host} {owner} {repo} {path} (owner/repo, or group/sub/repo) and {path_escaped} (that path as one URL-escaped segment).

type Record

type Record struct {
	Registry  string `json:"registry"`
	Version   int    `json:"version"`
	SHA256    string `json:"sha256"`
	Hosts     Hosts  `json:"hosts"`
	Installed string `json:"installed"`
	Revoked   string `json:"revoked,omitempty"`
	// Capabilities are the registry's for the file as it came
	// (CapabilitiesOf); nil for one installed before it said.
	Capabilities *Capabilities `json:"capabilities,omitempty"`
	// Key is which of the person's variables the file read; nil for one
	// installed before it was kept (KeyChange reads the file instead).
	Key *KeyVars `json:"key,omitempty"`
}

Record is what was installed from a registry: which version, its hash as it came, the hosts the person agreed to, and — after a refresh of the index — why that version was revoked.

type Registry

type Registry struct {
	Name string
	URL  string
	Key  string
}

Registry is where an index is read from, and the key it must be signed with ("" for none known).

func Registries

func Registries(cfg config.IntegrationsCfg) []Registry

Registries are conch's own, then those config.toml adds.

type Release

type Release struct {
	Verb string `json:"verb"`
	What string `json:"what"`
	Note string `json:"note,omitempty"`
	// Rebuilds: releasing starts a new build for production (Vercel), so
	// production moves only once it is ready; else it is immediate.
	Rebuilds bool `json:"rebuilds,omitempty"`
}

Release is how releasing is said for one deploy file: the button's verb, what happens, and the line under it.

func ReleaseOf

func ReleaseOf(f *File) Release

ReleaseOf is f's words for releasing a deploy.

type Remote

type Remote struct {
	Host string
	Path string
}

Remote is a repository's remote, parsed: its host and its path on the host (owner/repo, or group/sub/repo).

func ParseRemote

func ParseRemote(raw string) (Remote, bool)

ParseRemote reads a git remote URL: https://host/owner/repo(.git), ssh://git@host[:port]/owner/repo, or git@host:owner/repo.

type Revocation

type Revocation struct {
	Version int    `json:"version"`
	Reason  string `json:"reason"`
}

Revocation takes a version out of use, saying why.

type Run

type Run struct {
	ID       string    `json:"id"`
	Name     string    `json:"name,omitempty"`
	State    string    `json:"state"`
	Raw      string    `json:"raw,omitempty"`
	Commit   string    `json:"commit,omitempty"`
	URL      string    `json:"url,omitempty"`
	Started  time.Time `json:"started,omitempty"`
	Finished time.Time `json:"finished,omitempty"`
}

Run is one CI run, in the ci contract's words. State is pass, fail, pending or canceled; Raw is the service's own word for it.

type RunsOp

type RunsOp struct {
	Operation
	Items    string `toml:"items"`
	ID       string `toml:"id"`
	Name     string `toml:"name"`
	State    string `toml:"state"`
	Commit   string `toml:"commit"`
	URL      string `toml:"url"`
	Started  string `toml:"started"`
	Finished string `toml:"finished"`
}

RunsOp lists runs: Items is where the list is in the last step's value, and each field a path into an item — or, holding a {, a template over {item.x} and the steps.

type SSHCaps

type SSHCaps struct {
	Key    string `json:"key"`
	Access bool   `json:"access"`
	Port   string `json:"port"`
}

SSHCaps is whose key opens a sandbox (account, authorize, none), whether conch asks [ssh.access] first, and where the port comes from (fixed, reply, endpoint).

type StatusError

type StatusError struct {
	Code int
	// contains filtered or unexported fields
}

StatusError is a reply the service answered with an error status.

func (*StatusError) Error

func (e *StatusError) Error() string

type Step

type Step struct {
	// As names its value for the steps after it and the templates:
	// {as.x}. {reply.x} is the step just before, named or not.
	As      string            `toml:"as"`
	Call    string            `toml:"call"`
	Body    any               `toml:"body"`
	Headers map[string]string `toml:"headers"`
	// Each names an earlier step whose value is a list: the call is made
	// once per item, {item}, and the texts put together.
	Each string `toml:"each"`
	// Pick is what is kept of a JSON reply; all of it when empty. Nothing
	// picked ends the operation: there is no such thing.
	Pick string `toml:"pick"`
	// Follow is where URLs are in the reply; each is fetched, without the
	// key, from a follow host, and read by Text.
	Follow string `toml:"follow"`
	// Text makes the value text: "." the reply as it is, or a path into
	// a JSON reply whose values are put together a line each.
	Text string `toml:"text"`
}

Step is one call, or one per item of an earlier step's list.

type Target

type Target struct {
	Remote Remote
	Branch string
	Head   string
}

Target is what an operation is asked about: a branch of the project whose remote is Remote, at Head (its pull request's head commit, "" for none).

type TicketsOp

type TicketsOp struct {
	Operation
	Items         string `toml:"items"`
	Key           string `toml:"key"`
	Title         string `toml:"title"`
	Description   string `toml:"description"`
	URL           string `toml:"url"`
	Status        string `toml:"status"`
	StatusNames   string `toml:"status_names"`
	Comments      string `toml:"comments"`
	CommentAuthor string `toml:"comment_author"`
	CommentBody   string `toml:"comment_body"`
}

TicketsOp reads tickets: for list and mine, Items is where the list is in the last step's value; for get, where the ticket is ("" for all of it). Each field is a path into a ticket or, holding a {, a template over {item.x} and the steps; Description is the ticket's text. Comments (get only) is a path into the ticket, or {NAME.path} for an earlier step's value; CommentAuthor and CommentBody are paths into each comment. StatusNames, {NAME.path}, is a list of {id, name} an earlier step read, for a service whose ticket gives its status as an id: the status is the name of that id.

Jump to

Keyboard shortcuts

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