in internal/platform/qdenv/qdenv.go [141:182]
func ExtractQodanaEnvironment(setEnvironmentFunc func(string, string)) {
if license := os.Getenv(QodanaLicense); license != "" {
setEnvironmentFunc(QodanaLicense, license)
}
if endpoint := GetQodanaGlobalEnv(QodanaEndpointEnv); endpoint != "" {
setEnvironmentFunc(QodanaEndpointEnv, endpoint)
}
if remoteUrl := os.Getenv(QodanaRemoteUrl); remoteUrl != "" {
setEnvironmentFunc(QodanaRemoteUrl, remoteUrl)
}
if branch := os.Getenv(QodanaBranch); branch != "" {
setEnvironmentFunc(QodanaBranch, branch)
}
if revision := os.Getenv(QodanaRevision); revision != "" {
setEnvironmentFunc(QodanaRevision, revision)
}
ci := cienvironment.DetectCIEnvironment()
qEnv := "cli"
if ci != nil {
qEnv = GetCIName(ci)
setEnvironmentFunc(QodanaJobUrl, validateJobUrl(ci.URL, qEnv))
if ci.Git != nil {
setEnvironmentFunc(QodanaRemoteUrl, validateRemoteUrl(ci.Git.Remote, qEnv))
setEnvironmentFunc(QodanaBranch, validateBranch(ci.Git.Branch, qEnv))
setEnvironmentFunc(QodanaRevision, ci.Git.Revision)
}
setEnvironmentFunc(QodanaNugetUrl, os.Getenv(QodanaNugetUrl))
setEnvironmentFunc(QodanaNugetUser, os.Getenv(QodanaNugetUser))
setEnvironmentFunc(QodanaNugetPassword, os.Getenv(QodanaNugetPassword))
setEnvironmentFunc(QodanaNugetName, os.Getenv(QodanaNugetName))
} else if space := os.Getenv("JB_SPACE_API_URL"); space != "" {
qEnv = "space"
setEnvironmentFunc(QodanaJobUrl, os.Getenv("JB_SPACE_EXECUTION_URL"))
setEnvironmentFunc(QodanaRemoteUrl, getSpaceRemoteUrl())
setEnvironmentFunc(QodanaBranch, os.Getenv("JB_SPACE_GIT_BRANCH"))
setEnvironmentFunc(QodanaRevision, os.Getenv("JB_SPACE_GIT_REVISION"))
} else if IsBitBucket() {
qEnv = "bitbucket"
setEnvironmentFunc(QodanaJobUrl, GetBitBucketJobUrl())
}
setEnvironmentFunc(QodanaEnv, fmt.Sprintf("%s:%s", qEnv, version.Version))
}