Documentation
¶
Index ¶
- Constants
- Variables
- type Bazelregistry
- func (b *Bazelregistry) Changelog(from, to string) *result.Changelogs
- func (b *Bazelregistry) Condition(ctx context.Context, source string, scm scm.ScmHandler) (pass bool, message string, err error)
- func (b *Bazelregistry) ReportConfig() interface{}
- func (b *Bazelregistry) Source(ctx context.Context, workingDir string, resultSource *result.Source) error
- func (b *Bazelregistry) Target(_ context.Context, source string, scm scm.ScmHandler, dryRun bool, ...) error
- func (b *Bazelregistry) Validate() error
- type Maintainer
- type Metadata
- type Spec
Constants ¶
const (
// DefaultRegistryURL is the default Bazel Central Registry URL template
DefaultRegistryURL = "https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/{module}/metadata.json"
)
Variables ¶
var ( // ErrSpecModuleUndefined is returned if a module wasn't specified ErrSpecModuleUndefined = errors.New("bazelregistry module undefined") // ErrWrongSpec is returned when the Spec has wrong content ErrWrongSpec = errors.New("wrong spec content") )
Functions ¶
This section is empty.
Types ¶
type Bazelregistry ¶
type Bazelregistry struct {
// contains filtered or unexported fields
}
Bazelregistry stores configuration about the Bazel registry and the module to query
func New ¶
func New(spec interface{}) (*Bazelregistry, error)
New returns a reference to a newly initialized Bazelregistry object from a Spec or an error if the provided Spec triggers a validation error.
func (*Bazelregistry) Changelog ¶
func (b *Bazelregistry) Changelog(from, to string) *result.Changelogs
Changelog returns the changelog for this resource, or nil if not supported
func (*Bazelregistry) Condition ¶
func (b *Bazelregistry) Condition(ctx context.Context, source string, scm scm.ScmHandler) (pass bool, message string, err error)
Condition checks if a specific version exists in the Bazel Central Registry
func (*Bazelregistry) ReportConfig ¶
func (b *Bazelregistry) ReportConfig() interface{}
ReportConfig returns a new configuration object with only the necessary fields to identify the resource without any sensitive information or context specific data.
func (*Bazelregistry) Source ¶
func (b *Bazelregistry) Source(ctx context.Context, workingDir string, resultSource *result.Source) error
Source queries the Bazel Central Registry and returns the appropriate version
func (*Bazelregistry) Target ¶
func (b *Bazelregistry) Target(_ context.Context, source string, scm scm.ScmHandler, dryRun bool, resultTarget *result.Target) error
Target is not supported for the bazelregistry resource
func (*Bazelregistry) Validate ¶
func (b *Bazelregistry) Validate() error
Validate tests that the Bazelregistry struct is correctly configured
type Maintainer ¶
type Maintainer struct {
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
GitHub string `json:"github,omitempty"`
GitHubUserID int `json:"github_user_id,omitempty"`
}
Maintainer represents a module maintainer
type Metadata ¶
type Metadata struct {
Versions []string `json:"versions"`
YankedVersions map[string]string `json:"yanked_versions,omitempty"`
Homepage string `json:"homepage,omitempty"`
Maintainers []Maintainer `json:"maintainers,omitempty"`
Repository []string `json:"repository,omitempty"`
}
Metadata represents the structure of a Bazel Central Registry metadata.json file
type Spec ¶
type Spec struct {
// Module specifies the Bazel module name to query from the registry
//
// compatible:
// * source
// * condition
//
// example:
// * rules_go
// * rules_python
// * gazelle
Module string `yaml:",omitempty" jsonschema:"required"`
// VersionFilter provides parameters to specify version pattern and its type like regex, semver, or just latest.
//
// compatible:
// * source
//
// default:
// kind: latest
VersionFilter version.Filter `yaml:",omitempty"`
// URL specifies the custom registry URL (defaults to Bazel Central Registry)
//
// compatible:
// * source
// * condition
//
// default:
// https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/{module}/metadata.json
//
// example:
// * https://raw.githubusercontent.com/bazelbuild/bazel-central-registry/main/modules/{module}/metadata.json
// * https://mycompany.com/bazel-registry/modules/{module}/metadata.json
//
// remarks:
// * The URL must contain {module} placeholder which will be replaced with the module name
// * If not specified, defaults to the official Bazel Central Registry
URL string `yaml:",omitempty"`
}
Spec defines a specification for a "bazelregistry" resource parsed from an updatecli manifest file