obs

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

View Source
const (
	// OBSKubernetesProject is name of the organization/project on openSUSE's
	// OBS instance where packages are built and published.
	OBSKubernetesProject = "isv:kubernetes"

	// OBSNamespaceStable is part of the subproject name that's used for stable
	// packages.
	OBSNamespaceStable = "stable"
	// OBSNamespaceStable is part of the subproject name that's used for
	// prerelease (alpha, beta, rc) packages.
	OBSNamespacePrerelease = "prerelease"

	// OBSPasswordKey is name of the environment variable with password for
	// Kubernetes Release Bot account.
	OBSPasswordKey = "OBS_PASSWORD"

	// OBSUsernameKey is name of the environment variable containing the
	// username for the OBS account. If empty, obsK8sUsername will be used.
	OBSUsernameKey = "OBS_USERNAME"
)

Variables

View Source
var DefaultPrerequisitesCheckerOptions = &PrerequisitesCheckerOptions{
	CheckOBSPassword: true,
}

Functions

This section is empty.

Types

type DefaultRelease

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

DefaultRelease is the default release implementation used in production.

func NewDefaultRelease

func NewDefaultRelease(options *ReleaseOptions) *DefaultRelease

NewDefaultRelease creates a new defaultRelease instance.

func (*DefaultRelease) CheckPrerequisites

func (d *DefaultRelease) CheckPrerequisites() error

CheckPrerequisites checks if all prerequisites for the release process are met.

func (*DefaultRelease) CheckReleaseBranchState

func (d *DefaultRelease) CheckReleaseBranchState() error

func (*DefaultRelease) CheckoutOBSProject

func (d *DefaultRelease) CheckoutOBSProject() error

CheckoutOBSProject checks out the OBS project.

func (*DefaultRelease) GenerateOBSProject

func (d *DefaultRelease) GenerateOBSProject() error

GenerateOBSProject generates the OBS project name for the release. Uses the project from the options if set, otherwise generates the project name based on the release type.

func (*DefaultRelease) GenerateReleaseVersion

func (d *DefaultRelease) GenerateReleaseVersion() error

func (*DefaultRelease) InitOBSRoot

func (d *DefaultRelease) InitOBSRoot() error

InitOBSRoot creates the OBS root directory and the OBS config file.

func (*DefaultRelease) InitState

func (d *DefaultRelease) InitState()

func (*DefaultRelease) ReleasePackages

func (d *DefaultRelease) ReleasePackages() error

ReleasePackage publishes successful builds into the maintenance project.

func (*DefaultRelease) SetImpl

func (d *DefaultRelease) SetImpl(impl releaseImpl)

SetImpl can be used to set the internal release implementation.

func (*DefaultRelease) SetState

func (d *DefaultRelease) SetState(state *ReleaseState)

SetState fixes the current state. Mainly used for passing arbitrary values during testing

func (*DefaultRelease) Submit

func (d *DefaultRelease) Submit(stream bool) error

func (*DefaultRelease) ValidateOptions

func (d *DefaultRelease) ValidateOptions() error

ValidateOptions validates the release options.

type DefaultStage

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

DefaultStage is the default staging implementation used in production.

func NewDefaultStage

func NewDefaultStage(options *StageOptions) *DefaultStage

NewDefaultStage creates a new defaultStage instance.

func (*DefaultStage) CheckPrerequisites

func (d *DefaultStage) CheckPrerequisites() error

CheckPrerequisites checks if all prerequisites for the stage process are met.

func (*DefaultStage) CheckReleaseBranchState

func (d *DefaultStage) CheckReleaseBranchState() error

func (*DefaultStage) CheckoutOBSProject

func (d *DefaultStage) CheckoutOBSProject() error

CheckoutOBSProject checks out the OBS project.

func (*DefaultStage) GenerateOBSProject

func (d *DefaultStage) GenerateOBSProject() error

GenerateOBSProject generates the OBS project name for the release. Uses the project from the options if set, otherwise generates the project name based on the release type.

func (*DefaultStage) GeneratePackageArtifacts

func (d *DefaultStage) GeneratePackageArtifacts() error

GeneratePackageArtifacts generates the spec file and artifacts archive for packages that are built.

func (*DefaultStage) GeneratePackageVersion

func (d *DefaultStage) GeneratePackageVersion()

GeneratePackageVersion generates the package version for the release. Uses the version from the options if set, otherwise uses the prime version.

func (*DefaultStage) GenerateReleaseVersion

func (d *DefaultStage) GenerateReleaseVersion() error

func (*DefaultStage) InitOBSRoot

func (d *DefaultStage) InitOBSRoot() error

InitOBSRoot creates the OBS root directory and the OBS config file.

func (*DefaultStage) InitState

func (d *DefaultStage) InitState()

func (*DefaultStage) Push

func (d *DefaultStage) Push() error

Push pushes changes to OpenBuildService which triggers the build.

func (*DefaultStage) SetImpl

func (d *DefaultStage) SetImpl(impl stageImpl)

SetImpl can be used to set the internal stage implementation.

func (*DefaultStage) SetState

func (d *DefaultStage) SetState(state *StageState)

SetState fixes the current state. Mainly used for passing arbitrary values during testing

func (*DefaultStage) State

func (d *DefaultStage) State() *StageState

State returns the internal state.

func (*DefaultStage) Submit

func (d *DefaultStage) Submit(stream bool) error

func (*DefaultStage) ValidateOptions

func (d *DefaultStage) ValidateOptions() error

ValidateOptions validates the stage options.

func (*DefaultStage) Wait added in v0.16.2

func (d *DefaultStage) Wait() error

Wait waits for the OBS build results to succeed.

