helper

package
v0.0.0-...-4634687 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(ns string)

func DeleteNamespace

func DeleteNamespace(ns string, wait bool)

func DoesBackstageRouteExist

func DoesBackstageRouteExist(ns string, crName string) (bool, error)

func GetBackstageRouteHost

func GetBackstageRouteHost(ns string, crName string) (string, error)

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 GetPlatformTool

func GetPlatformTool() string

func GetProjectDir

func GetProjectDir() (string, error)

GetProjectDir will return the directory where the project is

func GuestAuth

func GuestAuth(baseUrl string) (string, error)

GuestAuth logs in with the guest user in Backstage and returns the auth token. It requires guest login to be enabled in the loaded app-config. See https://backstage.io/docs/auth/guest/provider/ for more details.

func IsOpenShift

func IsOpenShift() bool

func LoadImageToK3dClusterWithName

func LoadImageToK3dClusterWithName(name string) error

LoadImageToK3dClusterWithName loads a local container image to the k3d cluster

func LoadImageToKindClusterWithName

func LoadImageToKindClusterWithName(name string) error

LoadImageToKindClusterWithName loads a local container image to the kind cluster

func LoadImageToMinikubeClusterWithName

func LoadImageToMinikubeClusterWithName(name string) error

LoadImageToMinikubeClusterWithName loads a local container image to the Minikube cluster

func PatchBackstageCR

func PatchBackstageCR(ns string, crName string, jsonPatch string, patchType string) error

func RandString

func RandString(n int) string

func Run

func Run(cmd *exec.Cmd) ([]byte, error)

Run executes the provided command within this context

func VerifyBackstageCRStatus

func VerifyBackstageCRStatus(g Gomega, ns string, crName string, expectedStatus string)

func VerifyBackstagePodStatus

func VerifyBackstagePodStatus(g Gomega, ns string, crName string, expectedStatus string)

func VerifyBackstageRoute

func VerifyBackstageRoute(g Gomega, ns string, crName string, tests []ApiEndpointTest)

Types

type ApiEndpointTest

type ApiEndpointTest struct {
	BearerTokenRetrievalFn func(baseUrl string) (string, error)
	Endpoint               string
	ExpectedHttpStatusCode int
	BodyMatcher            types.GomegaMatcher
}

type BackstageAuthRefreshResponse

type BackstageAuthRefreshResponse struct {
	BackstageIdentity BackstageIdentity `json:"backstageIdentity,omitempty"`
}

BackstageAuthRefreshResponse is the struct of the response returned by the '/api/auth/:user/refresh' API endpoint.

Example:

{
   "backstageIdentity": {
       "expiresInSeconds": 3600,
       "identity": {
           "ownershipEntityRefs": [
               "user:development/guest"
           ],
           "type": "user",
           "userEntityRef": "user:development/guest"
       },
       "token": "eyJ0..."
   },
   "profile": {}
}

type BackstageIdentity

type BackstageIdentity struct {
	Token string `json:"token,omitempty"`
}

Jump to

Keyboard shortcuts

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