koji

package
v0.0.0-...-5a776c5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKojiTransport

func CreateKojiTransport(relaxTimeout uint) http.RoundTripper

func CreateRetryableTransport

func CreateRetryableTransport() *rh.RoundTripper

Types

type Build

type Build struct {
	BuildID   uint64 `json:"build_id"`
	TaskID    uint64 `json:"task_id"`
	Name      string `json:"name"`
	Version   string `json:"version"`
	Release   string `json:"release"`
	Source    string `json:"source"`
	StartTime int64  `json:"start_time"`
	EndTime   int64  `json:"end_time"`
	// NOTE: This is the struct that ends up shown in the buildinfo and webui in Koji.
	Extra BuildExtra `json:"extra"`
}

Build represents a Koji build and holds metadata about it.

type BuildExtra

type BuildExtra struct {
	TypeInfo TypeInfoBuild `json:"typeinfo"`
	// Manifest holds extra metadata about osbuild manifests attached to the build.
	// It is a map whose keys are the filenames of the manifests, and
	// the values are the extra metadata for the manifest.
	Manifest map[string]*ManifestExtraInfo `json:"osbuild_manifest,omitempty"`
}

BuildExtra holds extra metadata associated with the build. It is a free-form map, but must contain at least the 'typeinfo' key.

type BuildOutput

type BuildOutput struct {
	BuildRootID  uint64            `json:"buildroot_id"`
	Filename     string            `json:"filename"`
	FileSize     uint64            `json:"filesize"`
	Arch         string            `json:"arch"` // can be 'noarch' or a specific arch
	ChecksumType ChecksumType      `json:"checksum_type"`
	Checksum     string            `json:"checksum"`
	Type         BuildOutputType   `json:"type"`
	RPMs         []rpmmd.RPM       `json:"components,omitempty"`
	Extra        *BuildOutputExtra `json:"extra,omitempty"`
}

BuildOutput represents an output from the OSBuild content generator. The output can be a file of various types, which is imported to Koji. Examples of types are "image", "log" or other.

type BuildOutputExtra

type BuildOutputExtra struct {
	// ImageOutput holds extra metadata about a single "image" output.
	// "image" in this context is the "build type" in the Koji terminology,
	// not necessarily an actual image. It can and must be used also for
	// other supplementary files related to the image, such as osbuild manifest.
	// The only exception are logs, which do not need to specify any "typeinfo".
	ImageOutput ImageOutputTypeExtraInfo `json:"image"`
}

BuildOutputExtra holds extra metadata associated with the build output.

type BuildOutputType

type BuildOutputType string

BuildOutputType represents the type of a BuildOutput.

const (
	BuildOutputTypeImage    BuildOutputType = "image"
	BuildOutputTypeLog      BuildOutputType = "log"
	BuildOutputTypeManifest BuildOutputType = "osbuild-manifest"
)

type BuildRoot

type BuildRoot struct {
	ID               uint64           `json:"id"`
	Host             Host             `json:"host"`
	ContentGenerator ContentGenerator `json:"content_generator"`
	Container        Container        `json:"container"`
	Tools            []Tool           `json:"tools"`
	RPMs             []rpmmd.RPM      `json:"components"`
}

BuildRoot represents a buildroot used for the build.

type CGImportResult

type CGImportResult struct {
	BuildID int `xmlrpc:"build_id"`
}

type CGInitBuildResult

type CGInitBuildResult struct {
	BuildID int    `xmlrpc:"build_id"`
	Token   string `xmlrpc:"token"`
}

type ChecksumType

type ChecksumType string

ChecksumType represents the type of a checksum used for a BuildOutput.

const (
	ChecksumTypeMD5     ChecksumType = "md5"
	ChecksumTypeAdler32 ChecksumType = "adler32"
	ChecksumTypeSHA256  ChecksumType = "sha256"
)

type Container

type Container struct {
	// Type of the container that was used, e.g. 'none', 'chroot', 'kvm', 'docker', etc.
	Type string `json:"type"`
	Arch string `json:"arch"`
}

Container holds information about the container in which the build was run.

type ContentGenerator

type ContentGenerator struct {
	Name    string `json:"name"` // Must be 'osbuild'.
	Version string `json:"version"`
}

ContentGenerator holds information about the content generator which run the build.

type GSSAPICredentials

type GSSAPICredentials struct {
	Principal string
	KeyTab    string
}

func GSSAPICredentialsFromEnv

func GSSAPICredentialsFromEnv() (*GSSAPICredentials, error)

type Host

type Host struct {
	Os   string `json:"os"`
	Arch string `json:"arch"`
}

Host holds information about the host where the build was run.

type ImageExtraInfo

type ImageExtraInfo struct {
	Arch string `json:"arch"`
	// Boot mode of the image
	BootMode string `json:"boot_mode,omitempty"`
	// Configuration used to prouce this image using osbuild
	OSBuildArtifact *target.OsbuildArtifact `json:"osbuild_artifact,omitempty"`
	// Version of the osbuild binary used by the worker to build the image
	OSBuildVersion string `json:"osbuild_version,omitempty"`
	// Results from any upload targets associated with the image
	// except for the Koji target.
	UploadTargetResults []*target.TargetResult `json:"upload_target_results,omitempty"`
}

