util

package
v0.0.0-...-71653c3 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubOwner = "devbot-testing"
)

Variables

View Source
var (
	DevbotNamespace                    = "devbot"
	DevbotControllerServiceAccountName = "devbot-controller"
)

Functions

func CloneGitHubRepository

func CloneGitHubRepository(ctx context.Context, ghRepo *github.Repository) *git.Repository

func CreateFileInGitHubRepositoryBranch

func CreateFileInGitHubRepositoryBranch(ctx context.Context, ghc *github.Client, ghRepo *github.Repository, branch string) string

func CreateGitHubRepository

func CreateGitHubRepository(ctx context.Context, ghc *github.Client, fs embed.FS, embeddedPath string) *github.Repository

func CreateGitHubRepositoryBranch

func CreateGitHubRepositoryBranch(ctx context.Context, ghc *github.Client, ghRepo *github.Repository, branch string)

func CreateGitHubWebhookTunnel

func CreateGitHubWebhookTunnel() string

func CreateK8sApplication

func CreateK8sApplication(ctx context.Context, c client.Client, ns string, spec apiv1.ApplicationSpec) string

func CreateK8sGitOpsServiceAccount

func CreateK8sGitOpsServiceAccount(ctx context.Context, c client.Client, ns string) string

func CreateK8sNamespace

func CreateK8sNamespace(ctx context.Context, c client.Client) string

func CreateK8sRepository

func CreateK8sRepository(ctx context.Context, c client.Client, ns string, spec apiv1.RepositorySpec) string

func CreateK8sSecretWithGitHubAuthToken

func CreateK8sSecretWithGitHubAuthToken(ctx context.Context, c client.Client, ns, token string) (string, string)

func DeleteGitHubRepositoryBranch

func DeleteGitHubRepositoryBranch(ctx context.Context, ghc *github.Client, ghRepo *github.Repository, branch string)

func GetGitHubRepositoryBranchNamesAndSHA

func GetGitHubRepositoryBranchNamesAndSHA(ctx context.Context, ghc *github.Client, ghRepo *github.Repository) map[string]string

func GetGitHubRepositoryBranchSHA

func GetGitHubRepositoryBranchSHA(ctx context.Context, ghc *github.Client, ghRepo *github.Repository, branch string) string

func GetGitHubToken

func GetGitHubToken() string

func GitHubRepositoryBranchExists

func GitHubRepositoryBranchExists(ctx context.Context, ghc *github.Client, ghRepo *github.Repository, branch string) bool

func GrantK8sAccessToAllSecrets

func GrantK8sAccessToAllSecrets(ctx context.Context, c client.Client, ns string)

func GrantK8sAccessToSecret

func GrantK8sAccessToSecret(ctx context.Context, c client.Client, ns, secretName string)

func NewGitHubClient

func NewGitHubClient(ctx context.Context) *github.Client

func NewK8sClient

func NewK8sClient() (client.Client, *rest.Config)

func PatchK8sObject

func PatchK8sObject(ctx context.Context, c client.Client, obj client.Object, patches ...JSONPatchItem)

func PrintK8sDebugInfo

func PrintK8sDebugInfo(ctx SpecContext, c client.Client, cfg *rest.Config, nsName string)

func TraverseEmbeddedPath

func TraverseEmbeddedPath(fs embed.FS, path string, handler func(path string, data []byte) error) error

Types

type JSONPatchItem

type JSONPatchItem struct {
	Op    JSONPatchOperation `json:"op"`
	Path  string             `json:"path"`
	Value any                `json:"value"`
}

type JSONPatchOperation

type JSONPatchOperation string
const (
	JSONPatchOperationAdd     JSONPatchOperation = "add"
	JSONPatchOperationRemove  JSONPatchOperation = "remove"
	JSONPatchOperationReplace JSONPatchOperation = "replace"
	JSONPatchOperationCopy    JSONPatchOperation = "copy"
	JSONPatchOperationMove    JSONPatchOperation = "move"
	JSONPatchOperationTest    JSONPatchOperation = "test"
)

Jump to

Keyboard shortcuts

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