recipe

package
v0.0.0-...-b313b0a Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: GPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const RecipeCatalogueURL = "https://recipes.coopcloud.tech/recipes.json"

RecipeCatalogueURL is the only current recipe catalogue available.

View Source
const ReposMetadataURL = "https://git.coopcloud.tech/api/v1/orgs/coop-cloud/repos"

ReposMetadataURL is the recipe repository metadata.

Variables

This section is empty.

Functions

func GetRecipeCatalogueVersions

func GetRecipeCatalogueVersions(recipeName string, catl RecipeCatalogue) ([]string, error)

GetRecipeCatalogueVersions list the recipe versions listed in the recipe catalogue.

func GetRecipesLocal

func GetRecipesLocal() ([]string, error)

GetRecipesLocal retrieves all local recipe directories

func GetStringInBetween

func GetStringInBetween(recipeName, str, start, end string) (result string, err error)

GetStringInBetween returns empty string if no start or end string found

func UpdateRepositories

func UpdateRepositories(repos RepoCatalogue, recipeName string) error

UpdateRepositories clones and updates all recipe repositories locally.

func VersionsOfService

func VersionsOfService(recipe, serviceName string, offline bool) ([]string, error)

VersionsOfService lists the version of a service.

Types

type ByRecipeName

type ByRecipeName []RecipeMeta

ByRecipeName sorts recipes by name.

func (ByRecipeName) Len

func (r ByRecipeName) Len() int

func (ByRecipeName) Less

func (r ByRecipeName) Less(i, j int) bool

func (ByRecipeName) Swap

func (r ByRecipeName) Swap(i, j int)

type Features

type Features struct {
	Backups     string `json:"backups"`
	Email       string `json:"email"`
	Healthcheck string `json:"healthcheck"`
	Image       Image  `json:"image"`
	Status      int    `json:"status"`
	Tests       string `json:"tests"`
	SSO         string `json:"sso"`
}

Features represent what top-level features a recipe supports (e.g. does this recipe support backups?).

func GetRecipeFeaturesAndCategory

func GetRecipeFeaturesAndCategory(r Recipe) (Features, string, error)

type Image

type Image struct {
	Image  string `json:"image"`
	Rating string `json:"rating"`
	Source string `json:"source"`
	URL    string `json:"url"`
}

Image represents a recipe container image.

func GetImageMetadata

func GetImageMetadata(imageRowString, recipeName string) (Image, error)

type InternalTracker

type InternalTracker struct {
	EnableTimeTracker                bool `json:"enable_time_tracker"`
	AllowOnlyContributorsToTrackTime bool `json:"allow_only_contributors_to_track_time"`
	EnableIssuesDependencies         bool `json:"enable_issue_dependencies"`
}

InternalTracker is issue tracker metadata for a repo.

type Name

type Name = string

Name represents a recipe name.

type Owner

type Owner struct {
	ID         int    `json:"id"`
	Login      string `json:"login"`
	FullName   string `json:"full_name"`
	Email      string `json:"email"`
	AvatarURL  string `json:"avatar_url"`
	Language   string `json:"language"`
	IsAdmin    bool   `json:"is_admin"`
	LastLogin  string `json:"last_login"`
	Created    string `json:"created"`
	Restricted bool   `json:"restricted"`
	Username   string `json:"username"`
}

Owner is the repo organisation owner metadata.

type Permissions

type Permissions struct {
	Admin bool `json:"admin"`
	Push  bool `json:"push"`
	Pull  bool `json:"pull"`
}

Permissions is perms metadata for a repo.

type Recipe

type Recipe struct {
	Name    string
	Version string
	Dir     string
	GitURL  string
	SSHURL  string

	ComposePath   string
	ReadmePath    string
	SampleEnvPath string
	AbraShPath    string
}

func Get

func Get(name string) Recipe

func (Recipe) ChaosVersion

func (r Recipe) ChaosVersion() (string, error)

ChaosVersion constructs a chaos mode recipe version.

func (Recipe) Ensure

func (r Recipe) Ensure(chaos bool, offline bool) error

Ensure makes sure the recipe exists, is up to date and has the latest version checked out.

func (Recipe) EnsureExists

func (r Recipe) EnsureExists() error

EnsureExists ensures that the recipe is locally cloned

func (Recipe) EnsureIsClean

func (r Recipe) EnsureIsClean() error

EnsureIsClean makes sure that the recipe repository has no unstaged changes.

func (Recipe) EnsureLatest

func (r Recipe) EnsureLatest() error

EnsureLatest makes sure the latest commit is checked out for the local recipe repository

func (Recipe) EnsureUpToDate

func (r Recipe) EnsureUpToDate() error

EnsureUpToDate ensures that the local repo is synced to the remote

func (Recipe) EnsureVersion

func (r Recipe) EnsureVersion(version string) (bool, error)

EnsureVersion checks whether a specific version exists for a recipe.

func (Recipe) GetComposeConfig

func (r Recipe) GetComposeConfig(env map[string]string) (*composetypes.Config, error)

func (Recipe) GetComposeFiles

func (r Recipe) GetComposeFiles(appEnv map[string]string) ([]string, error)

