Service environment (#23443)
* fix fileutils.TestFindFile on MacOS * introduce model.ExternalServiceEnvironment * pick license public key from external service env * pick Stripe public key from external service env * pick Rudder key from external service env * configure Sentry DSN from external service env * always log external_service_environment, Unsetenv * clear faked BuildEnv, improve logging * strip out unset GOTAGS * fix Sentry tests * simplify to just ServiceEnvironment * relocate ServiceEnvironment in client config * initialize CWS URLs based on service environment * unset rudder key for boards dev * harden service environment to avoid accidental production * fix TestSentry again * fix DEFAULT -> ENTERPRISE * s/dev/test when naming playbooks rudder key * simplify boards rudder key switch * use uniform rudderKey variable names * retain compatibility with existing pipeline * reduce to just production/test * unit test with valid test license * simplify Playbooks telemetry initialization * restore dev service environment * emit ServiceEnvironment when running e2e tests
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6c82605df0
Коммит
305fac6507
@@ -31,8 +31,15 @@ const (
|
||||
DBAccessAttempts = 3
|
||||
DBAccessTimeoutSecs = 10
|
||||
|
||||
RudderKey = "placeholder_rudder_key"
|
||||
RudderDataplaneURL = "placeholder_rudder_dataplane_url"
|
||||
rudderDataplaneURL = "https://pdat.matterlytics.com"
|
||||
rudderKeyProd = "1aoejPqhgONMI720CsBSRWzzRQ9"
|
||||
rudderKeyTest = "1aoeoCDeh7OCHcbW2kseWlwUFyq"
|
||||
|
||||
// These are placeholders to allow the existing release pipelines to run without failing to
|
||||
// insert the values that are now hard-coded above. Remove this once we converge on the
|
||||
// unified delivery pipeline in GitHub.
|
||||
_ = "placeholder_rudder_dataplane_url"
|
||||
_ = "placeholder_rudder_key"
|
||||
|
||||
EnvVarInstallType = "MM_INSTALL_TYPE"
|
||||
|
||||
@@ -156,13 +163,21 @@ func (ts *TelemetryService) ensureTelemetryID() error {
|
||||
}
|
||||
|
||||
func (ts *TelemetryService) getRudderConfig() RudderConfig {
|
||||
if !strings.Contains(RudderKey, "placeholder") && !strings.Contains(RudderDataplaneURL, "placeholder") {
|
||||
return RudderConfig{RudderKey, RudderDataplaneURL}
|
||||
} else if os.Getenv("RudderKey") != "" && os.Getenv("RudderDataplaneURL") != "" {
|
||||
// Support unit testing
|
||||
if os.Getenv("RudderKey") != "" && os.Getenv("RudderDataplaneURL") != "" {
|
||||
return RudderConfig{os.Getenv("RudderKey"), os.Getenv("RudderDataplaneURL")}
|
||||
} else {
|
||||
return RudderConfig{}
|
||||
}
|
||||
|
||||
rudderKey := ""
|
||||
switch model.GetServiceEnvironment() {
|
||||
case model.ServiceEnvironmentProduction:
|
||||
rudderKey = rudderKeyProd
|
||||
case model.ServiceEnvironmentTest:
|
||||
rudderKey = rudderKeyTest
|
||||
case model.ServiceEnvironmentDev:
|
||||
}
|
||||
|
||||
return RudderConfig{rudderKey, rudderDataplaneURL}
|
||||
}
|
||||
|
||||
func (ts *TelemetryService) telemetryEnabled() bool {
|
||||
@@ -1333,7 +1348,7 @@ func (ts *TelemetryService) initRudder(endpoint string, rudderKey string) {
|
||||
config.Endpoint = endpoint
|
||||
config.Verbose = ts.verbose
|
||||
// For testing
|
||||
if endpoint != RudderDataplaneURL {
|
||||
if endpoint != rudderDataplaneURL {
|
||||
config.BatchSize = 1
|
||||
}
|
||||
client, err := rudder.NewWithConfig(rudderKey, endpoint, config)
|
||||
|
||||
Ссылка в новой задаче
Block a user