From fd2ccc004835fa34b429963da5ed707672f130d1 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Wed, 23 Mar 2022 19:01:09 -0700 Subject: [PATCH] ci: disable telemetry Signed-off-by: Andrea Luzzardi --- Makefile | 2 +- docs/learn/tests/helpers.bash | 4 +++ pkg/universe.dagger.io/bats_helpers.bash | 6 ++-- tests/helpers.bash | 42 ++---------------------- 4 files changed, 10 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index ad5c733d..da181e3b 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ doc-test: dagger-debug # Test docs .PHONY: docs docs: dagger # Generate docs - ./cmd/dagger/dagger doc --output ./docs/reference --format md + DAGGER_TELEMETRY_DISABLE=1 ./cmd/dagger/dagger doc --output ./docs/reference --format md .PHONY: docslint docslint: docs # Generate & lint docs diff --git a/docs/learn/tests/helpers.bash b/docs/learn/tests/helpers.bash index 2d2ba03e..96408a91 100644 --- a/docs/learn/tests/helpers.bash +++ b/docs/learn/tests/helpers.bash @@ -10,6 +10,10 @@ common_setup() { # otherwise infinite recursion when DAGGER_BINARY is not set. export DAGGER="${DAGGER_BINARY:-$(bash -c 'command -v dagger')}" + # Disable telemetry + DAGGER_TELEMETRY_DISABLE="1" + export DAGGER_TELEMETRY_DISABLE + # Set the project to the universe directory (so tests can run from anywhere) UNIVERSE="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" DAGGER_PROJECT="$UNIVERSE" diff --git a/pkg/universe.dagger.io/bats_helpers.bash b/pkg/universe.dagger.io/bats_helpers.bash index c8a2eec2..b8609ebe 100644 --- a/pkg/universe.dagger.io/bats_helpers.bash +++ b/pkg/universe.dagger.io/bats_helpers.bash @@ -7,9 +7,9 @@ common_setup() { # otherwise infinite recursion when DAGGER_BINARY is not set. export DAGGER="${DAGGER_BINARY:-$(bash -c 'command -v dagger')}" - # Force Europa mode - DAGGER_EUROPA="1" - export DAGGER_EUROPA + # Disable telemetry + DAGGER_TELEMETRY_DISABLE="1" + export DAGGER_TELEMETRY_DISABLE # Force plain printing for error reporting DAGGER_LOG_FORMAT="plain" diff --git a/tests/helpers.bash b/tests/helpers.bash index cff73691..b5bcba91 100644 --- a/tests/helpers.bash +++ b/tests/helpers.bash @@ -10,52 +10,14 @@ common_setup() { DAGGER_LOG_FORMAT="plain" export DAGGER_LOG_FORMAT - DAGGER_PROJECT="$BATS_TEST_TMPDIR" - export DAGGER_PROJECT + DAGGER_TELEMETRY_DISABLE="1" + export DAGGER_TELEMETRY_DISABLE SOPS_AGE_KEY_FILE=~/.config/dagger/keys.txt export SOPS_AGE_KEY_FILE } -dagger_new_with_plan() { - local name="$1" - local sourcePlan="$2" - local platform="$3" - - cp -a "$sourcePlan"/* "$DAGGER_PROJECT" - - local opts="" - if [ -n "$platform" ]; - then - opts="--platform $platform" - fi - - # Need word splitting to take in account "-a" and "$platform" - # shellcheck disable=SC2086 - "$DAGGER" new "$name" ${opts} -} - -dagger_new_with_env() { - local sourcePlan="$1" - - "$DAGGER" init --project "$DAGGER_PROJECT" - rsync -av "$sourcePlan"/ "$DAGGER_PROJECT" -} - # dagger helper to execute the right binary dagger() { "${DAGGER}" "$@" } - -skip_unless_secrets_available() { - local inputFile="$1" - sops exec-file "$inputFile" echo > /dev/null 2>&1 || skip "$inputFile cannot be decrypted" -} - -skip_unless_local_kube() { - if [ -f ~/.kube/config ] && grep -q "user: kind-kind" ~/.kube/config &> /dev/null && grep -q "127.0.0.1" ~/.kube/config &> /dev/null; then - echo "Kubernetes available" - else - skip "local kubernetes cluster not available" - fi -}