type Options

type Options struct {
	// Workspace is the root workspace.
	Workspace string

	// Run the whole process in non-mocked mode. Which means that it doesn't
	// push specs and artifacts to OpenBuildService.
	NoMock bool

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

	// Packages that should be built and published to OpenBuildService.
	Packages []string

	// Architectures for which packages should be built.
	Architectures []string

	// The release type for which packages are built for.
	// Can be either `alpha`, `beta`, `rc` or `official`.
	// Mutually exclusive with `Version`, `Project` and `Source`.
	ReleaseType string

	// The release branch for which the release should be built.
	// Can be `master`/`main` or any `release-x.y` branch.
	// Mutually exclusive with `Version`, `Project` and `Source`.
	ReleaseBranch string

	// The build version to be released. Has to be specified in the format:
	// `vX.Y.Z-[alpha|beta|rc].N.C+SHA`
	// Mutually exclusive with `Version`, `Project` and `Source`.
	BuildVersion string

	// Version of packages to build. Same version is used for all provided
	// packages.
	// Mutually exclusive with `ReleaseType`, `ReleaseBranch`, and
	// `BuildVersion`.
	Version string

	// Project is name of the OBS project where packages are built.
	// Mutually exclusive with `ReleaseType`, `ReleaseBranch`, and
	// `BuildVersion`.
	Project string

	// PackageSource is https:// or gs:// URL where to download binaries for
	// packages from.
	// Mutually exclusive with `ReleaseType`, `ReleaseBranch`, and
	// `BuildVersion`.
	PackageSource string

	// Wait can be used to wait for the OBS build results.
	Wait bool
}

Options are settings which will be used by `StageOptions` as well as `ReleaseOptions`.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns a new `Options` instance.

func (*Options) Bucket

func (o *Options) Bucket() string

Bucket returns the Google Cloud Bucket for these `Options`.

func (*Options) String

func (o *Options) String() string

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

func (*Options) Validate

func (o *Options) Validate(submit bool) error

Validate if the options are correctly set.

func (*Options) ValidateBuildVersion

func (o *Options) ValidateBuildVersion(state *State) error

ValidateBuildVersion validates the provided build version.

type PrerequisitesChecker

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

PrerequisitesChecker is the main type for checking the prerequisites for OBS operations.

func NewPrerequisitesChecker

func NewPrerequisitesChecker() *PrerequisitesChecker

NewPrerequisitesChecker creates a new PrerequisitesChecker instance.

func (*PrerequisitesChecker) Options

Options return the options from the prereq checker

func (*PrerequisitesChecker) Run

func (p *PrerequisitesChecker) Run(workdir string) error

func (*PrerequisitesChecker) SetImpl

func (p *PrerequisitesChecker) SetImpl(impl prerequisitesCheckerImpl)

SetImpl can be used to set the internal PrerequisitesChecker implementation.

type PrerequisitesCheckerOptions

type PrerequisitesCheckerOptions struct {
	CheckOBSPassword bool
}

Type prerequisites checker

type Release

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

Release is the structure to be used for releasing staged OBS builds.

func NewRelease

func NewRelease(options *ReleaseOptions) *Release

NewRelease creates a new `Release` instance.

func (*Release) Run

func (r *Release) Run() error

Run for `Release` struct finishes a previously staged release.

func (*Release) SetClient

func (r *Release) SetClient(client releaseClient)

SetClient can be used to set the internal stage client.

func (*Release) Submit

func (r *Release) Submit(stream bool) error

Submit can be used to submit a releasing Google Cloud Build (GCB) job.

type ReleaseOptions

type ReleaseOptions struct {
	*Options
}

ReleaseOptions contains the options for running `Release`.

func DefaultReleaseOptions

func DefaultReleaseOptions() *ReleaseOptions

DefaultReleaseOptions create a new default `ReleaseOptions`.

func (*ReleaseOptions) String

func (r *ReleaseOptions) String() string

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

func (*ReleaseOptions) Validate

func (r *ReleaseOptions) Validate(state *State, submit bool) error

Validate if the options are correctly set.

type ReleaseState

type ReleaseState struct {
	*State
}

ReleaseState holds the release process state

func DefaultReleaseState

func DefaultReleaseState() *ReleaseState

DefaultReleaseState create a new default `ReleaseOptions`.

type Stage

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

Stage is the structure to be used for staging packages.

func NewStage

func NewStage(options *StageOptions) *Stage

NewStage creates a new `Stage` instance.

func (*Stage) Run

func (s *Stage) Run() error

Run for the `Stage` struct prepares a release and pushes specs and archives to OpenBuildService.

func (*Stage) SetClient

func (s *Stage) SetClient(client stageClient)

SetClient can be used to set the internal stage client.

func (*Stage) Submit

func (s *Stage) Submit(stream bool) error

Submit can be used to submit a staging Google Cloud Build (GCB) job.

type StageOptions

type StageOptions struct {
	*Options
}

StageOptions contains the options for running `Stage`.

func DefaultStageOptions

func DefaultStageOptions() *StageOptions

DefaultStageOptions create a new default `StageOptions`.

func (*StageOptions) String

func (s *StageOptions) String() string

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

func (*StageOptions) Validate

func (s *StageOptions) Validate(state *State, submit bool) error

Validate validates the stage options.

type StageState

type StageState struct {
	*State
}

StageState holds the stage process state

func DefaultStageState

func DefaultStageState() *StageState

DefaultStageState create a new default `StageState`.

type State

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

State holds all inferred and calculated values from the stage/release process, it's state mutates as each step es executed

func DefaultState

func DefaultState() *State

DefaultState returns a new empty State

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
specsfakes
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