ci: disable telemetry

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2022-03-23 19:01:09 -07:00
parent e46acc8053
commit fd2ccc0048
4 changed files with 10 additions and 44 deletions

View File

@ -76,7 +76,7 @@ doc-test: dagger-debug # Test docs
.PHONY: docs .PHONY: docs
docs: dagger # Generate 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 .PHONY: docslint
docslint: docs # Generate & lint docs docslint: docs # Generate & lint docs

View File

@ -10,6 +10,10 @@ common_setup() {
# otherwise infinite recursion when DAGGER_BINARY is not set. # otherwise infinite recursion when DAGGER_BINARY is not set.
export DAGGER="${DAGGER_BINARY:-$(bash -c 'command -v dagger')}" 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) # Set the project to the universe directory (so tests can run from anywhere)
UNIVERSE="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" UNIVERSE="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )"
DAGGER_PROJECT="$UNIVERSE" DAGGER_PROJECT="$UNIVERSE"

View File

@ -7,9 +7,9 @@ common_setup() {
# otherwise infinite recursion when DAGGER_BINARY is not set. # otherwise infinite recursion when DAGGER_BINARY is not set.
export DAGGER="${DAGGER_BINARY:-$(bash -c 'command -v dagger')}" export DAGGER="${DAGGER_BINARY:-$(bash -c 'command -v dagger')}"
# Force Europa mode # Disable telemetry
DAGGER_EUROPA="1" DAGGER_TELEMETRY_DISABLE="1"
export DAGGER_EUROPA export DAGGER_TELEMETRY_DISABLE
# Force plain printing for error reporting # Force plain printing for error reporting
DAGGER_LOG_FORMAT="plain" DAGGER_LOG_FORMAT="plain"

View File

@ -10,52 +10,14 @@ common_setup() {
DAGGER_LOG_FORMAT="plain" DAGGER_LOG_FORMAT="plain"
export DAGGER_LOG_FORMAT export DAGGER_LOG_FORMAT
DAGGER_PROJECT="$BATS_TEST_TMPDIR" DAGGER_TELEMETRY_DISABLE="1"
export DAGGER_PROJECT export DAGGER_TELEMETRY_DISABLE
SOPS_AGE_KEY_FILE=~/.config/dagger/keys.txt SOPS_AGE_KEY_FILE=~/.config/dagger/keys.txt
export SOPS_AGE_KEY_FILE 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 helper to execute the right binary
dagger() { dagger() {
"${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
}