Skip to content

Commit 35e871b

Browse files
committed
[telemetry] Add new GITPOD_INSTALLATION_PLATFORM telemetry variable
Fixes #10766 This PR adds a new `GITPOD_INSTALLATION_PLATFORM` env variable, that is then transmitted by the `gitpod-telemetry` job as the `platform` property into our telemetry store. The value of this env variable is then overrided by each install method. This env can have the following values: - `installer` by default as when the installation is done directly through the installer, We don't have enough information about the environment. - [One of the `distribution` values](https://docs.replicated.com/reference/template-functions-static-context#distribution) when done through `kots`. This would have the distribution in which Gitpod is being installed, and is dependent on `kots`. - `local-preview` when the installation is done through the new preview install method. As the changes show in the PR, each installation method overrides the value. Signed-off-by: Tarun Pothulapati <tarun@gitpod.io>
1 parent b21e31a commit 35e871b

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

components/installation-telemetry/cmd/send.go

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ var sendCmd = &cobra.Command{
5656
Set("totalWorkspaces", data.TotalWorkspaces).
5757
Set("totalInstances", data.TotalInstances)
5858

59+
platform := os.Getenv("GITPOD_INSTALLATION_PLATFORM")
60+
if platform != "" {
61+
properties.Set("platform", platform)
62+
}
63+
5964
if data.InstallationAdmin.Settings.SendCustomerID {
6065
properties.Set("customerID", data.CustomerID)
6166
}

gitpod-ws.code-workspace

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
{ "path": "dev/gpctl" },
2626
{ "path": "dev/loadgen" },
2727
{ "path": "dev/poolkeeper" },
28-
{ "path": "install/installer" }
28+
{ "path": "install/installer" },
29+
{ "path": "install/preview" }
2930
],
3031
"settings": {
3132
"typescript.tsdk": "gitpod/node_modules/typescript/lib",

install/installer/pkg/components/gitpod/cronjob.go

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ func cronjob(ctx *common.RenderContext) ([]runtime.Object, error) {
6363
Name: "GITPOD_INSTALLATION_VERSION",
6464
Value: ctx.VersionManifest.Version,
6565
},
66+
{
67+
Name: "GITPOD_INSTALLATION_PLATFORM",
68+
Value: "installer",
69+
},
6670
{
6771
Name: "SERVER_URL",
6872
Value: fmt.Sprintf("http://%s.%s.svc.cluster.local:%d", common.ServerComponent, ctx.Namespace, common.ServerInstallationAdminPort),

install/kots/manifests/gitpod-installer-job.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ spec:
303303
'del(select(.kind == "StatefulSet" and .metadata.name == "openvsx-proxy").status)' \
304304
"${GITPOD_OBJECTS}/templates/gitpod.yaml"
305305
306+
echo "Gitpod: Update GITPOD_INSTALLATION_PLATFORM telemetry value"
307+
yq eval-all --inplace \
308+
'(select(.kind == "CronJob" and .metadata.name == "gitpod-telemetry") | .spec.jobTemplate.spec.spec.containers[].env[] | (select(.name=="GITPOD_INSTALLATION_PLATFORM") |.value |= sub("installer"; "repl{{ Distribution }}"))'
309+
"${GITPOD_OBJECTS}/templates/gitpod.yaml"
310+
306311
if [ '{{repl ConfigOptionEquals "reg_incluster" "1" }}' = "true" ];
307312
then
308313
echo "Gitpod: Add the local registry secret to the in-cluster registry secret"

install/preview/entrypoint.sh

+3
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ yq eval-all -i ". as \$item ireduce ({}; . *+ \$item)" /var/lib/rancher/k3s/serv
129129
# update Statefulset's to use k3s's `local-path` storage class
130130
for f in /var/lib/rancher/k3s/server/manifests/gitpod/*StatefulSet*.yaml; do yq e -i '.spec.volumeClaimTemplates[0].spec.storageClassName="local-path"' "$f"; done
131131

132+
# set the GITPOD_INSTALLATION_PLATFORM
133+
yq eval-all -i '.spec.jobTemplate.spec.spec.containers[].env[] | (select(.name=="GITPOD_INSTALLATION_PLATFORM") |.value |= sub("installer"; "local-preview"))' /var/lib/rancher/k3s/server/manifests/gitpod/*_CronJob_gitpod-telemetry.yaml
134+
132135
# removing init container from ws-daemon (systemd and Ubuntu)
133136
yq eval-all -i 'del(.spec.template.spec.initContainers[0])' /var/lib/rancher/k3s/server/manifests/gitpod/*_DaemonSet_ws-daemon.yaml
134137

0 commit comments

Comments
 (0)