Skip to content
Permalink
Browse files
feat(telemetry): add attributes related to the usage inside CI-systems
Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Aug 4, 2022
1 parent 7d19f54 commit ec02e3379a1350eaa51d7326a27e0ea3d4eaa58c
Showing 1 changed file with 31 additions and 0 deletions.
@@ -14,6 +14,7 @@ import (
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/trace"

"github.com/werf/werf/pkg/util"
"github.com/werf/werf/pkg/werf"
)

@@ -133,6 +134,36 @@ func (t *TelemetryWerfIO) getAttributes() map[string]interface{} {
attributes["groupChannel"] = val
}

{
if isCI := util.GetBoolEnvironmentDefaultFalse("CI"); isCI {
attributes["CI"] = true
}
if isGitlabCI := util.GetBoolEnvironmentDefaultFalse("GITLAB_CI"); isGitlabCI {
attributes["ciName"] = "gitlab"
}
if val := os.Getenv("JENKINS_URL"); val != "" {
attributes["ciName"] = "jenkins"
}
if isTravis := util.GetBoolEnvironmentDefaultFalse("TRAVIS"); isTravis {
attributes["ciName"] = "travis"
}
if isGithubActions := util.GetBoolEnvironmentDefaultFalse("GITHUB_ACTIONS"); isGithubActions {
attributes["ciName"] = "github-actions"
}
if isCircleCI := util.GetBoolEnvironmentDefaultFalse("CIRCLECI"); isCircleCI {
attributes["ciName"] = "circleci"
}
if val := os.Getenv("TEAMCITY_VERSION"); val != "" {
attributes["ciName"] = "teamcity"
}
if isBuddy := util.GetBoolEnvironmentDefaultFalse("BUDDY"); isBuddy {
attributes["ciName"] = "buddy"
}
if val := os.Getenv("GO_SERVER_URL"); val != "" {
attributes["ciName"] = "gocd"
}
}

return attributes
}

0 comments on commit ec02e33

Please sign in to comment.