common

package
v0.0.0-...-86bd201 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddChangelogToFile

func AddChangelogToFile(changelog *model.Changelog, version *semver.Version, packageRootPath, releaseDate string) (string, error)

add new changelog md to changelog file

func AddTagSet

func AddTagSet(path, tag string) error

AddTagSet add tag in file

func ChangeConfigWithCommitID

func ChangeConfigWithCommitID(path, repoURL, commitID, specRPName string) error

replace repo URL and commit id in autorest.md file

func ChangeConfigWithLocalPath

func ChangeConfigWithLocalPath(path, readmeFile, readmeGoFile string) error

replace repo commit with local path in autorest.md file

func CleanSDKGeneratedFiles

func CleanSDKGeneratedFiles(path string) error

remove all sdk generated files in given path

func ContainsPreviewAPIVersion

func ContainsPreviewAPIVersion(packagePath string) (bool, error)

func EnumFilter

func EnumFilter(changelog *model.Changelog)

func ExecuteAddIssueComment

func ExecuteAddIssueComment(path, repoOwner, repoName, issueNumber, comment, authToken string) error

func ExecuteAddIssueLabels

func ExecuteAddIssueLabels(path, repoOwner, repoName, issueNumber, authToken string, labels []string) error

func ExecuteCreatePullRequest

func ExecuteCreatePullRequest(path, repoOwner, repoName, prOwner, prBranch, prTitle, prBody, authToken, prLabels string) (string, error)

func ExecuteExampleGenerate

func ExecuteExampleGenerate(path, packagePath, flag string) error

execute `pwsh Invoke-MgmtTestgen` command and fetch result

func ExecuteGitPush

func ExecuteGitPush(path, remoteName, branchName string) (string, error)

func ExecuteGoGenerate

func ExecuteGoGenerate(path string) error

execute `go generate` command and fetch result

func ExecuteGoimports

func ExecuteGoimports(path string) error

execute `goimports` command and fetch result

func FilterChangelog

func FilterChangelog(changelog *model.Changelog, opts ...func(changelog *model.Changelog))

func FuncFilter

func FuncFilter(changelog *model.Changelog)

func GetAllVersionTags

func GetAllVersionTags(rpName, namespaceName string) ([]string, error)

func GetAlwaysSetBodyParamRequiredFlag

func GetAlwaysSetBodyParamRequiredFlag(path string) (string, error)

func GetExportsFromTag

func GetExportsFromTag(sdkRepo repo.SDKRepository, packagePath, tag string) (*exports.Content, error)

func GetPreviousVersionTag

func GetPreviousVersionTag(isCurrentPreview bool, allReleases []string) string

func GetSDKRepo

func GetSDKRepo(sdkRepoParam, sdkRepoURL string) (repo.SDKRepository, error)

func GetSpecCommit

func GetSpecCommit(specRepoParam string) (string, error)

func GetSpecRpName

func GetSpecRpName(packageRootPath string) (string, error)

get swagger rp folder name from autorest.md file

func GetTag

func GetTag(path string) (string, error)

func InterfaceToAnyFilter

func InterfaceToAnyFilter(changelog *model.Changelog)

func LROFilter

func LROFilter(changelog *model.Changelog)

LROFilter LROFilter after OperationFilter

func MarshalUnmarshalFilter

func MarshalUnmarshalFilter(changelog *model.Changelog)

func NonExportedFilter

func NonExportedFilter(changelog *model.Changelog)

func PageableFilter

func PageableFilter(changelog *model.Changelog)

PageableFilter PageableFilter after OperationFilter

func ReadV2ModuleNameToGetNamespace

func ReadV2ModuleNameToGetNamespace(path string) (map[string][]PackageInfo, error)

reads from readme.go.md, parses the `track2` section to get module and package name

func RemoveTagSet

func RemoveTagSet(path string) error

RemoveTagSet delete tag set in config file

func ReplaceNewClientNamePlaceholder

func ReplaceNewClientNamePlaceholder(packageRootPath string, exports exports.Content) error

replace `{{NewClientName}}` placeholder in README.md by first func name according to `^New.+Method$` pattern

func ReplaceReadmeNewClientName

func ReplaceReadmeNewClientName(packageRootPath string, exports exports.Content) error

func ReplaceVersion

func ReplaceVersion(packageRootPath string, newVersion string) error

replace version: use `module-version: ` prefix to locate version in autorest.md file, use version = "v*.*.*" regrex to locate version in constants.go file

func UpdateModuleDefinition

func UpdateModuleDefinition(packageRootPath, rpName, namespaceName string, version *semver.Version) error

func UpdateOnboardChangelogVersion

func UpdateOnboardChangelogVersion(packageRootPath, versionNumber string) error

Types

type GenerateContext

type GenerateContext struct {
	SDKPath           string
	SDKRepo           *repo.SDKRepository
	SpecPath          string
	SpecCommitHash    string
	SpecReadmeFile    string
	SpecReadmeGoFile  string
	SpecRepoURL       string
	UpdateSpecVersion bool
}

func (*GenerateContext) GenerateForAutomation

func (ctx *GenerateContext) GenerateForAutomation(readme, repo, goVersion string) ([]GenerateResult, []error)

func (*GenerateContext) GenerateForSingleRPNamespace

func (ctx *GenerateContext) GenerateForSingleRPNamespace(generateParam *GenerateParam) (*GenerateResult, error)

type GenerateParam

type GenerateParam struct {
	RPName              string
	NamespaceName       string
	NamespaceConfig     string
	SpecficVersion      string
	SpecficPackageTitle string
	SpecRPName          string
	ReleaseDate         string
	SkipGenerateExample bool
	GoVersion           string
	RemoveTagSet        bool
	ForceStableVersion  bool
}

type GenerateResult

type GenerateResult struct {
	Version           string
	RPName            string
	PackageName       string
	PackageAbsPath    string
	Changelog         model.Changelog
	ChangelogMD       string
	PullRequestLabels string
}

type PackageInfo

type PackageInfo struct {
	Name        string
	Config      string
	SpecName    string
	RequestLink string
	Tag         string
	ReleaseDate *time.Time
}

type PullRequestLabel

type PullRequestLabel string
const (
	StableLabel                PullRequestLabel = "Stable"
	BetaLabel                  PullRequestLabel = "Beta"
	FirstGALabel               PullRequestLabel = "FirstGA"
	FirstGABreakingChangeLabel PullRequestLabel = "FirstGA,BreakingChange"
	FirstBetaLabel             PullRequestLabel = "FirstBeta"
	StableBreakingChangeLabel  PullRequestLabel = "Stable,BreakingChange"
	BetaBreakingChangeLabel    PullRequestLabel = "Beta,BreakingChange"
)

func CalculateNewVersion

func CalculateNewVersion(changelog *model.Changelog, previousVersion string, isCurrentPreview bool) (*semver.Version, PullRequestLabel, error)

calculate new version by changelog using semver package

Jump to

Keyboard shortcuts

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