github

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlytectlReleaseConfig = &updater.Updater{
	Provider: &GHProvider{
		RepositoryURL: flytectlRepository,
		ArchiveName:   getFlytectlAssetName(),
		ghRepo:        GetGHRepoService(),
	},
	ExecutableName: flytectl,
	Version:        stdlibversion.Version,
}

FlytectlReleaseConfig represent the updater config for flytectl binary

Functions

func CheckBrewInstall

func CheckBrewInstall(goos platformutil.Platform) (string, error)

CheckBrewInstall returns the path of symlink if flytectl is installed from brew

func GetAssetFromRelease

func GetAssetFromRelease(tag, assetName, repoName string, g GHRepoService) (*github.ReleaseAsset, error)

GetAssetFromRelease returns the asset using assetName from github release with tag

func GetCommitSHA1

func GetCommitSHA1(repoName, version string, g GHRepoService) (string, error)

GetCommitSHA1 returns sha hash against the version

func GetFullyQualifiedImageName

func GetFullyQualifiedImageName(prefix, version, image string, pre bool, g GHRepoService) (string, string, error)

func GetLatestRelease

func GetLatestRelease(repoName string, g GHRepoService) (*github.RepositoryRelease, error)

GetLatestRelease returns the latest non-prerelease version of provided repoName, as described in https://docs.github.com/en/rest/reference/releases#get-the-latest-release

func GetReleaseByTag

func GetReleaseByTag(repoName, tag string, g GHRepoService) (*github.RepositoryRelease, error)

GetReleaseByTag returns the provided tag release if tag exist in repository

func GetSandboxImageSha

func GetSandboxImageSha(tag string, pre bool, g GHRepoService) (string, string, error)

GetSandboxImageSha returns the sha as per input

func GetUpgradeMessage

func GetUpgradeMessage(latest string, goos platformutil.Platform) (string, error)

GetUpgradeMessage return the upgrade message

func ListReleases

func ListReleases(repoName string, g GHRepoService, filterPrefix string) ([]*github.RepositoryRelease, error)

ListReleases returns the list of release of provided repoName

Types

type GHProvider added in v0.9.0

type GHProvider struct {
	RepositoryURL string // Repository URL, example github.com/mouuff/go-rocket-update
	ArchiveName   string // Archive name (the zip/tar.gz you upload for a release on github), example: binaries.zip
	// contains filtered or unexported fields
}

Github provider finds a archive file in the repository's releases to provide files

func (*GHProvider) Close added in v0.9.0

func (c *GHProvider) Close() error

Close closes the provider

func (*GHProvider) GetCleanLatestVersion added in v0.9.0

func (c *GHProvider) GetCleanLatestVersion() (string, error)

GetCleanLatestVersion gets the latest version without the "flytectl/" prefix

func (*GHProvider) GetLatestVersion added in v0.9.0

func (c *GHProvider) GetLatestVersion() (string, error)

GetLatestVersion gets the latest version

func (*GHProvider) Open added in v0.9.0

func (c *GHProvider) Open() (err error)

Open opens the provider

func (*GHProvider) Retrieve added in v0.9.0

func (c *GHProvider) Retrieve(src string, dest string) error

Retrieve file relative to "provider" to destination

func (*GHProvider) Walk added in v0.9.0

func (c *GHProvider) Walk(walkFn provider.WalkFunc) error

Walk walks all the files provided

type GHRepoService

type GHRepoService interface {
	GetLatestRelease(ctx context.Context, owner, repo string) (*github.RepositoryRelease, *github.Response, error)
	ListReleases(ctx context.Context, owner, repo string, opts *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)
	GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*github.RepositoryRelease, *github.Response, error)
	GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *github.Response, error)
}
var Client GHRepoService

func GetGHRepoService

func GetGHRepoService() GHRepoService

GetGHRepoService returns the initialized github repo service client.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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