Documentation ¶
Index ¶
- func ContainsStringSlice(slice []string, str string) bool
- func SetLogLevel(level string)
- type ChartProvider
- type CommitInfo
- type CommitIterFn
- type Config
- type FakeChartProvider
- type GitChartProvider
- func (g *GitChartProvider) BuildIndexFile() error
- func (g *GitChartProvider) BuildPackage(path string, info *CommitInfo, commit *git.Commit) (*Package, error)
- func (g *GitChartProvider) GetChart(name string, version string) (*Package, error)
- func (g *GitChartProvider) GetIndexFile() *helmrepo.IndexFile
- func (g *GitChartProvider) Initialize() error
- func (g *GitChartProvider) UpdateBranch(name string) error
- type GitRepo
- func (g *GitRepo) CommitIter(fn CommitIterFn) error
- func (g *GitRepo) FetchBranch(branchName string) error
- func (g *GitRepo) GetFilesFromCommit(commit *git.Commit, path string) ([]*loader.BufferedFile, error)
- func (g *GitRepo) LookupBranch(branch string) (*git.Branch, error)
- func (g *GitRepo) LookupBranchCommit(branch string) (*git.Commit, error)
- func (g *GitRepo) LookupCommit(id string) (*git.Commit, error)
- func (g *GitRepo) ModifiedFiles(c *git.Commit) ([]string, error)
- type Index
- type IndexBuilder
- type Package
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsStringSlice ¶
ContainsStringSlice given a string slice and a string, returns boolean when is contained.
func SetLogLevel ¶
func SetLogLevel(level string)
Types ¶
type ChartProvider ¶
type CommitInfo ¶
type CommitInfo struct { Time *time.Time // commit time ID string // commit-id (sha) Revision string // repository branch name Digest string // data digest }
CommitInfo holds together time and commit hash.
type CommitIterFn ¶
CommitIterFn function to be executed against each commit.
type Config ¶
type Config struct { RepoURL string // git repository URL RelativeDir string // relative directory in repository CloneDepth int // number of commits to load from history ListenAddr string // address to listen on (address:port) ForceClone bool // destroy the destination directory before cloning GitHubWebhookSecret string // GitHub's webhook secret to decode the events }
Config application central configuration instance.
type FakeChartProvider ¶
type FakeChartProvider struct {
// contains filtered or unexported fields
}
func NewFakeChartProvider ¶
func NewFakeChartProvider(cfg *Config) *FakeChartProvider
func (*FakeChartProvider) GetChart ¶
func (f *FakeChartProvider) GetChart(name, version string) (*Package, error)
func (*FakeChartProvider) GetIndexFile ¶
func (f *FakeChartProvider) GetIndexFile() *helmrepo.IndexFile
func (*FakeChartProvider) Initialize ¶
func (f *FakeChartProvider) Initialize() error
func (*FakeChartProvider) UpdateBranch ¶
func (f *FakeChartProvider) UpdateBranch(branch string) error
type GitChartProvider ¶
type GitChartProvider struct {
// contains filtered or unexported fields
}
GitChartProvider provides Helm charts from a specified Git repository.
func NewGitChartProvider ¶
func NewGitChartProvider(cfg *Config, workingDir string) *GitChartProvider
NewGitChartProvider returns an chart provider that can build and index charts from a Git repository.
func (*GitChartProvider) BuildIndexFile ¶
func (g *GitChartProvider) BuildIndexFile() error
func (*GitChartProvider) BuildPackage ¶
func (g *GitChartProvider) BuildPackage( path string, info *CommitInfo, commit *git.Commit, ) (*Package, error)
func (*GitChartProvider) GetChart ¶
func (g *GitChartProvider) GetChart(name string, version string) (*Package, error)
GetChart returns a chart Package for the given chart name and version.
func (*GitChartProvider) GetIndexFile ¶
func (g *GitChartProvider) GetIndexFile() *helmrepo.IndexFile
GetIndexFile returns the helm repository index-file instance.
func (*GitChartProvider) Initialize ¶
func (g *GitChartProvider) Initialize() error
Initialize clones a Git repository and harvests, for each commit, Helm charts and their versions.
func (*GitChartProvider) UpdateBranch ¶
func (g *GitChartProvider) UpdateBranch(name string) error
UpdateBranch fetches the latest changes from the remote.
type GitRepo ¶
type GitRepo struct { WorkingDir string // contains filtered or unexported fields }
GitRepo represents the actual Git repository, all actions taken on Git backend are here.
func NewGitRepo ¶
NewGitRepo instantiate git repository by cloning, and extract repository information.
func (*GitRepo) CommitIter ¶
func (g *GitRepo) CommitIter(fn CommitIterFn) error
CommitIter executed informed function on each branch commit.
func (*GitRepo) FetchBranch ¶
func (*GitRepo) GetFilesFromCommit ¶
func (g *GitRepo) GetFilesFromCommit( commit *git.Commit, path string, ) ([]*loader.BufferedFile, error)
GetFilesFromCommit returns a list of files inside the path for a given commit; this list of files is meant to be consumed by Helm's `loader.LoadFiles` function.
func (*GitRepo) LookupBranch ¶
LookupBranch search for a remote branch, and if not found, a local branch instead.
func (*GitRepo) LookupBranchCommit ¶
LookupBranchCommit look up branch, and look up head commit, with this information it can checkout the branch tree and finally, set repository information about new head.
func (*GitRepo) LookupCommit ¶
LookupCommit search for informed commit id.
type IndexBuilder ¶
type IndexBuilder struct {
// contains filtered or unexported fields
}
IndexBuilder navigate the repository commits in order to discover charts, and store the relationship between chart version and commit-id.
func NewIndexBuilder ¶
func NewIndexBuilder(cfg *Config, g *GitRepo) *IndexBuilder
NewIndexBuilder instantiate a Helm repository index-file builder.
func (*IndexBuilder) Build ¶
func (i *IndexBuilder) Build() (*helmrepo.IndexFile, error)
Build create instance of index-file by inspecting commits.
func (*IndexBuilder) GetChartCommitInfo ¶
func (i *IndexBuilder) GetChartCommitInfo(name, version string) *CommitInfo
GetChartCommitInfo return the commit information based on chart name and version, or nil in case of not found.
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package wraps the Helm Chart archive, which consists of chart files in a given directory packaged as a tarball, skipping ignored files in the process.
func NewPackage ¶
NewPackage instantiate a package by inspecting directory and loading the chart.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the chartstreams server offering its API. The server puts together the routes, and bootstrap steps in order to respond as a valid Helm repository.
func NewServer ¶
func NewServer(cfg *Config, chartProvider ChartProvider) *Server
NewServer instantiate server.
func (*Server) DirectLinkHandler ¶
DirectLinkHandler endpoint handler to directly load a chart tarball payload.
func (*Server) GitHubPullTriggerHandler ¶
func (*Server) IndexHandler ¶
IndexHandler endpoint handler to marshal and return index yaml payload.
func (*Server) RootHandler ¶
RootHandler returns a simple string.