artifact

package
v3.84.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 56 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArtifactPathDelimiter    = ";"
	ArtifactFallbackMimeType = "binary/octet-stream"
)

Variables

This section is empty.

Functions

func IsAzureBlobPath

func IsAzureBlobPath(loc string) bool

IsAzureBlobPath reports if the location is an Azure Blob Storage path.

func NewAzureBlobClient

func NewAzureBlobClient(l logger.Logger, storageAccountName string) (*service.Client, error)

NewAzureBlobClient creates a new Azure Blob Storage client.

func NewS3Client added in v3.82.0

func NewS3Client(l logger.Logger, bucket string) (*s3.S3, error)

func ParseArtifactoryDestination added in v3.82.0

func ParseArtifactoryDestination(destination string) (repo string, path string)

func ParseGSDestination added in v3.82.0

func ParseGSDestination(destination string) (name string, path string)

func ParseS3Destination added in v3.82.0

func ParseS3Destination(destination string) (string, string)

Types

type APIClient added in v3.82.0

type APIClient interface {
	CreateArtifacts(context.Context, string, *api.ArtifactBatch) (*api.ArtifactBatchCreateResponse, *api.Response, error)
	SearchArtifacts(context.Context, string, *api.ArtifactSearchOptions) ([]*api.Artifact, *api.Response, error)
	UpdateArtifacts(context.Context, string, []api.ArtifactState) (*api.Response, error)
}

APIClient describes the Agent REST API methods used by the artifact package.

type ArtifactoryDownloader added in v3.82.0

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

func NewArtifactoryDownloader added in v3.82.0

func NewArtifactoryDownloader(l logger.Logger, c ArtifactoryDownloaderConfig) *ArtifactoryDownloader

func (ArtifactoryDownloader) RepositoryFileLocation added in v3.82.0

func (d ArtifactoryDownloader) RepositoryFileLocation() string

func (ArtifactoryDownloader) RepositoryName added in v3.82.0

func (d ArtifactoryDownloader) RepositoryName() string

func (ArtifactoryDownloader) RepositoryPath added in v3.82.0

func (d ArtifactoryDownloader) RepositoryPath() string

func (ArtifactoryDownloader) Start added in v3.82.0

type ArtifactoryDownloaderConfig added in v3.82.0

type ArtifactoryDownloaderConfig struct {
	// The Artifactory repository name and the path, for example, rt://my-repo-name/foo/bar
	Repository string

	// The root directory of the download
	Destination string

	// The relative path that should be preserved in the download folder,
	// also its location in the repo
	Path string

	// How many times should it retry the download before giving up
	Retries int

	// If failed responses should be dumped to the log
	DebugHTTP    bool
	TraceHTTP    bool
	DisableHTTP2 bool
}

type ArtifactoryUploader added in v3.82.0

type ArtifactoryUploader struct {
	// The artifactory bucket path set from the destination
	Path string

	// The artifactory bucket name set from the destination
	Repository string
	// contains filtered or unexported fields
}

func NewArtifactoryUploader added in v3.82.0

func NewArtifactoryUploader(l logger.Logger, c ArtifactoryUploaderConfig) (*ArtifactoryUploader, error)

func (*ArtifactoryUploader) CreateWork added in v3.83.0

func (u *ArtifactoryUploader) CreateWork(artifact *api.Artifact) ([]workUnit, error)

func (*ArtifactoryUploader) URL added in v3.82.0

func (u *ArtifactoryUploader) URL(artifact *api.Artifact) string

type ArtifactoryUploaderConfig added in v3.82.0

type ArtifactoryUploaderConfig struct {
	// The destination which includes the Artifactory bucket name and the path.
	// e.g artifactory://my-repo-name/foo/bar
	Destination string

	// Standard HTTP options
	DebugHTTP    bool
	TraceHTTP    bool
	DisableHTTP2 bool
}

type AzureBlobDownloader

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

AzureBlobDownloader downloads files from Azure Blob storage.

func NewAzureBlobDownloader

func NewAzureBlobDownloader(l logger.Logger, c AzureBlobDownloaderConfig) *AzureBlobDownloader

NewAzureBlobDownloader creates a new AzureBlobDownloader.

func (*AzureBlobDownloader) Start

func (d *AzureBlobDownloader) Start(ctx context.Context) error

Start starts the download.

type AzureBlobDownloaderConfig

type AzureBlobDownloaderConfig struct {
	Path        string
	Repository  string
	Destination string
	Retries     int
	DebugHTTP   bool
	TraceHTTP   bool
}

AzureBlobUploaderConfig configures AzureBlobDownloader.

type AzureBlobLocation

type AzureBlobLocation struct {
	StorageAccountName string
	ContainerName      string
	BlobPath           string
}

AzureBlobLocation specifies the location of a blob in Azure Blob Storage.

func ParseAzureBlobLocation

func ParseAzureBlobLocation(loc string) (*AzureBlobLocation, error)

ParseAzureBlobLocation parses a URL into an Azure Blob Storage location.

func (*AzureBlobLocation) String

func (l *AzureBlobLocation) String() string

