specs

package
v0.16.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options added in v0.16.0

type Options struct {
	// Package is name of the package to generate specs and artifacts archive for.
	Package string

	// Version is the package version.
	// For kubelet, kubeadm, kubectl, this is Kubernetes version.
	// For cri-tools, kubernetes-cni and cri-o, this is their corresponding version.
	Version string

	// Revision is the package revision.
	Revision string

	// Architectures to download binaries for.
	// This can be one of: amd64, arm64, ppc64le, s390x.
	Architectures []string

	// Channel is a release Channel that we're building packages for.
	// It's used to determine the Kubernetes/package version if version is not
	// explicitly provided.
	// This can be one of: release, prerelease, nightly.
	// Omit for non-core Kubernetes packages.
	Channel string

	// PackageSourceBase is the base URL to download artifacts from.
	// Can be https:// or gs:// URL.
	PackageSourceBase string

	// SpecTemplatePath is a path to a directory with spec template files.
	SpecTemplatePath string

	// SpecOutputPath is a path to a directory where to save spec files and
	// archives. The directory must exist before running the command.
	SpecOutputPath string

	// SpecOnly generates only spec files without the artifacts archive.
	SpecOnly bool
}

Options defines options for generating specs and artifacts archive for the given package.

func DefaultOptions added in v0.16.0

func DefaultOptions() *Options

DefaultOptions returns a new Options instance.

func (*Options) String added in v0.16.0

func (o *Options) String() string

String returns a string representation for the `Options` type.

func (*Options) Validate added in v0.16.0

func (o *Options) Validate() error

Validate verifies if all parameters in the `Options` instance are valid.

type PackageDefinition

type PackageDefinition struct {
	Name       string
	Version    string
	Revision   string
	Channel    string
	Metadata   *metadata.PackageMetadata
	Variations []PackageVariation

	SpecTemplatePath string
	SpecOutputPath   string
}

PackageDefinition represents a concrete package and stores package's name, version, and metadata.

func (*PackageDefinition) RPMVersion added in v0.16.0

func (p *PackageDefinition) RPMVersion() string

RPMVersion returns version that's escaped to be a valid RPM package version. This function currently replaces "-" with "~" as described in the following document: https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/#_handling_non_sorting_versions_with_tilde_dot_and_caret

type PackageVariation added in v0.16.0

type PackageVariation struct {
	Architecture string
	Source       string
}

PackageVariation is a variation of the same package. Variation currently represents a different architecture and source for the given architecture.

type Specs added in v0.16.0

type Specs struct {
	// contains filtered or unexported fields
}

func New

func New(opts *Options) *Specs

func (*Specs) BuildArtifactsArchive added in v0.16.0

func (s *Specs) BuildArtifactsArchive(pkgDef *PackageDefinition) error

BuildArtifactsArchive downloads and archives artifacts from the given package source for all selected architectures. This archive is used as a source for artifacts by OpenBuildService when building the package.

func (*Specs) BuildSpecs added in v0.16.0

func (s *Specs) BuildSpecs(pkgDef *PackageDefinition, specOnly bool) (err error)

BuildSpecs creates spec file based on provided package definition.

func (*Specs) ConstructPackageDefinition added in v0.16.0

func (s *Specs) ConstructPackageDefinition() (*PackageDefinition, error)

ConstructPackageDefinition creates a new instance of PackageDefinition based on provided options.

func (*Specs) DownloadArtifact added in v0.16.0

func (s *Specs) DownloadArtifact(sourcePath, destPath string, extractTgz bool) error

DownloadArtifact is a wrapper function that runs appropriate download function depending if the package source URL scheme is gs:// or https://

func (*Specs) DownloadArtifactFromGCS added in v0.16.0

func (s *Specs) DownloadArtifactFromGCS(sourcePath, destPath string, extractTgz bool) error

DownloadArtifactFromGCS downloads the artifact from the given GCS bucket.

func (*Specs) DownloadArtifactFromURL added in v0.16.0

func (s *Specs) DownloadArtifactFromURL(downloadURL, destPath string, extractTgz bool) error

downloadArtifactFromGCS downloads the artifact from the given URL.

func (s *Specs) GetKubernetesCIDownloadLink(baseURL, name, version, arch string) (string, error)

GetKubernetesCIDownloadLink gets the download link for CI version of Kubernetes.

func (*Specs) GetKubernetesChannelForVersion added in v0.16.0

func (s *Specs) GetKubernetesChannelForVersion(kubernetesVersion string) (string, error)

GetKubernetesChannelForVersion returns channel for the given Kubernetes version.

func (s *Specs) GetKubernetesDownloadLink(channel, baseURL, name, version, arch string) func() (string, error)

GetKubernetesDownloadLink gets the download link for Kubernetes packages based on given options.

func (s *Specs) GetKubernetesReleaseDownloadLink(baseURL, name, version, arch string) string

GetKubernetesReleaseDownloadLink gets the download link for release version of Kubernetes.

func (*Specs) GetKubernetesVersionForChannel added in v0.16.0

func (s *Specs) GetKubernetesVersionForChannel(channel string) (string, error)

GetKubernetesVersionForChannel is used to determine the Kubernetes version based on the provided channel.

func (*Specs) GetMetadataWithVersionConstraint added in v0.16.0

func (s *Specs) GetMetadataWithVersionConstraint(packageName, packageVersion string, constraintedMetadata []metadata.PackageMetadata) (*metadata.PackageMetadata, error)

GetMetadataWithVersionConstraint parses metadata and takes metadata that matches the given version constraint.

func (*Specs) GetPackageMetadata added in v0.16.0

func (s *Specs) GetPackageMetadata(templateDir, packageName, packageVersion string) (*metadata.PackageMetadata, error)

GetPackageMetadata gets metadata for the given package. Metadata includes information about package source and dependencies, and is stored in a YAML manifest.

func (*Specs) GetPackageSource added in v0.16.0

func (s *Specs) GetPackageSource(templateBaseURL, baseURL, packageName, packageVersion, packageArch, channel string) (string, error)

GetPackageSource gets the download link for artifacts for the given package. This function runs template on sourceURLTemplate defined in the metadata manifest.

func (*Specs) Run added in v0.16.0

func (s *Specs) Run() error

func (*Specs) SetImpl added in v0.16.0

func (s *Specs) SetImpl(impl impl)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL