mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
commit 081987b647 updated the Dockerfile
to disable go's telemetry in our dev / test-environment; as collecting
this data doesn't serve much purpose.
However, the configuration to disable telemetry is tied to the user's
home-directory (HOME); and disabling telemetry writs a config-file to the
user's home-directory (`~/.config/go/telemetry/mode`). While go provides
env-vars about the mode and location (`GOTELEMETRY` and `GOTELEMETRYDIR`),
those env-vars are read-only and cannot be used to either disable telemetry
or to set the location;
> Information about telemetry configuration is also available via read-only Go environment variables:
>
> go env GOTELEMETRY reports the telemetry mode.
> go env GOTELEMETRYDIR reports the directory holding telemetry configuration and data.
Some steps in our CI set up a different home-directory, which is not configured
to disable telemetry, which means that CI currently leaves behind a bunch of
files related to this;
make TEST_FILTER=TestPruneDontDeleteUsedDangling test-integration
tree -a bundles/test-integration/fake-HOME/
bundles/test-integration/fake-HOME/
└── .config
└── go
└── telemetry
├── local
│ ├── asm@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
│ ├── compile@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
│ ├── go@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
│ ├── link@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
│ ├── test2json@go1.25.3-go1.25.3-linux-arm64-2025-10-21.v1.count
│ ├── upload.token
│ └── weekends
└── upload
6 directories, 7 files
This patch disables go telemetry also for this home-directory to prevent
those files from being created, and to prevent go from producing the
telemetry.
With this patch, only the file to disable telemetry is produced:
make TEST_FILTER=TestPruneDontDeleteUsedDangling test-integration
tree -a bundles/test-integration/fake-HOME/
bundles/test-integration/fake-HOME/
└── .config
└── go
└── telemetry
└── mode
4 directories, 1 file
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
72 lines
1.8 KiB
Bash
Executable File
72 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e -u -o pipefail
|
|
|
|
# Set defaults
|
|
: ${TESTFLAGS:=}
|
|
: ${TESTDEBUG:=}
|
|
|
|
integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
|
|
find /tests/integration -type d \
|
|
| grep -vE '(^/tests/integration($|/internal)|/testdata)'
|
|
)"}
|
|
|
|
run_test_integration() {
|
|
run_test_integration_suites
|
|
run_test_integration_legacy_suites
|
|
}
|
|
|
|
run_test_integration_suites() {
|
|
local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
|
|
for dir in $integration_api_dirs; do
|
|
if ! (
|
|
cd $dir
|
|
echo "Running $PWD"
|
|
test_env ./test.main $flags
|
|
); then exit 1; fi
|
|
done
|
|
}
|
|
|
|
run_test_integration_legacy_suites() {
|
|
(
|
|
flags="-test.v -test.timeout=360m $TESTFLAGS"
|
|
cd /tests/integration-cli
|
|
echo "Running $PWD"
|
|
test_env ./test.main $flags
|
|
)
|
|
}
|
|
|
|
# use "env -i" to tightly control the environment variables that bleed into the tests
|
|
test_env() {
|
|
(
|
|
set -e +u
|
|
[ -n "$TESTDEBUG" ] && set -x
|
|
|
|
# Disable collecting local telemetry, as collected by Go and Delve;
|
|
#
|
|
# - https://github.com/go-delve/delve/blob/v1.24.1/CHANGELOG.md#1231-2024-09-23
|
|
# - https://go.dev/doc/telemetry#background
|
|
HOME="$ABS_DEST/fake-HOME" go telemetry off
|
|
|
|
env -i \
|
|
DOCKER_API_VERSION="$DOCKER_API_VERSION" \
|
|
DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \
|
|
DOCKER_TLS_VERIFY="$DOCKER_TEST_TLS_VERIFY" \
|
|
DOCKER_CERT_PATH="$DOCKER_TEST_CERT_PATH" \
|
|
DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \
|
|
DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \
|
|
DOCKER_FIREWALL_BACKEND="$DOCKER_FIREWALL_BACKEND" \
|
|
DOCKER_HOST="$DOCKER_HOST" \
|
|
DOCKER_REMAP_ROOT="$DOCKER_REMAP_ROOT" \
|
|
DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \
|
|
GOPATH="$GOPATH" \
|
|
GOTRACEBACK=all \
|
|
HOME="$ABS_DEST/fake-HOME" \
|
|
PATH="$PATH" \
|
|
TEMP="$TEMP" \
|
|
TEST_CLIENT_BINARY="$TEST_CLIENT_BINARY" \
|
|
"$@"
|
|
)
|
|
}
|
|
|
|
run_test_integration
|