This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/pkg/universe.dagger.io/bats_helpers.bash
Tom Chauveau 19c0f999f4
Fix export cache issue
Resolve #1551 and #1020.
We are never returning the result of solved operations so Buildkit could not
cache the layer.
This commit implements a simple system to forward operations' result to the
main build to cache it.

Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
2022-03-31 20:36:50 +02:00

33 lines
1016 B
Bash

common_setup() {
load "$(dirname "${BASH_SOURCE[0]}")/node_modules/bats-support/load.bash"
load "$(dirname "${BASH_SOURCE[0]}")/node_modules/bats-assert/load.bash"
# Dagger Binary
# FIXME: `command -v` must be wrapped in a sub-bash,
# 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
# Force plain printing for error reporting
DAGGER_LOG_FORMAT="plain"
export DAGGER_LOG_FORMAT
export DAGGER_LOG_LEVEL="debug"
if [ -n "$GITHUB_ACTIONS" ];
then
export DAGGER_CACHE_TO="type=gha,mode=max,scope=universe-tests-$BATS_TEST_NAME"
export DAGGER_CACHE_FROM="type=gha,scope=universe-tests-$BATS_TEST_NAME"
fi
# cd into the directory containing the bats file
cd "$BATS_TEST_DIRNAME" || exit 1
}
# dagger helper to execute the right binary
dagger() {
"${DAGGER}" "$@"
}