repositories

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package repositories provides types and tools to deal with Giant Swarm's repository configuration data maintained in https://github.com/giantswarm/github/tree/master/repositories

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFileNotFoundError added in v0.12.0

func IsFileNotFoundError(err error) bool

IsFileNotFoundError returns true if error is fileNotFoundError.

Types

type Config added in v0.0.4

type Config struct {
	// Name of the GitHub organization owning our repository.
	GithubOrganization string

	// Name of the repository containing our repositories config.
	GithubRepositoryName string

	// Github personal access token (PTA) to use for client authentication.
	GithubAuthToken string

	// Path within the repository containing repository config YAML lists.
	// An empty string indicates the root directory.
	DirectoryPath string
}

type GithubReleaseDetails added in v0.11.0

type GithubReleaseDetails struct {
	// Creation date/time of the latest release.
	LatestReleaseTime time.Time

	// Tag name of the latest release.
	LatestReleaseTag string
}

Cache for info on releases of a repo.

type GithubRepoContentDetails added in v0.0.7

type GithubRepoContentDetails struct {
	// Whether the repository has a CircleCI configuration file.
	HasCircleCI bool

	// Whether the repository has a README.md in the root directory.
	HasReadme bool

	// Whether the repository has a "helm" folder in the root directory.
	HasHelmFolder bool

	NumHelmCharts int

	HelmChartNames []string
}

A struct for caching repository content information.

type GithubRepoDetails added in v0.0.7

type GithubRepoDetails struct {
	// Repository name
	Name string

	// Repository description
	Description string

	// Name of the default branch
	DefaultBranch string

	// Whether the repository is private. If false, it's public.
	IsPrivate bool

	// The main programming language in the repo.
	MainLanguage string
}

A sparse struct for caching just the GitHub repository details we need.

type ListResult

type ListResult struct {
	OwnerTeamName string
	Repositories  []Repo
}

type Repo

type Repo struct {
	Name            string           `yaml:"name"`
	ComponentType   string           `yaml:"componentType"`
	DeploymentNames []string         `yaml:"deploymentNames"`
	System          string           `yaml:"system"`
	Gen             RepoGen          `yaml:"gen"`
	Lifecycle       RepoLifecycle    `yaml:"lifecycle"`
	Replacements    RepoReplacements `yaml:"replace"`
	AppTestSuite    interface{}      `yaml:"app_test_suite"`
}

Repo represents an entry in the giantswarm/github repositories YAML data.

type RepoFlavor

type RepoFlavor string
const (
	RepoFlavorApp     RepoFlavor = "app"
	RepoFlavorCLI     RepoFlavor = "cli"
	RepoFlavorGeneric RepoFlavor = "generic"
)

type RepoGen

type RepoGen struct {
	Flavors                 []RepoFlavor `yaml:"flavours"`
	Language                RepoLanguage `yaml:"language"`
	InstallUpdateChart      bool         `yaml:"installUpdateChart"`
	EnableFloatingMajorTags bool         `yaml:"enableFloatingMajorTags"`
}

type RepoLanguage

type RepoLanguage string
const (
	RepoLanguageGo      RepoLanguage = "go"
	RepoLanguagePython  RepoLanguage = "python"
	RepoLanguageGeneric RepoLanguage = "generic"
)

type RepoLifecycle

type RepoLifecycle string

type RepoReplacements

type RepoReplacements struct {
	ArchitectOrb bool `yaml:"architect-orb"`
	Renovate     bool `yaml:"renovate"`
	PreCommit    bool `yaml:"precommit"`
}

type Sbom added in v0.1.0

type Sbom struct {
	Name     string        `json:"name"`
	Packages []SbomPackage `json:"packages"`
}

type SbomPackage added in v0.1.0

type SbomPackage struct {
	Name string `json:"name"`
}

type SbomPayload added in v0.1.0

type SbomPayload struct {
	Sbom Sbom `json:"sbom"`
}

type Service added in v0.0.4

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

func New added in v0.0.4

func New(c Config) (*Service, error)

New instantiates a new repositories service.

This results in the fetching of basic data on all repositories owned by the organization, issuing one request per 100 repositories. Beware of rate limiting!

func (*Service) GetDependencies added in v0.1.0

func (s *Service) GetDependencies(name string) ([]string, error)

Returns list of dependencies.

func (*Service) GetHasCircleCI added in v0.0.7

func (s *Service) GetHasCircleCI(name string) (bool, error)

Returns whether the repo has a CircleCI configuration.

func (*Service) GetHasReadme added in v0.0.7

func (s *Service) GetHasReadme(name string) (bool, error)

Returns whether the repo has a main README file.

func (*Service) GetHelmChartNames added in v0.12.0

func (s *Service) GetHelmChartNames(name string) ([]string, error)

Returns the name(s) of the repo's Helm chart(s).

func (*Service) GetIsPrivate added in v0.0.6

func (s *Service) GetIsPrivate(name string) (bool, error)

Returns the public/private info for the given repo.

func (*Service) GetLists added in v0.0.4

func (s *Service) GetLists() ([]ListResult, error)

GetLists loads the lists of repository YAML files from GitHub giantswarm/github.

func (*Service) GetNumHelmCharts added in v0.12.0

func (s *Service) GetNumHelmCharts(name string) (int, error)

Returns whether the repo has a Helm chart.

func (*Service) LoadGitHubFile added in v0.12.0

func (s *Service) LoadGitHubFile(name string, path string) (string, error)

Return the content of a source file in a repository as string.

func (*Service) MustGetDefaultBranch added in v0.0.7

func (s *Service) MustGetDefaultBranch(name string) string

Returns the default branch name. Returns an empty string in case of error.

func (*Service) MustGetDescription added in v0.0.7

func (s *Service) MustGetDescription(name string) string

Returns the description for the given repo. If not available, or an error occurs, returns an empty string.

func (*Service) MustGetLanguage added in v0.1.0

func (s *Service) MustGetLanguage(name string) string

Returns the main language for the given repo. If not available, or an error occurs, returns an empty string.

func (*Service) MustGetLatestReleaseTag added in v0.11.0

func (s *Service) MustGetLatestReleaseTag(name string) (string, error)

Returns the tag of the repository's most recent release. If no release was found, returns empty string.

func (*Service) MustGetLatestReleaseTime added in v0.11.0

func (s *Service) MustGetLatestReleaseTime(name string) (time.Time, error)

Returns the creation time of the repository's most recent release. If no release was found, returns zero-value time.

Jump to

Keyboard shortcuts

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