Skip to content

Commit

Permalink
[local-preview] honour DO_NOT_TRACK env variable
Browse files Browse the repository at this point in the history
Currently, There is no way to disable telemetry for `local-preview`
as we run the cronjob manaully during init, when Gitpod is ready.

This fixes that by honouring [`DO_NOT_TRACK` envrionment variable](https://consoledonottrack.com/)
, which when set prevent the script from triggering the cronjob manually.

Signed-off-by: Tarun Pothulapati <tarun@gitpod.io>
  • Loading branch information
Pothulapati committed Jul 20, 2022
1 parent ef13986 commit 2b90927
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions install/preview/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,15 @@ run_telemetry(){
sleep 100
# indefinitely wait for Gitpod pods to be ready
kubectl wait --timeout=-1s --for=condition=ready pod -l app=gitpod,component!=migrations
# manually tun the cronjob
kubectl create job gitpod-telemetry-init --from=cronjob/gitpod-telemetry
echo "Gitpod pods are ready"
# honour DO_NOT_TRACK if set
if [ ! "${DO_NOT_TRACK:-0}" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then
# suspend the cronjob
kubectl patch cronjobs gitpod-telemetry -p '{"spec" : {"suspend" : true }}'
else
# manually run the cronjob
kubectl create job gitpod-telemetry-init --from=cronjob/gitpod-telemetry
fi
}

run_telemetry 2>&1 &
Expand Down
2 changes: 1 addition & 1 deletion install/preview/prettylog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var msgs = []struct {
{Msg: "preparing system", Success: "extracting images to download ahead"},
{Msg: "downloading images", Success: "--output-split-files"},
{Msg: "preparing Gitpod preview installation", Success: "rm -rf /var/lib/rancher/k3s/server/manifests/gitpod"},
{Msg: "starting Gitpod", Success: "gitpod-telemetry-init"},
{Msg: "starting Gitpod", Success: "Gitpod pods are ready"},
{Msg: fmt.Sprintf("Gitpod is running. Visit https://%s to access the dashboard", os.Getenv("DOMAIN"))},
}

Expand Down

0 comments on commit 2b90927

Please sign in to comment.