Documentation ¶
Index ¶
- Variables
- func GitURLToName(name string) string
- func LoadStableVersionNumber(wrkDir string, kind VersionKind, name string) (string, error)
- func NameFromPath(basepath string, path string) (string, error)
- func ResolveDockerImage(versionsDir, image string) (string, error)
- func SaveQuickStarts(dir string, qs *QuickStarts) error
- func SaveStableVersion(wrkDir string, kind VersionKind, name string, stableVersion *StableVersion) error
- func SaveStableVersionFile(path string, stableVersion *StableVersion) error
- func UpdateStableVersion(dir string, kindStr string, name string, version string) ([]string, error)
- func UpdateStableVersionFiles(globPattern string, version string, excludeFiles ...string) ([]string, error)
- type Callback
- type QuickStart
- type QuickStarts
- type RepositoryPrefixes
- type RepositoryURLs
- type StableVersion
- type VersionKind
- type VersionResolver
- func (v *VersionResolver) GetRepositoryPrefixes() (*RepositoryPrefixes, error)
- func (v *VersionResolver) ResolveDockerImage(image string) (string, error)
- func (v *VersionResolver) ResolveGitVersion(gitURL string) (string, error)
- func (v *VersionResolver) StableVersion(kind VersionKind, name string) (*StableVersion, error)
- func (v *VersionResolver) StableVersionNumber(kind VersionKind, name string) (string, error)
- func (v *VersionResolver) VerifyPackage(name string, currentVersion string) error
- func (v *VersionResolver) VerifyPackages(packages map[string]string) error
Constants ¶
This section is empty.
Variables ¶
var ( // Kinds all the version kinds Kinds = []VersionKind{ KindChart, KindPackage, KindDocker, KindGit, } // KindStrings all the kinds as strings for validating CLI arguments KindStrings = []string{ string(KindChart), string(KindPackage), string(KindDocker), string(KindGit), } )
Functions ¶
func GitURLToName ¶
GitURLToName lets trim any URL scheme and trailing .git or / from a git URL
func LoadStableVersionNumber ¶
func LoadStableVersionNumber(wrkDir string, kind VersionKind, name string) (string, error)
LoadStableVersionNumber loads just the stable version number for the given kind and name
func NameFromPath ¶
NameFromPath converts a path into a name for use with stable versions
func ResolveDockerImage ¶
ResolveDockerImage resolves the version of the specified image against the version stream defined in versionsDir. If there is a version defined for the image in the version stream 'image:<version>' is returned, otherwise the passed image name is returned as is.
func SaveQuickStarts ¶
func SaveQuickStarts(dir string, qs *QuickStarts) error
SaveQuickStarts saves the modified quickstarts in the version stream dir
func SaveStableVersion ¶
func SaveStableVersion(wrkDir string, kind VersionKind, name string, stableVersion *StableVersion) error
SaveStableVersion saves the version file
func SaveStableVersionFile ¶
func SaveStableVersionFile(path string, stableVersion *StableVersion) error
SaveStableVersionFile saves the stabe version to the given file name
func UpdateStableVersion ¶
UpdateStableVersion applies an update to the stable version file in dir/kindStr/name.yml, updating to version
Types ¶
type Callback ¶
type Callback func(kind VersionKind, name string, version *StableVersion) (bool, error)
Callback a callback function for processing version information. Return true to continue processing or false to terminate the loop
type QuickStart ¶
type QuickStart struct { ID string `json:"id,omitempty"` Owner string `json:"owner,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Language string `json:"language,omitempty"` Framework string `json:"framework,omitempty"` Tags []string `json:"tags,omitempty"` DownloadZipURL string `json:"downloadZipURL,omitempty"` }
QuickStart the configuration of a quickstart in the version stream
type QuickStarts ¶
type QuickStarts struct { QuickStarts []*QuickStart `json:"quickstarts"` DefaultOwner string `json:"defaultOwner"` }
QuickStarts the configuration of a the quickstarts in the version stream
func GetQuickStarts ¶
func GetQuickStarts(dir string) (*QuickStarts, error)
GetQuickStarts loads the quickstarts from the version stream
func (*QuickStarts) DefaultMissingValues ¶
func (qs *QuickStarts) DefaultMissingValues()
DefaultMissingValues defaults any missing values such as ID which is a combination of owner and name
type RepositoryPrefixes ¶
type RepositoryPrefixes struct { Repositories []RepositoryURLs `json:"repositories"` // contains filtered or unexported fields }
RepositoryPrefixes maps repository prefixes to URLs
func GetRepositoryPrefixes ¶
func GetRepositoryPrefixes(dir string) (*RepositoryPrefixes, error)
GetRepositoryPrefixes loads the repository prefixes for the version stream
func (*RepositoryPrefixes) PrefixForURL ¶
func (p *RepositoryPrefixes) PrefixForURL(u string) string
PrefixForURL returns the repository prefix for the given URL
func (*RepositoryPrefixes) URLsForPrefix ¶
func (p *RepositoryPrefixes) URLsForPrefix(prefix string) []string
URLsForPrefix returns the repository URLs for the given prefix
type RepositoryURLs ¶
RepositoryURLs contains the prefix and URLS for a repository
type StableVersion ¶
type StableVersion struct { // Version the default version to use Version string `json:"version,omitempty"` // e.g. for packages we could use: `{ version: "1.10.1", upperLimit: "1.14.0"}` which would mean these // versions are all valid `["1.11.5", "1.13.1234"]` but these are invalid `["1.14.0", "1.14.1"]` UpperLimit string `json:"upperLimit,omitempty"` // GitURL the URL to the source code GitURL string `json:"gitUrl,omitempty"` // Component is the component inside the git URL Component string `json:"component,omitempty"` // URL the URL for the documentation URL string `json:"url,omitempty"` // Namespace the default namespace to install this chart if none is specified Namespace string `json:"namespace,omitempty"` }
StableVersion stores the stable version information
func LoadStableVersion ¶
func LoadStableVersion(wrkDir string, kind VersionKind, name string) (*StableVersion, error)
LoadStableVersion loads the stable version data from the version configuration directory returning an empty object if there is no specific stable version configuration available
func LoadStableVersionFile ¶
func LoadStableVersionFile(path string) (*StableVersion, error)
LoadStableVersionFile loads the stable version data from the given file name
func LoadStableVersionFromData ¶
func LoadStableVersionFromData(data []byte) (*StableVersion, error)
LoadStableVersionFromData loads the stable version data from the given the data
func (*StableVersion) VerifyPackage ¶
func (data *StableVersion) VerifyPackage(name string, currentVersion string, workDir string) error
VerifyPackage verifies the current version of the package is valid
type VersionKind ¶
type VersionKind string
VersionKind represents the kind of version
const ( // KindApp represents the app (application) defaults configuration for use with hemlfile and helm 3 KindApp VersionKind = "apps" // KindChart represents a chart version KindChart VersionKind = "charts" // KindPackage represents a package version KindPackage VersionKind = "packages" // KindDocker represents a docker resolveImage version KindDocker VersionKind = "docker" // KindGit represents a git repository (e.g. for jx boot configuration or a build pack) KindGit VersionKind = "git" )
type VersionResolver ¶
type VersionResolver struct {
VersionsDir string
}
VersionResolver resolves versions of charts, packages or docker images
func (*VersionResolver) GetRepositoryPrefixes ¶
func (v *VersionResolver) GetRepositoryPrefixes() (*RepositoryPrefixes, error)
GetRepositoryPrefixes loads the repository prefixes for the version stream
func (*VersionResolver) ResolveDockerImage ¶
func (v *VersionResolver) ResolveDockerImage(image string) (string, error)
ResolveDockerImage ensures the given docker image has a valid version if there is one in the version stream
func (*VersionResolver) ResolveGitVersion ¶
func (v *VersionResolver) ResolveGitVersion(gitURL string) (string, error)
ResolveGitVersion resolves the version to use for the given git repository using the version stream
func (*VersionResolver) StableVersion ¶
func (v *VersionResolver) StableVersion(kind VersionKind, name string) (*StableVersion, error)
StableVersion returns the stable version of the given kind name
func (*VersionResolver) StableVersionNumber ¶
func (v *VersionResolver) StableVersionNumber(kind VersionKind, name string) (string, error)
StableVersionNumber returns the stable version number of the given kind name
func (*VersionResolver) VerifyPackage ¶
func (v *VersionResolver) VerifyPackage(name string, currentVersion string) error
VerifyPackage verifies the package is of a sufficient version
func (*VersionResolver) VerifyPackages ¶
func (v *VersionResolver) VerifyPackages(packages map[string]string) error
VerifyPackages verifies that the package keys and current version numbers are at the required minimum versions