installation

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParamTypeString              = "string"
	ParamTypeIntegrationResource = "integration-resource"
	ParamTypeSecretPicker        = "secret_picker"
)

Supported InstallParam.Type values. New types added here must be recognised by the install UI as well (see web_src/src/pages/install/types.ts).

Variables

This section is empty.

Functions

func DefaultInstallationName

func DefaultInstallationName(repoName string) string

DefaultInstallationName derives a human-readable app name from a GitHub repository name. Example: preview-env-github-digitalocean -> Preview Env Github Digitalocean

func DefaultParamValues added in v0.26.0

func DefaultParamValues(schema []InstallParam) map[string]string

DefaultParamValues builds a fallback map from the schema using default → placeholder → param name, in that priority order.

secret_picker params are special: they must resolve to a real organization secret name, so they only fall back to an explicit default. The placeholder and param-name fallbacks are not valid secret names, and substituting them into canvas.yaml would silently inject a bogus credential reference that passes install validation but fails later at node-execution time. An empty optional picker therefore resolves to an empty string (no substitution).

func FetchCanvas

func FetchCanvas(repo *Repository) (*pb.Canvas, string, error)

FetchCanvas loads and parses canvas.yaml from a public GitHub repository.

func FetchConsole added in v0.23.0

func FetchConsole(repo *Repository, ref string) (*models.ConsoleYAML, error)

FetchConsole loads and parses an optional console.yaml from a public GitHub repository at the given ref. The console is opt-in: a missing file returns (nil, nil) so callers can install the app without one. Parse and validation errors from models.ConsoleFromYML are wrapped and surfaced to the caller.

Callers must pass a non-empty ref. Resolve it via FetchCanvas first so the canvas and console are read from the same commit.

func FindActiveUserForAccountInOrganization

func FindActiveUserForAccountInOrganization(accountID, organizationID uuid.UUID) (*models.User, error)

func ResolveInstallParams added in v0.26.0

func ResolveInstallParams(schema []InstallParam, values map[string]string) map[string]string

ResolveInstallParams merges user values with schema defaults. Every schema param is resolved — user value takes priority, then the same default → placeholder → name fallback as DefaultParamValues.

func SubstituteInstallParams added in v0.26.0

func SubstituteInstallParams(content []byte, params map[string]string) []byte

SubstituteInstallParams replaces {{ install_params.xxx }} placeholders in the given YAML content with the resolved parameter values.

func ValidateInstallParams added in v0.26.0

func ValidateInstallParams(schema []InstallParam, values map[string]string) error

ValidateInstallParams checks that all required params have values.

func ValidateSecretPickerParams added in v0.27.0

func ValidateSecretPickerParams(schema []InstallParam, values map[string]string, organizationID uuid.UUID) error

ValidateSecretPickerParams confirms that every "secret_picker" parameter value names an organization secret that actually exists, so installs cannot reference deleted/typoed credentials and surface a confusing failure later at node-execution time.

Types

type InstallParam added in v0.26.0

type InstallParam struct {
	Name        string `json:"name"`
	Label       string `json:"label"`
	Type        string `json:"type"` // "string", "integration-resource", or "secret_picker"
	Placeholder string `json:"placeholder,omitempty"`
	Description string `json:"description,omitempty"`
	Default     string `json:"default,omitempty"`
	Required    bool   `json:"required"`

	// For type "integration-resource"
	Integration    string `json:"integration,omitempty"`    // integration type name (e.g. "digitalocean")
	ResourceType   string `json:"resourceType,omitempty"`   // resource type (e.g. "region", "size", "image")
	UseNameAsValue bool   `json:"useNameAsValue,omitempty"` // when true, substitute the resource name instead of the ID
}

InstallParam defines a single parameter for the install wizard.

type InstallRequest

type InstallRequest struct {
	Repo           string
	Name           string
	OrganizationID uuid.UUID
	AccountID      uuid.UUID
	InstallParams  map[string]string
	Integrations   map[string]IntegrationMapping
}

type InstallResult

type InstallResult struct {
	CanvasID       string
	OrganizationID string
}

type IntegrationMapping added in v0.26.0

type IntegrationMapping struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type ParamsFile added in v0.26.0

type ParamsFile struct {
	InstallParams []InstallParam `json:"install_params"`
}

ParamsFile is the structure of params.json in the app repo.

func FetchParams added in v0.26.0

func FetchParams(repo *Repository, ref string) (*ParamsFile, error)

FetchParams loads and parses the optional params.json from the app repo. Returns nil if the file doesn't exist (params are optional).

type Preview

type Preview struct {
	Repo          string         `json:"repo"`
	Owner         string         `json:"owner"`
	Repository    string         `json:"repository"`
	Ref           string         `json:"ref"`
	Title         string         `json:"title"`
	Description   string         `json:"description"`
	CanvasName    string         `json:"canvasName"`
	DefaultName   string         `json:"defaultName"`
	InstallParams []InstallParam `json:"installParams,omitempty"`
	Integrations  []string       `json:"integrations,omitempty"`
}

Preview describes an installable GitHub app before the user confirms installation.

func BuildPreview

func BuildPreview(repoParam string, reg *registry.Registry) (*Preview, error)

BuildPreview loads app metadata from GitHub and prepares install defaults. If reg is non-nil, it also detects which integrations the canvas needs.

type Repository

type Repository struct {
	Owner string
	Name  string
	// Ref is the git ref used when fetching app files (main or master).
	Ref string
}

Repository identifies a public GitHub repository hosting a SuperPlane app.

func ParseRepository

func ParseRepository(raw string) (*Repository, error)

ParseRepository accepts github.com/owner/repo and common variants.

func (*Repository) String

func (r *Repository) String() string

type RepositoryFile added in v0.27.0

type RepositoryFile struct {
	Path    string
	Content []byte
}

RepositoryFile is a file extracted from a GitHub repository tarball, ready to be seeded into the canvas git repository.

func FetchRepositoryFiles added in v0.27.0

func FetchRepositoryFiles(repo *Repository, ref string) ([]RepositoryFile, error)

FetchRepositoryFiles downloads the GitHub repo tarball at the given ref and returns every regular file except the spec files (canvas.yaml/console.yaml) and params.json. Paths are validated with the same rules as user-supplied repository writes so reserved or escaping paths cannot reach the git provider through the seed-files path.

type Service

type Service struct {
	Registry        *registry.Registry
	Encryptor       crypto.Encryptor
	AuthService     authorization.Authorization
	GitProvider     git.Provider
	WebhooksBaseURL string
	UsageService    usage.Service
}

func (*Service) Install

func (s *Service) Install(ctx context.Context, req InstallRequest) (*InstallResult, error)

func (*Service) Preview

func (s *Service) Preview(repoParam string) (*Preview, error)

Jump to

Keyboard shortcuts

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