bitbucket

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package bitbucket provides a release.Provider implementation for Bitbucket Cloud using the Downloads API. Bitbucket has no native "Releases" concept; version information is inferred from asset filenames using a configurable regular expression. Provider construction uses package-owned Settings; GTB config integration lives in SettingsFromConfig.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitbucketReleaseProvider

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

BitbucketReleaseProvider implements release.Provider for Bitbucket Cloud.

func NewReleaseProvider

func NewReleaseProvider(settings Settings) (*BitbucketReleaseProvider, error)

NewReleaseProvider constructs a BitbucketReleaseProvider from explicit typed settings. Credentials are resolved before construction by GTB adapter code.

func (*BitbucketReleaseProvider) DownloadChecksumManifest

func (p *BitbucketReleaseProvider) DownloadChecksumManifest(ctx context.Context, rel release.Release, maxBytes int64) ([]byte, error)

DownloadChecksumManifest implements release.ChecksumProvider by locating an uploaded `checksums.txt` by exact filename in the repository's downloads list. The filename regex used by [matchAssets] is intentionally tight around the binary pattern, so the manifest is not picked up there; this method bypasses the regex for the well-known manifest name.

Returns release.ErrNotSupported when the downloads list contains no `checksums.txt`, so the caller treats it the same as "provider has no manifest support" and respects require_checksum policy.

func (*BitbucketReleaseProvider) DownloadReleaseAsset

func (p *BitbucketReleaseProvider) DownloadReleaseAsset(ctx context.Context, _, _ string, asset release.ReleaseAsset) (io.ReadCloser, string, error)

DownloadReleaseAsset streams the asset at its BrowserDownloadURL.

func (*BitbucketReleaseProvider) DownloadSignature added in v0.12.0

func (p *BitbucketReleaseProvider) DownloadSignature(ctx context.Context, rel release.Release, maxBytes int64) ([]byte, error)

DownloadSignature implements release.SignatureProvider by locating an uploaded `checksums.txt.sig` by exact filename in the downloads list. Returns release.ErrNotSupported when no signature file was uploaded, so the caller respects the require_signature policy.

func (*BitbucketReleaseProvider) GetLatestRelease

func (p *BitbucketReleaseProvider) GetLatestRelease(ctx context.Context, owner, repo string) (release.Release, error)

GetLatestRelease returns a synthetic release built from the most recently uploaded Downloads that match the filename pattern.

func (*BitbucketReleaseProvider) GetReleaseByTag

func (p *BitbucketReleaseProvider) GetReleaseByTag(_ context.Context, _, _, _ string) (release.Release, error)

GetReleaseByTag is not supported for Bitbucket Downloads.

func (*BitbucketReleaseProvider) ListReleases

func (p *BitbucketReleaseProvider) ListReleases(_ context.Context, _, _ string, _ int) ([]release.Release, error)

ListReleases is not supported for Bitbucket Downloads.

func (*BitbucketReleaseProvider) SetAPIBase

func (p *BitbucketReleaseProvider) SetAPIBase(base string)

SetAPIBase overrides the Bitbucket API base URL. Intended for testing only.

type Settings added in v0.30.0

type Settings struct {
	ReleaseSource   release.ReleaseSourceConfig
	Username        string
	AppPassword     string
	FilenamePattern string
}

Settings contains the typed configuration needed to construct a Bitbucket release provider without binding the provider to GTB config.

func SettingsFromConfig added in v0.30.0

func SettingsFromConfig(src release.ReleaseSourceConfig, cfg release.Config) (Settings, error)

SettingsFromConfig adapts the bitbucket config subtree into typed provider settings. It preserves the existing credential resolution chain and filename_pattern release-source param.

Jump to

Keyboard shortcuts

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