Documentation
¶
Overview ¶
Package gitlab provides functionality for interacting with GitLab repositories, including fetching release information, matching assets to specific requirements, and downloading files from repository releases. It supports authentication via GitLab tokens and provides utility functions for handling repository data.
Index ¶
- type GitLab
- func (g *GitLab) Get(attribute string) string
- func (g *GitLab) GetHeaders() http.Header
- func (g *GitLab) Initialize(name string) error
- func (g *GitLab) Install(d install.Data, progressListener getter.ProgressTracker) (output string, found file.File, err error)
- func (g *GitLab) LatestVersion(ctx context.Context) (string, error)
- func (g *GitLab) MatchAssetsToRequirements(ctx context.Context, _ []string, version string, ...) (string, error)
- func (g *GitLab) PopulateNamespaceAndRepo(name string) (err error)
- func (g *GitLab) URL(_ string, extensions []string, version string, requirements match.Requirements) error
- func (g *GitLab) Version(_ string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitLab ¶
type GitLab struct {
Data install.Metadata `mapstructure:"-" yaml:"-"`
Project string `mapstructure:"project" yaml:"project"`
Namespace string `mapstructure:"namespace" yaml:"namespace"`
Token string `mapstructure:"token" mask:"fixed" yaml:"token"`
Server string `mapstructure:"server" yaml:"server"`
Pre bool `mapstructure:"pre" yaml:"pre"`
NoToken bool `mapstructure:"no-token" yaml:"no-token"`
// contains filtered or unexported fields
}
GitLab represents a GitLab project configuration and state.
func (*GitLab) GetHeaders ¶
GetHeaders returns the HTTP headers required for GitLab API authentication.
func (*GitLab) Initialize ¶
Initialize sets up the GitLab project configuration from the given name. Returns an error if the project name format is invalid.
func (*GitLab) Install ¶
func (g *GitLab) Install( d install.Data, progressListener getter.ProgressTracker, ) (output string, found file.File, err error)
Install downloads the GitLab release asset using the provided configuration. Returns the operation output, downloaded file information, and any errors.
func (*GitLab) LatestVersion ¶
LatestVersion fetches the latest release version from GitLab. Returns the tag name of the latest release, respecting the Pre flag setting.
func (*GitLab) MatchAssetsToRequirements ¶
func (g *GitLab) MatchAssetsToRequirements( ctx context.Context, _ []string, version string, requirements match.Requirements, ) (string, error)
MatchAssetsToRequirements finds release assets matching the given requirements. Returns the download URL of the best matching asset, considering platform, architecture, and other specified requirements.
func (*GitLab) PopulateNamespaceAndRepo ¶
PopulateNamespaceAndRepo sets the Namespace and Project fields from a name string. Expects name in "namespace/project" format if fields are not already set. Returns an error if the format is invalid or fields are partially set.