String returns the location as a URL string.

func (*AzureBlobLocation) URL

func (l *AzureBlobLocation) URL(blob string) string

URL returns an Azure Blob Storage URL for the blob.

type AzureBlobUploader

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

AzureBlobUploader uploads artifacts to Azure Blob Storage.

func NewAzureBlobUploader

func NewAzureBlobUploader(l logger.Logger, c AzureBlobUploaderConfig) (*AzureBlobUploader, error)

NewAzureBlobUploader creates a new AzureBlobUploader.

func (*AzureBlobUploader) CreateWork added in v3.83.0

func (u *AzureBlobUploader) CreateWork(artifact *api.Artifact) ([]workUnit, error)

func (*AzureBlobUploader) URL

func (u *AzureBlobUploader) URL(artifact *api.Artifact) string

URL returns the full destination URL of an artifact.

type AzureBlobUploaderConfig

type AzureBlobUploaderConfig struct {
	// The destination which includes the storage account name and the path.
	// For example, "https://my-storage-account.blob.core.windows.net/my-container/my-virtual-directory/artifacts-go-here/"
	Destination string
}

AzureBlobUploaderConfig configures AzureBlobUploader.

type BKUploader added in v3.83.0

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

BKUploader uploads artifacts to Buildkite itself.

func NewBKUploader added in v3.83.0

func NewBKUploader(l logger.Logger, c BKUploaderConfig) *BKUploader

NewBKUploader creates a new Buildkite uploader.

func (*BKUploader) CreateWork added in v3.83.0

func (u *BKUploader) CreateWork(artifact *api.Artifact) ([]workUnit, error)

CreateWork checks the artifact size, then creates one worker.

func (*BKUploader) URL added in v3.83.0

func (u *BKUploader) URL(*api.Artifact) string

URL returns the empty string. BKUploader doesn't know the URL in advance, it is provided by Buildkite after uploading.

type BKUploaderConfig added in v3.83.0

type BKUploaderConfig struct {
	// Standard HTTP options
	DebugHTTP    bool
	TraceHTTP    bool
	DisableHTTP2 bool
}

type BatchCreator added in v3.82.0

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

func NewArtifactBatchCreator added in v3.82.0

func NewArtifactBatchCreator(l logger.Logger, ac APIClient, c BatchCreatorConfig) *BatchCreator

func (*BatchCreator) Create added in v3.82.0

func (a *BatchCreator) Create(ctx context.Context) ([]*api.Artifact, error)

type BatchCreatorConfig added in v3.82.0

type BatchCreatorConfig struct {
	// The ID of the Job that these artifacts belong to
	JobID string

	// All the artifacts that need to be created
	Artifacts []*api.Artifact

	// Where the artifacts are being uploaded to on the command line
	UploadDestination string

	// CreateArtifactsTimeout, sets a context.WithTimeout around the CreateArtifacts API.
	// If it's zero, there's no context timeout and the default HTTP timeout will prevail.
	CreateArtifactsTimeout time.Duration

	// Whether to allow multipart uploads to the BK-hosted bucket.
	AllowMultipart bool
}

type Download added in v3.82.0

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

func NewDownload added in v3.82.0

func NewDownload(l logger.Logger, client *http.Client, c DownloadConfig) *Download

func (Download) Start added in v3.82.0

func (d Download) Start(ctx context.Context) error

type DownloadConfig added in v3.82.0

type DownloadConfig struct {
	// The actual URL to get the file from
	URL string

	// The root directory of the download
	Destination string

	// Optional Headers to append to the request
	Headers map[string]string

	// The relative path that should be preserved in the download folder
	Path string

	// How many times should it retry the download before giving up
	Retries int

	// Hexadecimal(SHA256(content)) used to verify the downloaded contents, if not empty
	WantSHA256 string

	// If failed responses should be dumped to the log
	// Standard HTTP options.
	DebugHTTP bool
	TraceHTTP bool
}

type Downloader added in v3.82.0

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

func NewDownloader added in v3.82.0

func NewDownloader(l logger.Logger, ac APIClient, c DownloaderConfig) Downloader

func (*Downloader) Download added in v3.82.0

func (a *Downloader) Download(ctx context.Context) error

type DownloaderConfig added in v3.82.0

type DownloaderConfig struct {
	// The ID of the Build
	BuildID string

	// The query used to find the artifacts
	Query string

	// Which step should we look at for the jobs
	Step string

	// Whether to include artifacts from retried jobs in the search
	IncludeRetriedJobs bool

	// Where we'll be downloading artifacts to
	Destination string

	// Standard HTTP options
	DebugHTTP    bool
	TraceHTTP    bool
	DisableHTTP2 bool
}

type Error added in v3.82.0

type Error struct {
	Status  int    `json:"status"`  // Error code
	Message string `json:"message"` // Message describing the error.
}

An Error reports more details on an individual error in an ErrorResponse.

type GSDownloader added in v3.82.0

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

func NewGSDownloader added in v3.82.0

func NewGSDownloader(l logger.Logger, c GSDownloaderConfig) *GSDownloader

