cli

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Make

func Make() (*cobra.Command, error)

func ValidateParams

func ValidateParams(params []string) func(cmd *cobra.Command, args []string) error

Types

type DiscoveryConfig added in v0.9.0

type DiscoveryConfig struct {
	FileRegEx                *regexp.Regexp   `mapstructure:"-"`
	SplitTestsOn             string           `mapstructure:"splitteston"`
	ReappendSplitCharacter   bool             `mapstructure:"reappend-split-character"`
	AccTestFileSuffixRegexes []*regexp.Regexp `mapstructure:"-"`
	Concurrency              int              `mapstructure:"concurrency"`
	CollapseFilesAfter       int              `mapstructure:"collapse-files-after"`
}

func (DiscoveryConfig) AccTestFileSuffixRegexStrings added in v0.9.1

func (cfg DiscoveryConfig) AccTestFileSuffixRegexStrings() string

type Filter added in v0.6.0

type Filter struct {
	Name string
	PR   func(github.PullRequest) (bool, error) // todo shjould this return an error?
}

func GetFilterForAuthors added in v0.6.0

func GetFilterForAuthors(authors []string) *Filter

func GetFilterForCreatedTime added in v0.6.0

func GetFilterForCreatedTime(duration time.Duration) *Filter

func GetFilterForDrafts added in v0.9.0

func GetFilterForDrafts(filterDrafts bool) *Filter

func GetFilterForLabels added in v0.6.0

func GetFilterForLabels(labels []string, and bool) *Filter

func GetFilterForLabelsAnd added in v0.6.0

func GetFilterForLabelsAnd(labels []string) *Filter

func GetFilterForLabelsOr added in v0.6.0

func GetFilterForLabelsOr(labels []string) *Filter

func GetFilterForMilestone added in v0.6.0

func GetFilterForMilestone(milestoneRaw string) *Filter

func GetFilterForTitleRegex added in v0.6.0

func GetFilterForTitleRegex(pattern string) (*Filter, error)

func GetFilterForUpdatedTime added in v0.6.0

func GetFilterForUpdatedTime(duration time.Duration) *Filter

type FlagData

type FlagData struct {
	GH              FlagsGitHub     `mapstructure:",squash"`
	TC              FlagsTeamCity   `mapstructure:",squash"`
	DiscoveryConfig DiscoveryConfig `mapstructure:",squash"`
	OpenInBrowser   bool            `mapstructure:"open"`
	RunAllTests     bool            `mapstructure:"all"`
	Services        []string        `mapstructure:"service"`
}

func GetFlags added in v0.6.0

func GetFlags() FlagData

GetFlags returns the fully populated FlagData. We must unmarshal from Viper instead of using globally bound pflags variables because pflags only parses command-line arguments. Viper merges environment variables (and config files) on top of the CLI flags. By unmarshaling from Viper, we ensure that environment variable overrides (e.g. TCTEST_GH_TOKEN) are properly applied.

func (FlagData) BuildCmd added in v0.6.0

func (f FlagData) BuildCmd(buildTypeID, branch, testRegex, service string) (int, string, error)

func (FlagData) BuildResultsCmd added in v0.6.0

func (f FlagData) BuildResultsCmd(buildID int) error

func (FlagData) BuildResultsForPRCmd added in v0.6.0

func (f FlagData) BuildResultsForPRCmd(pr int) error

func (FlagData) GetAndRunPrsTests added in v0.6.0

func (f FlagData) GetAndRunPrsTests(prs map[int]string, testRegExParam string) error

func (FlagData) GetFilters added in v0.6.0

func (f FlagData) GetFilters() ([]Filter, error)

func (FlagData) GetPrTests added in v0.6.0

func (f FlagData) GetPrTests(number int, title string) (*map[string][]string, error)

func (FlagData) NewRepo added in v0.6.0

func (f FlagData) NewRepo() GithubRepo

func (FlagData) NewTCServer added in v0.9.1

func (f FlagData) NewTCServer() tc.Server

type FlagsGitHub added in v0.6.0

type FlagsGitHub struct {
	Token     string              `mapstructure:"token-gh"`
	Repo      string              `mapstructure:"repo"`
	FilterPRs FlagsGitHubPrFilter `mapstructure:",squash"`
}

type FlagsGitHubPrFilter added in v0.6.0

type FlagsGitHubPrFilter struct {
	Authors      []string      `mapstructure:"f-authors"`
	LabelsOr     []string      `mapstructure:"f-labels-any"`
	LabelsAnd    []string      `mapstructure:"f-labels-all"`
	Milestone    string        `mapstructure:"f-milestone"`
	TitleRegex   string        `mapstructure:"f-title-regex"`
	Drafts       bool          `mapstructure:"f-drafts"`
	CreationTime time.Duration `mapstructure:"f-created-time"`
	UpdatedTime  time.Duration `mapstructure:"f-updated-time"`
}

type FlagsTeamCity added in v0.6.0

type FlagsTeamCity struct {
	Build     FlagsTeamCityBuild `mapstructure:",squash"`
	ServerURL string             `mapstructure:"server"`
	Token     string             `mapstructure:"token-tc"`
	User      string             `mapstructure:"username"`
	Pass      string             `mapstructure:"password"`
}

type FlagsTeamCityBuild added in v0.6.0

type FlagsTeamCityBuild struct {
	TypeID           string   `mapstructure:"build-type-id"`
	LegacyTypeID     string   `mapstructure:"buildtypeid"`
	Parameters       string   `mapstructure:"properties"`
	SkipQueue        bool     `mapstructure:"skip-queue"`
	Wait             bool     `mapstructure:"wait"`
	Latest           bool     `mapstructure:"latest"`
	Comment          bool     `mapstructure:"comment"`
	ForceOldUI       bool     `mapstructure:"build-link-force-old-ui"`
	AddServiceSuffix bool     `mapstructure:"build-type-id-add-service-suffix"`
	QueueTimeout     int      `mapstructure:"queue-timeout"`
	RunTimeout       int      `mapstructure:"run-timeout"`
	MaxBuildsPerPR   int      `mapstructure:"max-builds-per-pr"`
	Tags             []string `mapstructure:"tag"`
}

type GithubRepo

type GithubRepo struct {
	gh.Repo
}

wrap the common gh lib shared with my other tools. splits common GH code from this CLI tool's specific tooling code

func (GithubRepo) GetAllPullRequestFiles added in v0.6.0

func (gr GithubRepo) GetAllPullRequestFiles(pri int, cfg DiscoveryConfig) (*map[string]struct{}, error)

func (GithubRepo) ListServices added in v0.7.0

func (ghr GithubRepo) ListServices() ([]string, error)

ListServices lists all service directory names under internal/services/ in the repo

func (GithubRepo) PrTests

func (gr GithubRepo) PrTests(pri int, cfg DiscoveryConfig) (*map[string][]string, error)

todo break this apart - get/check PR state, get files, filter/process files, get tests, get services.

Jump to

Keyboard shortcuts

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