From dbfd1892219c995669c3de1de9a7911ce18ea458 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 19 Dec 2024 12:00:19 -0500 Subject: [PATCH 1/3] Login to docker hub only if credentials were provided I think this could be the only solution (may be besides also adding retries in addition) to allow testing against dandi-cli to be done also in PRs from forks of the project, where there is no credentials. We could also advise our developers to provide such (own) credentials in their forks. FTR: login originally was added in 6b815dc6aabf33aebf846aa56b67fb952e13bc77 ref: https://github.com/dandi/dandi-archive/issues/2107 --- .github/workflows/cli-integration.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli-integration.yml b/.github/workflows/cli-integration.yml index 2e997058a..5d2a9ff28 100644 --- a/.github/workflows/cli-integration.yml +++ b/.github/workflows/cli-integration.yml @@ -19,7 +19,9 @@ jobs: - name: Build Docker image run: | - docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN" + [ -n "$DOCKER_LOGIN$DOCKER_TOKEN" ] \ + && docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN" \ + || echo "Not login-in to docker since no credentials were provided, might hit limits below" docker build \ -t dandiarchive/dandiarchive-api \ -f dev/django-public.Dockerfile \ From fff4f12deee825bec36d9063f460d240a2cf800e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 19 Dec 2024 12:24:01 -0500 Subject: [PATCH 2/3] Use if/then/else for not masking away fail to docker login --- .github/workflows/cli-integration.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cli-integration.yml b/.github/workflows/cli-integration.yml index 5d2a9ff28..d32bdcf79 100644 --- a/.github/workflows/cli-integration.yml +++ b/.github/workflows/cli-integration.yml @@ -19,9 +19,11 @@ jobs: - name: Build Docker image run: | - [ -n "$DOCKER_LOGIN$DOCKER_TOKEN" ] \ - && docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN" \ - || echo "Not login-in to docker since no credentials were provided, might hit limits below" + if [ -n "$DOCKER_LOGIN$DOCKER_TOKEN" ]; then + docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN" + else + echo "Not login-in to docker since no credentials were provided, might hit limits below" + fi docker build \ -t dandiarchive/dandiarchive-api \ -f dev/django-public.Dockerfile \ From 1da1253e8afb8d0ed81a003d7f1a855281055088 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 19 Dec 2024 13:02:22 -0500 Subject: [PATCH 3/3] Use progressive form "logging in" Co-authored-by: John T. Wodder II --- .github/workflows/cli-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-integration.yml b/.github/workflows/cli-integration.yml index d32bdcf79..57fb3b7c8 100644 --- a/.github/workflows/cli-integration.yml +++ b/.github/workflows/cli-integration.yml @@ -22,7 +22,7 @@ jobs: if [ -n "$DOCKER_LOGIN$DOCKER_TOKEN" ]; then docker login -u "$DOCKER_LOGIN" --password-stdin <<<"$DOCKER_TOKEN" else - echo "Not login-in to docker since no credentials were provided, might hit limits below" + echo "Not logging in to docker since no credentials were provided, might hit limits below" fi docker build \ -t dandiarchive/dandiarchive-api \