Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFileContentToDestination(fileContent string, destination string) error
- func CopyFileContentsToMonacoProject(fileContent string, keptnContext string) error
- func CreateBaseFolderIfNotExist() error
- func CreateTempFolderForKeptnContext(keptnContext string) error
- func DeleteTempFolderForKeptnContext(keptnContext string) error
- func ExecuteMonaco(dtCredentials *DTCredentials, keptnContext string, ...) error
- func ExtractMonacoArchive(keptnContext string) error
- func ExtractZIPArchive(archiveFileName string, outputFolder string) error
- func GenerateMonacoProjectStringFromMonacoConfig(monacoConfigFile *MonacoConfigFile, keptnEvent *BaseKeptnEvent) string
- func GetConfigurationServiceURL() string
- func GetKeptnResource(keptnEvent *BaseKeptnEvent, resourceURI string, logger *keptn.Logger) (string, error)
- func GetKubernetesClient() (*kubernetes.Clientset, error)
- func ParseUnixTimestamp(timestamp string) (time.Time, error)
- func PrepareFiles(keptnEvent *BaseKeptnEvent, shkeptncontext string, logger *keptn.Logger) error
- func ReplaceKeptnPlaceholders(input string, keptnEvent *BaseKeptnEvent) string
- func TimestampToString(time time.Time) string
- func Unzip(src string, dest string) ([]string, error)
- func UploadKeptnResource(contentToUpload []byte, remoteResourceURI string, keptnEvent *BaseKeptnEvent, ...) error
- type BaseKeptnEvent
- type DTCredentials
- type MonacoConfigFile
Constants ¶
const MonacoBaseFolder = "/tmp/monaco/"
const MonacoConfigFilename = "dynatrace/monaco.conf.yaml"
*
- Defines the Dynatrace Configuration File structure and supporting Constants
const MonacoConfigFilenameLOCAL = "dynatrace/_monaco.conf.yaml"
const MonacoExecutable = "./monaco"
Variables ¶
var RunLocal = (os.Getenv("ENV") == "local")
var RunLocalTest = (os.Getenv("ENV") == "localtest")
Functions ¶
func CopyFileContentToDestination ¶
Copy file contents to a destination
func CreateBaseFolderIfNotExist ¶
func CreateBaseFolderIfNotExist() error
Create base folder for all monaco executions
func CreateTempFolderForKeptnContext ¶
Create temp folder for keptn context to store project files
func DeleteTempFolderForKeptnContext ¶
Delete temp folder for cleanup
func ExecuteMonaco ¶
func ExecuteMonaco(dtCredentials *DTCredentials, keptnContext string, data *keptnlib.ConfigurationChangeEventData, projects string, verbose bool, dryrun bool) error
func ExtractMonacoArchive ¶
func ExtractZIPArchive ¶
func GenerateMonacoProjectStringFromMonacoConfig ¶
func GenerateMonacoProjectStringFromMonacoConfig(monacoConfigFile *MonacoConfigFile, keptnEvent *BaseKeptnEvent) string
func GetConfigurationServiceURL ¶
func GetConfigurationServiceURL() string
Request URL of configuration service
func GetKeptnResource ¶
func GetKeptnResource(keptnEvent *BaseKeptnEvent, resourceURI string, logger *keptn.Logger) (string, error)
Downloads a resource from the Keptn Configuration Repo In RunLocal mode it gets it from the local disk In normal mode it first tries to find it on service level, then stage and then project level
func GetKubernetesClient ¶
func GetKubernetesClient() (*kubernetes.Clientset, error)
func ParseUnixTimestamp ¶
ParseUnixTimestamp parses a time stamp into Unix foramt
func PrepareFiles ¶
func PrepareFiles(keptnEvent *BaseKeptnEvent, shkeptncontext string, logger *keptn.Logger) error
func ReplaceKeptnPlaceholders ¶
func ReplaceKeptnPlaceholders(input string, keptnEvent *BaseKeptnEvent) string
replaces $ placeholders with actual values $CONTEXT, $EVENT, $SOURCE $PROJECT, $STAGE, $SERVICE, $DEPLOYMENT $TESTSTRATEGY $LABEL.XXXX -> will replace that with a label called XXXX $ENV.XXXX -> will replace that with an env variable called XXXX $SECRET.YYYY -> will replace that with the k8s secret called YYYY
func TimestampToString ¶
TimestampToString converts time stamp into string
func UploadKeptnResource ¶
func UploadKeptnResource(contentToUpload []byte, remoteResourceURI string, keptnEvent *BaseKeptnEvent, logger *keptn.Logger) error
UploadKeptnResource uploads a file to the Keptn Configuration Service
Types ¶
type BaseKeptnEvent ¶
type DTCredentials ¶
type DTCredentials struct { Tenant string `json:"DT_TENANT" yaml:"DT_TENANT"` ApiToken string `json:"DT_API_TOKEN" yaml:"DT_API_TOKEN"` }
func GetDTCredentials ¶
func GetDTCredentials(dynatraceSecretName string) (*DTCredentials, error)
*
- Pulls the Dynatrace Credentials from the passed secret
type MonacoConfigFile ¶
type MonacoConfigFile struct { SpecVersion string `json:"spec_version" yaml:"spec_version"` DtCreds string `json:"dtCreds,omitempty" yaml:"dtCreds,omitempty"` Projects []string `json:"projects,omitempty" yaml:"projects,omitempty"` }
func GetMonacoConfig ¶
func GetMonacoConfig(keptnEvent *BaseKeptnEvent, logger *keptn.Logger) (*MonacoConfigFile, error)
GetMonacoConfig loads monaco.conf for the current service