Documentation
¶
Index ¶
Constants ¶
View Source
const REPO_APT = "Apt"
View Source
const REPO_DOCKERHUB = "DockerHub"
View Source
const REPO_PREFABSERVICE = "PrefabService"
View Source
const REPO_PYPI = "PyPI"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo interface {
// init repository parameters by deployment context
Init(context *dcontext.DeployContext) (err error)
// generate a SpecSheet by repository parametes and the given name & specifier
// Should Init() the Repo before calling this function
GenerateSpecSheet(name string, specifier string) (specSheet SpecSheet, err error)
// request repository to pull all the posible versions for a spec
// Warning! Finding 0 version is not an error, should return []string{} and nil
// This function MUST NOT rely on deployment context
// Any New() Repo MUST be able to GetVersions based on the information ONLY in specSheet
GetVersions(specSheet SpecSheet) (versions []string, err error)
// request repository to pull all the posible environmets for a spec
// SepcSheet.version must not be empty when calling this function
// Warning! Finding 0 environment is not an error, should return []string{} and nil
// This function MUST NOT rely on deployment context
// Any New() Repo MUST be able to GetEnvs based on the information ONLY in specSheet
GetEnvs(specSheet SpecSheet) (envs []string, err error)
// fabricate a prefab according to a SpecSheet, then save the prefab and blueprint to dstDir
// and return the path to prefab and blueprint
// This function MUST NOT rely on deployment context
// Any New() Repo MUST be able to GetEnvs based on the information ONLY in specSheet
Fabricate(specSheet SpecSheet, dstDir string) (prefabPath string, blueprintPath string, err error)
// If one of the [#existVersions] satisfies the [#item.Specifier], return
// otherwise, fabricate all possible environments for one or more versions of [#item.Name] package
FabricateDepend(item *prefab.Prefab, existVersions []string, dstDir string) (prefabPaths []string, blueprintPaths []string, err error)
}
Init() and GenerateSpecSheet() are executed by developers and executors GetVersions(), GetEnvs() and Fabricate are exectued by PrefabService and advanced Prefab developers
type SpecSheet ¶
type SpecSheet interface {
Type() string // type of SpecSheet, e.g. DockerHub
Name() string
Version() string
Environment() string
VersionSpecifier() string
// 1. set [environmet] to ""
// 2. select one version and fill it into [version]
// Warning! no matched version is not an error, should leave [version] empty and return nil
SelectVersion(versions []string) (err error)
// select one environment and fill it into [environmet]
// Warning! no matched environment is not an error, should leave [environment] empty and return nil
SelectEnv(envs []string) (err error)
}
MUST have a SpecType field
Click to show internal directories.
Click to hide internal directories.