utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitAndPush added in v0.2.0

func CommitAndPush(repoDir string, msg string, file string, otherFiles ...string) error

CommitAndPush commits and pushes specified files with a custom message Requires at least one file to be specified

func DeferCleanupOnSuccess added in v0.2.0

func DeferCleanupOnSuccess(args ...any)

func GetNonEmptyLines

func GetNonEmptyLines(output string) []string

GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.

func GetProjectDir

func GetProjectDir() (string, error)

GetProjectDir will return the directory where the project is

func GetTestNamespace added in v0.2.0

func GetTestNamespace() (string, error)

func InitializeRepoWithFunction added in v0.2.0

func InitializeRepoWithFunction(repoURL, username, password, language string, optFns ...RepoOption) (string, error)

InitializeRepoWithFunction creates a function project and pushes it to the Gitea repo

func IsRegistryInsecure added in v0.2.0

func IsRegistryInsecure() bool

IsRegistryInsecure returns if the registry for the e2e tests is insecure (no TLS verify)

func OperatorSdkRun added in v0.2.0

func OperatorSdkRun(command string, args ...string) (string, error)

func Registry added in v0.2.0

func Registry() string

Registry returns the registry used for the e2e tests

func Run

func Run(cmd *exec.Cmd) (string, error)

Run executes the provided command within this context

func RunFunc added in v0.2.0

func RunFunc(command string, args ...string) (string, error)

RunFunc executes the func CLI with the current/latest version

func RunFuncDeploy added in v0.2.0

func RunFuncDeploy(functionDir string, optFns ...FuncDeployOption) (string, error)

RunFuncDeploy runs func deploy with retry logic for transient network errors

func RunFuncWithVersion added in v0.2.0

func RunFuncWithVersion(version string, command string, args ...string) (string, error)

RunFuncWithVersion executes the func CLI with a specific version It downloads and caches the version if not already present

Types

type FuncDeployOption added in v0.2.0

type FuncDeployOption func(*FuncDeployOptions)

func WithBuilder added in v0.2.0

func WithBuilder(builder string) FuncDeployOption

func WithDeployCliVersion added in v0.2.0

func WithDeployCliVersion(version string) FuncDeployOption

func WithDeployer added in v0.2.0

func WithDeployer(deployer string) FuncDeployOption

func WithNamespace added in v0.2.0

func WithNamespace(namespace string) FuncDeployOption

type FuncDeployOptions added in v0.2.0

type FuncDeployOptions struct {
	Registry         string
	RegistryInsecure bool
	Namespace        string
	Builder          string
	Deployer         string
	CliVersion       string
}

type GiteaClient added in v0.2.0

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

GiteaClient wraps the Gitea SDK client and provides helper methods

func NewGiteaClient added in v0.2.0

func NewGiteaClient() (*GiteaClient, error)

NewGiteaClient discovers Gitea endpoint from ConfigMap and creates client

func (*GiteaClient) CreateAccessToken added in v0.2.0

func (g *GiteaClient) CreateAccessToken(username, password, tokenName string) (string, error)

CreateAccessToken creates a personal access token for a user

func (*GiteaClient) CreateRandomRepo added in v0.2.0

func (g *GiteaClient) CreateRandomRepo(owner string, private bool) (name, url string, cleanup func(), err error)

CreateRandomRepo creates a repo with a random name

func (*GiteaClient) CreateRandomUser added in v0.2.0

func (g *GiteaClient) CreateRandomUser() (username, password, email string, cleanup func(), err error)

CreateRandomUser creates a user with random credentials

func (*GiteaClient) CreateRepo added in v0.2.0

func (g *GiteaClient) CreateRepo(owner, name string, private bool) (url string, cleanup func(), err error)

CreateRepo creates a new repository and returns its URL

func (*GiteaClient) CreateUser added in v0.2.0

func (g *GiteaClient) CreateUser(username, password, email string) (cleanup func(), err error)

CreateUser creates a new Gitea user

func (*GiteaClient) DeleteRepo added in v0.2.0

func (g *GiteaClient) DeleteRepo(owner, name string) error

DeleteRepo deletes a repository

func (*GiteaClient) DeleteUser added in v0.2.0

func (g *GiteaClient) DeleteUser(username string) error

DeleteUser deletes a Gitea user

type RepoOption added in v0.2.0

type RepoOption func(*RepoOptions)

func WithCliVersion added in v0.2.0

func WithCliVersion(cliVersion string) RepoOption

func WithSubDir added in v0.2.0

func WithSubDir(subDir string) RepoOption

type RepoOptions added in v0.2.0

type RepoOptions struct {
	SubDir     string
	CliVersion string
}

type RepositoryProvider added in v0.2.0

type RepositoryProvider interface {
	// User management
	CreateUser(username, password, email string) (cleanup func(), err error)
	DeleteUser(username string) error
	CreateRandomUser() (username, password, email string, cleanup func(), err error)

	// Repository management
	CreateRepo(owner, name string, private bool) (url string, cleanup func(), err error)
	DeleteRepo(owner, name string) error
	CreateRandomRepo(owner string, private bool) (name, url string, cleanup func(), err error)

	// Authentication
	CreateAccessToken(username, password, tokenName string) (string, error)
}

RepositoryProvider defines the interface for interacting with Git repository hosting providers

Jump to

Keyboard shortcuts

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