func (GSDownloader) BucketFileLocation added in v3.82.0

func (d GSDownloader) BucketFileLocation() string

func (GSDownloader) BucketName added in v3.82.0

func (d GSDownloader) BucketName() string

func (GSDownloader) BucketPath added in v3.82.0

func (d GSDownloader) BucketPath() string

func (GSDownloader) Start added in v3.82.0

func (d GSDownloader) Start(ctx context.Context) error

type GSDownloaderConfig added in v3.82.0

type GSDownloaderConfig struct {
	// The name of the bucket
	Bucket string

	// The root directory of the download
	Destination string

	// The relative path that should be preserved in the download folder,
	// also its location in the bucket
	Path string

	// How many times should it retry the download before giving up
	Retries int

	// If failed responses should be dumped to the log
	DebugHTTP bool
	TraceHTTP bool
}

type GSUploader added in v3.82.0

type GSUploader struct {
	// The gs bucket path set from the destination
	BucketPath string

	// The gs bucket name set from the destination
	BucketName string
	// contains filtered or unexported fields
}

func NewGSUploader added in v3.82.0

func NewGSUploader(ctx context.Context, l logger.Logger, c GSUploaderConfig) (*GSUploader, error)

func (*GSUploader) CreateWork added in v3.83.0

func (u *GSUploader) CreateWork(artifact *api.Artifact) ([]workUnit, error)

func (*GSUploader) URL added in v3.82.0

func (u *GSUploader) URL(artifact *api.Artifact) string

type GSUploaderConfig added in v3.82.0

type GSUploaderConfig struct {
	// The destination which includes the GS bucket name and the path.
	// gs://my-bucket-name/foo/bar
	Destination string
}

type S3Downloader added in v3.82.0

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

func NewS3Downloader added in v3.82.0

func NewS3Downloader(l logger.Logger, c S3DownloaderConfig) *S3Downloader

func (S3Downloader) BucketFileLocation added in v3.82.0

func (d S3Downloader) BucketFileLocation() string

func (S3Downloader) BucketName added in v3.82.0

func (d S3Downloader) BucketName() string

func (S3Downloader) BucketPath added in v3.82.0

func (d S3Downloader) BucketPath() string

func (S3Downloader) Start added in v3.82.0

func (d S3Downloader) Start(ctx context.Context) error

type S3DownloaderConfig added in v3.82.0

type S3DownloaderConfig struct {
	// The client for interacting with S3
	S3Client *s3.S3

	// The S3 bucket name and the path, for example, s3://my-bucket-name/foo/bar
	S3Path string

	// The root directory of the download
	Destination string

	// The relative path that should be preserved in the download folder,
	// also its location in the bucket
	Path string

	// How many times should it retry the download before giving up
	Retries int

	// If failed responses should be dumped to the log
	DebugHTTP    bool
	TraceHTTP    bool
	DisableHTTP2 bool
}

type S3Uploader added in v3.82.0

type S3Uploader struct {
	// The s3 bucket path set from the destination
	BucketPath string

	// The s3 bucket name set from the destination
	BucketName string
	// contains filtered or unexported fields
}

func NewS3Uploader added in v3.82.0

func NewS3Uploader(l logger.Logger, c S3UploaderConfig) (*S3Uploader, error)

func (*S3Uploader) CreateWork added in v3.83.0

func (u *S3Uploader) CreateWork(artifact *api.Artifact) ([]workUnit, error)

func (*S3Uploader) URL added in v3.82.0

func (u *S3Uploader) URL(artifact *api.Artifact) string

type S3UploaderConfig added in v3.82.0

type S3UploaderConfig struct {
	// The destination which includes the S3 bucket name and the path.
	// For example, s3://my-bucket-name/foo/bar
	Destination string
}

type Searcher added in v3.82.0

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

func NewSearcher added in v3.82.0

func NewSearcher(l logger.Logger, ac APIClient, buildID string) *Searcher

func (*Searcher) Search added in v3.82.0

func (a *Searcher) Search(ctx context.Context, query, scope string, includeRetriedJobs, includeDuplicates bool) ([]*api.Artifact, error)

type Uploader added in v3.82.0

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

func NewUploader added in v3.82.0

func NewUploader(l logger.Logger, ac APIClient, c UploaderConfig) *Uploader

func (*Uploader) Upload added in v3.82.0

func (a *Uploader) Upload(ctx context.Context) error

type UploaderConfig added in v3.82.0

type UploaderConfig struct {
	// The ID of the Job
	JobID string

	// The path of the uploads
	Paths string

	// Where we'll be uploading artifacts
	Destination string

	// A specific Content-Type to use for all artifacts
	ContentType string

	// Standard HTTP options.
	DebugHTTP    bool
	TraceHTTP    bool
	DisableHTTP2 bool

	// Whether to follow symbolic links when resolving globs
	GlobResolveFollowSymlinks bool

	// Whether to not upload symlinks
	UploadSkipSymlinks bool

	// Whether to allow multipart uploads to the BK-hosted bucket
	AllowMultipart bool
}

Jump to

Keyboard shortcuts

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