GetComposeFiles gets the list of compose files for an app (or recipe if you don't already have an app) which should be merged into a composetypes.Config while respecting the COMPOSE_FILE env var.

func (Recipe) GetRecipeVersions

func (r Recipe) GetRecipeVersions() (RecipeVersions, error)

GetRecipeVersions retrieves all recipe versions.

func (Recipe) GetReleaseNotes

func (r Recipe) GetReleaseNotes(version string) (string, error)

GetReleaseNotes prints release notes for the recipe version

func (Recipe) GetVersionLabelLocal

func (r Recipe) GetVersionLabelLocal() (string, error)

GetVersionLabelLocal retrieves the version label on the local recipe config

func (Recipe) Head

func (r Recipe) Head() (*plumbing.Reference, error)

Head retrieves latest HEAD metadata.

func (Recipe) Push

func (r Recipe) Push(dryRun bool) error

Push pushes the latest changes to a SSH URL remote. You need to have your local SSH configuration for git.coopcloud.tech working for this to work

func (Recipe) SampleEnv

func (r Recipe) SampleEnv() (map[string]string, error)

func (Recipe) Tags

func (r Recipe) Tags() ([]string, error)

Tags list the recipe tags

func (Recipe) UpdateLabel

func (r Recipe) UpdateLabel(pattern, serviceName, label string) error

UpdateLabel updates a label in-place on file system local compose files.

func (Recipe) UpdateTag

func (r Recipe) UpdateTag(image, tag string) (bool, error)

UpdateTag updates an image tag in-place on file system local compose files.

type RecipeCatalogue

type RecipeCatalogue map[Name]RecipeMeta

RecipeCatalogue represents the entire recipe catalogue.

func ReadRecipeCatalogue

func ReadRecipeCatalogue(offline bool) (RecipeCatalogue, error)

ReadRecipeCatalogue reads the recipe catalogue.

func (RecipeCatalogue) Flatten

func (r RecipeCatalogue) Flatten() []RecipeMeta

Flatten converts AppCatalogue to slice

type RecipeMeta

type RecipeMeta struct {
	Category      string         `json:"category"`
	DefaultBranch string         `json:"default_branch"`
	Description   string         `json:"description"`
	Features      Features       `json:"features"`
	Icon          string         `json:"icon"`
	Name          string         `json:"name"`
	Repository    string         `json:"repository"`
	SSHURL        string         `json:"ssh_url"`
	Versions      RecipeVersions `json:"versions"`
	Website       string         `json:"website"`
}

RecipeMeta represents metadata for a recipe in the abra catalogue.

func GetRecipeMeta

func GetRecipeMeta(recipeName string, offline bool) (RecipeMeta, error)

GetRecipeMeta retrieves the recipe metadata from the recipe catalogue.

func (RecipeMeta) LatestVersion

func (r RecipeMeta) LatestVersion() string

LatestVersion returns the latest version of a recipe.

type RecipeMissingFromCatalogue

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

RecipeMissingFromCatalogue signifies a recipe is not present in the catalogue.

func (RecipeMissingFromCatalogue) Error

Error outputs the error message.

type RecipeVersions

type RecipeVersions []map[tag]map[service]ServiceMeta

RecipeVersions are the versions associated with a recipe.

type RepoCatalogue

type RepoCatalogue map[string]RepoMeta

RepoCatalogue represents all the recipe repo metadata.

func ReadReposMetadata

func ReadReposMetadata() (RepoCatalogue, error)

ReadReposMetadata retrieves coop-cloud/... repo metadata from Gitea.

type RepoMeta

type RepoMeta struct {
	ID                        int `json:"id"`
	Owner                     Owner
	Name                      string      `json:"name"`
	FullName                  string      `json:"full_name"`
	Description               string      `json:"description"`
	Empty                     bool        `json:"empty"`
	Private                   bool        `json:"private"`
	Fork                      bool        `json:"fork"`
	Template                  bool        `json:"template"`
	Parent                    interface{} `json:"parent"`
	Mirror                    bool        `json:"mirror"`
	Size                      int         `json:"size"`
	HTMLURL                   string      `json:"html_url"`
	SSHURL                    string      `json:"ssh_url"`
	CloneURL                  string      `json:"clone_url"`
	OriginalURL               string      `json:"original_url"`
	Website                   string      `json:"website"`
	StarsCount                int         `json:"stars_count"`
	ForksCount                int         `json:"forks_count"`
	WatchersCount             int         `json:"watchers_count"`
	OpenIssuesCount           int         `json:"open_issues_count"`
	OpenPRCount               int         `json:"open_pr_counter"`
	ReleaseCounter            int         `json:"release_counter"`
	DefaultBranch             string      `json:"default_branch"`
	Archived                  bool        `json:"archived"`
	CreatedAt                 string      `json:"created_at"`
	UpdatedAt                 string      `json:"updated_at"`
	Permissions               Permissions
	HasIssues                 bool `json:"has_issues"`
	InternalTracker           InternalTracker
	HasWiki                   bool   `json:"has_wiki"`
	HasPullRequests           bool   `json:"has_pull_requests"`
	HasProjects               bool   `json:"has_projects"`
	IgnoreWhitespaceConflicts bool   `json:"ignore_whitespace_conflicts"`
	AllowMergeCommits         bool   `json:"allow_merge_commits"`
	AllowRebase               bool   `json:"allow_rebase"`
	AllowRebaseExplicit       bool   `json:"allow_rebase_explicit"`
	AllowSquashMerge          bool   `json:"allow_squash_merge"`
	AvatarURL                 string `json:"avatar_url"`
	Internal                  bool   `json:"internal"`
	MirrorInterval            string `json:"mirror_interval"`
}

RepoMeta is a single recipe repo metadata.

type ServiceMeta

type ServiceMeta struct {
	Image string `json:"image"`
	Tag   string `json:"tag"`
}

ServiceMeta represents meta info associated with a service.

type TopicMeta

type TopicMeta struct {
	Topics []string `json:"topics"`
}

TopicMeta represents a list of topics for a repository.

Jump to

Keyboard shortcuts

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