utils

package
v0.0.0-...-5e11853 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TerraformTempDir  = ".terraform"
	TerraformLockFile = ".terraform.lock.hcl"
)

Variables

This section is empty.

Functions

func CopyDirectory

func CopyDirectory(src string, dest string) error

CopyDirectory copies a directory and the files and directories under it.

func CopyFile

func CopyFile(src string, dest string) error

CopyFile copies a single file from the src path to the dest path

func FileExists

func FileExists(filename string) (bool, error)

FileExists check if a give file exists

func FindFiles

func FindFiles(dir, filename string) ([]string, error)

FindFiles find files with the given filename under the directory skipping terraform temp dir.

func GetLogger

func GetLogger(quiet bool) *logger.Logger

func ReadTfvars

func ReadTfvars(filename string, val interface{}) error

ReadTfvars reads a valid terraform tfvars file into the provided struct.

func ReplaceStringInFile

func ReplaceStringInFile(filename, old, new string) error

ReplaceStringInFile replaces a string in a file with a new value.

func WriteTfvars

func WriteTfvars(filename string, val interface{}) error

WriteTfvars writes a valid terraform tfvars file from the provided struct.

Types

type CustomLogger

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

func NewCustomLogger

func NewCustomLogger() CustomLogger

func (CustomLogger) Logf

func (c CustomLogger) Logf(t grunttest.TestingT, format string, args ...interface{})

type GitRepo

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

func CloneCSR

func CloneCSR(t testing.TB, name, path, project string, logger *logger.Logger) GitRepo

CloneCSR clones a Google Cloud Source repository and returns a CmdConfig pointing to the repository.

func (GitRepo) AddRemote

func (g GitRepo) AddRemote(name, url string) error

AddRemote adds a remote to the repository

func (GitRepo) CheckoutBranch

func (g GitRepo) CheckoutBranch(branch string) error

CheckoutBranch checkouts a branch. If the branch does not exist it will be created.

func (GitRepo) CommitFiles

func (g GitRepo) CommitFiles(msg string) error

CommitFiles commit files it there are pending changes.

func (GitRepo) GetCommitSha

func (g GitRepo) GetCommitSha() (string, error)

GetCommitSha gets the commit SHA of the last commit of the current branch

func (GitRepo) GetCurrentBranch

func (g GitRepo) GetCurrentBranch() (string, error)

GetCurrentBranch gets the current branch in the repository.

func (GitRepo) HasUpstream

func (g GitRepo) HasUpstream(branch, remote string) (bool, error)

HasUpstream check it a branch has an upstream branch configured.

func (GitRepo) PushBranch

func (g GitRepo) PushBranch(branch, remote string) error

PushBranch pushes a branch to 'remote' repository .

Jump to

Keyboard shortcuts

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