diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..00b39fdf --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.secret filter=git-crypt diff=git-crypt +*.key filter=git-crypt diff=git-crypt +*.secret.* filter=git-crypt diff=git-crypt diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 34f5780e..242ee92f 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -130,3 +130,11 @@ test::one(){ disable(){ logger::warning "Test \"$2\" has been disabled." } + +secret(){ + if [ -z "${DAGGER_SECRETS_LOADED+x}" ] || [ "$DAGGER_SECRETS_LOADED" != "1" ]; then + logger::warning "Skip \"$2\": secrets not available" + else + "$@" + fi +} diff --git a/tests/test.secret b/tests/test.secret new file mode 100644 index 00000000..82cd5d6c Binary files /dev/null and b/tests/test.secret differ diff --git a/tests/test.sh b/tests/test.sh index f9843843..e38e2425 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -6,6 +6,11 @@ readonly d=$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd) # shellcheck source=/dev/null . "$d/test-lib.sh" +# shellcheck source=/dev/null +if grep -q "DAGGER_SECRETS" "$d/test.secret"; then + source "$d/test.secret" +fi + # Point this to your dagger binary readonly DAGGER_BINARY="${DAGGER_BINARY:-$d/../cmd/dagger/dagger}" # The default arguments are a no-op, but having "anything" is a little cheat necessary for "${DAGGER_BINARY_ARGS[@]}" to not be empty down there @@ -86,6 +91,14 @@ test::fetchcontainer(){ "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/nonexistent/image-with-valid-digest } +test::pushcontainer(){ + local dagger="$1" + + # Fetch container + secret test::one "FetchContainer: valid containers" --exit=0 \ + "$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/fetch-container/exist +} + test::fetchgit(){ local dagger="$1" @@ -244,22 +257,23 @@ test::dockerbuild() { test::all(){ local dagger="$1" - test::load "$dagger" - test::mount "$dagger" +# test::load "$dagger" +# test::mount "$dagger" - test::copy "$dagger" - test::local "$dagger" - test::compute "$dagger" - test::fetchcontainer "$dagger" - test::fetchgit "$dagger" - test::exec "$dagger" - test::export "$dagger" - test::input "$dagger" - test::subdir "$dagger" - test::dockerbuild "$dagger" +# test::copy "$dagger" +# test::local "$dagger" +# test::compute "$dagger" +# test::fetchcontainer "$dagger" + test::pushcontainer "$dagger" +# test::fetchgit "$dagger" +# test::exec "$dagger" +# test::export "$dagger" +# test::input "$dagger" +# test::subdir "$dagger" +# test::dockerbuild "$dagger" - test::stdlib "$dagger" - test::examples "$dagger" +# test::stdlib "$dagger" +# test::examples "$dagger" } case "${1:-all}" in