ImageExtraInfo holds extra metadata about the image. This structure is shared for the Extra metadata of the output and the build.

type ImageOutputTypeExtraInfo

type ImageOutputTypeExtraInfo interface {
	// contains filtered or unexported methods
}

type Koji

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

func NewFromGSSAPI

func NewFromGSSAPI(server string, credentials *GSSAPICredentials, transport http.RoundTripper) (*Koji, error)

NewFromGSSAPI creates a new Koji session authenticated using GSSAPI. Principal and keytab used for the session is passed using credentials parameter.

func NewFromPlain

func NewFromPlain(server, user, password string, transport http.RoundTripper) (*Koji, error)

NewFromPlain creates a new Koji sessions =authenticated using the plain username/password method. If you want to speak to a public koji instance, you probably cannot use this method.

func (*Koji) CGCancelBuild

func (k *Koji) CGCancelBuild(buildID int, token string) error

CGCancelBuild marks an in-progress build as cancelled, and

func (*Koji) CGFailBuild

func (k *Koji) CGFailBuild(buildID int, token string) error

CGFailBuild marks an in-progress build as failed

func (*Koji) CGImport

func (k *Koji) CGImport(build Build, buildRoots []BuildRoot, outputs []BuildOutput, directory, token string) (*CGImportResult, error)

CGImport imports previously uploaded content, by specifying its metadata, and the temporary directory where it is located.

func (*Koji) CGInitBuild

func (k *Koji) CGInitBuild(name, version, release string) (*CGInitBuildResult, error)

CGInitBuild reserves a build ID and initializes a build

func (*Koji) GetAPIVersion

func (k *Koji) GetAPIVersion() (int, error)

GetAPIVersion gets the version of the API of the remote Koji instance

func (*Koji) Logout

func (k *Koji) Logout() error

Logout ends the session

func (*Koji) Upload

func (k *Koji) Upload(file io.Reader, filepath, filename string) (string, uint64, error)

Upload uploads file to the temporary filepath on the kojiserver under the name filename The md5sum and size of the file is returned on success.

type LeveledLogrus

type LeveledLogrus struct {
	*logrus.Logger
}

func (*LeveledLogrus) Debug

func (l *LeveledLogrus) Debug(msg string, keysAndValues ...interface{})

func (*LeveledLogrus) Error

func (l *LeveledLogrus) Error(msg string, keysAndValues ...interface{})

func (*LeveledLogrus) Info

func (l *LeveledLogrus) Info(msg string, keysAndValues ...interface{})

func (*LeveledLogrus) Warn

func (l *LeveledLogrus) Warn(msg string, keysAndValues ...interface{})

type ManifestExtraInfo

type ManifestExtraInfo struct {
	Arch string        `json:"arch"`
	Info *ManifestInfo `json:"info,omitempty"`
}

ManifestExtraInfo holds extra metadata about the osbuild manifest.

type ManifestInfo

type ManifestInfo struct {
	OSBuildComposerVersion string `json:"osbuild_composer_version"`
	// List of relevant modules used by osbuild-composer which
	// could affect the manifest content.
	OSBuildComposerDeps []*OSBuildComposerDepModule `json:"osbuild_composer_deps,omitempty"`
}

ManifestInfo holds information about the environment in which the manifest was produced and which could affect its content.

type Metadata

type Metadata struct {
	MetadataVersion int           `json:"metadata_version"` // must be '0'
	Build           Build         `json:"build"`
	BuildRoots      []BuildRoot   `json:"buildroots"`
	Outputs         []BuildOutput `json:"output"`
}

Metadata holds Koji Content Generator metadata. This is passed to the CGImport call. For more information, see https://docs.pagure.org/koji/content_generator_metadata/

type OSBuildComposerDepModule

type OSBuildComposerDepModule struct {
	Path    string                    `json:"path"`
	Version string                    `json:"version"`
	Replace *OSBuildComposerDepModule `json:"replace,omitempty"`
}

type Tool

type Tool struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Tool holds information about a tool used to run build.

type Transport

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

func (*Transport) RoundTrip

func (rt *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface, using the default transport. When a session has been established, also pass along the session credentials. This may not be how the RoundTripper interface is meant to be used, but the underlying XML-RPC helpers don't allow us to adjust the URL per-call (these arguments should really be in the body).

type TypeInfoBuild

type TypeInfoBuild struct {
	// Image holds extra metadata about all images built by the build.
	// It is a map whose keys are the filenames of the images, and
	// the values are the extra metadata for the image.
	// There can't be more than one image with the same filename.
	Image map[string]ImageExtraInfo `json:"image"`
}

TypeInfoBuild is a map whose entries are the names of the build types used for the build, and the values are free-form maps containing type-specific information for the build.

Jump to

Keyboard shortcuts

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