recipe

package
v0.0.0-...-004cd70 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: GPL-2.0 Imports: 24 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 ChaosVersion

func ChaosVersion(recipeName string) (string, error)

ChaosVersion constructs a chaos mode recipe version.

func Ensure

func Ensure(recipeName string) error

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

func EnsureExists

func EnsureExists(recipeName string) error

EnsureExists ensures that a recipe is locally cloned

func EnsureIsClean

func EnsureIsClean(recipeName string) error

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

func EnsureLatest

func EnsureLatest(recipeName string) error

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

func EnsureUpToDate

func EnsureUpToDate(recipeName string) error

EnsureUpToDate ensures that the local repo is synced to the remote

func EnsureVersion

func EnsureVersion(recipeName, version string) error

EnsureVersion checks whether a specific version exists for a recipe.

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 GetVersionLabelLocal

func GetVersionLabelLocal(recipe Recipe) (string, error)

GetVersionLabelLocal retrieves the version label on the local recipe config

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(recipeName string) (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
	Config *composetypes.Config
	Meta   RecipeMeta
}

Recipe represents a recipe.

func Get

func Get(recipeName string, offline bool) (Recipe, error)

Get retrieves a recipe.

func (Recipe) Dir

func (r Recipe) Dir() string

Dir retrieves the recipe repository path

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 recipe label

func (Recipe) UpdateTag

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

UpdateTag updates a recipe tag

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.

func GetRecipeVersions

func GetRecipeVersions(recipeName string, offline bool) (RecipeVersions, error)

GetRecipeVersions retrieves all recipe versions.

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