release

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Latest added in v0.5.0

func Latest(ctx context.Context, r Release) (string, error)

Latest returns the latest release. Note that GetLatestRelease API in GitHub and GitLab returns the most recent release, which doesn't mean the latest stable release. I'm not sure if it also affects Terraform Registry but I think we should use the same strategy for consistency. So we sort versions in semver order and find the latest non pre-release.

func List added in v0.5.0

func List(ctx context.Context, r Release, maxLength int, preRelease bool) ([]string, error)

List returns a list of releases in semver order. If preRelease is set to false, the result doesn't contain pre-releases.

Types

type GitHubAPI added in v0.3.1

type GitHubAPI interface {
	// RepositoriesListReleases lists the releases for a repository.
	// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
	RepositoriesListReleases(ctx context.Context, owner, repo string, opt *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)
}

GitHubAPI is an interface which calls GitHub API. This abstraction layer is needed for testing with mock.

type GitHubClient added in v0.3.1

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

GitHubClient is a real GitHubAPI implementation.

func NewGitHubClient added in v0.3.1

func NewGitHubClient(config GitHubConfig) (*GitHubClient, error)

NewGitHubClient returns a real GitHubClient instance.

func (*GitHubClient) RepositoriesListReleases added in v0.3.5

func (c *GitHubClient) RepositoriesListReleases(ctx context.Context, owner, repo string, opt *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)

RepositoriesListReleases lists the releases for a repository.

type GitHubConfig added in v0.3.1

type GitHubConfig struct {

	// BaseURL is a URL for GitHub API requests.
	// Defaults to the public GitHub API.
	// This looks like the GitHub Enterprise support, but currently for testing purposes only.
	// The GitHub Enterprise is not supported yet.
	// BaseURL should always be specified with a trailing slash.
	BaseURL string

	// Token is a personal access token for GitHub.
	// This allows access to a private repository.
	Token string
	// contains filtered or unexported fields
}

GitHubConfig is a set of configurations for GitHubRelease.

type GitHubRelease

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

GitHubRelease is a release implementation which provides version information with GitHub Release.

func (*GitHubRelease) ListReleases added in v0.5.0

func (r *GitHubRelease) ListReleases(ctx context.Context) ([]string, error)

ListReleases returns a list of unsorted all releases including pre-release.

type GitLabAPI added in v0.3.2

type GitLabAPI interface {
	// ProjectListReleases gets a page of releases accessible by the authenticated user.
	ProjectListReleases(ctx context.Context, owner, project string, opt *gitlab.ListReleasesOptions) ([]*gitlab.Release, *gitlab.Response, error)
}

GitLabAPI is an interface which calls GitLab API. This abstraction layer is needed for testing with mock.

type GitLabClient added in v0.3.2

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

GitLabClient is a real GitLabAPI implementation.

func NewGitLabClient added in v0.3.2

func NewGitLabClient(config GitLabConfig) (*GitLabClient, error)

NewGitLabClient returns a real GitLab instance.

func (*GitLabClient) ProjectListReleases added in v0.3.5

func (c *GitLabClient) ProjectListReleases(ctx context.Context, owner, project string, opt *gitlab.ListReleasesOptions) ([]*gitlab.Release, *gitlab.Response, error)

ProjectListReleases gets a page of releases accessible by the authenticated user.

type GitLabConfig added in v0.3.2

type GitLabConfig struct {

	// BaseURL is a URL for GitLab API requests.
	// Defaults to the public GitLab API.
	// BaseURL should always be specified with a trailing slash.
	BaseURL string

	// Token is a personal access token for GitLab, needed to use the API.
	Token string
	// contains filtered or unexported fields
}

GitLabConfig is a set of configurations for GitLabRelease.

type GitLabRelease added in v0.3.2

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

GitLabRelease is a release implementation which provides version information with GitLab Release.

func NewGitLabRelease added in v0.3.2

func NewGitLabRelease(source string, config GitLabConfig) (*GitLabRelease, error)

NewGitLabRelease is a factory method which returns a GitLabRelease instance.

func (*GitLabRelease) ListReleases added in v0.5.0

func (r *GitLabRelease) ListReleases(ctx context.Context) ([]string, error)

ListReleases returns a list of unsorted all releases including pre-release.

type Release

type Release interface {
	// ListReleases returns a list of unsorted all releases including pre-release.
	ListReleases(ctx context.Context) ([]string, error)
}

Release is an interface which provides version information of a module or provider.

func NewGitHubRelease

func NewGitHubRelease(source string, config GitHubConfig) (Release, error)

NewGitHubRelease is a factory method which returns a GitHubRelease instance.

func NewTFRegistryModuleRelease added in v0.3.4

func NewTFRegistryModuleRelease(source string, config tfregistry.Config) (Release, error)

NewTFRegistryModuleRelease is a factory method which returns a TFRegistryModuleRelease instance.

func NewTFRegistryProviderRelease added in v0.4.2

func NewTFRegistryProviderRelease(source string, config tfregistry.Config) (Release, error)

NewTFRegistryProviderRelease is a factory method which returns a TFRegistryProviderRelease instance.

type TFRegistryModuleRelease added in v0.3.4

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

TFRegistryModuleRelease is a release implementation which provides version information with TFRegistryModule Release.

func (*TFRegistryModuleRelease) ListReleases added in v0.5.0

func (r *TFRegistryModuleRelease) ListReleases(ctx context.Context) ([]string, error)

ListReleases returns a list of unsorted all releases including pre-release.

type TFRegistryProviderRelease added in v0.4.2

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

TFRegistryProviderRelease is a release implementation which provides version information with TFRegistryProvider Release.

func (*TFRegistryProviderRelease) ListReleases added in v0.5.0

func (r *TFRegistryProviderRelease) ListReleases(ctx context.Context) ([]string, error)

ListReleases returns a list of unsorted all releases including pre-release.

Jump to

Keyboard shortcuts

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