From d83af5133eb9bd44ea07f05e0df1347b72defa89 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:22:38 +0100 Subject: [PATCH] hack: mount docker config on gha Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- hack/test | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hack/test b/hack/test index 616df894..3aa3ec00 100755 --- a/hack/test +++ b/hack/test @@ -2,6 +2,8 @@ set -eu -o pipefail +: "${GITHUB_ACTIONS=}" + : "${BUILDX_CMD=docker buildx}" : "${TEST_COVERAGE=}" @@ -37,7 +39,15 @@ if [ "$TEST_COVERAGE" = "1" ]; then export GO_TEST_COVERPROFILE="/testreports/coverage-report$TEST_REPORT_SUFFIX.txt" fi -cid=$(docker create --rm --privileged \ +dockerConfigMount="" +if [ "$GITHUB_ACTIONS" = "true" ]; then + dockerConfigPath="$HOME/.docker/config.json" + if [ -f "$dockerConfigPath" ]; then + dockerConfigMount="-v $dockerConfigPath:/root/.docker/config.json:ro" + fi +fi + +cid=$(docker create --rm --privileged $dockerConfigMount \ -v /tmp $testReportsVol \ --volumes-from=$cacheVolume \ -e GITHUB_REF \